]> git.saurik.com Git - wxWidgets.git/blame - utils/screenshotgen/src/guiframe.cpp
forwarding mouse moved events to the view under the mouse, not the firstResponder
[wxWidgets.git] / utils / screenshotgen / src / guiframe.cpp
CommitLineData
f978831f
BP
1/////////////////////////////////////////////////////////////////////////////
2// Name: guiframe.cpp
3// Purpose: Implement the Application Frame
4// Author: Utensil Candel (UtensilCandel@@gmail.com)
5// RCS-ID: $Id$
526954c5 6// Licence: wxWindows licence
f978831f 7/////////////////////////////////////////////////////////////////////////////
0d5eda9c
FM
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
4bae10bd 16// for all others, include the necessary headers wxWidgets headers)
0d5eda9c
FM
17#ifndef WX_PRECOMP
18#include "wx/wx.h"
19#endif
20
f978831f
BP
21#include "guiframe.h"
22
0d5eda9c
FM
23///////////////////////////////////////////////////////////////////////////
24
25GUIFrame::GUIFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
26{
f978831f 27 this->SetSizeHints( wxDefaultSize, wxDefaultSize );
51d48751
FM
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
ecba92ec
FM
48 m_notebook1->ChangeSelection(0);
49
51d48751
FM
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 ) );
51d48751
FM
59}
60
61void GUIFrame::AddMenuBar()
62{
f978831f 63 mbar = new wxMenuBar( 0 );
51d48751
FM
64
65 //File Menu
f978831f 66 fileMenu = new wxMenu();
51d48751 67
f978831f 68 wxMenuItem* m_menuSeeScr;
9a83f860 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 );
f978831f 70 fileMenu->Append( m_menuSeeScr );
51d48751 71
f978831f 72 fileMenu->AppendSeparator();
51d48751 73
f978831f 74 wxMenuItem* m_menuFileQuit;
9a83f860 75 m_menuFileQuit = new wxMenuItem( fileMenu, wxID_EXIT, wxString( _("&Quit") ) + wxT('\t') + wxT("Alt+F4"), _("Quits the application."), wxITEM_NORMAL );
f978831f 76 fileMenu->Append( m_menuFileQuit );
51d48751 77
f978831f 78 mbar->Append( fileMenu, _("&File") );
51d48751
FM
79
80 //Capture Menu
f978831f 81 captureMenu = new wxMenu();
51d48751 82
f978831f 83 wxMenuItem* m_menuCapFullScreen;
9a83f860 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 );
f978831f 85 captureMenu->Append( m_menuCapFullScreen );
51d48751 86
f978831f 87 wxMenuItem* m_menuCapAll;
9a83f860 88 m_menuCapAll = new wxMenuItem( captureMenu, idMenuCapAll, wxString( _("Capture All") ) + wxT('\t') + wxT("Ctrl+Alt+A"), _("Takes screenshots for all controls automatically."), wxITEM_NORMAL );
f978831f 89 captureMenu->Append( m_menuCapAll );
51d48751 90
f978831f 91 mbar->Append( captureMenu, _("&Capture") );
51d48751
FM
92
93 //Help Menu
f978831f
BP
94 helpMenu = new wxMenu();
95 wxMenuItem* m_menuHelpAbout;
2d143b66 96 m_menuHelpAbout = new wxMenuItem( helpMenu, wxID_ABOUT, wxString( _("&About") ) + wxT('\t') + wxT("F1"), _("Shows info about this application."), wxITEM_NORMAL );
f978831f 97 helpMenu->Append( m_menuHelpAbout );
51d48751 98
f978831f 99 mbar->Append( helpMenu, _("&Help") );
51d48751 100
f978831f 101 this->SetMenuBar( mbar );
51d48751
FM
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 ) );
51d48751
FM
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
111void GUIFrame::AddPanel_1()
112{
f978831f 113 m_panel1 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
51d48751 114
f978831f 115 wxFlexGridSizer* fgSizer1;
51d48751 116 fgSizer1 = new wxFlexGridSizer( 0, 2, 0, 0 );
f978831f
BP
117 fgSizer1->SetFlexibleDirection( wxBOTH );
118 fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_NONE );
51d48751 119
f978831f
BP
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 );
51d48751 122
f978831f
BP
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 );
51d48751 126
f978831f
BP
127 m_checkBox1 = new wxCheckBox( m_panel1, wxID_ANY, _("Checked"), wxDefaultPosition, wxDefaultSize, 0 );
128 m_checkBox1->SetValue(true);
f978831f 129 m_checkBox1->SetToolTip( _("wxCheckBox") );
f978831f 130 fgSizer1->Add( m_checkBox1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
51d48751 131
f978831f 132 m_checkBox2 = new wxCheckBox( m_panel1, wxID_ANY, _("Unchecked"), wxDefaultPosition, wxDefaultSize, 0 );
f978831f 133 m_checkBox2->SetToolTip( _("wxCheckBox") );
f978831f 134 fgSizer1->Add( m_checkBox2, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 20 );
51d48751 135
ecba92ec
FM
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 */
f978831f 141 m_radioBtn1 = new wxRadioButton( m_panel1, wxID_ANY, _("Checked"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
51d48751 142 m_radioBtn1->SetValue( true );
f978831f 143 m_radioBtn1->SetToolTip( _("wxRadioButton") );
f978831f 144 fgSizer1->Add( m_radioBtn1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
51d48751 145
f978831f
BP
146 m_radioBtn2 = new wxRadioButton( m_panel1, wxID_ANY, _("Unchecked"), wxDefaultPosition, wxDefaultSize, 0 );
147 m_radioBtn2->SetToolTip( _("wxRadioButton") );
f978831f 148 fgSizer1->Add( m_radioBtn2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
51d48751 149
9a83f860 150 m_bpButton1 = new wxBitmapButton( m_panel1, wxID_ANY, wxBitmap( wxT("bitmaps/wxwin32x32.png"), wxBITMAP_TYPE_ANY ), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
f978831f 151 m_bpButton1->SetToolTip( _("wxBitmapButton") );
f978831f 152 m_bpButton1->SetToolTip( _("wxBitmapButton") );
f978831f 153 fgSizer1->Add( m_bpButton1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
51d48751 154
9a83f860 155 m_bitmap1 = new wxStaticBitmap( m_panel1, wxID_ANY, wxBitmap( wxT("bitmaps/wxwin32x32.png"), wxBITMAP_TYPE_ANY ), wxDefaultPosition, wxDefaultSize, 0 );
f978831f 156 m_bitmap1->SetToolTip( _("wxStaticBitmap") );
f978831f 157 fgSizer1->Add( m_bitmap1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
51d48751 158
9a83f860 159 m_gauge1 = new wxGauge( m_panel1, wxID_ANY, 100, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL, wxDefaultValidator, wxT("_Gauge") );
51d48751 160 m_gauge1->SetValue( 50 );
f978831f 161 m_gauge1->SetToolTip( _("wxGauge") );
f978831f 162 fgSizer1->Add( m_gauge1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 20 );
51d48751 163
f978831f
BP
164 m_slider1 = new wxSlider( m_panel1, wxID_ANY, 50, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL );
165 m_slider1->SetToolTip( _("wxSlider") );
f978831f 166 fgSizer1->Add( m_slider1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 20 );
51d48751 167
f978831f
BP
168 m_toggleBtn1 = new wxToggleButton( m_panel1, wxID_ANY, _("Untoggled"), wxDefaultPosition, wxDefaultSize, 0 );
169 m_toggleBtn1->SetToolTip( _("wxToggleButton") );
f978831f 170 fgSizer1->Add( m_toggleBtn1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
51d48751 171
f978831f 172 m_toggleBtn2 = new wxToggleButton( m_panel1, wxID_ANY, _("Toggled"), wxDefaultPosition, wxDefaultSize, 0 );
51d48751 173 m_toggleBtn2->SetValue( true );
f978831f 174 m_toggleBtn2->SetToolTip( _("wxToggleButton") );
f978831f 175 fgSizer1->Add( m_toggleBtn2, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 20 );
51d48751 176
9a83f860 177 m_hyperlink1 = new wxHyperlinkCtrl( m_panel1, wxID_ANY, _("www.wxwidgets.org"), wxT("http://www.wxwidgets.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
f978831f 178 m_hyperlink1->SetToolTip( _("wxHyperlinkCtrl") );
f978831f 179 fgSizer1->Add( m_hyperlink1, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 20 );
51d48751 180
9a83f860 181 m_spinCtrl1 = new wxSpinCtrl( m_panel1, wxID_ANY, wxT("5"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 10, 0 );
f978831f 182 m_spinCtrl1->SetToolTip( _("wxSpinCtrl") );
f978831f 183 fgSizer1->Add( m_spinCtrl1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
51d48751 184
f978831f
BP
185 m_spinBtn1 = new wxSpinButton( m_panel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
186 m_spinBtn1->SetToolTip( _("wxSpinButton") );
f978831f 187 fgSizer1->Add( m_spinBtn1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
51d48751 188
f978831f 189 m_scrollBar1 = new wxScrollBar( m_panel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSB_HORIZONTAL );
ecba92ec 190 m_scrollBar1->SetScrollbar(50, 1, 100, 1);
f978831f 191 m_scrollBar1->SetToolTip( _("wxScrollBar") );
f978831f 192 fgSizer1->Add( m_scrollBar1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 20 );
51d48751 193
f978831f
BP
194 m_panel1->SetSizer( fgSizer1 );
195 m_panel1->Layout();
196 fgSizer1->Fit( m_panel1 );
197 m_notebook1->AddPage( m_panel1, _("Tiny Controls"), true );
51d48751
FM
198}
199
200void GUIFrame::AddPanel_2()
201{
f978831f 202 m_panel2 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
51d48751 203
f978831f 204 wxFlexGridSizer* fgSizer2;
51d48751 205 fgSizer2 = new wxFlexGridSizer( 0, 2, 0, 0 );
f978831f
BP
206 fgSizer2->SetFlexibleDirection( wxBOTH );
207 fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
51d48751 208
f978831f
BP
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 );
ecba92ec 212 m_checkList1->Check(0);
f978831f 213 fgSizer2->Add( m_checkList1, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
51d48751 214
f978831f
BP
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 );
51d48751 220
f978831f
BP
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 );
51d48751 226
f978831f 227 m_staticBox1 = new wxStaticBox(m_panel2,wxID_ANY, _("wxStaticBox"), wxDefaultPosition, wxDefaultSize, 0, _("_StaticBox"));
f978831f 228 fgSizer2->Add( m_staticBox1, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 20 );
51d48751 229
f978831f 230 m_treeCtrl1 = new wxTreeCtrl( m_panel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE|wxSUNKEN_BORDER );
ecba92ec
FM
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();
f978831f 236 fgSizer2->Add( m_treeCtrl1, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
51d48751 237
015fba49 238 m_listCtrl1 = new wxListCtrl( m_panel2, wxID_ANY, wxDefaultPosition, wxSize(220,120), wxLC_REPORT|wxSUNKEN_BORDER );
ecba92ec
FM
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 }
f978831f 245 m_listCtrl1->SetToolTip( _("wxListCtrl") );
f978831f 246 fgSizer2->Add( m_listCtrl1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 20 );
51d48751 247
f978831f
BP
248 m_animationCtrl1 = new wxAnimationCtrl(m_panel2, wxID_ANY);
249 m_animationCtrl1->SetToolTip(_("wxAnimationCtrl"));
9a83f860 250 if (m_animationCtrl1->LoadFile(wxT("bitmaps/throbber.gif")))
f978831f
BP
251 m_animationCtrl1->Play();
252 fgSizer2->Add( m_animationCtrl1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
51d48751
FM
253
254 //wxCollapsiblePane 1
9a83f860 255 m_collPane1 = new wxCollapsiblePane(m_panel2, -1, wxT("Collapsed"));
f978831f
BP
256 wxWindow *win = m_collPane1->GetPane();
257 m_collPane1->SetToolTip(_("wxCollapsiblePane"));
51d48751 258
f978831f 259 wxBoxSizer * collbSizer = new wxBoxSizer(wxVERTICAL);
9a83f860
VZ
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"));
f978831f
BP
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 );
51d48751
FM
268
269 //wxCollapsiblePane 2
9a83f860 270 m_collPane2 = new wxCollapsiblePane(m_panel2, -1, wxT("Expanded"));
f978831f
BP
271 wxWindow *win2 = m_collPane2->GetPane();
272 m_collPane2->SetToolTip(_("wxCollapsiblePane"));
51d48751 273
f978831f 274 wxBoxSizer * collbSizer2 = new wxBoxSizer(wxVERTICAL);
9a83f860
VZ
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"));
f978831f
BP
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);
51d48751 282
f978831f 283 m_collPane2->Expand();
51d48751 284
f978831f 285 fgSizer2->Add( m_collPane2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
51d48751 286
f978831f
BP
287 m_panel2->SetSizer( fgSizer2 );
288 m_panel2->Layout();
289 fgSizer2->Fit( m_panel2 );
51d48751 290
f978831f 291 m_notebook1->AddPage( m_panel2, _("Multiple choice Controls"), false );
51d48751
FM
292}
293
294void GUIFrame::AddPanel_3()
295{
f978831f 296 m_panel3 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
51d48751 297
f978831f
BP
298 wxBoxSizer* bSizer2;
299 bSizer2 = new wxBoxSizer( wxVERTICAL );
51d48751 300
f978831f
BP
301 m_textCtrl1 = new wxTextCtrl( m_panel3, wxID_ANY, _("Single-line"), wxDefaultPosition, wxDefaultSize, 0 );
302 m_textCtrl1->SetToolTip( _("wxTextCtrl") );
f978831f 303 bSizer2->Add( m_textCtrl1, 0, wxTOP|wxRIGHT|wxLEFT, 20 );
51d48751 304
f978831f 305 bSizer2->Add( 0, 10, 0, 0, 5 );
51d48751 306
f978831f
BP
307 m_textCtrl2 = new wxTextCtrl( m_panel3, wxID_ANY, _("Multi-line\nLine1\nLine2\n"), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
308 m_textCtrl2->SetToolTip( _("wxTextCtrl") );
f978831f 309 bSizer2->Add( m_textCtrl2, 0, wxBOTTOM|wxRIGHT|wxLEFT, 20 );
51d48751 310
f978831f 311 m_richText1 = new wxRichTextCtrl( m_panel3, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0|wxVSCROLL|wxHSCROLL|wxNO_BORDER|wxWANTS_CHARS );
9a83f860 312 m_richText1->LoadFile(wxT("richtext.xml"));
f978831f
BP
313 m_richText1->SetToolTip( _("wxRichTextCtrl") );
314 m_richText1->SetMinSize( wxSize( 200,200 ) );
f978831f 315 bSizer2->Add( m_richText1, 0, wxALL, 20 );
51d48751 316
f978831f
BP
317 m_panel3->SetSizer( bSizer2 );
318 m_panel3->Layout();
319 bSizer2->Fit( m_panel3 );
51d48751 320
f978831f 321 m_notebook1->AddPage( m_panel3, _("[Rich]Text Controls"), false );
51d48751
FM
322}
323
324void GUIFrame::AddPanel_4()
325{
f978831f 326 m_panel4 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
51d48751 327
f978831f 328 wxFlexGridSizer* fgSizer5;
51d48751 329 fgSizer5 = new wxFlexGridSizer( 0, 2, 10, 10 );
f978831f
BP
330 fgSizer5->SetFlexibleDirection( wxBOTH );
331 fgSizer5->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
51d48751 332
f978831f
BP
333 m_colourPicker1 = new wxColourPickerCtrl( m_panel4, wxID_ANY, *wxBLACK, wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
334 m_colourPicker1->SetToolTip( _("wxColourPickerCtrl") );
f978831f 335 fgSizer5->Add( m_colourPicker1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
51d48751 336
f978831f 337 m_fontPicker1 = new wxFontPickerCtrl( m_panel4, wxID_ANY, wxNullFont, wxDefaultPosition, wxDefaultSize, wxFNTP_DEFAULT_STYLE );
51d48751 338 m_fontPicker1->SetMaxPointSize( 100 );
f978831f 339 m_fontPicker1->SetToolTip( _("wxFontPickerCtrl") );
f978831f 340 fgSizer5->Add( m_fontPicker1, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 20 );
51d48751 341
9a83f860 342 m_filePicker1 = new wxFilePickerCtrl( m_panel4, wxID_ANY, wxEmptyString, _("Select a file"), wxT("*.*"), wxDefaultPosition, wxDefaultSize, wxFLP_DEFAULT_STYLE, wxDefaultValidator, wxT("_FilePickerCtrl") );
ecba92ec
FM
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);
f978831f 349 m_filePicker1->SetToolTip( _("wxFilePickerCtrl") );
f978831f 350 fgSizer5->Add( m_filePicker1, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 20 );
51d48751 351
f978831f 352 fgSizer5->Add( 0, 0, 1, wxEXPAND, 5 );
51d48751 353
f978831f
BP
354 m_calendar1 = new wxCalendarCtrl( m_panel4, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxCAL_SHOW_HOLIDAYS );
355 m_calendar1->SetToolTip( _("wxCalendarCtrl") );
f978831f 356 fgSizer5->Add( m_calendar1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
51d48751 357
f978831f
BP
358 m_datePicker1 = new wxDatePickerCtrl( m_panel4, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT );
359 m_datePicker1->SetToolTip( _("wxDatePickerCtrl") );
f978831f 360 fgSizer5->Add( m_datePicker1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
51d48751 361
9a83f860 362 m_genericDirCtrl1 = new wxGenericDirCtrl( m_panel4, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDIRCTRL_3D_INTERNAL|wxSUNKEN_BORDER, wxEmptyString, 0, wxT("_GenericDirCtrl") );
f978831f
BP
363 m_genericDirCtrl1->ShowHidden( false );
364 m_genericDirCtrl1->SetToolTip( _("wxGenericDirCtrl") );
365 m_genericDirCtrl1->SetMinSize( wxSize( -1,150 ) );
f978831f 366 fgSizer5->Add( m_genericDirCtrl1, 1, wxEXPAND|wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
51d48751 367
9a83f860 368 m_dirPicker1 = new wxDirPickerCtrl( m_panel4, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, wxDIRP_DEFAULT_STYLE, wxDefaultValidator, wxT("_DirPickerCtrl") );
ecba92ec
FM
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);
f978831f 375 m_dirPicker1->SetToolTip( _("wxDirPickerCtrl") );
f978831f 376 fgSizer5->Add( m_dirPicker1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
51d48751 377
f978831f
BP
378 m_panel4->SetSizer( fgSizer5 );
379 m_panel4->Layout();
380 fgSizer5->Fit( m_panel4 );
51d48751 381
f978831f 382 m_notebook1->AddPage( m_panel4, _("Picker Controls"), false );
51d48751
FM
383}
384
385void GUIFrame::AddPanel_5()
386{
f978831f 387 m_panel5 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
51d48751 388
f978831f 389 wxFlexGridSizer* fgSizer4;
51d48751 390 fgSizer4 = new wxFlexGridSizer( 0, 2, 0, 0 );
f978831f
BP
391 fgSizer4->SetFlexibleDirection( wxBOTH );
392 fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
51d48751 393
f978831f
BP
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 );
51d48751 399
f978831f
BP
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") );
ecba92ec
FM
406 m_comboBox1->Select(0);
407 // To look better under gtk
408 #ifdef __WXGTK__
409 m_comboBox1->Delete(4);
410 #endif
f978831f 411 fgSizer4->Add( m_comboBox1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
51d48751 412
f978831f 413 fgSizer4->Add( 0, 120, 1, wxEXPAND, 5 );
51d48751 414
f978831f 415 fgSizer4->Add( 0, 120, 1, wxEXPAND, 5 );
51d48751 416
f978831f 417 m_bmpComboBox1 = new wxBitmapComboBox(m_panel5, wxID_ANY,_("Item1"));
9a83f860
VZ
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));
f978831f
BP
422 m_bmpComboBox1->SetToolTip(_("wxBitmapComboBox"));
423 fgSizer4->Add( m_bmpComboBox1, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 20 );
51d48751 424
f978831f 425 m_ownerDrawnComboBox1 = PenStyleComboBox::CreateSample(m_panel5);
51d48751 426 m_ownerDrawnComboBox1->SetToolTip(_("wxOwnerDrawnComboBox"));
f978831f 427 fgSizer4->Add( m_ownerDrawnComboBox1, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
51d48751 428
f978831f 429 fgSizer4->Add( 0, 90, 1, wxEXPAND, 5 );
51d48751 430
f978831f 431 fgSizer4->Add( 0, 90, 1, wxEXPAND, 5 );
51d48751
FM
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
9a83f860 440 m_comboCtrl1->SetText(wxT("wxComboCtrl"));
51d48751
FM
441 m_comboCtrl1->SetToolTip(_("wxComboCtrl"));
442
443 // Populate using wxListView methods
9a83f860
VZ
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"));
51d48751
FM
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
9a83f860 462 m_comboCtrl2->SetText(wxT("wxComboCtrl"));
51d48751
FM
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
f978831f
BP
478 m_panel5->SetSizer( fgSizer4 );
479 m_panel5->Layout();
480 fgSizer4->Fit( m_panel5 );
51d48751 481
f978831f 482 m_notebook1->AddPage( m_panel5, _("Drop-down Controls"), false );
0d5eda9c 483}
0d5eda9c
FM
484GUIFrame::~GUIFrame()
485{
f978831f
BP
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 ) );
f978831f
BP
491 this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnCaptureAllControls ) );
492 this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnAbout ) );
0d5eda9c 493}