File: new_class.cpp

package info (click to toggle)
codelite 14.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • 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 (209 lines) | stat: -rw-r--r-- 10,775 bytes parent folder | download | duplicates (5)
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
197
198
199
200
201
202
203
204
205
206
207
208
209
//////////////////////////////////////////////////////////////////////
// This file was auto-generated by codelite's wxCrafter Plugin
// wxCrafter project file: new_class.wxcp
// Do not modify this file by hand!
//////////////////////////////////////////////////////////////////////

#include "new_class.h"


// Declare the bitmap loading function
extern void wxC847AInitBitmapResources();

static bool bBitmapLoaded = false;


NewPHPClassBase::NewPHPClassBase(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);
        wxC847AInitBitmapResources();
        bBitmapLoaded = true;
    }
    
    wxBoxSizer* boxSizer2 = new wxBoxSizer(wxVERTICAL);
    this->SetSizer(boxSizer2);
    
    wxStaticBoxSizer* staticBoxSizer24 = new wxStaticBoxSizer( new wxStaticBox(this, wxID_ANY, _("General:")), wxVERTICAL);
    
    boxSizer2->Add(staticBoxSizer24, 0, wxALL|wxEXPAND, WXC_FROM_DIP(5));
    
    wxFlexGridSizer* flexGridSizer10 = new wxFlexGridSizer(0, 3, 0, 0);
    flexGridSizer10->SetFlexibleDirection( wxBOTH );
    flexGridSizer10->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
    flexGridSizer10->AddGrowableCol(1);
    
    staticBoxSizer24->Add(flexGridSizer10, 1, wxALL|wxEXPAND, WXC_FROM_DIP(5));
    
    m_staticText50 = new wxStaticText(this, wxID_ANY, _("Type:"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
    
    flexGridSizer10->Add(m_staticText50, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
    
    wxArrayString m_choiceTypeArr;
    m_choiceTypeArr.Add(wxT("class"));
    m_choiceTypeArr.Add(wxT("interface"));
    m_choiceTypeArr.Add(wxT("trait"));
    m_choiceType = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), m_choiceTypeArr, 0);
    m_choiceType->SetToolTip(_("Choose the object type"));
    m_choiceType->SetSelection(0);
    
    flexGridSizer10->Add(m_choiceType, 0, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
    
    flexGridSizer10->Add(0, 0, 1, wxALL, WXC_FROM_DIP(5));
    
    m_staticText12 = new wxStaticText(this, wxID_ANY, _("Name:"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
    
    flexGridSizer10->Add(m_staticText12, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
    
    m_textCtrlClassName = new wxTextCtrl(this, wxID_ANY, wxT(""), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
    m_textCtrlClassName->SetToolTip(_("The name"));
    m_textCtrlClassName->SetFocus();
    #if wxVERSION_NUMBER >= 3000
    m_textCtrlClassName->SetHint(wxT(""));
    #endif
    
    flexGridSizer10->Add(m_textCtrlClassName, 0, wxALL|wxEXPAND, WXC_FROM_DIP(5));
    
    flexGridSizer10->Add(0, 0, 1, wxALL, WXC_FROM_DIP(5));
    
    m_staticText16 = new wxStaticText(this, wxID_ANY, _("Namespace:"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
    
    flexGridSizer10->Add(m_staticText16, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
    
    m_textCtrlNamespace = new wxTextCtrl(this, wxID_ANY, wxT(""), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
    m_textCtrlNamespace->SetToolTip(_("If set, the generated code will be placed inside this namespace"));
    #if wxVERSION_NUMBER >= 3000
    m_textCtrlNamespace->SetHint(wxT(""));
    #endif
    
    flexGridSizer10->Add(m_textCtrlNamespace, 0, wxALL|wxEXPAND, WXC_FROM_DIP(5));
    
    flexGridSizer10->Add(0, 0, 1, wxALL, WXC_FROM_DIP(5));
    
    m_staticText74 = new wxStaticText(this, wxID_ANY, _("Extends:"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
    
    flexGridSizer10->Add(m_staticText74, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
    
    m_textCtrlExtends = new wxTextCtrl(this, wxID_ANY, wxT(""), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
    m_textCtrlExtends->SetToolTip(_("A comma separated list of parents for this class"));
    #if wxVERSION_NUMBER >= 3000
    m_textCtrlExtends->SetHint(wxT(""));
    #endif
    
    flexGridSizer10->Add(m_textCtrlExtends, 0, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
    
    m_button90 = new wxButton(this, wxID_ANY, _("..."), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), wxBU_EXACTFIT);
    m_button90->SetToolTip(_("Edit in a small text editor..."));
    
    flexGridSizer10->Add(m_button90, 0, wxALL, WXC_FROM_DIP(5));
    
    m_staticText78 = new wxStaticText(this, wxID_ANY, _("Implements:"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
    
    flexGridSizer10->Add(m_staticText78, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
    
    m_textCtrlImplements = new wxTextCtrl(this, wxID_ANY, wxT(""), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
    m_textCtrlImplements->SetToolTip(_("A comma separated list of interfaces for this class"));
    #if wxVERSION_NUMBER >= 3000
    m_textCtrlImplements->SetHint(wxT(""));
    #endif
    
    flexGridSizer10->Add(m_textCtrlImplements, 0, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
    
    m_button92 = new wxButton(this, wxID_ANY, _("..."), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), wxBU_EXACTFIT);
    m_button92->SetToolTip(_("Edit in a small text editor..."));
    
    flexGridSizer10->Add(m_button92, 0, wxALL, WXC_FROM_DIP(5));
    
    wxStaticBoxSizer* staticBoxSizer40 = new wxStaticBoxSizer( new wxStaticBox(this, wxID_ANY, _("Options:")), wxVERTICAL);
    
    boxSizer2->Add(staticBoxSizer40, 0, wxALL|wxEXPAND, WXC_FROM_DIP(5));
    
    wxFlexGridSizer* flexGridSizer46 = new wxFlexGridSizer(0, 2, 0, 0);
    flexGridSizer46->SetFlexibleDirection( wxBOTH );
    flexGridSizer46->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
    flexGridSizer46->AddGrowableCol(0);
    flexGridSizer46->AddGrowableCol(1);
    
    staticBoxSizer40->Add(flexGridSizer46, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, WXC_FROM_DIP(5));
    
    m_checkBoxCtor = new wxCheckBox(this, wxID_ANY, _("Generate consturctor"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
    m_checkBoxCtor->SetValue(true);
    
    flexGridSizer46->Add(m_checkBoxCtor, 0, wxALL|wxEXPAND, WXC_FROM_DIP(5));
    
    m_checkBoxDtor = new wxCheckBox(this, wxID_ANY, _("Generate desctructor"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
    m_checkBoxDtor->SetValue(false);
    
    flexGridSizer46->Add(m_checkBoxDtor, 0, wxALL|wxEXPAND, WXC_FROM_DIP(5));
    
    m_checkBoxFolderPerNamespace = new wxCheckBox(this, wxID_ANY, _("Create folder per namespace"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
    m_checkBoxFolderPerNamespace->SetValue(false);
    
    flexGridSizer46->Add(m_checkBoxFolderPerNamespace, 0, wxALL, WXC_FROM_DIP(5));
    
    m_checkBoxSingleton = new wxCheckBox(this, wxID_ANY, _("Make singleton (available for classes only)"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
    m_checkBoxSingleton->SetValue(false);
    m_checkBoxSingleton->SetToolTip(_("The generated class will be generated as a singleton\nclass"));
    
    flexGridSizer46->Add(m_checkBoxSingleton, 0, wxALL, WXC_FROM_DIP(5));
    
    boxSizer2->Add(0, 0, 1, wxALL, WXC_FROM_DIP(5));
    
    wxBoxSizer* boxSizer4 = new wxBoxSizer(wxHORIZONTAL);
    
    boxSizer2->Add(boxSizer4, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, WXC_FROM_DIP(5));
    
    m_buttonOK = new wxButton(this, wxID_OK, _("&OK"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
    m_buttonOK->SetDefault();
    
    boxSizer4->Add(m_buttonOK, 0, wxALL, WXC_FROM_DIP(5));
    
    m_buttonCancel = new wxButton(this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1,-1)), 0);
    
    boxSizer4->Add(m_buttonCancel, 0, wxALL, WXC_FROM_DIP(5));
    
    SetName(wxT("NewPHPClassBase"));
    SetSize(-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
    m_textCtrlClassName->Connect(wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler(NewPHPClassBase::OnClassNameUpdate), NULL, this);
    m_textCtrlNamespace->Connect(wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler(NewPHPClassBase::OnNamespaceTextUpdated), NULL, this);
    m_button90->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(NewPHPClassBase::OnEditExtends), NULL, this);
    m_button92->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(NewPHPClassBase::OnEditImplements), NULL, this);
    m_checkBoxCtor->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(NewPHPClassBase::OnMakeSingletonUI), NULL, this);
    m_checkBoxDtor->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(NewPHPClassBase::OnMakeSingletonUI), NULL, this);
    m_checkBoxFolderPerNamespace->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(NewPHPClassBase::OnFolderPerNamespace), NULL, this);
    m_checkBoxSingleton->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(NewPHPClassBase::OnMakeSingletonUI), NULL, this);
    m_buttonOK->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(NewPHPClassBase::OnOKUI), NULL, this);
    
}

NewPHPClassBase::~NewPHPClassBase()
{
    m_textCtrlClassName->Disconnect(wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler(NewPHPClassBase::OnClassNameUpdate), NULL, this);
    m_textCtrlNamespace->Disconnect(wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler(NewPHPClassBase::OnNamespaceTextUpdated), NULL, this);
    m_button90->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(NewPHPClassBase::OnEditExtends), NULL, this);
    m_button92->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(NewPHPClassBase::OnEditImplements), NULL, this);
    m_checkBoxCtor->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(NewPHPClassBase::OnMakeSingletonUI), NULL, this);
    m_checkBoxDtor->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(NewPHPClassBase::OnMakeSingletonUI), NULL, this);
    m_checkBoxFolderPerNamespace->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(NewPHPClassBase::OnFolderPerNamespace), NULL, this);
    m_checkBoxSingleton->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(NewPHPClassBase::OnMakeSingletonUI), NULL, this);
    m_buttonOK->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(NewPHPClassBase::OnOKUI), NULL, this);
    
}