Base class for general dialog support for both modeless and modal behavior. More...
#include <mi32/midialog.h>
Public Types | |
| enum | BUTTONS { BUTTONS_Default = 0x00, BUTTON_OK = 0x01, BUTTON_Cancel = 0x02, BUTTON_Apply = 0x04, BUTTON_Close = 0x08 } |
Public Member Functions | |
| MIDIALOG () | |
| virtual | ~MIDIALOG ()=0 |
| void | Close (bool notify=true) |
| ERRVALUE | CreateModeless (MDLGPARENT dlgparent) |
| ERRVALUE | DoModal (MDLGPARENT dlgparent) |
| bool | IsCreated () const |
| bool | IsOpen () const |
| ERRVALUE | Open () |
| void | SetApplySensitive (bool sensitive) const |
Protected Member Functions | |
| Widget | CreateButtonRow (const BUTTONITEM *ButtonItems, void *cbdata=0, void *userdata=0) |
| Widget | CreateButtons (BUTTONS buttons=BUTTONS_Default) |
| virtual const char * | GetDialogHelpID () const =0 |
| virtual const char * | GetDialogName () const =0 |
| Widget | GetMainForm () const |
| virtual void | OnApply () |
| virtual void | OnCancel () |
| virtual void | OnClose () |
| virtual ERRVALUE | OnInitDialog (Widget form)=0 |
| virtual void | OnOK () |
| virtual void | OnOpen () |
| void | SetupButtonApply (BUTTONITEM &bi) |
| void | SetupButtonCancel (BUTTONITEM &bi) |
| void | SetupButtonClose (BUTTONITEM &bi) |
| void | SetupButtonOK (BUTTONITEM &bi) |
Base class for general dialog support for both modeless and modal behavior.
The derived class must override the GetDialogName(), GetDialogHelpID() and OnInitDialog() methods. Most derived classes will also override the OnApply to perform the desired update of the external data when the user presses "OK" or "Apply". When overriding the On...() virtual methods pay close attention to when (or if) the corresponding superclass method is to be called.
| enum MIDIALOG::BUTTONS |
| MIDIALOG::MIDIALOG | ( | ) |
Default constructor, initialize only.
| virtual MIDIALOG::~MIDIALOG | ( | ) | [pure virtual] |
Destructor.
| void MIDIALOG::Close | ( | bool | notify = true |
) |
Close the dialog if modeless.
| notify | Notify via OnClose() |
| Widget MIDIALOG::CreateButtonRow | ( | const BUTTONITEM * | ButtonItems, | |
| void * | cbdata = 0, |
|||
| void * | userdata = 0 | |||
| ) | [protected] |
Create buttons at bottom of form.
Create standard buttons at bottom of form.
Default button labels will depend on the dialog style. Modal dialog buttons will be "OK", "Cancel" and "Help". Modeless dialog buttons will be "OK", "Cancel", "Apply" and "Help". For modeless dialogs, pressing "OK" has the same effect as pressing "Apply" followed by "Close".
| buttons | Buttons to create |
| ERRVALUE MIDIALOG::CreateModeless | ( | MDLGPARENT | dlgparent | ) |
Create "modeless" dialog (without opening it).
| dlgparent | Parent for dialog |
| ERRVALUE MIDIALOG::DoModal | ( | MDLGPARENT | dlgparent | ) |
Open dialog in modal state and wait for user to dismiss via OK/Cancel.
| dlgparent | Parent for modal dialog |
| virtual const char* MIDIALOG::GetDialogHelpID | ( | ) | const [protected, pure virtual] |
Get dialog HelpID.
| virtual const char* MIDIALOG::GetDialogName | ( | ) | const [protected, pure virtual] |
Get dialog name for title resource.
| Widget MIDIALOG::GetMainForm | ( | ) | const [inline, protected] |
Get outermost Form widget.
| bool MIDIALOG::IsCreated | ( | ) | const [inline] |
Determine if dialog has been created.
| bool MIDIALOG::IsOpen | ( | ) | const [inline] |
Determine if dialog is currently open.
| virtual void MIDIALOG::OnApply | ( | ) | [protected, virtual] |
Called when user presses "Apply" button.
Will also be called when "OK" button is pressed if have "Apply" button and "Apply" is not disabled. Derived class must call superclass OnApply() method BEFORE performing its own processing.
| virtual void MIDIALOG::OnCancel | ( | ) | [protected, virtual] |
Called when "Cancel" button is pressed.
Derived class must call superclass OnCancel() method AFTER performing its own processing to properly close the dialog. In some cases the user may be given an opportunity to verify that they intended to press the Cancel button. If they elect not to cancel then the superclass OnCancel() method should not be called. This will cause the dialog to remain open and allow the user to retain the settings.
| virtual void MIDIALOG::OnClose | ( | ) | [protected, virtual] |
Called when dialog is closed.
Create dialog contents.
Derived class MUST implement this. Function must return 0 for success or an error code. This will be called by the dialog creation code and thus should not be called directly. This is normally overridden only by the specific dialog implementation and not by the code that actually uses that dialog implementation.
| form | Form to create contents in |
| virtual void MIDIALOG::OnOK | ( | ) | [protected, virtual] |
Called when "OK" button is pressed.
Derived class must call superclass OnOK() method AFTER performing its own processing to properly close the dialog. If the dialog settings do not pass their associated validation test then an appropriate message should be displayed for the user and the superclass OnOK() method should not be called. This will cause the dialog to remain open and allow the user to correct the settings.
| virtual void MIDIALOG::OnOpen | ( | ) | [protected, virtual] |
Called when dialog is opened after the dialog is actually "managed" and displayed.
Derived class must call superclass OnOpen() method BEFORE performing its own processing.
| ERRVALUE MIDIALOG::Open | ( | ) |
Open dialog if created in modeless state.
| void MIDIALOG::SetApplySensitive | ( | bool | sensitive | ) | const [inline] |
Set "Apply" (if exists) button sensitivity.
| void MIDIALOG::SetupButtonApply | ( | BUTTONITEM & | bi | ) | [protected] |
Setup BUTTONITEM for "Apply" button.
| void MIDIALOG::SetupButtonCancel | ( | BUTTONITEM & | bi | ) | [protected] |
Setup BUTTONITEM for Cancel button.
| void MIDIALOG::SetupButtonClose | ( | BUTTONITEM & | bi | ) | [protected] |
Setup BUTTONITEM for Close button.
| void MIDIALOG::SetupButtonOK | ( | BUTTONITEM & | bi | ) | [protected] |
Setup BUTTONITEM for "OK" button.
1.6.1