lastest patch from Utensil Candel: remove some legacy code; clarify the logic in the construction of ScreenshotFrame; fix some wxFlexGridSizer issues; update README and TODO list

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57908 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2009-01-08 14:28:55 +00:00
parent 89efaf2b65
commit 51d4875177
5 changed files with 263 additions and 234 deletions

View File

@@ -5,15 +5,47 @@
Author: Utensil Candel (Email: UtensilCandel at GMail dot com) Author: Utensil Candel (Email: UtensilCandel at GMail dot com)
Licence: wxWidgets Licence Licence: wxWidgets Licence
Thanks: Auria, frm, tierra, Jorg (these are the names they use on the wxWidgets forum) Thanks: Francesco Montorsi, Bryan Petty, Auria, Jorg and wxForum
This utility is developed to generate automatically screenshots of the wxWidgets This utility is developed to automatically generate screenshots of the wxWidgets
controls for use in wxWidgets documentation. controls for use in wxWidgets documentation.
The main part of the GUI (guiframe.h/guiframe.cpp) is generated with wxFormBuilder The main part of the GUI (guiframe.h/guiframe.cpp) was generated with wxFormBuilder
(http://wxformbuilder.org/), a powerful cross-platform open-source RAD tool. (http://wxformbuilder.org/), a powerful cross-platform open-source RAD tool. Now its
To add a control that wxFormBuilder doesn't support directly, "custom controls" trace is removed so we can maintain the code without using it.
feature of wxFormBuilder has been used.
Please DO NOT modify guiframe.h/guiframe.cpp; modify the code in the wxFormBuilder
project file, instead. ===User Guide: How To Use==
The screenshots will be generated under sub-directory "screenshots" silently.
Please monitor this folder before taking screenshots using "File->Open screenshots folder".
1) The menu "Capture->Full screen" can take a screeshot for the fullscreen. It's designed
for testing purpose only.
2) The menu "Capture->Regions<Begin>" and "Capture->Regions<End>" was the semi-auto part,
and now it's deprecated and will be removed soon.
3) Finnally the full-auto mode: "Capture->Capture All" or Ctrl+Alt+A, follow the instructions
and all the screenshots will be generated correctly under the subdirectory "screenshots".
==Developer Guide: How To Add More Controls==
(Coming soon)
==To-do List==
1) Remove wxAuiNoteBook related lagacy codes, which is no longer useful;
2) Refactor the GUI code, which was generated by wxFormBuilder, but it's messy for human to
maintain;
3) Remove the class CtrlMaskOut since semi-auto part of this utility is no longer needed.
4) Clearify the interface of class AutoCaptureMechanism and document how to add a new control
that needs to take screenshots, and how to adjust it to avoid bugs in wxRTTI system and
wxWindow::GetScreenRect();
5) Make this utility easier to configure;
6) Add test functionality to confirm bugs in wxRTTI system and wxWindow::GetScreenRect().

View File

@@ -29,193 +29,229 @@
GUIFrame::GUIFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) GUIFrame::GUIFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
{ {
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); this->SetSizeHints( wxDefaultSize, wxDefaultSize );
AddMenuBar();
wxBoxSizer* bSizer0;
bSizer0 = new wxBoxSizer( wxVERTICAL );
m_notebook1 = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
//Add panels into m_notebook1
//Tiny Controls
AddPanel_1();
//Multiple choice Controls
AddPanel_2();
//[Rich]Text Controls
AddPanel_3();
//Picker Controls
AddPanel_4();
//Drop-down Controls
AddPanel_5();
bSizer0->Add( m_notebook1, 1, wxEXPAND | wxALL, 0 );
this->SetSizer( bSizer0 );
this->Layout();
bSizer0->Fit( this );
statusBar = this->CreateStatusBar( 1, wxST_SIZEGRIP, wxID_ANY );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( GUIFrame::OnClose ) );
m_notebook1->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( GUIFrame::OnNotebookPageChanged ), NULL, this );
m_notebook1->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, wxNotebookEventHandler( GUIFrame::OnNotebookPageChanging ), NULL, this );
}
void GUIFrame::AddMenuBar()
{
mbar = new wxMenuBar( 0 ); mbar = new wxMenuBar( 0 );
//File Menu
fileMenu = new wxMenu(); fileMenu = new wxMenu();
wxMenuItem* m_menuSeeScr; wxMenuItem* m_menuSeeScr;
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 ); 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 );
fileMenu->Append( m_menuSeeScr ); fileMenu->Append( m_menuSeeScr );
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
wxMenuItem* m_menuFileQuit; wxMenuItem* m_menuFileQuit;
m_menuFileQuit = new wxMenuItem( fileMenu, wxID_EXIT, wxString( _("&Quit") ) + wxT('\t') + wxT("Alt+F4"), _("Quits the application."), wxITEM_NORMAL ); m_menuFileQuit = new wxMenuItem( fileMenu, wxID_EXIT, wxString( _("&Quit") ) + wxT('\t') + wxT("Alt+F4"), _("Quits the application."), wxITEM_NORMAL );
fileMenu->Append( m_menuFileQuit ); fileMenu->Append( m_menuFileQuit );
mbar->Append( fileMenu, _("&File") ); mbar->Append( fileMenu, _("&File") );
//Capture Menu
captureMenu = new wxMenu(); captureMenu = new wxMenu();
wxMenuItem* m_menuCapFullScreen; wxMenuItem* m_menuCapFullScreen;
m_menuCapFullScreen = new wxMenuItem( captureMenu, idMenuCapFullScreen, wxString( _("&Full Screen") ) + wxT('\t') + wxT("Ctrl+Alt+F"), _("Takes a screenshot of the entire screen."), wxITEM_NORMAL ); m_menuCapFullScreen = new wxMenuItem( captureMenu, idMenuCapFullScreen, wxString( _("&Full Screen") ) + wxT('\t') + wxT("Ctrl+Alt+F"), _("Takes a screenshot of the entire screen."), wxITEM_NORMAL );
captureMenu->Append( m_menuCapFullScreen ); captureMenu->Append( m_menuCapFullScreen );
m_menuCapRect = new wxMenuItem( captureMenu, idMenuCapRect, wxString( _("Regions<Begin>") ) + wxT('\t') + wxT("Ctrl+Alt+R"), _("Manually specify rectangular regions for the screenshots."), wxITEM_NORMAL ); m_menuCapRect = new wxMenuItem( captureMenu, idMenuCapRect, wxString( _("Regions<Begin>") ) + wxT('\t') + wxT("Ctrl+Alt+R"), _("Manually specify rectangular regions for the screenshots."), wxITEM_NORMAL );
captureMenu->Append( m_menuCapRect ); captureMenu->Append( m_menuCapRect );
m_menuEndCapRect = new wxMenuItem( captureMenu, idMenuEndCapRect, wxString( _("Regions<End>") ) + wxT('\t') + wxT("Ctrl+Alt+E"), _("Stop manually generating screenshots."), wxITEM_NORMAL ); m_menuEndCapRect = new wxMenuItem( captureMenu, idMenuEndCapRect, wxString( _("Regions<End>") ) + wxT('\t') + wxT("Ctrl+Alt+E"), _("Stop manually generating screenshots."), wxITEM_NORMAL );
captureMenu->Append( m_menuEndCapRect ); captureMenu->Append( m_menuEndCapRect );
m_menuEndCapRect->Enable( false ); m_menuEndCapRect->Enable( false );
wxMenuItem* m_menuCapAll; wxMenuItem* m_menuCapAll;
m_menuCapAll = new wxMenuItem( captureMenu, idMenuCapAll, wxString( _("Capture All") ) + wxT('\t') + wxT("Ctrl+Alt+A"), _("Takes screenshots for all controls automatically."), wxITEM_NORMAL ); m_menuCapAll = new wxMenuItem( captureMenu, idMenuCapAll, wxString( _("Capture All") ) + wxT('\t') + wxT("Ctrl+Alt+A"), _("Takes screenshots for all controls automatically."), wxITEM_NORMAL );
captureMenu->Append( m_menuCapAll ); captureMenu->Append( m_menuCapAll );
mbar->Append( captureMenu, _("&Capture") ); mbar->Append( captureMenu, _("&Capture") );
//Help Menu
helpMenu = new wxMenu(); helpMenu = new wxMenu();
wxMenuItem* m_menuHelpAbout; wxMenuItem* m_menuHelpAbout;
m_menuHelpAbout = new wxMenuItem( helpMenu, wxID_ABOUT, wxString( _("&About...") ) + wxT('\t') + wxT("F1"), _("Shows info about this application."), wxITEM_NORMAL ); m_menuHelpAbout = new wxMenuItem( helpMenu, wxID_ABOUT, wxString( _("&About...") ) + wxT('\t') + wxT("F1"), _("Shows info about this application."), wxITEM_NORMAL );
helpMenu->Append( m_menuHelpAbout ); helpMenu->Append( m_menuHelpAbout );
mbar->Append( helpMenu, _("&Help") ); mbar->Append( helpMenu, _("&Help") );
this->SetMenuBar( mbar ); this->SetMenuBar( mbar );
wxBoxSizer* bSizer0; // Connect Events
bSizer0 = new wxBoxSizer( wxVERTICAL ); this->Connect( m_menuSeeScr->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnSeeScreenshots ) );
this->Connect( m_menuFileQuit->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnQuit ) );
m_notebook1 = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); this->Connect( m_menuCapFullScreen->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnCaptureFullScreen ) );
this->Connect( m_menuCapRect->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnCaptureRect ) );
this->Connect( m_menuEndCapRect->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnEndCaptureRect ) );
this->Connect( m_menuCapAll->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnCaptureAllControls ) );
this->Connect( m_menuHelpAbout->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnAbout ) );
}
void GUIFrame::AddPanel_1()
{
m_panel1 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_panel1 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxFlexGridSizer* fgSizer1; wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 5, 2, 0, 0 ); fgSizer1 = new wxFlexGridSizer( 0, 2, 0, 0 );
fgSizer1->SetFlexibleDirection( wxBOTH ); fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_NONE ); fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_NONE );
m_button1 = new wxButton( m_panel1, wxID_ANY, _("wxButton"), wxDefaultPosition, wxDefaultSize, 0 ); m_button1 = new wxButton( m_panel1, wxID_ANY, _("wxButton"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_button1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); fgSizer1->Add( m_button1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
m_staticText1 = new wxStaticText( m_panel1, wxID_ANY, _("wxStaticText"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText1 = new wxStaticText( m_panel1, wxID_ANY, _("wxStaticText"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 ); m_staticText1->Wrap( -1 );
fgSizer1->Add( m_staticText1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); fgSizer1->Add( m_staticText1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
m_checkBox1 = new wxCheckBox( m_panel1, wxID_ANY, _("Checked"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkBox1 = new wxCheckBox( m_panel1, wxID_ANY, _("Checked"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBox1->SetValue(true); m_checkBox1->SetValue(true);
m_checkBox1->SetToolTip( _("wxCheckBox") ); m_checkBox1->SetToolTip( _("wxCheckBox") );
fgSizer1->Add( m_checkBox1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); fgSizer1->Add( m_checkBox1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
m_checkBox2 = new wxCheckBox( m_panel1, wxID_ANY, _("Unchecked"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkBox2 = new wxCheckBox( m_panel1, wxID_ANY, _("Unchecked"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBox2->SetToolTip( _("wxCheckBox") ); m_checkBox2->SetToolTip( _("wxCheckBox") );
fgSizer1->Add( m_checkBox2, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 20 ); fgSizer1->Add( m_checkBox2, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 20 );
m_radioBtn1 = new wxRadioButton( m_panel1, wxID_ANY, _("Checked"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); m_radioBtn1 = new wxRadioButton( m_panel1, wxID_ANY, _("Checked"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_radioBtn1->SetValue( true ); m_radioBtn1->SetValue( true );
m_radioBtn1->SetToolTip( _("wxRadioButton") ); m_radioBtn1->SetToolTip( _("wxRadioButton") );
fgSizer1->Add( m_radioBtn1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); fgSizer1->Add( m_radioBtn1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
m_radioBtn2 = new wxRadioButton( m_panel1, wxID_ANY, _("Unchecked"), wxDefaultPosition, wxDefaultSize, 0 ); m_radioBtn2 = new wxRadioButton( m_panel1, wxID_ANY, _("Unchecked"), wxDefaultPosition, wxDefaultSize, 0 );
m_radioBtn2->SetToolTip( _("wxRadioButton") ); m_radioBtn2->SetToolTip( _("wxRadioButton") );
fgSizer1->Add( m_radioBtn2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); fgSizer1->Add( m_radioBtn2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
m_bpButton1 = new wxBitmapButton( m_panel1, wxID_ANY, wxBitmap( wxT("bitmaps/wxwin32x32.png"), wxBITMAP_TYPE_ANY ), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW ); m_bpButton1 = new wxBitmapButton( m_panel1, wxID_ANY, wxBitmap( wxT("bitmaps/wxwin32x32.png"), wxBITMAP_TYPE_ANY ), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
m_bpButton1->SetToolTip( _("wxBitmapButton") ); m_bpButton1->SetToolTip( _("wxBitmapButton") );
m_bpButton1->SetToolTip( _("wxBitmapButton") ); m_bpButton1->SetToolTip( _("wxBitmapButton") );
fgSizer1->Add( m_bpButton1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); fgSizer1->Add( m_bpButton1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
m_bitmap1 = new wxStaticBitmap( m_panel1, wxID_ANY, wxBitmap( wxT("bitmaps/wxwin32x32.png"), wxBITMAP_TYPE_ANY ), wxDefaultPosition, wxDefaultSize, 0 ); m_bitmap1 = new wxStaticBitmap( m_panel1, wxID_ANY, wxBitmap( wxT("bitmaps/wxwin32x32.png"), wxBITMAP_TYPE_ANY ), wxDefaultPosition, wxDefaultSize, 0 );
m_bitmap1->SetToolTip( _("wxStaticBitmap") ); m_bitmap1->SetToolTip( _("wxStaticBitmap") );
fgSizer1->Add( m_bitmap1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); fgSizer1->Add( m_bitmap1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
m_gauge1 = new wxGauge( m_panel1, wxID_ANY, 100, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL, wxDefaultValidator, wxT("_Gauge") ); m_gauge1 = new wxGauge( m_panel1, wxID_ANY, 100, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL, wxDefaultValidator, wxT("_Gauge") );
m_gauge1->SetValue( 50 ); m_gauge1->SetValue( 50 );
m_gauge1->SetToolTip( _("wxGauge") ); m_gauge1->SetToolTip( _("wxGauge") );
fgSizer1->Add( m_gauge1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 20 ); fgSizer1->Add( m_gauge1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 20 );
m_slider1 = new wxSlider( m_panel1, wxID_ANY, 50, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL ); m_slider1 = new wxSlider( m_panel1, wxID_ANY, 50, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL );
m_slider1->SetToolTip( _("wxSlider") ); m_slider1->SetToolTip( _("wxSlider") );
fgSizer1->Add( m_slider1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 20 ); fgSizer1->Add( m_slider1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 20 );
m_toggleBtn1 = new wxToggleButton( m_panel1, wxID_ANY, _("Untoggled"), wxDefaultPosition, wxDefaultSize, 0 ); m_toggleBtn1 = new wxToggleButton( m_panel1, wxID_ANY, _("Untoggled"), wxDefaultPosition, wxDefaultSize, 0 );
m_toggleBtn1->SetToolTip( _("wxToggleButton") ); m_toggleBtn1->SetToolTip( _("wxToggleButton") );
fgSizer1->Add( m_toggleBtn1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); fgSizer1->Add( m_toggleBtn1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
m_toggleBtn2 = new wxToggleButton( m_panel1, wxID_ANY, _("Toggled"), wxDefaultPosition, wxDefaultSize, 0 ); m_toggleBtn2 = new wxToggleButton( m_panel1, wxID_ANY, _("Toggled"), wxDefaultPosition, wxDefaultSize, 0 );
m_toggleBtn2->SetValue( true ); m_toggleBtn2->SetValue( true );
m_toggleBtn2->SetToolTip( _("wxToggleButton") ); m_toggleBtn2->SetToolTip( _("wxToggleButton") );
fgSizer1->Add( m_toggleBtn2, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 20 ); fgSizer1->Add( m_toggleBtn2, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 20 );
m_hyperlink1 = new wxHyperlinkCtrl( m_panel1, wxID_ANY, _("www.wxwidgets.org"), wxT("http://www.wxwidgets.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); m_hyperlink1 = new wxHyperlinkCtrl( m_panel1, wxID_ANY, _("www.wxwidgets.org"), wxT("http://www.wxwidgets.org"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
m_hyperlink1->SetToolTip( _("wxHyperlinkCtrl") ); m_hyperlink1->SetToolTip( _("wxHyperlinkCtrl") );
fgSizer1->Add( m_hyperlink1, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 20 ); fgSizer1->Add( m_hyperlink1, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 20 );
m_spinCtrl1 = new wxSpinCtrl( m_panel1, wxID_ANY, wxT("5"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 10, 0 ); m_spinCtrl1 = new wxSpinCtrl( m_panel1, wxID_ANY, wxT("5"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 10, 0 );
m_spinCtrl1->SetToolTip( _("wxSpinCtrl") ); m_spinCtrl1->SetToolTip( _("wxSpinCtrl") );
fgSizer1->Add( m_spinCtrl1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); fgSizer1->Add( m_spinCtrl1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
m_spinBtn1 = new wxSpinButton( m_panel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); m_spinBtn1 = new wxSpinButton( m_panel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_spinBtn1->SetToolTip( _("wxSpinButton") ); m_spinBtn1->SetToolTip( _("wxSpinButton") );
fgSizer1->Add( m_spinBtn1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); fgSizer1->Add( m_spinBtn1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
m_scrollBar1 = new wxScrollBar( m_panel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSB_HORIZONTAL ); m_scrollBar1 = new wxScrollBar( m_panel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSB_HORIZONTAL );
m_scrollBar1->SetToolTip( _("wxScrollBar") ); m_scrollBar1->SetToolTip( _("wxScrollBar") );
fgSizer1->Add( m_scrollBar1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 20 ); fgSizer1->Add( m_scrollBar1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 20 );
m_panel1->SetSizer( fgSizer1 ); m_panel1->SetSizer( fgSizer1 );
m_panel1->Layout(); m_panel1->Layout();
fgSizer1->Fit( m_panel1 ); fgSizer1->Fit( m_panel1 );
m_notebook1->AddPage( m_panel1, _("Tiny Controls"), true ); m_notebook1->AddPage( m_panel1, _("Tiny Controls"), true );
}
void GUIFrame::AddPanel_2()
{
m_panel2 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_panel2 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxFlexGridSizer* fgSizer2; wxFlexGridSizer* fgSizer2;
fgSizer2 = new wxFlexGridSizer( 5, 2, 0, 0 ); fgSizer2 = new wxFlexGridSizer( 0, 2, 0, 0 );
fgSizer2->SetFlexibleDirection( wxBOTH ); fgSizer2->SetFlexibleDirection( wxBOTH );
fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
wxString m_checkList1Choices[] = { _("wxCheckListBox"), _("Item1"), _("Item2") }; wxString m_checkList1Choices[] = { _("wxCheckListBox"), _("Item1"), _("Item2") };
int m_checkList1NChoices = sizeof( m_checkList1Choices ) / sizeof( wxString ); int m_checkList1NChoices = sizeof( m_checkList1Choices ) / sizeof( wxString );
m_checkList1 = new wxCheckListBox( m_panel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_checkList1NChoices, m_checkList1Choices, 0 ); m_checkList1 = new wxCheckListBox( m_panel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_checkList1NChoices, m_checkList1Choices, 0 );
fgSizer2->Add( m_checkList1, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); fgSizer2->Add( m_checkList1, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
m_listBox1 = new wxListBox( m_panel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); m_listBox1 = new wxListBox( m_panel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
m_listBox1->Append( _("wxListBox") ); m_listBox1->Append( _("wxListBox") );
m_listBox1->Append( _("Item1") ); m_listBox1->Append( _("Item1") );
m_listBox1->Append( _("Item2") ); m_listBox1->Append( _("Item2") );
fgSizer2->Add( m_listBox1, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); fgSizer2->Add( m_listBox1, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
wxString m_radioBox1Choices[] = { _("Item1"), _("Item2") }; wxString m_radioBox1Choices[] = { _("Item1"), _("Item2") };
int m_radioBox1NChoices = sizeof( m_radioBox1Choices ) / sizeof( wxString ); int m_radioBox1NChoices = sizeof( m_radioBox1Choices ) / sizeof( wxString );
m_radioBox1 = new wxRadioBox( m_panel2, wxID_ANY, _("wxRadioBox"), wxDefaultPosition, wxDefaultSize, m_radioBox1NChoices, m_radioBox1Choices, 1, wxRA_SPECIFY_COLS ); m_radioBox1 = new wxRadioBox( m_panel2, wxID_ANY, _("wxRadioBox"), wxDefaultPosition, wxDefaultSize, m_radioBox1NChoices, m_radioBox1Choices, 1, wxRA_SPECIFY_COLS );
m_radioBox1->SetSelection( 0 ); m_radioBox1->SetSelection( 0 );
fgSizer2->Add( m_radioBox1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); fgSizer2->Add( m_radioBox1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
m_staticBox1 = new wxStaticBox(m_panel2,wxID_ANY, _("wxStaticBox"), wxDefaultPosition, wxDefaultSize, 0, _("_StaticBox")); m_staticBox1 = new wxStaticBox(m_panel2,wxID_ANY, _("wxStaticBox"), wxDefaultPosition, wxDefaultSize, 0, _("_StaticBox"));
fgSizer2->Add( m_staticBox1, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 20 ); fgSizer2->Add( m_staticBox1, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 20 );
m_treeCtrl1 = new wxTreeCtrl( m_panel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE|wxSUNKEN_BORDER ); m_treeCtrl1 = new wxTreeCtrl( m_panel2, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE|wxSUNKEN_BORDER );
fgSizer2->Add( m_treeCtrl1, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); fgSizer2->Add( m_treeCtrl1, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
m_listCtrl1 = new wxListCtrl( m_panel2, wxID_ANY, wxDefaultPosition, wxSize(220,120), wxLC_REPORT|wxSUNKEN_BORDER ); m_listCtrl1 = new wxListCtrl( m_panel2, wxID_ANY, wxDefaultPosition, wxSize(220,120), wxLC_REPORT|wxSUNKEN_BORDER );
m_listCtrl1->SetToolTip( _("wxListCtrl") ); m_listCtrl1->SetToolTip( _("wxListCtrl") );
fgSizer2->Add( m_listCtrl1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 20 ); fgSizer2->Add( m_listCtrl1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 20 );
m_animationCtrl1 = new wxAnimationCtrl(m_panel2, wxID_ANY); m_animationCtrl1 = new wxAnimationCtrl(m_panel2, wxID_ANY);
m_animationCtrl1->SetToolTip(_("wxAnimationCtrl")); m_animationCtrl1->SetToolTip(_("wxAnimationCtrl"));
if (m_animationCtrl1->LoadFile(wxT("bitmaps/throbber.gif"))) if (m_animationCtrl1->LoadFile(wxT("bitmaps/throbber.gif")))
m_animationCtrl1->Play(); m_animationCtrl1->Play();
fgSizer2->Add( m_animationCtrl1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); fgSizer2->Add( m_animationCtrl1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
//wxCollapsiblePane 1
m_collPane1 = new wxCollapsiblePane(m_panel2, -1, wxT("Collapsed")); m_collPane1 = new wxCollapsiblePane(m_panel2, -1, wxT("Collapsed"));
wxWindow *win = m_collPane1->GetPane(); wxWindow *win = m_collPane1->GetPane();
m_collPane1->SetToolTip(_("wxCollapsiblePane")); m_collPane1->SetToolTip(_("wxCollapsiblePane"));
wxBoxSizer * collbSizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer * collbSizer = new wxBoxSizer(wxVERTICAL);
wxStaticText* m_collSText = new wxStaticText(win, -1, wxT("You can place")); wxStaticText* m_collSText = new wxStaticText(win, -1, wxT("You can place"));
wxButton* m_collBut = new wxButton(win, -1, wxT("anything")); wxButton* m_collBut = new wxButton(win, -1, wxT("anything"));
@@ -225,11 +261,12 @@ GUIFrame::GUIFrame( wxWindow* parent, wxWindowID id, const wxString& title, cons
collbSizer->Add( m_collText, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0 ); collbSizer->Add( m_collText, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0 );
win->SetSizer(collbSizer); win->SetSizer(collbSizer);
fgSizer2->Add( m_collPane1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); fgSizer2->Add( m_collPane1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
//wxCollapsiblePane 2
m_collPane2 = new wxCollapsiblePane(m_panel2, -1, wxT("Expanded")); m_collPane2 = new wxCollapsiblePane(m_panel2, -1, wxT("Expanded"));
wxWindow *win2 = m_collPane2->GetPane(); wxWindow *win2 = m_collPane2->GetPane();
m_collPane2->SetToolTip(_("wxCollapsiblePane")); m_collPane2->SetToolTip(_("wxCollapsiblePane"));
wxBoxSizer * collbSizer2 = new wxBoxSizer(wxVERTICAL); wxBoxSizer * collbSizer2 = new wxBoxSizer(wxVERTICAL);
wxStaticText* m_collSText2 = new wxStaticText(win2, -1, wxT("You can place")); wxStaticText* m_collSText2 = new wxStaticText(win2, -1, wxT("You can place"));
wxButton* m_collBut2 = new wxButton(win2, -1, wxT("anything")); wxButton* m_collBut2 = new wxButton(win2, -1, wxT("anything"));
@@ -238,105 +275,111 @@ GUIFrame::GUIFrame( wxWindow* parent, wxWindowID id, const wxString& title, cons
collbSizer2->Add( m_collBut2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0 ); collbSizer2->Add( m_collBut2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0 );
collbSizer2->Add( m_collText2, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0 ); collbSizer2->Add( m_collText2, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0 );
win2->SetSizer(collbSizer2); win2->SetSizer(collbSizer2);
m_collPane2->Expand(); m_collPane2->Expand();
fgSizer2->Add( m_collPane2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); fgSizer2->Add( m_collPane2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_panel2->SetSizer( fgSizer2 ); m_panel2->SetSizer( fgSizer2 );
m_panel2->Layout(); m_panel2->Layout();
fgSizer2->Fit( m_panel2 ); fgSizer2->Fit( m_panel2 );
m_notebook1->AddPage( m_panel2, _("Multiple choice Controls"), false ); m_notebook1->AddPage( m_panel2, _("Multiple choice Controls"), false );
}
void GUIFrame::AddPanel_3()
{
m_panel3 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_panel3 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer2; wxBoxSizer* bSizer2;
bSizer2 = new wxBoxSizer( wxVERTICAL ); bSizer2 = new wxBoxSizer( wxVERTICAL );
m_textCtrl1 = new wxTextCtrl( m_panel3, wxID_ANY, _("Single-line"), wxDefaultPosition, wxDefaultSize, 0 ); m_textCtrl1 = new wxTextCtrl( m_panel3, wxID_ANY, _("Single-line"), wxDefaultPosition, wxDefaultSize, 0 );
m_textCtrl1->SetToolTip( _("wxTextCtrl") ); m_textCtrl1->SetToolTip( _("wxTextCtrl") );
bSizer2->Add( m_textCtrl1, 0, wxTOP|wxRIGHT|wxLEFT, 20 ); bSizer2->Add( m_textCtrl1, 0, wxTOP|wxRIGHT|wxLEFT, 20 );
bSizer2->Add( 0, 10, 0, 0, 5 ); bSizer2->Add( 0, 10, 0, 0, 5 );
m_textCtrl2 = new wxTextCtrl( m_panel3, wxID_ANY, _("Multi-line\nLine1\nLine2\n"), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE ); m_textCtrl2 = new wxTextCtrl( m_panel3, wxID_ANY, _("Multi-line\nLine1\nLine2\n"), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
m_textCtrl2->SetToolTip( _("wxTextCtrl") ); m_textCtrl2->SetToolTip( _("wxTextCtrl") );
bSizer2->Add( m_textCtrl2, 0, wxBOTTOM|wxRIGHT|wxLEFT, 20 ); bSizer2->Add( m_textCtrl2, 0, wxBOTTOM|wxRIGHT|wxLEFT, 20 );
m_richText1 = new wxRichTextCtrl( m_panel3, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0|wxVSCROLL|wxHSCROLL|wxNO_BORDER|wxWANTS_CHARS ); m_richText1 = new wxRichTextCtrl( m_panel3, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0|wxVSCROLL|wxHSCROLL|wxNO_BORDER|wxWANTS_CHARS );
m_richText1->SetToolTip( _("wxRichTextCtrl") ); m_richText1->SetToolTip( _("wxRichTextCtrl") );
m_richText1->SetMinSize( wxSize( 200,200 ) ); m_richText1->SetMinSize( wxSize( 200,200 ) );
bSizer2->Add( m_richText1, 0, wxALL, 20 ); bSizer2->Add( m_richText1, 0, wxALL, 20 );
m_panel3->SetSizer( bSizer2 ); m_panel3->SetSizer( bSizer2 );
m_panel3->Layout(); m_panel3->Layout();
bSizer2->Fit( m_panel3 ); bSizer2->Fit( m_panel3 );
m_notebook1->AddPage( m_panel3, _("[Rich]Text Controls"), false ); m_notebook1->AddPage( m_panel3, _("[Rich]Text Controls"), false );
}
void GUIFrame::AddPanel_4()
{
m_panel4 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_panel4 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxFlexGridSizer* fgSizer5; wxFlexGridSizer* fgSizer5;
fgSizer5 = new wxFlexGridSizer( 2, 2, 10, 10 ); fgSizer5 = new wxFlexGridSizer( 0, 2, 10, 10 );
fgSizer5->SetFlexibleDirection( wxBOTH ); fgSizer5->SetFlexibleDirection( wxBOTH );
fgSizer5->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); fgSizer5->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_colourPicker1 = new wxColourPickerCtrl( m_panel4, wxID_ANY, *wxBLACK, wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE ); m_colourPicker1 = new wxColourPickerCtrl( m_panel4, wxID_ANY, *wxBLACK, wxDefaultPosition, wxDefaultSize, wxCLRP_DEFAULT_STYLE );
m_colourPicker1->SetToolTip( _("wxColourPickerCtrl") ); m_colourPicker1->SetToolTip( _("wxColourPickerCtrl") );
fgSizer5->Add( m_colourPicker1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); fgSizer5->Add( m_colourPicker1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
m_fontPicker1 = new wxFontPickerCtrl( m_panel4, wxID_ANY, wxNullFont, wxDefaultPosition, wxDefaultSize, wxFNTP_DEFAULT_STYLE ); m_fontPicker1 = new wxFontPickerCtrl( m_panel4, wxID_ANY, wxNullFont, wxDefaultPosition, wxDefaultSize, wxFNTP_DEFAULT_STYLE );
m_fontPicker1->SetMaxPointSize( 100 ); m_fontPicker1->SetMaxPointSize( 100 );
m_fontPicker1->SetToolTip( _("wxFontPickerCtrl") ); m_fontPicker1->SetToolTip( _("wxFontPickerCtrl") );
fgSizer5->Add( m_fontPicker1, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 20 ); fgSizer5->Add( m_fontPicker1, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 20 );
m_filePicker1 = new wxFilePickerCtrl( m_panel4, wxID_ANY, wxEmptyString, _("Select a file"), wxT("*.*"), wxDefaultPosition, wxDefaultSize, wxFLP_DEFAULT_STYLE, wxDefaultValidator, wxT("_FilePickerCtrl") ); m_filePicker1 = new wxFilePickerCtrl( m_panel4, wxID_ANY, wxEmptyString, _("Select a file"), wxT("*.*"), wxDefaultPosition, wxDefaultSize, wxFLP_DEFAULT_STYLE, wxDefaultValidator, wxT("_FilePickerCtrl") );
m_filePicker1->SetToolTip( _("wxFilePickerCtrl") ); m_filePicker1->SetToolTip( _("wxFilePickerCtrl") );
fgSizer5->Add( m_filePicker1, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 20 ); fgSizer5->Add( m_filePicker1, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 20 );
fgSizer5->Add( 0, 0, 1, wxEXPAND, 5 ); fgSizer5->Add( 0, 0, 1, wxEXPAND, 5 );
m_calendar1 = new wxCalendarCtrl( m_panel4, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxCAL_SHOW_HOLIDAYS ); m_calendar1 = new wxCalendarCtrl( m_panel4, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxCAL_SHOW_HOLIDAYS );
m_calendar1->SetToolTip( _("wxCalendarCtrl") ); m_calendar1->SetToolTip( _("wxCalendarCtrl") );
fgSizer5->Add( m_calendar1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); fgSizer5->Add( m_calendar1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
m_datePicker1 = new wxDatePickerCtrl( m_panel4, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT ); m_datePicker1 = new wxDatePickerCtrl( m_panel4, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT );
m_datePicker1->SetToolTip( _("wxDatePickerCtrl") ); m_datePicker1->SetToolTip( _("wxDatePickerCtrl") );
fgSizer5->Add( m_datePicker1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); fgSizer5->Add( m_datePicker1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
m_genericDirCtrl1 = new wxGenericDirCtrl( m_panel4, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDIRCTRL_3D_INTERNAL|wxSUNKEN_BORDER, wxEmptyString, 0, wxT("_GenericDirCtrl") ); m_genericDirCtrl1 = new wxGenericDirCtrl( m_panel4, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDIRCTRL_3D_INTERNAL|wxSUNKEN_BORDER, wxEmptyString, 0, wxT("_GenericDirCtrl") );
m_genericDirCtrl1->ShowHidden( false ); m_genericDirCtrl1->ShowHidden( false );
m_genericDirCtrl1->SetToolTip( _("wxGenericDirCtrl") ); m_genericDirCtrl1->SetToolTip( _("wxGenericDirCtrl") );
m_genericDirCtrl1->SetMinSize( wxSize( -1,150 ) ); m_genericDirCtrl1->SetMinSize( wxSize( -1,150 ) );
fgSizer5->Add( m_genericDirCtrl1, 1, wxEXPAND|wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); fgSizer5->Add( m_genericDirCtrl1, 1, wxEXPAND|wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
m_dirPicker1 = new wxDirPickerCtrl( m_panel4, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, wxDIRP_DEFAULT_STYLE, wxDefaultValidator, wxT("_DirPickerCtrl") ); m_dirPicker1 = new wxDirPickerCtrl( m_panel4, wxID_ANY, wxEmptyString, _("Select a folder"), wxDefaultPosition, wxDefaultSize, wxDIRP_DEFAULT_STYLE, wxDefaultValidator, wxT("_DirPickerCtrl") );
m_dirPicker1->SetToolTip( _("wxDirPickerCtrl") ); m_dirPicker1->SetToolTip( _("wxDirPickerCtrl") );
fgSizer5->Add( m_dirPicker1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); fgSizer5->Add( m_dirPicker1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
m_panel4->SetSizer( fgSizer5 ); m_panel4->SetSizer( fgSizer5 );
m_panel4->Layout(); m_panel4->Layout();
fgSizer5->Fit( m_panel4 ); fgSizer5->Fit( m_panel4 );
m_notebook1->AddPage( m_panel4, _("Picker Controls"), false ); m_notebook1->AddPage( m_panel4, _("Picker Controls"), false );
}
void GUIFrame::AddPanel_5()
{
m_panel5 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_panel5 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxFlexGridSizer* fgSizer4; wxFlexGridSizer* fgSizer4;
fgSizer4 = new wxFlexGridSizer( 2, 2, 0, 0 ); fgSizer4 = new wxFlexGridSizer( 0, 2, 0, 0 );
fgSizer4->SetFlexibleDirection( wxBOTH ); fgSizer4->SetFlexibleDirection( wxBOTH );
fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
wxString m_choice1Choices[] = { _("wxChoice"), _("Item1"), _("Item2"), _("Item3"), _("Item4") }; wxString m_choice1Choices[] = { _("wxChoice"), _("Item1"), _("Item2"), _("Item3"), _("Item4") };
int m_choice1NChoices = sizeof( m_choice1Choices ) / sizeof( wxString ); int m_choice1NChoices = sizeof( m_choice1Choices ) / sizeof( wxString );
m_choice1 = new wxChoice( m_panel5, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choice1NChoices, m_choice1Choices, 0 ); m_choice1 = new wxChoice( m_panel5, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choice1NChoices, m_choice1Choices, 0 );
m_choice1->SetSelection( 0 ); m_choice1->SetSelection( 0 );
fgSizer4->Add( m_choice1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); fgSizer4->Add( m_choice1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
m_comboBox1 = new wxComboBox( m_panel5, wxID_ANY, _("wxComboBox"), wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); m_comboBox1 = new wxComboBox( m_panel5, wxID_ANY, _("wxComboBox"), wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
m_comboBox1->Append( _("wxComboBox") ); m_comboBox1->Append( _("wxComboBox") );
m_comboBox1->Append( _("Item1") ); m_comboBox1->Append( _("Item1") );
@@ -344,13 +387,11 @@ GUIFrame::GUIFrame( wxWindow* parent, wxWindowID id, const wxString& title, cons
m_comboBox1->Append( _("Item3") ); m_comboBox1->Append( _("Item3") );
m_comboBox1->Append( _("Item4") ); m_comboBox1->Append( _("Item4") );
fgSizer4->Add( m_comboBox1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); fgSizer4->Add( m_comboBox1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
fgSizer4->Add( 0, 120, 1, wxEXPAND, 5 ); fgSizer4->Add( 0, 120, 1, wxEXPAND, 5 );
fgSizer4->Add( 0, 120, 1, wxEXPAND, 5 ); fgSizer4->Add( 0, 120, 1, wxEXPAND, 5 );
m_bmpComboBox1 = new wxBitmapComboBox(m_panel5, wxID_ANY,_("Item1")); m_bmpComboBox1 = new wxBitmapComboBox(m_panel5, wxID_ANY,_("Item1"));
m_bmpComboBox1->Append(_("Item1"), wxBitmap(_T("bitmaps/bell.png"),wxBITMAP_TYPE_PNG)); m_bmpComboBox1->Append(_("Item1"), wxBitmap(_T("bitmaps/bell.png"),wxBITMAP_TYPE_PNG));
m_bmpComboBox1->Append(_("Item2"), wxBitmap(_T("bitmaps/sound.png"),wxBITMAP_TYPE_PNG)); m_bmpComboBox1->Append(_("Item2"), wxBitmap(_T("bitmaps/sound.png"),wxBITMAP_TYPE_PNG));
@@ -358,85 +399,66 @@ GUIFrame::GUIFrame( wxWindow* parent, wxWindowID id, const wxString& title, cons
m_bmpComboBox1->Append(_("Item4"), wxBitmap(_T("bitmaps/sound.png"),wxBITMAP_TYPE_PNG)); m_bmpComboBox1->Append(_("Item4"), wxBitmap(_T("bitmaps/sound.png"),wxBITMAP_TYPE_PNG));
m_bmpComboBox1->SetToolTip(_("wxBitmapComboBox")); m_bmpComboBox1->SetToolTip(_("wxBitmapComboBox"));
fgSizer4->Add( m_bmpComboBox1, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 20 ); fgSizer4->Add( m_bmpComboBox1, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 20 );
m_ownerDrawnComboBox1 = PenStyleComboBox::CreateSample(m_panel5); m_ownerDrawnComboBox1 = PenStyleComboBox::CreateSample(m_panel5);
m_ownerDrawnComboBox1->SetToolTip(_("wxOwnerDrawnComboBox")); m_ownerDrawnComboBox1->SetToolTip(_("wxOwnerDrawnComboBox"));
fgSizer4->Add( m_ownerDrawnComboBox1, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 ); fgSizer4->Add( m_ownerDrawnComboBox1, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 20 );
fgSizer4->Add( 0, 90, 1, wxEXPAND, 5 ); fgSizer4->Add( 0, 90, 1, wxEXPAND, 5 );
fgSizer4->Add( 0, 90, 1, wxEXPAND, 5 ); fgSizer4->Add( 0, 90, 1, wxEXPAND, 5 );
m_comboCtrl1 = new wxComboCtrl(m_panel5,wxID_ANY,wxEmptyString); //wxComboCtrl 1
// first of all, set the popup control! m_comboCtrl1 = new wxComboCtrl(m_panel5,wxID_ANY,wxEmptyString);
ListViewComboPopup* popupList = new ListViewComboPopup(); // first of all, set the popup control!
m_comboCtrl1->SetPopupControl(popupList); ListViewComboPopup* popupList = new ListViewComboPopup();
m_comboCtrl1->SetPopupMaxHeight(80); m_comboCtrl1->SetPopupControl(popupList);
m_comboCtrl1->SetPopupMaxHeight(80);
m_comboCtrl1->SetText(wxT("wxComboCtrl"));
m_comboCtrl1->SetToolTip(_("wxComboCtrl")); m_comboCtrl1->SetText(wxT("wxComboCtrl"));
m_comboCtrl1->SetToolTip(_("wxComboCtrl"));
// Populate using wxListView methods
popupList->InsertItem(popupList->GetItemCount(),wxT("wxComboCtrl")); // Populate using wxListView methods
popupList->InsertItem(popupList->GetItemCount(),wxT("with")); popupList->InsertItem(popupList->GetItemCount(),wxT("wxComboCtrl"));
popupList->InsertItem(popupList->GetItemCount(),wxT("wxListView")); popupList->InsertItem(popupList->GetItemCount(),wxT("with"));
popupList->InsertItem(popupList->GetItemCount(),wxT("popup")); popupList->InsertItem(popupList->GetItemCount(),wxT("wxListView"));
popupList->InsertItem(popupList->GetItemCount(),wxT("Item1")); popupList->InsertItem(popupList->GetItemCount(),wxT("popup"));
popupList->InsertItem(popupList->GetItemCount(),wxT("Item2")); popupList->InsertItem(popupList->GetItemCount(),wxT("Item1"));
popupList->InsertItem(popupList->GetItemCount(),wxT("Item3")); popupList->InsertItem(popupList->GetItemCount(),wxT("Item2"));
popupList->InsertItem(popupList->GetItemCount(),wxT("Item3"));
popupList->Select(0, true);
fgSizer4->Add( m_comboCtrl1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 20 ); popupList->Select(0, true);
fgSizer4->Add( m_comboCtrl1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 20 );
m_comboCtrl2 = new wxComboCtrl(m_panel5,wxID_ANY,wxEmptyString);
// first of all, set the popup control! //wxComboCtrl 2
TreeCtrlComboPopup* popupTree = new TreeCtrlComboPopup(); m_comboCtrl2 = new wxComboCtrl(m_panel5,wxID_ANY,wxEmptyString);
m_comboCtrl2->SetPopupControl(popupTree); // first of all, set the popup control!
m_comboCtrl2->SetPopupMaxHeight(80); TreeCtrlComboPopup* popupTree = new TreeCtrlComboPopup();
m_comboCtrl2->SetPopupControl(popupTree);
m_comboCtrl2->SetText(wxT("wxComboCtrl")); m_comboCtrl2->SetPopupMaxHeight(80);
m_comboCtrl2->SetToolTip(_("wxComboCtrl"));
m_comboCtrl2->SetText(wxT("wxComboCtrl"));
//Add a root and some nodes using wxTreeCtrl methods m_comboCtrl2->SetToolTip(_("wxComboCtrl"));
wxTreeItemId root = popupTree->AddRoot(_("wxComboCtrl"));
//Add a root and some nodes using wxTreeCtrl methods
popupTree->AppendItem(root, _("with")); wxTreeItemId root = popupTree->AddRoot(_("wxComboCtrl"));
popupTree->AppendItem(root, _("wxTreeCtrl"));
popupTree->AppendItem(root, _("with"));
wxTreeItemId node2 = popupTree->AppendItem(root, _("popout")); popupTree->AppendItem(root, _("wxTreeCtrl"));
popupTree->AppendItem(node2, _("Node1"));
popupTree->AppendItem(node2, _("Node2")); wxTreeItemId node2 = popupTree->AppendItem(root, _("popout"));
popupTree->AppendItem(node2, _("Node1"));
popupTree->ExpandAll(); popupTree->AppendItem(node2, _("Node2"));
fgSizer4->Add( m_comboCtrl2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 20 );
popupTree->ExpandAll();
fgSizer4->Add( m_comboCtrl2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 20 );
m_panel5->SetSizer( fgSizer4 ); m_panel5->SetSizer( fgSizer4 );
m_panel5->Layout(); m_panel5->Layout();
fgSizer4->Fit( m_panel5 ); fgSizer4->Fit( m_panel5 );
m_notebook1->AddPage( m_panel5, _("Drop-down Controls"), false );
bSizer0->Add( m_notebook1, 1, wxEXPAND | wxALL, 0 );
this->SetSizer( bSizer0 );
this->Layout();
bSizer0->Fit( this );
statusBar = this->CreateStatusBar( 1, wxST_SIZEGRIP, wxID_ANY );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( GUIFrame::OnClose ) );
this->Connect( m_menuSeeScr->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnSeeScreenshots ) );
this->Connect( m_menuFileQuit->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnQuit ) );
this->Connect( m_menuCapFullScreen->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnCaptureFullScreen ) );
this->Connect( m_menuCapRect->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnCaptureRect ) );
this->Connect( m_menuEndCapRect->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnEndCaptureRect ) );
this->Connect( m_menuCapAll->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnCaptureAllControls ) );
this->Connect( m_menuHelpAbout->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GUIFrame::OnAbout ) );
m_notebook1->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( GUIFrame::OnNotebookPageChanged ), NULL, this );
m_notebook1->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, wxNotebookEventHandler( GUIFrame::OnNotebookPageChanging ), NULL, this );
}
m_notebook1->AddPage( m_panel5, _("Drop-down Controls"), false );
}
GUIFrame::~GUIFrame() GUIFrame::~GUIFrame()
{ {
// Disconnect Events // Disconnect Events

View File

@@ -30,7 +30,7 @@
#include "customcombo.h" #include "customcombo.h"
class GUIFrame : public wxFrame class GUIFrame : public wxFrame
{ {
public: public:
@@ -53,7 +53,11 @@ protected:
wxMenuItem* m_menuCapRect; wxMenuItem* m_menuCapRect;
wxMenuItem* m_menuEndCapRect; wxMenuItem* m_menuEndCapRect;
wxMenu* helpMenu; wxMenu* helpMenu;
wxStatusBar* statusBar;
wxNotebook* m_notebook1; wxNotebook* m_notebook1;
wxPanel* m_panel1; wxPanel* m_panel1;
wxButton* m_button1; wxButton* m_button1;
wxStaticText* m_staticText1; wxStaticText* m_staticText1;
@@ -71,6 +75,7 @@ protected:
wxSpinCtrl* m_spinCtrl1; wxSpinCtrl* m_spinCtrl1;
wxSpinButton* m_spinBtn1; wxSpinButton* m_spinBtn1;
wxScrollBar* m_scrollBar1; wxScrollBar* m_scrollBar1;
wxPanel* m_panel2; wxPanel* m_panel2;
wxCheckListBox* m_checkList1; wxCheckListBox* m_checkList1;
wxListBox* m_listBox1; wxListBox* m_listBox1;
@@ -81,30 +86,28 @@ protected:
wxAnimationCtrl * m_animationCtrl1; wxAnimationCtrl * m_animationCtrl1;
wxCollapsiblePane *m_collPane1; wxCollapsiblePane *m_collPane1;
wxCollapsiblePane *m_collPane2; wxCollapsiblePane *m_collPane2;
wxPanel* m_panel3; wxPanel* m_panel3;
wxTextCtrl* m_textCtrl1; wxTextCtrl* m_textCtrl1;
wxTextCtrl* m_textCtrl2; wxTextCtrl* m_textCtrl2;
wxRichTextCtrl* m_richText1; wxRichTextCtrl* m_richText1;
wxPanel* m_panel4; wxPanel* m_panel4;
wxColourPickerCtrl* m_colourPicker1; wxColourPickerCtrl* m_colourPicker1;
wxFontPickerCtrl* m_fontPicker1; wxFontPickerCtrl* m_fontPicker1;
wxFilePickerCtrl* m_filePicker1; wxFilePickerCtrl* m_filePicker1;
wxCalendarCtrl* m_calendar1; wxCalendarCtrl* m_calendar1;
wxDatePickerCtrl* m_datePicker1; wxDatePickerCtrl* m_datePicker1;
wxGenericDirCtrl* m_genericDirCtrl1; wxGenericDirCtrl* m_genericDirCtrl1;
wxDirPickerCtrl* m_dirPicker1; wxDirPickerCtrl* m_dirPicker1;
wxPanel* m_panel5; wxPanel* m_panel5;
wxChoice* m_choice1; wxChoice* m_choice1;
wxComboBox* m_comboBox1; wxComboBox* m_comboBox1;
wxBitmapComboBox * m_bmpComboBox1; wxBitmapComboBox * m_bmpComboBox1;
PenStyleComboBox * m_ownerDrawnComboBox1; PenStyleComboBox * m_ownerDrawnComboBox1;
wxComboCtrl * m_comboCtrl1; wxComboCtrl * m_comboCtrl1;
wxComboCtrl * m_comboCtrl2; wxComboCtrl * m_comboCtrl2;
wxStatusBar* statusBar;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ){ event.Skip(); } virtual void OnClose( wxCloseEvent& event ){ event.Skip(); }
@@ -117,6 +120,14 @@ protected:
virtual void OnAbout( wxCommandEvent& event ){ event.Skip(); } virtual void OnAbout( wxCommandEvent& event ){ event.Skip(); }
virtual void OnNotebookPageChanged( wxNotebookEvent& event ){ event.Skip(); } virtual void OnNotebookPageChanged( wxNotebookEvent& event ){ event.Skip(); }
virtual void OnNotebookPageChanging( wxNotebookEvent& event ){ event.Skip(); } virtual void OnNotebookPageChanging( wxNotebookEvent& event ){ event.Skip(); }
private:
void AddMenuBar();
void AddPanel_1();
void AddPanel_2();
void AddPanel_3();
void AddPanel_4();
void AddPanel_5();
}; };
#endif //_GUIFRAME_H_ #endif //_GUIFRAME_H_

View File

@@ -34,12 +34,7 @@
// ScreenshotFrame // ScreenshotFrame
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
ScreenshotFrame::ScreenshotFrame(wxFrame *frame) ScreenshotFrame::ScreenshotFrame(wxFrame *frame) : GUIFrame(frame)
#if SCREENSHOTGEN_USE_AUI
: AuiGUIFrame(frame)
#else
: GUIFrame(frame)
#endif
{ {
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
statusBar->SetStatusText(_("Welcome to the Automatic Screenshot Generator!"), 0); statusBar->SetStatusText(_("Welcome to the Automatic Screenshot Generator!"), 0);
@@ -53,11 +48,6 @@ ScreenshotFrame::ScreenshotFrame(wxFrame *frame)
// Do some further customization on some controls generated by wxFormBuilder // Do some further customization on some controls generated by wxFormBuilder
InitFBControls(); InitFBControls();
#if SCREENSHOTGEN_USE_AUI
// Somehow it will be very small after I move to Aui
SetSize(600, 600);
// Maximize(true);
#endif
} }
ScreenshotFrame::~ScreenshotFrame() ScreenshotFrame::~ScreenshotFrame()
@@ -213,13 +203,7 @@ void ScreenshotFrame::OnEndCaptureRect(wxCommandEvent& WXUNUSED(event))
thePage->Disconnect( wxEVT_MOTION, wxMouseEventHandler( CtrlMaskOut::OnMouseMoving ), NULL, m_maskout); thePage->Disconnect( wxEVT_MOTION, wxMouseEventHandler( CtrlMaskOut::OnMouseMoving ), NULL, m_maskout);
} }
void ScreenshotFrame::OnNotebookPageChanging( void ScreenshotFrame::OnNotebookPageChanging(wxNotebookEvent& event)
#if SCREENSHOTGEN_USE_AUI
wxAuiNotebookEvent& event
#else
wxNotebookEvent& event
#endif
)
{ {
if (!capturingRect) if (!capturingRect)
{ {
@@ -236,13 +220,7 @@ wxNotebookEvent& event
event.Skip(); event.Skip();
} }
void ScreenshotFrame::OnNotebookPageChanged( void ScreenshotFrame::OnNotebookPageChanged(wxNotebookEvent& event)
#if SCREENSHOTGEN_USE_AUI
wxAuiNotebookEvent& event
#else
wxNotebookEvent& event
#endif
)
{ {
if (!capturingRect) if (!capturingRect)
{ {

View File

@@ -11,19 +11,10 @@
#include "guiframe.h" #include "guiframe.h"
// when defined to 1, wxAui for the main frame
#define SCREENSHOTGEN_USE_AUI 0
class CtrlMaskOut; class CtrlMaskOut;
class ScreenshotFrame class ScreenshotFrame : public GUIFrame
#if SCREENSHOTGEN_USE_AUI
: public AuiGUIFrame
#else
: public GUIFrame
#endif
{ {
public: public:
ScreenshotFrame(wxFrame *frame); ScreenshotFrame(wxFrame *frame);
@@ -41,13 +32,8 @@ protected: // event handlers
virtual void OnEndCaptureRect( wxCommandEvent& event ); virtual void OnEndCaptureRect( wxCommandEvent& event );
virtual void OnCaptureAllControls( wxCommandEvent& event ); virtual void OnCaptureAllControls( wxCommandEvent& event );
#if SCREENSHOTGEN_USE_AUI
virtual void OnNotebookPageChanged( wxAuiNotebookEvent& event );
virtual void OnNotebookPageChanging( wxAuiNotebookEvent& event );
#else
virtual void OnNotebookPageChanged( wxNotebookEvent& event ); virtual void OnNotebookPageChanged( wxNotebookEvent& event );
virtual void OnNotebookPageChanging( wxNotebookEvent& event ); virtual void OnNotebookPageChanging( wxNotebookEvent& event );
#endif
private: private:
// Helper functions // Helper functions