Isis 3 Programmer Reference
Tool.h
1 #ifndef Tool_h
2 #define Tool_h
3 
10 /* SPDX-License-Identifier: CC0-1.0 */
11 
12 
13 #include <QObject>
14 
15 #include <QDebug>
16 #include <QPoint>
17 
18 class QAction;
19 class QMenu;
20 class QPainter;
21 //class QPoint;
22 class QStackedWidget;
23 class QToolBar;
24 
25 template< class T > class QVector;
26 
27 
28 namespace Isis {
29  class CubeViewport;
30  class MdiCubeViewport;
31  class RubberBandTool;
32  class ToolList;
33  class ToolPad;
34  class ViewportMainWindow;
35  class Workspace;
36 
67  class Tool : public QObject {
68  Q_OBJECT
69 
70  public:
71  Tool(QWidget *parent);
72 
73  void addTo(ViewportMainWindow *mw);
74 
75  void addTo(ToolPad *toolpad);
76 
83  virtual QString menuName() const {
84  return "";
85  }
86 
87 
91  virtual void addTo(QMenu *menu) {};
92 
93 
97  virtual void addToPermanent(QToolBar *toolbar) {};
98 
99  void addToActive(QToolBar *toolbar);
100 
104  virtual void addTo(Workspace *ws);
105 
106 
113  QString toolIconDir() const {
114  return m_toolIconDir;
115  };
116 
117 
122  virtual void paintViewport(MdiCubeViewport *vp, QPainter *painter) {}
123 
124  RubberBandTool *rubberBandTool();
125  void setList(ToolList *currentList);
126 
127  public slots:
128  void activate(bool);
129  virtual void updateTool();
130  void setCubeViewport(MdiCubeViewport *cvp);
131 
132 
133  signals:
134  void clearWarningSignal();
135  void toolActivated();
136 
137  protected slots:
138 
141  virtual void rubberBandComplete() { }
142 
143 
148  virtual void screenPixelsChanged() {}
149 
152  virtual void mouseEnter() {}
153 
154  virtual void mouseMove(QPoint p);
155  virtual void mouseMove(QPoint p, Qt::MouseButton) {}
156 
159  virtual void mouseLeave() {};
160 
161  virtual void mouseDoubleClick(QPoint p);
162  virtual void mouseButtonPress(QPoint p, Qt::MouseButton s);
163  virtual void mouseButtonRelease(QPoint p, Qt::MouseButton s);
164 
167  virtual void updateMeasure() {}
168 
169 
172  virtual void scaleChanged() {}
173 
174 
177  virtual void stretchRequested(MdiCubeViewport *, int) {}
178 
179 
183  void registerTool(MdiCubeViewport *viewport);
184 
185 
186  signals:
189  void viewportChanged();
190 
191  protected:
197  inline MdiCubeViewport *cubeViewport() const {
198  return m_cvp;
199  }
200 
201 
206 
208 
209 
217  virtual QAction *toolPadAction(ToolPad *toolpad) {
218  return NULL;
219  }
220 
221 
229  virtual QWidget *createToolBarWidget(QStackedWidget *parent) {
230  return NULL;
231  }
232 
233 
239  virtual void addConnections(MdiCubeViewport *cvp) {}
240 
241 
247  virtual void removeConnections(MdiCubeViewport *cvp) {}
248 
249 
251  virtual void enableRubberBandTool();
252 
253  Workspace *workspace();
254 
255  private:
256  void addViewportConnections();
258  void enableToolBar();
259  void disableToolBar();
260 
262  Workspace *m_workspace;
263 
264  bool m_active;
267  QString m_toolIconDir;
268  ToolList *m_toolList;
269  };
270 }
271 
272 #endif
Isis::Tool::addConnections
virtual void addConnections(MdiCubeViewport *cvp)
Anytime a tool is created, you must add the connections for it.
Definition: Tool.h:239
Isis::Tool::updateTool
virtual void updateTool()
Updates the tool.
Definition: Tool.cpp:318
Isis::MdiCubeViewport
Cube display widget for certain Isis MDI applications.
Definition: MdiCubeViewport.h:39
QWidget
Isis::ToolList
Allows tools to share data between each other.
Definition: ToolList.h:32
Isis::Tool::registerTool
void registerTool(MdiCubeViewport *viewport)
Registers the tool to the viewport.
Definition: Tool.cpp:327
Isis::Tool::m_toolPadAction
QAction * m_toolPadAction
The tool pad on which this tool resides.
Definition: Tool.h:266
Isis::Tool::menuName
virtual QString menuName() const
Anytime a tool is created, you must give it a name for the menu.
Definition: Tool.h:83
Isis::Tool::cubeViewportList
CubeViewportList * cubeViewportList() const
Return the list of cubeviewports.
Definition: Tool.cpp:390
Isis::Tool::screenPixelsChanged
virtual void screenPixelsChanged()
This is called when actions change which pixels from the cube are displayed.
Definition: Tool.h:148
Isis::Tool::removeConnections
virtual void removeConnections(MdiCubeViewport *cvp)
Anytime a tool is created, you must be able to remove it's connections.
Definition: Tool.h:247
Isis::Tool
Base class for the Qisis tools.
Definition: Tool.h:67
QMenu
Isis::Tool::toolIconDir
QString toolIconDir() const
returns the path to the icon directory.
Definition: Tool.h:113
Isis::Tool::mouseButtonRelease
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
Isis::Tool::addToPermanent
virtual void addToPermanent(QToolBar *toolbar)
Definition: Tool.h:97
Isis::Tool::m_toolBarWidget
QWidget * m_toolBarWidget
The tool bar on which this tool resides.
Definition: Tool.h:265
Isis::Tool::m_cvp
MdiCubeViewport * m_cvp
current cubeviewport
Definition: Tool.h:261
Isis::Tool::m_active
bool m_active
Is the tool acitve?
Definition: Tool.h:264
Isis::Tool::toolPadAction
virtual QAction * toolPadAction(ToolPad *toolpad)
Anytime a tool is created, you must setup a tool pad action with it.
Definition: Tool.h:217
Isis::Tool::enableToolBar
void enableToolBar()
Enables entire tool bar.
Definition: Tool.cpp:297
QToolBar
Isis::Tool::disableToolBar
void disableToolBar()
Disables entire tool bar.
Definition: Tool.cpp:285
Isis::Tool::Tool
Tool(QWidget *parent)
Tool constructor.
Definition: Tool.cpp:27
Isis::Tool::setCubeViewport
void setCubeViewport(MdiCubeViewport *cvp)
Sets the current viewport to the given cvp.
Definition: Tool.cpp:160
Isis::ViewportMainWindow
This was called the Qisis MainWindow.
Definition: ViewportMainWindow.h:43
Isis::Tool::CubeViewportList
QVector< MdiCubeViewport * > CubeViewportList
A list of cubeviewports.
Definition: Tool.h:205
Isis::Tool::addTo
void addTo(ViewportMainWindow *mw)
Adds the tool to the application.
Definition: Tool.cpp:78
Isis::Tool::paintViewport
virtual void paintViewport(MdiCubeViewport *vp, QPainter *painter)
Definition: Tool.h:122
Isis::Tool::enableRubberBandTool
virtual void enableRubberBandTool()
Anytime a tool is created, you may use the rubber band tool.
Definition: Tool.cpp:339
Isis::Tool::removeViewportConnections
void removeViewportConnections()
Removes all the connections from the tool.
Definition: Tool.cpp:238
Isis::ToolPad
Definition: ToolPad.h:14
Isis::Tool::addViewportConnections
void addViewportConnections()
Makes all the connections for the tool.
Definition: Tool.cpp:187
Isis::Tool::activate
void activate(bool)
Activates the tool.
Definition: Tool.cpp:131
Isis::RubberBandTool
Rubber banding tool.
Definition: RubberBandTool.h:50
Isis::Tool::mouseDoubleClick
virtual void mouseDoubleClick(QPoint p)
Definition: Tool.cpp:358
Isis::Tool::addTo
virtual void addTo(QMenu *menu)
Definition: Tool.h:91
Isis::Tool::addToActive
void addToActive(QToolBar *toolbar)
Definition: Tool.cpp:112
Isis::Tool::mouseMove
virtual void mouseMove(QPoint p)
Definition: Tool.cpp:352
Isis::Workspace
Definition: Workspace.h:78
Isis::Tool::m_toolIconDir
QString m_toolIconDir
The pathway to the icon directory.
Definition: Tool.h:267
QObject
QVector
This is free and unencumbered software released into the public domain.
Definition: Calculator.h:18
QAction
Isis::Tool::mouseButtonPress
virtual void mouseButtonPress(QPoint p, Qt::MouseButton s)
Definition: Tool.cpp:367
Isis::Tool::cubeViewport
MdiCubeViewport * cubeViewport() const
Return the current cubeviewport.
Definition: Tool.h:197
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::Tool::createToolBarWidget
virtual QWidget * createToolBarWidget(QStackedWidget *parent)
Anytime a tool is created, you must add it to the tool bar.
Definition: Tool.h:229