wxShapeFramework
1.13.0 beta
|
Class encapsulates a special shape able to manage assigned GUI controls (widgets). The GUI control's position and size can by modified via parent control shape. User can also specify how events incoming from the managed GUI control are processed. More...
#include <ControlShape.h>
Public Types | |
enum | EVTPROCESSING { evtNONE = 0, evtKEY2GUI = 1, evtKEY2CANVAS = 2, evtMOUSE2GUI = 4, evtMOUSE2CANVAS = 8 } |
Way of processing of GUI control's events. More... | |
Public Member Functions | |
wxSFControlShape () | |
Default constructor. | |
wxSFControlShape (wxWindow *ctrl, const wxRealPoint &pos, const wxRealPoint &size, wxSFDiagramManager *manager) | |
User constructor. | |
wxSFControlShape (const wxSFControlShape &obj) | |
Copy constructor. | |
virtual | ~wxSFControlShape () |
Default destructor. | |
void | SetControl (wxWindow *ctrl, bool fit=sfFIT_SHAPE_TO_CONTROL) |
Set managed GUI control. | |
wxWindow * | GetControl () |
Get pointer to managed GUI control. | |
void | SetEventProcessing (int mask) |
Set a way how GUI control's events are processed. | |
int | GetEventProcessing () |
Get a way how GUI control's events are processed. | |
void | SetModFill (const wxBrush &brush) |
Set control shape's background style used during its modification. | |
wxBrush | GetModFill () |
Get control shape's background style used during its modification. | |
void | SetModBorder (const wxPen &pen) |
Set control shape's border styl used during its modification. | |
wxPen | GetModBorder () |
Get control shape's border styl used during its modification. | |
void | SetControlOffset (int offset) |
Set control shape's offset (a gap between the shape's border and managed GUI control). | |
int | GetControlOffset () |
Get control shape's offset (a gap between the shape's border and managed GUI control). | |
void | UpdateControl () |
Update size and position of the managed control according to the parent shape. | |
void | UpdateShape () |
Update size of the shape position according to the managed control. | |
virtual void | Scale (double x, double y, bool children=sfWITHCHILDREN) |
Scale the shape size by in both directions. The function can be overrided if necessary (new implementation should call default one ore scale shape's children manualy if neccesary). | |
virtual void | MoveTo (double x, double y) |
Move the shape to the given absolute position. The function can be overrided if necessary. | |
virtual void | MoveBy (double x, double y) |
Move the shape by the given offset. The function can be overrided if neccessary. | |
virtual void | Update () |
Upate shape (align all child shapes an resize it to fit them) | |
virtual void | FitToChildren () |
Resize the shape to bound all child shapes. The function can be overrided if neccessary. | |
virtual void | OnBeginDrag (const wxPoint &pos) |
Event handler called at the begining of the shape dragging process. The function can be overrided if necessary. | |
virtual void | OnEndDrag (const wxPoint &pos) |
Event handler called at the end of the shape dragging process. The function can be overrided if necessary. | |
virtual void | OnBeginHandle (wxSFShapeHandle &handle) |
Event handler called when the user started to drag the shape handle. The function can be overrided if necessary. | |
virtual void | OnHandle (wxSFShapeHandle &handle) |
Event handler called during dragging of the shape handle. The function can be overrided if necessary. | |
virtual void | OnEndHandle (wxSFShapeHandle &handle) |
Event handler called when the user finished dragging of the shape handle. The function can be overrided if necessary. | |
Protected Attributes | |
wxWindow * | m_pControl |
Pointer to manager data control. | |
int | m_nProcessEvents |
Events processing mask. | |
wxBrush | m_ModFill |
Brush used during the shape's modification. | |
wxPen | m_ModBorder |
Pen used during the shape's modification. | |
int | m_nControlOffset |
Offset between the shape and managed GUI control. | |
Private Member Functions | |
void | MarkSerializableDataMembers () |
Initialize serializable properties. | |
Private Attributes | |
wxWindow * | m_pPrevParent |
Pointer to parent window. | |
EventSink * | m_pEventSink |
Pointer to event sink. | |
long | m_nPrevStyle |
Previous canvas style. | |
wxBrush | m_PrevFill |
Previously used shape's brush. | |
wxPen | m_PrevBorder |
Previously used shape's pen. | |
Friends | |
class | EventSink |
Class encapsulates a special shape able to manage assigned GUI controls (widgets). The GUI control's position and size can by modified via parent control shape. User can also specify how events incoming from the managed GUI control are processed.
Note that the managed controls use a shape canvas as their parent window so these shapes cannot be used without existing and properly initialized shape canvas. Moreover, managed GUI controls are not serialized in any way internaly so it is completely up to the user to provide this functionality if needed.
Way of processing of GUI control's events.
Default constructor.
wxSFControlShape::wxSFControlShape | ( | wxWindow * | ctrl, |
const wxRealPoint & | pos, | ||
const wxRealPoint & | size, | ||
wxSFDiagramManager * | manager | ||
) |
User constructor.
ctrl | Pointer to managed GUI control |
pos | Initial position |
size | Initial size |
manager | Pointer to parent diagram manager |
wxSFControlShape::wxSFControlShape | ( | const wxSFControlShape & | obj | ) |
Copy constructor.
obj | Object to copy from |
virtual wxSFControlShape::~wxSFControlShape | ( | ) | [virtual] |
Default destructor.
virtual void wxSFControlShape::FitToChildren | ( | ) | [virtual] |
Resize the shape to bound all child shapes. The function can be overrided if neccessary.
Reimplemented from wxSFRectShape.
wxWindow* wxSFControlShape::GetControl | ( | ) | [inline] |
Get pointer to managed GUI control.
int wxSFControlShape::GetControlOffset | ( | ) | [inline] |
Get control shape's offset (a gap between the shape's border and managed GUI control).
int wxSFControlShape::GetEventProcessing | ( | ) | [inline] |
Get a way how GUI control's events are processed.
wxPen wxSFControlShape::GetModBorder | ( | ) | [inline] |
Get control shape's border styl used during its modification.
wxBrush wxSFControlShape::GetModFill | ( | ) | [inline] |
Get control shape's background style used during its modification.
void wxSFControlShape::MarkSerializableDataMembers | ( | ) | [private] |
Initialize serializable properties.
Reimplemented from wxSFRectShape.
virtual void wxSFControlShape::MoveBy | ( | double | x, |
double | y | ||
) | [virtual] |
Move the shape by the given offset. The function can be overrided if neccessary.
x | X offset |
y | Y offset |
Reimplemented from wxSFShapeBase.
virtual void wxSFControlShape::MoveTo | ( | double | x, |
double | y | ||
) | [virtual] |
Move the shape to the given absolute position. The function can be overrided if necessary.
x | X coordinate |
y | Y coordinate |
Reimplemented from wxSFShapeBase.
virtual void wxSFControlShape::OnBeginDrag | ( | const wxPoint & | pos | ) | [virtual] |
Event handler called at the begining of the shape dragging process. The function can be overrided if necessary.
The function is called by the framework (by the shape canvas). Default implementation does nothing.
Reimplemented from wxSFShapeBase.
virtual void wxSFControlShape::OnBeginHandle | ( | wxSFShapeHandle & | handle | ) | [virtual] |
Event handler called when the user started to drag the shape handle. The function can be overrided if necessary.
The function is called by the framework (by the shape canvas). Default implementation does nothing.
handle | Reference to dragged handle |
Reimplemented from wxSFRectShape.
virtual void wxSFControlShape::OnEndDrag | ( | const wxPoint & | pos | ) | [virtual] |
Event handler called at the end of the shape dragging process. The function can be overrided if necessary.
The function is called by the framework (by the shape canvas). Default implementation does nothing.
pos | Current mouse position |
Reimplemented from wxSFShapeBase.
virtual void wxSFControlShape::OnEndHandle | ( | wxSFShapeHandle & | handle | ) | [virtual] |
Event handler called when the user finished dragging of the shape handle. The function can be overrided if necessary.
The function is called by the framework (by the shape canvas). Default implementation does nothing.
handle | Reference to dragged handle |
Reimplemented from wxSFShapeBase.
virtual void wxSFControlShape::OnHandle | ( | wxSFShapeHandle & | handle | ) | [virtual] |
Event handler called during dragging of the shape handle. The function can be overrided if necessary.
The function is called by the framework (by the shape canvas). Default implementation does nothing.
handle | Reference to dragged handle |
Reimplemented from wxSFRectShape.
virtual void wxSFControlShape::Scale | ( | double | x, |
double | y, | ||
bool | children = sfWITHCHILDREN |
||
) | [virtual] |
Scale the shape size by in both directions. The function can be overrided if necessary (new implementation should call default one ore scale shape's children manualy if neccesary).
x | Horizontal scale factor |
y | Vertical scale factor |
children | TRUE if the shape's children shoould be scaled as well, otherwise the shape will be updated after scaling via Update() function. |
Reimplemented from wxSFRectShape.
void wxSFControlShape::SetControl | ( | wxWindow * | ctrl, |
bool | fit = sfFIT_SHAPE_TO_CONTROL |
||
) |
Set managed GUI control.
ctrl | Pointer to existing manager GUI control |
fit | TRUE if the control shape should be resized in accordance to the given GUI control |
void wxSFControlShape::SetControlOffset | ( | int | offset | ) | [inline] |
Set control shape's offset (a gap between the shape's border and managed GUI control).
offset | Offset size |
void wxSFControlShape::SetEventProcessing | ( | int | mask | ) | [inline] |
Set a way how GUI control's events are processed.
mask | Event processing |
void wxSFControlShape::SetModBorder | ( | const wxPen & | pen | ) | [inline] |
Set control shape's border styl used during its modification.
pen | Reference to used pen |
void wxSFControlShape::SetModFill | ( | const wxBrush & | brush | ) | [inline] |
Set control shape's background style used during its modification.
brush | Reference to used brush |
virtual void wxSFControlShape::Update | ( | ) | [virtual] |
Upate shape (align all child shapes an resize it to fit them)
Reimplemented from wxSFShapeBase.
void wxSFControlShape::UpdateControl | ( | ) |
Update size and position of the managed control according to the parent shape.
void wxSFControlShape::UpdateShape | ( | ) |
Update size of the shape position according to the managed control.
friend class EventSink [friend] |
wxPen wxSFControlShape::m_ModBorder [protected] |
Pen used during the shape's modification.
wxBrush wxSFControlShape::m_ModFill [protected] |
Brush used during the shape's modification.
int wxSFControlShape::m_nControlOffset [protected] |
Offset between the shape and managed GUI control.
long wxSFControlShape::m_nPrevStyle [private] |
Previous canvas style.
int wxSFControlShape::m_nProcessEvents [protected] |
Events processing mask.
wxWindow* wxSFControlShape::m_pControl [protected] |
Pointer to manager data control.
EventSink* wxSFControlShape::m_pEventSink [private] |
Pointer to event sink.
wxWindow* wxSFControlShape::m_pPrevParent [private] |
Pointer to parent window.
wxPen wxSFControlShape::m_PrevBorder [private] |
Previously used shape's pen.
wxBrush wxSFControlShape::m_PrevFill [private] |
Previously used shape's brush.