| Version: 3.0.2

- Main Page
- Related Pages
- Categories
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
wxStdDialogButtonSizer Class Reference
Window Layout

`#include <wx/sizer.h>`

Inheritance diagram for wxStdDialogButtonSizer:
[legend]

## Detailed Description

This class creates button layouts which conform to the standard button spacing and ordering defined by the platform or toolkit's user interface guidelines (if such things exist).

By using this class, you can ensure that all your standard dialogs look correct on all major platforms. Currently it conforms to the Windows, GTK+ and Mac OS X human interface guidelines.

When there aren't interface guidelines defined for a particular platform or toolkit, wxStdDialogButtonSizer reverts to the Windows implementation.

To use this class, first add buttons to the sizer by calling wxStdDialogButtonSizer::AddButton (or wxStdDialogButtonSizer::SetAffirmativeButton, wxStdDialogButtonSizer::SetNegativeButton or wxStdDialogButtonSizer::SetCancelButton) and then call Realize in order to create the actual button layout used. Other than these special operations, this sizer works like any other sizer.

If you add a button with wxID_SAVE, on Mac OS X the button will be renamed to "Save" and the wxID_NO button will be renamed to "Don't Save" in accordance with the Mac OS X Human Interface Guidelines.

##

Library: wxCore
Category: Window Layout

See Also
  wxSizer, Sizers Overview, wxDialog::CreateButtonSizer

## Public Member Functions
| wxStdDialogButtonSizer ()
| Constructor for a wxStdDialogButtonSizer.
void | AddButton (wxButton *button)
| Adds a button to the wxStdDialogButtonSizer.
void | Realize ()
| Rearranges the buttons and applies proper spacing between buttons to make them match the platform or toolkit's interface guidelines.
void | SetAffirmativeButton (wxButton *button)
| Sets the affirmative button for the sizer.
void | SetCancelButton (wxButton *button)
| Sets the cancel button for the sizer.
void | SetNegativeButton (wxButton *button)
| Sets the negative button for the sizer.
virtual void | RecalcSizes ()
| Implements the calculation of a box sizer's dimensions and then sets the size of its children (calling wxWindow::SetSize if the child is a window).
virtual wxSize | CalcMin ()
| Implements the calculation of a box sizer's minimal.
Public Member Functions inherited from wxBoxSizer
| wxBoxSizer (int orient)
| Constructor for a wxBoxSizer.
virtual wxSizerItem * | AddSpacer (int size)
| Adds non-stretchable space to the main orientation of the sizer only.
int | GetOrientation () const
| Returns the orientation of the box sizer, either wxVERTICAL or wxHORIZONTAL.
void | SetOrientation (int orient)
| Sets the orientation of the box sizer, either wxVERTICAL or wxHORIZONTAL.
Public Member Functions inherited from wxSizer
| wxSizer ()
| The constructor.
virtual | ~wxSizer ()
| The destructor.
wxSizerItem * | Add (wxWindow *window, const wxSizerFlags &flags)
| Appends a child to the sizer.
wxSizerItem * | Add (wxWindow *window, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL)
| Appends a child to the sizer.
wxSizerItem * | Add (wxSizer *sizer, const wxSizerFlags &flags)
| Appends a child to the sizer.
wxSizerItem * | Add (wxSizer *sizer, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL)
| Appends a child to the sizer.
wxSizerItem * | Add (int width, int height, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL)
| Appends a spacer child to the sizer.
wxSizerItem * | Add (int width, int height, const wxSizerFlags &flags)
| Appends a spacer child to the sizer.
wxSizerItem * | Add (wxSizerItem *item)
wxSizerItem * | AddStretchSpacer (int prop=1)
| Adds stretchable space to the sizer.
virtual void | Clear (bool delete_windows=false)
| Detaches all children from the sizer.
wxSize | ComputeFittingClientSize (wxWindow *window)
| Computes client area size for window so that it matches the sizer's minimal size.
wxSize | ComputeFittingWindowSize (wxWindow *window)
| Like ComputeFittingClientSize(), but converts the result into window size.
virtual bool | Detach (wxWindow *window)
| Detach the child window from the sizer without destroying it.
virtual bool | Detach (wxSizer *sizer)
| Detach the child sizer from the sizer without destroying it.
virtual bool | Detach (int index)
| Detach a item at position index from the sizer without destroying it.
wxSize | Fit (wxWindow *window)
| Tell the sizer to resize the window so that its client area matches the sizer's minimal size (ComputeFittingClientSize() is called to determine it).
void | FitInside (wxWindow *window)
| Tell the sizer to resize the virtual size of the window to match the sizer's minimal size.
virtual bool | InformFirstDirection (int direction, int size, int availableOtherDir)
| Inform sizer about the first direction that has been decided (by parent item).
wxWindow * | GetContainingWindow () const
| Returns the window this sizer is used in or NULL if none.
void | SetContainingWindow (wxWindow *window)
| Set the window this sizer is used in.
size_t | GetItemCount () const
| Returns the number of items in the sizer.
wxSizerItem * | GetItem (wxWindow *window, bool recursive=false)
| Finds wxSizerItem which holds the given window.
wxSizerItem * | GetItem (wxSizer *sizer, bool recursive=false)
| Finds wxSizerItem which holds the given sizer.
wxSizerItem * | GetItem (size_t index)
| Finds wxSizerItem which is located in the sizer at position index.
wxSizerItem * | GetItemById (int id, bool recursive=false)
| Finds item of the sizer which has the given id.
wxSize | GetMinSize ()
| Returns the minimal size of the sizer.
wxPoint | GetPosition () const
| Returns the current position of the sizer.
wxSize | GetSize () const
| Returns the current size of the sizer.
bool | Hide (wxWindow *window, bool recursive=false)
| Hides the child window.
bool | Hide (wxSizer *sizer, bool recursive=false)
| Hides the child sizer.
bool | Hide (size_t index)
| Hides the item at position index.
wxSizerItem * | Insert (size_t index, wxWindow *window, const wxSizerFlags &flags)
| Insert a child into the sizer before any existing item at index.
wxSizerItem * | Insert (size_t index, wxWindow *window, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL)
| Insert a child into the sizer before any existing item at index.
wxSizerItem * | Insert (size_t index, wxSizer *sizer, const wxSizerFlags &flags)
| Insert a child into the sizer before any existing item at index.
wxSizerItem * | Insert (size_t index, wxSizer *sizer, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL)
| Insert a child into the sizer before any existing item at index.
wxSizerItem * | Insert (size_t index, int width, int height, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL)
| Insert a child into the sizer before any existing item at index.
wxSizerItem * | Insert (size_t index, int width, int height, const wxSizerFlags &flags)
| Insert a child into the sizer before any existing item at index.
wxSizerItem * | Insert (size_t index, wxSizerItem *item)
wxSizerItem * | InsertSpacer (size_t index, int size)
| Inserts non-stretchable space to the sizer.
wxSizerItem * | InsertStretchSpacer (size_t index, int prop=1)
| Inserts stretchable space to the sizer.
bool | IsEmpty () const
| Return true if the sizer has no elements.
bool | IsShown (wxWindow *window) const
| Returns true if the window is shown.
bool | IsShown (wxSizer *sizer) const
| Returns true if the sizer is shown.
bool | IsShown (size_t index) const
| Returns true if the item at index is shown.
virtual void | Layout ()
| Call this to force layout of the children anew, e.g. after having added a child to or removed a child (window, other sizer or space) from the sizer while keeping the current dimension.
wxSizerItem * | Prepend (wxWindow *window, const wxSizerFlags &flags)
| Same as Add(), but prepends the items to the beginning of the list of items (windows, subsizers or spaces) owned by this sizer.
wxSizerItem * | Prepend (wxWindow *window, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL)
| Same as Add(), but prepends the items to the beginning of the list of items (windows, subsizers or spaces) owned by this sizer.
wxSizerItem * | Prepend (wxSizer *sizer, const wxSizerFlags &flags)
| Same as Add(), but prepends the items to the beginning of the list of items (windows, subsizers or spaces) owned by this sizer.
wxSizerItem * | Prepend (wxSizer *sizer, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL)
| Same as Add(), but prepends the items to the beginning of the list of items (windows, subsizers or spaces) owned by this sizer.
wxSizerItem * | Prepend (int width, int height, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL)
| Same as Add(), but prepends the items to the beginning of the list of items (windows, subsizers or spaces) owned by this sizer.
wxSizerItem * | Prepend (int width, int height, const wxSizerFlags &flags)
| Same as Add(), but prepends the items to the beginning of the list of items (windows, subsizers or spaces) owned by this sizer.
wxSizerItem * | Prepend (wxSizerItem *item)
wxSizerItem * | PrependSpacer (int size)
| Prepends non-stretchable space to the sizer.
wxSizerItem * | PrependStretchSpacer (int prop=1)
| Prepends stretchable space to the sizer.
virtual bool | Remove (wxWindow *window)
| Removes a child window from the sizer, but does not destroy it (because windows are owned by their parent window, not the sizer).
virtual bool | Remove (wxSizer *sizer)
| Removes a sizer child from the sizer and destroys it.
virtual bool | Remove (int index)
| Removes a child from the sizer and destroys it if it is a sizer or a spacer, but not if it is a window (because windows are owned by their parent window, not the sizer).
virtual bool | Replace (wxWindow *oldwin, wxWindow *newwin, bool recursive=false)
| Detaches the given oldwin from the sizer and replaces it with the given newwin.
virtual bool | Replace (wxSizer *oldsz, wxSizer *newsz, bool recursive=false)
| Detaches the given oldsz from the sizer and replaces it with the given newsz.
virtual bool | Replace (size_t index, wxSizerItem *newitem)
| Detaches the given item at position index from the sizer and replaces it with the given wxSizerItem newitem.
void | SetDimension (int x, int y, int width, int height)
| Call this to force the sizer to take the given dimension and thus force the items owned by the sizer to resize themselves according to the rules defined by the parameter in the Add() and Prepend() methods.
void | SetDimension (const wxPoint &pos, const wxSize &size)
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void | SetMinSize (const wxSize &size)
| Call this to give the sizer a minimal size.
void | SetMinSize (int width, int height)
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void | SetSizeHints (wxWindow *window)
| This method first calls Fit() and then wxTopLevelWindow::SetSizeHints() on the window passed to it.
void | SetVirtualSizeHints (wxWindow *window)
| Tell the sizer to set the minimal size of the window virtual area to match the sizer's minimal size.
bool | Show (wxWindow *window, bool show=true, bool recursive=false)
| Shows or hides the window.
bool | Show (wxSizer *sizer, bool show=true, bool recursive=false)
| Shows or hides sizer.
bool | Show (size_t index, bool show=true)
| Shows the item at index.
virtual void | ShowItems (bool show)
| Show or hide all items managed by the sizer.
wxSizerItemList & | GetChildren ()
| Returns the list of the items in this sizer.
const wxSizerItemList & | GetChildren () const
| Returns the list of the items in this sizer.
bool | SetItemMinSize (wxWindow *window, int width, int height)
| Set an item's minimum size by window, sizer, or position.
bool | SetItemMinSize (wxWindow *window, const wxSize &size)
| Set an item's minimum size by window, sizer, or position.
bool | SetItemMinSize (wxSizer *sizer, int width, int height)
| Set an item's minimum size by window, sizer, or position.
bool | SetItemMinSize (wxSizer *sizer, const wxSize &size)
| Set an item's minimum size by window, sizer, or position.
bool | SetItemMinSize (size_t index, int width, int height)
| Set an item's minimum size by window, sizer, or position.
bool | SetItemMinSize (size_t index, const wxSize &size)
| Set an item's minimum size by window, sizer, or position.
Public Member Functions inherited from wxObject
| wxObject ()
| Default ctor; initializes to NULL the internal reference data.
| wxObject (const wxObject &other)
| Copy ctor.
virtual | ~wxObject ()
| Destructor.
virtual wxClassInfo * | GetClassInfo () const
| This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar).
wxObjectRefData * | GetRefData () const
| Returns the wxObject::m_refData pointer, i.e. the data referenced by this object.
bool | IsKindOf (const wxClassInfo *info) const
| Determines whether this class is a subclass of (or the same class as) the given class.
bool | IsSameAs (const wxObject &obj) const
| Returns true if this object has the same data pointer as obj.
void | Ref (const wxObject &clone)
| Makes this object refer to the data in clone.
void | SetRefData (wxObjectRefData *data)
| Sets the wxObject::m_refData pointer.
void | UnRef ()
| Decrements the reference count in the associated data, and if it is zero, deletes the data.
void | UnShare ()
| This is the same of AllocExclusive() but this method is public.
void | operator delete (void *buf)
| The delete operator is defined for debugging versions of the library only, when the identifier `WXDEBUG` is defined.
void * | operator new (size_t size, const wxString &filename=NULL, int lineNum=0)
| The new operator is defined for debugging versions of the library only, when the identifier `WXDEBUG` is defined.

## Additional Inherited Members
Protected Member Functions inherited from wxObject
void | AllocExclusive ()
| Ensure that this object's data is not shared with any other object.
virtual wxObjectRefData * | CreateRefData () const
| Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it.
virtual wxObjectRefData * | CloneRefData (const wxObjectRefData *data) const
| Creates a new instance of the wxObjectRefData-derived class specific to this object and initializes it copying data.
Protected Attributes inherited from wxObject
wxObjectRefData * | m_refData
| Pointer to an object which is the object's reference-counted data.

## Constructor & Destructor Documentation

wxStdDialogButtonSizer::wxStdDialogButtonSizer | ( |  | ) |

Constructor for a wxStdDialogButtonSizer.

## Member Function Documentation

void wxStdDialogButtonSizer::AddButton | ( | wxButton * | button | ) |

Adds a button to the wxStdDialogButtonSizer.

The button must have one of the following identifiers:

- wxID_OK
- wxID_YES
- wxID_SAVE
- wxID_APPLY
- wxID_CLOSE
- wxID_NO
- wxID_CANCEL
- wxID_HELP
- wxID_CONTEXT_HELP

virtual wxSize wxStdDialogButtonSizer::CalcMin | ( |  | ) |
| virtual

Implements the calculation of a box sizer's minimal.

It is used internally only and must not be called by the user. Documented for information.

Reimplemented from wxBoxSizer.

void wxStdDialogButtonSizer::Realize | ( |  | ) |

Rearranges the buttons and applies proper spacing between buttons to make them match the platform or toolkit's interface guidelines.

virtual void wxStdDialogButtonSizer::RecalcSizes | ( |  | ) |
| virtual

Implements the calculation of a box sizer's dimensions and then sets the size of its children (calling wxWindow::SetSize if the child is a window).

It is used internally only and must not be called by the user (call Layout() if you want to resize). Documented for information.

Reimplemented from wxBoxSizer.

void wxStdDialogButtonSizer::SetAffirmativeButton | ( | wxButton * | button | ) |

Sets the affirmative button for the sizer.

This allows you to use identifiers other than the standard identifiers outlined above.

void wxStdDialogButtonSizer::SetCancelButton | ( | wxButton * | button | ) |

Sets the cancel button for the sizer.

This allows you to use identifiers other than the standard identifiers outlined above.

void wxStdDialogButtonSizer::SetNegativeButton | ( | wxButton * | button | ) |

Sets the negative button for the sizer.

This allows you to use identifiers other than the standard identifiers outlined above.