wxEnDialogBox is derived from wxDialogBox.
The purpose of the wxEnhDialogBox class is to make it easy to provide a common look for all dialog boxes of an application. The wxEnhDialogBox separates the dialog box into four areas:
For now, these panels are tiled vertically, but in future there may a style flag to allow placement of the command area to the right of the dialog, as is common in Windows applications.
The pin area is borrowed from the pushpin metaphor of XView, and can be disabled via a compilation flag. Again, a flag style is perhaps more judicious and may be implemented in future.
The user area is left free for the application programmer.
The command area contains command buttons which are centered automatically by the wxEnhDialogBox::Fit method.
The status area provides a way to display status messages, as in XView.
All areas can have distints fonts sets, currently controlled by a compilation flag. The pushpin can be replaced by a Cancel button (automatically created) if WANT_CANCEL_BUTTON is defined when compiling.
wxEnhDialogBox::wxEnhDialogBox
wxEnhDialogBox::~wxEnhDialogBox
wxEnhDialogBox::userPanel
wxEnhDialogBox::SetStatus
wxEnhDialogBox::AddCmd
wxEnhDialogBox::GetCmd
wxEnhDialogBox::SetPin
wxEnhDialogBox::Show
wxEnhDialogBox::Fit
void wxEnhDialogBox(wxFrame *frame, char *title,
Bool modal = FALSE, wxFunction fun = NULL, int space = -1,
int x = 0, int y = 0, int width = 10, int height = 10,
long style = wxENH_DEFAULT, char *name = "Shell")
Constructor. fun is called when the user dismiss the window by using the pin or the cancel button. If space is greater than zero, it is used as panel horizontal spacing for the command area.
The style parameter may be a combination of the following, using the bitwise 'or' operator.
wxBOTTOM_COMMANDS | Command buttons are on bottom of the dialog. |
wxCANCEL_BUTTON_FIRST | The cancel button is the first button. |
wxCANCEL_BUTTON_LAST | The cancel button is the last button. |
wxCANCEL_BUTTON_SECOND | The cancel button is the second button. |
wxCAPTION | Gives a caption to the dialog box. |
wxENH_DEFAULT | Equivalent to a combination of wxCAPTION, wxBOTTOM_COMMANDS, wxSTATUS_FOOTER and wxNO_CANCEL_BUTTON. |
wxNO_STATUS_FOOTER | No status line is displayed. |
wxNO_CANCEL | No cancel button is displayed. |
wxRIGHT_COMMANDS | Command buttons are on the right hand side of the dialog. |
wxSTATUS_FOOTER | A status line is displayed at the bottom of the dialog. |
void ~wxEnhDialogBox(void)
Destructor.
wxPanel * userPanel
User application items must be created in this panel.
void SetStatus(char *label=NULL)
Display text in the staus area.
wxButton * AddCmd(char *label, wxFunction fun=NULL,
int tag = 0)
wxButton * AddCmd(wxBitmap *bitmap, wxFunction fun=NULL,
int tag = 0)
Adds a command button in the command area, and returns its identifier. The client data part of the button is initialized with tag. Buttons are aranged horizontally, from left to right. If WANT_CANCEL_BUTTON is defined at compile time, a first button is automatically created, with the label "Cancel''.
wxButton * GetCmd(int n)
Returns the identifier of the nth wxButton in the command area (starting at 0).
void SetPin(Bool flag)
Set the pushpin to the given state. The state of the pushpin controls the way the ::Show() method works. Usually, setting the pin to TRUE indicates an error. Please note that this works even if you have compiled with WANT_CANCEL_BUTTON.
Bool Show(Bool show, Bool flag = FALSE)
Dismiss or popup the dialog box. If show is FALSE, the dialog box is dismissed only if the pushpin current state is FALSE. If show is TRUE, the dialog box is popped, and the pushpin is initialized in the state flag.
void Fit(void)
Fits the dialog box to its contents, and centres command buttons in the command area. The status area is created when Fit is called, so do not call SetStatus before fitting.