Contents Up Previous Next

wxShapeEvtHandler

wxShapeEvtHandler is a class from which wxShape (and therefore all shape classes) are derived. A wxShape also contains a pointer to its current wxShapeEvtHandler. Event handlers can be swapped in and out, altering the behaviour of a shape. This allows, for example, a range of behaviours to be redefined in one class, rather than requiring each shape class to be subclassed.

Derived from

wxObject

Members

wxShapeEvtHandler::m_handlerShape
wxShapeEvtHandler::m_previousHandler
wxShapeEvtHandler::wxShapeEvtHandler
wxShapeEvtHandler::~wxShapeEvtHandler
wxShapeEvtHandler::CopyData
wxShapeEvtHandler::CreateNewCopy
wxShapeEvtHandler::GetPreviousHandler
wxShapeEvtHandler::GetShape
wxShapeEvtHandler::OnBeginDragLeft
wxShapeEvtHandler::OnBeginDragRight
wxShapeEvtHandler::OnBeginSize
wxShapeEvtHandler::OnChangeAttachment
wxShapeEvtHandler::OnDragLeft
wxShapeEvtHandler::OnDragRight
wxShapeEvtHandler::OnDraw
wxShapeEvtHandler::OnDrawContents
wxShapeEvtHandler::OnDrawControlPoints
wxShapeEvtHandler::OnDrawOutline
wxShapeEvtHandler::OnEndDragLeft
wxShapeEvtHandler::OnEndDragRight
wxShapeEvtHandler::OnEndSize
wxShapeEvtHandler::OnErase
wxShapeEvtHandler::OnEraseContents
wxShapeEvtHandler::OnEraseControlPoints
wxShapeEvtHandler::OnHighlight
wxShapeEvtHandler::OnLeftClick
wxShapeEvtHandler::OnMoveLink
wxShapeEvtHandler::OnMoveLinks
wxShapeEvtHandler::OnMovePost
wxShapeEvtHandler::OnMovePre
wxShapeEvtHandler::OnRightClick
wxShapeEvtHandler::OnSize
wxShapeEvtHandler::OnSizingBeginDragLeft
wxShapeEvtHandler::OnSizingDragLeft
wxShapeEvtHandler::OnSizingEndDragLeft
wxShapeEvtHandler::SetPreviousHandler
wxShapeEvtHandler::SetShape


wxShapeEvtHandler::m_handlerShape

wxShape* m_handlerShape

Pointer to the shape associated with this handler.


wxShapeEvtHandler::m_previousHandler

wxShapeEvtHandler* m_previousHandler

Pointer to the previous handler.


wxShapeEvtHandler::wxShapeEvtHandler

void wxShapeEvtHandler(wxShapeEvtHandler *previous = NULL, wxShape *shape = NULL)

Constructs a new event handler.


wxShapeEvtHandler::~wxShapeEvtHandler

void ~wxShapeEvtHandler()

Destructor.


wxShapeEvtHandler::CopyData

void CopyData(wxShapeEvtHandler& handler)

A virtual function to copy the data from this object to handler. Override if you derive from wxShapeEvtHandler and have data to copy.


wxShapeEvtHandler::CreateNewCopy

wxShapeEvtHandler* CreateNewCopy()

Creates a new event handler object of the same class as this object, and then calls wxShapeEvtHandler::CopyData.


wxShapeEvtHandler::GetPreviousHandler

wxShapeEvtHandler* GetPreviousHandler() const

Returns the previous handler.


wxShapeEvtHandler::GetShape

wxShape* GetShape() const

Returns the shape associated with this handler.


wxShapeEvtHandler::OnBeginDragLeft

void OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0)

Called when the user is beginning to drag using the left mouse button.


wxShapeEvtHandler::OnBeginDragRight

void OnBeginDragRight(double x, double y, int keys=0, int attachment = 0)

Called when the user is beginning to drag using the right mouse button.


wxShapeEvtHandler::OnBeginSize

void OnBeginSize(double width, double height)

Called when a shape starts to be resized.


wxShapeEvtHandler::OnChangeAttachment

void OnChangeAttachment(int attachment, wxLineShape* line, wxList& ordering)

Override this to prevent or intercept line reordering. wxShape's implementation of this function calls wxShape::ApplyAttachmentOrdering to apply the new ordering.


wxShapeEvtHandler::OnDragLeft

void OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0)

Called twice when the shape is being dragged, once to allow erasing the old image, and again to allow drawing at the new position.


wxShapeEvtHandler::OnDragRight

void OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0)

Called twice when the shape is being dragged, once to allow erasing the old image, and again to allow drawing at the new position.


wxShapeEvtHandler::OnDraw

void OnDraw(wxDC& dc)

Defined for each class to draw the main graphic, but not the contents.


wxShapeEvtHandler::OnDrawContents

void OnDrawContents(wxDC& dc)

Defined for each class to draw the contents of the shape, such as text.


wxShapeEvtHandler::OnDrawControlPoints

void OnDrawControlPoints(wxDC& dc)

Called when the shape's control points (handles) should be drawn.


wxShapeEvtHandler::OnDrawOutline

void OnDrawOutline(wxDC& dc)

Called when the outline of the shape should be drawn.


wxShapeEvtHandler::OnEndDragLeft

void OnEndDragLeft(double x, double y, int keys=0, int attachment = 0)

Called when the user is stopping dragging using the left mouse button.


wxShapeEvtHandler::OnEndDragRight

void OnEndDragRight(double x, double y, int keys=0, int attachment = 0)

Called when the user is stopping dragging using the right mouse button.


wxShapeEvtHandler::OnEndSize

void OnEndSize(double width, double height)

Called after a shape is resized.


wxShapeEvtHandler::OnErase

void OnErase(wxDC& dc)

Called when the whole shape should be erased.


wxShapeEvtHandler::OnEraseContents

void OnEraseContents(wxDC& dc)

Called when the contents should be erased.


wxShapeEvtHandler::OnEraseControlPoints

void OnEraseControlPoints(wxDC& dc)

Called when the shape's control points (handles) should be erased.


wxShapeEvtHandler::OnHighlight

void OnHighlight(wxDC& dc)

Called when the shape should be highlighted.


wxShapeEvtHandler::OnLeftClick

void OnLeftClick(double x, double y, int keys =0, int attachment = 0)

Called when the shape receives a left mouse click event.


wxShapeEvtHandler::OnMoveLink

void OnMoveLink(wxDC& dc, bool moveControlPoints=TRUE)

Called when the line attached to an shape need to be repositioned, because the shape has moved.


wxShapeEvtHandler::OnMoveLinks

void OnMoveLinks(wxDC& dc)

Called when the lines attached to an shape need to be repositioned, because the shape has moved.


wxShapeEvtHandler::OnMovePost

bool OnMovePost(wxDC& dc, double x, double y, double oldX, double oldY, bool display = TRUE)

Called just after the shape receives a move request.


wxShapeEvtHandler::OnMovePre

bool OnMovePre(wxDC& dc, double x, double y, double oldX, double oldY, bool display = TRUE)

Called just before the shape receives a move request. Returning TRUE allows the move to be processed; returning FALSE vetoes the move.


wxShapeEvtHandler::OnRightClick

void OnRightClick(double x, double y, int keys = 0, int attachment = 0)

Called when the shape receives a mouse mouse click event.


wxShapeEvtHandler::OnSize

void OnSize(double x, double y)

Called when the shape receives a resize request.


wxShapeEvtHandler::OnSizingBeginDragLeft

void OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0)

Called when a sizing drag is beginning.


wxShapeEvtHandler::OnSizingDragLeft

void OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0)

Called when a sizing drag is occurring.


wxShapeEvtHandler::OnSizingEndDragLeft

void OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0)

Called when a sizing drag is ending.


wxShapeEvtHandler::SetPreviousHandler

void SetPreviousHandler(wxShapeEvtHandler* handler)

Sets the previous handler.


wxShapeEvtHandler::SetShape

void SetShape(wxShape* shape)

Sets the shape for this handler.