[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: flake canvas
From: Boudewijn Rempt <boud () valdyas ! org>
Date: 2006-03-30 19:05:26
Message-ID: 200603302105.31540.boud () valdyas ! org
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
Zagge and I discussed yesterday the need for some baseline canvas class on
irc; then I got the idea that an interface might be all that's needed. And
surprise, Krita has got one of those: an interface that defines the
interaction between a tool and a canvas.
So -- Zagge, and everybody into flake. How about adding something like
class KoCanvasBase {
public:
KoCanvasBase() {};
virtual ~KoCanvasBase() {};
public:
/**
* @return the value of the horizontal scrollbar.
*/
virtual qint32 horzValue() const = 0;
/**
* @return the value of the vertical scrollbar
*/
virtual qint32 vertValue() const = 0;
/**
* Sets the horizontal and vertical scrollbars to the specified values
*
* @param x the value the horizontal scrollbar is set to
* @param y the value the vertical scrollbar is set to
*/
virtual void scrollTo(qint32 x, qint32 y) = 0;
/**
* Tell all of the canvas to repaint itself.
*/
virtual void updateCanvas() = 0;
/**
* Tell the canvas to repaint the rectangle defined by x, y, w and h.
* The coordinates are document coordinates.
*/
virtual void updateCanvas(qint32 x, qint32 y, qint32 w, qint32 h) = 0;
/**
* Tell the canvas repaint the specified rectangle. The coordinates
* are document coordinates, not view coordinates.
*/
virtual void updateCanvas(const QRect& rc) = 0;
/**
* Increase the zoomlevel one step
*/
virtual void zoomIn() = 0;
/**
* Increase the zoomlevel one step and make sure that x,y is the center
point of the view.
*
* @param x The x coordinate of the visible point in document coordinates
* @param y the y coordinate of the visible point in document coordinates
*/
virtual void zoomIn(qint32 x, qint32 y) = 0;
/**
* Decrease the zoomlevel one step
*/
virtual void zoomOut() = 0;
/**
* Decrease the zoomlevel one step and make sure that x,y is the center
point of the view.
*
* @param x the x coordinate of the visible point in document coordinates
* @param y the y coordinate of the visible point in document coordinates
*/
virtual void zoomOut(qint32 x, qint32 y) = 0;
/**
* To centre the view on the given point with the given zoom factor.
*
* @param x the x coordinate of the center point in document coordinates
* @param y the y coordinate of the center point in document coordinates
* @param zf the zoomfactor
*/
virtual void zoomAroundPoint(double x, double y, double zf) = 0;
/**
* Make the rect defined by x, y, w and h visible, zooming in or
* out as necessary. The view will be centered around the center point
* of the specified rect.
*/
virtual void zoomTo(qint32 x, qint32 y, qint32 w, qint32 h) = 0;
/**
* Make the rect defined by x, y, w and h visible, zooming in or
* out as necessary. The view will be centered around the center point
* of the specified rect.
*/
virtual void zoomTo(const QRect& r) = 0;
/**
* Make the rect defined by x, y, w and h visible, zooming in or
* out as necessary. The view will be centered around the center point
* of the specified rect.
*/
virtual void zoomTo(const QRectF& r) = 0;
/**
* Conversion functions from view coordinates to document coordinates
*
* You can get the rectangle of the document that's visible using the
* viewToWindow() functions (KoCanvasBase). E.g.
* viewToWindow(QRect(0, 0, canvasWidth, canvasHeight)).
*
* Here, the view is the canvas widget in the view widget, and the window
* is the window on the document.
*/
virtual QPoint viewToWindow(const QPoint& pt) = 0;
virtual KisPoint viewToWindow(const KisPoint& pt) = 0;
virtual QRect viewToWindow(const QRect& rc) = 0;
virtual QRectF viewToWindow(const QRectF& rc) = 0;
virtual void viewToWindow(qint32 *x, qint32 *y) = 0;
/**
* Conversion functions from document coordinates to view coordinates
*/
virtual QPoint windowToView(const QPoint& pt) = 0;
virtual KisPoint windowToView(const KisPoint& pt) = 0;
virtual QRect windowToView(const QRect& rc) = 0;
virtual QRectF windowToView(const QRectF& rc) = 0;
virtual void windowToView(qint32 *x, qint32 *y) = 0;
/**
* Set the cursor shown when the pointer is over the canvas widget to
* the specified cursor.
*
* @param cursor the new cursor
* @return the old cursor
*/
virtual QCursor setCanvasCursor(const QCursor & cursor) = 0;
/**
* Set the active input device to the specified input device, This
* could be a mouse, a stylus, an eraser or any other pointing input
* device.
*
* @param inputDevice the new input device
*/
virtual void setInputDevice(KoInputDevice inputDevice) = 0;
/**
* @return the current input device, such as a mouse or a stylus
*/
virtual KoInputDevice currentInputDevice() const = 0;
--
Boudewijn Rempt
http://www.valdyas.org/fading/index.cgi
[Attachment #5 (application/pgp-signature)]
_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic