## wxShapeCanvas

A canvas for drawing diagrams on.

Derived from

wxScrolledWindow

See also

wxDiagram

Members

wxShapeCanvas::wxShapeCanvas
wxShapeCanvas::~wxShapeCanvas
wxShapeCanvas::AddShape
wxShapeCanvas::FindShape
wxShapeCanvas::FindFirstSensitiveShape
wxShapeCanvas::GetDiagram
wxShapeCanvas::GetGridSpacing
wxShapeCanvas::GetMouseTolerance
wxShapeCanvas::GetShapeList
wxShapeCanvas::GetQuickEditMode
wxShapeCanvas::InsertShape
wxShapeCanvas::OnBeginDragLeft
wxShapeCanvas::OnBeginDragRight
wxShapeCanvas::OnEndDragLeft
wxShapeCanvas::OnEndDragRight
wxShapeCanvas::OnDragLeft
wxShapeCanvas::OnDragRight
wxShapeCanvas::OnLeftClick
wxShapeCanvas::OnRightClick
wxShapeCanvas::Redraw
wxShapeCanvas::RemoveShape
wxShapeCanvas::SetDiagram
wxShapeCanvas::Snap

### wxShapeCanvas::wxShapeCanvas

wxShapeCanvas(wxWindow* parent = NULL, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxBORDER)

Constructor.

### wxShapeCanvas::~wxShapeCanvas

~wxShapeCanvas()

Destructor.

### wxShapeCanvas::AddShape

void AddShape(wxShape *shape, wxShape *addAfter = NULL)

Adds a shape to the diagram. If addAfter is non-NULL, the shape will be added after this one.

### wxShapeCanvas::FindShape

wxShape * FindShape(double x1, double y, int *attachment, wxClassInfo *info = NULL, wxShape *notImage = NULL)

Find a shape under this mouse click. Returns the shape (or NULL), and the nearest attachment point.

If info is non-NULL, a shape whose class which is a descendant of the desired class is found.

If notImage is non-NULL, shapes which are descendants of notImage are ignored.

### wxShapeCanvas::FindFirstSensitiveShape

wxShape * FindFirstSensitiveShape(double x1, double y, int *attachment, int op)

Finds the first sensitive shape whose sensitivity filter matches op, working up the hierarchy of composites until one (or none) is found.

### wxShapeCanvas::GetDiagram

wxDiagram* GetDiagram() const

Returns the canvas associated with this diagram.

### wxShapeCanvas::GetGridSpacing

double GetGridSpacing() const

Returns the grid spacing.

### wxShapeCanvas::GetMouseTolerance

int GetMouseTolerance() const

Returns the tolerance within which a mouse move is ignored.

### wxShapeCanvas::GetShapeList

wxList* GetShapeList() const

Returns a pointer to the internal shape list.

### wxShapeCanvas::GetQuickEditMode

bool GetQuickEditMode() const

Returns quick edit mode for the associated diagram.

### wxShapeCanvas::InsertShape

void InsertShape(wxShape* shape)

Inserts a shape at the front of the shape list.

### wxShapeCanvas::OnBeginDragLeft

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

Called when the start of a left-button drag event on the canvas background is detected by OnEvent. You may override this member; by default it does nothing.

keys is a bit list of the following:

- KEY_SHIFT
- KEY_CTRL

See also wxShapeCanvas::OnDragLeft, wxShapeCanvas::OnEndDragLeft.

### wxShapeCanvas::OnBeginDragRight

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

Called when the start of a right-button drag event on the canvas background is detected by OnEvent. You may override this member; by default it does nothing.

keys is a bit list of the following:

- KEY_SHIFT
- KEY_CTRL

See also wxShapeCanvas::OnDragRight, wxShapeCanvas::OnEndDragRight.

### wxShapeCanvas::OnEndDragLeft

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

Called when the end of a left-button drag event on the canvas background is detected by OnEvent. You may override this member; by default it does nothing.

keys is a bit list of the following:

- KEY_SHIFT
- KEY_CTRL

See also wxShapeCanvas::OnDragLeft, wxShapeCanvas::OnBeginDragLeft.

### wxShapeCanvas::OnEndDragRight

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

Called when the end of a right-button drag event on the canvas background is detected by OnEvent. You may override this member; by default it does nothing.

keys is a bit list of the following:

- KEY_SHIFT
- KEY_CTRL

See also wxShapeCanvas::OnDragRight, wxShapeCanvas::OnBeginDragRight.

### wxShapeCanvas::OnDragLeft

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

Called when a left-button drag event on the canvas background is detected by OnEvent. You may override this member; by default it does nothing.

draw is alternately TRUE and FALSE, to assist drawing and erasing.

keys is a bit list of the following:

- KEY_SHIFT
- KEY_CTRL

See also wxShapeCanvas::OnBeginDragLeft, wxShapeCanvas::OnEndDragLeft.

### wxShapeCanvas::OnDragRight

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

Called when a right-button drag event on the canvas background is detected by OnEvent. You may override this member; by default it does nothing.

draw is alternately TRUE and FALSE, to assist drawing and erasing.

keys is a bit list of the following:

- KEY_SHIFT
- KEY_CTRL

See also wxShapeCanvas::OnBeginDragRight, wxShapeCanvas::OnEndDragRight.

### wxShapeCanvas::OnLeftClick

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

Called when a left click event on the canvas background is detected by OnEvent. You may override this member; by default it does nothing.

keys is a bit list of the following:

- KEY_SHIFT
- KEY_CTRL

### wxShapeCanvas::OnRightClick

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

Called when a right click event on the canvas background is detected by OnEvent. You may override this member; by default it does nothing.

keys is a bit list of the following:

- KEY_SHIFT
- KEY_CTRL

### wxShapeCanvas::Redraw

void Redraw()

Calls wxDiagram::Redraw.

### wxShapeCanvas::RemoveShape

void RemoveShape(wxShape *shape)

Calls wxDiagram::RemoveShape.

### wxShapeCanvas::SetDiagram

void SetDiagram(wxDiagram *diagram)

Sets the diagram associated with this diagram.

### wxShapeCanvas::Snap

void Snap(double *x, double *y)

Calls wxDiagram::Snap.