#include <KoCanvasBase.h>
Public Member Functions | |
| KoCanvasBase (KoShapeControllerBase *shapeControllerBase) | |
| The constructor. | |
| virtual void | gridSize (double *horizontal, double *vertical) const =0 |
| retrieve the grid size setting. | |
| virtual bool | snapToGrid () const =0 |
| return if snap to grid is enabled. | |
| virtual void | addCommand (QUndoCommand *command)=0 |
| Adds a command to the history. | |
| virtual KoShapeManager * | shapeManager () const =0 |
| return the current shapeManager | |
| virtual void | updateCanvas (const QRectF &rc)=0 |
| Tell the canvas to repaint the specified rectangle. | |
| virtual KoToolProxy * | toolProxy () const =0 |
| 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 const KoViewConverter * | viewConverter () const =0 |
| Return the viewConverter for this view. | |
| virtual QWidget * | canvasWidget ()=0 |
| Return the widget that will be added to the scrollArea. | |
| virtual KoUnit | unit () const =0 |
| Return the unit of the current document for initialization of the widgets created by the flake framework. | |
| virtual void | clipToDocument (const KoShape *shape, QPointF &move) const |
| 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. | |
| virtual QPoint | documentOrigin () const |
| Return the position of the document origin inside the canvas widget, in pixels. | |
| virtual void | updateInputMethodInfo ()=0 |
| This method should somehow call QWidget::updateMicroFocus() on the canvas widget. | |
| KoCanvasResourceProvider * | resourceProvider () const |
| Return a pointer to the resource provider associated with this canvas. | |
| KoShapeController * | shapeController () const |
| Return the shape controller for this canvas. | |
| KoCanvasController * | canvasController () const |
| Return the canvas controller for this canvas. | |
| virtual void | ensureVisible (const QRectF &rect) |
| Scrolls the content of the canvas so that the given rect is visible. | |
| KoSnapGuide * | snapGuide () const |
| Returns the snap guide of the canvas. | |
| virtual KoGuidesData * | guidesData () |
| Returns the guides data. | |
Protected Member Functions | |
| void | setCanvasController (KoCanvasController *controller) |
| called by KoCanvasController to set the controller that handles this canvas. | |
| bool | isAntialiased () const |
| Return true if the canvas is painted with antialiasing turned on. | |
Friends | |
| class | KoCanvasController |
Flake tools know about the canvas, so they can do things like scroll, redraw, set a cursor etc.
| KoCanvasBase::KoCanvasBase | ( | KoShapeControllerBase * | shapeControllerBase | ) | [explicit] |
The constructor.
| shapeControllerBase | the implementation of the shapeController that the application provides to allow shapes to be added in multiple views. |
| 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.
| command | the command to add |
Implemented in KoPACanvas.
| void KoCanvasBase::clipToDocument | ( | const KoShape * | shape, | |
| QPointF & | move | |||
| ) | const [virtual] |
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.
| shape | the shape that will be moved soon. | |
| move | the distance the caller intends to move the shape. |
| 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.
| 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.
| rect | the rectangle to make visible |
| virtual void KoCanvasBase::gridSize | ( | double * | horizontal, | |
| double * | vertical | |||
| ) | const [pure virtual] |
retrieve the grid size setting.
The grid spacing will be provided in pt.
| horizontal | a pointer to a double that will be filled with the horizontal grid-spacing | |
| vertical | a pointer to a double that will be filled with the vertical grid-spacing |
Implemented in KoPACanvas.
| 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.
Reimplemented in KoPACanvas.
| 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.
| 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.
| virtual KoShapeManager* KoCanvasBase::shapeManager | ( | ) | const [pure virtual] |
| virtual bool KoCanvasBase::snapToGrid | ( | ) | const [pure virtual] |
| virtual KoUnit KoCanvasBase::unit | ( | ) | const [pure virtual] |
Return the unit of the current document for initialization of the widgets created by the flake framework.
Implemented in KoPACanvas.
| 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.
Implemented in KoPACanvas.
| virtual const KoViewConverter* KoCanvasBase::viewConverter | ( | ) | const [pure virtual] |
Return the viewConverter for this view.
Implemented in KoPACanvas.
1.4.7