Contents Up Previous Next

wxDiagram

Encapsulates an entire diagram, with methods for reading/writing and drawing. A diagram has an associated wxShapeCanvas.

Derived from

wxObject

See also

wxShapeCanvas

Members

wxDiagram::wxDiagram
wxDiagram::~wxDiagram
wxDiagram::AddShape
wxDiagram::Clear
wxDiagram::DeleteAllShapes
wxDiagram::DrawOutline
wxDiagram::FindShape
wxDiagram::GetCanvas
wxDiagram::GetCount
wxDiagram::GetGridSpacing
wxDiagram::GetMouseTolerance
wxDiagram::GetShapeList
wxDiagram::GetQuickEditMode
wxDiagram::GetSnapToGrid
wxDiagram::InsertShape
wxDiagram::LoadFile
wxDiagram::OnDatabaseLoad
wxDiagram::OnDatabaseSave
wxDiagram::OnHeaderLoad
wxDiagram::OnHeaderSave
wxDiagram::OnShapeLoad
wxDiagram::OnShapeSave
wxDiagram::ReadContainerGeometry
wxDiagram::ReadLines
wxDiagram::ReadNodes
wxDiagram::RecentreAll
wxDiagram::Redraw
wxDiagram::RemoveAllShapes
wxDiagram::RemoveShape
wxDiagram::SaveFile
wxDiagram::SetCanvas
wxDiagram::SetGridSpacing
wxDiagram::SetMouseTolerance
wxDiagram::SetQuickEditMode
wxDiagram::SetSnapToGrid
wxDiagram::ShowAll
wxDiagram::Snap


wxDiagram::wxDiagram

wxDiagram()

Constructor.


wxDiagram::~wxDiagram

~wxDiagram()

Destructor.


wxDiagram::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.


wxDiagram::Clear

void Clear(wxDC& dc)

Clears the specified device context.


wxDiagram::DeleteAllShapes

void DeletesAllShapes()

Removes and deletes all shapes in the diagram.


wxDiagram::DrawOutline

void DrawOutline(wxDC& dc, double x1, double y1, double x2, double y2)

Draws an outline rectangle on the current device context.


wxDiagram::FindShape

wxShape* FindShape(long id) const

Returns the shape for the given identifier.


wxDiagram::GetCanvas

wxShapeCanvas* GetCanvas() const

Returns the shape canvas associated with this diagram.


wxDiagram::GetCount

int GetCount() const

Returns the number of shapes in the diagram.


wxDiagram::GetGridSpacing

double GetGridSpacing() const

Returns the grid spacing.


wxDiagram::GetMouseTolerance

int GetMouseTolerance()

Returns the tolerance within which a mouse move is ignored.


wxDiagram::GetShapeList

wxList* GetShapeList() const

Returns a pointer to the internal shape list.


wxDiagram::GetQuickEditMode

bool GetQuickEditMode() const

Returns quick edit mode.


wxDiagram::GetSnapToGrid

bool GetSnapToGrid() const

Returns snap-to-grid mode.


wxDiagram::InsertShape

void InsertShape(wxShape *shape)

Inserts a shape at the front of the shape list.


wxDiagram::LoadFile

bool LoadFile(const wxString& filename)

Loads the diagram from a file.


wxDiagram::OnDatabaseLoad

void OnDatabaseLoad(wxExprDatabase& database)

Called just after the nodes and lines have been read from the wxExprDatabase. You may override this; the default member does nothing.


wxDiagram::OnDatabaseSave

void OnDatabaseSave(wxExprDatabase& database)

Called just after the nodes and lines have been written to the wxExprDatabase. You may override this; the default member does nothing.


wxDiagram::OnHeaderLoad

bool OnHeaderLoad(wxExprDatabase& database, wxExpr& expr)

Called to allow the 'diagram' header object to be read. The default member reads no further information. You may wish to override this to read version information, author name, etc.


wxDiagram::OnHeaderSave

bool OnHeaderSave(wxExprDatabase& database, wxExpr& expr)

Called to allow instantiation of the 'diagram' header object. The default member writes no further information. You may wish to override this to include version information, author name, etc.


wxDiagram::OnShapeLoad

bool OnShapeLoad(wxExprDatabase& database, wxShape& shape, wxExpr& expr)

Called to read the shape from the expr. You may override this, but call this function first. The default member calls ReadAttributes for the shape.


wxDiagram::OnShapeSave

bool OnShapeSave(wxExprDatabase& database, wxShape& shape, wxExpr& expr)

Called to save the shape to the expr and database. You may override this, but call this function first. The default member calls WriteAttributes for the shape, appends the shape to the database, and of the shape is a composite, recursively calls OnShapeSave for its children.


wxDiagram::ReadContainerGeometry

void ReadContainerGeometry(wxExprDatabase& database)

Reads container geometry from a wxExprDatabase, linking up nodes which are part of a composite. You probably won't need to redefine this.


wxDiagram::ReadLines

void ReadLines(wxExprDatabase& database)

Reads lines from a wxExprDatabase. You probably won't need to redefine this.


wxDiagram::ReadNodes

void ReadNodes(wxExprDatabase& database)

Reads nodes from a wxExprDatabase. You probably won't need to redefine this.


wxDiagram::RecentreAll

void RecentreAll(wxDC& dc)

Make sure all text that should be centred, is centred.


wxDiagram::Redraw

void Redraw(wxDC& dc)

Draws the shapes in the diagram on the specified device context.


wxDiagram::RemoveAllShapes

void RemoveAllShapes()

Removes all shapes from the diagram but does not delete the shapes.


wxDiagram::RemoveShape

void RemoveShape(wxShape* shape)

Removes the shape from the diagram (non-recursively) but does not delete it.


wxDiagram::SaveFile

bool SaveFile(const wxString& filename)

Saves the diagram in a file.


wxDiagram::SetCanvas

void SetCanvas(wxShapeCanvas* canvas)

Sets the canvas associated with this diagram.


wxDiagram::SetGridSpacing

void SetGridSpacing(double spacing)

Sets the grid spacing. The default is 5.


wxDiagram::SetMouseTolerance

void SetMouseTolerance(int tolerance)

Sets the tolerance within which a mouse move is ignored. The default is 3 pixels.


wxDiagram::SetQuickEditMode

void SetQuickEditMode(bool mode)

Sets quick-edit-mode on or off. In this mode, refreshes are minimized, but the diagram may need manual refreshing occasionally.


wxDiagram::SetSnapToGrid

void SetSnapToGrid(bool snap)

Sets snap-to-grid mode on or off. The default is on.


wxDiagram::ShowAll

void ShowAll(bool show)

Calls Show for each shape in the diagram.


wxDiagram::Snap

void Snap(double *x, double *y)

'Snaps' the coordinate to the nearest grid position, if snap-to-grid is on.