#include "wx/fontpicker.h"
#include "wx/aboutdlg.h"
+#ifndef __WXMSW__
+ #include "../sample.xpm"
+#endif
+
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
PANE_SHOWDLG,
PANE_ABOUT = wxID_ABOUT,
PANE_QUIT = wxID_EXIT,
-
+
PANE_BUTTON,
PANE_TEXTCTRL
};
wxDefaultPosition, wxSize(420, 300),
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
{
+ SetIcon(wxICON(sample));
+
#if wxUSE_STATUSBAR
CreateStatusBar(2);
#endif // wxUSE_STATUSBAR
m_collPane = new wxCollapsiblePane(this, -1, wxT("test!"));
wxWindow *win = m_collPane->GetPane();
-
+
m_paneSizer = new wxBoxSizer( wxVERTICAL );
m_paneSizer->Add( new wxStaticText(win, -1, wxT("Static text") ), 0, wxALIGN_LEFT );
m_paneSizer->Add( new wxStaticText(win, -1, wxT("Yet another one!") ), 0, wxALIGN_LEFT );
{
wxSizerItem *item = m_paneSizer->GetItem( FindWindow(PANE_TEXTCTRL), true );
item->SetFlag( wxALIGN_RIGHT );
-
+
Layout();
}
#include "wx/log.h"
#include "wx/config.h"
+#ifndef __WXMSW__
+ #include "../sample.xpm"
+#endif
+
// ----------------------------------------------------------------------------
// classes
// ----------------------------------------------------------------------------
class MyFrame: public wxFrame
{
public:
- MyFrame();
- virtual ~MyFrame();
+ MyFrame();
+ virtual ~MyFrame();
- // callbacks
- void OnQuit(wxCommandEvent& event);
- void OnAbout(wxCommandEvent& event);
- void OnDelete(wxCommandEvent& event);
+ // callbacks
+ void OnQuit(wxCommandEvent& event);
+ void OnAbout(wxCommandEvent& event);
+ void OnDelete(wxCommandEvent& event);
private:
- wxTextCtrl *m_text;
- wxCheckBox *m_check;
+ wxTextCtrl *m_text;
+ wxCheckBox *m_check;
- DECLARE_EVENT_TABLE()
+ DECLARE_EVENT_TABLE()
};
enum
// `Main program' equivalent, creating windows and returning main app frame
bool MyApp::OnInit()
{
- if ( !wxApp::OnInit() )
- return false;
-
- // we're using wxConfig's "create-on-demand" feature: it will create the
- // config object when it's used for the first time. It has a number of
- // advantages compared with explicitly creating our wxConfig:
- // 1) we don't pay for it if we don't use it
- // 2) there is no danger to create it twice
-
- // application and vendor name are used by wxConfig to construct the name
- // of the config file/registry key and must be set before the first call
- // to Get() if you want to override the default values (the application
- // name is the name of the executable and the vendor name is the same)
- SetVendorName(_T("wxWidgets"));
- SetAppName(_T("conftest")); // not needed, it's the default value
-
- wxConfigBase *pConfig = wxConfigBase::Get();
-
- // uncomment this to force writing back of the defaults for all values
- // if they're not present in the config - this can give the user an idea
- // of all possible settings for this program
- pConfig->SetRecordDefaults();
-
- // or you could also write something like this:
- // wxFileConfig *pConfig = new wxFileConfig("conftest");
- // wxConfigBase::Set(pConfig);
- // where you can also specify the file names explicitly if you wish.
- // Of course, calling Set() is optional and you only must do it if
- // you want to later retrieve this pointer with Get().
-
- // create the main program window
- MyFrame *frame = new MyFrame;
- frame->Show(true);
- SetTopWindow(frame);
-
- // use our config object...
- if ( pConfig->Read(_T("/Controls/Check"), 1l) != 0 ) {
- wxMessageBox(_T("You can disable this message box by unchecking\n")
- _T("the checkbox in the main window (of course, a real\n")
- _T("program would have a checkbox right here but we\n")
- _T("keep it simple)"), _T("Welcome to wxConfig demo"),
- wxICON_INFORMATION | wxOK);
- }
+ if ( !wxApp::OnInit() )
+ return false;
+
+ // we're using wxConfig's "create-on-demand" feature: it will create the
+ // config object when it's used for the first time. It has a number of
+ // advantages compared with explicitly creating our wxConfig:
+ // 1) we don't pay for it if we don't use it
+ // 2) there is no danger to create it twice
+
+ // application and vendor name are used by wxConfig to construct the name
+ // of the config file/registry key and must be set before the first call
+ // to Get() if you want to override the default values (the application
+ // name is the name of the executable and the vendor name is the same)
+ SetVendorName(_T("wxWidgets"));
+ SetAppName(_T("conftest")); // not needed, it's the default value
+
+ wxConfigBase *pConfig = wxConfigBase::Get();
- return true;
+ // uncomment this to force writing back of the defaults for all values
+ // if they're not present in the config - this can give the user an idea
+ // of all possible settings for this program
+ pConfig->SetRecordDefaults();
+
+ // or you could also write something like this:
+ // wxFileConfig *pConfig = new wxFileConfig("conftest");
+ // wxConfigBase::Set(pConfig);
+ // where you can also specify the file names explicitly if you wish.
+ // Of course, calling Set() is optional and you only must do it if
+ // you want to later retrieve this pointer with Get().
+
+ // create the main program window
+ MyFrame *frame = new MyFrame;
+ frame->Show(true);
+ SetTopWindow(frame);
+
+ // use our config object...
+ if ( pConfig->Read(_T("/Controls/Check"), 1l) != 0 ) {
+ wxMessageBox(_T("You can disable this message box by unchecking\n")
+ _T("the checkbox in the main window (of course, a real\n")
+ _T("program would have a checkbox right here but we\n")
+ _T("keep it simple)"), _T("Welcome to wxConfig demo"),
+ wxICON_INFORMATION | wxOK);
+ }
+
+ return true;
}
int MyApp::OnExit()
{
- // clean up: Set() returns the active config object as Get() does, but unlike
- // Get() it doesn't try to create one if there is none (definitely not what
- // we want here!)
- delete wxConfigBase::Set((wxConfigBase *) NULL);
+ // clean up: Set() returns the active config object as Get() does, but unlike
+ // Get() it doesn't try to create one if there is none (definitely not what
+ // we want here!)
+ delete wxConfigBase::Set((wxConfigBase *) NULL);
- return 0;
+ return 0;
}
// ----------------------------------------------------------------------------
MyFrame::MyFrame()
: wxFrame((wxFrame *) NULL, wxID_ANY, _T("wxConfig Demo"))
{
- // menu
- wxMenu *file_menu = new wxMenu;
-
- file_menu->Append(ConfTest_Delete, _T("&Delete"), _T("Delete config file"));
- file_menu->AppendSeparator();
- file_menu->Append(ConfTest_About, _T("&About\tF1"), _T("About this sample"));
- file_menu->AppendSeparator();
- file_menu->Append(ConfTest_Quit, _T("E&xit\tAlt-X"), _T("Exit the program"));
- wxMenuBar *menu_bar = new wxMenuBar;
- menu_bar->Append(file_menu, _T("&File"));
- SetMenuBar(menu_bar);
+ SetIcon(wxICON(sample));
+
+ // menu
+ wxMenu *file_menu = new wxMenu;
+
+ file_menu->Append(ConfTest_Delete, _T("&Delete"), _T("Delete config file"));
+ file_menu->AppendSeparator();
+ file_menu->Append(ConfTest_About, _T("&About\tF1"), _T("About this sample"));
+ file_menu->AppendSeparator();
+ file_menu->Append(ConfTest_Quit, _T("E&xit\tAlt-X"), _T("Exit the program"));
+ wxMenuBar *menu_bar = new wxMenuBar;
+ menu_bar->Append(file_menu, _T("&File"));
+ SetMenuBar(menu_bar);
#if wxUSE_STATUSBAR
- CreateStatusBar();
+ CreateStatusBar();
#endif // wxUSE_STATUSBAR
- // child controls
- wxPanel *panel = new wxPanel(this);
- (void)new wxStaticText(panel, wxID_ANY, _T("These controls remember their values!"),
- wxPoint(10, 10), wxSize(300, 20));
- m_text = new wxTextCtrl(panel, wxID_ANY, _T(""), wxPoint(10, 40), wxSize(300, 20));
- m_check = new wxCheckBox(panel, wxID_ANY, _T("show welcome message box at startup"),
- wxPoint(10, 70), wxSize(300, 20));
-
- // restore the control's values from the config
-
- // NB: in this program, the config object is already created at this moment
- // because we had called Get() from MyApp::OnInit(). However, if you later
- // change the code and don't create it before this line, it won't break
- // anything - unlike if you manually create wxConfig object with Create()
- // or in any other way (then you must be sure to create it before using it!).
- wxConfigBase *pConfig = wxConfigBase::Get();
-
- // we could write Read("/Controls/Text") as well, it's just to show SetPath()
- pConfig->SetPath(_T("/Controls"));
-
- m_text->SetValue(pConfig->Read(_T("Text"), _T("")));
- m_check->SetValue(pConfig->Read(_T("Check"), 1l) != 0);
-
- // SetPath() understands ".."
- pConfig->SetPath(_T("../MainFrame"));
-
- // restore frame position and size
- int x = pConfig->Read(_T("x"), 50),
- y = pConfig->Read(_T("y"), 50),
- w = pConfig->Read(_T("w"), 350),
- h = pConfig->Read(_T("h"), 200);
- Move(x, y);
- SetClientSize(w, h);
-
- pConfig->SetPath(_T("/"));
- wxString s;
- if ( pConfig->Read(_T("TestValue"), &s) )
- {
- wxLogStatus(this, wxT("TestValue from config is '%s'"), s.c_str());
- }
- else
- {
- wxLogStatus(this, wxT("TestValue not found in the config"));
- }
+ // child controls
+ wxPanel *panel = new wxPanel(this);
+ (void)new wxStaticText(panel, wxID_ANY, _T("These controls remember their values!"),
+ wxPoint(10, 10), wxSize(300, 20));
+ m_text = new wxTextCtrl(panel, wxID_ANY, _T(""), wxPoint(10, 40), wxSize(300, 20));
+ m_check = new wxCheckBox(panel, wxID_ANY, _T("show welcome message box at startup"),
+ wxPoint(10, 70), wxSize(300, 20));
+
+ // restore the control's values from the config
+
+ // NB: in this program, the config object is already created at this moment
+ // because we had called Get() from MyApp::OnInit(). However, if you later
+ // change the code and don't create it before this line, it won't break
+ // anything - unlike if you manually create wxConfig object with Create()
+ // or in any other way (then you must be sure to create it before using it!).
+ wxConfigBase *pConfig = wxConfigBase::Get();
+
+ // we could write Read("/Controls/Text") as well, it's just to show SetPath()
+ pConfig->SetPath(_T("/Controls"));
+
+ m_text->SetValue(pConfig->Read(_T("Text"), _T("")));
+ m_check->SetValue(pConfig->Read(_T("Check"), 1l) != 0);
+
+ // SetPath() understands ".."
+ pConfig->SetPath(_T("../MainFrame"));
+
+ // restore frame position and size
+ int x = pConfig->Read(_T("x"), 50),
+ y = pConfig->Read(_T("y"), 50),
+ w = pConfig->Read(_T("w"), 350),
+ h = pConfig->Read(_T("h"), 200);
+ Move(x, y);
+ SetClientSize(w, h);
+
+ pConfig->SetPath(_T("/"));
+ wxString s;
+ if ( pConfig->Read(_T("TestValue"), &s) )
+ {
+ wxLogStatus(this, wxT("TestValue from config is '%s'"), s.c_str());
+ }
+ else
+ {
+ wxLogStatus(this, wxT("TestValue not found in the config"));
+ }
}
void MyFrame::OnQuit(wxCommandEvent&)
{
- Close(true);
+ Close(true);
}
void MyFrame::OnAbout(wxCommandEvent&)
{
- wxMessageBox(_T("wxConfig demo\n(c) 1998-2001 Vadim Zeitlin"), _T("About"),
- wxICON_INFORMATION | wxOK);
+ wxMessageBox(_T("wxConfig demo\n(c) 1998-2001 Vadim Zeitlin"), _T("About"),
+ wxICON_INFORMATION | wxOK);
}
void MyFrame::OnDelete(wxCommandEvent&)
MyFrame::~MyFrame()
{
- wxConfigBase *pConfig = wxConfigBase::Get();
- if ( pConfig == NULL )
- return;
-
- // save the control's values to the config
- pConfig->Write(_T("/Controls/Text"), m_text->GetValue());
- pConfig->Write(_T("/Controls/Check"), m_check->GetValue());
-
- // save the frame position
- int x, y, w, h;
- GetClientSize(&w, &h);
- GetPosition(&x, &y);
- pConfig->Write(_T("/MainFrame/x"), (long) x);
- pConfig->Write(_T("/MainFrame/y"), (long) y);
- pConfig->Write(_T("/MainFrame/w"), (long) w);
- pConfig->Write(_T("/MainFrame/h"), (long) h);
-
- pConfig->Write(_T("/TestValue"), wxT("A test value"));
+ wxConfigBase *pConfig = wxConfigBase::Get();
+ if ( pConfig == NULL )
+ return;
+
+ // save the control's values to the config
+ pConfig->Write(_T("/Controls/Text"), m_text->GetValue());
+ pConfig->Write(_T("/Controls/Check"), m_check->GetValue());
+
+ // save the frame position
+ int x, y, w, h;
+ GetClientSize(&w, &h);
+ GetPosition(&x, &y);
+ pConfig->Write(_T("/MainFrame/x"), (long) x);
+ pConfig->Write(_T("/MainFrame/y"), (long) y);
+ pConfig->Write(_T("/MainFrame/w"), (long) w);
+ pConfig->Write(_T("/MainFrame/h"), (long) h);
+
+ pConfig->Write(_T("/TestValue"), wxT("A test value"));
}
#include "wx/dialup.h"
+#ifndef __WXMSW__
+ #include "../sample.xpm"
+#endif
+
// ----------------------------------------------------------------------------
// private classes
// ----------------------------------------------------------------------------
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size)
{
+ SetIcon(wxICON(sample));
+
// create a menu bar
wxMenu *menuFile = new wxMenu;
#include "wx/wx.h"
#endif
+#ifndef __WXMSW__
+ #include "../sample.xpm"
+#endif
+
// ----------------------------------------------------------------------------
// event constants
// ----------------------------------------------------------------------------
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size)
{
+ SetIcon(wxICON(sample));
+
// init members
m_nPush = 0;
#include "griddemo.h"
+#ifndef __WXMSW__
+ #include "../sample.xpm"
+#endif
+
// ----------------------------------------------------------------------------
// wxWin macros
// ----------------------------------------------------------------------------
wxDefaultPosition,
wxDefaultSize )
{
+ SetIcon(wxICON(sample));
+
wxMenu *fileMenu = new wxMenu;
fileMenu->Append( ID_VTABLE, _T("&Virtual table test\tCtrl-V"));
fileMenu->Append( ID_BUGS_TABLE, _T("&Bugs table test\tCtrl-B"));
#include "canvas.h"
+#ifndef __WXMSW__
+ #include "../sample.xpm"
+#endif
// ============================================================================
// declarations
: wxFrame( (wxFrame *)NULL, wxID_ANY, _T("wxImage sample"),
wxPoint(20, 20), wxSize(950, 700) )
{
+ SetIcon(wxICON(sample));
+
wxMenuBar *menu_bar = new wxMenuBar();
wxMenu *menuImage = new wxMenu;
#include "wx/wx.h"
#endif
+#ifndef __WXMSW__
+ #include "../sample.xpm"
+#endif
// Define a new frame type: this is going to be our main frame
class MyFrame : public wxFrame
m_inputWin(NULL),
m_skip(true)
{
+ SetIcon(wxICON(sample));
+
// IDs for menu items
enum
{
" RawKeyCode RawKeyFlags");
- m_logText = new wxTextCtrl(this, wxID_ANY, "",
+ m_logText = new wxTextCtrl(this, wxID_ANY, "",
wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL);
// set monospace font to have output in nice columns
- wxFont font(10, wxFONTFAMILY_TELETYPE,
+ wxFont font(10, wxFONTFAMILY_TELETYPE,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
headerText->SetFont(font);
m_logText->SetFont(font);
Connect(SkipID, wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler(MyFrame::OnSkip));
- // connect event handlers for the blue input window
+ // connect event handlers for the blue input window
m_inputWin->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MyFrame::OnKeyDown),
NULL, this);
m_inputWin->Connect(wxEVT_KEY_UP, wxKeyEventHandler(MyFrame::OnKeyUp),
NULL, this);
m_inputWin->Connect(wxEVT_CHAR, wxKeyEventHandler(MyFrame::OnChar),
NULL, this);
- m_inputWin->Connect(wxEVT_PAINT,
+ m_inputWin->Connect(wxEVT_PAINT,
wxPaintEventHandler(MyFrame::OnPaintInputWin),
NULL, this);
font.SetPointSize(font.GetPointSize() + 2);
dc.SetFont(font);
- dc.DrawLabel("Press keys here",
+ dc.DrawLabel("Press keys here",
m_inputWin->GetClientRect(), wxALIGN_CENTER);
}
switch ( keycode )
{
#define WXK_(x) \
- case WXK_##x: return #x;
+ case WXK_##x: return #x;
WXK_(BACK)
WXK_(TAB)
WXK_(NUMPAD_DECIMAL)
WXK_(NUMPAD_DIVIDE)
#undef WXK_
- default:
- return NULL;
+ default:
+ return NULL;
}
}
void MyFrame::LogEvent(const wxString& name, wxKeyEvent& event)
{
wxString msg;
- // event key_name KeyCode modifiers Unicode raw_code raw_flags
+ // event key_name KeyCode modifiers Unicode raw_code raw_flags
msg.Printf("%7s %15s %5d %c%c%c%c"
#if wxUSE_UNICODE
"%5d (U+%04x)"
#include "layout.h"
+#ifndef __WXMSW__
+ #include "../sample.xpm"
+#endif
+
+
// ----------------------------------------------------------------------------
// MyApp
// ----------------------------------------------------------------------------
wxPoint(30,30), wxDefaultSize,
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
{
- // Make a menubar
- wxMenu *file_menu = new wxMenu;
+ SetIcon(wxICON(sample));
- file_menu->Append(LAYOUT_TEST_PROPORTIONS, _T("&Proportions demo...\tF1"));
- file_menu->Append(LAYOUT_TEST_SIZER, _T("Test wx&FlexSizer...\tF2"));
- file_menu->Append(LAYOUT_TEST_NB_SIZER, _T("Test ¬ebook sizers...\tF3"));
- file_menu->Append(LAYOUT_TEST_GB_SIZER, _T("Test &gridbag sizer...\tF4"));
- file_menu->Append(LAYOUT_TEST_SET_MINIMAL, _T("Test Set&ItemMinSize...\tF5"));
- file_menu->Append(LAYOUT_TEST_NESTED, _T("Test nested sizer in a wxPanel...\tF6"));
- file_menu->Append(LAYOUT_TEST_WRAP, _T("Test wrap sizers...\tF7"));
+ // Make a menubar
+ wxMenu *file_menu = new wxMenu;
- file_menu->AppendSeparator();
- file_menu->Append(LAYOUT_QUIT, _T("E&xit"), _T("Quit program"));
+ file_menu->Append(LAYOUT_TEST_PROPORTIONS, _T("&Proportions demo...\tF1"));
+ file_menu->Append(LAYOUT_TEST_SIZER, _T("Test wx&FlexSizer...\tF2"));
+ file_menu->Append(LAYOUT_TEST_NB_SIZER, _T("Test ¬ebook sizers...\tF3"));
+ file_menu->Append(LAYOUT_TEST_GB_SIZER, _T("Test &gridbag sizer...\tF4"));
+ file_menu->Append(LAYOUT_TEST_SET_MINIMAL, _T("Test Set&ItemMinSize...\tF5"));
+ file_menu->Append(LAYOUT_TEST_NESTED, _T("Test nested sizer in a wxPanel...\tF6"));
+ file_menu->Append(LAYOUT_TEST_WRAP, _T("Test wrap sizers...\tF7"));
- wxMenu *help_menu = new wxMenu;
- help_menu->Append(LAYOUT_ABOUT, _T("&About"), _T("About layout demo..."));
+ file_menu->AppendSeparator();
+ file_menu->Append(LAYOUT_QUIT, _T("E&xit"), _T("Quit program"));
- wxMenuBar *menu_bar = new wxMenuBar;
+ wxMenu *help_menu = new wxMenu;
+ help_menu->Append(LAYOUT_ABOUT, _T("&About"), _T("About layout demo..."));
- menu_bar->Append(file_menu, _T("&File"));
- menu_bar->Append(help_menu, _T("&Help"));
+ wxMenuBar *menu_bar = new wxMenuBar;
+
+ menu_bar->Append(file_menu, _T("&File"));
+ menu_bar->Append(help_menu, _T("&Help"));
- // Associate the menu bar with the frame
- SetMenuBar(menu_bar);
+ // Associate the menu bar with the frame
+ SetMenuBar(menu_bar);
#if wxUSE_STATUSBAR
- CreateStatusBar(2);
- SetStatusText(_T("wxWidgets layout demo"));
+ CreateStatusBar(2);
+ SetStatusText(_T("wxWidgets layout demo"));
#endif // wxUSE_STATUSBAR
- wxPanel* p = new wxPanel(this, wxID_ANY);
-
- // we want to get a dialog that is stretchable because it
- // has a text ctrl in the middle. at the bottom, we have
- // two buttons which.
-
- wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
-
- // 1) top: create wxStaticText with minimum size equal to its default size
- topsizer->Add(
- new wxStaticText( p, wxID_ANY, _T("An explanation (wxALIGN_RIGHT).") ),
- wxSizerFlags().Align(wxALIGN_RIGHT).Border(wxALL & ~wxBOTTOM, 5));
- topsizer->Add(
- new wxStaticText( p, wxID_ANY, _T("An explanation (wxALIGN_LEFT).") ),
- wxSizerFlags().Align(wxALIGN_LEFT).Border(wxALL & ~wxBOTTOM, 5));
- topsizer->Add(
- new wxStaticText( p, wxID_ANY, _T("An explanation (wxALIGN_CENTRE_HORIZONTAL).") ),
- wxSizerFlags().Align(wxALIGN_CENTRE_HORIZONTAL).Border(wxALL & ~wxBOTTOM, 5));
-
- // 2) top: create wxTextCtrl with minimum size (100x60)
- topsizer->Add(
- new wxTextCtrl( p, wxID_ANY, _T("My text (wxEXPAND)."), wxDefaultPosition, wxSize(100,60), wxTE_MULTILINE),
- wxSizerFlags(1).Expand().Border(wxALL, 5));
-
- // 2.5) Gratuitous test of wxStaticBoxSizers
- wxBoxSizer *statsizer = new wxStaticBoxSizer(
- new wxStaticBox(p, wxID_ANY, _T("A wxStaticBoxSizer")), wxVERTICAL );
- statsizer->Add(
- new wxStaticText(p, wxID_ANY, _T("And some TEXT inside it")),
- wxSizerFlags().Border(wxALL, 30));
- topsizer->Add(
- statsizer,
- wxSizerFlags(1).Expand().Border(wxALL, 10));
+ wxPanel* p = new wxPanel(this, wxID_ANY);
+
+ // we want to get a dialog that is stretchable because it
+ // has a text ctrl in the middle. at the bottom, we have
+ // two buttons which.
+
+ wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
+
+ // 1) top: create wxStaticText with minimum size equal to its default size
+ topsizer->Add(
+ new wxStaticText( p, wxID_ANY, _T("An explanation (wxALIGN_RIGHT).") ),
+ wxSizerFlags().Align(wxALIGN_RIGHT).Border(wxALL & ~wxBOTTOM, 5));
+ topsizer->Add(
+ new wxStaticText( p, wxID_ANY, _T("An explanation (wxALIGN_LEFT).") ),
+ wxSizerFlags().Align(wxALIGN_LEFT).Border(wxALL & ~wxBOTTOM, 5));
+ topsizer->Add(
+ new wxStaticText( p, wxID_ANY, _T("An explanation (wxALIGN_CENTRE_HORIZONTAL).") ),
+ wxSizerFlags().Align(wxALIGN_CENTRE_HORIZONTAL).Border(wxALL & ~wxBOTTOM, 5));
+
+ // 2) top: create wxTextCtrl with minimum size (100x60)
+ topsizer->Add(
+ new wxTextCtrl( p, wxID_ANY, _T("My text (wxEXPAND)."), wxDefaultPosition, wxSize(100,60), wxTE_MULTILINE),
+ wxSizerFlags(1).Expand().Border(wxALL, 5));
+
+ // 2.5) Gratuitous test of wxStaticBoxSizers
+ wxBoxSizer *statsizer = new wxStaticBoxSizer(
+ new wxStaticBox(p, wxID_ANY, _T("A wxStaticBoxSizer")), wxVERTICAL );
+ statsizer->Add(
+ new wxStaticText(p, wxID_ANY, _T("And some TEXT inside it")),
+ wxSizerFlags().Border(wxALL, 30));
+ topsizer->Add(
+ statsizer,
+ wxSizerFlags(1).Expand().Border(wxALL, 10));
// 2.7) And a test of wxGridSizer
wxGridSizer *gridsizer = new wxGridSizer(2, 5, 5);
gridsizer->Add(new wxStaticText(p, wxID_ANY, _T("Label")),
- wxSizerFlags().Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL));
+ wxSizerFlags().Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL));
gridsizer->Add(new wxTextCtrl(p, wxID_ANY, _T("Grid sizer demo")),
- wxSizerFlags(1).Align(wxGROW | wxALIGN_CENTER_VERTICAL));
+ wxSizerFlags(1).Align(wxGROW | wxALIGN_CENTER_VERTICAL));
gridsizer->Add(new wxStaticText(p, wxID_ANY, _T("Another label")),
- wxSizerFlags().Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL));
+ wxSizerFlags().Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL));
gridsizer->Add(new wxTextCtrl(p, wxID_ANY, _T("More text")),
- wxSizerFlags(1).Align(wxGROW | wxALIGN_CENTER_VERTICAL));
+ wxSizerFlags(1).Align(wxGROW | wxALIGN_CENTER_VERTICAL));
gridsizer->Add(new wxStaticText(p, wxID_ANY, _T("Final label")),
- wxSizerFlags().Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL));
+ wxSizerFlags().Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL));
gridsizer->Add(new wxTextCtrl(p, wxID_ANY, _T("And yet more text")),
- wxSizerFlags().Align(wxGROW | wxALIGN_CENTER_VERTICAL));
+ wxSizerFlags().Align(wxGROW | wxALIGN_CENTER_VERTICAL));
topsizer->Add(
gridsizer,
wxSizerFlags().Proportion(1).Expand().Border(wxALL, 10));
#if wxUSE_STATLINE
- // 3) middle: create wxStaticLine with minimum size (3x3)
- topsizer->Add(
- new wxStaticLine( p, wxID_ANY, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL),
- wxSizerFlags().Expand());
+ // 3) middle: create wxStaticLine with minimum size (3x3)
+ topsizer->Add(
+ new wxStaticLine( p, wxID_ANY, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL),
+ wxSizerFlags().Expand());
#endif // wxUSE_STATLINE
- // 4) bottom: create two centred wxButtons
- wxBoxSizer *button_box = new wxBoxSizer( wxHORIZONTAL );
- button_box->Add(
- new wxButton( p, wxID_ANY, _T("Two buttons in a box") ),
- wxSizerFlags().Border(wxALL, 7));
- button_box->Add(
- new wxButton( p, wxID_ANY, _T("(wxCENTER)") ),
- wxSizerFlags().Border(wxALL, 7));
+ // 4) bottom: create two centred wxButtons
+ wxBoxSizer *button_box = new wxBoxSizer( wxHORIZONTAL );
+ button_box->Add(
+ new wxButton( p, wxID_ANY, _T("Two buttons in a box") ),
+ wxSizerFlags().Border(wxALL, 7));
+ button_box->Add(
+ new wxButton( p, wxID_ANY, _T("(wxCENTER)") ),
+ wxSizerFlags().Border(wxALL, 7));
- topsizer->Add(button_box, wxSizerFlags().Center());
+ topsizer->Add(button_box, wxSizerFlags().Center());
- p->SetSizer( topsizer );
+ p->SetSizer( topsizer );
- // don't allow frame to get smaller than what the sizers tell it and also set
- // the initial size as calculated by the sizers
- topsizer->SetSizeHints( this );
+ // don't allow frame to get smaller than what the sizers tell it and also set
+ // the initial size as calculated by the sizers
+ topsizer->SetSizeHints( this );
}
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
main_sizer->Add( new wxStaticText( this, -1, wxT("Hello outside") ), 0, wxALIGN_CENTER );
main_sizer->Add( new wxStaticText( this, -1, wxT("Hello outside") ), 0, wxALIGN_CENTER );
- wxPanel *panel = new wxPanel( this, -1, wxDefaultPosition, wxDefaultSize,
+ wxPanel *panel = new wxPanel( this, -1, wxDefaultPosition, wxDefaultSize,
wxTAB_TRAVERSAL | wxSUNKEN_BORDER );
main_sizer->Add( panel, 0, wxALIGN_CENTER );
wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL );
panel_sizer->Add( new wxStaticText( panel, -1, wxT("Hello inside") ) );
panel_sizer->Add( new wxStaticText( panel, -1, wxT("Hello inside") ) );
panel_sizer->Add( new wxStaticText( panel, -1, wxT("Hello inside") ) );
-
+
main_sizer->Add( new wxStaticText( this, -1, wxT("Hello outside") ), 0, wxALIGN_CENTER );
m_target = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 80, wxDefaultCoord ) );
for (i = 0; i < 4; i++)
row->Add( new wxButton( this, -1, "Hello" ), 0, wxALL, 10 );
root->Add( row, 0, wxGROW );
-
+
row = new wxWrapSizer;
for (i = 0; i < 4; i++)
row->Add( new wxButton( this, -1, "Hello" ) );
root->Add( row, 0, wxGROW );
-
+
#else
- // A number of checkboxes inside a wrap sizer
+ // A number of checkboxes inside a wrap sizer
wxSizer *ps_mid = new wxStaticBoxSizer( wxVERTICAL, this, "Wrapping check-boxes" );
wxSizer *ps_mid_wrap = new wxWrapSizer(wxHORIZONTAL);
ps_mid->Add( ps_mid_wrap, 100, wxEXPAND );
ps_bottom_box->Add( new wxListBox(this,wxID_ANY,wxPoint(0,0),wxSize(70,70)), 0, wxEXPAND|wxSHAPED );
ps_bottom_box->Add( 10,10 );
ps_bottom_box->Add( new wxCheckBox(this,wxID_ANY,"A much longer option..."), 100, 0, 5 );
-
+
root->Add( ps_bottom, 1, wxEXPAND | wxALL, 5 );
#endif
-
+
// Set sizer for window
SetSizerAndFit( root );
}
#include "wx/filename.h" //For wxFileName::GetName()
#include "wx/config.h" //for native wxConfig
+#ifndef __WXMSW__
+ #include "../sample.xpm"
+#endif
+
// ----------------------------------------------------------------------------
// Bail out if the user doesn't want one of the
// things we need
wxMediaPlayerFrame::wxMediaPlayerFrame(const wxString& title)
: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(600,600))
{
+ SetIcon(wxICON(sample));
+
//
// Create Menus
//
// Create an initial notebook page so the user has something
// to work with without having to go file->open every time :).
//
- wxMediaPlayerNotebookPage* page =
+ wxMediaPlayerNotebookPage* page =
new wxMediaPlayerNotebookPage(this, m_notebook);
m_notebook->AddPage(page,
wxT(""),
wxMenuItem* pSIItem = GetMenuBar()->FindItem(wxID_SHOWINTERFACE);
wxASSERT(pSIItem);
pSIItem->Check(!event.IsChecked());
-
+
if(event.IsChecked())
wxMessageBox(wxT("Could not show player controls"));
else
true);
}
- wxMediaPlayerNotebookPage* currentpage =
+ wxMediaPlayerNotebookPage* currentpage =
(wxMediaPlayerNotebookPage*) m_notebook->GetCurrentPage();
if(currentpage->m_nLastFileId != -1)
- currentpage->m_playlist->SetItemState(currentpage->m_nLastFileId,
+ currentpage->m_playlist->SetItemState(currentpage->m_nLastFileId,
0, wxLIST_STATE_SELECTED);
wxListItem newlistitem;
// ----------------------------------------------------------------------------
void wxMediaPlayerFrame::DoPlayFile(const wxString& path)
{
- wxMediaPlayerNotebookPage* currentpage =
+ wxMediaPlayerNotebookPage* currentpage =
(wxMediaPlayerNotebookPage*) m_notebook->GetCurrentPage();
wxListItem listitem;
}
else
{
- int nNewId = listitem.GetData() ? listitem.GetId() :
+ int nNewId = listitem.GetData() ? listitem.GetId() :
currentpage->m_playlist->GetItemCount()-1;
m_notebook->SetPageText(m_notebook->GetSelection(),
wxFileName(path).GetName());
currentpage->m_nLastFileId = nNewId;
currentpage->m_szFile = path;
- currentpage->m_playlist->SetItem(currentpage->m_nLastFileId,
+ currentpage->m_playlist->SetItem(currentpage->m_nLastFileId,
1, wxFileName(path).GetName());
- currentpage->m_playlist->SetItem(currentpage->m_nLastFileId,
+ currentpage->m_playlist->SetItem(currentpage->m_nLastFileId,
2, wxT(""));
}
}
// ----------------------------------------------------------------------------
void wxMediaPlayerFrame::OnMediaLoaded(wxMediaEvent& WXUNUSED(evt))
{
- wxMediaPlayerNotebookPage* currentpage =
+ wxMediaPlayerNotebookPage* currentpage =
(wxMediaPlayerNotebookPage*) m_notebook->GetCurrentPage();
if( !currentpage->m_mediactrl->Play() )
), wxT(""), true);
DoOpenFile(
- ((wxMediaPlayerNotebookPage*) m_notebook->GetCurrentPage())->m_szFile,
+ ((wxMediaPlayerNotebookPage*) m_notebook->GetCurrentPage())->m_szFile,
false);
}
}
// ----------------------------------------------------------------------------
void wxMediaPlayerFrame::OnPlay(wxCommandEvent& WXUNUSED(event))
{
- wxMediaPlayerNotebookPage* currentpage =
+ wxMediaPlayerNotebookPage* currentpage =
(wxMediaPlayerNotebookPage*) m_notebook->GetCurrentPage();
wxListItem listitem;
listitem.SetState(listitem.GetState() | wxLIST_STATE_SELECTED);
currentpage->m_playlist->SetItem(listitem);
wxASSERT(listitem.GetData());
- DoPlayFile((*((wxString*) listitem.GetData())));
+ DoPlayFile((*((wxString*) listitem.GetData())));
}
}
else
{
if(event.GetKeyCode() == WXK_BACK/*DELETE*/)
{
- wxMediaPlayerNotebookPage* currentpage =
+ wxMediaPlayerNotebookPage* currentpage =
(wxMediaPlayerNotebookPage*) m_notebook->GetCurrentPage();
//delete all selected items
while(true)
// ----------------------------------------------------------------------------
void wxMediaPlayerFrame::OnStop(wxCommandEvent& WXUNUSED(evt))
{
- wxMediaPlayerNotebookPage* currentpage =
+ wxMediaPlayerNotebookPage* currentpage =
(wxMediaPlayerNotebookPage*) m_notebook->GetCurrentPage();
if( !currentpage->m_mediactrl->Stop() )
// ----------------------------------------------------------------------------
void wxMediaPlayerFrame::OnChangeSong(wxListEvent& WXUNUSED(evt))
{
- wxMediaPlayerNotebookPage* currentpage =
+ wxMediaPlayerNotebookPage* currentpage =
(wxMediaPlayerNotebookPage*) m_notebook->GetCurrentPage();
wxListItem listitem;
// ----------------------------------------------------------------------------
void wxMediaPlayerFrame::OnPrev(wxCommandEvent& WXUNUSED(event))
{
- wxMediaPlayerNotebookPage* currentpage =
+ wxMediaPlayerNotebookPage* currentpage =
(wxMediaPlayerNotebookPage*) m_notebook->GetCurrentPage();
if (currentpage->m_playlist->GetItemCount() == 0)
currentpage->m_playlist->SetItemState(nSelectedItem, 0, wxLIST_STATE_SELECTED);
}
- if (nLastSelectedItem == -1)
+ if (nLastSelectedItem == -1)
{
//nothing selected, default to the file before the currently playing one
if(currentpage->m_nLastFileId == 0)
else
nLastSelectedItem = currentpage->m_nLastFileId - 1;
}
- else if (nLastSelectedItem == 0)
+ else if (nLastSelectedItem == 0)
nLastSelectedItem = currentpage->m_playlist->GetItemCount() - 1;
else
nLastSelectedItem -= 1;
// ----------------------------------------------------------------------------
void wxMediaPlayerFrame::OnNext(wxCommandEvent& WXUNUSED(event))
{
- wxMediaPlayerNotebookPage* currentpage =
+ wxMediaPlayerNotebookPage* currentpage =
(wxMediaPlayerNotebookPage*) m_notebook->GetCurrentPage();
if (currentpage->m_playlist->GetItemCount() == 0)
if(currentpage->m_nLastFileId == currentpage->m_playlist->GetItemCount() - 1)
nLastSelectedItem = 0;
else
- nLastSelectedItem = currentpage->m_nLastFileId + 1;
+ nLastSelectedItem = currentpage->m_nLastFileId + 1;
}
else if (nLastSelectedItem == currentpage->m_playlist->GetItemCount() - 1)
nLastSelectedItem = 0;
// ----------------------------------------------------------------------------
void wxMediaPlayerFrame::OnVolumeDown(wxCommandEvent& WXUNUSED(event))
{
- wxMediaPlayerNotebookPage* currentpage =
+ wxMediaPlayerNotebookPage* currentpage =
(wxMediaPlayerNotebookPage*) m_notebook->GetCurrentPage();
double dVolume = currentpage->m_mediactrl->GetVolume();
// ----------------------------------------------------------------------------
void wxMediaPlayerFrame::OnVolumeUp(wxCommandEvent& WXUNUSED(event))
{
- wxMediaPlayerNotebookPage* currentpage =
+ wxMediaPlayerNotebookPage* currentpage =
(wxMediaPlayerNotebookPage*) m_notebook->GetCurrentPage();
double dVolume = currentpage->m_mediactrl->GetVolume();
// ----------------------------------------------------------------------------
void wxMediaPlayerTimer::Notify()
{
- wxMediaPlayerNotebookPage* currentpage =
+ wxMediaPlayerNotebookPage* currentpage =
(wxMediaPlayerNotebookPage*) m_frame->m_notebook->GetCurrentPage();
wxMediaCtrl* currentMediaCtrl = currentpage->m_mediactrl;
m_gauge->Create(this, wxID_GAUGE, 0, wxDefaultPosition, wxDefaultSize,
wxGA_HORIZONTAL | wxGA_SMOOTH);
sizer->Add(m_gauge, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND , 5);
-
+
//
// Create the speed/volume sliders
#include "copy.xpm"
#endif
+#ifndef __WXMSW__
+ #include "../sample.xpm"
+#endif
+
// ----------------------------------------------------------------------------
// classes
// ----------------------------------------------------------------------------
MyFrame::MyFrame()
: wxFrame((wxFrame *)NULL, wxID_ANY, _T("wxWidgets menu sample"))
{
+ SetIcon(wxICON(sample));
+
#if USE_LOG_WINDOW
m_textctrl = NULL;
#endif
#error Sorry, this sample is only appropriate under Windows.
#endif
+#ifndef __WXMSW__
+ #include "../sample.xpm"
+#endif
+
#include <ctype.h>
#include "nativdlg.h"
#include "resource.h"
+
+
+
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit(void)
MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size):
wxFrame(parent, id, title, pos, size)
{
- panel = NULL;
+ SetIcon(wxICON(sample));
+
+ panel = NULL;
}
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void MyDialog::OnOk(wxCommandEvent& WXUNUSED(event))
{
- EndModal(wxID_OK);
+ EndModal(wxID_OK);
}
void MyDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
{
- EndModal(wxID_CANCEL);
+ EndModal(wxID_CANCEL);
}
#include <wx/artprov.h>
+#ifndef __WXMSW__
+ #include "../sample.xpm"
+#endif
// -----------------------------------------------------------------------
// wxSampleMultiButtonEditor
(wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCAPTION|
wxTAB_TRAVERSAL|wxCLOSE_BOX|wxNO_FULL_REPAINT_ON_RESIZE) )
{
+ SetIcon(wxICON(sample));
+
m_propGrid = NULL;
m_panel = NULL;
public:
wxVectorProperty( const wxString& label = wxPG_LABEL,
- const wxString& name = wxPG_LABEL,
- const wxVector3f& value = wxVector3f() );
+ const wxString& name = wxPG_LABEL,
+ const wxVector3f& value = wxVector3f() );
virtual ~wxVectorProperty();
virtual void ChildChanged( wxVariant& thisValue,
- int childIndex, wxVariant& childValue ) const;
+ int childIndex, wxVariant& childValue ) const;
virtual void RefreshChildren();
protected:
virtual ~wxTriangleProperty();
virtual void ChildChanged( wxVariant& thisValue,
- int childIndex, wxVariant& childValue ) const;
+ int childIndex, wxVariant& childValue ) const;
virtual void RefreshChildren();
protected:
{
public:
FormMain(const wxString& title, const wxPoint& pos, const wxSize& size );
- ~FormMain();
+ ~FormMain();
wxPropertyGridManager* m_pPropGridManager;
wxPropertyGrid* m_propGrid;
#include "wx/log.h"
#include "wx/tglbtn.h"
+#ifndef __WXMSW__
+ #include "../sample.xpm"
+#endif
+
// ----------------------------------------------------------------------------
// a trivial example
// ----------------------------------------------------------------------------
MyFrame::MyFrame()
: wxFrame(NULL, wxID_ANY, "wxWidgets scroll sample")
{
+ SetIcon(wxICON(sample));
+
wxMenu *menuFile = new wxMenu;
menuFile->Append(wxID_ABOUT, "&About..");
menuFile->AppendSeparator();
#include "wx/dcclient.h"
#include "wx/image.h"
+#ifndef __WXMSW__
+ #include "../sample.xpm"
+#endif
// ----------------------------------------------------------------------------
// constants
: wxFrame(NULL, wxID_ANY, "wxWidgets Shaped Sample",
wxDefaultPosition, wxSize(200, 100))
{
+ SetIcon(wxICON(sample));
+
wxMenuBar * const mbar = new wxMenuBar;
wxMenu * const menuFrames = new wxMenu;
menuFrames->Append(Show_Shaped, "Show &shaped window\tCtrl-S");
#include "wx/splitter.h"
#include "wx/dcmirror.h"
+#ifndef __WXMSW__
+ #include "../sample.xpm"
+#endif
+
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
wxDefaultPosition, wxSize(420, 300),
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
{
+ SetIcon(wxICON(sample));
+
#if wxUSE_STATUSBAR
CreateStatusBar(2);
#endif // wxUSE_STATUSBAR
#include "wx/datetime.h"
#include "wx/numdlg.h"
+#ifndef __WXMSW__
+ #include "../sample.xpm"
+#endif
+
// define this for the platforms which don't support wxBitmapButton (such as
// Motif), else a wxBitmapButton will be used
: wxFrame((wxWindow *)NULL, wxID_ANY, title, pos, size)
#endif
{
+ SetIcon(wxICON(sample));
+
m_statbarDefault = NULL;
m_statbarCustom = NULL;
#include "edit.h" // Edit module
#include "prefs.h" // Prefs
+#ifndef __WXMSW__
+ #include "../sample.xpm"
+#endif
//----------------------------------------------------------------------------
// resources
AppFrame::AppFrame (const wxString &title)
: wxFrame ((wxFrame *)NULL, wxID_ANY, title, wxDefaultPosition, wxSize(750,550),
- wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE) {
+ wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
+{
+ SetIcon(wxICON(sample));
// intitialize important variables
m_edit = NULL;
#include "wx/notebook.h"
+#ifndef __WXMSW__
+ #include "../sample.xpm"
+#endif
+
+
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
: wxFrame(NULL, wxID_ANY, _T("TabOrder wxWidgets Sample"),
wxDefaultPosition, wxSize(700, 450))
{
+ SetIcon(wxICON(sample));
+
wxMenu *menuFile = new wxMenu;
menuFile->Append(TabOrder_About);
menuFile->AppendSeparator();
#include "wx/numdlg.h"
#include "wx/tokenzr.h"
+#ifndef __WXMSW__
+ #include "../sample.xpm"
+#endif
+
//----------------------------------------------------------------------
// class definitions
//----------------------------------------------------------------------
MyFrame::MyFrame(wxFrame *frame, const wxChar *title, int x, int y, int w, int h)
: wxFrame(frame, wxID_ANY, title, wxPoint(x, y), wxSize(w, h) )
{
+ SetIcon(wxICON(sample));
+
#if wxUSE_STATUSBAR
CreateStatusBar(2);
#endif // wxUSE_STATUSBAR
// Purpose: wxWidgets sample demonstrating wxWrapSizer use
// Author: Arne Steinarson
// Created: 21.01.2008
-// RCS-ID: $Id:$
+// RCS-ID: $Id$
// Copyright: (c) Arne Steinarson
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/wrapsizer.h"
#include "wx/artprov.h"
+#ifndef __WXMSW__
+ #include "../sample.xpm"
+#endif
+
+
+// ----------------------------------------------------------------------------
+// definitions
+// ----------------------------------------------------------------------------
+
class WrapSizerFrame : public wxFrame
{
public:
- WrapSizerFrame()
- : wxFrame(NULL, wxID_ANY, "wxWrapSizer Sample")
- {
- // Root sizer, vertical
- wxSizer * const sizerRoot = new wxBoxSizer(wxVERTICAL);
-
- // Some toolbars in a wrap sizer
- wxSizer * const sizerTop = new wxWrapSizer( wxHORIZONTAL );
- sizerTop->Add(MakeToolBar());
- sizerTop->Add(20, 1);
- sizerTop->Add(MakeToolBar());
- sizerTop->Add(20, 1);
- sizerTop->Add(MakeToolBar());
- sizerRoot->Add(sizerTop, wxSizerFlags().Expand().Border());
-
- // A number of checkboxes inside a wrap sizer
- wxSizer *sizerMid = new wxStaticBoxSizer(wxVERTICAL, this,
- "With check-boxes");
- wxSizer * const sizerMidWrap = new wxWrapSizer(wxHORIZONTAL);
- for ( int nCheck = 0; nCheck < 6; nCheck++ )
- {
- wxCheckBox *chk = new wxCheckBox
- (
- this,
- wxID_ANY,
- wxString::Format("Option %d", nCheck)
- );
-
- sizerMidWrap->Add(chk, wxSizerFlags().Centre().Border());
- }
-
- sizerMid->Add(sizerMidWrap, wxSizerFlags(100).Expand());
- sizerRoot->Add(sizerMid, wxSizerFlags(100).Expand().Border());
-
-
- // A shaped item inside a box sizer
- wxSizer *sizerBottom = new wxStaticBoxSizer(wxVERTICAL, this,
- "With wxSHAPED item");
- wxSizer *sizerBottomBox = new wxBoxSizer(wxHORIZONTAL);
- sizerBottom->Add(sizerBottomBox, wxSizerFlags(100).Expand());
-
- sizerBottomBox->Add(new wxListBox(this, wxID_ANY,
- wxPoint(0, 0), wxSize(70, 70)),
- wxSizerFlags().Expand().Shaped());
- sizerBottomBox->AddSpacer(10);
- sizerBottomBox->Add(new wxCheckBox(this, wxID_ANY,
- "A much longer option..."),
- wxSizerFlags(100).Border());
- sizerRoot->Add(sizerBottom, wxSizerFlags(100).Expand().Border());
-
- // OK Button
- sizerRoot->Add(new wxButton(this, wxID_OK),
- wxSizerFlags().Centre().DoubleBorder());
- Connect(wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED,
- wxCommandEventHandler(WrapSizerFrame::OnButton));
-
- // Set sizer for window
- SetSizerAndFit(sizerRoot);
-
- Show();
- }
+ WrapSizerFrame();
private:
void OnButton(wxCommandEvent& WXUNUSED(event))
tb->Realize( );
return tb;
}
-
};
-
class WrapSizerApp : public wxApp
{
public:
};
IMPLEMENT_APP(WrapSizerApp);
+
+
+// ----------------------------------------------------------------------------
+// WrapSizerFrame
+// ----------------------------------------------------------------------------
+
+WrapSizerFrame::WrapSizerFrame()
+ : wxFrame(NULL, wxID_ANY, "wxWrapSizer Sample")
+{
+ SetIcon(wxICON(sample));
+
+ // Root sizer, vertical
+ wxSizer * const sizerRoot = new wxBoxSizer(wxVERTICAL);
+
+ // Some toolbars in a wrap sizer
+ wxSizer * const sizerTop = new wxWrapSizer( wxHORIZONTAL );
+ sizerTop->Add(MakeToolBar());
+ sizerTop->Add(20, 1);
+ sizerTop->Add(MakeToolBar());
+ sizerTop->Add(20, 1);
+ sizerTop->Add(MakeToolBar());
+ sizerRoot->Add(sizerTop, wxSizerFlags().Expand().Border());
+
+ // A number of checkboxes inside a wrap sizer
+ wxSizer *sizerMid = new wxStaticBoxSizer(wxVERTICAL, this,
+ "With check-boxes");
+ wxSizer * const sizerMidWrap = new wxWrapSizer(wxHORIZONTAL);
+ for ( int nCheck = 0; nCheck < 6; nCheck++ )
+ {
+ wxCheckBox *chk = new wxCheckBox
+ (
+ this,
+ wxID_ANY,
+ wxString::Format("Option %d", nCheck)
+ );
+
+ sizerMidWrap->Add(chk, wxSizerFlags().Centre().Border());
+ }
+
+ sizerMid->Add(sizerMidWrap, wxSizerFlags(100).Expand());
+ sizerRoot->Add(sizerMid, wxSizerFlags(100).Expand().Border());
+
+
+ // A shaped item inside a box sizer
+ wxSizer *sizerBottom = new wxStaticBoxSizer(wxVERTICAL, this,
+ "With wxSHAPED item");
+ wxSizer *sizerBottomBox = new wxBoxSizer(wxHORIZONTAL);
+ sizerBottom->Add(sizerBottomBox, wxSizerFlags(100).Expand());
+
+ sizerBottomBox->Add(new wxListBox(this, wxID_ANY,
+ wxPoint(0, 0), wxSize(70, 70)),
+ wxSizerFlags().Expand().Shaped());
+ sizerBottomBox->AddSpacer(10);
+ sizerBottomBox->Add(new wxCheckBox(this, wxID_ANY,
+ "A much longer option..."),
+ wxSizerFlags(100).Border());
+ sizerRoot->Add(sizerBottom, wxSizerFlags(100).Expand().Border());
+
+ // OK Button
+ sizerRoot->Add(new wxButton(this, wxID_OK),
+ wxSizerFlags().Centre().DoubleBorder());
+ Connect(wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED,
+ wxCommandEventHandler(WrapSizerFrame::OnButton));
+
+ // Set sizer for window
+ SetSizerAndFit(sizerRoot);
+
+ Show();
+}
+