MGUI::DLGSHELL Class Reference

Base class for general dialog support for both modeless and modal behavior. More...

#include <mgui/dlgshell.h>

Inheritance diagram for MGUI::DLGSHELL:

Inheritance graph
[legend]
List of all members.

Public Types

enum  BUTTONS {
  BUTTONS_Default = 0x00, BUTTON_OK = 0x01, BUTTON_Cancel = 0x02, BUTTON_Apply = 0x04,
  BUTTON_Close = 0x08, BUTTON_Help = 0x10
}
enum  STYLE {
  STYLE_Default = 0x00, STYLE_Resizable = 0x01, STYLE_ContextHelp = 0x02, STYLE_AllowMinimize = 0x04,
  STYLE_AllowMaximize = 0x08, STYLE_CenterOnScreen = 0x10, STYLE_CenterOnMouse = 0x20, STYLE_DeleteOnClose = 0x40,
  STYLE_ToolWindow = 0x80
}

Public Member Functions

void Close (bool notify=true)
ERRVALUE CreateModeless (MDLGPARENT dlgparent, bool AllowMinimize=false)
ERRVALUE DoModal (MDLGPARENT dlgparent)
bool IsOpen () const
ERRVALUE Open ()
 operator MDLGPARENT () const
void SetApplyEnabled (bool enabled=true)
void SetDeleteOnClose (bool DeleteOnClose=true)
void SetOkEnabled (bool enabled=true)
virtual ~DLGSHELL ()=0

Protected Member Functions

MGUI::CTRL_PUSHBUTTONCreateButton (BUTTONS button, const char *label=0)
void CreateButtons (BUTTONS buttons=BUTTONS_Default)
 DLGSHELL (const MISTRING &title, HELPID HelpID, STYLE style=STYLE_Default)
MGUI::LAYOUT_PANEGetButtonPane (bool AddSpace=true)
bool IsModal () const
void NotifyCancel ()
void NotifyOK ()
void SetIgnoreNonVisible (bool IgnoreNonVisible=true)
void SetReturnValue (int RetValue)
void SetRootMargin (int RootMargin)
void SetRootSpacing (int RootSpacing)
void SetStyle (STYLE style)
void UpdateLayout ()
virtual void v_OnCancel ()
virtual void v_OnOK ()

Private Member Functions

virtual ERRVALUE v_CreateContent ()=0
virtual void v_OnApply ()
virtual void v_OnClose ()
virtual void v_OnCloseRequest ()
virtual void v_OnDestroy ()
virtual void v_OnOpen ()

Detailed Description

Base class for general dialog support for both modeless and modal behavior.

This class is available for both X and MFC with identical public and protected interfaces. The derived dialog implementation class must override the v_CreateContent() method. Most derived classes will also override v_OnApply to perform the desired update of the external data when the user presses 'OK' or 'Apply'. When overriding the protected v_On...() virtual methods pay close attention to when the corresponding base method is to be called to ensure correct behavior.

Definition at line 74 of file dlgshell.h.


Member Enumeration Documentation

enum MGUI::DLGSHELL::BUTTONS
 

Standard dialog button selections, may be combined for some methods.

Enumeration values:
BUTTONS_Default  Default buttons per dialog style.
BUTTON_OK 
BUTTON_Cancel 
BUTTON_Apply 
BUTTON_Close 
BUTTON_Help 

Definition at line 91 of file dlgshell.h.

enum MGUI::DLGSHELL::STYLE
 

Style settings, may be combined.

Enumeration values:
STYLE_Default  Default style.
STYLE_Resizable  Dialog is resizable.
STYLE_ContextHelp  (Non-X) Include '?' icon in titlebar, cannot combine with AllowMinimize or AllowMaximize
STYLE_AllowMinimize  (Non-X) Include minimize box in titlebar, cannot combine with STYLE_ContextHelp
STYLE_AllowMaximize  (Non-X) Include maximize box in titlebar, cannot combine with STYLE_ContextHelp
STYLE_CenterOnScreen  Initially center dialog on monitor containing parent window.
STYLE_CenterOnMouse  Initially center dialog on mouse cursor.
STYLE_DeleteOnClose  Delete (destroy) dialog on closing, only used for modeless dialogs.
STYLE_ToolWindow  Window is a "tool controls" or "pallette" window. Gets a smaller title bar than normal windows.

Reimplemented in RVC::DLG_IMAGE_HISTOGRAM.

Definition at line 78 of file dlgshell.h.


Constructor & Destructor Documentation

virtual MGUI::DLGSHELL::~DLGSHELL  )  [pure virtual]
 

Destructor.

MGUI::DLGSHELL::DLGSHELL const MISTRING title,
HELPID  HelpID,
STYLE  style = STYLE_Default
[protected]
 

Constructor, initializes only.

Parameters:
title  Title string, can use TEXTID also
HelpID  Help ID, use HELPID__None if no 'help' available
style  Dialog style settings


Member Function Documentation

void MGUI::DLGSHELL::Close bool  notify = true  ) 
 

Close the dialog if modeless.

Parameters:
notify  Notify via OnClose()

MGUI::CTRL_PUSHBUTTON& MGUI::DLGSHELL::CreateButton BUTTONS  button,
const char *  label = 0
[protected]
 

Create standard button.

Returns:
Reference to button created (usually for alignment only).
Parameters:
button  Button to create
label  Override for label, used for resource lookup

void MGUI::DLGSHELL::CreateButtons BUTTONS  buttons = BUTTONS_Default  )  [protected]
 

Create standard buttons at bottom of dialog.

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'.

Parameters:
buttons  Buttons to create

ERRVALUE MGUI::DLGSHELL::CreateModeless MDLGPARENT  dlgparent,
bool  AllowMinimize = false
 

Create 'modeless' dialog (without opening it).

Parameters:
dlgparent  Parent for dialog
AllowMinimize  (Non-X) Allow dialog to be "minimized"

ERRVALUE MGUI::DLGSHELL::DoModal MDLGPARENT  dlgparent  ) 
 

Open dialog in modal state and wait for user to dismiss via OK/Cancel.

Returns:
0 if OK, EUserCancel if Cancel, < 0 if error
Parameters:
dlgparent  Parent for modal dialog

MGUI::LAYOUT_PANE& MGUI::DLGSHELL::GetButtonPane bool  AddSpace = true  )  [protected]
 

Get pane to create buttons at bottom of dialog.

This allows additional 'non-standard' buttons to be added to the dialog. This will create the pane if it has not been created already.

Parameters:
AddSpace  Add space if creating so buttons placed at right

bool MGUI::DLGSHELL::IsModal  )  const [inline, protected]
 

Determine if dialog was open as modal.

Definition at line 177 of file dlgshell.h.

bool MGUI::DLGSHELL::IsOpen  )  const
 

Determine if dialog is currently open.

void MGUI::DLGSHELL::NotifyCancel  )  [inline, protected]
 

Send 'Cancel' notification to dialog.

Definition at line 188 of file dlgshell.h.

void MGUI::DLGSHELL::NotifyOK  )  [inline, protected]
 

Send 'OK' notification to dialog.

Definition at line 192 of file dlgshell.h.

ERRVALUE MGUI::DLGSHELL::Open  ) 
 

Open dialog if created in modeless state.

MGUI::DLGSHELL::operator MDLGPARENT  )  const [inline]
 

Cast to MDLGPARENT for use as parent for other dialogs.

Definition at line 105 of file dlgshell.h.

void MGUI::DLGSHELL::SetApplyEnabled bool  enabled = true  )  [inline]
 

Set whether 'Apply' (if exists) button is enabled.

Definition at line 134 of file dlgshell.h.

void MGUI::DLGSHELL::SetDeleteOnClose bool  DeleteOnClose = true  ) 
 

Set to delete shell instance when closed (for modal dialogs).

This allows the dialog to be created via 'new' without retaining the pointer instance.

void MGUI::DLGSHELL::SetIgnoreNonVisible bool  IgnoreNonVisible = true  )  [inline, protected]
 

Set to ignore nonvisible items when doing layout.

This must be called before CreateModeless() or DoModal() and is usually done in the subclass constructor.

Definition at line 198 of file dlgshell.h.

void MGUI::DLGSHELL::SetOkEnabled bool  enabled = true  )  [inline]
 

Set whether 'OK' button (if exists) is enabled.

Definition at line 146 of file dlgshell.h.

void MGUI::DLGSHELL::SetReturnValue int  RetValue  )  [inline, protected]
 

Set value to return from dialog.

Definition at line 203 of file dlgshell.h.

void MGUI::DLGSHELL::SetRootMargin int  RootMargin  )  [inline, protected]
 

Set margin for root pane.

This must be called before CreateModeless() or DoModal() and is usually done in the subclass constructor.

Definition at line 210 of file dlgshell.h.

void MGUI::DLGSHELL::SetRootSpacing int  RootSpacing  )  [inline, protected]
 

Set spacing for root pane.

This must be called before CreateModeless() or DoModal() and is usually done in the subclass constructor.

Definition at line 217 of file dlgshell.h.

void MGUI::DLGSHELL::SetStyle STYLE  style  )  [inline, protected]
 

Set dialog style.

This must be called before CreateModeless() or DoModal() and not in v_OnInitDialog() for proper behavior.

Definition at line 224 of file dlgshell.h.

void MGUI::DLGSHELL::UpdateLayout  )  [inline, protected]
 

Force update of dialog layout.

Definition at line 229 of file dlgshell.h.

virtual ERRVALUE MGUI::DLGSHELL::v_CreateContent  )  [private, pure virtual]
 

Create dialog shell 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 must 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. Implementation should call GetMainForm() or GetMainPane() to determine the form or pane to create the controls in. Note that you cannot override the dialog title in v_CreateContent, title must be set first.

Implements MGUI::SHELL.

Implemented in GRE::DLG_VIEWZOOM, and MGUI::FRAMESTYLEDLG.

virtual void MGUI::DLGSHELL::v_OnApply  )  [private, virtual]
 

Called when user presses 'Apply' button.

Will also be called by default v_OnOK implementation if 'Apply' button exists and is not disabled.

Reimplemented in GRE::DLG_VIEWZOOM, and MGUI::FRAMESTYLEDLG.

virtual void MGUI::DLGSHELL::v_OnCancel  )  [protected, virtual]
 

Called when 'Cancel' button is pressed.

Derived class must call base class v_OnCancel() method AFTER performing its own processing to actually 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 base class v_OnCancel() method should not be called. This will cause the dialog to remain open and allow the user to retain the settings. Derived classes should generally declare this method as private.

virtual void MGUI::DLGSHELL::v_OnClose  )  [private, virtual]
 

Called when dialog gets closed.

virtual void MGUI::DLGSHELL::v_OnCloseRequest  )  [private, virtual]
 

Called when user requests that shell be 'closed'.

Default implementation simply calls Close(). May be overridden if different behavior desired.

Implements MGUI::SHELL.

virtual void MGUI::DLGSHELL::v_OnDestroy  )  [private, virtual]
 

Called when dialog is destroyed.

virtual void MGUI::DLGSHELL::v_OnOK  )  [protected, virtual]
 

Called when 'OK' button is pressed.

Derived class must call base class v_OnOK() method AFTER performing its own processing to actually 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 base class v_OnOK() method should not be called. This will cause the dialog to remain open and allow the user to correct the settings. In addition, if an 'Apply' button has been created using the appropriate DLGSHELL methods then v_OnApply will be called before closing. Derived classes should generally declare this method as private.

virtual void MGUI::DLGSHELL::v_OnOpen  )  [private, virtual]
 

Called after dialog is actually opened.


The documentation for this class was generated from the following file:
Generated on Tue Dec 14 13:20:49 2004 for TNTsdk by  doxygen 1.3.8-20040913