USGS

Isis 3.0 Developer's Reference (API)

Home

Tool.h

Go to the documentation of this file.
00001 #ifndef Qisis_Tool_h
00002 #define Qisis_Tool_h
00003 
00027 #include <QObject>
00028 
00029 // FIXME: remove this include!
00030 #include <QPoint>
00031 
00032 
00033 class QAction;
00034 class QMenu;
00035 class QPainter;
00036 //class QPoint;
00037 class QStackedWidget;
00038 class QToolBar;
00039 
00040 template< class T > class QVector;
00041 
00042 
00043 namespace Isis {
00044   class CubeViewport;
00045   class MdiCubeViewport;
00046   class ToolPad;
00047   class ViewportMainWindow;
00048   class Workspace;
00049 
00077   class Tool : public QObject {
00078       Q_OBJECT
00079 
00080     public:
00081       Tool(QWidget *parent);
00082 
00083       void addTo(ViewportMainWindow *mw);
00084 
00085       void addTo(ToolPad *toolpad);
00086 
00092       virtual void addTo(QMenu *menu) {};
00093 
00094 
00100       virtual void addToPermanent(QToolBar *toolbar) {};
00101 
00102       void addToActive(QToolBar *toolbar);
00103 
00109       virtual void addTo(Workspace *ws);
00110 
00111 
00118       QString toolIconDir() const {
00119         return p_toolIconDir;
00120       };
00121 
00122 
00129       virtual void paintViewport(MdiCubeViewport *vp, QPainter *painter) {};
00130 
00131 
00132     public slots:
00133       void activate(bool);
00134       virtual void updateTool();
00135       void setCubeViewport(MdiCubeViewport *cvp);
00136 
00137 
00138     signals:
00139       void clearWarningSignal();
00140 
00141     protected slots:
00142 
00145       virtual void rubberBandComplete() {};
00146 
00147 
00152       virtual void screenPixelsChanged() {};
00153 
00156       virtual void mouseEnter() {};
00157 
00158       virtual void mouseMove(QPoint p);
00159       virtual void mouseMove(QPoint p, Qt::MouseButton) {}
00160 
00163       virtual void mouseLeave() {};
00164 
00165       virtual void mouseDoubleClick(QPoint p);
00166       virtual void mouseButtonPress(QPoint p, Qt::MouseButton s);
00167       virtual void mouseButtonRelease(QPoint p, Qt::MouseButton s);
00168 
00171       virtual void updateMeasure() {};
00172 
00173 
00176       virtual void scaleChanged() {};
00177 
00178 
00181       virtual void stretchRequested(MdiCubeViewport *, int) {};
00182 
00183 
00187       void registerTool(MdiCubeViewport *viewport);
00188 
00189 
00190     signals:
00193       void viewportChanged();
00194 
00195     protected:
00201       inline MdiCubeViewport *cubeViewport() const {
00202         return p_cvp;
00203       };
00204 
00205 
00209       typedef QVector< MdiCubeViewport * > CubeViewportList;
00210 
00211       CubeViewportList *cubeViewportList() const;
00212 
00213 
00221       virtual QAction *toolPadAction(ToolPad *toolpad) {
00222         return NULL;
00223       };
00224 
00225 
00232       virtual QString menuName() const {
00233         return "";
00234       };
00235 
00236 
00244       virtual QWidget *createToolBarWidget(QStackedWidget *parent) {
00245         return NULL;
00246       };
00247 
00248 
00254       virtual void addConnections(MdiCubeViewport *cvp) {};
00255 
00256 
00262       virtual void removeConnections(MdiCubeViewport *cvp) {};
00263 
00264 
00266       virtual void enableRubberBandTool();
00267 
00268       MdiCubeViewport *p_cvp;  
00269       Workspace *p_workspace;
00270 
00271     private:
00272       void addViewportConnections();
00273       void removeViewportConnections();
00274       void enableToolBar();
00275       void disableToolBar();
00276 
00277       bool p_active;            
00278       QWidget *p_toolBarWidget;  
00279       QAction *p_toolPadAction;  
00280       QString p_toolIconDir;    
00281       static QStackedWidget *p_activeToolBarStack;  
00282   };
00283 };
00284 
00285 #endif