Base class for canvas gadgets. More...
#include <mgui/gadget.h>

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::POINT & | GetPosition () const |
| INT16 | GetPriority () const |
| const MGUI::POINT & | GetSize () 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) |
| TOOLCANVAS * | GetCanvas () 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) |
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
| enum MGUI::GADGET::FLAGS |
Gadget placement.
| 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.
| 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.
| 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.
| 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.
| virtual int MGUI::GADGET::v_DlgEditSettings | ( | MDLGPARENT | dlgparent | ) | [private, virtual] |
Called via DlgEditSettings.
| 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.
| virtual bool MGUI::GADGET::v_OnPointerButtonDown | ( | MGUI::POINT | ptCanvas, | |
| POINTERBUTTON | button, | |||
| KEYSTATE | keystate | |||
| ) | [private, virtual] |
Called when pointer button pressed within gadget area.
| virtual bool MGUI::GADGET::v_OnPointerButtonUp | ( | MGUI::POINT | ptCanvas, | |
| POINTERBUTTON | button, | |||
| KEYSTATE | keystate | |||
| ) | [private, virtual] |
Called when pointer button released.
| 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.
1.6.1