1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Implement the Application Frame
4 // Author: Utensil Candel (UtensilCandel@@gmail.com)
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
9 // For compilers that support precompilation, includes "wx/wx.h".
10 #include "wx/wxprec.h"
16 // for all others, include the necessary headers wxWidgets headers)
23 #include "bitmaps/play.xpm"
24 #include "bitmaps/stop.xpm"
27 ///////////////////////////////////////////////////////////////////////////
29 GUIFrame::GUIFrame( wxWindow
* parent
, wxWindowID id
, const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
, long style
) : wxFrame( parent
, id
, title
, pos
, size
, style
)
31 this->SetSizeHints( wxDefaultSize
, wxDefaultSize
);
36 bSizer0
= new wxBoxSizer( wxVERTICAL
);
37 m_notebook1
= new wxNotebook( this, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
, 0 );
39 //Add panels into m_notebook1
43 //Multiple choice Controls
52 bSizer0
->Add( m_notebook1
, 1, wxEXPAND
| wxALL
, 0 );
54 this->SetSizer( bSizer0
);
57 statusBar
= this->CreateStatusBar( 1, wxST_SIZEGRIP
, wxID_ANY
);
60 this->Connect( wxEVT_CLOSE_WINDOW
, wxCloseEventHandler( GUIFrame::OnClose
) );
62 m_notebook1
->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
, wxNotebookEventHandler( GUIFrame::OnNotebookPageChanged
), NULL
, this );
63 m_notebook1
->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
, wxNotebookEventHandler( GUIFrame::OnNotebookPageChanging
), NULL
, this );
66 void GUIFrame::AddMenuBar()
68 mbar
= new wxMenuBar( 0 );
71 fileMenu
= new wxMenu();
73 wxMenuItem
* m_menuSeeScr
;
74 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
);
75 fileMenu
->Append( m_menuSeeScr
);
77 fileMenu
->AppendSeparator();
79 wxMenuItem
* m_menuFileQuit
;
80 m_menuFileQuit
= new wxMenuItem( fileMenu
, wxID_EXIT
, wxString( _("&Quit") ) + wxT('\t') + wxT("Alt+F4"), _("Quits the application."), wxITEM_NORMAL
);
81 fileMenu
->Append( m_menuFileQuit
);
83 mbar
->Append( fileMenu
, _("&File") );
86 captureMenu
= new wxMenu();
88 wxMenuItem
* m_menuCapFullScreen
;
89 m_menuCapFullScreen
= new wxMenuItem( captureMenu
, idMenuCapFullScreen
, wxString( _("&Full Screen") ) + wxT('\t') + wxT("Ctrl+Alt+F"), _("Takes a screenshot of the entire screen."), wxITEM_NORMAL
);
90 captureMenu
->Append( m_menuCapFullScreen
);
92 m_menuCapRect
= new wxMenuItem( captureMenu
, idMenuCapRect
, wxString( _("Regions<Begin>") ) + wxT('\t') + wxT("Ctrl+Alt+R"), _("Manually specify rectangular regions for the screenshots."), wxITEM_NORMAL
);
93 captureMenu
->Append( m_menuCapRect
);
95 m_menuEndCapRect
= new wxMenuItem( captureMenu
, idMenuEndCapRect
, wxString( _("Regions<End>") ) + wxT('\t') + wxT("Ctrl+Alt+E"), _("Stop manually generating screenshots."), wxITEM_NORMAL
);
96 captureMenu
->Append( m_menuEndCapRect
);
97 m_menuEndCapRect
->Enable( false );
99 wxMenuItem
* m_menuCapAll
;
100 m_menuCapAll
= new wxMenuItem( captureMenu
, idMenuCapAll
, wxString( _("Capture All") ) + wxT('\t') + wxT("Ctrl+Alt+A"), _("Takes screenshots for all controls automatically."), wxITEM_NORMAL
);
101 captureMenu
->Append( m_menuCapAll
);
103 mbar
->Append( captureMenu
, _("&Capture") );
106 helpMenu
= new wxMenu();
107 wxMenuItem
* m_menuHelpAbout
;
108 m_menuHelpAbout
= new wxMenuItem( helpMenu
, wxID_ABOUT
, wxString( _("&About...") ) + wxT('\t') + wxT("F1"), _("Shows info about this application."), wxITEM_NORMAL
);
109 helpMenu
->Append( m_menuHelpAbout
);
111 mbar
->Append( helpMenu
, _("&Help") );
113 this->SetMenuBar( mbar
);
116 this->Connect( m_menuSeeScr
->GetId(), wxEVT_COMMAND_MENU_SELECTED
, wxCommandEventHandler( GUIFrame::OnSeeScreenshots
) );
117 this->Connect( m_menuFileQuit
->GetId(), wxEVT_COMMAND_MENU_SELECTED
, wxCommandEventHandler( GUIFrame::OnQuit
) );
118 this->Connect( m_menuCapFullScreen
->GetId(), wxEVT_COMMAND_MENU_SELECTED
, wxCommandEventHandler( GUIFrame::OnCaptureFullScreen
) );
119 this->Connect( m_menuCapRect
->GetId(), wxEVT_COMMAND_MENU_SELECTED
, wxCommandEventHandler( GUIFrame::OnCaptureRect
) );
120 this->Connect( m_menuEndCapRect
->GetId(), wxEVT_COMMAND_MENU_SELECTED
, wxCommandEventHandler( GUIFrame::OnEndCaptureRect
) );
121 this->Connect( m_menuCapAll
->GetId(), wxEVT_COMMAND_MENU_SELECTED
, wxCommandEventHandler( GUIFrame::OnCaptureAllControls
) );
122 this->Connect( m_menuHelpAbout
->GetId(), wxEVT_COMMAND_MENU_SELECTED
, wxCommandEventHandler( GUIFrame::OnAbout
) );
125 void GUIFrame::AddPanel_1()
127 m_panel1
= new wxPanel( m_notebook1
, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
, wxTAB_TRAVERSAL
);
129 wxFlexGridSizer
* fgSizer1
;
130 fgSizer1
= new wxFlexGridSizer( 0, 2, 0, 0 );
131 fgSizer1
->SetFlexibleDirection( wxBOTH
);
132 fgSizer1
->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_NONE
);
134 m_button1
= new wxButton( m_panel1
, wxID_ANY
, _("wxButton"), wxDefaultPosition
, wxDefaultSize
, 0 );
135 fgSizer1
->Add( m_button1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
137 m_staticText1
= new wxStaticText( m_panel1
, wxID_ANY
, _("wxStaticText"), wxDefaultPosition
, wxDefaultSize
, 0 );
138 m_staticText1
->Wrap( -1 );
139 fgSizer1
->Add( m_staticText1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
141 m_checkBox1
= new wxCheckBox( m_panel1
, wxID_ANY
, _("Checked"), wxDefaultPosition
, wxDefaultSize
, 0 );
142 m_checkBox1
->SetValue(true);
143 m_checkBox1
->SetToolTip( _("wxCheckBox") );
144 fgSizer1
->Add( m_checkBox1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
146 m_checkBox2
= new wxCheckBox( m_panel1
, wxID_ANY
, _("Unchecked"), wxDefaultPosition
, wxDefaultSize
, 0 );
147 m_checkBox2
->SetToolTip( _("wxCheckBox") );
148 fgSizer1
->Add( m_checkBox2
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
|wxALIGN_CENTER_HORIZONTAL
, 20 );
150 m_radioBtn1
= new wxRadioButton( m_panel1
, wxID_ANY
, _("Checked"), wxDefaultPosition
, wxDefaultSize
, wxRB_GROUP
);
151 m_radioBtn1
->SetValue( true );
152 m_radioBtn1
->SetToolTip( _("wxRadioButton") );
153 fgSizer1
->Add( m_radioBtn1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
155 m_radioBtn2
= new wxRadioButton( m_panel1
, wxID_ANY
, _("Unchecked"), wxDefaultPosition
, wxDefaultSize
, 0 );
156 m_radioBtn2
->SetToolTip( _("wxRadioButton") );
157 fgSizer1
->Add( m_radioBtn2
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
159 m_bpButton1
= new wxBitmapButton( m_panel1
, wxID_ANY
, wxBitmap( wxT("bitmaps/wxwin32x32.png"), wxBITMAP_TYPE_ANY
), wxDefaultPosition
, wxDefaultSize
, wxBU_AUTODRAW
);
160 m_bpButton1
->SetToolTip( _("wxBitmapButton") );
161 m_bpButton1
->SetToolTip( _("wxBitmapButton") );
162 fgSizer1
->Add( m_bpButton1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
164 m_bitmap1
= new wxStaticBitmap( m_panel1
, wxID_ANY
, wxBitmap( wxT("bitmaps/wxwin32x32.png"), wxBITMAP_TYPE_ANY
), wxDefaultPosition
, wxDefaultSize
, 0 );
165 m_bitmap1
->SetToolTip( _("wxStaticBitmap") );
166 fgSizer1
->Add( m_bitmap1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
168 m_gauge1
= new wxGauge( m_panel1
, wxID_ANY
, 100, wxDefaultPosition
, wxDefaultSize
, wxGA_HORIZONTAL
, wxDefaultValidator
, wxT("_Gauge") );
169 m_gauge1
->SetValue( 50 );
170 m_gauge1
->SetToolTip( _("wxGauge") );
171 fgSizer1
->Add( m_gauge1
, 1, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
|wxEXPAND
, 20 );
173 m_slider1
= new wxSlider( m_panel1
, wxID_ANY
, 50, 0, 100, wxDefaultPosition
, wxDefaultSize
, wxSL_HORIZONTAL
);
174 m_slider1
->SetToolTip( _("wxSlider") );
175 fgSizer1
->Add( m_slider1
, 1, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
|wxEXPAND
, 20 );
177 m_toggleBtn1
= new wxToggleButton( m_panel1
, wxID_ANY
, _("Untoggled"), wxDefaultPosition
, wxDefaultSize
, 0 );
178 m_toggleBtn1
->SetToolTip( _("wxToggleButton") );
179 fgSizer1
->Add( m_toggleBtn1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
181 m_toggleBtn2
= new wxToggleButton( m_panel1
, wxID_ANY
, _("Toggled"), wxDefaultPosition
, wxDefaultSize
, 0 );
182 m_toggleBtn2
->SetValue( true );
183 m_toggleBtn2
->SetToolTip( _("wxToggleButton") );
184 fgSizer1
->Add( m_toggleBtn2
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
|wxALIGN_CENTER_HORIZONTAL
, 20 );
186 m_hyperlink1
= new wxHyperlinkCtrl( m_panel1
, wxID_ANY
, _("www.wxwidgets.org"), wxT("http://www.wxwidgets.org"), wxDefaultPosition
, wxDefaultSize
, wxHL_DEFAULT_STYLE
);
187 m_hyperlink1
->SetToolTip( _("wxHyperlinkCtrl") );
188 fgSizer1
->Add( m_hyperlink1
, 0, wxALL
|wxALIGN_CENTER_VERTICAL
|wxALIGN_CENTER_HORIZONTAL
, 20 );
190 m_spinCtrl1
= new wxSpinCtrl( m_panel1
, wxID_ANY
, wxT("5"), wxDefaultPosition
, wxDefaultSize
, wxSP_ARROW_KEYS
, 0, 10, 0 );
191 m_spinCtrl1
->SetToolTip( _("wxSpinCtrl") );
192 fgSizer1
->Add( m_spinCtrl1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
194 m_spinBtn1
= new wxSpinButton( m_panel1
, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
, 0 );
195 m_spinBtn1
->SetToolTip( _("wxSpinButton") );
196 fgSizer1
->Add( m_spinBtn1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
198 m_scrollBar1
= new wxScrollBar( m_panel1
, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
, wxSB_HORIZONTAL
);
199 m_scrollBar1
->SetToolTip( _("wxScrollBar") );
200 fgSizer1
->Add( m_scrollBar1
, 1, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
|wxEXPAND
, 20 );
202 m_panel1
->SetSizer( fgSizer1
);
204 fgSizer1
->Fit( m_panel1
);
205 m_notebook1
->AddPage( m_panel1
, _("Tiny Controls"), true );
208 void GUIFrame::AddPanel_2()
210 m_panel2
= new wxPanel( m_notebook1
, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
, wxTAB_TRAVERSAL
);
212 wxFlexGridSizer
* fgSizer2
;
213 fgSizer2
= new wxFlexGridSizer( 0, 2, 0, 0 );
214 fgSizer2
->SetFlexibleDirection( wxBOTH
);
215 fgSizer2
->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED
);
217 wxString m_checkList1Choices
[] = { _("wxCheckListBox"), _("Item1"), _("Item2") };
218 int m_checkList1NChoices
= sizeof( m_checkList1Choices
) / sizeof( wxString
);
219 m_checkList1
= new wxCheckListBox( m_panel2
, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
, m_checkList1NChoices
, m_checkList1Choices
, 0 );
220 fgSizer2
->Add( m_checkList1
, 1, wxALL
|wxEXPAND
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
222 m_listBox1
= new wxListBox( m_panel2
, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
, 0, NULL
, 0 );
223 m_listBox1
->Append( _("wxListBox") );
224 m_listBox1
->Append( _("Item1") );
225 m_listBox1
->Append( _("Item2") );
226 fgSizer2
->Add( m_listBox1
, 1, wxALL
|wxEXPAND
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
228 wxString m_radioBox1Choices
[] = { _("Item1"), _("Item2") };
229 int m_radioBox1NChoices
= sizeof( m_radioBox1Choices
) / sizeof( wxString
);
230 m_radioBox1
= new wxRadioBox( m_panel2
, wxID_ANY
, _("wxRadioBox"), wxDefaultPosition
, wxDefaultSize
, m_radioBox1NChoices
, m_radioBox1Choices
, 1, wxRA_SPECIFY_COLS
);
231 m_radioBox1
->SetSelection( 0 );
232 fgSizer2
->Add( m_radioBox1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
234 m_staticBox1
= new wxStaticBox(m_panel2
,wxID_ANY
, _("wxStaticBox"), wxDefaultPosition
, wxDefaultSize
, 0, _("_StaticBox"));
235 fgSizer2
->Add( m_staticBox1
, 1, wxALL
|wxALIGN_CENTER_VERTICAL
|wxALIGN_CENTER_HORIZONTAL
|wxEXPAND
, 20 );
237 m_treeCtrl1
= new wxTreeCtrl( m_panel2
, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
, wxTR_DEFAULT_STYLE
|wxSUNKEN_BORDER
);
238 fgSizer2
->Add( m_treeCtrl1
, 1, wxALL
|wxEXPAND
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
240 m_listCtrl1
= new wxListCtrl( m_panel2
, wxID_ANY
, wxDefaultPosition
, wxSize(220,120), wxLC_REPORT
|wxSUNKEN_BORDER
);
241 m_listCtrl1
->SetToolTip( _("wxListCtrl") );
242 fgSizer2
->Add( m_listCtrl1
, 1, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
|wxEXPAND
, 20 );
244 m_animationCtrl1
= new wxAnimationCtrl(m_panel2
, wxID_ANY
);
245 m_animationCtrl1
->SetToolTip(_("wxAnimationCtrl"));
246 if (m_animationCtrl1
->LoadFile(wxT("bitmaps/throbber.gif")))
247 m_animationCtrl1
->Play();
248 fgSizer2
->Add( m_animationCtrl1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
250 //wxCollapsiblePane 1
251 m_collPane1
= new wxCollapsiblePane(m_panel2
, -1, wxT("Collapsed"));
252 wxWindow
*win
= m_collPane1
->GetPane();
253 m_collPane1
->SetToolTip(_("wxCollapsiblePane"));
255 wxBoxSizer
* collbSizer
= new wxBoxSizer(wxVERTICAL
);
256 wxStaticText
* m_collSText
= new wxStaticText(win
, -1, wxT("You can place"));
257 wxButton
* m_collBut
= new wxButton(win
, -1, wxT("anything"));
258 wxTextCtrl
* m_collText
= new wxTextCtrl(win
, -1, wxT("inside a wxCollapsiblePane"));
259 collbSizer
->Add( m_collSText
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 0 );
260 collbSizer
->Add( m_collBut
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 0 );
261 collbSizer
->Add( m_collText
, 0, wxALL
|wxEXPAND
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 0 );
262 win
->SetSizer(collbSizer
);
263 fgSizer2
->Add( m_collPane1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
|wxEXPAND
, 5 );
265 //wxCollapsiblePane 2
266 m_collPane2
= new wxCollapsiblePane(m_panel2
, -1, wxT("Expanded"));
267 wxWindow
*win2
= m_collPane2
->GetPane();
268 m_collPane2
->SetToolTip(_("wxCollapsiblePane"));
270 wxBoxSizer
* collbSizer2
= new wxBoxSizer(wxVERTICAL
);
271 wxStaticText
* m_collSText2
= new wxStaticText(win2
, -1, wxT("You can place"));
272 wxButton
* m_collBut2
= new wxButton(win2
, -1, wxT("anything"));
273 wxTextCtrl
* m_collText2
= new wxTextCtrl(win2
, -1, wxT("inside a wxCollapsiblePane"));
274 collbSizer2
->Add( m_collSText2
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 0 );
275 collbSizer2
->Add( m_collBut2
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 0 );
276 collbSizer2
->Add( m_collText2
, 0, wxALL
|wxEXPAND
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 0 );
277 win2
->SetSizer(collbSizer2
);
279 m_collPane2
->Expand();
281 fgSizer2
->Add( m_collPane2
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
|wxEXPAND
, 5 );
283 m_panel2
->SetSizer( fgSizer2
);
285 fgSizer2
->Fit( m_panel2
);
287 m_notebook1
->AddPage( m_panel2
, _("Multiple choice Controls"), false );
290 void GUIFrame::AddPanel_3()
292 m_panel3
= new wxPanel( m_notebook1
, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
, wxTAB_TRAVERSAL
);
295 bSizer2
= new wxBoxSizer( wxVERTICAL
);
297 m_textCtrl1
= new wxTextCtrl( m_panel3
, wxID_ANY
, _("Single-line"), wxDefaultPosition
, wxDefaultSize
, 0 );
298 m_textCtrl1
->SetToolTip( _("wxTextCtrl") );
299 bSizer2
->Add( m_textCtrl1
, 0, wxTOP
|wxRIGHT
|wxLEFT
, 20 );
301 bSizer2
->Add( 0, 10, 0, 0, 5 );
303 m_textCtrl2
= new wxTextCtrl( m_panel3
, wxID_ANY
, _("Multi-line\nLine1\nLine2\n"), wxDefaultPosition
, wxDefaultSize
, wxTE_MULTILINE
);
304 m_textCtrl2
->SetToolTip( _("wxTextCtrl") );
305 bSizer2
->Add( m_textCtrl2
, 0, wxBOTTOM
|wxRIGHT
|wxLEFT
, 20 );
307 m_richText1
= new wxRichTextCtrl( m_panel3
, wxID_ANY
, wxEmptyString
, wxDefaultPosition
, wxSize( -1,-1 ), 0|wxVSCROLL
|wxHSCROLL
|wxNO_BORDER
|wxWANTS_CHARS
);
308 m_richText1
->SetToolTip( _("wxRichTextCtrl") );
309 m_richText1
->SetMinSize( wxSize( 200,200 ) );
310 bSizer2
->Add( m_richText1
, 0, wxALL
, 20 );
312 m_panel3
->SetSizer( bSizer2
);
314 bSizer2
->Fit( m_panel3
);
316 m_notebook1
->AddPage( m_panel3
, _("[Rich]Text Controls"), false );
319 void GUIFrame::AddPanel_4()
321 m_panel4
= new wxPanel( m_notebook1
, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
, wxTAB_TRAVERSAL
);
323 wxFlexGridSizer
* fgSizer5
;
324 fgSizer5
= new wxFlexGridSizer( 0, 2, 10, 10 );
325 fgSizer5
->SetFlexibleDirection( wxBOTH
);
326 fgSizer5
->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED
);
328 m_colourPicker1
= new wxColourPickerCtrl( m_panel4
, wxID_ANY
, *wxBLACK
, wxDefaultPosition
, wxDefaultSize
, wxCLRP_DEFAULT_STYLE
);
329 m_colourPicker1
->SetToolTip( _("wxColourPickerCtrl") );
330 fgSizer5
->Add( m_colourPicker1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
332 m_fontPicker1
= new wxFontPickerCtrl( m_panel4
, wxID_ANY
, wxNullFont
, wxDefaultPosition
, wxDefaultSize
, wxFNTP_DEFAULT_STYLE
);
333 m_fontPicker1
->SetMaxPointSize( 100 );
334 m_fontPicker1
->SetToolTip( _("wxFontPickerCtrl") );
335 fgSizer5
->Add( m_fontPicker1
, 0, wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
|wxALL
, 20 );
337 m_filePicker1
= new wxFilePickerCtrl( m_panel4
, wxID_ANY
, wxEmptyString
, _("Select a file"), wxT("*.*"), wxDefaultPosition
, wxDefaultSize
, wxFLP_DEFAULT_STYLE
, wxDefaultValidator
, wxT("_FilePickerCtrl") );
338 m_filePicker1
->SetToolTip( _("wxFilePickerCtrl") );
339 fgSizer5
->Add( m_filePicker1
, 0, wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
|wxALL
, 20 );
341 fgSizer5
->Add( 0, 0, 1, wxEXPAND
, 5 );
343 m_calendar1
= new wxCalendarCtrl( m_panel4
, wxID_ANY
, wxDefaultDateTime
, wxDefaultPosition
, wxDefaultSize
, wxCAL_SHOW_HOLIDAYS
);
344 m_calendar1
->SetToolTip( _("wxCalendarCtrl") );
345 fgSizer5
->Add( m_calendar1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
347 m_datePicker1
= new wxDatePickerCtrl( m_panel4
, wxID_ANY
, wxDefaultDateTime
, wxDefaultPosition
, wxDefaultSize
, wxDP_DEFAULT
);
348 m_datePicker1
->SetToolTip( _("wxDatePickerCtrl") );
349 fgSizer5
->Add( m_datePicker1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
351 m_genericDirCtrl1
= new wxGenericDirCtrl( m_panel4
, wxID_ANY
, wxEmptyString
, wxDefaultPosition
, wxDefaultSize
, wxDIRCTRL_3D_INTERNAL
|wxSUNKEN_BORDER
, wxEmptyString
, 0, wxT("_GenericDirCtrl") );
352 m_genericDirCtrl1
->ShowHidden( false );
353 m_genericDirCtrl1
->SetToolTip( _("wxGenericDirCtrl") );
354 m_genericDirCtrl1
->SetMinSize( wxSize( -1,150 ) );
355 fgSizer5
->Add( m_genericDirCtrl1
, 1, wxEXPAND
|wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
357 m_dirPicker1
= new wxDirPickerCtrl( m_panel4
, wxID_ANY
, wxEmptyString
, _("Select a folder"), wxDefaultPosition
, wxDefaultSize
, wxDIRP_DEFAULT_STYLE
, wxDefaultValidator
, wxT("_DirPickerCtrl") );
358 m_dirPicker1
->SetToolTip( _("wxDirPickerCtrl") );
359 fgSizer5
->Add( m_dirPicker1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
361 m_panel4
->SetSizer( fgSizer5
);
363 fgSizer5
->Fit( m_panel4
);
365 m_notebook1
->AddPage( m_panel4
, _("Picker Controls"), false );
368 void GUIFrame::AddPanel_5()
370 m_panel5
= new wxPanel( m_notebook1
, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
, wxTAB_TRAVERSAL
);
372 wxFlexGridSizer
* fgSizer4
;
373 fgSizer4
= new wxFlexGridSizer( 0, 2, 0, 0 );
374 fgSizer4
->SetFlexibleDirection( wxBOTH
);
375 fgSizer4
->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED
);
377 wxString m_choice1Choices
[] = { _("wxChoice"), _("Item1"), _("Item2"), _("Item3"), _("Item4") };
378 int m_choice1NChoices
= sizeof( m_choice1Choices
) / sizeof( wxString
);
379 m_choice1
= new wxChoice( m_panel5
, wxID_ANY
, wxDefaultPosition
, wxDefaultSize
, m_choice1NChoices
, m_choice1Choices
, 0 );
380 m_choice1
->SetSelection( 0 );
381 fgSizer4
->Add( m_choice1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
383 m_comboBox1
= new wxComboBox( m_panel5
, wxID_ANY
, _("wxComboBox"), wxDefaultPosition
, wxDefaultSize
, 0, NULL
, 0 );
384 m_comboBox1
->Append( _("wxComboBox") );
385 m_comboBox1
->Append( _("Item1") );
386 m_comboBox1
->Append( _("Item2") );
387 m_comboBox1
->Append( _("Item3") );
388 m_comboBox1
->Append( _("Item4") );
389 fgSizer4
->Add( m_comboBox1
, 0, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
391 fgSizer4
->Add( 0, 120, 1, wxEXPAND
, 5 );
393 fgSizer4
->Add( 0, 120, 1, wxEXPAND
, 5 );
395 m_bmpComboBox1
= new wxBitmapComboBox(m_panel5
, wxID_ANY
,_("Item1"));
396 m_bmpComboBox1
->Append(_("Item1"), wxBitmap(_T("bitmaps/bell.png"),wxBITMAP_TYPE_PNG
));
397 m_bmpComboBox1
->Append(_("Item2"), wxBitmap(_T("bitmaps/sound.png"),wxBITMAP_TYPE_PNG
));
398 m_bmpComboBox1
->Append(_("Item3"), wxBitmap(_T("bitmaps/bell.png"),wxBITMAP_TYPE_PNG
));
399 m_bmpComboBox1
->Append(_("Item4"), wxBitmap(_T("bitmaps/sound.png"),wxBITMAP_TYPE_PNG
));
400 m_bmpComboBox1
->SetToolTip(_("wxBitmapComboBox"));
401 fgSizer4
->Add( m_bmpComboBox1
, 1, wxALL
|wxALIGN_CENTER_VERTICAL
|wxALIGN_CENTER_HORIZONTAL
|wxEXPAND
, 20 );
403 m_ownerDrawnComboBox1
= PenStyleComboBox::CreateSample(m_panel5
);
404 m_ownerDrawnComboBox1
->SetToolTip(_("wxOwnerDrawnComboBox"));
405 fgSizer4
->Add( m_ownerDrawnComboBox1
, 1, wxALL
|wxEXPAND
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
, 20 );
407 fgSizer4
->Add( 0, 90, 1, wxEXPAND
, 5 );
409 fgSizer4
->Add( 0, 90, 1, wxEXPAND
, 5 );
412 m_comboCtrl1
= new wxComboCtrl(m_panel5
,wxID_ANY
,wxEmptyString
);
413 // first of all, set the popup control!
414 ListViewComboPopup
* popupList
= new ListViewComboPopup();
415 m_comboCtrl1
->SetPopupControl(popupList
);
416 m_comboCtrl1
->SetPopupMaxHeight(80);
418 m_comboCtrl1
->SetText(wxT("wxComboCtrl"));
419 m_comboCtrl1
->SetToolTip(_("wxComboCtrl"));
421 // Populate using wxListView methods
422 popupList
->InsertItem(popupList
->GetItemCount(),wxT("wxComboCtrl"));
423 popupList
->InsertItem(popupList
->GetItemCount(),wxT("with"));
424 popupList
->InsertItem(popupList
->GetItemCount(),wxT("wxListView"));
425 popupList
->InsertItem(popupList
->GetItemCount(),wxT("popup"));
426 popupList
->InsertItem(popupList
->GetItemCount(),wxT("Item1"));
427 popupList
->InsertItem(popupList
->GetItemCount(),wxT("Item2"));
428 popupList
->InsertItem(popupList
->GetItemCount(),wxT("Item3"));
430 popupList
->Select(0, true);
431 fgSizer4
->Add( m_comboCtrl1
, 1, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
|wxEXPAND
, 20 );
434 m_comboCtrl2
= new wxComboCtrl(m_panel5
,wxID_ANY
,wxEmptyString
);
435 // first of all, set the popup control!
436 TreeCtrlComboPopup
* popupTree
= new TreeCtrlComboPopup();
437 m_comboCtrl2
->SetPopupControl(popupTree
);
438 m_comboCtrl2
->SetPopupMaxHeight(80);
440 m_comboCtrl2
->SetText(wxT("wxComboCtrl"));
441 m_comboCtrl2
->SetToolTip(_("wxComboCtrl"));
443 //Add a root and some nodes using wxTreeCtrl methods
444 wxTreeItemId root
= popupTree
->AddRoot(_("wxComboCtrl"));
446 popupTree
->AppendItem(root
, _("with"));
447 popupTree
->AppendItem(root
, _("wxTreeCtrl"));
449 wxTreeItemId node2
= popupTree
->AppendItem(root
, _("popout"));
450 popupTree
->AppendItem(node2
, _("Node1"));
451 popupTree
->AppendItem(node2
, _("Node2"));
453 popupTree
->ExpandAll();
454 fgSizer4
->Add( m_comboCtrl2
, 1, wxALL
|wxALIGN_CENTER_HORIZONTAL
|wxALIGN_CENTER_VERTICAL
|wxEXPAND
, 20 );
456 m_panel5
->SetSizer( fgSizer4
);
458 fgSizer4
->Fit( m_panel5
);
460 m_notebook1
->AddPage( m_panel5
, _("Drop-down Controls"), false );
462 GUIFrame::~GUIFrame()
465 this->Disconnect( wxEVT_CLOSE_WINDOW
, wxCloseEventHandler( GUIFrame::OnClose
) );
466 this->Disconnect( wxID_ANY
, wxEVT_COMMAND_MENU_SELECTED
, wxCommandEventHandler( GUIFrame::OnSeeScreenshots
) );
467 this->Disconnect( wxID_ANY
, wxEVT_COMMAND_MENU_SELECTED
, wxCommandEventHandler( GUIFrame::OnQuit
) );
468 this->Disconnect( wxID_ANY
, wxEVT_COMMAND_MENU_SELECTED
, wxCommandEventHandler( GUIFrame::OnCaptureFullScreen
) );
469 this->Disconnect( wxID_ANY
, wxEVT_COMMAND_MENU_SELECTED
, wxCommandEventHandler( GUIFrame::OnCaptureRect
) );
470 this->Disconnect( wxID_ANY
, wxEVT_COMMAND_MENU_SELECTED
, wxCommandEventHandler( GUIFrame::OnEndCaptureRect
) );
471 this->Disconnect( wxID_ANY
, wxEVT_COMMAND_MENU_SELECTED
, wxCommandEventHandler( GUIFrame::OnCaptureAllControls
) );
472 this->Disconnect( wxID_ANY
, wxEVT_COMMAND_MENU_SELECTED
, wxCommandEventHandler( GUIFrame::OnAbout
) );
473 m_notebook1
->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
, wxNotebookEventHandler( GUIFrame::OnNotebookPageChanged
), NULL
, this );
474 m_notebook1
->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
, wxNotebookEventHandler( GUIFrame::OnNotebookPageChanging
), NULL
, this );