MGUI::CTRL Class Reference

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

#include <mgui/ctrl.h>

Inheritance diagram for MGUI::CTRL:
Inheritance graph
[legend]

List of all members.

Public Types

typedef
fastdelegate::FastDelegate
< void(int, int)> 
DELEGATE_ONSIZE
enum  SHADOW {
  SHADOW_None = 0, SHADOW_Black, SHADOW_White, SHADOW_In,
  SHADOW_Out
}

Public Member Functions

virtual ~CTRL ()=0
void GetBackgroundColor (COLOR &color) const
void GetDimensions (MGUI::POINT &dimensions) const
MDLGPARENT GetDlgParent () const
SHELLGetShell () const
CTRL_TOOLTIPGetToolTip () const
Widget GetWidget () const
void Invalidate (bool erase=true)
virtual bool IsCreated () const
virtual bool IsEnabled () const
bool IsVisible () const
void SetBackgroundColor (const COLOR &color)
void SetDimensions (MGUI::POINT dimensions)
virtual void SetEnabled (bool enabled=true)
void SetForegroundColor (const COLOR &color)
void SetMinimumSize (int width, int height)
void SetSizeByKey (const char *SizeKey)
void SetToolTipString (const MISTRING &string)
virtual void SetVisible (bool visible=true)
void UpdateWindow ()

Static Public Member Functions

static const COLORGetBackgroundColor ()
static void ProcessWidgetEvents (Widget widget)
static void SetWidgetShadow (Widget widget, SHADOW shadow)

Protected Member Functions

 CTRL ()
void AddDestroyCallback ()
virtual void v_OnDestroyWidget ()

Static Protected Member Functions

static void SetShadowArgs (XTARGS &args, SHADOW shadow)

Protected Attributes

Widget m_widget

Detailed Description

Base 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). There are three common 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.
  2. Use the various SetDelegate... methods provided by the control to specify a method to be called when the user interacts with the control.
  3. Inherit from the control class and override the On... virtual method to perform task specific processing. Note that not all controls allow such overrides. Also, delegates should not be set when overriding as the order of calling delegate vs override is indeterminant and in some cases the delegate may not be called at all.

Member Typedef Documentation

typedef fastdelegate::FastDelegate<void(int, int)> MGUI::CTRL::DELEGATE_ONSIZE

Delegate type for size change notification.

Parameters are xsize, ysize.


Member Enumeration Documentation

Enumerator:
SHADOW_None 
SHADOW_Black 
SHADOW_White 
SHADOW_In 
SHADOW_Out 

Constructor & Destructor Documentation

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

Destructor.

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

Constructor (X version).


Member Function Documentation

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

Add 'Destroy' callback for widget.

void MGUI::CTRL::GetBackgroundColor ( COLOR color  )  const

Get control 'background' color.

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

Get common interface 'background' color.

void MGUI::CTRL::GetDimensions ( MGUI::POINT dimensions  )  const

Get control dimensions.

Parameters:
dimensions Dimensions returned
MDLGPARENT MGUI::CTRL::GetDlgParent (  )  const

Get parent for dialogs launched from control.

Reimplemented in MGUI::CANVAS.

SHELL* MGUI::CTRL::GetShell (  )  const

Get pointer to shell containing control.

Returns:
NULL if not contained in MGUI::SHELL.
CTRL_TOOLTIP* MGUI::CTRL::GetToolTip (  )  const

Get associated ToolTip control.

Returns:
NULL if no ToolTip control attached
Widget MGUI::CTRL::GetWidget (  )  const [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.

void MGUI::CTRL::Invalidate ( bool  erase = true  ) 

Invalidate the entire control area.

This will force it to redraw during normal event processing.

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.
bool MGUI::CTRL::IsVisible (  )  const

Determine if control is visible.

Returns:
true if visible, false if not, or if not yet created.
static void MGUI::CTRL::ProcessWidgetEvents ( Widget  widget  )  [static]

Process all pending events for widget, discarding others.

Intended for use in code which checks for a "button press" during an operation, ignoring user actions on other controls.

void MGUI::CTRL::SetBackgroundColor ( const COLOR color  ) 

Set control 'background' color.

Reimplemented in MGUI::CTRL_MAGNIFIER, and MGUI::CTRL_TREE.

void MGUI::CTRL::SetDimensions ( MGUI::POINT  dimensions  ) 

Set control dimensions if allowed.

Parameters:
dimensions New dimensions requested
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::SetForegroundColor ( const COLOR color  ) 

Set control 'foreground' color.

void MGUI::CTRL::SetMinimumSize ( int  width,
int  height 
)

Set minimum size for control.

Parameters:
width Minimum width in pixels, -1 to leave unchanged
height Minimum height in pixels, -1 to leave unchanged
static void MGUI::CTRL::SetShadowArgs ( XTARGS args,
SHADOW  shadow 
) [static, protected]
void MGUI::CTRL::SetSizeByKey ( const char *  SizeKey  ) 

Set control size using key.

This will automatically load the size and subsequently record any changes later made to the size by the user.

void MGUI::CTRL::SetToolTipString ( const MISTRING string  ) 

Set ToolTip string.

Recommended for simple ToolTip support only. For complex or dynamic ToolTips use the CTRL_TOOLTIP class directly.

Parameters:
string String to use for ToolTip
virtual void MGUI::CTRL::SetVisible ( bool  visible = true  )  [virtual]

Set whether control is visible or not.

Implements MGUI::FORM.

static void MGUI::CTRL::SetWidgetShadow ( Widget  widget,
SHADOW  shadow 
) [static]

Set shadow for widget.

void MGUI::CTRL::UpdateWindow (  ) 

Force window to be updated immediately if necessary.

virtual void MGUI::CTRL::v_OnDestroyWidget (  )  [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.


Member Data Documentation


The documentation for this class was generated from the following file:

Generated on Sun Oct 7 21:35:29 2012 for TNTsdk 2012 by  doxygen 1.6.1