-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwxcrafter.cpp
More file actions
110 lines (86 loc) · 4.57 KB
/
wxcrafter.cpp
File metadata and controls
110 lines (86 loc) · 4.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
//////////////////////////////////////////////////////////////////////
// This file was auto-generated by codelite's wxCrafter Plugin
// wxCrafter project file: wxcrafter.wxcp
// Do not modify this file by hand!
//////////////////////////////////////////////////////////////////////
#include <wx/wx.h>
#include <wx/event.h>
#include <wx/accel.h>
#include "wx/artprov.h"
#include "wxcrafter.h"
// Declare the bitmap loading function
extern void wxC9ED9InitBitmapResources();
static bool bBitmapLoaded = false;
MainFrameBaseClass::MainFrameBaseClass(wxWindow* parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style)
: wxFrame(parent, id, title, pos, size, style)
{
if ( !bBitmapLoaded ) {
// We need to initialise the default bitmap handler
wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler);
wxC9ED9InitBitmapResources();
bBitmapLoaded = true;
}
SetBackgroundColour(wxColour(* wxWHITE));
m_menuBar = new wxMenuBar(0);
this->SetMenuBar(m_menuBar);
m_menu_File = new wxMenu();
m_menuBar->Append(m_menu_File, _("File"));
m_menuItem_Refresh = new wxMenuItem(m_menu_File, wxID_REFRESH, _("Refresh\tAlt-SPACE"), wxT(""), wxITEM_NORMAL);
m_menuItem_Refresh->SetBitmap(wxArtProvider::GetIcon(wxART_REDO, wxART_MENU));
m_menu_File->Append(m_menuItem_Refresh);
m_menuItem_Exit = new wxMenuItem(m_menu_File, wxID_EXIT, _("Exit\tAlt-X"), _("Quit"), wxITEM_NORMAL);
m_menuItem_Exit->SetBitmap(wxArtProvider::GetIcon(wxART_QUIT, wxART_MENU));
m_menu_File->Append(m_menuItem_Exit);
m_menu_Help = new wxMenu();
m_menuBar->Append(m_menu_Help, _("Help"));
m_menuItem_Credits = new wxMenuItem(m_menu_Help, wxID_CREDITS, _("Credits"), wxT(""), wxITEM_NORMAL);
m_menuItem_Credits->SetBitmap(wxArtProvider::GetIcon(wxART_INFORMATION, wxART_MENU));
m_menu_Help->Append(m_menuItem_Credits);
m_menuItem_About = new wxMenuItem(m_menu_Help, wxID_ABOUT, _("About..."), wxT(""), wxITEM_NORMAL);
m_menuItem_About->SetBitmap(wxArtProvider::GetIcon(wxART_QUESTION, wxART_MENU));
m_menu_Help->Append(m_menuItem_About);
m_timer = new wxTimer(this, wxID_TIMER);
SetName(wxT("MainFrameBaseClass"));
if (GetSizer()) {
GetSizer()->Fit(this);
}
if(GetParent()) {
CentreOnParent(wxBOTH);
} else {
CentreOnScreen(wxBOTH);
}
#if wxVERSION_NUMBER >= 2900
if(!wxPersistenceManager::Get().Find(this)) {
wxPersistenceManager::Get().RegisterAndRestore(this);
} else {
wxPersistenceManager::Get().Restore(this);
}
#endif
// Set up an accelerator for the Enter key
// (Works on Linux but not windows!)
wxAcceleratorEntry entries[1];
entries[0].Set(wxACCEL_NORMAL, WXK_RETURN, wxID_REFRESH);
wxAcceleratorTable accel(WXSIZEOF(entries), entries);
SetAcceleratorTable(accel);
// Connect events
this->Connect(m_menuItem_Refresh->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrameBaseClass::OnRefresh), NULL, this);
this->Connect(m_menuItem_Exit->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrameBaseClass::OnExit), NULL, this);
this->Connect(m_menuItem_About->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrameBaseClass::OnAbout), NULL, this);
this->Connect(m_menuItem_Credits->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrameBaseClass::OnCredits), NULL, this);
this->Connect(m_timer->GetId(), wxEVT_TIMER, wxTimerEventHandler( MainFrameBaseClass::OnProbeAll ), NULL, this );
this->Connect(wxID_ANY, wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainFrameBaseClass::OnClose), NULL, this);
}
MainFrameBaseClass::~MainFrameBaseClass()
{
this->Disconnect(m_menuItem_Refresh->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrameBaseClass::OnRefresh), NULL, this);
this->Disconnect(m_menuItem_Exit->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrameBaseClass::OnExit), NULL, this);
this->Disconnect(m_menuItem_About->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrameBaseClass::OnAbout), NULL, this);
this->Disconnect(m_menuItem_Credits->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrameBaseClass::OnCredits), NULL, this);
this->Disconnect(wxID_TIMER, wxEVT_TIMER, wxTimerEventHandler( MainFrameBaseClass::OnProbeAll ), NULL, this );
this->Disconnect(wxID_ANY, wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainFrameBaseClass::OnClose), NULL, this);
}