Added SetSheetStyle to property sheet dialog to allow specification
of alternative book styles and shrink-to-fit mode Updated dialogs sample with example of toolbook-style property sheet dialog git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37233 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -73,6 +73,8 @@ All (GUI):
|
|||||||
with BEGIN_EVENT_TABLE_TEMPLATEn() macros
|
with BEGIN_EVENT_TABLE_TEMPLATEn() macros
|
||||||
- Added double-buffering to wxVListBox and fixed a scrolling issue.
|
- Added double-buffering to wxVListBox and fixed a scrolling issue.
|
||||||
- Added wxToolbook (uses a wxToolBar to control pages).
|
- Added wxToolbook (uses a wxToolBar to control pages).
|
||||||
|
- Added SetSheetStyle to wxPropertySheetDialog and allowed it to
|
||||||
|
behave like a Mac OS X settings dialog.
|
||||||
|
|
||||||
wxMSW:
|
wxMSW:
|
||||||
|
|
||||||
|
@@ -1,8 +1,9 @@
|
|||||||
\section{\class{wxPropertySheetDialog}}\label{wxpropertysheetdialog}
|
\section{\class{wxPropertySheetDialog}}\label{wxpropertysheetdialog}
|
||||||
|
|
||||||
This class represents a property sheet dialog: a tabbed dialog
|
This class represents a property sheet dialog: a tabbed dialog
|
||||||
for showing settings. It is optimized to show with flat tabs
|
for showing settings. It is optimized to show flat tabs
|
||||||
on PocketPC devices.
|
on PocketPC devices, and can be customized to use different
|
||||||
|
controllers instead of the default notebook style.
|
||||||
|
|
||||||
To use this class, call \helpref{wxPropertySheetDialog::Create}{wxpropertysheetdialogcreate} from your own
|
To use this class, call \helpref{wxPropertySheetDialog::Create}{wxpropertysheetdialogcreate} from your own
|
||||||
Create function. Then call \helpref{CreateButtons}{wxpropertysheetdialogcreatebuttons}, and create pages, adding them to the book control.
|
Create function. Then call \helpref{CreateButtons}{wxpropertysheetdialogcreatebuttons}, and create pages, adding them to the book control.
|
||||||
@@ -29,6 +30,11 @@ bool MyPropertySheetDialog::Create(...)
|
|||||||
|
|
||||||
If necessary, override CreateBookCtrl and AddBookCtrl to create and add a different
|
If necessary, override CreateBookCtrl and AddBookCtrl to create and add a different
|
||||||
kind of book control. You would then need to use two-step construction for the dialog.
|
kind of book control. You would then need to use two-step construction for the dialog.
|
||||||
|
Or, change the style of book control by calling \helpref{SetSheetStyle}{wxpropertysheetdialogsetsheetstyle}
|
||||||
|
before calling Create.
|
||||||
|
|
||||||
|
The dialogs sample shows this class being used with notebook and toolbook controllers (for
|
||||||
|
Windows-style and Mac-style settings dialogs).
|
||||||
|
|
||||||
\wxheading{Derived from}
|
\wxheading{Derived from}
|
||||||
|
|
||||||
@@ -77,8 +83,9 @@ Call this from your own Create function, before adding buttons and pages.
|
|||||||
|
|
||||||
\func{virtual wxBookCtrlBase*}{CreateBookCtrl}{\void}
|
\func{virtual wxBookCtrlBase*}{CreateBookCtrl}{\void}
|
||||||
|
|
||||||
Override this if you wish to create a different kind of book control; by default, a wxNotebook
|
Override this if you wish to create a different kind of book control; by default, the value
|
||||||
is created.
|
passed to \helpref{SetSheetStyle}{wxpropertysheetdialogsetsheetstyle} is used to determine the control.
|
||||||
|
The default behaviour is to create a notebook except on Smartphone, where a choicebook is used.
|
||||||
|
|
||||||
\membersection{wxPropertySheetDialog::CreateButtons}\label{wxpropertysheetdialogcreatebuttons}
|
\membersection{wxPropertySheetDialog::CreateButtons}\label{wxpropertysheetdialogcreatebuttons}
|
||||||
|
|
||||||
@@ -99,9 +106,16 @@ Returns the book control that will contain your settings pages.
|
|||||||
|
|
||||||
Returns the inner sizer that contains the book control and button sizer.
|
Returns the inner sizer that contains the book control and button sizer.
|
||||||
|
|
||||||
|
\membersection{wxPropertySheetDialog::GetSheetStyle}\label{wxpropertysheetdialoggetsheetstyle}
|
||||||
|
|
||||||
|
\constfunc{long}{GetSheetStyle}{\void}
|
||||||
|
|
||||||
|
Returns the sheet style. See \helpref{SetSheetStyle}{wxpropertysheetdialogsetsheetstyle} for
|
||||||
|
permissable values.
|
||||||
|
|
||||||
\membersection{wxPropertySheetDialog::LayoutDialog}\label{wxpropertysheetdialoglayoutdialog}
|
\membersection{wxPropertySheetDialog::LayoutDialog}\label{wxpropertysheetdialoglayoutdialog}
|
||||||
|
|
||||||
\func{void}{LayoutDialog}{\void}
|
\func{void}{LayoutDialog}{\param{int}{ centreFlags=wxBOTH}}
|
||||||
|
|
||||||
Call this to lay out the dialog. On PocketPC, this does nothing, since the dialog will be shown
|
Call this to lay out the dialog. On PocketPC, this does nothing, since the dialog will be shown
|
||||||
full-screen, and the layout will be done when the dialog receives a size event.
|
full-screen, and the layout will be done when the dialog receives a size event.
|
||||||
@@ -118,3 +132,22 @@ Sets the book control used for the dialog. You will normally not need to use thi
|
|||||||
|
|
||||||
Sets the inner sizer that contains the book control and button sizer. You will normally not need to use this.
|
Sets the inner sizer that contains the book control and button sizer. You will normally not need to use this.
|
||||||
|
|
||||||
|
\membersection{wxPropertySheetDialog::SetSheetStyle}\label{wxpropertysheetdialogsetsheetstyle}
|
||||||
|
|
||||||
|
\func{void}{SetSheetStyle}{\param{long}{ style}}
|
||||||
|
|
||||||
|
You can customize the look and feel of the dialog by setting the sheet style. It is
|
||||||
|
a bit list of the following values:
|
||||||
|
|
||||||
|
\twocolwidtha{5cm}
|
||||||
|
\begin{twocollist}\itemsep=0pt
|
||||||
|
\twocolitem{wxPROPSHEET\_DEFAULT}{Uses the default look and feel for the controller window,
|
||||||
|
normally a notebook except on Smartphone where a choice control is used.}
|
||||||
|
\twocolitem{wxPROPSHEET\_NOTEBOOK}{Uses a notebook for the controller window.}
|
||||||
|
\twocolitem{wxPROPSHEET\_TOOLBOOK}{Uses a toolbook for the controller window.}
|
||||||
|
\twocolitem{wxPROPSHEET\_CHOICEBOOK}{Uses a choicebook for the controller window.}
|
||||||
|
\twocolitem{wxPROPSHEET\_LISTBOOK}{Uses a listbook for the controller window.}
|
||||||
|
\twocolitem{wxPROPSHEET\_SHRINKTOFIT}{Shrinks the dialog window to fit the currently selected page (common behaviour for
|
||||||
|
property sheets on Mac OS X).}
|
||||||
|
\end{twocollist}
|
||||||
|
|
||||||
|
@@ -48,6 +48,24 @@ class WXDLLEXPORT wxBookCtrlBase;
|
|||||||
// kind of book control.
|
// kind of book control.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Use the platform default
|
||||||
|
#define wxPROPSHEET_DEFAULT 0x0001
|
||||||
|
|
||||||
|
// Use a notebook
|
||||||
|
#define wxPROPSHEET_NOTEBOOK 0x0002
|
||||||
|
|
||||||
|
// Use a toolbook
|
||||||
|
#define wxPROPSHEET_TOOLBOOK 0x0004
|
||||||
|
|
||||||
|
// Use a choicebook
|
||||||
|
#define wxPROPSHEET_CHOICEBOOK 0x0008
|
||||||
|
|
||||||
|
// Use a listbook
|
||||||
|
#define wxPROPSHEET_LISTBOOK 0x0010
|
||||||
|
|
||||||
|
// Shrink dialog to fit current page
|
||||||
|
#define wxPROPSHEET_SHRINKTOFIT 0x0100
|
||||||
|
|
||||||
class WXDLLIMPEXP_ADV wxPropertySheetDialog : public wxDialog
|
class WXDLLIMPEXP_ADV wxPropertySheetDialog : public wxDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -81,13 +99,17 @@ public:
|
|||||||
void SetInnerSize(wxSizer* sizer) { m_innerSizer = sizer; }
|
void SetInnerSize(wxSizer* sizer) { m_innerSizer = sizer; }
|
||||||
wxSizer* GetInnerSizer() const { return m_innerSizer ; }
|
wxSizer* GetInnerSizer() const { return m_innerSizer ; }
|
||||||
|
|
||||||
|
// Set and get the book style
|
||||||
|
void SetSheetStyle(long sheetStyle) { m_sheetStyle = sheetStyle; }
|
||||||
|
long GetSheetStyle() const { return m_sheetStyle ; }
|
||||||
|
|
||||||
/// Operations
|
/// Operations
|
||||||
|
|
||||||
// Creates the buttons (none on PocketPC)
|
// Creates the buttons (none on PocketPC)
|
||||||
virtual void CreateButtons(int flags = wxOK|wxCANCEL);
|
virtual void CreateButtons(int flags = wxOK|wxCANCEL);
|
||||||
|
|
||||||
// Lay out the dialog, to be called after pages have been created
|
// Lay out the dialog, to be called after pages have been created
|
||||||
virtual void LayoutDialog();
|
virtual void LayoutDialog(int centreFlags = wxBOTH);
|
||||||
|
|
||||||
/// Implementation
|
/// Implementation
|
||||||
|
|
||||||
@@ -101,12 +123,17 @@ public:
|
|||||||
// Set the focus
|
// Set the focus
|
||||||
void OnActivate(wxActivateEvent& event);
|
void OnActivate(wxActivateEvent& event);
|
||||||
|
|
||||||
|
// Resize dialog if necessary
|
||||||
|
void OnIdle(wxIdleEvent& event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxBookCtrlBase* m_bookCtrl;
|
wxBookCtrlBase* m_bookCtrl;
|
||||||
wxSizer* m_innerSizer; // sizer for extra space
|
wxSizer* m_innerSizer; // sizer for extra space
|
||||||
|
long m_sheetStyle;
|
||||||
|
int m_selectedPage;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxPropertySheetDialog)
|
DECLARE_DYNAMIC_CLASS(wxPropertySheetDialog)
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
#include "wx/datetime.h"
|
#include "wx/datetime.h"
|
||||||
#include "wx/image.h"
|
#include "wx/image.h"
|
||||||
#include "wx/bookctrl.h"
|
#include "wx/bookctrl.h"
|
||||||
|
#include "wx/artprov.h"
|
||||||
|
|
||||||
#if wxUSE_COLOURDLG
|
#if wxUSE_COLOURDLG
|
||||||
#include "wx/colordlg.h"
|
#include "wx/colordlg.h"
|
||||||
@@ -191,6 +192,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|||||||
|
|
||||||
#if USE_SETTINGS_DIALOG
|
#if USE_SETTINGS_DIALOG
|
||||||
EVT_MENU(DIALOGS_PROPERTY_SHEET, MyFrame::OnPropertySheet)
|
EVT_MENU(DIALOGS_PROPERTY_SHEET, MyFrame::OnPropertySheet)
|
||||||
|
EVT_MENU(DIALOGS_PROPERTY_SHEET_TOOLBOOK, MyFrame::OnPropertySheetToolBook)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EVT_MENU(DIALOGS_REQUEST, MyFrame::OnRequestUserAttention)
|
EVT_MENU(DIALOGS_REQUEST, MyFrame::OnRequestUserAttention)
|
||||||
@@ -358,6 +360,7 @@ bool MyApp::OnInit()
|
|||||||
|
|
||||||
#if USE_SETTINGS_DIALOG
|
#if USE_SETTINGS_DIALOG
|
||||||
file_menu->Append(DIALOGS_PROPERTY_SHEET, _T("&Property Sheet Dialog\tCtrl-P"));
|
file_menu->Append(DIALOGS_PROPERTY_SHEET, _T("&Property Sheet Dialog\tCtrl-P"));
|
||||||
|
file_menu->Append(DIALOGS_PROPERTY_SHEET_TOOLBOOK, _T("Property Sheet Dialog using &ToolBook"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
file_menu->Append(DIALOGS_REQUEST, _T("&Request user attention\tCtrl-R"));
|
file_menu->Append(DIALOGS_REQUEST, _T("&Request user attention\tCtrl-R"));
|
||||||
@@ -973,6 +976,12 @@ void MyFrame::OnPropertySheet(wxCommandEvent& WXUNUSED(event))
|
|||||||
SettingsDialog dialog(this);
|
SettingsDialog dialog(this);
|
||||||
dialog.ShowModal();
|
dialog.ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnPropertySheetToolBook(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
SettingsDialog dialog(this, true);
|
||||||
|
dialog.ShowModal();
|
||||||
|
}
|
||||||
#endif // USE_SETTINGS_DIALOG
|
#endif // USE_SETTINGS_DIALOG
|
||||||
|
|
||||||
void MyFrame::OnRequestUserAttention(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnRequestUserAttention(wxCommandEvent& WXUNUSED(event))
|
||||||
@@ -1371,33 +1380,67 @@ IMPLEMENT_CLASS(SettingsDialog, wxPropertySheetDialog)
|
|||||||
BEGIN_EVENT_TABLE(SettingsDialog, wxPropertySheetDialog)
|
BEGIN_EVENT_TABLE(SettingsDialog, wxPropertySheetDialog)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
SettingsDialog::SettingsDialog(wxWindow* win)
|
SettingsDialog::SettingsDialog(wxWindow* win, bool useToolBook)
|
||||||
{
|
{
|
||||||
SetExtraStyle(wxDIALOG_EX_CONTEXTHELP|wxWS_EX_VALIDATE_RECURSIVELY);
|
SetExtraStyle(wxDIALOG_EX_CONTEXTHELP|wxWS_EX_VALIDATE_RECURSIVELY);
|
||||||
|
|
||||||
|
int tabImage1 = -1;
|
||||||
|
int tabImage2 = -1;
|
||||||
|
|
||||||
|
if (useToolBook)
|
||||||
|
{
|
||||||
|
tabImage1 = 0;
|
||||||
|
tabImage2 = 1;
|
||||||
|
SetSheetStyle(wxPROPSHEET_TOOLBOOK|wxPROPSHEET_SHRINKTOFIT);
|
||||||
|
|
||||||
|
// create a dummy image list with a few icons
|
||||||
|
const wxSize imageSize(32, 32);
|
||||||
|
|
||||||
|
m_imageList = new wxImageList(imageSize.GetWidth(), imageSize.GetHeight());
|
||||||
|
m_imageList->
|
||||||
|
Add(wxArtProvider::GetIcon(wxART_INFORMATION, wxART_OTHER, imageSize));
|
||||||
|
m_imageList->
|
||||||
|
Add(wxArtProvider::GetIcon(wxART_QUESTION, wxART_OTHER, imageSize));
|
||||||
|
m_imageList->
|
||||||
|
Add(wxArtProvider::GetIcon(wxART_WARNING, wxART_OTHER, imageSize));
|
||||||
|
m_imageList->
|
||||||
|
Add(wxArtProvider::GetIcon(wxART_ERROR, wxART_OTHER, imageSize));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_imageList = NULL;
|
||||||
|
|
||||||
Create(win, wxID_ANY, _("Preferences"), wxDefaultPosition, wxDefaultSize,
|
Create(win, wxID_ANY, _("Preferences"), wxDefaultPosition, wxDefaultSize,
|
||||||
wxDEFAULT_DIALOG_STYLE
|
wxDEFAULT_DIALOG_STYLE
|
||||||
#ifndef __WXWINCE__
|
#ifndef __WXWINCE__
|
||||||
|wxRESIZE_BORDER
|
|wxRESIZE_BORDER
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
CreateButtons(wxOK|wxCANCEL
|
|
||||||
|
// If using a toolbook, also follow Mac style and don't create buttons
|
||||||
|
if (!useToolBook)
|
||||||
|
CreateButtons(wxOK|wxCANCEL
|
||||||
#ifndef __POCKETPC__
|
#ifndef __POCKETPC__
|
||||||
|wxHELP
|
|wxHELP
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
wxBookCtrlBase* notebook = GetBookCtrl();
|
wxBookCtrlBase* notebook = GetBookCtrl();
|
||||||
|
notebook->SetImageList(m_imageList);
|
||||||
|
|
||||||
wxPanel* generalSettings = CreateGeneralSettingsPage(notebook);
|
wxPanel* generalSettings = CreateGeneralSettingsPage(notebook);
|
||||||
wxPanel* aestheticSettings = CreateAestheticSettingsPage(notebook);
|
wxPanel* aestheticSettings = CreateAestheticSettingsPage(notebook);
|
||||||
|
|
||||||
notebook->AddPage(generalSettings, _("General"));
|
notebook->AddPage(generalSettings, _("General"), true, tabImage1);
|
||||||
notebook->AddPage(aestheticSettings, _("Aesthetics"));
|
notebook->AddPage(aestheticSettings, _("Aesthetics"), false, tabImage2);
|
||||||
|
|
||||||
LayoutDialog();
|
LayoutDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SettingsDialog::~SettingsDialog()
|
||||||
|
{
|
||||||
|
delete m_imageList;
|
||||||
|
}
|
||||||
|
|
||||||
wxPanel* SettingsDialog::CreateGeneralSettingsPage(wxWindow* parent)
|
wxPanel* SettingsDialog::CreateGeneralSettingsPage(wxWindow* parent)
|
||||||
{
|
{
|
||||||
wxPanel* panel = new wxPanel(parent, wxID_ANY);
|
wxPanel* panel = new wxPanel(parent, wxID_ANY);
|
||||||
|
@@ -142,7 +142,8 @@ class SettingsDialog: public wxPropertySheetDialog
|
|||||||
{
|
{
|
||||||
DECLARE_CLASS(SettingsDialog)
|
DECLARE_CLASS(SettingsDialog)
|
||||||
public:
|
public:
|
||||||
SettingsDialog(wxWindow* parent);
|
SettingsDialog(wxWindow* parent, bool useToolBook = false);
|
||||||
|
~SettingsDialog();
|
||||||
|
|
||||||
wxPanel* CreateGeneralSettingsPage(wxWindow* parent);
|
wxPanel* CreateGeneralSettingsPage(wxWindow* parent);
|
||||||
wxPanel* CreateAestheticSettingsPage(wxWindow* parent);
|
wxPanel* CreateAestheticSettingsPage(wxWindow* parent);
|
||||||
@@ -160,6 +161,8 @@ protected:
|
|||||||
ID_FONT_SIZE
|
ID_FONT_SIZE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
wxImageList* m_imageList;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -253,6 +256,7 @@ public:
|
|||||||
#endif // USE_FONTDLG_GENERIC
|
#endif // USE_FONTDLG_GENERIC
|
||||||
|
|
||||||
void OnPropertySheet(wxCommandEvent& event);
|
void OnPropertySheet(wxCommandEvent& event);
|
||||||
|
void OnPropertySheetToolBook(wxCommandEvent& event);
|
||||||
void OnRequestUserAttention(wxCommandEvent& event);
|
void OnRequestUserAttention(wxCommandEvent& event);
|
||||||
void OnExit(wxCommandEvent& event);
|
void OnExit(wxCommandEvent& event);
|
||||||
|
|
||||||
@@ -322,7 +326,8 @@ enum
|
|||||||
DIALOGS_FIND,
|
DIALOGS_FIND,
|
||||||
DIALOGS_REPLACE,
|
DIALOGS_REPLACE,
|
||||||
DIALOGS_REQUEST,
|
DIALOGS_REQUEST,
|
||||||
DIALOGS_PROPERTY_SHEET
|
DIALOGS_PROPERTY_SHEET,
|
||||||
|
DIALOGS_PROPERTY_SHEET_TOOLBOOK
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -29,6 +29,20 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/bookctrl.h"
|
#include "wx/bookctrl.h"
|
||||||
|
|
||||||
|
#if wxUSE_NOTEBOOK
|
||||||
|
#include "wx/notebook.h"
|
||||||
|
#endif
|
||||||
|
#if wxUSE_CHOICEBOOK
|
||||||
|
#include "wx/choicebk.h"
|
||||||
|
#endif
|
||||||
|
#if wxUSE_TOOLBOOK
|
||||||
|
#include "wx/toolbook.h"
|
||||||
|
#endif
|
||||||
|
#if wxUSE_LISTBOOK
|
||||||
|
#include "wx/listbook.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "wx/generic/propdlg.h"
|
#include "wx/generic/propdlg.h"
|
||||||
#include "wx/sysopt.h"
|
#include "wx/sysopt.h"
|
||||||
|
|
||||||
@@ -40,6 +54,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxPropertySheetDialog, wxDialog)
|
|||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxPropertySheetDialog, wxDialog)
|
BEGIN_EVENT_TABLE(wxPropertySheetDialog, wxDialog)
|
||||||
EVT_ACTIVATE(wxPropertySheetDialog::OnActivate)
|
EVT_ACTIVATE(wxPropertySheetDialog::OnActivate)
|
||||||
|
EVT_IDLE(wxPropertySheetDialog::OnIdle)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
bool wxPropertySheetDialog::Create(wxWindow* parent, wxWindowID id, const wxString& title,
|
bool wxPropertySheetDialog::Create(wxWindow* parent, wxWindowID id, const wxString& title,
|
||||||
@@ -69,17 +84,19 @@ bool wxPropertySheetDialog::Create(wxWindow* parent, wxWindowID id, const wxStri
|
|||||||
|
|
||||||
void wxPropertySheetDialog::Init()
|
void wxPropertySheetDialog::Init()
|
||||||
{
|
{
|
||||||
|
m_sheetStyle = wxPROPSHEET_DEFAULT;
|
||||||
m_innerSizer = NULL;
|
m_innerSizer = NULL;
|
||||||
m_bookCtrl = NULL;
|
m_bookCtrl = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Layout the dialog, to be called after pages have been created
|
// Layout the dialog, to be called after pages have been created
|
||||||
void wxPropertySheetDialog::LayoutDialog()
|
void wxPropertySheetDialog::LayoutDialog(int centreFlags)
|
||||||
{
|
{
|
||||||
#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__)
|
#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__)
|
||||||
GetSizer()->Fit(this);
|
GetSizer()->Fit(this);
|
||||||
GetSizer()->SetSizeHints(this);
|
GetSizer()->SetSizeHints(this);
|
||||||
Centre(wxBOTH);
|
if (centreFlags)
|
||||||
|
Centre(centreFlags);
|
||||||
#endif
|
#endif
|
||||||
#if defined(__SMARTPHONE__)
|
#if defined(__SMARTPHONE__)
|
||||||
if (m_bookCtrl)
|
if (m_bookCtrl)
|
||||||
@@ -123,7 +140,32 @@ wxBookCtrlBase* wxPropertySheetDialog::CreateBookCtrl()
|
|||||||
#else
|
#else
|
||||||
style |= wxBK_DEFAULT;
|
style |= wxBK_DEFAULT;
|
||||||
#endif
|
#endif
|
||||||
return new wxBookCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, style );
|
|
||||||
|
wxBookCtrlBase* bookCtrl = NULL;
|
||||||
|
|
||||||
|
#if wxUSE_NOTEBOOK
|
||||||
|
if (GetSheetStyle() & wxPROPSHEET_NOTEBOOK)
|
||||||
|
bookCtrl = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, style );
|
||||||
|
#endif
|
||||||
|
#if wxUSE_CHOICEBOOK
|
||||||
|
if (GetSheetStyle() & wxPROPSHEET_CHOICEBOOK)
|
||||||
|
bookCtrl = new wxChoicebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, style );
|
||||||
|
#endif
|
||||||
|
#if wxUSE_TOOLBOOK
|
||||||
|
if (GetSheetStyle() & wxPROPSHEET_TOOLBOOK)
|
||||||
|
bookCtrl = new wxToolbook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, style );
|
||||||
|
#endif
|
||||||
|
#if wxUSE_LISTBOOK
|
||||||
|
if (GetSheetStyle() & wxPROPSHEET_LISTBOOK)
|
||||||
|
bookCtrl = new wxListbook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, style );
|
||||||
|
#endif
|
||||||
|
if (!bookCtrl)
|
||||||
|
bookCtrl = new wxBookCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, style );
|
||||||
|
|
||||||
|
if (GetSheetStyle() & wxPROPSHEET_SHRINKTOFIT)
|
||||||
|
bookCtrl->SetShrinkMode(true);
|
||||||
|
|
||||||
|
return bookCtrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adds the book control to the inner sizer.
|
// Adds the book control to the inner sizer.
|
||||||
@@ -157,4 +199,25 @@ void wxPropertySheetDialog::OnActivate(wxActivateEvent& event)
|
|||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Resize dialog if necessary
|
||||||
|
void wxPropertySheetDialog::OnIdle(wxIdleEvent& event)
|
||||||
|
{
|
||||||
|
event.Skip();
|
||||||
|
|
||||||
|
if ((GetSheetStyle() & wxPROPSHEET_SHRINKTOFIT) && GetBookCtrl())
|
||||||
|
{
|
||||||
|
int sel = GetBookCtrl()->GetSelection();
|
||||||
|
if (sel != -1 && sel != m_selectedPage)
|
||||||
|
{
|
||||||
|
GetBookCtrl()->InvalidateBestSize();
|
||||||
|
InvalidateBestSize();
|
||||||
|
SetSizeHints(-1, -1, -1, -1);
|
||||||
|
|
||||||
|
m_selectedPage = sel;
|
||||||
|
LayoutDialog(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // wxUSE_BOOKCTRL
|
#endif // wxUSE_BOOKCTRL
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user