wxShapeFramework
1.13.0 beta
|
Class encapsulating a Shape canvas. The shape canvas is window control which extends the wxScrolledWindow and is responsible for displaying of shapes diagrams. It also supports clipboard and drag&drop operations, undo/redo operations, and graphics exporting functions. More...
#include <ShapeCanvas.h>
Public Member Functions | |
wxSFShapeCanvas () | |
Default constructor. More... | |
wxSFShapeCanvas (wxSFDiagramManager *manager, wxWindow *parent, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxHSCROLL|wxVSCROLL) | |
Constructor. More... | |
~wxSFShapeCanvas (void) | |
Destructor. More... | |
virtual bool | Create (wxWindow *parent, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxHSCROLL|wxVSCROLL, const wxString &name=wxT("scrolledWindow")) |
Creates the window in two-step construction mode. SetDiagramManager() function must be also called to complete the canvas initialization. More... | |
wxSFDiagramManager * | GetDiagramManager () |
Get diagram manager associated with this instance of shape canvas. More... | |
void | SetDiagramManager (wxSFDiagramManager *manager) |
Set diagram manager for this shape canvas. More... | |
void | LoadCanvas (const wxString &file) |
Load serialized canvas content (diagrams) from given file. More... | |
void | SaveCanvas (const wxString &file) |
Save canvas content (diagrams) to given file. More... | |
void | SaveCanvasToBMP (const wxString &file) |
Export canvas content to BMP file. DEPRECATED: use SaveCanvasToImage() instead. More... | |
void | SaveCanvasToImage (const wxString &file, wxBitmapType type=wxBITMAP_TYPE_BMP, bool background=true, double scale=-1) |
Export canvas content to image file. More... | |
void | StartInteractiveConnection (wxClassInfo *shapeInfo, const wxPoint &pos, wxSF::ERRCODE *err=NULL) |
Start interactive connection creation. More... | |
void | StartInteractiveConnection (wxSFLineShape *shape, const wxPoint &pos, wxSF::ERRCODE *err=NULL) |
Start interactive connection creation from existing line object. More... | |
void | StartInteractiveConnection (wxSFLineShape *shape, wxSFConnectionPoint *connectionPoint, const wxPoint &pos, wxSF::ERRCODE *err=NULL) |
Start interactive connection creation from existing line object. More... | |
void | AbortInteractiveConnection () |
Abort interactive connection creation process. More... | |
void | SelectAll () |
Select all shapes in the canvas. More... | |
void | DeselectAll () |
Deselect all shapes. More... | |
void | HideAllHandles () |
Hide handles of all shapes. More... | |
void | RefreshCanvas (bool erase, const wxRect &rct) |
Repaint the shape canvas. More... | |
void | InvalidateRect (const wxRect &rct) |
Mark given rectangle as an invalidated one, i.e. as a rectangle which should be refreshed (by using wxSFShapeCanvas::RefreshInvalidatedRect()). More... | |
void | InvalidateVisibleRect () |
Mark whole visible canvas portion as an invalidated rectangle. More... | |
void | RefreshInvalidatedRect () |
Refresh all canvas rectangles marked as invalidated. More... | |
void | ShowShadows (bool show, SHADOWMODE style) |
Show shapes shadows (only current digram shapes are affected). More... | |
wxDragResult | DoDragDrop (ShapeList &shapes, const wxPoint &start=wxPoint(-1, -1)) |
Start Drag&Drop operation with shapes included in the given list. More... | |
void | Copy () |
Copy selected shapes to the clipboard. More... | |
void | Cut () |
Copy selected shapes to the clipboard and remove them from the canvas. More... | |
void | Paste () |
Paste shapes stored in the clipboard to the canvas. More... | |
void | Undo () |
Perform Undo operation (if available) More... | |
void | Redo () |
Perform Redo operation (if available) More... | |
bool | CanCopy () |
Function returns TRUE if some shapes can be copied to the clipboard (it means they are selected) More... | |
bool | CanCut () |
Function returns TRUE if some shapes can be cutted to the clipboard (it means they are selected) More... | |
bool | CanPaste () |
Function returns TRUE if some shapes can be copied from the clipboard to the canvas (it means the clipboard contains stored shapes) More... | |
bool | CanUndo () |
Function returns TRUE if Undo operation can be done. More... | |
bool | CanRedo () |
Function returns TRUE if Redo operation can be done. More... | |
bool | CanAlignSelected () |
Function returns TRUE if AlignSelected function can be invoked (if more than one shape is selected) More... | |
void | SaveCanvasState () |
Save current canvas state (for Undo/Redo operations) More... | |
void | ClearCanvasHistory () |
Clear all stored canvas states (no Undo/Redo operations will be available) More... | |
void | Print (bool prompt=sfPROMPT) |
Print current canvas content. More... | |
void | Print (wxSFPrintout *printout, bool prompt=sfPROMPT) |
Print current canvas content using user-defined printout class. More... | |
void | PrintPreview () |
Show print preview. More... | |
void | PrintPreview (wxSFPrintout *preview, wxSFPrintout *printout=NULL) |
void | PageSetup () |
Show page setup dialog for printing. More... | |
wxPoint | DP2LP (const wxPoint &pos) const |
Show page margins setup dialog (available only for MAC). */ void PageMargins(); #endif. More... | |
wxRect | DP2LP (const wxRect &rct) const |
wxPoint | LP2DP (const wxPoint &pos) const |
Convert logical position to device position. More... | |
wxRect | LP2DP (const wxRect &rct) const |
void | UpdateShapeUnderCursorCache (const wxPoint &pos) |
wxSFShapeBase * | GetShapeUnderCursor (SEARCHMODE mode=searchBOTH) |
Get shape under current mouse cursor position (fast implementation - use everywhere it is possible instead of much slower GetShapeAtPosition()). More... | |
wxSFShapeBase * | GetShapeAtPosition (const wxPoint &pos, int zorder=1, SEARCHMODE mode=searchBOTH) |
Get shape at given logical position. More... | |
wxSFShapeHandle * | GetTopmostHandleAtPosition (const wxPoint &pos) |
Get topmost handle at given position. More... | |
void | GetShapesAtPosition (const wxPoint &pos, ShapeList &shapes) |
Get list of all shapes located at given position. More... | |
void | GetShapesInside (const wxRect &rct, ShapeList &shapes) |
Get list of shapes located inside given rectangle. More... | |
void | GetSelectedShapes (ShapeList &selection) |
Get list of selected shapes. More... | |
wxRect | GetTotalBoundingBox () const |
Get box bounding all shapes in the canvas. More... | |
wxRect | GetSelectionBB () |
Get bounding box of all selected shapes. More... | |
void | AlignSelected (HALIGN halign, VALIGN valign) |
Align selected shapes in given directions. More... | |
void | SetStyle (long style) |
Set canvas style. More... | |
long | GetStyle () const |
Get current canvas style. More... | |
void | AddStyle (STYLE style) |
Add new style flag. More... | |
void | RemoveStyle (STYLE style) |
Remove given style flag. More... | |
bool | ContainsStyle (STYLE style) const |
Check whether given style flag is used. More... | |
void | SetCanvasColour (const wxColour &col) |
Set canvas background color. More... | |
wxColour | GetCanvasColour () const |
Get canvas background color. More... | |
void | SetGradientFrom (const wxColour &col) |
Set starting gradient color. More... | |
wxColour | GetGradientFrom () const |
Get starting gradient color. More... | |
void | SetGradientTo (const wxColour &col) |
Set ending gradient color. More... | |
wxColour | GetGradientTo () const |
Get ending gradient color. More... | |
wxSize | GetGrid () const |
Get grid size. More... | |
void | SetGrid (wxSize grid) |
Set grid size. More... | |
void | SetGridLineMult (int multiple) |
Set grid line multiple. More... | |
int | GetGrigLineMult () const |
Get grid line multiple. More... | |
void | SetGridColour (const wxColour &col) |
Set grid color. More... | |
wxColour | GetGridColour () const |
Get grid color. More... | |
void | SetGridStyle (int style) |
Set grid line style. More... | |
int | GetGridStyle () const |
Get grid line style. More... | |
void | SetShadowOffset (const wxRealPoint &offset) |
Set shadow offset. More... | |
wxRealPoint | GetShadowOffset () const |
Get shadow offset. More... | |
void | SetShadowFill (const wxBrush &brush) |
Set shadow fill (used for shadows of non-text shapes only). More... | |
wxBrush | GetShadowFill () const |
Get shadow fill. More... | |
void | SetPrintHAlign (HALIGN val) |
Set horizontal align of printed drawing. More... | |
HALIGN | GetPrintHAlign () const |
Get horizontal align of printed drawing. More... | |
void | SetPrintVAlign (VALIGN val) |
Set vertical align of printed drawing. More... | |
VALIGN | GetPrintVAlign () const |
Get vertical align of printed drawing. More... | |
void | SetPrintMode (PRINTMODE mode) |
Set printing mode for this canvas. More... | |
PRINTMODE | GetPrintMode () const |
Get printing mode for this canvas. More... | |
void | SetScale (double scale) |
Set canvas scale. More... | |
void | SetMinScale (double scale) |
Set minimal allowed scale (for mouse wheel scale change). More... | |
double | GetMinScale () |
Get minimal allowed scale (for mouse wheel scale change). More... | |
void | SetMaxScale (double scale) |
Set maximal allowed scale (for mouse wheel scale change). More... | |
double | GetMaxScale () |
Set maximal allowed scale (for mouse wheel scale change). More... | |
double | GetScale () const |
Get the canvas scale. More... | |
void | SetScaleToViewAll () |
Set the canvas scale so a whole diagram is visible. More... | |
void | ScrollToShape (wxSFShapeBase *shape) |
Scroll the shape canvas so the given shape will be located in its center. More... | |
MODE | GetMode () const |
Get canvas workind mode. More... | |
void | SetHoverColour (const wxColour &col) |
Set default hover color. More... | |
wxColour | GetHoverColour () const |
Get default hover color. More... | |
wxSFCanvasHistory & | GetHistoryManager () |
Get canvas hostory manager. More... | |
wxPoint | FitPositionToGrid (const wxPoint &pos) |
Update given position so it will fit canvas grid (if enabled). More... | |
void | UpdateMultieditSize () |
Update size of multi selection rectangle. More... | |
void | UpdateVirtualSize () |
Update scroll window virtual size so it can display all shape canvas. More... | |
void | MoveShapesFromNegatives () |
Move all shapes so none of it will be located in negative position. More... | |
void | CenterShapes () |
Center diagram in accordance to the shape canvas extent. More... | |
void | ValidateSelection (ShapeList &selection) |
Validate selection (remove redundantly selected shapes etc...). More... | |
virtual void | DrawContent (wxDC &dc, bool fromPaint) |
Function responsible for drawing of the canvas's content to given DC. The default implementation draws actual objects managed by assigned diagram manager. More... | |
virtual void | DrawBackground (wxDC &dc, bool fromPaint) |
Function responsible for drawing of the canvas's background to given DC. The default implementation draws canvas background and grid. More... | |
virtual void | DrawForeground (wxDC &dc, bool fromPaint) |
Function responsible for drawing of the canvas's foreground to given DC. The default do nothing. More... | |
wxSFMultiSelRect & | GetMultiselectionBox () |
Get reference to multiselection box. More... | |
void | DeleteAllTextCtrls () |
Close and delete all opened text editing controls actualy used by editable text shapes. More... | |
virtual void | OnLeftDown (wxMouseEvent &event) |
Event handler called when the canvas is clicked by the left mouse button. The function can be overrided if necessary. More... | |
virtual void | OnLeftDoubleClick (wxMouseEvent &event) |
Event handler called when the canvas is double-clicked by the left mouse button. The function can be overrided if necessary. More... | |
virtual void | OnLeftUp (wxMouseEvent &event) |
Event handler called when the left mouse button is released. The function can be overrided if necessary. More... | |
virtual void | OnRightDown (wxMouseEvent &event) |
Event handler called when the canvas is clicked by the right mouse button. The function can be overrided if necessary. More... | |
virtual void | OnRightDoubleClick (wxMouseEvent &event) |
Event handler called when the canvas is double-clicked by the right mouse button. The function can be overrided if necessary. More... | |
virtual void | OnRightUp (wxMouseEvent &event) |
Event handler called when the right mouse button is released. The function can be overrided if necessary. More... | |
virtual void | OnMouseMove (wxMouseEvent &event) |
Event handler called when the mouse pointer is moved. The function can be overrided if necessary. More... | |
virtual void | OnMouseWheel (wxMouseEvent &event) |
Event handler called when the mouse wheel position is changed. The function can be overrided if necessary. More... | |
virtual void | OnKeyDown (wxKeyEvent &event) |
Event handler called when any key is pressed. The function can be overrided if necessary. More... | |
virtual void | OnTextChange (wxSFEditTextShape *shape) |
Event handler called when any editable text shape is changed. The function can be overrided if necessary. The function is called by the framework and its default implementation generates wxEVT_SF_TEXT_CHANGE event. More... | |
virtual void | OnConnectionFinished (wxSFLineShape *connection) |
virtual PRECONNECTIONFINISHEDSTATE | OnPreConnectionFinished (wxSFLineShape *connection) |
virtual void | OnDrop (wxCoord x, wxCoord y, wxDragResult def, const ShapeList &dropped) |
virtual void | OnPaste (const ShapeList &pasted) |
virtual void | OnUpdateVirtualSize (wxRect &virtrct) |
Event handler called if canvas virtual size is going to be updated. The default implementation does nothing but the function can be overrided by a user to modify calculated virtual canvas size. More... | |
Static Public Member Functions | |
static void | EnableGC (bool enab) |
Enable usage of wxGraphicsContext for drawing (if supported). More... | |
static bool | IsGCEnabled () |
Function returns information whether the wxGraphicsContext is enabled (if supported). More... | |
Protected Attributes | |
MODE | m_nWorkingMode |
SELECTIONMODE | m_nSelectionMode |
wxSFCanvasSettings | m_Settings |
Static Protected Attributes | |
static bool | m_fEnableGC |
Private Member Functions | |
void | ValidateSelectionForClipboard (ShapeList &selection, bool storeprevpos) |
Validate selection so the shapes in the given list can be processed by the clipboard functions. More... | |
void | AppendAssignedConnections (wxSFShapeBase *shape, ShapeList &selection, bool childrenonly) |
Append connections assigned to shapes in given list to this list as well. More... | |
void | InitializePrinting () |
Initialize printing framework. More... | |
void | DeinitializePrinting () |
Deinitialize prnting framework. More... | |
void | RemoveFromTemporaries (wxSFShapeBase *shape) |
Remove given shape for temporary containers. More... | |
void | ClearTemporaries () |
Clear all temporary containers. More... | |
void | ReparentShape (wxSFShapeBase *shape, const wxPoint &parentpos) |
Assign give shape to parent at given location (if exists) More... | |
void | StorePrevPosition (const wxSFShapeBase *shape) |
Store previous shape's position modified in ValidateSelectionForClipboard() function. More... | |
void | RestorePrevPositions () |
Restore previously stored shapes' positions and clear the storage. More... | |
void | _OnPaint (wxPaintEvent &event) |
Event handler called when the canvas should be repainted. More... | |
void | _OnEraseBackground (wxEraseEvent &event) |
Event handler called when the canvas should be erased. More... | |
void | _OnLeaveWindow (wxMouseEvent &event) |
Event handler called when the mouse pointer leaves the canvas window. More... | |
void | _OnEnterWindow (wxMouseEvent &event) |
Event handler called when the mouse pointer enters the canvas window. More... | |
void | _OnResize (wxSizeEvent &event) |
Event handler called when the canvas size has changed. More... | |
void | _OnLeftDown (wxMouseEvent &event) |
Original private event handler called when the canvas is clicked by left mouse button. The handler calls user-overridable event handler function and skips the event for next possible processing. More... | |
void | _OnLeftDoubleClick (wxMouseEvent &event) |
Original private event handler called when the canvas is double-clicked by left mouse button. The handler calls user-overridable event handler function and skips the event for next possible processing. More... | |
void | _OnLeftUp (wxMouseEvent &event) |
Original private event handler called when the left mouse button is release above the canvas. The handler calls user-overridable event handler function and skips the event for next possible processing. More... | |
void | _OnRightDown (wxMouseEvent &event) |
Original private event handler called when the canvas is clicked by right mouse button. The handler calls user-overridable event handler function and skips the event for next possible processing. More... | |
void | _OnRightDoubleClick (wxMouseEvent &event) |
Original private event handler called when the canvas is double-clicked by right mouse button. The handler calls user-overridable event handler function and skips the event for next possible processing. More... | |
void | _OnRightUp (wxMouseEvent &event) |
Original private event handler called when the right mouse button is release above the canvas. The handler calls user-overridable event handler function and skips the event for next possible processing. More... | |
void | _OnMouseMove (wxMouseEvent &event) |
Original private event handler called when the mouse pointer is moving above the canvas. The handler calls user-overridable event handler function and skips the event for next possible processing. More... | |
void | _OnMouseWheel (wxMouseEvent &event) |
Original private event handler called when the mouse wheel pocition is changed. The handler calls user-overridable event handler function and skips the event for next possible processing. More... | |
void | _OnKeyDown (wxKeyEvent &event) |
Original private event handler called when any key is pressed. The handler calls user-overridable event handler function and skips the event for next possible processing. More... | |
void | _OnDrop (wxCoord x, wxCoord y, wxDragResult def, wxDataObject *data) |
Function is called by associated wxSFCanvasDropTarget after any dragged shapes are dropped to the canvas. More... | |
DECLARE_EVENT_TABLE () | |
Private Attributes | |
wxRealPoint | m_selectionStart |
wxSFMultiSelRect | m_shpSelection |
wxSFMultiSelRect | m_shpMultiEdit |
bool | m_fCanSaveStateOnMouseUp |
bool | m_fDnDStartedHere |
Flag used for determination whether the D&D operation has started and ended in one canvas instance. More... | |
wxPoint | m_nDnDStartedAt |
Started position of current D&D operation. More... | |
wxDataFormat | m_formatShapes |
Custom data format object (used for the clipboard and D&D operations. More... | |
wxPoint | m_nPrevMousePos |
PositionMap | m_mapPrevPositions |
wxRect | m_nInvalidateRect |
wxSFCanvasHistory | m_CanvasHistory |
Canvas history manager. More... | |
wxSFDiagramManager * | m_pManager |
Pointer to parent data (shapes) manager. More... | |
wxSFShapeHandle * | m_pSelectedHandle |
Pointer to currently selected shape handle. More... | |
wxSFLineShape * | m_pNewLineShape |
Pointer to new line shape under constuction. More... | |
wxSFShapeBase * | m_pUnselectedShapeUnderCursor |
Pointer to topmost unselected shape under the mouse cursor. More... | |
wxSFShapeBase * | m_pSelectedShapeUnderCursor |
Pointer to topmost selected shape under the mouse cursor. More... | |
wxSFShapeBase * | m_pTopmostShapeUnderCursor |
Pointer to topmost shape under the mouse cursor. More... | |
ShapeList | m_lstCurrentShapes |
Current list of all shapes in the canvas updated during mouse movement. More... | |
Static Private Attributes | |
static wxBitmap | m_OutBMP |
static int | m_nRefCounter |
Friends | |
class | wxSFDiagramManager |
class | wxSFCanvasDropTarget |
Class encapsulating a Shape canvas. The shape canvas is window control which extends the wxScrolledWindow and is responsible for displaying of shapes diagrams. It also supports clipboard and drag&drop operations, undo/redo operations, and graphics exporting functions.
This class is a core framework class and provides many member functions suitable for adding, removing, moving, resizing and drawing of shape objects. It can be used as it is or as a base class if necessary. In that case, the default class functionality can be enhaced by overriding of its virtual functions or by manual events handling. In both cases the user is responsible for invoking of default event handlers/virtual functions otherwise the built in functionality wont be available.
Working modes.
Printing modes used by SetPrintMode() function.
Style flags.
wxSFShapeCanvas::wxSFShapeCanvas | ( | ) |
Default constructor.
wxSFShapeCanvas::wxSFShapeCanvas | ( | wxSFDiagramManager * | manager, |
wxWindow * | parent, | ||
wxWindowID | id = -1 , |
||
const wxPoint & | pos = wxDefaultPosition , |
||
const wxSize & | size = wxDefaultSize , |
||
long | style = wxHSCROLL|wxVSCROLL |
||
) |
Constructor.
manager | Pointer to shape manager |
parent | Parent window |
id | Window ID |
pos | Initial position |
size | Initial size |
style | Window style |
wxSFShapeCanvas::~wxSFShapeCanvas | ( | void | ) |
Destructor.
|
private |
Function is called by associated wxSFCanvasDropTarget after any dragged shapes are dropped to the canvas.
x | X-coordinate of a position the data was dropped to |
y | Y-coordinate of a position the data was dropped to |
def | Drag result |
data | Pointer to a data object encapsulating dropped data |
|
private |
Event handler called when the mouse pointer enters the canvas window.
event | Mouse event |
|
private |
Event handler called when the canvas should be erased.
event | Erase event |
|
private |
Original private event handler called when any key is pressed. The handler calls user-overridable event handler function and skips the event for next possible processing.
event | Keyboard event |
|
private |
Event handler called when the mouse pointer leaves the canvas window.
event | Mouse event |
|
private |
Original private event handler called when the canvas is double-clicked by left mouse button. The handler calls user-overridable event handler function and skips the event for next possible processing.
event | Mouse event |
|
private |
Original private event handler called when the canvas is clicked by left mouse button. The handler calls user-overridable event handler function and skips the event for next possible processing.
event | Mouse event |
|
private |
Original private event handler called when the left mouse button is release above the canvas. The handler calls user-overridable event handler function and skips the event for next possible processing.
event | Mouse event |
|
private |
Original private event handler called when the mouse pointer is moving above the canvas. The handler calls user-overridable event handler function and skips the event for next possible processing.
event | Mouse event |
|
private |
Original private event handler called when the mouse wheel pocition is changed. The handler calls user-overridable event handler function and skips the event for next possible processing.
event | Mouse event |
|
private |
Event handler called when the canvas should be repainted.
event | Paint event |
|
private |
Event handler called when the canvas size has changed.
event | Size event |
|
private |
Original private event handler called when the canvas is double-clicked by right mouse button. The handler calls user-overridable event handler function and skips the event for next possible processing.
event | Mouse event |
|
private |
Original private event handler called when the canvas is clicked by right mouse button. The handler calls user-overridable event handler function and skips the event for next possible processing.
event | Mouse event |
|
private |
Original private event handler called when the right mouse button is release above the canvas. The handler calls user-overridable event handler function and skips the event for next possible processing.
event | Mouse event |
void wxSFShapeCanvas::AbortInteractiveConnection | ( | ) |
Abort interactive connection creation process.
|
inline |
Add new style flag.
Align selected shapes in given directions.
Shapes will be aligned according to most far shape in appropriate direction.
halign | Horizontal alignment |
valign | Vertical alignment |
|
private |
Append connections assigned to shapes in given list to this list as well.
bool wxSFShapeCanvas::CanAlignSelected | ( | ) |
Function returns TRUE if AlignSelected function can be invoked (if more than one shape is selected)
bool wxSFShapeCanvas::CanCopy | ( | ) |
Function returns TRUE if some shapes can be copied to the clipboard (it means they are selected)
bool wxSFShapeCanvas::CanCut | ( | ) |
Function returns TRUE if some shapes can be cutted to the clipboard (it means they are selected)
bool wxSFShapeCanvas::CanPaste | ( | ) |
Function returns TRUE if some shapes can be copied from the clipboard to the canvas (it means the clipboard contains stored shapes)
bool wxSFShapeCanvas::CanRedo | ( | ) |
Function returns TRUE if Redo operation can be done.
bool wxSFShapeCanvas::CanUndo | ( | ) |
Function returns TRUE if Undo operation can be done.
void wxSFShapeCanvas::CenterShapes | ( | ) |
Center diagram in accordance to the shape canvas extent.
void wxSFShapeCanvas::ClearCanvasHistory | ( | ) |
Clear all stored canvas states (no Undo/Redo operations will be available)
|
private |
Clear all temporary containers.
|
inline |
Check whether given style flag is used.
void wxSFShapeCanvas::Copy | ( | ) |
Copy selected shapes to the clipboard.
|
virtual |
Creates the window in two-step construction mode. SetDiagramManager() function must be also called to complete the canvas initialization.
parent | Parent window |
id | Window ID |
pos | Initial position |
size | Initial size |
style | Window style |
name | Window name |
void wxSFShapeCanvas::Cut | ( | ) |
Copy selected shapes to the clipboard and remove them from the canvas.
|
private |
|
private |
Deinitialize prnting framework.
void wxSFShapeCanvas::DeleteAllTextCtrls | ( | ) |
Close and delete all opened text editing controls actualy used by editable text shapes.
void wxSFShapeCanvas::DeselectAll | ( | ) |
Deselect all shapes.
wxDragResult wxSFShapeCanvas::DoDragDrop | ( | ShapeList & | shapes, |
const wxPoint & | start = wxPoint(-1, -1) |
||
) |
Start Drag&Drop operation with shapes included in the given list.
shapes | List of shapes which should be dragged |
start | A point where the dragging operation has started |
wxPoint wxSFShapeCanvas::DP2LP | ( | const wxPoint & | pos | ) | const |
Show page margins setup dialog (available only for MAC). */ void PageMargins(); #endif.
/*! \brief Convert device position to logical position. The function returns unscrolled unscaled canvas position. \param pos Device position (for example mouse position) \return Logical position
wxRect wxSFShapeCanvas::DP2LP | ( | const wxRect & | rct | ) | const |
|
virtual |
Function responsible for drawing of the canvas's background to given DC. The default implementation draws canvas background and grid.
dc | Reference to device context where the shapes will be drawn to |
fromPaint | Set the argument to TRUE if the dc argument refers to the wxPaintDC instance or derived classes (i.e. the function is called as a response to wxEVT_PAINT event) |
|
virtual |
Function responsible for drawing of the canvas's content to given DC. The default implementation draws actual objects managed by assigned diagram manager.
dc | Reference to device context where the shapes will be drawn to |
fromPaint | Set the argument to TRUE if the dc argument refers to the wxPaintDC instance or derived classes (i.e. the function is called as a response to wxEVT_PAINT event) |
|
virtual |
Function responsible for drawing of the canvas's foreground to given DC. The default do nothing.
dc | Reference to device context where the shapes will be drawn to |
fromPaint | Set the argument to TRUE if the dc argument refers to the wxPaintDC instance or derived classes (i.e. the function is called as a response to wxEVT_PAINT event) |
|
static |
Enable usage of wxGraphicsContext for drawing (if supported).
enab | If TRUE then the wxGraphicsContext will be used |
wxPoint wxSFShapeCanvas::FitPositionToGrid | ( | const wxPoint & | pos | ) |
Update given position so it will fit canvas grid (if enabled).
pos | Position which should be updated |
|
inline |
Get canvas background color.
|
inline |
Get diagram manager associated with this instance of shape canvas.
|
inline |
Get starting gradient color.
|
inline |
Get ending gradient color.
|
inline |
Get grid size.
|
inline |
Get grid color.
|
inline |
Get grid line style.
|
inline |
Get grid line multiple.
|
inline |
Get canvas hostory manager.
|
inline |
Get default hover color.
|
inline |
Set maximal allowed scale (for mouse wheel scale change).
|
inline |
Get minimal allowed scale (for mouse wheel scale change).
|
inline |
|
inline |
Get reference to multiselection box.
|
inline |
|
inline |
|
inline |
|
inline |
Get the canvas scale.
void wxSFShapeCanvas::GetSelectedShapes | ( | ShapeList & | selection | ) |
Get list of selected shapes.
selection | Reference to shape list where pointers to all selected shapes will be stored |
wxRect wxSFShapeCanvas::GetSelectionBB | ( | ) |
Get bounding box of all selected shapes.
|
inline |
Get shadow fill.
|
inline |
Get shadow offset.
wxSFShapeBase* wxSFShapeCanvas::GetShapeAtPosition | ( | const wxPoint & | pos, |
int | zorder = 1 , |
||
SEARCHMODE | mode = searchBOTH |
||
) |
Get shape at given logical position.
pos | Logical position |
zorder | Z-order of searched shape (usefull if several shapes are located at the given position) |
mode | Search mode |
void wxSFShapeCanvas::GetShapesAtPosition | ( | const wxPoint & | pos, |
ShapeList & | shapes | ||
) |
Get list of all shapes located at given position.
pos | Logical position |
shapes | Reference to shape list where pointers to all found shapes will be stored |
void wxSFShapeCanvas::GetShapesInside | ( | const wxRect & | rct, |
ShapeList & | shapes | ||
) |
Get list of shapes located inside given rectangle.
rct | Examined rectangle |
shapes | Reference to shape list where pointers to all found shapes will be stored |
wxSFShapeBase* wxSFShapeCanvas::GetShapeUnderCursor | ( | SEARCHMODE | mode = searchBOTH | ) |
Get shape under current mouse cursor position (fast implementation - use everywhere it is possible instead of much slower GetShapeAtPosition()).
mode | Search mode |
|
inline |
Get current canvas style.
wxSFShapeHandle* wxSFShapeCanvas::GetTopmostHandleAtPosition | ( | const wxPoint & | pos | ) |
Get topmost handle at given position.
pos | Logical position |
wxRect wxSFShapeCanvas::GetTotalBoundingBox | ( | ) | const |
Get box bounding all shapes in the canvas.
void wxSFShapeCanvas::HideAllHandles | ( | ) |
Hide handles of all shapes.
|
private |
Initialize printing framework.
void wxSFShapeCanvas::InvalidateRect | ( | const wxRect & | rct | ) |
Mark given rectangle as an invalidated one, i.e. as a rectangle which should be refreshed (by using wxSFShapeCanvas::RefreshInvalidatedRect()).
rct | Rectangle to be invalidated |
void wxSFShapeCanvas::InvalidateVisibleRect | ( | ) |
Mark whole visible canvas portion as an invalidated rectangle.
|
inlinestatic |
Function returns information whether the wxGraphicsContext is enabled (if supported).
void wxSFShapeCanvas::LoadCanvas | ( | const wxString & | file | ) |
Load serialized canvas content (diagrams) from given file.
file | Full file name |
wxPoint wxSFShapeCanvas::LP2DP | ( | const wxPoint & | pos | ) | const |
Convert logical position to device position.
The function returns scrolled scaled canvas position.
pos | Logical position (for example shape position) |
wxRect wxSFShapeCanvas::LP2DP | ( | const wxRect & | rct | ) | const |
void wxSFShapeCanvas::MoveShapesFromNegatives | ( | ) |
Move all shapes so none of it will be located in negative position.
|
virtual |
\brief Event handler called after successfull conection creation. The function can be overrided if necessary. The default implementation
generates wxEVT_SF_LINE_DONE event.
connection | Pointer to new connection object |
|
virtual |
\brief Event handler called by the framework after any dragged shapes are dropped to the canvas. The default implementation
generates wxEVT_SF_ON_DROP event.
x | X-coordinate of a position the data was dropped to |
y | Y-coordinate of a position the data was dropped to |
def | Drag result |
dropped | Reference to a list containing the dropped data |
|
virtual |
Event handler called when any key is pressed. The function can be overrided if necessary.
The function is called by the framework and provides basic functionality needed for proper management of displayed shape. It is necessary to call this function from overrided methods if the default canvas behaviour should be preserved.
event | Keyboard event |
|
virtual |
Event handler called when the canvas is double-clicked by the left mouse button. The function can be overrided if necessary.
The function is called by the framework and provides basic functionality needed for proper management of displayed shape. It is necessary to call this function from overrided methods if the default canvas behaviour should be preserved.
event | Mouse event |
|
virtual |
Event handler called when the canvas is clicked by the left mouse button. The function can be overrided if necessary.
The function is called by the framework and provides basic functionality needed for proper management of displayed shape. It is necessary to call this function from overrided methods if the default canvas behaviour should be preserved.
event | Mouse event |
|
virtual |
Event handler called when the left mouse button is released. The function can be overrided if necessary.
The function is called by the framework and provides basic functionality needed for proper management of displayed shape. It is necessary to call this function from overrided methods if the default canvas behaviour should be preserved.
event | Mouse event |
|
virtual |
Event handler called when the mouse pointer is moved. The function can be overrided if necessary.
The function is called by the framework and provides basic functionality needed for proper management of displayed shape. It is necessary to call this function from overrided methods if the default canvas behaviour should be preserved.
event | Mouse event |
|
virtual |
Event handler called when the mouse wheel position is changed. The function can be overrided if necessary.
The function is called by the framework and provides basic functionality needed for proper management of displayed shape. It is necessary to call this function from overrided methods if the default canvas behaviour should be preserved.
event | Mouse event |
|
virtual |
\brief Event handler called by the framework after pasting of shapes from the clipboard to the canvas. The default implementation
generates wxEVT_SF_ON_PASTE event.
pasted | Reference to a list containing the pasted data |
|
virtual |
\brief Event handler called after successfull conection creation in order to alow developper to perform some kind of checks before the connection is really added to the diagram. The function can be overrided if necessary. The default implementation
generates wxEVT_SF_LINE_DONE event.
connection | Pointer to new connection object |
|
virtual |
Event handler called when the canvas is double-clicked by the right mouse button. The function can be overrided if necessary.
The function is called by the framework and provides basic functionality needed for proper management of displayed shape. It is necessary to call this function from overrided methods if the default canvas behaviour should be preserved.
event | Mouse event |
|
virtual |
Event handler called when the canvas is clicked by the right mouse button. The function can be overrided if necessary.
The function is called by the framework and provides basic functionality needed for proper management of displayed shape. It is necessary to call this function from overrided methods if the default canvas behaviour should be preserved.
event | Mouse event |
|
virtual |
Event handler called when the right mouse button is released. The function can be overrided if necessary.
The function is called by the framework and provides basic functionality needed for proper management of displayed shape. It is necessary to call this function from overrided methods if the default canvas behaviour should be preserved.
event | Mouse event |
|
virtual |
Event handler called when any editable text shape is changed. The function can be overrided if necessary. The function is called by the framework and its default implementation generates wxEVT_SF_TEXT_CHANGE event.
shape | Changed wxSFEditTextShape object |
|
virtual |
Event handler called if canvas virtual size is going to be updated. The default implementation does nothing but the function can be overrided by a user to modify calculated virtual canvas size.
virtrct | Calculated canvas virtual size |
void wxSFShapeCanvas::PageSetup | ( | ) |
Show page setup dialog for printing.
void wxSFShapeCanvas::Paste | ( | ) |
Paste shapes stored in the clipboard to the canvas.
void wxSFShapeCanvas::Print | ( | bool | prompt = sfPROMPT | ) |
Print current canvas content.
prompt | If TRUE (sfPROMT) then the the native print dialog will be displayed before printing |
void wxSFShapeCanvas::Print | ( | wxSFPrintout * | printout, |
bool | prompt = sfPROMPT |
||
) |
Print current canvas content using user-defined printout class.
printout | Pointer to user-defined printout object (inherited from wxSFPrintout class). Do not delete this object explicitly. |
prompt | If TRUE (sfPROMT) then the native print dialog will be displayed before printing |
void wxSFShapeCanvas::PrintPreview | ( | ) |
Show print preview.
void wxSFShapeCanvas::PrintPreview | ( | wxSFPrintout * | preview, |
wxSFPrintout * | printout = NULL |
||
) |
\brief Show print preview using user-defined printout classes.
preview | Pointer to user-defined printout object (inherited from wxSFPrintout class) used for print preview. Do not delete this object explicitly. |
printout | Pointer to user-defined printout class (inherited from wxSFPrintout class) used for printing. Do not delete this object explicitly. This parameter can be NULL (in this case a print button will not be available in the print preview window). |
void wxSFShapeCanvas::Redo | ( | ) |
Perform Redo operation (if available)
void wxSFShapeCanvas::RefreshCanvas | ( | bool | erase, |
const wxRect & | rct | ||
) |
Repaint the shape canvas.
erase | TRUE if the canvas should be erased before repainting |
rct | Refreshed region (rectangle) |
void wxSFShapeCanvas::RefreshInvalidatedRect | ( | ) |
Refresh all canvas rectangles marked as invalidated.
|
private |
Remove given shape for temporary containers.
|
inline |
Remove given style flag.
|
private |
Assign give shape to parent at given location (if exists)
|
private |
Restore previously stored shapes' positions and clear the storage.
void wxSFShapeCanvas::SaveCanvas | ( | const wxString & | file | ) |
Save canvas content (diagrams) to given file.
file | Full file name |
void wxSFShapeCanvas::SaveCanvasState | ( | ) |
Save current canvas state (for Undo/Redo operations)
void wxSFShapeCanvas::SaveCanvasToBMP | ( | const wxString & | file | ) |
Export canvas content to BMP file. DEPRECATED: use SaveCanvasToImage() instead.
file | Full file name |
void wxSFShapeCanvas::SaveCanvasToImage | ( | const wxString & | file, |
wxBitmapType | type = wxBITMAP_TYPE_BMP , |
||
bool | background = true , |
||
double | scale = -1 |
||
) |
Export canvas content to image file.
file | Full file name |
type | Image type. See wxBitmapType for more details. Default type is wxBITMAP_TYPE_BMP. |
background | Export also diagram background |
scale | Image scale. If -1 then current canvas scale id used. |
void wxSFShapeCanvas::ScrollToShape | ( | wxSFShapeBase * | shape | ) |
Scroll the shape canvas so the given shape will be located in its center.
shape | Pointer to focused shape |
void wxSFShapeCanvas::SelectAll | ( | ) |
Select all shapes in the canvas.
|
inline |
Set canvas background color.
col | Background color |
void wxSFShapeCanvas::SetDiagramManager | ( | wxSFDiagramManager * | manager | ) |
Set diagram manager for this shape canvas.
manager | Pointer to diagram manager instance |
|
inline |
Set starting gradient color.
col | Color |
|
inline |
Set ending gradient color.
col | Color |
|
inline |
Set grid size.
grid | Grid size |
|
inline |
Set grid color.
col | Grid color |
|
inline |
Set grid line multiple.
Grid lines will be drawn in a distance calculated as grid size multiplicated by this value. Default value is 1.
multiple | Multiple value |
|
inline |
Set grid line style.
style | Line style |
void wxSFShapeCanvas::SetHoverColour | ( | const wxColour & | col | ) |
Set default hover color.
col | Hover color. |
|
inline |
Set maximal allowed scale (for mouse wheel scale change).
scale | Maximal scale |
|
inline |
Set minimal allowed scale (for mouse wheel scale change).
scale | Minimal scale |
|
inline |
|
inline |
|
inline |
void wxSFShapeCanvas::SetScale | ( | double | scale | ) |
Set canvas scale.
scale | Scale value |
void wxSFShapeCanvas::SetScaleToViewAll | ( | ) |
Set the canvas scale so a whole diagram is visible.
|
inline |
Set shadow fill (used for shadows of non-text shapes only).
brush | Reference to brush object |
|
inline |
Set shadow offset.
offset | Shadow offset |
|
inline |
Set canvas style.
Default value is sfsMULTI_SELECTION | sfsMULTI_SIZE_CHANGE | sfsDND | sfsUNDOREDO | sfsCLIPBOARD | sfsHOVERING | sfsHIGHLIGHTING
style | Combination of the canvas styles |
void wxSFShapeCanvas::ShowShadows | ( | bool | show, |
SHADOWMODE | style | ||
) |
Show shapes shadows (only current digram shapes are affected).
The functions sets/unsets sfsSHOW_SHADOW flag for all shapes currently included in the diagram.
show | TRUE if the shadow shoud be shown, otherwise FALSE |
style | Shadow style |
void wxSFShapeCanvas::StartInteractiveConnection | ( | wxClassInfo * | shapeInfo, |
const wxPoint & | pos, | ||
wxSF::ERRCODE * | err = NULL |
||
) |
Start interactive connection creation.
This function switch the canvas to a mode in which a new shape connection can be created interactively (by mouse operations). Every connection must start and finish in some shape object or another connection. At the end of the process the OnConnectionFinished event handler is invoked so the user can set needed connection properties immediately.
Function must be called from mouse event handler and the event must be passed to the function.
shapeInfo | Connection type |
pos | Position where to start |
err | Pointer to variable where operation result will be stored. Can be NULL. |
void wxSFShapeCanvas::StartInteractiveConnection | ( | wxSFLineShape * | shape, |
const wxPoint & | pos, | ||
wxSF::ERRCODE * | err = NULL |
||
) |
Start interactive connection creation from existing line object.
This function switch the canvas to a mode in which a new shape connection can be created interactively (by mouse operations). Every connection must start and finish in some shape object or another connection. At the end of the process the OnConnectionFinished event handler is invoked so the user can set needed connection properties immediately.
Function must be called from mouse event handler and the event must be passed to the function.
shape | Pointer to existing line shape object which will be used as a connection. |
pos | Position where to start |
err | Pointer to variable where operation result will be stored. Can be NULL. |
void wxSFShapeCanvas::StartInteractiveConnection | ( | wxSFLineShape * | shape, |
wxSFConnectionPoint * | connectionPoint, | ||
const wxPoint & | pos, | ||
wxSF::ERRCODE * | err = NULL |
||
) |
Start interactive connection creation from existing line object.
This function switch the canvas to a mode in which a new shape connection can be created interactively (by mouse operations). Every connection must start and finish in some shape object or another connection. At the end of the process the OnConnectionFinished event handler is invoked so the user can set needed connection properties immediately.
Function must be called from mouse event handler and the event must be passed to the function.
shape | Pointer to existing line shape object which will be used as a connection. |
connectionPoint | Initial connection point |
pos | Position where to start |
err | Pointer to variable where operation result will be stored. Can be NULL. |
|
inlineprivate |
Store previous shape's position modified in ValidateSelectionForClipboard() function.
void wxSFShapeCanvas::Undo | ( | ) |
Perform Undo operation (if available)
void wxSFShapeCanvas::UpdateMultieditSize | ( | ) |
Update size of multi selection rectangle.
void wxSFShapeCanvas::UpdateShapeUnderCursorCache | ( | const wxPoint & | pos | ) |
void wxSFShapeCanvas::UpdateVirtualSize | ( | ) |
Update scroll window virtual size so it can display all shape canvas.
void wxSFShapeCanvas::ValidateSelection | ( | ShapeList & | selection | ) |
Validate selection (remove redundantly selected shapes etc...).
selection | List of selected shapes that should be validated |
|
private |
Validate selection so the shapes in the given list can be processed by the clipboard functions.
|
friend |
|
friend |
|
private |
Canvas history manager.
|
private |
|
private |
Flag used for determination whether the D&D operation has started and ended in one canvas instance.
|
staticprotected |
|
private |
Custom data format object (used for the clipboard and D&D operations.
|
private |
Current list of all shapes in the canvas updated during mouse movement.
|
private |
|
private |
Started position of current D&D operation.
|
private |
|
private |
|
staticprivate |
|
protected |
|
protected |
|
staticprivate |
|
private |
Pointer to parent data (shapes) manager.
|
private |
Pointer to new line shape under constuction.
|
private |
Pointer to currently selected shape handle.
|
private |
Pointer to topmost selected shape under the mouse cursor.
|
private |
Pointer to topmost shape under the mouse cursor.
|
private |
Pointer to topmost unselected shape under the mouse cursor.
|
private |
|
protected |
|
private |
|
private |