#include <canwidget.h>


Public Types | |
| enum | WidgetMode { Boundingbox, BoundingboxSize, ScaledContent, ScaledContentKeepAspect } |
Public Member Functions | |
| a2dWidgetButton (a2dCanvasObject *parent, int buttonId, double x, double y, double w, double h, WidgetMode mode=Boundingbox) | |
| Standard constructor. | |
| a2dWidgetButton (const a2dWidgetButton &other, CloneOptions options) | |
| ~a2dWidgetButton () | |
| destructor | |
| virtual a2dObject * | Clone (CloneOptions options) const |
| Clone this object and return a pointer to the new object. | |
| virtual void | SetParent (a2dCanvasObject *parent) |
| set parent object of the pin or some other objects that needs a parent | |
| virtual a2dEvtHandler * | GetParentEvtHandler () |
| get parent object if available | |
| void | SetContentObject (a2dCanvasObject *content) |
| Set the content object. | |
| a2dCanvasObject * | GetContentObject () |
| Get the content object,. | |
| void | SetContentBorder (double contentBorder) |
| Set the border width around the content. | |
| double | GetContentBorder () |
| Get the border width around the content. | |
| void | SetSelectedStroke (const a2dStroke &selectedStroke) |
| Set the selected stroke style for the button. | |
| void | SetSelectedFill (const a2dFill &selectedFill) |
| Set the selected fill style for the button. | |
| void | SetHighLightStroke (const a2dStroke &highLightStroke) |
| Set the selected stroke style for the button. | |
| void | SetHighLightFill (const a2dFill &highLightFill) |
| Set the selected fill style for the button. | |
| int | GetButtonId () |
| id used for button event. | |
Protected Member Functions | |
| void | DoWalker (wxObject *parent, a2dWalkerIOHandler &handler) |
| iterate over this object and its children | |
| virtual void | DrawHighLighted (a2dIterC &ic) |
| called by Render() if m_flags.m_HighLight is set | |
| virtual void | Render (a2dIterC &ic, OVERLAP clipparent) |
| Render this object to the active a2dCanvasView. | |
| virtual bool | DoUpdate (UpdateMode mode, const a2dBoundingBox &childbox, const a2dBoundingBox &clipbox, const a2dBoundingBox &propbox) |
| Update derived Object specific things ( mainly boundingbox). | |
| virtual a2dBoundingBox | DoGetUnTransformedBbox (a2dBboxFlags flags=a2dCANOBJ_BBOX_NON) const |
| virtual void | DoRender (a2dIterC &ic, OVERLAP clipparent) |
| render derived object | |
| bool | DoIsHitWorld (a2dIterC &ic, a2dHitEvent &hitEvent) |
| Does hit test on the object (exclusif child objects). | |
| void | OnEnterObject (a2dCanvasObjectMouseEvent &event) |
| handler for A2D_EVT_CANVASOBJECT_ENTER_EVENT | |
| void | OnLeaveObject (a2dCanvasObjectMouseEvent &event) |
| handler for A2D_EVT_CANVASOBJECT_LEAVE_EVENT | |
| void | OnCanvasObjectMouseEvent (a2dCanvasObjectMouseEvent &event) |
| handler for A2D_EVT_CANVASOBJECT_MOUSE_EVENT | |
Protected Attributes | |
| a2dStroke | m_selectedStroke |
| a2dFill | m_selectedFill |
| a2dStroke | m_highLightStroke |
| a2dFill | m_highLightFill |
| int | m_buttonId |
| event id used when sending events | |
| WidgetMode | m_mode |
| type of button rendering of the m_content object. | |
| double | m_contentBorder |
| here a border between the button and the content can be given | |
| a2dCanvasObjectPtr | m_content |
| the button its graphics, which will be scaled in WidgetMode::ScaleChildren | |
| a2dCanvasObject * | m_parent |
| events are sent from the button to this object, if not handled by the button itself. | |
| a2dAffineMatrix | m_contentWorld |
| for scaling/translating the m_content | |
a2dWidgetButton implements a a2dCanvasObject based button. This is usefull for selecting objects from a a2dCanvas that is used as a palette of objects, styles or tools. If the object is selected, it is drawn with the styles set by SetSelectedStroke and SetSelectedFill. Otherwise it is drawn by the usual style for this object. The default selected style is a one pixel black line and white fill. The default non-selected style is transparent stroke and fill.
a2dWidgetButton does not need a tool. It processes Mouse events.
Definition at line 41 of file canwidget.h.
Definition at line 46 of file canwidget.h.
| virtual a2dEvtHandler* a2dWidgetButton::GetParentEvtHandler | ( | ) | [inline, virtual] |
get parent object if available
A wxCommandEvent is sent to a parent when available.
Reimplemented from a2dEvtHandler.
Definition at line 67 of file canwidget.h.
| void a2dWidgetButton::SetContentObject | ( | a2dCanvasObject * | content | ) | [inline] |
Set the content object.
child objects can be added to a button, but they will always be drawn unscaled, independent of WidgetMode. Therefore one can not fit the children inside of the boundingbox of the button. It is important to be able to split normalized content from child objects, for example when object tips that are added to the button. Such an object tip should never be scaled, when the button itself is resized. So the prefered manner of setting the drawing for a button is using SetContentObject(). Children should be used for decorating the button itself, not for fitting/scaling the inside drawing of tyhe button.
Definition at line 79 of file canwidget.h.
| a2dCanvasObject* a2dWidgetButton::GetContentObject | ( | ) | [inline] |
| void a2dWidgetButton::DoWalker | ( | wxObject * | parent, | |
| a2dWalkerIOHandler & | handler | |||
| ) | [protected, virtual] |
iterate over this object and its children
This function allows you to extend the functionality of all a2dCanvasObject classes in a a2dCanvasDocument, without adding extra members to these objects.
Default functions are called on the a2dWalkerIOHandler, which redirect the calls to other functions based on this object its classname. On can register classes to a2dWalkerIOHandler or derived classes. This way for each unique object in the document there can be a function in a2dWalkerIOHandler.
Reimplemented from a2dCanvasObject.
Definition at line 84 of file canwidget.cpp.
| void a2dWidgetButton::DrawHighLighted | ( | a2dIterC & | ic | ) | [protected, virtual] |
called by Render() if m_flags.m_HighLight is set
| ic | iteration context (has a2dCanvasView accumulative matrix to calculate absolute position of the object) |
Reimplemented from a2dCanvasObject.
Definition at line 95 of file canwidget.cpp.
Render this object to the active a2dCanvasView.
This function is called via the a2dCanvasDocument class or its nested children. The active a2dCanvasView which is set for the document is used to draw to (either on its buffer or directly on the device) All rendering goes through this function to be able to render specific things in the base class first (like a2dCanvasObject its properties.) Somewhere internal DoRender will be called to really render the derived object itself. Next to that nested a2dCanvasObject's will be rendered too.
If wanted only the canvas objects with a certain mask set, will be rendered. Mask example: Checking visible and selected
use: mask=(a2dCANOBJ_VISIBLE | a2dCANOBJ_SELECTED)
Normally an object will be rendered if the given layer is equal to the object its layer.
wxLAYER_ALL has a special meaning. If the given input layer is wxLAYER_ALL, then the m_layer of objects is not tested. So the child objects their own layer settings are ignored/not checked in that case. All child objects are drawn at once, still the style of the layers settings is used when needed.
| ic | iteration context (has a2dCanvasView accumulative matrix to calculate absolute position of the object) | |
| clipparent | this must be the clip status of parent object, it is used to optimize drawing speed. e.g If parent is completely within the current clipping rectangle of the a2dCanvasView, there is no need to check child objects. |
Reimplemented from a2dCanvasObject.
Definition at line 131 of file canwidget.cpp.
| bool a2dWidgetButton::DoUpdate | ( | UpdateMode | mode, | |
| const a2dBoundingBox & | childbox, | |||
| const a2dBoundingBox & | clipbox, | |||
| const a2dBoundingBox & | propbox | |||
| ) | [protected, virtual] |
Update derived Object specific things ( mainly boundingbox).
Calculates the boundingbox of the object (exclusif base class child objects but with other nested objects).
| mode | way to update the objects | |
| childbox | size of children boundingbox | |
| clipbox | clip to this | |
| propbox | size of properties boundingbox |
force may or may not have direct influence on the object itself, if this function is called directly for some reason (e.g from derived objects), you must invalidate the boudingbox yourself. GetDrawerBox()->SetValid( false );
Reimplemented from a2dWindowMM.
Definition at line 138 of file canwidget.cpp.
render derived object
if the object has sub objects (apart from the childobject which are handled here), those subobject most rendered by iterating on layer when needed/wanted, simular to child objects. We do not iterate here, since that is only needed if indeed there or subobjects. This will be know in a "wxDerivedCanvasObject DoRender".
SO parent objects that call this function, must:
Reimplemented from a2dWindowMM.
Definition at line 246 of file canwidget.cpp.
| bool a2dWidgetButton::DoIsHitWorld | ( | a2dIterC & | ic, | |
| a2dHitEvent & | hitEvent | |||
| ) | [protected, virtual] |
Does hit test on the object (exclusif child objects).
DoIsHitWorld() should return the way the object is hit by filling a2dHitEvent::m_how with the correct info.
| ic | iterative context ( e.g. current transform WITH the local transform applied ) | |
| hitEvent | stores hit information |
Reimplemented from a2dRectMM.
Definition at line 313 of file canwidget.cpp.
a2dStroke a2dWidgetButton::m_selectedStroke [protected] |
a2dFill a2dWidgetButton::m_selectedFill [protected] |
a2dStroke a2dWidgetButton::m_highLightStroke [protected] |
a2dFill a2dWidgetButton::m_highLightFill [protected] |