File: wxcrafter.cpp

package info (click to toggle)
codelite 14.0+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 112,816 kB
  • sloc: cpp: 483,662; ansic: 150,144; php: 9,569; lex: 4,186; python: 3,417; yacc: 2,820; sh: 1,147; makefile: 52; xml: 13
file content (196 lines) | stat: -rw-r--r-- 8,144 bytes parent folder | download
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
//////////////////////////////////////////////////////////////////////
// This file was auto-generated by codelite's wxCrafter Plugin
// wxCrafter project file: wxcrafter.wxcp
// Do not modify this file by hand!
//////////////////////////////////////////////////////////////////////

#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;
    }
    // Set icon(s) to the application/dialog
    wxIconBundle app_icons;
    {
        wxBitmap iconBmp = wxXmlResource::Get()->LoadBitmap(wxT("terminal-16"));
        wxIcon icn;
        icn.CopyFromBitmap(iconBmp);
        app_icons.AddIcon(icn);
    }
    {
        wxBitmap iconBmp = wxXmlResource::Get()->LoadBitmap(wxT("terminal-32"));
        wxIcon icn;
        icn.CopyFromBitmap(iconBmp);
        app_icons.AddIcon(icn);
    }
    SetIcons(app_icons);

    wxBoxSizer* boxSizer1 = new wxBoxSizer(wxVERTICAL);
    this->SetSizer(boxSizer1);

    m_mainPanel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(this, wxSize(500, 300)), wxTAB_TRAVERSAL);

    boxSizer1->Add(m_mainPanel, 1, wxEXPAND, WXC_FROM_DIP(0));

    wxBoxSizer* boxSizer11 = new wxBoxSizer(wxVERTICAL);
    m_mainPanel->SetSizer(boxSizer11);

    m_menuBar = new wxMenuBar(0);
    this->SetMenuBar(m_menuBar);

    m_File = new wxMenu();
    m_menuBar->Append(m_File, _("File"));

    m_menuItemClearScreen = new wxMenuItem(m_File, wxID_CLEAR, _("Clear screen\tCtrl-L"), wxT(""), wxITEM_NORMAL);
    m_File->Append(m_menuItemClearScreen);

    m_File->AppendSeparator();

    m_menuItemPreferences = new wxMenuItem(m_File, wxID_PREFERENCES, _("Preferences..."), wxT(""), wxITEM_NORMAL);
    m_File->Append(m_menuItemPreferences);

    m_File->AppendSeparator();

    m_menuItemExit = new wxMenuItem(m_File, wxID_EXIT, _("Exit\tAlt-X"), _("Quit"), wxITEM_NORMAL);
    m_File->Append(m_menuItemExit);

    m_Help = new wxMenu();
    m_menuBar->Append(m_Help, _("Help"));

    m_menuItem9 = new wxMenuItem(m_Help, wxID_ABOUT, _("About..."), wxT(""), wxITEM_NORMAL);
    m_Help->Append(m_menuItem9);

    SetName(wxT("MainFrameBaseClass"));
    SetSize(wxDLG_UNIT(this, wxSize(-1, -1)));
    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
    // Connect events
    this->Connect(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(MainFrameBaseClass::OnClose), NULL, this);
    this->Connect(m_menuItemClearScreen->GetId(), wxEVT_COMMAND_MENU_SELECTED,
                  wxCommandEventHandler(MainFrameBaseClass::OnClearScreen), NULL, this);
    this->Connect(m_menuItemPreferences->GetId(), wxEVT_COMMAND_MENU_SELECTED,
                  wxCommandEventHandler(MainFrameBaseClass::OnSettings), NULL, this);
    this->Connect(m_menuItemExit->GetId(), wxEVT_COMMAND_MENU_SELECTED,
                  wxCommandEventHandler(MainFrameBaseClass::OnExit), NULL, this);
    this->Connect(m_menuItem9->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrameBaseClass::OnAbout),
                  NULL, this);
}

MainFrameBaseClass::~MainFrameBaseClass()
{
    this->Disconnect(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(MainFrameBaseClass::OnClose), NULL, this);
    this->Disconnect(m_menuItemClearScreen->GetId(), wxEVT_COMMAND_MENU_SELECTED,
                     wxCommandEventHandler(MainFrameBaseClass::OnClearScreen), NULL, this);
    this->Disconnect(m_menuItemPreferences->GetId(), wxEVT_COMMAND_MENU_SELECTED,
                     wxCommandEventHandler(MainFrameBaseClass::OnSettings), NULL, this);
    this->Disconnect(m_menuItemExit->GetId(), wxEVT_COMMAND_MENU_SELECTED,
                     wxCommandEventHandler(MainFrameBaseClass::OnExit), NULL, this);
    this->Disconnect(m_menuItem9->GetId(), wxEVT_COMMAND_MENU_SELECTED,
                     wxCommandEventHandler(MainFrameBaseClass::OnAbout), NULL, this);
}

SettingsDlgBase::SettingsDlgBase(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos,
                                 const wxSize& size, long style)
    : wxDialog(parent, id, title, pos, size, style)
{
    if(!bBitmapLoaded) {
        // We need to initialise the default bitmap handler
        wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler);
        wxC9ED9InitBitmapResources();
        bBitmapLoaded = true;
    }

    wxBoxSizer* boxSizer27 = new wxBoxSizer(wxVERTICAL);
    this->SetSizer(boxSizer27);

    wxFlexGridSizer* flexGridSizer29 = new wxFlexGridSizer(0, 2, 0, 0);
    flexGridSizer29->SetFlexibleDirection(wxBOTH);
    flexGridSizer29->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
    flexGridSizer29->AddGrowableCol(1);

    boxSizer27->Add(flexGridSizer29, 1, wxALL | wxEXPAND, WXC_FROM_DIP(5));

    m_staticText31 =
        new wxStaticText(this, wxID_ANY, _("Text Colour:"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);

    flexGridSizer29->Add(m_staticText31, 0, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));

    m_colourPickerFG = new wxColourPickerCtrl(this, wxID_ANY, wxColour(wxT("rgb(255,255,255)")), wxDefaultPosition,
                                              wxDLG_UNIT(this, wxSize(-1, -1)), wxCLRP_DEFAULT_STYLE);

    flexGridSizer29->Add(m_colourPickerFG, 0, wxALL | wxEXPAND, WXC_FROM_DIP(5));

    m_staticText35 = new wxStaticText(this, wxID_ANY, _("Background Colour:"), wxDefaultPosition,
                                      wxDLG_UNIT(this, wxSize(-1, -1)), 0);

    flexGridSizer29->Add(m_staticText35, 0, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));

    m_colourPickerBG = new wxColourPickerCtrl(this, wxID_ANY, wxColour(wxT("rgb(32,32,32)")), wxDefaultPosition,
                                              wxDLG_UNIT(this, wxSize(-1, -1)), wxCLRP_DEFAULT_STYLE);

    flexGridSizer29->Add(m_colourPickerBG, 0, wxALL | wxEXPAND, WXC_FROM_DIP(5));

    m_staticText39 =
        new wxStaticText(this, wxID_ANY, _("Font:"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);

    flexGridSizer29->Add(m_staticText39, 0, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));

    m_fontPicker = new wxFontPickerCtrl(this, wxID_ANY, wxNullFont, wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)),
                                        wxFNTP_DEFAULT_STYLE);

    flexGridSizer29->Add(m_fontPicker, 0, wxALL | wxEXPAND, WXC_FROM_DIP(5));

    wxBoxSizer* boxSizer43 = new wxBoxSizer(wxHORIZONTAL);

    boxSizer27->Add(boxSizer43, 0, wxALL | wxALIGN_CENTER_HORIZONTAL, WXC_FROM_DIP(5));

    m_button45 = new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);

    boxSizer43->Add(m_button45, 0, wxALL, WXC_FROM_DIP(5));

    m_button47 = new wxButton(this, wxID_OK, _("&OK"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), 0);
    m_button47->SetFocus();

    boxSizer43->Add(m_button47, 0, wxALL, WXC_FROM_DIP(5));

    SetName(wxT("SettingsDlgBase"));
    SetSize(wxDLG_UNIT(this, wxSize(-1, -1)));
    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
}

SettingsDlgBase::~SettingsDlgBase() {}