libs/flake
KoCanvasBase Class Reference
KoCanvasBase is the interface actual application canvas classes should implement. More...
#include <KoCanvasBase.h>
Inherited by SimpleCanvas.
Public Member Functions | |
| KoCanvasBase (KoShapeControllerBase *shapeControllerBase) | |
| virtual | ~KoCanvasBase () |
| virtual void | addCommand (QUndoCommand *command)=0 |
| KoCanvasController * | canvasController () const |
| virtual const QWidget * | canvasWidget () const =0 |
| virtual QWidget * | canvasWidget ()=0 |
| virtual void | clipToDocument (const KoShape *shape, QPointF &move) const |
| virtual QPoint | documentOrigin () const |
| virtual void | ensureVisible (const QRectF &rect) |
| virtual void | gridSize (qreal *horizontal, qreal *vertical) const =0 |
| virtual KoGuidesData * | guidesData () |
| KoCanvasResourceProvider * | resourceProvider () const |
| KoShapeController * | shapeController () const |
| virtual KoShapeManager * | shapeManager () const =0 |
| KoSnapGuide * | snapGuide () const |
| virtual bool | snapToGrid () const =0 |
| virtual KoToolProxy * | toolProxy () const =0 |
| virtual KoUnit | unit () const =0 |
| virtual void | updateCanvas (const QRectF &rc)=0 |
| virtual void | updateInputMethodInfo ()=0 |
| virtual const KoViewConverter * | viewConverter () const =0 |
Protected Member Functions | |
| void | setCanvasController (KoCanvasController *controller) |
Detailed Description
KoCanvasBase is the interface actual application canvas classes should implement.
Flake tools know about the canvas, so they can do things like scroll, redraw, set a cursor etc.
Definition at line 53 of file KoCanvasBase.h.
Constructor & Destructor Documentation
| KoCanvasBase::KoCanvasBase | ( | KoShapeControllerBase * | shapeControllerBase | ) | [explicit] |
The constructor.
- Parameters:
-
shapeControllerBase the implementation of the shapeController that the application provides to allow shapes to be added in multiple views.
Definition at line 47 of file KoCanvasBase.cpp.
| KoCanvasBase::~KoCanvasBase | ( | ) | [virtual] |
Definition at line 55 of file KoCanvasBase.cpp.
Member Function Documentation
| virtual void KoCanvasBase::addCommand | ( | QUndoCommand * | command | ) | [pure virtual] |
Adds a command to the history.
Call this for each command you create. This will also execute the command. This means, most of the application's code will look like MyCommand * cmd = new MyCommand( parameters ); canvas.addCommand( cmd );
Note that the command history takes ownership of the command, it will delete it when the undo limit is reached, or when deleting the command history itself.
- Parameters:
-
command the command to add
| KoCanvasController * KoCanvasBase::canvasController | ( | ) | const |
Return the canvas controller for this canvas.
Definition at line 82 of file KoCanvasBase.cpp.
| virtual const QWidget* KoCanvasBase::canvasWidget | ( | ) | const [pure virtual] |
Return the widget that will be added to the scrollArea.
| virtual QWidget* KoCanvasBase::canvasWidget | ( | ) | [pure virtual] |
Return the widget that will be added to the scrollArea.
Called when the user tries to move the argument shape to allow the application to limit the users movement to stay within the document bounds.
An implementation can alter the parameter move to make sure that if the distance moved is applied to the shape it will not become unreachable for the user. The default implementation does not restrict movement.
- Parameters:
-
shape the shape that will be moved soon. move the distance the caller intends to move the shape.
Definition at line 87 of file KoCanvasBase.cpp.
| virtual QPoint KoCanvasBase::documentOrigin | ( | ) | const [inline, virtual] |
Return the position of the document origin inside the canvas widget, in pixels.
By default the origin of the canvas widget and the position of the document origin are coincident, thus an empty point is returned.
Definition at line 153 of file KoCanvasBase.h.
| void KoCanvasBase::ensureVisible | ( | const QRectF & | rect | ) | [virtual] |
Scrolls the content of the canvas so that the given rect is visible.
The rect is to be specified in document coordinates.
- Parameters:
-
rect the rectangle to make visible
Definition at line 71 of file KoCanvasBase.cpp.
| virtual void KoCanvasBase::gridSize | ( | qreal * | horizontal, | |
| qreal * | vertical | |||
| ) | const [pure virtual] |
retrieve the grid size setting.
The grid spacing will be provided in pt.
- Parameters:
-
horizontal a pointer to a qreal that will be filled with the horizontal grid-spacing vertical a pointer to a qreal that will be filled with the vertical grid-spacing
| KoGuidesData * KoCanvasBase::guidesData | ( | ) | [virtual] |
Returns the guides data.
Applications that want to have guides should reimplement this function and return the KOGuideData object. The default implementation returns 0.
- Returns:
- pointer to the guide data or zero if there is none
Definition at line 96 of file KoCanvasBase.cpp.
| KoCanvasResourceProvider * KoCanvasBase::resourceProvider | ( | ) | const |
Return a pointer to the resource provider associated with this canvas.
The resource provider contains per-canvas settings such as current foreground and background color.
Definition at line 66 of file KoCanvasBase.cpp.
| void KoCanvasBase::setCanvasController | ( | KoCanvasController * | controller | ) | [protected] |
called by KoCanvasController to set the controller that handles this canvas.
Definition at line 77 of file KoCanvasBase.cpp.
| KoShapeController * KoCanvasBase::shapeController | ( | ) | const |
Return the shape controller for this canvas.
A shape controller is used to create or delete shapes and show the relevant dialogs to the user.
Definition at line 61 of file KoCanvasBase.cpp.
| virtual KoShapeManager* KoCanvasBase::shapeManager | ( | ) | const [pure virtual] |
return the current shapeManager
- Returns:
- the current shapeManager
| KoSnapGuide * KoCanvasBase::snapGuide | ( | ) | const |
Returns the snap guide of the canvas.
Definition at line 91 of file KoCanvasBase.cpp.
| virtual bool KoCanvasBase::snapToGrid | ( | ) | const [pure virtual] |
return if snap to grid is enabled.
- Returns:
- if snap to grid is enabled.
| virtual KoToolProxy* KoCanvasBase::toolProxy | ( | ) | const [pure virtual] |
Return the proxy to the active tool (determining which tool is really, really active is hard when tablets are involved, so leave that to others.
| virtual KoUnit KoCanvasBase::unit | ( | ) | const [pure virtual] |
Return the unit of the current document for initialization of the widgets created by the flake framework.
- See also:
- KoDocument::unit()
| virtual void KoCanvasBase::updateCanvas | ( | const QRectF & | rc | ) | [pure virtual] |
Tell the canvas to repaint the specified rectangle.
The coordinates are document coordinates, not view coordinates.
| virtual void KoCanvasBase::updateInputMethodInfo | ( | ) | [pure virtual] |
This method should somehow call QWidget::updateMicroFocus() on the canvas widget.
| virtual const KoViewConverter* KoCanvasBase::viewConverter | ( | ) | const [pure virtual] |
Return the viewConverter for this view.
- Returns:
- the viewConverter for this view.
The documentation for this class was generated from the following files:
