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