MGUI::GADGET Class Reference

Base class for canvas gadgets. More...

#include <mgui/gadget.h>

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

List of all members.

Public Types

enum  CANVASDEVICES {
  CANVASDEVICE_Memory = 0x01, CANVASDEVICE_Pixmap = 0x02, CANVASDEVICE_ScreenIfActive = 0x04, CANVASDEVICE_ScreenAlways = 0x08,
  CANVASDEVICE_Stereo = 0x10
}
enum  FLAGS { FLAG_None = 0, FLAG_AllowUserHide = 0x01, FLAG_HasDlgSettings = 0x02 }
enum  PLACEMENT {
  PLACEMENT_Center = 0x001, PLACEMENT_CenterLeft = 0x002, PLACEMENT_CenterRight = 0x004, PLACEMENT_BottomCenter = 0x008,
  PLACEMENT_BottomLeft = 0x010, PLACEMENT_BottomRight = 0x020, PLACEMENT_TopCenter = 0x040, PLACEMENT_TopLeft = 0x080,
  PLACEMENT_TopRight = 0x100, PLACEMENT_AnyLeft = PLACEMENT_CenterLeft | PLACEMENT_BottomLeft | PLACEMENT_TopLeft, PLACEMENT_AnyRight = PLACEMENT_CenterRight | PLACEMENT_BottomRight | PLACEMENT_TopRight, PLACEMENT_AnyBottom = PLACEMENT_BottomCenter | PLACEMENT_BottomLeft | PLACEMENT_BottomRight,
  PLACEMENT_AnyTop = PLACEMENT_TopCenter | PLACEMENT_TopLeft | PLACEMENT_TopRight, PLACEMENT_AnyCorner = PLACEMENT_BottomLeft | PLACEMENT_BottomRight | PLACEMENT_TopLeft | PLACEMENT_TopRight, PLACEMENT_Any = 0x1FF
}

Public Member Functions

virtual ~GADGET ()=0
bool CanDrawOnDeviceType (CANVAS::DEVICETYPE DeviceType) const
bool DlgEditSettings (MDLGPARENT dlgparent)
void Draw (CANVAS::DEVICETYPE DeviceType)
PLACEMENT GetPlacement () const
const MGUI::POINTGetPosition () const
INT16 GetPriority () const
const MGUI::POINTGetSize () const
bool HasPosition () const
bool IsVisible () const
bool OnToolTipRequest (CTRL_TOOLTIP &tooltip, MGUI::POINT ptCanvas)
bool operator< (const GADGET &rhs) const
void SetDelegateOnChangePlacement (DELEGATE_VOID_NOPARMS delegate)
void SetDelegateOnChangeSettings (DELEGATE_VOID_NOPARMS delegate)
void SetDelegateOnChangeVisible (DELEGATE_VOID_NOPARMS delegate)
void SetPlacement (PLACEMENT Placement, bool notify=true)
void SetPlacementsAllowed (PLACEMENT PlacementsAllowed)
void SetPriority (INT16 priority)
void SetVisible (bool visible, bool notify=true)

Protected Member Functions

 GADGET (TOOLCANVAS *pCanvas, PLACEMENT PlacementsAllowed, FLAGS flags=FLAG_None, CANVASDEVICES CanvasDevices=CANVASDEVICE_Memory)
void Draw (MGD::CONTEXT *gc, CANVAS::DEVICETYPE DeviceType)
TOOLCANVASGetCanvas () const
bool IsPointerCaptured () const
void SetCursor (CURSORID cursorid) const
MGUI::POINT TransCanvasToGadget (MGUI::POINT ptCanvas) const
MGUI::POINT TransGadgetToCanvas (MGUI::POINT ptGadget) const

Private Member Functions

virtual MGUI::POINT v_ComputeSize ()=0
virtual int v_DlgEditSettings (MDLGPARENT dlgparent)
virtual void v_Draw (MGD::CONTEXT *gc, CANVAS::DEVICETYPE DeviceType)=0
virtual bool v_OnKey (MGUI::POINT ptCanvas, MGUI::KEYCODE keycode, KEYSTATE keystate)
virtual bool v_OnPointerButtonDown (MGUI::POINT ptCanvas, POINTERBUTTON button, KEYSTATE keystate)
virtual bool v_OnPointerButtonUp (MGUI::POINT ptCanvas, POINTERBUTTON button, KEYSTATE keystate)
virtual void v_OnPointerEnter ()
virtual void v_OnPointerLeave ()
virtual void v_OnPointerMove (MGUI::POINT ptCanvas, POINTERBUTTON button, KEYSTATE keystate)
virtual bool v_OnToolTipRequest (CTRL_TOOLTIP &tooltip, MGUI::POINT &ptCanvas)

Detailed Description

Base class for canvas gadgets.

A "gadget" is a simple graphic that is drawn on a canvas, into the canvas buffer or as an overlay or both. The placement


Member Enumeration Documentation

Enumerator:
CANVASDEVICE_Memory 

Draw in canvas "memory" buffer.

CANVASDEVICE_Pixmap 

Draw in canvas "pixmap" buffer.

CANVASDEVICE_ScreenIfActive 

Draw on canvas "screen" if gadget is active.

CANVASDEVICE_ScreenAlways 

Draw on canvas "screen" always.

CANVASDEVICE_Stereo 

Draw in canvas "stereo" buffer.

Flags used in construction.

Enumerator:
FLAG_None 
FLAG_AllowUserHide 

Allow user to hide gadget via default RMB popup menu.

FLAG_HasDlgSettings 

Has ability to create dialog for settings.

Gadget placement.

Enumerator:
PLACEMENT_Center 
PLACEMENT_CenterLeft 
PLACEMENT_CenterRight 
PLACEMENT_BottomCenter 
PLACEMENT_BottomLeft 
PLACEMENT_BottomRight 
PLACEMENT_TopCenter 
PLACEMENT_TopLeft 
PLACEMENT_TopRight 
PLACEMENT_AnyLeft 
PLACEMENT_AnyRight 
PLACEMENT_AnyBottom 
PLACEMENT_AnyTop 
PLACEMENT_AnyCorner 
PLACEMENT_Any 

Constructor & Destructor Documentation

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

Destructor.

MGUI::GADGET::GADGET ( TOOLCANVAS pCanvas,
PLACEMENT  PlacementsAllowed,
FLAGS  flags = FLAG_None,
CANVASDEVICES  CanvasDevices = CANVASDEVICE_Memory 
) [explicit, protected]

Constructor.


Member Function Documentation

bool MGUI::GADGET::CanDrawOnDeviceType ( CANVAS::DEVICETYPE  DeviceType  )  const

Determine if can draw gadget on specified canvas device type.

bool MGUI::GADGET::DlgEditSettings ( MDLGPARENT  dlgparent  ) 

Show dialog to edit gadget settings.

Returns:
true if settings changed, false if not.
void MGUI::GADGET::Draw ( MGD::CONTEXT gc,
CANVAS::DEVICETYPE  DeviceType 
) [protected]

Draw gadget graphics.

void MGUI::GADGET::Draw ( CANVAS::DEVICETYPE  DeviceType  ) 

Draw gadget on canvas.

TOOLCANVAS* MGUI::GADGET::GetCanvas (  )  const [inline, protected]

Get "canvas" associated with gadget.

PLACEMENT MGUI::GADGET::GetPlacement (  )  const [inline]

Get placement.

const MGUI::POINT& MGUI::GADGET::GetPosition (  )  const [inline]

Get position of gadget (top-left corner) in canvas coordinates.

INT16 MGUI::GADGET::GetPriority (  )  const [inline]

Get priority.

const MGUI::POINT& MGUI::GADGET::GetSize (  )  const [inline]

Get size of gadget in pixels.

bool MGUI::GADGET::HasPosition (  )  const [inline]

Determine if has position set.

bool MGUI::GADGET::IsPointerCaptured (  )  const [protected]

Determine if gadget has the pointer "captured".

bool MGUI::GADGET::IsVisible (  )  const [inline]

Determine if gadget is visible.

bool MGUI::GADGET::OnToolTipRequest ( CTRL_TOOLTIP tooltip,
MGUI::POINT  ptCanvas 
) [inline]
bool MGUI::GADGET::operator< ( const GADGET rhs  )  const [inline]

Comparison operator for sorting.

void MGUI::GADGET::SetCursor ( CURSORID  cursorid  )  const [inline, protected]

Set pointer cursor.

void MGUI::GADGET::SetDelegateOnChangePlacement ( DELEGATE_VOID_NOPARMS  delegate  )  [inline]

Set delegate to call when placement changes.

void MGUI::GADGET::SetDelegateOnChangeSettings ( DELEGATE_VOID_NOPARMS  delegate  )  [inline]

Set delegate to call when settings changed.

void MGUI::GADGET::SetDelegateOnChangeVisible ( DELEGATE_VOID_NOPARMS  delegate  )  [inline]

Set delegate to call when visibility changes.

void MGUI::GADGET::SetPlacement ( PLACEMENT  Placement,
bool  notify = true 
)

Set placement.

Parameters:
Placement Single placement value
void MGUI::GADGET::SetPlacementsAllowed ( PLACEMENT  PlacementsAllowed  )  [inline]

Set which placements are allowed.

void MGUI::GADGET::SetPriority ( INT16  priority  )  [inline]

Set priority for placement.

void MGUI::GADGET::SetVisible ( bool  visible,
bool  notify = true 
)

Set whether gadget is visible.

Does not update gadget placement or redraw canvas. Gadgets are initially visible by default. Gadgets that are not visible will be ignored in placement and will receive no messages.

MGUI::POINT MGUI::GADGET::TransCanvasToGadget ( MGUI::POINT  ptCanvas  )  const [inline, protected]

Translate canvas coordinates to gadget coordinates.

MGUI::POINT MGUI::GADGET::TransGadgetToCanvas ( MGUI::POINT  ptGadget  )  const [inline, protected]

Translate gadget coordinates to canvas coordinates.

virtual MGUI::POINT MGUI::GADGET::v_ComputeSize (  )  [private, pure virtual]

Compute gadget size.

Returns:
New gadget size.
virtual int MGUI::GADGET::v_DlgEditSettings ( MDLGPARENT  dlgparent  )  [private, virtual]

Called via DlgEditSettings.

Returns:
TRUE if settings changed, FALSE if not, < 0 if error.
virtual void MGUI::GADGET::v_Draw ( MGD::CONTEXT gc,
CANVAS::DEVICETYPE  DeviceType 
) [private, pure virtual]

Draw gadget graphic.

Will not be called if canvas devices specified in constructor don't allow drawing on device type.

virtual bool MGUI::GADGET::v_OnKey ( MGUI::POINT  ptCanvas,
MGUI::KEYCODE  keycode,
KEYSTATE  keystate 
) [private, virtual]

Called when key pressed/released within gadget area.

Returns:
'true' if key handled, 'false' if not. Default implementation does nothing.
virtual bool MGUI::GADGET::v_OnPointerButtonDown ( MGUI::POINT  ptCanvas,
POINTERBUTTON  button,
KEYSTATE  keystate 
) [private, virtual]

Called when pointer button pressed within gadget area.

Returns:
true if button handled, false if not. Default implementation simply returns false. If override then should also override v_OnPointerButtonUp and that should handle same button to avoid unwanted propagation.
virtual bool MGUI::GADGET::v_OnPointerButtonUp ( MGUI::POINT  ptCanvas,
POINTERBUTTON  button,
KEYSTATE  keystate 
) [private, virtual]

Called when pointer button released.

Returns:
true if button handled, false if not. Default implementation simply returns false.
virtual void MGUI::GADGET::v_OnPointerEnter (  )  [private, virtual]

Called when pointer enters gadget location on canvas.

Default implementation does nothing.

virtual void MGUI::GADGET::v_OnPointerLeave (  )  [private, virtual]

Called when pointer leaves gadget location on canvas.

Default implementation does nothing.

virtual void MGUI::GADGET::v_OnPointerMove ( MGUI::POINT  ptCanvas,
POINTERBUTTON  button,
KEYSTATE  keystate 
) [private, virtual]

Called when pointer is moved in gadget area or when captured.

Default implementation does nothing.

virtual bool MGUI::GADGET::v_OnToolTipRequest ( CTRL_TOOLTIP tooltip,
MGUI::POINT ptCanvas 
) [private, virtual]

Called when requesting tooltip.

Default implementation sets text to press right button for settings and returns true if has capability.


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

Generated on Sun Oct 7 21:36:08 2012 for TNTsdk 2012 by  doxygen 1.6.1