Scribus Developer Documentation - API
logo-pen

Scribus Developer Documentation - API

canvasmode.h

Go to the documentation of this file.
00001 /*
00002  For general Scribus (>=1.3.2) copyright and licensing information please refer
00003  to the COPYING file provided with the program. Following this notice may exist
00004  a copyright and/or license notice that predates the release of Scribus 1.3.2
00005  for which a new license (GPL+exception) is in place.
00006  */
00007 /***************************************************************************
00008 *                                                                         *
00009 *   This program is free software; you can redistribute it and/or modify  *
00010 *   it under the terms of the GNU General Public License as published by  *
00011 *   the Free Software Foundation; either version 2 of the License, or     *
00012 *   (at your option) any later version.                                   *
00013 *                                                                         *
00014 ***************************************************************************/
00015 
00016 
00017 
00018 #ifndef CANVAS_MODE_H
00019 #define CANVAS_MODE_H
00020 
00021 #include "scribusapi.h"
00022 
00023 class QDragEnterEvent;
00024 class QDragMoveEvent;
00025 class QDragLeaveEvent;
00026 class QDropEvent;
00027 class QEvent;
00028 class QInputMethodEvent;
00029 class QMouseEvent;
00030 class QKeyEvent;
00031 class QPainter;
00032 
00033 class  Canvas;
00034 struct CanvasViewMode;
00035 class  ScribusDoc;
00036 class  ScribusView;
00037 
00039 enum SubMode
00040 {
00041     submodeFirstSubmode = 1000,
00042     submodePaintingDone,    // return to normal mode
00043     submodeEndNodeEdit,     // return from node/shape editing
00044     submodeLoadPic,         // open GetImage dialog
00045     submodeStatusPic,       // open ManageImages dialog
00046     submodeEditExternal,    // open external image editor
00047     submodeAnnotProps,      // open properties dialog
00048     submodeLastSubmode
00049 };
00050 
00051 
00056 class SCRIBUS_API CanvasMode
00057 {
00058 protected:
00059     CanvasMode (ScribusView* view);
00060     
00061 public:
00062     static CanvasMode* createForAppMode(ScribusView* view, int appMode);
00063     
00069     virtual void activate(bool fromGesture) {}
00074     virtual void deactivate(bool forGesture) {}
00075     
00076     virtual void enterEvent(QEvent *) {}
00077     virtual void leaveEvent(QEvent *) {}
00078 
00079     virtual void dragEnterEvent(QDragEnterEvent *e) {}
00080     virtual void dragMoveEvent(QDragMoveEvent *e) {}
00081     virtual void dragLeaveEvent(QDragLeaveEvent *e) {}
00082     virtual void dropEvent(QDropEvent *e) {}
00083     
00084     virtual void mouseDoubleClickEvent(QMouseEvent *m) {}
00085     virtual void mouseReleaseEvent(QMouseEvent *m) {}
00086     virtual void mouseMoveEvent(QMouseEvent *m) {}
00087     virtual void mousePressEvent(QMouseEvent *m) {}
00088 
00089     virtual void keyPressEvent(QKeyEvent *e) {}
00090     virtual void keyReleaseEvent(QKeyEvent *e) {}
00091     virtual void inputMethodEvent(QInputMethodEvent *e) {}
00092 
00096     virtual void updateViewMode(CanvasViewMode* viewmode);
00097     
00102     virtual void drawControls(QPainter* p) { } 
00103     
00104 
00106     void drawSelection(QPainter* psx);
00108     void drawOutline(QPainter* p, double scalex=1.0, double scaley=1.0, double deltax=0.0, double deltay=0.0);
00109     
00110     void setModeCursor();
00111     
00113     virtual CanvasMode* delegate() { return 0; }
00114     ScribusView* view() const { return m_view; }
00115     virtual ~CanvasMode() {}
00116     
00117 
00118 protected:
00119     ScribusView * const m_view; 
00120     Canvas * const m_canvas;
00121     ScribusDoc * const m_doc;
00122 };
00123 
00124 
00125 #endif
Created with personalized Doxygen. This is documentation for GPL software Scribus - Open Source Desktop Publishing.