Encapsulates an entire diagram, with methods for reading/writing and drawing. A diagram has an associated wxShapeCanvas.
Derived from
wxObject
See also
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()
Constructor.
~wxDiagram()
Destructor.
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.
void Clear(wxDC& dc)
Clears the specified device context.
void DeletesAllShapes()
Removes and deletes all shapes in the diagram.
void DrawOutline(wxDC& dc, double x1, double y1, double x2, double y2)
Draws an outline rectangle on the current device context.
wxShape* FindShape(long id) const
Returns the shape for the given identifier.
wxShapeCanvas* GetCanvas() const
Returns the shape canvas associated with this diagram.
int GetCount() const
Returns the number of shapes in the diagram.
double GetGridSpacing() const
Returns the grid spacing.
int GetMouseTolerance()
Returns the tolerance within which a mouse move is ignored.
wxList* GetShapeList() const
Returns a pointer to the internal shape list.
bool GetQuickEditMode() const
Returns quick edit mode.
bool GetSnapToGrid() const
Returns snap-to-grid mode.
void InsertShape(wxShape *shape)
Inserts a shape at the front of the shape list.
bool LoadFile(const wxString& filename)
Loads the diagram from a file.
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.
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.
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.
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.
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.
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.
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.
void ReadLines(wxExprDatabase& database)
Reads lines from a wxExprDatabase. You probably won't need to redefine this.
void ReadNodes(wxExprDatabase& database)
Reads nodes from a wxExprDatabase. You probably won't need to redefine this.
void RecentreAll(wxDC& dc)
Make sure all text that should be centred, is centred.
void Redraw(wxDC& dc)
Draws the shapes in the diagram on the specified device context.
void RemoveAllShapes()
Removes all shapes from the diagram but does not delete the shapes.
void RemoveShape(wxShape* shape)
Removes the shape from the diagram (non-recursively) but does not delete it.
bool SaveFile(const wxString& filename)
Saves the diagram in a file.
void SetCanvas(wxShapeCanvas* canvas)
Sets the canvas associated with this diagram.
void SetGridSpacing(double spacing)
Sets the grid spacing. The default is 5.
void SetMouseTolerance(int tolerance)
Sets the tolerance within which a mouse move is ignored. The default is 3 pixels.
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.
void SetSnapToGrid(bool snap)
Sets snap-to-grid mode on or off. The default is on.
void ShowAll(bool show)
Calls Show for each shape in the diagram.
void Snap(double *x, double *y)
'Snaps' the coordinate to the nearest grid position, if snap-to-grid is on.