~efargaspro/+junk/codeblocks-16.01-release

« back to all changes in this revision

Viewing changes to src/templates/common/wx-main-ash.cpp

  • Committer: damienlmoore at gmail
  • Date: 2016-02-02 02:43:22 UTC
  • Revision ID: damienlmoore@gmail.com-20160202024322-yql5qmtbwdyamdwd
Code::BlocksĀ 16.01

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "main.h"
 
2
 
 
3
//helper functions
 
4
enum wxbuildinfoformat {
 
5
    short_f, long_f };
 
6
 
 
7
wxString wxbuildinfo(wxbuildinfoformat format)
 
8
{
 
9
    wxString wxbuild(wxVERSION_STRING);
 
10
 
 
11
    if (format == long_f )
 
12
    {
 
13
#if defined(__WXMSW__)
 
14
        wxbuild << _T("-Windows");
 
15
#elif defined(__UNIX__)
 
16
        wxbuild << _T("-Linux");
 
17
#endif
 
18
 
 
19
#if wxUSE_UNICODE
 
20
        wxbuild << _T("-unicode build");
 
21
#else
 
22
        wxbuild << _T("-ANSI build");
 
23
#endif // wxUSE_UNICODE
 
24
    }
 
25
 
 
26
    return wxbuild;
 
27
}
 
28
 
 
29
int idMenuQuit = wxNewId();
 
30
int idMenuAbout = wxNewId();
 
31
 
 
32
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
 
33
    EVT_MENU(idMenuQuit, MyFrame::OnQuit)
 
34
    EVT_MENU(idMenuAbout, MyFrame::OnAbout)
 
35
END_EVENT_TABLE()
 
36
 
 
37
MyFrame::MyFrame(wxFrame *frame, const wxString& title)
 
38
    : wxFrame(frame, -1, title)
 
39
{
 
40
#if wxUSE_MENUS
 
41
    // create a menu bar
 
42
    wxMenuBar* mbar = new wxMenuBar();
 
43
    wxMenu* fileMenu = new wxMenu(_T(""));
 
44
    fileMenu->Append(idMenuQuit, _("&Quit\tAlt-F4"), _("Quit the application"));
 
45
    mbar->Append(fileMenu, _("&File"));
 
46
 
 
47
    wxMenu* helpMenu = new wxMenu(_T(""));
 
48
    helpMenu->Append(idMenuAbout, _("&About\tF1"), _("Show info about this application"));
 
49
    mbar->Append(helpMenu, _("&Help"));
 
50
 
 
51
    SetMenuBar(mbar);
 
52
#endif // wxUSE_MENUS
 
53
 
 
54
#if wxUSE_STATUSBAR
 
55
    // create a status bar with some information about the used wxWidgets version
 
56
    CreateStatusBar(2);
 
57
    SetStatusText(_("Hello Code::Blocks user !"),0);
 
58
    SetStatusText(wxbuildinfo(short_f),1);
 
59
#endif // wxUSE_STATUSBAR
 
60
}
 
61
 
 
62
MyFrame::~MyFrame()
 
63
{
 
64
}
 
65
 
 
66
void MyFrame::OnQuit(wxCommandEvent& event)
 
67
{
 
68
    Close();
 
69
}
 
70
 
 
71
void MyFrame::OnAbout(wxCommandEvent& event)
 
72
{
 
73
    wxString msg = wxbuildinfo(long_f);
 
74
    wxMessageBox(msg, _("Welcome to..."));
 
75
}
 
76