always call SetIcon() on the main frame of the sample; some small cleanup
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58744 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -44,6 +44,10 @@
|
|||||||
#include "wx/fontpicker.h"
|
#include "wx/fontpicker.h"
|
||||||
#include "wx/aboutdlg.h"
|
#include "wx/aboutdlg.h"
|
||||||
|
|
||||||
|
#ifndef __WXMSW__
|
||||||
|
#include "../sample.xpm"
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// constants
|
// constants
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -166,6 +170,8 @@ MyFrame::MyFrame()
|
|||||||
wxDefaultPosition, wxSize(420, 300),
|
wxDefaultPosition, wxSize(420, 300),
|
||||||
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
|
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
|
||||||
{
|
{
|
||||||
|
SetIcon(wxICON(sample));
|
||||||
|
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
CreateStatusBar(2);
|
CreateStatusBar(2);
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
|
@@ -25,6 +25,10 @@
|
|||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
#include "wx/config.h"
|
#include "wx/config.h"
|
||||||
|
|
||||||
|
#ifndef __WXMSW__
|
||||||
|
#include "../sample.xpm"
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// classes
|
// classes
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -40,19 +44,19 @@ public:
|
|||||||
class MyFrame: public wxFrame
|
class MyFrame: public wxFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyFrame();
|
MyFrame();
|
||||||
virtual ~MyFrame();
|
virtual ~MyFrame();
|
||||||
|
|
||||||
// callbacks
|
// callbacks
|
||||||
void OnQuit(wxCommandEvent& event);
|
void OnQuit(wxCommandEvent& event);
|
||||||
void OnAbout(wxCommandEvent& event);
|
void OnAbout(wxCommandEvent& event);
|
||||||
void OnDelete(wxCommandEvent& event);
|
void OnDelete(wxCommandEvent& event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxTextCtrl *m_text;
|
wxTextCtrl *m_text;
|
||||||
wxCheckBox *m_check;
|
wxCheckBox *m_check;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@@ -85,61 +89,61 @@ IMPLEMENT_APP(MyApp)
|
|||||||
// `Main program' equivalent, creating windows and returning main app frame
|
// `Main program' equivalent, creating windows and returning main app frame
|
||||||
bool MyApp::OnInit()
|
bool MyApp::OnInit()
|
||||||
{
|
{
|
||||||
if ( !wxApp::OnInit() )
|
if ( !wxApp::OnInit() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// we're using wxConfig's "create-on-demand" feature: it will create the
|
// 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
|
// config object when it's used for the first time. It has a number of
|
||||||
// advantages compared with explicitly creating our wxConfig:
|
// advantages compared with explicitly creating our wxConfig:
|
||||||
// 1) we don't pay for it if we don't use it
|
// 1) we don't pay for it if we don't use it
|
||||||
// 2) there is no danger to create it twice
|
// 2) there is no danger to create it twice
|
||||||
|
|
||||||
// application and vendor name are used by wxConfig to construct the name
|
// 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
|
// 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
|
// 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)
|
// name is the name of the executable and the vendor name is the same)
|
||||||
SetVendorName(_T("wxWidgets"));
|
SetVendorName(_T("wxWidgets"));
|
||||||
SetAppName(_T("conftest")); // not needed, it's the default value
|
SetAppName(_T("conftest")); // not needed, it's the default value
|
||||||
|
|
||||||
wxConfigBase *pConfig = wxConfigBase::Get();
|
wxConfigBase *pConfig = wxConfigBase::Get();
|
||||||
|
|
||||||
// uncomment this to force writing back of the defaults for all values
|
// 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
|
// if they're not present in the config - this can give the user an idea
|
||||||
// of all possible settings for this program
|
// of all possible settings for this program
|
||||||
pConfig->SetRecordDefaults();
|
pConfig->SetRecordDefaults();
|
||||||
|
|
||||||
// or you could also write something like this:
|
// or you could also write something like this:
|
||||||
// wxFileConfig *pConfig = new wxFileConfig("conftest");
|
// wxFileConfig *pConfig = new wxFileConfig("conftest");
|
||||||
// wxConfigBase::Set(pConfig);
|
// wxConfigBase::Set(pConfig);
|
||||||
// where you can also specify the file names explicitly if you wish.
|
// 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
|
// Of course, calling Set() is optional and you only must do it if
|
||||||
// you want to later retrieve this pointer with Get().
|
// you want to later retrieve this pointer with Get().
|
||||||
|
|
||||||
// create the main program window
|
// create the main program window
|
||||||
MyFrame *frame = new MyFrame;
|
MyFrame *frame = new MyFrame;
|
||||||
frame->Show(true);
|
frame->Show(true);
|
||||||
SetTopWindow(frame);
|
SetTopWindow(frame);
|
||||||
|
|
||||||
// use our config object...
|
// use our config object...
|
||||||
if ( pConfig->Read(_T("/Controls/Check"), 1l) != 0 ) {
|
if ( pConfig->Read(_T("/Controls/Check"), 1l) != 0 ) {
|
||||||
wxMessageBox(_T("You can disable this message box by unchecking\n")
|
wxMessageBox(_T("You can disable this message box by unchecking\n")
|
||||||
_T("the checkbox in the main window (of course, a real\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("program would have a checkbox right here but we\n")
|
||||||
_T("keep it simple)"), _T("Welcome to wxConfig demo"),
|
_T("keep it simple)"), _T("Welcome to wxConfig demo"),
|
||||||
wxICON_INFORMATION | wxOK);
|
wxICON_INFORMATION | wxOK);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MyApp::OnExit()
|
int MyApp::OnExit()
|
||||||
{
|
{
|
||||||
// clean up: Set() returns the active config object as Get() does, but unlike
|
// 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
|
// Get() it doesn't try to create one if there is none (definitely not what
|
||||||
// we want here!)
|
// we want here!)
|
||||||
delete wxConfigBase::Set((wxConfigBase *) NULL);
|
delete wxConfigBase::Set((wxConfigBase *) NULL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -150,77 +154,79 @@ int MyApp::OnExit()
|
|||||||
MyFrame::MyFrame()
|
MyFrame::MyFrame()
|
||||||
: wxFrame((wxFrame *) NULL, wxID_ANY, _T("wxConfig Demo"))
|
: wxFrame((wxFrame *) NULL, wxID_ANY, _T("wxConfig Demo"))
|
||||||
{
|
{
|
||||||
// menu
|
SetIcon(wxICON(sample));
|
||||||
wxMenu *file_menu = new wxMenu;
|
|
||||||
|
|
||||||
file_menu->Append(ConfTest_Delete, _T("&Delete"), _T("Delete config file"));
|
// menu
|
||||||
file_menu->AppendSeparator();
|
wxMenu *file_menu = new wxMenu;
|
||||||
file_menu->Append(ConfTest_About, _T("&About\tF1"), _T("About this sample"));
|
|
||||||
file_menu->AppendSeparator();
|
file_menu->Append(ConfTest_Delete, _T("&Delete"), _T("Delete config file"));
|
||||||
file_menu->Append(ConfTest_Quit, _T("E&xit\tAlt-X"), _T("Exit the program"));
|
file_menu->AppendSeparator();
|
||||||
wxMenuBar *menu_bar = new wxMenuBar;
|
file_menu->Append(ConfTest_About, _T("&About\tF1"), _T("About this sample"));
|
||||||
menu_bar->Append(file_menu, _T("&File"));
|
file_menu->AppendSeparator();
|
||||||
SetMenuBar(menu_bar);
|
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
|
#if wxUSE_STATUSBAR
|
||||||
CreateStatusBar();
|
CreateStatusBar();
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
|
|
||||||
// child controls
|
// child controls
|
||||||
wxPanel *panel = new wxPanel(this);
|
wxPanel *panel = new wxPanel(this);
|
||||||
(void)new wxStaticText(panel, wxID_ANY, _T("These controls remember their values!"),
|
(void)new wxStaticText(panel, wxID_ANY, _T("These controls remember their values!"),
|
||||||
wxPoint(10, 10), wxSize(300, 20));
|
wxPoint(10, 10), wxSize(300, 20));
|
||||||
m_text = new wxTextCtrl(panel, wxID_ANY, _T(""), wxPoint(10, 40), 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"),
|
m_check = new wxCheckBox(panel, wxID_ANY, _T("show welcome message box at startup"),
|
||||||
wxPoint(10, 70), wxSize(300, 20));
|
wxPoint(10, 70), wxSize(300, 20));
|
||||||
|
|
||||||
// restore the control's values from the config
|
// restore the control's values from the config
|
||||||
|
|
||||||
// NB: in this program, the config object is already created at this moment
|
// 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
|
// 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
|
// 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()
|
// 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!).
|
// or in any other way (then you must be sure to create it before using it!).
|
||||||
wxConfigBase *pConfig = wxConfigBase::Get();
|
wxConfigBase *pConfig = wxConfigBase::Get();
|
||||||
|
|
||||||
// we could write Read("/Controls/Text") as well, it's just to show SetPath()
|
// we could write Read("/Controls/Text") as well, it's just to show SetPath()
|
||||||
pConfig->SetPath(_T("/Controls"));
|
pConfig->SetPath(_T("/Controls"));
|
||||||
|
|
||||||
m_text->SetValue(pConfig->Read(_T("Text"), _T("")));
|
m_text->SetValue(pConfig->Read(_T("Text"), _T("")));
|
||||||
m_check->SetValue(pConfig->Read(_T("Check"), 1l) != 0);
|
m_check->SetValue(pConfig->Read(_T("Check"), 1l) != 0);
|
||||||
|
|
||||||
// SetPath() understands ".."
|
// SetPath() understands ".."
|
||||||
pConfig->SetPath(_T("../MainFrame"));
|
pConfig->SetPath(_T("../MainFrame"));
|
||||||
|
|
||||||
// restore frame position and size
|
// restore frame position and size
|
||||||
int x = pConfig->Read(_T("x"), 50),
|
int x = pConfig->Read(_T("x"), 50),
|
||||||
y = pConfig->Read(_T("y"), 50),
|
y = pConfig->Read(_T("y"), 50),
|
||||||
w = pConfig->Read(_T("w"), 350),
|
w = pConfig->Read(_T("w"), 350),
|
||||||
h = pConfig->Read(_T("h"), 200);
|
h = pConfig->Read(_T("h"), 200);
|
||||||
Move(x, y);
|
Move(x, y);
|
||||||
SetClientSize(w, h);
|
SetClientSize(w, h);
|
||||||
|
|
||||||
pConfig->SetPath(_T("/"));
|
pConfig->SetPath(_T("/"));
|
||||||
wxString s;
|
wxString s;
|
||||||
if ( pConfig->Read(_T("TestValue"), &s) )
|
if ( pConfig->Read(_T("TestValue"), &s) )
|
||||||
{
|
{
|
||||||
wxLogStatus(this, wxT("TestValue from config is '%s'"), s.c_str());
|
wxLogStatus(this, wxT("TestValue from config is '%s'"), s.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxLogStatus(this, wxT("TestValue not found in the config"));
|
wxLogStatus(this, wxT("TestValue not found in the config"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnQuit(wxCommandEvent&)
|
void MyFrame::OnQuit(wxCommandEvent&)
|
||||||
{
|
{
|
||||||
Close(true);
|
Close(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnAbout(wxCommandEvent&)
|
void MyFrame::OnAbout(wxCommandEvent&)
|
||||||
{
|
{
|
||||||
wxMessageBox(_T("wxConfig demo\n(c) 1998-2001 Vadim Zeitlin"), _T("About"),
|
wxMessageBox(_T("wxConfig demo\n(c) 1998-2001 Vadim Zeitlin"), _T("About"),
|
||||||
wxICON_INFORMATION | wxOK);
|
wxICON_INFORMATION | wxOK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnDelete(wxCommandEvent&)
|
void MyFrame::OnDelete(wxCommandEvent&)
|
||||||
@@ -247,23 +253,23 @@ void MyFrame::OnDelete(wxCommandEvent&)
|
|||||||
|
|
||||||
MyFrame::~MyFrame()
|
MyFrame::~MyFrame()
|
||||||
{
|
{
|
||||||
wxConfigBase *pConfig = wxConfigBase::Get();
|
wxConfigBase *pConfig = wxConfigBase::Get();
|
||||||
if ( pConfig == NULL )
|
if ( pConfig == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// save the control's values to the config
|
// save the control's values to the config
|
||||||
pConfig->Write(_T("/Controls/Text"), m_text->GetValue());
|
pConfig->Write(_T("/Controls/Text"), m_text->GetValue());
|
||||||
pConfig->Write(_T("/Controls/Check"), m_check->GetValue());
|
pConfig->Write(_T("/Controls/Check"), m_check->GetValue());
|
||||||
|
|
||||||
// save the frame position
|
// save the frame position
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
GetClientSize(&w, &h);
|
GetClientSize(&w, &h);
|
||||||
GetPosition(&x, &y);
|
GetPosition(&x, &y);
|
||||||
pConfig->Write(_T("/MainFrame/x"), (long) x);
|
pConfig->Write(_T("/MainFrame/x"), (long) x);
|
||||||
pConfig->Write(_T("/MainFrame/y"), (long) y);
|
pConfig->Write(_T("/MainFrame/y"), (long) y);
|
||||||
pConfig->Write(_T("/MainFrame/w"), (long) w);
|
pConfig->Write(_T("/MainFrame/w"), (long) w);
|
||||||
pConfig->Write(_T("/MainFrame/h"), (long) h);
|
pConfig->Write(_T("/MainFrame/h"), (long) h);
|
||||||
|
|
||||||
pConfig->Write(_T("/TestValue"), wxT("A test value"));
|
pConfig->Write(_T("/TestValue"), wxT("A test value"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -36,6 +36,10 @@
|
|||||||
|
|
||||||
#include "wx/dialup.h"
|
#include "wx/dialup.h"
|
||||||
|
|
||||||
|
#ifndef __WXMSW__
|
||||||
|
#include "../sample.xpm"
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// private classes
|
// private classes
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -220,6 +224,8 @@ void MyApp::OnConnected(wxDialUpEvent& event)
|
|||||||
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||||
: wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size)
|
: wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size)
|
||||||
{
|
{
|
||||||
|
SetIcon(wxICON(sample));
|
||||||
|
|
||||||
// create a menu bar
|
// create a menu bar
|
||||||
wxMenu *menuFile = new wxMenu;
|
wxMenu *menuFile = new wxMenu;
|
||||||
|
|
||||||
|
@@ -30,6 +30,10 @@
|
|||||||
#include "wx/wx.h"
|
#include "wx/wx.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __WXMSW__
|
||||||
|
#include "../sample.xpm"
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// event constants
|
// event constants
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -214,6 +218,8 @@ bool MyApp::OnInit()
|
|||||||
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||||
: wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size)
|
: wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size)
|
||||||
{
|
{
|
||||||
|
SetIcon(wxICON(sample));
|
||||||
|
|
||||||
// init members
|
// init members
|
||||||
m_nPush = 0;
|
m_nPush = 0;
|
||||||
|
|
||||||
|
@@ -39,6 +39,10 @@
|
|||||||
|
|
||||||
#include "griddemo.h"
|
#include "griddemo.h"
|
||||||
|
|
||||||
|
#ifndef __WXMSW__
|
||||||
|
#include "../sample.xpm"
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxWin macros
|
// wxWin macros
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -148,6 +152,8 @@ GridFrame::GridFrame()
|
|||||||
wxDefaultPosition,
|
wxDefaultPosition,
|
||||||
wxDefaultSize )
|
wxDefaultSize )
|
||||||
{
|
{
|
||||||
|
SetIcon(wxICON(sample));
|
||||||
|
|
||||||
wxMenu *fileMenu = new wxMenu;
|
wxMenu *fileMenu = new wxMenu;
|
||||||
fileMenu->Append( ID_VTABLE, _T("&Virtual table test\tCtrl-V"));
|
fileMenu->Append( ID_VTABLE, _T("&Virtual table test\tCtrl-V"));
|
||||||
fileMenu->Append( ID_BUGS_TABLE, _T("&Bugs table test\tCtrl-B"));
|
fileMenu->Append( ID_BUGS_TABLE, _T("&Bugs table test\tCtrl-B"));
|
||||||
|
@@ -46,6 +46,9 @@
|
|||||||
|
|
||||||
#include "canvas.h"
|
#include "canvas.h"
|
||||||
|
|
||||||
|
#ifndef __WXMSW__
|
||||||
|
#include "../sample.xpm"
|
||||||
|
#endif
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// declarations
|
// declarations
|
||||||
@@ -575,6 +578,8 @@ MyFrame::MyFrame()
|
|||||||
: wxFrame( (wxFrame *)NULL, wxID_ANY, _T("wxImage sample"),
|
: wxFrame( (wxFrame *)NULL, wxID_ANY, _T("wxImage sample"),
|
||||||
wxPoint(20, 20), wxSize(950, 700) )
|
wxPoint(20, 20), wxSize(950, 700) )
|
||||||
{
|
{
|
||||||
|
SetIcon(wxICON(sample));
|
||||||
|
|
||||||
wxMenuBar *menu_bar = new wxMenuBar();
|
wxMenuBar *menu_bar = new wxMenuBar();
|
||||||
|
|
||||||
wxMenu *menuImage = new wxMenu;
|
wxMenu *menuImage = new wxMenu;
|
||||||
|
@@ -18,6 +18,9 @@
|
|||||||
#include "wx/wx.h"
|
#include "wx/wx.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __WXMSW__
|
||||||
|
#include "../sample.xpm"
|
||||||
|
#endif
|
||||||
|
|
||||||
// Define a new frame type: this is going to be our main frame
|
// Define a new frame type: this is going to be our main frame
|
||||||
class MyFrame : public wxFrame
|
class MyFrame : public wxFrame
|
||||||
@@ -77,6 +80,8 @@ MyFrame::MyFrame(const wxString& title)
|
|||||||
m_inputWin(NULL),
|
m_inputWin(NULL),
|
||||||
m_skip(true)
|
m_skip(true)
|
||||||
{
|
{
|
||||||
|
SetIcon(wxICON(sample));
|
||||||
|
|
||||||
// IDs for menu items
|
// IDs for menu items
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@@ -34,6 +34,11 @@
|
|||||||
|
|
||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
|
|
||||||
|
#ifndef __WXMSW__
|
||||||
|
#include "../sample.xpm"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// MyApp
|
// MyApp
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -76,113 +81,115 @@ MyFrame::MyFrame()
|
|||||||
wxPoint(30,30), wxDefaultSize,
|
wxPoint(30,30), wxDefaultSize,
|
||||||
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
|
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
|
||||||
{
|
{
|
||||||
// Make a menubar
|
SetIcon(wxICON(sample));
|
||||||
wxMenu *file_menu = new wxMenu;
|
|
||||||
|
|
||||||
file_menu->Append(LAYOUT_TEST_PROPORTIONS, _T("&Proportions demo...\tF1"));
|
// Make a menubar
|
||||||
file_menu->Append(LAYOUT_TEST_SIZER, _T("Test wx&FlexSizer...\tF2"));
|
wxMenu *file_menu = new wxMenu;
|
||||||
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"));
|
|
||||||
|
|
||||||
file_menu->AppendSeparator();
|
file_menu->Append(LAYOUT_TEST_PROPORTIONS, _T("&Proportions demo...\tF1"));
|
||||||
file_menu->Append(LAYOUT_QUIT, _T("E&xit"), _T("Quit program"));
|
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;
|
file_menu->AppendSeparator();
|
||||||
help_menu->Append(LAYOUT_ABOUT, _T("&About"), _T("About layout demo..."));
|
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"));
|
wxMenuBar *menu_bar = new wxMenuBar;
|
||||||
menu_bar->Append(help_menu, _T("&Help"));
|
|
||||||
|
|
||||||
// Associate the menu bar with the frame
|
menu_bar->Append(file_menu, _T("&File"));
|
||||||
SetMenuBar(menu_bar);
|
menu_bar->Append(help_menu, _T("&Help"));
|
||||||
|
|
||||||
|
// Associate the menu bar with the frame
|
||||||
|
SetMenuBar(menu_bar);
|
||||||
|
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
CreateStatusBar(2);
|
CreateStatusBar(2);
|
||||||
SetStatusText(_T("wxWidgets layout demo"));
|
SetStatusText(_T("wxWidgets layout demo"));
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
|
|
||||||
wxPanel* p = new wxPanel(this, wxID_ANY);
|
wxPanel* p = new wxPanel(this, wxID_ANY);
|
||||||
|
|
||||||
// we want to get a dialog that is stretchable because it
|
// we want to get a dialog that is stretchable because it
|
||||||
// has a text ctrl in the middle. at the bottom, we have
|
// has a text ctrl in the middle. at the bottom, we have
|
||||||
// two buttons which.
|
// two buttons which.
|
||||||
|
|
||||||
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
|
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
// 1) top: create wxStaticText with minimum size equal to its default size
|
// 1) top: create wxStaticText with minimum size equal to its default size
|
||||||
topsizer->Add(
|
topsizer->Add(
|
||||||
new wxStaticText( p, wxID_ANY, _T("An explanation (wxALIGN_RIGHT).") ),
|
new wxStaticText( p, wxID_ANY, _T("An explanation (wxALIGN_RIGHT).") ),
|
||||||
wxSizerFlags().Align(wxALIGN_RIGHT).Border(wxALL & ~wxBOTTOM, 5));
|
wxSizerFlags().Align(wxALIGN_RIGHT).Border(wxALL & ~wxBOTTOM, 5));
|
||||||
topsizer->Add(
|
topsizer->Add(
|
||||||
new wxStaticText( p, wxID_ANY, _T("An explanation (wxALIGN_LEFT).") ),
|
new wxStaticText( p, wxID_ANY, _T("An explanation (wxALIGN_LEFT).") ),
|
||||||
wxSizerFlags().Align(wxALIGN_LEFT).Border(wxALL & ~wxBOTTOM, 5));
|
wxSizerFlags().Align(wxALIGN_LEFT).Border(wxALL & ~wxBOTTOM, 5));
|
||||||
topsizer->Add(
|
topsizer->Add(
|
||||||
new wxStaticText( p, wxID_ANY, _T("An explanation (wxALIGN_CENTRE_HORIZONTAL).") ),
|
new wxStaticText( p, wxID_ANY, _T("An explanation (wxALIGN_CENTRE_HORIZONTAL).") ),
|
||||||
wxSizerFlags().Align(wxALIGN_CENTRE_HORIZONTAL).Border(wxALL & ~wxBOTTOM, 5));
|
wxSizerFlags().Align(wxALIGN_CENTRE_HORIZONTAL).Border(wxALL & ~wxBOTTOM, 5));
|
||||||
|
|
||||||
// 2) top: create wxTextCtrl with minimum size (100x60)
|
// 2) top: create wxTextCtrl with minimum size (100x60)
|
||||||
topsizer->Add(
|
topsizer->Add(
|
||||||
new wxTextCtrl( p, wxID_ANY, _T("My text (wxEXPAND)."), wxDefaultPosition, wxSize(100,60), wxTE_MULTILINE),
|
new wxTextCtrl( p, wxID_ANY, _T("My text (wxEXPAND)."), wxDefaultPosition, wxSize(100,60), wxTE_MULTILINE),
|
||||||
wxSizerFlags(1).Expand().Border(wxALL, 5));
|
wxSizerFlags(1).Expand().Border(wxALL, 5));
|
||||||
|
|
||||||
// 2.5) Gratuitous test of wxStaticBoxSizers
|
// 2.5) Gratuitous test of wxStaticBoxSizers
|
||||||
wxBoxSizer *statsizer = new wxStaticBoxSizer(
|
wxBoxSizer *statsizer = new wxStaticBoxSizer(
|
||||||
new wxStaticBox(p, wxID_ANY, _T("A wxStaticBoxSizer")), wxVERTICAL );
|
new wxStaticBox(p, wxID_ANY, _T("A wxStaticBoxSizer")), wxVERTICAL );
|
||||||
statsizer->Add(
|
statsizer->Add(
|
||||||
new wxStaticText(p, wxID_ANY, _T("And some TEXT inside it")),
|
new wxStaticText(p, wxID_ANY, _T("And some TEXT inside it")),
|
||||||
wxSizerFlags().Border(wxALL, 30));
|
wxSizerFlags().Border(wxALL, 30));
|
||||||
topsizer->Add(
|
topsizer->Add(
|
||||||
statsizer,
|
statsizer,
|
||||||
wxSizerFlags(1).Expand().Border(wxALL, 10));
|
wxSizerFlags(1).Expand().Border(wxALL, 10));
|
||||||
|
|
||||||
// 2.7) And a test of wxGridSizer
|
// 2.7) And a test of wxGridSizer
|
||||||
wxGridSizer *gridsizer = new wxGridSizer(2, 5, 5);
|
wxGridSizer *gridsizer = new wxGridSizer(2, 5, 5);
|
||||||
gridsizer->Add(new wxStaticText(p, wxID_ANY, _T("Label")),
|
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")),
|
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")),
|
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")),
|
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")),
|
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")),
|
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(
|
topsizer->Add(
|
||||||
gridsizer,
|
gridsizer,
|
||||||
wxSizerFlags().Proportion(1).Expand().Border(wxALL, 10));
|
wxSizerFlags().Proportion(1).Expand().Border(wxALL, 10));
|
||||||
|
|
||||||
|
|
||||||
#if wxUSE_STATLINE
|
#if wxUSE_STATLINE
|
||||||
// 3) middle: create wxStaticLine with minimum size (3x3)
|
// 3) middle: create wxStaticLine with minimum size (3x3)
|
||||||
topsizer->Add(
|
topsizer->Add(
|
||||||
new wxStaticLine( p, wxID_ANY, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL),
|
new wxStaticLine( p, wxID_ANY, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL),
|
||||||
wxSizerFlags().Expand());
|
wxSizerFlags().Expand());
|
||||||
#endif // wxUSE_STATLINE
|
#endif // wxUSE_STATLINE
|
||||||
|
|
||||||
|
|
||||||
// 4) bottom: create two centred wxButtons
|
// 4) bottom: create two centred wxButtons
|
||||||
wxBoxSizer *button_box = new wxBoxSizer( wxHORIZONTAL );
|
wxBoxSizer *button_box = new wxBoxSizer( wxHORIZONTAL );
|
||||||
button_box->Add(
|
button_box->Add(
|
||||||
new wxButton( p, wxID_ANY, _T("Two buttons in a box") ),
|
new wxButton( p, wxID_ANY, _T("Two buttons in a box") ),
|
||||||
wxSizerFlags().Border(wxALL, 7));
|
wxSizerFlags().Border(wxALL, 7));
|
||||||
button_box->Add(
|
button_box->Add(
|
||||||
new wxButton( p, wxID_ANY, _T("(wxCENTER)") ),
|
new wxButton( p, wxID_ANY, _T("(wxCENTER)") ),
|
||||||
wxSizerFlags().Border(wxALL, 7));
|
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
|
// don't allow frame to get smaller than what the sizers tell it and also set
|
||||||
// the initial size as calculated by the sizers
|
// the initial size as calculated by the sizers
|
||||||
topsizer->SetSizeHints( this );
|
topsizer->SetSizeHints( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||||
|
@@ -67,6 +67,10 @@
|
|||||||
#include "wx/filename.h" //For wxFileName::GetName()
|
#include "wx/filename.h" //For wxFileName::GetName()
|
||||||
#include "wx/config.h" //for native wxConfig
|
#include "wx/config.h" //for native wxConfig
|
||||||
|
|
||||||
|
#ifndef __WXMSW__
|
||||||
|
#include "../sample.xpm"
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Bail out if the user doesn't want one of the
|
// Bail out if the user doesn't want one of the
|
||||||
// things we need
|
// things we need
|
||||||
@@ -481,6 +485,8 @@ void wxMediaPlayerApp::MacOpenFile(const wxString & fileName )
|
|||||||
wxMediaPlayerFrame::wxMediaPlayerFrame(const wxString& title)
|
wxMediaPlayerFrame::wxMediaPlayerFrame(const wxString& title)
|
||||||
: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(600,600))
|
: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(600,600))
|
||||||
{
|
{
|
||||||
|
SetIcon(wxICON(sample));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create Menus
|
// Create Menus
|
||||||
//
|
//
|
||||||
|
@@ -59,6 +59,10 @@
|
|||||||
#include "copy.xpm"
|
#include "copy.xpm"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __WXMSW__
|
||||||
|
#include "../sample.xpm"
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// classes
|
// classes
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -371,6 +375,8 @@ bool MyApp::OnInit()
|
|||||||
MyFrame::MyFrame()
|
MyFrame::MyFrame()
|
||||||
: wxFrame((wxFrame *)NULL, wxID_ANY, _T("wxWidgets menu sample"))
|
: wxFrame((wxFrame *)NULL, wxID_ANY, _T("wxWidgets menu sample"))
|
||||||
{
|
{
|
||||||
|
SetIcon(wxICON(sample));
|
||||||
|
|
||||||
#if USE_LOG_WINDOW
|
#if USE_LOG_WINDOW
|
||||||
m_textctrl = NULL;
|
m_textctrl = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
@@ -24,10 +24,17 @@
|
|||||||
#error Sorry, this sample is only appropriate under Windows.
|
#error Sorry, this sample is only appropriate under Windows.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __WXMSW__
|
||||||
|
#include "../sample.xpm"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "nativdlg.h"
|
#include "nativdlg.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
IMPLEMENT_APP(MyApp)
|
IMPLEMENT_APP(MyApp)
|
||||||
|
|
||||||
bool MyApp::OnInit(void)
|
bool MyApp::OnInit(void)
|
||||||
@@ -75,7 +82,9 @@ END_EVENT_TABLE()
|
|||||||
MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size):
|
MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size):
|
||||||
wxFrame(parent, id, title, pos, size)
|
wxFrame(parent, id, title, pos, size)
|
||||||
{
|
{
|
||||||
panel = NULL;
|
SetIcon(wxICON(sample));
|
||||||
|
|
||||||
|
panel = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||||
@@ -104,10 +113,10 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
void MyDialog::OnOk(wxCommandEvent& WXUNUSED(event))
|
void MyDialog::OnOk(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
EndModal(wxID_OK);
|
EndModal(wxID_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
|
void MyDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
EndModal(wxID_CANCEL);
|
EndModal(wxID_CANCEL);
|
||||||
}
|
}
|
||||||
|
@@ -68,6 +68,9 @@
|
|||||||
|
|
||||||
#include <wx/artprov.h>
|
#include <wx/artprov.h>
|
||||||
|
|
||||||
|
#ifndef __WXMSW__
|
||||||
|
#include "../sample.xpm"
|
||||||
|
#endif
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// wxSampleMultiButtonEditor
|
// wxSampleMultiButtonEditor
|
||||||
@@ -2062,6 +2065,8 @@ FormMain::FormMain(const wxString& title, const wxPoint& pos, const wxSize& size
|
|||||||
(wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCAPTION|
|
(wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCAPTION|
|
||||||
wxTAB_TRAVERSAL|wxCLOSE_BOX|wxNO_FULL_REPAINT_ON_RESIZE) )
|
wxTAB_TRAVERSAL|wxCLOSE_BOX|wxNO_FULL_REPAINT_ON_RESIZE) )
|
||||||
{
|
{
|
||||||
|
SetIcon(wxICON(sample));
|
||||||
|
|
||||||
m_propGrid = NULL;
|
m_propGrid = NULL;
|
||||||
m_panel = NULL;
|
m_panel = NULL;
|
||||||
|
|
||||||
|
@@ -72,12 +72,12 @@ class wxVectorProperty : public wxPGProperty
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
wxVectorProperty( const wxString& label = wxPG_LABEL,
|
wxVectorProperty( const wxString& label = wxPG_LABEL,
|
||||||
const wxString& name = wxPG_LABEL,
|
const wxString& name = wxPG_LABEL,
|
||||||
const wxVector3f& value = wxVector3f() );
|
const wxVector3f& value = wxVector3f() );
|
||||||
virtual ~wxVectorProperty();
|
virtual ~wxVectorProperty();
|
||||||
|
|
||||||
virtual void ChildChanged( wxVariant& thisValue,
|
virtual void ChildChanged( wxVariant& thisValue,
|
||||||
int childIndex, wxVariant& childValue ) const;
|
int childIndex, wxVariant& childValue ) const;
|
||||||
virtual void RefreshChildren();
|
virtual void RefreshChildren();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -109,7 +109,7 @@ public:
|
|||||||
virtual ~wxTriangleProperty();
|
virtual ~wxTriangleProperty();
|
||||||
|
|
||||||
virtual void ChildChanged( wxVariant& thisValue,
|
virtual void ChildChanged( wxVariant& thisValue,
|
||||||
int childIndex, wxVariant& childValue ) const;
|
int childIndex, wxVariant& childValue ) const;
|
||||||
virtual void RefreshChildren();
|
virtual void RefreshChildren();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -128,7 +128,7 @@ class FormMain : public wxFrame
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FormMain(const wxString& title, const wxPoint& pos, const wxSize& size );
|
FormMain(const wxString& title, const wxPoint& pos, const wxSize& size );
|
||||||
~FormMain();
|
~FormMain();
|
||||||
|
|
||||||
wxPropertyGridManager* m_pPropGridManager;
|
wxPropertyGridManager* m_pPropGridManager;
|
||||||
wxPropertyGrid* m_propGrid;
|
wxPropertyGrid* m_propGrid;
|
||||||
|
@@ -22,6 +22,10 @@
|
|||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
#include "wx/tglbtn.h"
|
#include "wx/tglbtn.h"
|
||||||
|
|
||||||
|
#ifndef __WXMSW__
|
||||||
|
#include "../sample.xpm"
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// a trivial example
|
// a trivial example
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -854,6 +858,8 @@ END_EVENT_TABLE()
|
|||||||
MyFrame::MyFrame()
|
MyFrame::MyFrame()
|
||||||
: wxFrame(NULL, wxID_ANY, "wxWidgets scroll sample")
|
: wxFrame(NULL, wxID_ANY, "wxWidgets scroll sample")
|
||||||
{
|
{
|
||||||
|
SetIcon(wxICON(sample));
|
||||||
|
|
||||||
wxMenu *menuFile = new wxMenu;
|
wxMenu *menuFile = new wxMenu;
|
||||||
menuFile->Append(wxID_ABOUT, "&About..");
|
menuFile->Append(wxID_ABOUT, "&About..");
|
||||||
menuFile->AppendSeparator();
|
menuFile->AppendSeparator();
|
||||||
|
@@ -40,6 +40,9 @@
|
|||||||
#include "wx/dcclient.h"
|
#include "wx/dcclient.h"
|
||||||
#include "wx/image.h"
|
#include "wx/image.h"
|
||||||
|
|
||||||
|
#ifndef __WXMSW__
|
||||||
|
#include "../sample.xpm"
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// constants
|
// constants
|
||||||
@@ -246,6 +249,8 @@ MainFrame::MainFrame()
|
|||||||
: wxFrame(NULL, wxID_ANY, "wxWidgets Shaped Sample",
|
: wxFrame(NULL, wxID_ANY, "wxWidgets Shaped Sample",
|
||||||
wxDefaultPosition, wxSize(200, 100))
|
wxDefaultPosition, wxSize(200, 100))
|
||||||
{
|
{
|
||||||
|
SetIcon(wxICON(sample));
|
||||||
|
|
||||||
wxMenuBar * const mbar = new wxMenuBar;
|
wxMenuBar * const mbar = new wxMenuBar;
|
||||||
wxMenu * const menuFrames = new wxMenu;
|
wxMenu * const menuFrames = new wxMenu;
|
||||||
menuFrames->Append(Show_Shaped, "Show &shaped window\tCtrl-S");
|
menuFrames->Append(Show_Shaped, "Show &shaped window\tCtrl-S");
|
||||||
|
@@ -39,6 +39,10 @@
|
|||||||
#include "wx/splitter.h"
|
#include "wx/splitter.h"
|
||||||
#include "wx/dcmirror.h"
|
#include "wx/dcmirror.h"
|
||||||
|
|
||||||
|
#ifndef __WXMSW__
|
||||||
|
#include "../sample.xpm"
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// constants
|
// constants
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -197,6 +201,8 @@ MyFrame::MyFrame()
|
|||||||
wxDefaultPosition, wxSize(420, 300),
|
wxDefaultPosition, wxSize(420, 300),
|
||||||
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
|
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
|
||||||
{
|
{
|
||||||
|
SetIcon(wxICON(sample));
|
||||||
|
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
CreateStatusBar(2);
|
CreateStatusBar(2);
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
|
@@ -49,6 +49,10 @@
|
|||||||
#include "wx/datetime.h"
|
#include "wx/datetime.h"
|
||||||
#include "wx/numdlg.h"
|
#include "wx/numdlg.h"
|
||||||
|
|
||||||
|
#ifndef __WXMSW__
|
||||||
|
#include "../sample.xpm"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// define this for the platforms which don't support wxBitmapButton (such as
|
// define this for the platforms which don't support wxBitmapButton (such as
|
||||||
// Motif), else a wxBitmapButton will be used
|
// Motif), else a wxBitmapButton will be used
|
||||||
@@ -312,6 +316,8 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
|||||||
: wxFrame((wxWindow *)NULL, wxID_ANY, title, pos, size)
|
: wxFrame((wxWindow *)NULL, wxID_ANY, title, pos, size)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
SetIcon(wxICON(sample));
|
||||||
|
|
||||||
m_statbarDefault = NULL;
|
m_statbarDefault = NULL;
|
||||||
m_statbarCustom = NULL;
|
m_statbarCustom = NULL;
|
||||||
|
|
||||||
|
@@ -39,6 +39,9 @@
|
|||||||
#include "edit.h" // Edit module
|
#include "edit.h" // Edit module
|
||||||
#include "prefs.h" // Prefs
|
#include "prefs.h" // Prefs
|
||||||
|
|
||||||
|
#ifndef __WXMSW__
|
||||||
|
#include "../sample.xpm"
|
||||||
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// resources
|
// resources
|
||||||
@@ -300,7 +303,9 @@ END_EVENT_TABLE ()
|
|||||||
|
|
||||||
AppFrame::AppFrame (const wxString &title)
|
AppFrame::AppFrame (const wxString &title)
|
||||||
: wxFrame ((wxFrame *)NULL, wxID_ANY, title, wxDefaultPosition, wxSize(750,550),
|
: 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
|
// intitialize important variables
|
||||||
m_edit = NULL;
|
m_edit = NULL;
|
||||||
|
@@ -39,6 +39,11 @@
|
|||||||
|
|
||||||
#include "wx/notebook.h"
|
#include "wx/notebook.h"
|
||||||
|
|
||||||
|
#ifndef __WXMSW__
|
||||||
|
#include "../sample.xpm"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// constants
|
// constants
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -189,6 +194,8 @@ MyFrame::MyFrame()
|
|||||||
: wxFrame(NULL, wxID_ANY, _T("TabOrder wxWidgets Sample"),
|
: wxFrame(NULL, wxID_ANY, _T("TabOrder wxWidgets Sample"),
|
||||||
wxDefaultPosition, wxSize(700, 450))
|
wxDefaultPosition, wxSize(700, 450))
|
||||||
{
|
{
|
||||||
|
SetIcon(wxICON(sample));
|
||||||
|
|
||||||
wxMenu *menuFile = new wxMenu;
|
wxMenu *menuFile = new wxMenu;
|
||||||
menuFile->Append(TabOrder_About);
|
menuFile->Append(TabOrder_About);
|
||||||
menuFile->AppendSeparator();
|
menuFile->AppendSeparator();
|
||||||
|
@@ -45,6 +45,10 @@
|
|||||||
#include "wx/numdlg.h"
|
#include "wx/numdlg.h"
|
||||||
#include "wx/tokenzr.h"
|
#include "wx/tokenzr.h"
|
||||||
|
|
||||||
|
#ifndef __WXMSW__
|
||||||
|
#include "../sample.xpm"
|
||||||
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// class definitions
|
// class definitions
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
@@ -1369,6 +1373,8 @@ END_EVENT_TABLE()
|
|||||||
MyFrame::MyFrame(wxFrame *frame, const wxChar *title, int x, int y, int w, int h)
|
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) )
|
: wxFrame(frame, wxID_ANY, title, wxPoint(x, y), wxSize(w, h) )
|
||||||
{
|
{
|
||||||
|
SetIcon(wxICON(sample));
|
||||||
|
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
CreateStatusBar(2);
|
CreateStatusBar(2);
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
// Purpose: wxWidgets sample demonstrating wxWrapSizer use
|
// Purpose: wxWidgets sample demonstrating wxWrapSizer use
|
||||||
// Author: Arne Steinarson
|
// Author: Arne Steinarson
|
||||||
// Created: 21.01.2008
|
// Created: 21.01.2008
|
||||||
// RCS-ID: $Id:$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Arne Steinarson
|
// Copyright: (c) Arne Steinarson
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -21,70 +21,19 @@
|
|||||||
#include "wx/wrapsizer.h"
|
#include "wx/wrapsizer.h"
|
||||||
#include "wx/artprov.h"
|
#include "wx/artprov.h"
|
||||||
|
|
||||||
|
#ifndef __WXMSW__
|
||||||
|
#include "../sample.xpm"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// definitions
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WrapSizerFrame : public wxFrame
|
class WrapSizerFrame : public wxFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WrapSizerFrame()
|
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnButton(wxCommandEvent& WXUNUSED(event))
|
void OnButton(wxCommandEvent& WXUNUSED(event))
|
||||||
@@ -116,10 +65,8 @@ private:
|
|||||||
tb->Realize( );
|
tb->Realize( );
|
||||||
return tb;
|
return tb;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class WrapSizerApp : public wxApp
|
class WrapSizerApp : public wxApp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -133,3 +80,73 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
IMPLEMENT_APP(WrapSizerApp);
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user