MGUI::CTRL Class Reference

Base class for "single" graphical user interface controls. More...

#include <mgui/ctrl.h>

Inheritance diagram for MGUI::CTRL:

Inheritance graph
[legend]
List of all members.

Public Member Functions

void GetClientRect (LPRECT lpRect) const
CWnd * GetCWnd ()
Widget GetWidget ()
void Invalidate (bool erase=true)
void InvalidateRect (const LRECT2D &lrect, bool erase=true)
virtual bool IsCreated () const
virtual bool IsEnabled () const
virtual bool PreTranslateMessageHook (MSG *pMsg)
virtual void SetEnabled (bool enabled=true)
void SetRedraw (bool redraw=true)
virtual void SetVisible (bool visible=true)
void UpdateWindow ()
virtual ~CTRL ()=0

Static Public Member Functions

const COLORGetBackgroundColor ()

Protected Member Functions

void AddDestroyCallback ()
 CTRL ()
 CTRL (CWnd *pWnd)
 CTRL (CWnd &wnd)
virtual void OnDestroy ()

Protected Attributes

CWnd * m_pWnd
Widget m_widget

Detailed Description

Base class for "single" graphical user interface controls.

There are two basic types of 'controls' which can be used in user interface implementation, controls which the user can interact with and 'static' controls which the user cannot change directly.

All controls which the user can manipulate also encapsulate information about the current 'state' of the control (except for MGUI::CTRL_PUSHBUTTON as explained below). There are three ways to use each of these controls in a program (in order of convenience):

  1. If changing the state of a control has no other immediate effect then the control class may be used directly and the state information retrieved when needed, such as when the user presses 'OK' on the dialog. This option is not available for MGUI::CTRL_PUSHBUTTON as pressing a button must always have some other affect and MGUI::CTRL_PUSHBUTTON contains no 'state' information.
  2. Use the template version of the control and specify a callback 'container' and callback method pointer for the control. This allows the callback to be a method of the 'container' class (usually the dialog, page or main window) thus allowing access to other controls in the container. This is similar to MFC message maps and avoids the common need to include a reference or pointer to the container in a subclass. Templates for controls with a single On... virtual method will generally include the container and method pointer as parameters to the Create() methods. Templates for controls with multiple On... virtual methods will generally have a SetFunc... method for each corresponding On... virtual method in their base class and will not override the Create() methods.
  3. Inherit from the control class and override the On... virtual method to perform task specific processing. This is simplest if no reference to the containing dialog or window is necessary. Also for some control types, the template version itself may be inherited from to override other virtual methods, such as MGUI::CTRL_EDIT_... validation methods.

Definition at line 264 of file ctrl.h.


Constructor & Destructor Documentation

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

Destructor.

MGUI::CTRL::CTRL CWnd &  wnd  )  [inline, protected]
 

Constructor (MFC version).

Definition at line 368 of file ctrl.h.

MGUI::CTRL::CTRL CWnd *  pWnd  )  [inline, protected]
 

Definition at line 372 of file ctrl.h.

MGUI::CTRL::CTRL  )  [inline, protected]
 

Constructor (X version).

Definition at line 382 of file ctrl.h.


Member Function Documentation

void MGUI::CTRL::AddDestroyCallback  )  [protected]
 

Add 'Destroy' callback for widget.

const COLOR& MGUI::CTRL::GetBackgroundColor  )  [static]
 

Get interface 'background' color.

void MGUI::CTRL::GetClientRect LPRECT  lpRect  )  const [inline]
 

Get "client rectangle" for the primary control window (MFC only).

Definition at line 277 of file ctrl.h.

CWnd* MGUI::CTRL::GetCWnd  )  [inline]
 

Get the CWnd of the primary control (MFC only).

Definition at line 284 of file ctrl.h.

Widget MGUI::CTRL::GetWidget  )  [inline]
 

Get the Widget for the control or container if multiple controls (X only).

The widget should only be used for attachment, do not assume the widget is of a particular type.

Definition at line 292 of file ctrl.h.

void MGUI::CTRL::Invalidate bool  erase = true  )  [inline]
 

Invalidate the entire client area (MFC only).

This will force it to redraw the next WM_PAINT message occurs.

Reimplemented in MGUI::CANVAS.

Definition at line 299 of file ctrl.h.

void MGUI::CTRL::InvalidateRect const LRECT2D lrect,
bool  erase = true
[inline]
 

Invalidate a rectangle in the client area (MFC only).

This will force it to redraw the next WM_PAINT message occurs.

Definition at line 307 of file ctrl.h.

virtual bool MGUI::CTRL::IsCreated  )  const [virtual]
 

Determine if control has been created.

Returns:
true if created, false if not.

Implements MGUI::FORM.

virtual bool MGUI::CTRL::IsEnabled  )  const [virtual]
 

Determine if control is enabled for keyboard or mouse input.

Returns:
true if enabled, false if not, or if not yet created.

virtual void MGUI::CTRL::OnDestroy  )  [protected, virtual]
 

Called if widgets are destroyed before CTRL class instance.

Will not be called if CTRL class instance is destroyed before widgets. Usually just sets widgets to NULL so won't be referenced in destructor. Derived class must call corresponding base class method AFTER performing its own processing.

virtual bool MGUI::CTRL::PreTranslateMessageHook MSG *  pMsg  )  [inline, virtual]
 

Called to process messages before translation (MFC only).

Allows a control to trap messages before they get passed. Should return 'true' if the message was translated and should not be dispatched or 'false' if the message was not handled and should be dispatched. The control must also be added to the root layout's pretranslation list via MGUI::LAYOUT_PANE_BASE::PreTransListAddCtrl(). This should be done in the control's Create() method.

Reimplemented in MGUI::CTRL_EDIT_TEXT, and MGUI::CTRL_EDIT_TEXT_WYSIWYG.

Definition at line 334 of file ctrl.h.

virtual void MGUI::CTRL::SetEnabled bool  enabled = true  )  [virtual]
 

Set whether mouse or keyboard input to control is allowed.

Implements MGUI::FORM.

Reimplemented in MGUI::CTRL_COMBOBOX.

void MGUI::CTRL::SetRedraw bool  redraw = true  )  [inline]
 

Allow the window to be redrawn (MFC only).

Definition at line 346 of file ctrl.h.

virtual void MGUI::CTRL::SetVisible bool  visible = true  )  [virtual]
 

Set whether control is visible or not.

Implements MGUI::FORM.

void MGUI::CTRL::UpdateWindow  )  [inline]
 

Generate a WM_PAINT message if the window needs to be updated.

Definition at line 358 of file ctrl.h.


Member Data Documentation

CWnd* MGUI::CTRL::m_pWnd [protected]
 

Pointer to actual control in derived class.

Definition at line 365 of file ctrl.h.

Widget MGUI::CTRL::m_widget [protected]
 

Definition at line 379 of file ctrl.h.


The documentation for this class was generated from the following file:
Generated on Wed May 31 15:29:47 2006 for TNTsdk by  doxygen 1.3.8-20040913