]>
Commit | Line | Data |
---|---|---|
f978831f BP |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: guiframe.cpp | |
3 | // Purpose: Implement the Application Frame | |
4 | // Author: Utensil Candel (UtensilCandel@@gmail.com) | |
526954c5 | 5 | // Licence: wxWindows licence |
f978831f | 6 | ///////////////////////////////////////////////////////////////////////////// |
0d5eda9c FM |
7 | |
8 | // For compilers that support precompilation, includes "wx/wx.h". | |
9 | #include "wx/wxprec.h" | |
10 | ||
11 | #ifdef __BORLANDC__ | |
12 | #pragma hdrstop | |
13 | #endif | |
14 | ||
4bae10bd | 15 | // for all others, include the necessary headers wxWidgets headers) |
0d5eda9c FM |
16 | #ifndef WX_PRECOMP |
17 | #include "wx/wx.h" | |
18 | #endif | |
19 | ||
f978831f BP |
20 | #include "guiframe.h" |
21 | ||
0d5eda9c FM |
22 | /////////////////////////////////////////////////////////////////////////// |
23 | ||
24 | GUIFrame::GUIFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) | |
25 | { | |
f978831f | 26 | this->SetSizeHints( wxDefaultSize, wxDefaultSize ); |
51d48751 FM |
27 | |
28 | AddMenuBar(); | |
29 | ||
30 | wxBoxSizer* bSizer0; | |
31 | bSizer0 = new wxBoxSizer( wxVERTICAL ); | |
32 | m_notebook1 = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); | |
33 | ||
34 | //Add panels into m_notebook1 | |
35 | ||
36 | //Tiny Controls | |
37 | AddPanel_1(); | |
38 | //Multiple choice Controls | |
39 | AddPanel_2(); | |
40 | //[Rich]Text Controls | |
41 | AddPanel_3(); | |
42 | //Picker Controls | |
43 | AddPanel_4(); | |
44 | //Drop-down Controls | |
45 | AddPanel_5(); | |
46 | ||
ecba92ec FM |
47 | m_notebook1->ChangeSelection(0); |
48 | ||
51d48751 FM |
49 | bSizer0->Add( m_notebook1, 1, wxEXPAND | wxALL, 0 ); |
50 | ||
51 | this->SetSizer( bSizer0 ); | |
52 | this->Layout(); | |
53 | bSizer0->Fit( this ); | |
54 | statusBar = this->CreateStatusBar( 1, wxST_SIZEGRIP, wxID_ANY ); | |
55 | ||
56 | // Connect Events | |
57 | this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( GUIFrame::OnClose ) ); | |
51d48751 FM |
58 | } |
59 | ||
60 | void GUIFrame::AddMenuBar() | |
61 | { | |
f978831f | 62 | mbar = new wxMenuBar( 0 ); |
51d48751 FM |
63 | |
64 | //File Menu | |
f978831f | 65 | fileMenu = new wxMenu(); |
51d48751 | 66 | |
f978831f | 67 | wxMenuItem* m_menuSeeScr; |
9a83f860 | 68 | m_menuSeeScr = new wxMenuItem( fileMenu, wxID_ZOOM_IN, wxString( _("&Open screenshots folder...") ) + wxT('\t') + wxT("Ctrl+O"), _("Opens the directory where the screenshots are saved."), wxITEM_NORMAL ); |
f978831f | 69 | fileMenu->Append( m_menuSeeScr ); |
51d48751 | 70 | |
f978831f | 71 | fileMenu->AppendSeparator(); |
51d48751 | 72 | |
f978831f | 73 | wxMenuItem* m_menuFileQuit; |
9a83f860 | 74 | m_menuFileQuit = new wxMenuItem( fileMenu, wxID_EXIT, wxString( _("&Quit") ) + wxT('\t') + wxT("Alt+F4"), _("Quits the application."), wxITEM_NORMAL ); |
f978831f | 75 | fileMenu->Append( m_menuFileQuit ); |
51d48751 | 76 | |
f978831f | 77 | mbar->Append( fileMenu, _("&File") ); |
51d48751 FM |
78 | |
79 | //Capture Menu | |
f978831f | 80 | captureMenu = new wxMenu(); |
51d48751 | 81 | |
f978831f | 82 | wxMenuItem* m_menuCapFullScreen; |
9a83f860 | 83 | m_menuCapFullScreen = new wxMenuItem( captureMenu, idMenuCapFullScreen, wxString( _("&Full Screen") ) + wxT('\t') + wxT("Ctrl+Alt+F"), _("Takes a screenshot of the entire screen."), wxITEM_NORMAL ); |
f978831f | 84 | captureMenu->Append( m_menuCapFullScreen ); |
51d48751 | 85 | |
f978831f | 86 | wxMenuItem* m_menuCapAll; |
9a83f860 | 87 | m_menuCapAll = new wxMenuItem( captureMenu, idMenuCapAll, wxString( _("Capture All") ) + wxT('\t') + wxT("Ctrl+Alt+A"), _("Takes screenshots for all controls automatically."), wxITEM_NORMAL ); |
f978831f | 88 | captureMenu->Append( m_menuCapAll ); |
51d48751 | 89 | |
f978831f | 90 | mbar->Append( captureMenu, _("&Capture") ); |
51d48751 FM |
91 | |
92 | //Help Menu | |
f978831f BP |
93 | helpMenu = new wxMenu(); |
94 | wxMenuItem* m_menuHelpAbout; | |
2d143b66 | 95 | m_menuHelpAbout = new wxMenuItem( helpMenu, wxID_ABOUT, wxString( _("&About") ) + wxT('\t') + wxT("F1"), _("Shows info about this application."), wxITEM_NORMAL ); |
f978831f | 96 | helpMenu->Append( m_menuHelpAbout ); |
51d48751 | 97 | |
f978831f | 98 | mbar->Append( helpMenu, _("&Help") ); |
51d48751 | 99 | |
f978831f | 100 | this->SetMenuBar( mbar ); |
51d48751 FM |
101 | |
102 | // Connect Events | |
ce7fe42e VZ |
103 | this->Connect( m_menuSeeScr->GetId(), wxEVT_MENU, wxCommandEventHandler( GUIFrame::OnSeeScreenshots ) ); |
104 | this->Connect( m_menuFileQuit->GetId(), wxEVT_MENU, wxCommandEventHandler( GUIFrame::OnQuit ) ); | |
105 | this->Connect( m_menuCapFullScreen->GetId(), wxEVT_MENU, wxCommandEventHandler( GUIFrame::OnCaptureFullScreen ) ); | |
106 | this->Connect( m_menuCapAll->GetId(), wxEVT_MENU, wxCommandEventHandler( GUIFrame::OnCaptureAllControls ) ); | |
107 | this->Connect( m_menuHelpAbout->GetId(), wxEVT_MENU, wxCommandEventHandler( GUIFrame::OnAbout ) ); | |
51d48751 FM |
108 | } |
109 | ||
110 | void GUIFrame::AddPanel_1() | |
111 | { | |
f978831f | 112 | m_panel1 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); |
51d48751 | 113 | |
f978831f | 114 | wxFlexGridSizer* fgSizer1; |
51d48751 | 115 | fgSizer1 = new wxFlexGridSizer( 0, 2, 0, 0 ); |
f978831f BP |
116 | fgSizer1->SetFlexibleDirection( wxBOTH ); |
117 | fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_NONE ); | |
51d48751 | 118 | |
f978831f BP |
119 | m_button1 = new wxButton( m_panel1, wxID_ANY, _("wxButton"), wxDefaultPosition, wxDefaultSize, 0 ); |
120 | fgSizer1->Add( m_button1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); | |
51d48751 | 121 | |
f978831f BP |
122 | m_staticText1 = new wxStaticText( m_panel1, wxID_ANY, _("wxStaticText"), wxDefaultPosition, wxDefaultSize, 0 ); |
123 | m_staticText1->Wrap( -1 ); | |
124 | fgSizer1->Add( m_staticText1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); | |
51d48751 | 125 | |
f978831f BP |
126 | m_checkBox1 = new wxCheckBox( m_panel1, wxID_ANY, _("Checked"), wxDefaultPosition, wxDefaultSize, 0 ); |
127 | m_checkBox1->SetValue(true); | |
f978831f | 128 | m_checkBox1->SetToolTip( _("wxCheckBox") ); |
f978831f | 129 | fgSizer1->Add( m_checkBox1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); |
51d48751 | 130 | |
f978831f | 131 | m_checkBox2 = new wxCheckBox( m_panel1, wxID_ANY, _("Unchecked"), wxDefaultPosition, wxDefaultSize, 0 ); |
f978831f | 132 | m_checkBox2->SetToolTip( _("wxCheckBox") ); |
f978831f | 133 | fgSizer1->Add( m_checkBox2, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 20 ); |
51d48751 | 134 | |
ecba92ec FM |
135 | /* |
136 | NB: under wxGTK for the radio button "unchecked" to be unchecked, it's | |
137 | important to put the wxRB_GROUP style on the first wxRadioButton | |
138 | (the one "checked") and no flags on the second one. | |
139 | */ | |
f978831f | 140 | m_radioBtn1 = new wxRadioButton( m_panel1, wxID_ANY, _("Checked"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); |
51d48751 | 141 | m_radioBtn1->SetValue( true ); |
f978831f | 142 | m_radioBtn1->SetToolTip( _("wxRadioButton") ); |
f978831f | 143 | fgSizer1->Add( m_radioBtn1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); |
51d48751 | 144 | |
f978831f BP |
145 | m_radioBtn2 = new wxRadioButton( m_panel1, wxID_ANY, _("Unchecked"), wxDefaultPosition, wxDefaultSize, 0 ); |
146 | m_radioBtn2->SetToolTip( _("wxRadioButton") ); | |
f978831f | 147 | fgSizer1->Add( m_radioBtn2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); |
51d48751 | 148 | |
9a83f860 | 149 | m_bpButton1 = new wxBitmapButton( m_panel1, wxID_ANY, wxBitmap( wxT("bitmaps/wxwin32x32.png"), wxBITMAP_TYPE_ANY ), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW ); |
f978831f | 150 | m_bpButton1->SetToolTip( _("wxBitmapButton") ); |
f978831f | 151 | m_bpButton1->SetToolTip( _("wxBitmapButton") ); |
f978831f | 152 | fgSizer1->Add( m_bpButton1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); |
51d48751 | 153 | |
9a83f860 | 154 | m_bitmap1 = new wxStaticBitmap( m_panel1, wxID_ANY, wxBitmap( wxT("bitmaps/wxwin32x32.png"), wxBITMAP_TYPE_ANY ), wxDefaultPosition, wxDefaultSize, 0 ); |
f978831f | 155 | m_bitmap1->SetToolTip( _("wxStaticBitmap") ); |
f978831f | 156 | fgSizer1->Add( m_bitmap1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); |
51d48751 | 157 | |
9a83f860 | 158 | m_gauge1 = new wxGauge( m_panel1, wxID_ANY, 100, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL, wxDefaultValidator, wxT("_Gauge") ); |
51d48751 | 159 | m_gauge1->SetValue( 50 ); |
f978831f | 160 | m_gauge1->SetToolTip( _("wxGauge") ); |
f978831f | 161 | fgSizer1->Add( m_gauge1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 20 ); |
51d48751 | 162 | |
f978831f BP |
163 | m_slider1 = new wxSlider( m_panel1, wxID_ANY, 50, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL ); |
164 | m_slider1->SetToolTip( _("wxSlider") ); | |
f978831f | 165 | fgSizer1->Add( m_slider1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 20 ); |
51d48751 | 166 | |
f978831f BP |
167 | m_toggleBtn1 = new wxToggleButton( m_panel1, wxID_ANY, _("Untoggled"), wxDefaultPosition, wxDefaultSize, 0 ); |
168 | m_toggleBtn1->SetToolTip( _("wxToggleButton") ); | |
f978831f | 169 | fgSizer1->Add( m_toggleBtn1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); |
51d48751 | 170 | |
f978831f | 171 | m_toggleBtn2 = new wxToggleButton( m_panel1, wxID_ANY, _("Toggled"), wxDefaultPosition, wxDefaultSize, 0 ); |
51d48751 | 172 | m_toggleBtn2->SetValue( true ); |
f978831f | 173 | m_toggleBtn2->SetToolTip( _("wxToggleButton") ); |
f978831f | 174 | fgSizer1->Add( m_toggleBtn2, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 20 ); |
51d48751 | 175 | |
9a83f860 | 176 | m_hyperlink1 = new wxHyperlinkCtrl( m_panel1, wxID_ANY, _("www.wxwidgets.org"), wxT("http://www.wxwidgets.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); |
f978831f | 177 | m_hyperlink1->SetToolTip( _("wxHyperlinkCtrl") ); |
f978831f | 178 | fgSizer1->Add( m_hyperlink1, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 20 ); |
51d48751 | 179 | |
9a83f860 | 180 | m_spinCtrl1 = new wxSpinCtrl( m_panel1, wxID_ANY, wxT("5"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 10, 0 ); |
f978831f | 181 | m_spinCtrl1->SetToolTip( _("wxSpinCtrl") ); |
f978831f | 182 | fgSizer1->Add( m_spinCtrl1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); |
51d48751 | 183 | |
f978831f BP |
184 | m_spinBtn1 = new wxSpinButton( m_panel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); |
185 | m_spinBtn1->SetToolTip( _("wxSpinButton") ); | |
f978831f | 186 | fgSizer1->Add( m_spinBtn1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); |
51d48751 | 187 | |
f978831f | 188 | m_scrollBar1 = new wxScrollBar( m_panel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSB_HORIZONTAL ); |
ecba92ec | 189 | m_scrollBar1->SetScrollbar(50, 1, 100, 1); |
f978831f | 190 | m_scrollBar1->SetToolTip( _("wxScrollBar") ); |
f978831f | 191 | fgSizer1->Add( m_scrollBar1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 20 ); |
51d48751 | 192 | |
f978831f BP |
193 | m_panel1->SetSizer( fgSizer1 ); |
194 | m_panel1->Layout(); | |
195 | fgSizer1->Fit( m_panel1 ); | |
196 | m_notebook1->AddPage( m_panel1, _("Tiny Controls"), true ); | |
51d48751 FM |
197 | } |
198 | ||
199 | void GUIFrame::AddPanel_2() | |
200 | { | |
f978831f | 201 | m_panel2 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); |
51d48751 | 202 | |
f978831f | 203 | wxFlexGridSizer* fgSizer2; |
51d48751 | 204 | fgSizer2 = new wxFlexGridSizer( 0, 2, 0, 0 ); |
f978831f BP |
205 | fgSizer2->SetFlexibleDirection( wxBOTH ); |
206 | fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); | |
51d48751 | 207 | |
f978831f BP |
208 | wxString m_checkList1Choices[] = { _("wxCheckListBox"), _("Item1"), _("Item2") }; |
209 | int m_checkList1NChoices = sizeof( m_checkList1Choices ) / sizeof( wxString ); | |
210 | m_checkList1 = new wxCheckListBox( m_panel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_checkList1NChoices, m_checkList1Choices, 0 ); | |
ecba92ec | 211 | m_checkList1->Check(0); |
f978831f | 212 | fgSizer2->Add( m_checkList1, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); |
51d48751 | 213 | |
f978831f BP |
214 | m_listBox1 = new wxListBox( m_panel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); |
215 | m_listBox1->Append( _("wxListBox") ); | |
216 | m_listBox1->Append( _("Item1") ); | |
217 | m_listBox1->Append( _("Item2") ); | |
218 | fgSizer2->Add( m_listBox1, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); | |
51d48751 | 219 | |
f978831f BP |
220 | wxString m_radioBox1Choices[] = { _("Item1"), _("Item2") }; |
221 | int m_radioBox1NChoices = sizeof( m_radioBox1Choices ) / sizeof( wxString ); | |
222 | m_radioBox1 = new wxRadioBox( m_panel2, wxID_ANY, _("wxRadioBox"), wxDefaultPosition, wxDefaultSize, m_radioBox1NChoices, m_radioBox1Choices, 1, wxRA_SPECIFY_COLS ); | |
223 | m_radioBox1->SetSelection( 0 ); | |
224 | fgSizer2->Add( m_radioBox1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); | |
51d48751 | 225 | |
f978831f | 226 | m_staticBox1 = new wxStaticBox(m_panel2,wxID_ANY, _("wxStaticBox"), wxDefaultPosition, wxDefaultSize, 0, _("_StaticBox")); |
f978831f | 227 | fgSizer2->Add( m_staticBox1, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 20 ); |
51d48751 | 228 | |
f978831f | 229 | m_treeCtrl1 = new wxTreeCtrl( m_panel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE|wxSUNKEN_BORDER ); |
ecba92ec FM |
230 | wxTreeItemId root = m_treeCtrl1->AddRoot(_("wxTreeCtrl")); |
231 | m_treeCtrl1->AppendItem(root, _("Node1")); | |
232 | wxTreeItemId node2 = m_treeCtrl1->AppendItem(root, _("Node2")); | |
233 | m_treeCtrl1->AppendItem(node2, _("Node3")); | |
234 | m_treeCtrl1->ExpandAll(); | |
f978831f | 235 | fgSizer2->Add( m_treeCtrl1, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); |
51d48751 | 236 | |
015fba49 | 237 | m_listCtrl1 = new wxListCtrl( m_panel2, wxID_ANY, wxDefaultPosition, wxSize(220,120), wxLC_REPORT|wxSUNKEN_BORDER ); |
ecba92ec FM |
238 | m_listCtrl1->InsertColumn(0, "Names"); |
239 | m_listCtrl1->InsertColumn(1, "Values"); | |
240 | for(long index = 0; index < 5; index++) { | |
241 | m_listCtrl1->InsertItem( index, wxString::Format(_("Item%d"),index)); | |
242 | m_listCtrl1->SetItem(index, 1, wxString::Format("%d", index)); | |
243 | } | |
f978831f | 244 | m_listCtrl1->SetToolTip( _("wxListCtrl") ); |
f978831f | 245 | fgSizer2->Add( m_listCtrl1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 20 ); |
51d48751 | 246 | |
f978831f BP |
247 | m_animationCtrl1 = new wxAnimationCtrl(m_panel2, wxID_ANY); |
248 | m_animationCtrl1->SetToolTip(_("wxAnimationCtrl")); | |
9a83f860 | 249 | if (m_animationCtrl1->LoadFile(wxT("bitmaps/throbber.gif"))) |
f978831f BP |
250 | m_animationCtrl1->Play(); |
251 | fgSizer2->Add( m_animationCtrl1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); | |
51d48751 FM |
252 | |
253 | //wxCollapsiblePane 1 | |
9a83f860 | 254 | m_collPane1 = new wxCollapsiblePane(m_panel2, -1, wxT("Collapsed")); |
f978831f BP |
255 | wxWindow *win = m_collPane1->GetPane(); |
256 | m_collPane1->SetToolTip(_("wxCollapsiblePane")); | |
51d48751 | 257 | |
f978831f | 258 | wxBoxSizer * collbSizer = new wxBoxSizer(wxVERTICAL); |
9a83f860 VZ |
259 | wxStaticText* m_collSText = new wxStaticText(win, -1, wxT("You can place")); |
260 | wxButton* m_collBut = new wxButton(win, -1, wxT("anything")); | |
261 | wxTextCtrl* m_collText = new wxTextCtrl(win, -1, wxT("inside a wxCollapsiblePane")); | |
f978831f BP |
262 | collbSizer->Add( m_collSText, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0 ); |
263 | collbSizer->Add( m_collBut, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0 ); | |
264 | collbSizer->Add( m_collText, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0 ); | |
265 | win->SetSizer(collbSizer); | |
266 | fgSizer2->Add( m_collPane1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); | |
51d48751 FM |
267 | |
268 | //wxCollapsiblePane 2 | |
9a83f860 | 269 | m_collPane2 = new wxCollapsiblePane(m_panel2, -1, wxT("Expanded")); |
f978831f BP |
270 | wxWindow *win2 = m_collPane2->GetPane(); |
271 | m_collPane2->SetToolTip(_("wxCollapsiblePane")); | |
51d48751 | 272 | |
f978831f | 273 | wxBoxSizer * collbSizer2 = new wxBoxSizer(wxVERTICAL); |
9a83f860 VZ |
274 | wxStaticText* m_collSText2 = new wxStaticText(win2, -1, wxT("You can place")); |
275 | wxButton* m_collBut2 = new wxButton(win2, -1, wxT("anything")); | |
276 | wxTextCtrl* m_collText2 = new wxTextCtrl(win2, -1, wxT("inside a wxCollapsiblePane")); | |
f978831f BP |
277 | collbSizer2->Add( m_collSText2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0 ); |
278 | collbSizer2->Add( m_collBut2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0 ); | |
279 | collbSizer2->Add( m_collText2, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0 ); | |
280 | win2->SetSizer(collbSizer2); | |
51d48751 | 281 | |
f978831f | 282 | m_collPane2->Expand(); |
51d48751 | 283 | |
f978831f | 284 | fgSizer2->Add( m_collPane2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); |
51d48751 | 285 | |
f978831f BP |
286 | m_panel2->SetSizer( fgSizer2 ); |
287 | m_panel2->Layout(); | |
288 | fgSizer2->Fit( m_panel2 ); | |
51d48751 | 289 | |
f978831f | 290 | m_notebook1->AddPage( m_panel2, _("Multiple choice Controls"), false ); |
51d48751 FM |
291 | } |
292 | ||
293 | void GUIFrame::AddPanel_3() | |
294 | { | |
f978831f | 295 | m_panel3 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); |
51d48751 | 296 | |
f978831f BP |
297 | wxBoxSizer* bSizer2; |
298 | bSizer2 = new wxBoxSizer( wxVERTICAL ); | |
51d48751 | 299 | |
f978831f BP |
300 | m_textCtrl1 = new wxTextCtrl( m_panel3, wxID_ANY, _("Single-line"), wxDefaultPosition, wxDefaultSize, 0 ); |
301 | m_textCtrl1->SetToolTip( _("wxTextCtrl") ); | |
f978831f | 302 | bSizer2->Add( m_textCtrl1, 0, wxTOP|wxRIGHT|wxLEFT, 20 ); |
51d48751 | 303 | |
f978831f | 304 | bSizer2->Add( 0, 10, 0, 0, 5 ); |
51d48751 | 305 | |
f978831f BP |
306 | m_textCtrl2 = new wxTextCtrl( m_panel3, wxID_ANY, _("Multi-line\nLine1\nLine2\n"), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE ); |
307 | m_textCtrl2->SetToolTip( _("wxTextCtrl") ); | |
f978831f | 308 | bSizer2->Add( m_textCtrl2, 0, wxBOTTOM|wxRIGHT|wxLEFT, 20 ); |
51d48751 | 309 | |
f978831f | 310 | m_richText1 = new wxRichTextCtrl( m_panel3, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0|wxVSCROLL|wxHSCROLL|wxNO_BORDER|wxWANTS_CHARS ); |
9a83f860 | 311 | m_richText1->LoadFile(wxT("richtext.xml")); |
f978831f BP |
312 | m_richText1->SetToolTip( _("wxRichTextCtrl") ); |
313 | m_richText1->SetMinSize( wxSize( 200,200 ) ); | |
f978831f | 314 | bSizer2->Add( m_richText1, 0, wxALL, 20 ); |
51d48751 | 315 | |
f978831f BP |
316 | m_panel3->SetSizer( bSizer2 ); |
317 | m_panel3->Layout(); | |
318 | bSizer2->Fit( m_panel3 ); | |
51d48751 | 319 | |
f978831f | 320 | m_notebook1->AddPage( m_panel3, _("[Rich]Text Controls"), false ); |
51d48751 FM |
321 | } |
322 | ||
323 | void GUIFrame::AddPanel_4() | |
324 | { | |
f978831f | 325 | m_panel4 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); |
51d48751 | 326 | |
f978831f | 327 | wxFlexGridSizer* fgSizer5; |
51d48751 | 328 | fgSizer5 = new wxFlexGridSizer( 0, 2, 10, 10 ); |
f978831f BP |
329 | fgSizer5->SetFlexibleDirection( wxBOTH ); |
330 | fgSizer5->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); | |
51d48751 | 331 | |
f978831f BP |
332 | m_colourPicker1 = new wxColourPickerCtrl( m_panel4, wxID_ANY, *wxBLACK, wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE ); |
333 | m_colourPicker1->SetToolTip( _("wxColourPickerCtrl") ); | |
f978831f | 334 | fgSizer5->Add( m_colourPicker1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); |
51d48751 | 335 | |
f978831f | 336 | m_fontPicker1 = new wxFontPickerCtrl( m_panel4, wxID_ANY, wxNullFont, wxDefaultPosition, wxDefaultSize, wxFNTP_DEFAULT_STYLE ); |
51d48751 | 337 | m_fontPicker1->SetMaxPointSize( 100 ); |
f978831f | 338 | m_fontPicker1->SetToolTip( _("wxFontPickerCtrl") ); |
f978831f | 339 | fgSizer5->Add( m_fontPicker1, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 20 ); |
51d48751 | 340 | |
9a83f860 | 341 | m_filePicker1 = new wxFilePickerCtrl( m_panel4, wxID_ANY, wxEmptyString, _("Select a file"), wxT("*.*"), wxDefaultPosition, wxDefaultSize, wxFLP_DEFAULT_STYLE, wxDefaultValidator, wxT("_FilePickerCtrl") ); |
ecba92ec FM |
342 | #if defined(__WXMSW__) |
343 | const wxString a_file = "C:\\Windows\\explorer.exe"; | |
344 | #else | |
345 | const wxString a_file = "/bin/bash"; | |
346 | #endif | |
347 | m_filePicker1->SetPath(a_file); | |
f978831f | 348 | m_filePicker1->SetToolTip( _("wxFilePickerCtrl") ); |
f978831f | 349 | fgSizer5->Add( m_filePicker1, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 20 ); |
51d48751 | 350 | |
f978831f | 351 | fgSizer5->Add( 0, 0, 1, wxEXPAND, 5 ); |
51d48751 | 352 | |
f978831f BP |
353 | m_calendar1 = new wxCalendarCtrl( m_panel4, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxCAL_SHOW_HOLIDAYS ); |
354 | m_calendar1->SetToolTip( _("wxCalendarCtrl") ); | |
f978831f | 355 | fgSizer5->Add( m_calendar1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); |
51d48751 | 356 | |
f978831f BP |
357 | m_datePicker1 = new wxDatePickerCtrl( m_panel4, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT ); |
358 | m_datePicker1->SetToolTip( _("wxDatePickerCtrl") ); | |
f978831f | 359 | fgSizer5->Add( m_datePicker1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); |
51d48751 | 360 | |
9a83f860 | 361 | m_genericDirCtrl1 = new wxGenericDirCtrl( m_panel4, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDIRCTRL_3D_INTERNAL|wxSUNKEN_BORDER, wxEmptyString, 0, wxT("_GenericDirCtrl") ); |
f978831f BP |
362 | m_genericDirCtrl1->ShowHidden( false ); |
363 | m_genericDirCtrl1->SetToolTip( _("wxGenericDirCtrl") ); | |
364 | m_genericDirCtrl1->SetMinSize( wxSize( -1,150 ) ); | |
f978831f | 365 | fgSizer5->Add( m_genericDirCtrl1, 1, wxEXPAND|wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); |
51d48751 | 366 | |
9a83f860 | 367 | m_dirPicker1 = new wxDirPickerCtrl( m_panel4, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, wxDIRP_DEFAULT_STYLE, wxDefaultValidator, wxT("_DirPickerCtrl") ); |
ecba92ec FM |
368 | #if defined(__WXMSW__) |
369 | const wxString a_dir = "C:\\Windows"; | |
370 | #else | |
371 | const wxString a_dir = "/home"; | |
372 | #endif | |
373 | m_dirPicker1->SetPath(a_dir); | |
f978831f | 374 | m_dirPicker1->SetToolTip( _("wxDirPickerCtrl") ); |
f978831f | 375 | fgSizer5->Add( m_dirPicker1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); |
51d48751 | 376 | |
f978831f BP |
377 | m_panel4->SetSizer( fgSizer5 ); |
378 | m_panel4->Layout(); | |
379 | fgSizer5->Fit( m_panel4 ); | |
51d48751 | 380 | |
f978831f | 381 | m_notebook1->AddPage( m_panel4, _("Picker Controls"), false ); |
51d48751 FM |
382 | } |
383 | ||
384 | void GUIFrame::AddPanel_5() | |
385 | { | |
f978831f | 386 | m_panel5 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); |
51d48751 | 387 | |
f978831f | 388 | wxFlexGridSizer* fgSizer4; |
51d48751 | 389 | fgSizer4 = new wxFlexGridSizer( 0, 2, 0, 0 ); |
f978831f BP |
390 | fgSizer4->SetFlexibleDirection( wxBOTH ); |
391 | fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); | |
51d48751 | 392 | |
f978831f BP |
393 | wxString m_choice1Choices[] = { _("wxChoice"), _("Item1"), _("Item2"), _("Item3"), _("Item4") }; |
394 | int m_choice1NChoices = sizeof( m_choice1Choices ) / sizeof( wxString ); | |
395 | m_choice1 = new wxChoice( m_panel5, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choice1NChoices, m_choice1Choices, 0 ); | |
396 | m_choice1->SetSelection( 0 ); | |
397 | fgSizer4->Add( m_choice1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); | |
51d48751 | 398 | |
f978831f BP |
399 | m_comboBox1 = new wxComboBox( m_panel5, wxID_ANY, _("wxComboBox"), wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); |
400 | m_comboBox1->Append( _("wxComboBox") ); | |
401 | m_comboBox1->Append( _("Item1") ); | |
402 | m_comboBox1->Append( _("Item2") ); | |
403 | m_comboBox1->Append( _("Item3") ); | |
404 | m_comboBox1->Append( _("Item4") ); | |
ecba92ec FM |
405 | m_comboBox1->Select(0); |
406 | // To look better under gtk | |
407 | #ifdef __WXGTK__ | |
408 | m_comboBox1->Delete(4); | |
409 | #endif | |
f978831f | 410 | fgSizer4->Add( m_comboBox1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); |
51d48751 | 411 | |
f978831f | 412 | fgSizer4->Add( 0, 120, 1, wxEXPAND, 5 ); |
51d48751 | 413 | |
f978831f | 414 | fgSizer4->Add( 0, 120, 1, wxEXPAND, 5 ); |
51d48751 | 415 | |
f978831f | 416 | m_bmpComboBox1 = new wxBitmapComboBox(m_panel5, wxID_ANY,_("Item1")); |
9a83f860 VZ |
417 | m_bmpComboBox1->Append(_("Item1"), wxBitmap(wxT("bitmaps/bell.png"),wxBITMAP_TYPE_PNG)); |
418 | m_bmpComboBox1->Append(_("Item2"), wxBitmap(wxT("bitmaps/sound.png"),wxBITMAP_TYPE_PNG)); | |
419 | m_bmpComboBox1->Append(_("Item3"), wxBitmap(wxT("bitmaps/bell.png"),wxBITMAP_TYPE_PNG)); | |
420 | m_bmpComboBox1->Append(_("Item4"), wxBitmap(wxT("bitmaps/sound.png"),wxBITMAP_TYPE_PNG)); | |
f978831f BP |
421 | m_bmpComboBox1->SetToolTip(_("wxBitmapComboBox")); |
422 | fgSizer4->Add( m_bmpComboBox1, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 20 ); | |
51d48751 | 423 | |
f978831f | 424 | m_ownerDrawnComboBox1 = PenStyleComboBox::CreateSample(m_panel5); |
51d48751 | 425 | m_ownerDrawnComboBox1->SetToolTip(_("wxOwnerDrawnComboBox")); |
f978831f | 426 | fgSizer4->Add( m_ownerDrawnComboBox1, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); |
51d48751 | 427 | |
f978831f | 428 | fgSizer4->Add( 0, 90, 1, wxEXPAND, 5 ); |
51d48751 | 429 | |
f978831f | 430 | fgSizer4->Add( 0, 90, 1, wxEXPAND, 5 ); |
51d48751 FM |
431 | |
432 | //wxComboCtrl 1 | |
433 | m_comboCtrl1 = new wxComboCtrl(m_panel5,wxID_ANY,wxEmptyString); | |
434 | // first of all, set the popup control! | |
435 | ListViewComboPopup* popupList = new ListViewComboPopup(); | |
436 | m_comboCtrl1->SetPopupControl(popupList); | |
437 | m_comboCtrl1->SetPopupMaxHeight(80); | |
438 | ||
9a83f860 | 439 | m_comboCtrl1->SetText(wxT("wxComboCtrl")); |
51d48751 FM |
440 | m_comboCtrl1->SetToolTip(_("wxComboCtrl")); |
441 | ||
442 | // Populate using wxListView methods | |
9a83f860 VZ |
443 | popupList->InsertItem(popupList->GetItemCount(),wxT("wxComboCtrl")); |
444 | popupList->InsertItem(popupList->GetItemCount(),wxT("with")); | |
445 | popupList->InsertItem(popupList->GetItemCount(),wxT("wxListView")); | |
446 | popupList->InsertItem(popupList->GetItemCount(),wxT("popup")); | |
447 | popupList->InsertItem(popupList->GetItemCount(),wxT("Item1")); | |
448 | popupList->InsertItem(popupList->GetItemCount(),wxT("Item2")); | |
449 | popupList->InsertItem(popupList->GetItemCount(),wxT("Item3")); | |
51d48751 FM |
450 | |
451 | popupList->Select(0, true); | |
452 | fgSizer4->Add( m_comboCtrl1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 20 ); | |
453 | ||
454 | //wxComboCtrl 2 | |
455 | m_comboCtrl2 = new wxComboCtrl(m_panel5,wxID_ANY,wxEmptyString); | |
456 | // first of all, set the popup control! | |
457 | TreeCtrlComboPopup* popupTree = new TreeCtrlComboPopup(); | |
458 | m_comboCtrl2->SetPopupControl(popupTree); | |
459 | m_comboCtrl2->SetPopupMaxHeight(80); | |
460 | ||
9a83f860 | 461 | m_comboCtrl2->SetText(wxT("wxComboCtrl")); |
51d48751 FM |
462 | m_comboCtrl2->SetToolTip(_("wxComboCtrl")); |
463 | ||
464 | //Add a root and some nodes using wxTreeCtrl methods | |
465 | wxTreeItemId root = popupTree->AddRoot(_("wxComboCtrl")); | |
466 | ||
467 | popupTree->AppendItem(root, _("with")); | |
468 | popupTree->AppendItem(root, _("wxTreeCtrl")); | |
469 | ||
470 | wxTreeItemId node2 = popupTree->AppendItem(root, _("popout")); | |
471 | popupTree->AppendItem(node2, _("Node1")); | |
472 | popupTree->AppendItem(node2, _("Node2")); | |
473 | ||
474 | popupTree->ExpandAll(); | |
475 | fgSizer4->Add( m_comboCtrl2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 20 ); | |
476 | ||
f978831f BP |
477 | m_panel5->SetSizer( fgSizer4 ); |
478 | m_panel5->Layout(); | |
479 | fgSizer4->Fit( m_panel5 ); | |
51d48751 | 480 | |
f978831f | 481 | m_notebook1->AddPage( m_panel5, _("Drop-down Controls"), false ); |
0d5eda9c | 482 | } |
0d5eda9c FM |
483 | GUIFrame::~GUIFrame() |
484 | { | |
f978831f BP |
485 | // Disconnect Events |
486 | this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( GUIFrame::OnClose ) ); | |
ce7fe42e VZ |
487 | this->Disconnect( wxID_ANY, wxEVT_MENU, wxCommandEventHandler( GUIFrame::OnSeeScreenshots ) ); |
488 | this->Disconnect( wxID_ANY, wxEVT_MENU, wxCommandEventHandler( GUIFrame::OnQuit ) ); | |
489 | this->Disconnect( wxID_ANY, wxEVT_MENU, wxCommandEventHandler( GUIFrame::OnCaptureFullScreen ) ); | |
490 | this->Disconnect( wxID_ANY, wxEVT_MENU, wxCommandEventHandler( GUIFrame::OnCaptureAllControls ) ); | |
491 | this->Disconnect( wxID_ANY, wxEVT_MENU, wxCommandEventHandler( GUIFrame::OnAbout ) ); | |
0d5eda9c | 492 | } |