use an enum to make it easier to document the values

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53119 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2008-04-10 21:59:22 +00:00
parent a30b5ab969
commit 3e8ec95401
2 changed files with 104 additions and 83 deletions

View File

@@ -50,29 +50,32 @@ class WXDLLIMPEXP_FWD_CORE wxBookCtrlBase;
// kind of book control. // kind of book control.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Use the platform default enum wxPropertySheetDialogFlags
#define wxPROPSHEET_DEFAULT 0x0001 {
// Use the platform default
wxPROPSHEET_DEFAULT = 0x0001,
// Use a notebook // Use a notebook
#define wxPROPSHEET_NOTEBOOK 0x0002 wxPROPSHEET_NOTEBOOK = 0x0002,
// Use a toolbook // Use a toolbook
#define wxPROPSHEET_TOOLBOOK 0x0004 wxPROPSHEET_TOOLBOOK = 0x0004,
// Use a choicebook // Use a choicebook
#define wxPROPSHEET_CHOICEBOOK 0x0008 wxPROPSHEET_CHOICEBOOK = 0x0008,
// Use a listbook // Use a listbook
#define wxPROPSHEET_LISTBOOK 0x0010 wxPROPSHEET_LISTBOOK = 0x0010,
// Use a wxButtonToolBar toolbook // Use a wxButtonToolBar toolbook
#define wxPROPSHEET_BUTTONTOOLBOOK 0x0020 wxPROPSHEET_BUTTONTOOLBOOK = 0x0020,
// Use a treebook // Use a treebook
#define wxPROPSHEET_TREEBOOK 0x0040 wxPROPSHEET_TREEBOOK = 0x0040,
// Shrink dialog to fit current page // Shrink dialog to fit current page
#define wxPROPSHEET_SHRINKTOFIT 0x0100 wxPROPSHEET_SHRINKTOFIT = 0x0100,
};
class WXDLLIMPEXP_ADV wxPropertySheetDialog : public wxDialog class WXDLLIMPEXP_ADV wxPropertySheetDialog : public wxDialog
{ {

View File

@@ -6,6 +6,56 @@
// Licence: wxWindows license // Licence: wxWindows license
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/**
Values used by wxPropertySheetDialog::SetSheetStyle
*/
enum wxPropertySheetDialogFlags
{
/**
Uses the default look and feel for the controller window,
normally a notebook except on Smartphone where a choice control is used.
*/
wxPROPSHEET_DEFAULT = 0x0001,
/**
Uses a notebook for the controller window.
*/
wxPROPSHEET_NOTEBOOK = 0x0002,
/**
Uses a toolbook for the controller window.
*/
wxPROPSHEET_TOOLBOOK = 0x0004,
/**
Uses a choicebook for the controller window.
*/
wxPROPSHEET_CHOICEBOOK = 0x0008,
/**
Uses a listbook for the controller window.
*/
wxPROPSHEET_LISTBOOK = 0x0010,
/**
Uses a button toolbox for the controller window.
*/
wxPROPSHEET_BUTTONTOOLBOOK = 0x0020,
/**
Uses a treebook for the controller window.
*/
wxPROPSHEET_TREEBOOK = 0x0040,
/**
Shrinks the dialog window to fit the currently selected page
(common behaviour for property sheets on Mac OS X).
*/
wxPROPSHEET_SHRINKTOFIT = 0x0100,
};
/** /**
@class wxPropertySheetDialog @class wxPropertySheetDialog
@wxheader{propdlg.h} @wxheader{propdlg.h}
@@ -15,10 +65,9 @@
on PocketPC devices, and can be customized to use different on PocketPC devices, and can be customized to use different
controllers instead of the default notebook style. controllers instead of the default notebook style.
To use this class, call wxPropertySheetDialog::Create from your own To use this class, call Create() from your own Create function.
Create function. Then call wxPropertySheetDialog::CreateButtons, and create Then call CreateButtons(), and create pages, adding them to the book control.
pages, adding them to the book control. Finally call LayoutDialog().
Finally call wxPropertySheetDialog::LayoutDialog.
For example: For example:
@@ -32,31 +81,27 @@
// Add page // Add page
wxPanel* panel = new wxPanel(GetBookCtrl(), ...); wxPanel* panel = new wxPanel(GetBookCtrl(), ...);
GetBookCtrl()-AddPage(panel, wxT("General")); GetBookCtrl()->AddPage(panel, wxT("General"));
LayoutDialog(); LayoutDialog();
return @true; return @true;
} }
@endcode @endcode
If necessary, override CreateBookCtrl and AddBookCtrl to create and add a If necessary, override CreateBookCtrl() and AddBookCtrl() to create and add a
different different kind of book control. You will then need to use two-step construction
kind of book control. You would then need to use two-step construction for the for the dialog or change the style of the book control by calling SetSheetStyle()
dialog. before calling Create().
Or, change the style of book control by calling
wxPropertySheetDialog::SetSheetStyle
before calling Create.
The dialogs sample shows this class being used with notebook and toolbook The @ref page_samples_dialogs shows this class being used with notebook and toolbook
controllers (for controllers (for Windows-style and Mac-style settings dialogs).
Windows-style and Mac-style settings dialogs).
To make pages of the dialog scroll when the display is too small to fit the To make pages of the dialog scroll when the display is too small to fit the
whole dialog, you can switch whole dialog, you can switch layout adaptation on globally with
layout adaptation on globally with wxDialog::EnableLayoutAdaptation or wxDialog::EnableLayoutAdaptation() or per dialog with
per dialog with wxDialog::SetLayoutAdaptationMode. For more wxDialog::SetLayoutAdaptationMode().
about layout adaptation, see @ref overview_autoscrollingdialogs "Automatic
scrolling dialogs". For more about layout adaptation, see @ref overview_dialog_autoscrolling.
@library{wxadv} @library{wxadv}
@category{managedwnd} @category{managedwnd}
@@ -92,17 +137,18 @@ public:
/** /**
Override this if you wish to create a different kind of book control; by Override this if you wish to create a different kind of book control; by
default, the value default, the value passed to SetSheetStyle() is used to determine the control.
passed to SetSheetStyle() is used to determine the control.
The default behaviour is to create a notebook except on Smartphone, where a The default behaviour is to create a notebook except on Smartphone, where a
choicebook is used. choicebook is used.
*/ */
virtual wxBookCtrlBase* CreateBookCtrl(); virtual wxBookCtrlBase* CreateBookCtrl();
/** /**
Call this to create the buttons for the dialog. This calls Call this to create the buttons for the dialog.
wxDialog::CreateButtonSizer, and This calls wxDialog::CreateButtonSizer(), and the flags are the same.
the flags are the same. On PocketPC, no buttons are created.
@note On PocketPC, no buttons are created.
*/ */
void CreateButtons(int flags = wxOK|wxCANCEL); void CreateButtons(int flags = wxOK|wxCANCEL);
@@ -117,65 +163,37 @@ public:
wxSizer* GetInnerSizer() const; wxSizer* GetInnerSizer() const;
/** /**
Returns the sheet style. See SetSheetStyle() for Returns the sheet style.
permissable values.
See SetSheetStyle() for allowed values.
*/ */
long GetSheetStyle() const; long GetSheetStyle() const;
/** /**
Call this to lay out the dialog. On PocketPC, this does nothing, since the Call this to lay out the dialog.
dialog will be shown
full-screen, and the layout will be done when the dialog receives a size event. @note 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.
*/ */
void LayoutDialog(int centreFlags = wxBOTH); void LayoutDialog(int centreFlags = wxBOTH);
/** /**
Sets the book control used for the dialog. You will normally not need to use Sets the book control used for the dialog.
this.
You will normally not need to use this.
*/ */
void SetBookCtrl(wxBookCtrlBase* bookCtrl); void SetBookCtrl(wxBookCtrlBase* bookCtrl);
/** /**
Sets the inner sizer that contains the book control and button sizer. You will Sets the inner sizer that contains the book control and button sizer.
normally not need to use this.
You will normally not need to use this.
*/ */
void SetInnerSizer(wxSizer* sizer); void SetInnerSizer(wxSizer* sizer);
/** /**
You can customize the look and feel of the dialog by setting the sheet style. You can customize the look and feel of the dialog by setting the sheet style.
It is It is a bit list of the ::wxPropertySheetDialogFlags values.
a bit list of the following values:
wxPROPSHEET_DEFAULT
Uses the default look and feel for the controller window,
normally a notebook except on Smartphone where a choice control is used.
wxPROPSHEET_NOTEBOOK
Uses a notebook for the controller window.
wxPROPSHEET_TOOLBOOK
Uses a toolbook for the controller window.
wxPROPSHEET_CHOICEBOOK
Uses a choicebook for the controller window.
wxPROPSHEET_LISTBOOK
Uses a listbook for the controller window.
wxPROPSHEET_TREEBOOK
Uses a treebook for the controller window.
wxPROPSHEET_SHRINKTOFIT
Shrinks the dialog window to fit the currently selected page (common behaviour
for
property sheets on Mac OS X).
*/ */
void SetSheetStyle(long style); void SetSheetStyle(long style);
}; };