MGUI::CANVAS Class Reference

Generic 'canvas' control supporting drawing and simple user input. More...

#include <mgui/canvas.h>

Inheritance diagram for MGUI::CANVAS:

Inheritance graph
[legend]
List of all members.

Public Types

enum  DCTYPE { DCTYPE_Buffer, DCTYPE_Screen }
enum  STYLE { STYLE_Default = 0x00, STYLE_EnableOverlay = 0x01, STYLE_NoBuffer = 0x02 }

Public Member Functions

 CANVAS (STYLE style=STYLE_Default)
void Create (LAYOUT_PANE_BASE &ParentPane, int width, int height, LAYOUT_SIZEALIGN sizealign, CANVAS::STYLE style=STYLE_Default)
MDLGPARENT GetDlgParent () const
MGD::CONTEXTGetDrawingContext (DCTYPE dctype=DCTYPE_Buffer)
void GetSize (INT16 &width, INT16 &height)
void Invalidate (const LRECT2D &rect, bool UpdateNow=false)
void Invalidate (bool UpdateNow=false)
bool IsMouseCaptured () const
void RedrawDelayed (int delay=1000)
void SetCursor (CURSORID cursorid)
virtual ~CANVAS ()

Private Member Functions

virtual void v_OnCaptureChanged ()
virtual bool v_OnKey (MGUI::POINT point, MGUI::KEYCODE keycode, MGUI::KEYSTATE keystate)
virtual void v_OnLeftDown (MGUI::POINT point, KEYSTATE keystate)
virtual void v_OnLeftUp (MGUI::POINT point, KEYSTATE keystate)
virtual void v_OnMouseMove (MGUI::POINT point, KEYSTATE keystate)
virtual void v_OnPaint (MGD::CONTEXT *gc)
virtual void v_OnRightDown (MGUI::POINT point, KEYSTATE keystate)
virtual void v_OnRightUp (MGUI::POINT point, KEYSTATE keystate)
virtual void v_OnSize (int width, int height)

Detailed Description

Generic 'canvas' control supporting drawing and simple user input.

To avoid unnecessary overhead there is at present no 'template' (_CT) version of this class due to the large number of virtual methods.

Definition at line 82 of file canvas.h.


Member Enumeration Documentation

enum MGUI::CANVAS::DCTYPE
 

Enumeration values:
DCTYPE_Buffer 
DCTYPE_Screen 

Definition at line 85 of file canvas.h.

enum MGUI::CANVAS::STYLE
 

Enumeration values:
STYLE_Default 
STYLE_EnableOverlay 
STYLE_NoBuffer 

Definition at line 90 of file canvas.h.


Constructor & Destructor Documentation

MGUI::CANVAS::CANVAS STYLE  style = STYLE_Default  ) 
 

Constructor.

virtual MGUI::CANVAS::~CANVAS  )  [virtual]
 

Destructor.


Member Function Documentation

void MGUI::CANVAS::Create LAYOUT_PANE_BASE ParentPane,
int  width,
int  height,
LAYOUT_SIZEALIGN  sizealign,
CANVAS::STYLE  style = STYLE_Default
 

Create canvas control.

Parameters:
ParentPane  Parent pane
width  Desired width in pixels
height  Desired height in pixels
sizealign  Sizing and alignment options

MDLGPARENT MGUI::CANVAS::GetDlgParent  )  const
 

Get suitable parent for dialog launched from canvas.

MGD::CONTEXT* MGUI::CANVAS::GetDrawingContext DCTYPE  dctype = DCTYPE_Buffer  ) 
 

Get drawing context for buffer or direct display.

Do not delete the returned CONTEXT as it is internal to the CANVAS.

Parameters:
dctype  Drawing context type

void MGUI::CANVAS::GetSize INT16 width,
INT16 height
 

Get dimensions of canvas.

Parameters:
width  Width in pixels returned
height  Height in pixels returned

void MGUI::CANVAS::Invalidate const LRECT2D rect,
bool  UpdateNow = false
 

Invalidate specified portion of canvas.

This will restore from off-screen buffer (if available) and/or generate OnPaint notification depending on canvas style.

Parameters:
UpdateNow  Perform immediate update before returning

void MGUI::CANVAS::Invalidate bool  UpdateNow = false  ) 
 

Invalidate entire canvas.

This will restore from off-screen buffer (if available) and/or generate OnPaint notification depending on canvas style.

Parameters:
UpdateNow  Perform immediate update before returning

Reimplemented from MGUI::CTRL.

bool MGUI::CANVAS::IsMouseCaptured  )  const
 

Determine if mouse is "captured" by this canvas.

void MGUI::CANVAS::RedrawDelayed int  delay = 1000  ) 
 

Schedule redraw of canvas after specified delay.

Parameters:
delay  Delay in milliseconds

void MGUI::CANVAS::SetCursor CURSORID  cursorid  ) 
 

Set mouse cursor to show while in canvas.

virtual void MGUI::CANVAS::v_OnCaptureChanged  )  [private, virtual]
 

Called when cursor "capture" is changed (lost).

virtual bool MGUI::CANVAS::v_OnKey MGUI::POINT  point,
MGUI::KEYCODE  keycode,
MGUI::KEYSTATE  keystate
[private, virtual]
 

Called when key "pressed".

Returns:
'true' if key handled, 'false' if not.
Parameters:
point  Point in canvas coordinates where button event occurred
keycode  Processed key code, equivalent to MIUNICODE for alphanumeric keys.
keystate  Modifier key state

virtual void MGUI::CANVAS::v_OnLeftDown MGUI::POINT  point,
KEYSTATE  keystate
[private, virtual]
 

Called when left mouse button pressed.

Parameters:
point  Point in canvas coordinates where button event occurred
keystate  Modifier key state at time of event

virtual void MGUI::CANVAS::v_OnLeftUp MGUI::POINT  point,
KEYSTATE  keystate
[private, virtual]
 

Called when left mouse button released.

Parameters:
point  Point in canvas coordinates where button event occurred
keystate  Modifier key state at time of event

virtual void MGUI::CANVAS::v_OnMouseMove MGUI::POINT  point,
KEYSTATE  keystate
[private, virtual]
 

Called when mouse cursor is moved.

Parameters:
point  Point in canvas coordinates where button event occurred
keystate  Modifier key state at time of event

virtual void MGUI::CANVAS::v_OnPaint MGD::CONTEXT gc  )  [private, virtual]
 

Called when canvas needs to be redrawn, do not call directly.

This is called after the buffer is updated to the screen. If no overlay and not unbuffered then this method does not need to be overridden.

Parameters:
gc  Drawing context for unbuffered/overlay.

virtual void MGUI::CANVAS::v_OnRightDown MGUI::POINT  point,
KEYSTATE  keystate
[private, virtual]
 

Called when right mouse button pressed.

Parameters:
point  Point in canvas coordinates where button event occurred
keystate  Modifier key state at time of event

virtual void MGUI::CANVAS::v_OnRightUp MGUI::POINT  point,
KEYSTATE  keystate
[private, virtual]
 

Called when right mouse button released.

Parameters:
point  Point in canvas coordinates where button event occurred
keystate  Modifier key state at time of event

virtual void MGUI::CANVAS::v_OnSize int  width,
int  height
[private, virtual]
 

Called when canvas size changes.

Note, this is NOT called repeatedly while the user resizes the window, but instead will be called after the user releases the mouse or pauses for a nominal period of time (.5 second).

Parameters:
width  New canvas width in pixels
height  New canvas height in pixels


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