1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Implement the Application Frame
4 // Author: Utensil Candel (UtensilCandel@@gmail.com)
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
8 // For compilers that support precompilation, includes "wx/wx.h".
15 // for all others, include the necessary headers wxWidgets headers)
22 ///////////////////////////////////////////////////////////////////////////
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
)
26 this->SetSizeHints( wxDefaultSize
, wxDefaultSize
);
31 bSizer0
= new wxBoxSizer( wxVERTICAL
);
32 m_notebook1
= new wxNotebook( this, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
, 0 );
34 //Add panels into m_notebook1
38 //Multiple choice Controls
47 m_notebook1
->ChangeSelection(0);
49 bSizer0
->Add( m_notebook1
, 1, wxEXPAND
| wxALL
, 0 );
51 this->SetSizer( bSizer0
);
54 statusBar
= this->CreateStatusBar( 1, wxST_SIZEGRIP
, wxID_ANY
);
57 this->Connect( wxEVT_CLOSE_WINDOW
, wxCloseEventHandler( GUIFrame::OnClose
) );
60 void GUIFrame::AddMenuBar()
62 mbar
= new wxMenuBar( 0 );
65 fileMenu
= new wxMenu();
67 wxMenuItem
* m_menuSeeScr
;
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
);
69 fileMenu
->Append( m_menuSeeScr
);
71 fileMenu
->AppendSeparator();
73 wxMenuItem
* m_menuFileQuit
;
74 m_menuFileQuit
= new wxMenuItem( fileMenu
, wxID_EXIT
, wxString( _("&Quit") ) + wxT('\t') + wxT("Alt+F4"), _("Quits the application."), wxITEM_NORMAL
);
75 fileMenu
->Append( m_menuFileQuit
);
77 mbar
->Append( fileMenu
, _("&File") );
80 captureMenu
= new wxMenu();
82 wxMenuItem
* m_menuCapFullScreen
;
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
);
84 captureMenu
->Append( m_menuCapFullScreen
);
86 wxMenuItem
* m_menuCapAll
;
87 m_menuCapAll
= new wxMenuItem( captureMenu
, idMenuCapAll
, wxString( _("Capture All") ) + wxT('\t') + wxT("Ctrl+Alt+A"), _("Takes screenshots for all controls automatically."), wxITEM_NORMAL
);
88 captureMenu
->Append( m_menuCapAll
);
90 mbar
->Append( captureMenu
, _("&Capture") );
93 helpMenu
= new wxMenu();
94 wxMenuItem
* m_menuHelpAbout
;
95 m_menuHelpAbout
= new wxMenuItem( helpMenu
, wxID_ABOUT
, wxString( _("&About") ) + wxT('\t') + wxT("F1"), _("Shows info about this application."), wxITEM_NORMAL
);
96 helpMenu
->Append( m_menuHelpAbout
);
98 mbar
->Append( helpMenu
, _("&Help") );
100 this->SetMenuBar( mbar
);
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
) );
110 void GUIFrame::AddPanel_1()
112 m_panel1
= new wxPanel( m_notebook1
, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
, wxTAB_TRAVERSAL
);
114 wxFlexGridSizer
* fgSizer1
;
115 fgSizer1
= new wxFlexGridSizer( 0, 2, 0, 0 );
116 fgSizer1
->SetFlexibleDirection( wxBOTH
);
117 fgSizer1
->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_NONE
);
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 );
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 );
126 m_checkBox1
= new wxCheckBox( m_panel1
, wxID_ANY
, _("Checked"), wxDefaultPosition
, wxDefaultSize
, 0 );
127 m_checkBox1
->SetValue(true);
128 m_checkBox1
->SetToolTip( _("wxCheckBox") );
129 fgSizer1
->Add( m_checkBox1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
131 m_checkBox2
= new wxCheckBox( m_panel1
, wxID_ANY
, _("Unchecked"), wxDefaultPosition
, wxDefaultSize
, 0 );
132 m_checkBox2
->SetToolTip( _("wxCheckBox") );
133 fgSizer1
->Add( m_checkBox2
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
|wxALIGN_CENTER_HORIZONTAL
, 20 );
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.
140 m_radioBtn1
= new wxRadioButton( m_panel1
, wxID_ANY
, _("Checked"), wxDefaultPosition
, wxDefaultSize
, wxRB_GROUP
);
141 m_radioBtn1
->SetValue( true );
142 m_radioBtn1
->SetToolTip( _("wxRadioButton") );
143 fgSizer1
->Add( m_radioBtn1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
145 m_radioBtn2
= new wxRadioButton( m_panel1
, wxID_ANY
, _("Unchecked"), wxDefaultPosition
, wxDefaultSize
, 0 );
146 m_radioBtn2
->SetToolTip( _("wxRadioButton") );
147 fgSizer1
->Add( m_radioBtn2
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
149 m_bpButton1
= new wxBitmapButton( m_panel1
, wxID_ANY
, wxBitmap( wxT("bitmaps/wxwin32x32.png"), wxBITMAP_TYPE_ANY
), wxDefaultPosition
, wxDefaultSize
, wxBU_AUTODRAW
);
150 m_bpButton1
->SetToolTip( _("wxBitmapButton") );
151 m_bpButton1
->SetToolTip( _("wxBitmapButton") );
152 fgSizer1
->Add( m_bpButton1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
154 m_bitmap1
= new wxStaticBitmap( m_panel1
, wxID_ANY
, wxBitmap( wxT("bitmaps/wxwin32x32.png"), wxBITMAP_TYPE_ANY
), wxDefaultPosition
, wxDefaultSize
, 0 );
155 m_bitmap1
->SetToolTip( _("wxStaticBitmap") );
156 fgSizer1
->Add( m_bitmap1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
158 m_gauge1
= new wxGauge( m_panel1
, wxID_ANY
, 100, wxDefaultPosition
, wxDefaultSize
, wxGA_HORIZONTAL
, wxDefaultValidator
, wxT("_Gauge") );
159 m_gauge1
->SetValue( 50 );
160 m_gauge1
->SetToolTip( _("wxGauge") );
161 fgSizer1
->Add( m_gauge1
, 1, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
|wxEXPAND
, 20 );
163 m_slider1
= new wxSlider( m_panel1
, wxID_ANY
, 50, 0, 100, wxDefaultPosition
, wxDefaultSize
, wxSL_HORIZONTAL
);
164 m_slider1
->SetToolTip( _("wxSlider") );
165 fgSizer1
->Add( m_slider1
, 1, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
|wxEXPAND
, 20 );
167 m_toggleBtn1
= new wxToggleButton( m_panel1
, wxID_ANY
, _("Untoggled"), wxDefaultPosition
, wxDefaultSize
, 0 );
168 m_toggleBtn1
->SetToolTip( _("wxToggleButton") );
169 fgSizer1
->Add( m_toggleBtn1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
171 m_toggleBtn2
= new wxToggleButton( m_panel1
, wxID_ANY
, _("Toggled"), wxDefaultPosition
, wxDefaultSize
, 0 );
172 m_toggleBtn2
->SetValue( true );
173 m_toggleBtn2
->SetToolTip( _("wxToggleButton") );
174 fgSizer1
->Add( m_toggleBtn2
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
|wxALIGN_CENTER_HORIZONTAL
, 20 );
176 m_hyperlink1
= new wxHyperlinkCtrl( m_panel1
, wxID_ANY
, _("www.wxwidgets.org"), wxT("http://www.wxwidgets.org"), wxDefaultPosition
, wxDefaultSize
, wxHL_DEFAULT_STYLE
);
177 m_hyperlink1
->SetToolTip( _("wxHyperlinkCtrl") );
178 fgSizer1
->Add( m_hyperlink1
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
|wxALIGN_CENTER_HORIZONTAL
, 20 );
180 m_spinCtrl1
= new wxSpinCtrl( m_panel1
, wxID_ANY
, wxT("5"), wxDefaultPosition
, wxDefaultSize
, wxSP_ARROW_KEYS
, 0, 10, 0 );
181 m_spinCtrl1
->SetToolTip( _("wxSpinCtrl") );
182 fgSizer1
->Add( m_spinCtrl1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
184 m_spinBtn1
= new wxSpinButton( m_panel1
, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
, 0 );
185 m_spinBtn1
->SetToolTip( _("wxSpinButton") );
186 fgSizer1
->Add( m_spinBtn1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
188 m_scrollBar1
= new wxScrollBar( m_panel1
, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
, wxSB_HORIZONTAL
);
189 m_scrollBar1
->SetScrollbar(50, 1, 100, 1);
190 m_scrollBar1
->SetToolTip( _("wxScrollBar") );
191 fgSizer1
->Add( m_scrollBar1
, 1, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
|wxEXPAND
, 20 );
193 m_panel1
->SetSizer( fgSizer1
);
195 fgSizer1
->Fit( m_panel1
);
196 m_notebook1
->AddPage( m_panel1
, _("Tiny Controls"), true );
199 void GUIFrame::AddPanel_2()
201 m_panel2
= new wxPanel( m_notebook1
, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
, wxTAB_TRAVERSAL
);
203 wxFlexGridSizer
* fgSizer2
;
204 fgSizer2
= new wxFlexGridSizer( 0, 2, 0, 0 );
205 fgSizer2
->SetFlexibleDirection( wxBOTH
);
206 fgSizer2
->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED
);
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 );
211 m_checkList1
->Check(0);
212 fgSizer2
->Add( m_checkList1
, 1, wxALL
|wxEXPAND
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
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 );
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 );
226 m_staticBox1
= new wxStaticBox(m_panel2
,wxID_ANY
, _("wxStaticBox"), wxDefaultPosition
, wxDefaultSize
, 0, _("_StaticBox"));
227 fgSizer2
->Add( m_staticBox1
, 1, wxALL
|wxALIGN_CENTER_VERTICAL
|wxALIGN_CENTER_HORIZONTAL
|wxEXPAND
, 20 );
229 m_treeCtrl1
= new wxTreeCtrl( m_panel2
, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
, wxTR_DEFAULT_STYLE
|wxSUNKEN_BORDER
);
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();
235 fgSizer2
->Add( m_treeCtrl1
, 1, wxALL
|wxEXPAND
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
237 m_listCtrl1
= new wxListCtrl( m_panel2
, wxID_ANY
, wxDefaultPosition
, wxSize(220,120), wxLC_REPORT
|wxSUNKEN_BORDER
);
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
));
244 m_listCtrl1
->SetToolTip( _("wxListCtrl") );
245 fgSizer2
->Add( m_listCtrl1
, 1, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
|wxEXPAND
, 20 );
247 m_animationCtrl1
= new wxAnimationCtrl(m_panel2
, wxID_ANY
);
248 m_animationCtrl1
->SetToolTip(_("wxAnimationCtrl"));
249 if (m_animationCtrl1
->LoadFile(wxT("bitmaps/throbber.gif")))
250 m_animationCtrl1
->Play();
251 fgSizer2
->Add( m_animationCtrl1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
253 //wxCollapsiblePane 1
254 m_collPane1
= new wxCollapsiblePane(m_panel2
, -1, wxT("Collapsed"));
255 wxWindow
*win
= m_collPane1
->GetPane();
256 m_collPane1
->SetToolTip(_("wxCollapsiblePane"));
258 wxBoxSizer
* collbSizer
= new wxBoxSizer(wxVERTICAL
);
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"));
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 );
268 //wxCollapsiblePane 2
269 m_collPane2
= new wxCollapsiblePane(m_panel2
, -1, wxT("Expanded"));
270 wxWindow
*win2
= m_collPane2
->GetPane();
271 m_collPane2
->SetToolTip(_("wxCollapsiblePane"));
273 wxBoxSizer
* collbSizer2
= new wxBoxSizer(wxVERTICAL
);
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"));
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
);
282 m_collPane2
->Expand();
284 fgSizer2
->Add( m_collPane2
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
|wxEXPAND
, 5 );
286 m_panel2
->SetSizer( fgSizer2
);
288 fgSizer2
->Fit( m_panel2
);
290 m_notebook1
->AddPage( m_panel2
, _("Multiple choice Controls"), false );
293 void GUIFrame::AddPanel_3()
295 m_panel3
= new wxPanel( m_notebook1
, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
, wxTAB_TRAVERSAL
);
298 bSizer2
= new wxBoxSizer( wxVERTICAL
);
300 m_textCtrl1
= new wxTextCtrl( m_panel3
, wxID_ANY
, _("Single-line"), wxDefaultPosition
, wxDefaultSize
, 0 );
301 m_textCtrl1
->SetToolTip( _("wxTextCtrl") );
302 bSizer2
->Add( m_textCtrl1
, 0, wxTOP
|wxRIGHT
|wxLEFT
, 20 );
304 bSizer2
->Add( 0, 10, 0, 0, 5 );
306 m_textCtrl2
= new wxTextCtrl( m_panel3
, wxID_ANY
, _("Multi-line\nLine1\nLine2\n"), wxDefaultPosition
, wxDefaultSize
, wxTE_MULTILINE
);
307 m_textCtrl2
->SetToolTip( _("wxTextCtrl") );
308 bSizer2
->Add( m_textCtrl2
, 0, wxBOTTOM
|wxRIGHT
|wxLEFT
, 20 );
310 m_richText1
= new wxRichTextCtrl( m_panel3
, wxID_ANY
, wxEmptyString
, wxDefaultPosition
, wxSize( -1,-1 ), 0|wxVSCROLL
|wxHSCROLL
|wxNO_BORDER
|wxWANTS_CHARS
);
311 m_richText1
->LoadFile(wxT("richtext.xml"));
312 m_richText1
->SetToolTip( _("wxRichTextCtrl") );
313 m_richText1
->SetMinSize( wxSize( 200,200 ) );
314 bSizer2
->Add( m_richText1
, 0, wxALL
, 20 );
316 m_panel3
->SetSizer( bSizer2
);
318 bSizer2
->Fit( m_panel3
);
320 m_notebook1
->AddPage( m_panel3
, _("[Rich]Text Controls"), false );
323 void GUIFrame::AddPanel_4()
325 m_panel4
= new wxPanel( m_notebook1
, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
, wxTAB_TRAVERSAL
);
327 wxFlexGridSizer
* fgSizer5
;
328 fgSizer5
= new wxFlexGridSizer( 0, 2, 10, 10 );
329 fgSizer5
->SetFlexibleDirection( wxBOTH
);
330 fgSizer5
->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED
);
332 m_colourPicker1
= new wxColourPickerCtrl( m_panel4
, wxID_ANY
, *wxBLACK
, wxDefaultPosition
, wxDefaultSize
, wxCLRP_DEFAULT_STYLE
);
333 m_colourPicker1
->SetToolTip( _("wxColourPickerCtrl") );
334 fgSizer5
->Add( m_colourPicker1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
336 m_fontPicker1
= new wxFontPickerCtrl( m_panel4
, wxID_ANY
, wxNullFont
, wxDefaultPosition
, wxDefaultSize
, wxFNTP_DEFAULT_STYLE
);
337 m_fontPicker1
->SetMaxPointSize( 100 );
338 m_fontPicker1
->SetToolTip( _("wxFontPickerCtrl") );
339 fgSizer5
->Add( m_fontPicker1
, 0, wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
|wxALL
, 20 );
341 m_filePicker1
= new wxFilePickerCtrl( m_panel4
, wxID_ANY
, wxEmptyString
, _("Select a file"), wxT("*.*"), wxDefaultPosition
, wxDefaultSize
, wxFLP_DEFAULT_STYLE
, wxDefaultValidator
, wxT("_FilePickerCtrl") );
342 #if defined(__WXMSW__)
343 const wxString a_file
= "C:\\Windows\\explorer.exe";
345 const wxString a_file
= "/bin/bash";
347 m_filePicker1
->SetPath(a_file
);
348 m_filePicker1
->SetToolTip( _("wxFilePickerCtrl") );
349 fgSizer5
->Add( m_filePicker1
, 0, wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
|wxALL
, 20 );
351 fgSizer5
->Add( 0, 0, 1, wxEXPAND
, 5 );
353 m_calendar1
= new wxCalendarCtrl( m_panel4
, wxID_ANY
, wxDefaultDateTime
, wxDefaultPosition
, wxDefaultSize
, wxCAL_SHOW_HOLIDAYS
);
354 m_calendar1
->SetToolTip( _("wxCalendarCtrl") );
355 fgSizer5
->Add( m_calendar1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
357 m_datePicker1
= new wxDatePickerCtrl( m_panel4
, wxID_ANY
, wxDefaultDateTime
, wxDefaultPosition
, wxDefaultSize
, wxDP_DEFAULT
);
358 m_datePicker1
->SetToolTip( _("wxDatePickerCtrl") );
359 fgSizer5
->Add( m_datePicker1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
361 m_genericDirCtrl1
= new wxGenericDirCtrl( m_panel4
, wxID_ANY
, wxEmptyString
, wxDefaultPosition
, wxDefaultSize
, wxDIRCTRL_3D_INTERNAL
|wxSUNKEN_BORDER
, wxEmptyString
, 0, wxT("_GenericDirCtrl") );
362 m_genericDirCtrl1
->ShowHidden( false );
363 m_genericDirCtrl1
->SetToolTip( _("wxGenericDirCtrl") );
364 m_genericDirCtrl1
->SetMinSize( wxSize( -1,150 ) );
365 fgSizer5
->Add( m_genericDirCtrl1
, 1, wxEXPAND
|wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
367 m_dirPicker1
= new wxDirPickerCtrl( m_panel4
, wxID_ANY
, wxEmptyString
, _("Select a folder"), wxDefaultPosition
, wxDefaultSize
, wxDIRP_DEFAULT_STYLE
, wxDefaultValidator
, wxT("_DirPickerCtrl") );
368 #if defined(__WXMSW__)
369 const wxString a_dir
= "C:\\Windows";
371 const wxString a_dir
= "/home";
373 m_dirPicker1
->SetPath(a_dir
);
374 m_dirPicker1
->SetToolTip( _("wxDirPickerCtrl") );
375 fgSizer5
->Add( m_dirPicker1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
377 m_panel4
->SetSizer( fgSizer5
);
379 fgSizer5
->Fit( m_panel4
);
381 m_notebook1
->AddPage( m_panel4
, _("Picker Controls"), false );
384 void GUIFrame::AddPanel_5()
386 m_panel5
= new wxPanel( m_notebook1
, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
, wxTAB_TRAVERSAL
);
388 wxFlexGridSizer
* fgSizer4
;
389 fgSizer4
= new wxFlexGridSizer( 0, 2, 0, 0 );
390 fgSizer4
->SetFlexibleDirection( wxBOTH
);
391 fgSizer4
->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED
);
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 );
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") );
405 m_comboBox1
->Select(0);
406 // To look better under gtk
408 m_comboBox1
->Delete(4);
410 fgSizer4
->Add( m_comboBox1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
412 fgSizer4
->Add( 0, 120, 1, wxEXPAND
, 5 );
414 fgSizer4
->Add( 0, 120, 1, wxEXPAND
, 5 );
416 m_bmpComboBox1
= new wxBitmapComboBox(m_panel5
, wxID_ANY
,_("Item1"));
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
));
421 m_bmpComboBox1
->SetToolTip(_("wxBitmapComboBox"));
422 fgSizer4
->Add( m_bmpComboBox1
, 1, wxALL
|wxALIGN_CENTER_VERTICAL
|wxALIGN_CENTER_HORIZONTAL
|wxEXPAND
, 20 );
424 m_ownerDrawnComboBox1
= PenStyleComboBox::CreateSample(m_panel5
);
425 m_ownerDrawnComboBox1
->SetToolTip(_("wxOwnerDrawnComboBox"));
426 fgSizer4
->Add( m_ownerDrawnComboBox1
, 1, wxALL
|wxEXPAND
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
428 fgSizer4
->Add( 0, 90, 1, wxEXPAND
, 5 );
430 fgSizer4
->Add( 0, 90, 1, wxEXPAND
, 5 );
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);
439 m_comboCtrl1
->SetText(wxT("wxComboCtrl"));
440 m_comboCtrl1
->SetToolTip(_("wxComboCtrl"));
442 // Populate using wxListView methods
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"));
451 popupList
->Select(0, true);
452 fgSizer4
->Add( m_comboCtrl1
, 1, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
|wxEXPAND
, 20 );
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);
461 m_comboCtrl2
->SetText(wxT("wxComboCtrl"));
462 m_comboCtrl2
->SetToolTip(_("wxComboCtrl"));
464 //Add a root and some nodes using wxTreeCtrl methods
465 wxTreeItemId root
= popupTree
->AddRoot(_("wxComboCtrl"));
467 popupTree
->AppendItem(root
, _("with"));
468 popupTree
->AppendItem(root
, _("wxTreeCtrl"));
470 wxTreeItemId node2
= popupTree
->AppendItem(root
, _("popout"));
471 popupTree
->AppendItem(node2
, _("Node1"));
472 popupTree
->AppendItem(node2
, _("Node2"));
474 popupTree
->ExpandAll();
475 fgSizer4
->Add( m_comboCtrl2
, 1, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
|wxEXPAND
, 20 );
477 m_panel5
->SetSizer( fgSizer4
);
479 fgSizer4
->Fit( m_panel5
);
481 m_notebook1
->AddPage( m_panel5
, _("Drop-down Controls"), false );
483 GUIFrame::~GUIFrame()
486 this->Disconnect( wxEVT_CLOSE_WINDOW
, wxCloseEventHandler( GUIFrame::OnClose
) );
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
) );