2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: propdlg.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxPropertySheetDialog
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2008-04-10 17:59:22 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
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,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxPropertySheetDialog
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This class represents a property sheet dialog: a tabbed dialog
|
|
|
|
for showing settings. It is optimized to show flat tabs
|
|
|
|
on PocketPC devices, and can be customized to use different
|
|
|
|
controllers instead of the default notebook style.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-10 17:59:22 -04:00
|
|
|
To use this class, call Create() from your own Create function.
|
|
|
|
Then call CreateButtons(), and create pages, adding them to the book control.
|
|
|
|
Finally call LayoutDialog().
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
For example:
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@code
|
|
|
|
bool MyPropertySheetDialog::Create(...)
|
|
|
|
{
|
|
|
|
if (!wxPropertySheetDialog::Create(...))
|
2008-07-02 10:45:57 -04:00
|
|
|
return false;
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
CreateButtons(wxOK|wxCANCEL|wxHELP);
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
// Add page
|
|
|
|
wxPanel* panel = new wxPanel(GetBookCtrl(), ...);
|
2008-04-10 17:59:22 -04:00
|
|
|
GetBookCtrl()->AddPage(panel, wxT("General"));
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
LayoutDialog();
|
2008-07-02 10:45:57 -04:00
|
|
|
return true;
|
2008-03-08 08:52:38 -05:00
|
|
|
}
|
|
|
|
@endcode
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-10 17:59:22 -04:00
|
|
|
If necessary, override CreateBookCtrl() and AddBookCtrl() to create and add a
|
|
|
|
different kind of book control. You will then need to use two-step construction
|
|
|
|
for the dialog or change the style of the book control by calling SetSheetStyle()
|
|
|
|
before calling Create().
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-10 17:59:22 -04:00
|
|
|
The @ref page_samples_dialogs shows this class being used with notebook and toolbook
|
|
|
|
controllers (for Windows-style and Mac-style settings dialogs).
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
To make pages of the dialog scroll when the display is too small to fit the
|
2008-04-10 17:59:22 -04:00
|
|
|
whole dialog, you can switch layout adaptation on globally with
|
|
|
|
wxDialog::EnableLayoutAdaptation() or per dialog with
|
|
|
|
wxDialog::SetLayoutAdaptationMode().
|
|
|
|
|
|
|
|
For more about layout adaptation, see @ref overview_dialog_autoscrolling.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxadv}
|
|
|
|
@category{managedwnd}
|
|
|
|
*/
|
|
|
|
class wxPropertySheetDialog : public wxDialog
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Constructor.
|
|
|
|
*/
|
|
|
|
wxPropertySheetDialog(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDEFAULT_DIALOG_STYLE,
|
|
|
|
const wxString& name = "dialogBox");
|
|
|
|
|
|
|
|
/**
|
|
|
|
Override this if you wish to add the book control in a way different from the
|
|
|
|
standard way (for example, using different spacing).
|
|
|
|
*/
|
|
|
|
virtual void AddBookCtrl(wxSizer* sizer);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Call this from your own Create function, before adding buttons and pages.
|
|
|
|
*/
|
|
|
|
bool Create(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDEFAULT_DIALOG_STYLE,
|
|
|
|
const wxString& name = "dialogBox");
|
|
|
|
|
|
|
|
/**
|
|
|
|
Override this if you wish to create a different kind of book control; by
|
2008-04-10 17:59:22 -04:00
|
|
|
default, the value passed to SetSheetStyle() is used to determine the control.
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
The default behaviour is to create a notebook except on Smartphone, where a
|
|
|
|
choicebook is used.
|
|
|
|
*/
|
|
|
|
virtual wxBookCtrlBase* CreateBookCtrl();
|
|
|
|
|
|
|
|
/**
|
2008-04-10 17:59:22 -04:00
|
|
|
Call this to create the buttons for the dialog.
|
|
|
|
This calls wxDialog::CreateButtonSizer(), and the flags are the same.
|
|
|
|
|
|
|
|
@note On PocketPC, no buttons are created.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
void CreateButtons(int flags = wxOK|wxCANCEL);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the book control that will contain your settings pages.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxBookCtrlBase* GetBookCtrl() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the inner sizer that contains the book control and button sizer.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxSizer* GetInnerSizer() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-04-10 17:59:22 -04:00
|
|
|
Returns the sheet style.
|
|
|
|
|
|
|
|
See SetSheetStyle() for allowed values.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
long GetSheetStyle() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-04-10 17:59:22 -04:00
|
|
|
Call this to lay out the dialog.
|
|
|
|
|
|
|
|
@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.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
void LayoutDialog(int centreFlags = wxBOTH);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-04-10 17:59:22 -04:00
|
|
|
Sets the book control used for the dialog.
|
|
|
|
|
|
|
|
You will normally not need to use this.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetBookCtrl(wxBookCtrlBase* bookCtrl);
|
|
|
|
|
|
|
|
/**
|
2008-04-10 17:59:22 -04:00
|
|
|
Sets the inner sizer that contains the book control and button sizer.
|
|
|
|
|
|
|
|
You will normally not need to use this.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetInnerSizer(wxSizer* sizer);
|
|
|
|
|
|
|
|
/**
|
|
|
|
You can customize the look and feel of the dialog by setting the sheet style.
|
2008-04-10 17:59:22 -04:00
|
|
|
It is a bit list of the ::wxPropertySheetDialogFlags values.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetSheetStyle(long style);
|
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|