Isis 3 Developer Reference
Tool.h
Go to the documentation of this file.
1 #ifndef Tool_h
2 #define Tool_h
3 
27 #include <QObject>
28 
29 #include <QDebug>
30 #include <QPoint>
31 
32 class QAction;
33 class QMenu;
34 class QPainter;
35 //class QPoint;
36 class QStackedWidget;
37 class QToolBar;
38 
39 template< class T > class QVector;
40 
41 
42 namespace Isis {
43  class CubeViewport;
44  class MdiCubeViewport;
45  class RubberBandTool;
46  class ToolList;
47  class ToolPad;
48  class ViewportMainWindow;
49  class Workspace;
50 
81  class Tool : public QObject {
82  Q_OBJECT
83 
84  public:
85  Tool(QWidget *parent);
86 
87  void addTo(ViewportMainWindow *mw);
88 
89  void addTo(ToolPad *toolpad);
90 
97  virtual QString menuName() const {
98  return "";
99  }
100 
101 
105  virtual void addTo(QMenu *menu) {};
106 
107 
111  virtual void addToPermanent(QToolBar *toolbar) {};
112 
113  void addToActive(QToolBar *toolbar);
114 
118  virtual void addTo(Workspace *ws);
119 
120 
127  QString toolIconDir() const {
128  return m_toolIconDir;
129  };
130 
131 
136  virtual void paintViewport(MdiCubeViewport *vp, QPainter *painter) {}
137 
139  void setList(ToolList *currentList);
140 
141  public slots:
142  void activate(bool);
143  virtual void updateTool();
144  void setCubeViewport(MdiCubeViewport *cvp);
145 
146 
147  signals:
148  void clearWarningSignal();
149  void toolActivated();
150 
151  protected slots:
152 
155  virtual void rubberBandComplete() { }
156 
157 
162  virtual void screenPixelsChanged() {}
163 
166  virtual void mouseEnter() {}
167 
168  virtual void mouseMove(QPoint p);
169  virtual void mouseMove(QPoint p, Qt::MouseButton) {}
170 
173  virtual void mouseLeave() {};
174 
175  virtual void mouseDoubleClick(QPoint p);
176  virtual void mouseButtonPress(QPoint p, Qt::MouseButton s);
177  virtual void mouseButtonRelease(QPoint p, Qt::MouseButton s);
178 
181  virtual void updateMeasure() {}
182 
183 
186  virtual void scaleChanged() {}
187 
188 
191  virtual void stretchRequested(MdiCubeViewport *, int) {}
192 
193 
197  void registerTool(MdiCubeViewport *viewport);
198 
199 
200  signals:
203  void viewportChanged();
204 
205  protected:
211  inline MdiCubeViewport *cubeViewport() const {
212  return m_cvp;
213  }
214 
215 
220 
222 
223 
231  virtual QAction *toolPadAction(ToolPad *toolpad) {
232  return NULL;
233  }
234 
235 
243  virtual QWidget *createToolBarWidget(QStackedWidget *parent) {
244  return NULL;
245  }
246 
247 
253  virtual void addConnections(MdiCubeViewport *cvp) {}
254 
255 
261  virtual void removeConnections(MdiCubeViewport *cvp) {}
262 
263 
265  virtual void enableRubberBandTool();
266 
267  Workspace *workspace();
268 
269  private:
270  void addViewportConnections();
271  void removeViewportConnections();
272  void enableToolBar();
273  void disableToolBar();
274 
275  MdiCubeViewport *m_cvp;
276  Workspace *m_workspace;
277 
278  bool m_active;
279  QWidget *m_toolBarWidget;
280  QAction *m_toolPadAction;
281  QString m_toolIconDir;
282  ToolList *m_toolList;
283  };
284 }
285 
286 #endif
Cube display widget for certain Isis MDI applications.
Definition: MdiCubeViewport.h:53
virtual void screenPixelsChanged()
This is called when actions change which pixels from the cube are displayed.
Definition: Tool.h:162
virtual void removeConnections(MdiCubeViewport *cvp)
Anytime a tool is created, you must be able to remove it&#39;s connections.
Definition: Tool.h:261
QString toolIconDir() const
returns the path to the icon directory.
Definition: Tool.h:127
void registerTool(MdiCubeViewport *viewport)
Registers the tool to the viewport.
Definition: Tool.cpp:327
virtual QAction * toolPadAction(ToolPad *toolpad)
Anytime a tool is created, you must setup a tool pad action with it.
Definition: Tool.h:231
void addToActive(QToolBar *toolbar)
Definition: Tool.cpp:112
void setList(ToolList *currentList)
Definition: Tool.cpp:68
virtual void updateMeasure()
Definition: Tool.h:181
virtual void mouseButtonRelease(QPoint p, Qt::MouseButton s)
Resets the Warning to Nowarning when a different activity occurs on the application.
Definition: Tool.cpp:380
void viewportChanged()
CubeViewportList * cubeViewportList() const
Return the list of cubeviewports.
Definition: Tool.cpp:390
virtual void addToPermanent(QToolBar *toolbar)
Definition: Tool.h:111
void setCubeViewport(MdiCubeViewport *cvp)
Sets the current viewport to the given cvp.
Definition: Tool.cpp:160
virtual void mouseEnter()
Definition: Tool.h:166
RubberBandTool * rubberBandTool()
Definition: Tool.cpp:57
void toolActivated()
This was called the Qisis MainWindow.
Definition: ViewportMainWindow.h:43
Workspace * workspace()
Definition: Tool.cpp:344
virtual void mouseMove(QPoint p, Qt::MouseButton)
Definition: Tool.h:169
Tool(QWidget *parent)
Tool constructor.
Definition: Tool.cpp:27
virtual void mouseDoubleClick(QPoint p)
Definition: Tool.cpp:358
virtual void scaleChanged()
Definition: Tool.h:186
void addTo(ViewportMainWindow *mw)
Adds the tool to the application.
Definition: Tool.cpp:78
void clearWarningSignal()
QVector< MdiCubeViewport *> CubeViewportList
A list of cubeviewports.
Definition: Tool.h:219
virtual void stretchRequested(MdiCubeViewport *, int)
Definition: Tool.h:191
Rubber banding tool.
Definition: RubberBandTool.h:50
Definition: Calculator.h:33
virtual QWidget * createToolBarWidget(QStackedWidget *parent)
Anytime a tool is created, you must add it to the tool bar.
Definition: Tool.h:243
virtual void mouseLeave()
Definition: Tool.h:173
Definition: Workspace.h:90
virtual void paintViewport(MdiCubeViewport *vp, QPainter *painter)
Definition: Tool.h:136
virtual void mouseButtonPress(QPoint p, Qt::MouseButton s)
Definition: Tool.cpp:367
virtual void updateTool()
Updates the tool.
Definition: Tool.cpp:318
virtual void rubberBandComplete()
Definition: Tool.h:155
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
Base class for the Qisis tools.
Definition: Tool.h:81
virtual void enableRubberBandTool()
Anytime a tool is created, you may use the rubber band tool.
Definition: Tool.cpp:339
MdiCubeViewport * cubeViewport() const
Return the current cubeviewport.
Definition: Tool.h:211
virtual QString menuName() const
Anytime a tool is created, you must give it a name for the menu.
Definition: Tool.h:97
void activate(bool)
Activates the tool.
Definition: Tool.cpp:131
virtual void addConnections(MdiCubeViewport *cvp)
Anytime a tool is created, you must add the connections for it.
Definition: Tool.h:253
virtual void addTo(QMenu *menu)
Definition: Tool.h:105
Allows tools to share data between each other.
Definition: ToolList.h:46
Definition: ToolPad.h:14
virtual void mouseMove(QPoint p)
Definition: Tool.cpp:352