libs/flake
KoCanvasController.hGo to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef KOCANVASCONTROLLER_H
00025 #define KOCANVASCONTROLLER_H
00026
00027 #include "flake_export.h"
00028
00029 #include <QAbstractScrollArea>
00030
00031 class KoShape;
00032 class KoCanvasBase;
00033 class KoView;
00034
00055 class FLAKE_EXPORT KoCanvasController : public QAbstractScrollArea
00056 {
00057 Q_OBJECT
00058 public:
00060 enum CanvasMode {
00061 AlignTop,
00062 Centered,
00063 Infinite,
00064 Presentation
00065 };
00066
00071 explicit KoCanvasController(QWidget *parent = 0);
00072 virtual ~KoCanvasController();
00076 void scrollContentsBy(int dx, int dy);
00077
00085 void setDrawShadow(bool drawShadow);
00086
00094 void setCanvas(KoCanvasBase *canvas);
00099 KoCanvasBase* canvas() const;
00100
00107 void changeCanvasWidget(QWidget *widget);
00108
00113 int visibleHeight() const;
00118 int visibleWidth() const;
00123 int canvasOffsetX() const;
00128 int canvasOffsetY() const;
00129
00134 void setCanvasMode(CanvasMode mode);
00135
00137 CanvasMode canvasMode() const;
00138
00140 bool isCanvasOpenGL() const;
00141
00143 virtual bool eventFilter(QObject *watched, QEvent *event);
00144
00154 void ensureVisible(const QRectF &rect, bool smooth = false);
00155
00163 void ensureVisible(KoShape *shape);
00164
00174 void setToolOptionWidgets(const QMap<QString, QWidget *> &);
00175
00184 void zoomIn(const QPoint ¢er);
00185
00194 void zoomOut(const QPoint ¢er);
00195
00205 void zoomBy(const QPoint ¢er, qreal zoom);
00206
00215 void zoomTo(const QRect &rect);
00216
00226 void recenterPreferred();
00227
00232 void setPreferredCenter(const QPoint &viewPoint);
00233
00235 QPoint preferredCenter() const;
00236
00241 void pan(const QPoint &distance);
00242
00247 int margin() const;
00248
00252 void setMargin(int margin);
00253
00257 QPoint scrollBarValue() const;
00258
00263 void setScrollBarValue(const QPoint &value);
00264
00265 signals:
00270 void canvasRemoved(KoCanvasController *cv);
00275 void canvasSet(KoCanvasController *cv);
00276
00281 void canvasOffsetXChanged(int offset);
00282
00287 void canvasOffsetYChanged(int offset);
00288
00293 void canvasMousePositionChanged(const QPoint &pos);
00294
00299 void documentMousePositionChanged(const QPointF &pos);
00300
00305 void sizeChanged(const QSize &size);
00306
00310 void toolOptionWidgetsChanged(const QMap<QString, QWidget *> &, QWidget *);
00311
00315 void toolOptionWidgetsChanged(const QMap<QString, QWidget *> &);
00316
00323 void moveDocumentOffset(const QPoint &point);
00324
00332 void zoomBy(const qreal factor);
00333
00334 public slots:
00335
00343 void setDocumentSize(const QSize &newSize, bool recalculateCenter = true);
00344
00350 void addGuideLine(Qt::Orientation orientation, int viewPosition);
00351
00352 protected slots:
00353
00355 void updateCanvasOffsetX();
00356
00358 void updateCanvasOffsetY();
00359
00360 protected:
00362 virtual void paintEvent(QPaintEvent *event);
00364 virtual void resizeEvent(QResizeEvent *resizeEvent);
00366 virtual void dragEnterEvent(QDragEnterEvent *event);
00368 virtual void dropEvent(QDropEvent *event);
00370 virtual void dragMoveEvent(QDragMoveEvent *event);
00372 virtual void dragLeaveEvent(QDragLeaveEvent *event);
00374 virtual void wheelEvent(QWheelEvent *event);
00376 virtual void keyPressEvent(QKeyEvent *event);
00378 virtual bool focusNextPrevChild(bool next);
00379
00380
00381 private:
00382
00383 void setDocumentOffset();
00384
00385 void resetScrollBars();
00386 void emitPointerPositionChangedSignals(QEvent *event);
00387
00388 friend class KoToolManager;
00389
00390 private slots:
00394 void activate();
00395
00396 private:
00397
00398 class Private;
00399 Private * const d;
00400 };
00401
00402 #endif
|