Isis Developer Reference
Tool.h
Go to the documentation of this file.
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 
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:
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:
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();
257  void removeViewportConnections();
258  void enableToolBar();
259  void disableToolBar();
260 
261  MdiCubeViewport *m_cvp;
262  Workspace *m_workspace;
263 
264  bool m_active;
265  QWidget *m_toolBarWidget;
266  QAction *m_toolPadAction;
267  QString m_toolIconDir;
268  ToolList *m_toolList;
269  };
270 }
271 
272 #endif
Isis::Tool::updateMeasure
virtual void updateMeasure()
Definition: Tool.h:167
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
FileName.h
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::ViewportMainWindow::getMenu
QMenu * getMenu(const QString &name)
Returns the menu with menu name = name.
Definition: ViewportMainWindow.cpp:87
MdiCubeViewport.h
Isis::Tool::registerTool
void registerTool(MdiCubeViewport *viewport)
Registers the tool to the viewport.
Definition: Tool.cpp:327
Isis::Tool::setList
void setList(ToolList *currentList)
Definition: Tool.cpp:68
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
ViewportMainWindow.h
Isis::Tool::viewportChanged
void viewportChanged()
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
Isis::FileName
File name manipulation and expansion.
Definition: FileName.h:100
Isis::ToolList::toolBarStack
QStackedWidget * toolBarStack()
Definition: ToolList.cpp:46
QMenu
Isis::Tool::toolIconDir
QString toolIconDir() const
returns the path to the icon directory.
Definition: Tool.h:113
Isis::Tool::rubberBandTool
RubberBandTool * rubberBandTool()
Definition: Tool.cpp:57
Isis::Tool::mouseEnter
virtual void mouseEnter()
Definition: Tool.h:152
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::ViewportMainWindow::workspace
Workspace * workspace()
Returns the current workspace.
Definition: ViewportMainWindow.h:58
Isis::Tool::addToPermanent
virtual void addToPermanent(QToolBar *toolbar)
Definition: Tool.h:97
Tool.h
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
ToolPad.h
QToolBar
IString.h
CubeViewport.h
Isis::ViewportMainWindow::activeToolBar
QToolBar * activeToolBar()
Returns the active toolbar.
Definition: ViewportMainWindow.h:68
Isis::Tool::mouseMove
virtual void mouseMove(QPoint p, Qt::MouseButton)
Definition: Tool.h:155
Isis::Tool::Tool
Tool(QWidget *parent)
Tool constructor.
Definition: Tool.cpp:27
Isis::FileName::expanded
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
Definition: FileName.cpp:196
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::toolActivated
void toolActivated()
Isis::Tool::CubeViewportList
QVector< MdiCubeViewport * > CubeViewportList
A list of cubeviewports.
Definition: Tool.h:205
Isis::Tool::workspace
Workspace * workspace()
Definition: Tool.cpp:344
Isis::ToolList::rubberBandTool
RubberBandTool * rubberBandTool()
Definition: ToolList.cpp:41
Isis::ViewportMainWindow::toolPad
ToolPad * toolPad()
Returns the toolpad.
Definition: ViewportMainWindow.h:73
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
Workspace.h
Isis::ViewportMainWindow::permanentToolBar
QToolBar * permanentToolBar()
Returns the permanent toolbar.
Definition: ViewportMainWindow.h:63
Isis::Tool::scaleChanged
virtual void scaleChanged()
Definition: Tool.h:172
Isis::Tool::stretchRequested
virtual void stretchRequested(MdiCubeViewport *, int)
Definition: Tool.h:177
Isis::Tool::enableRubberBandTool
virtual void enableRubberBandTool()
Anytime a tool is created, you may use the rubber band tool.
Definition: Tool.cpp:339
Isis::ToolPad
Definition: ToolPad.h:14
Isis::Tool::clearWarningSignal
void clearWarningSignal()
Isis::Tool::activate
void activate(bool)
Activates the tool.
Definition: Tool.cpp:131
Isis::RubberBandTool
Rubber banding tool.
Definition: RubberBandTool.h:50
Isis::ToolPad::addAction
void addAction(QAction *action)
Adds an action to the action group and tool bar.
Definition: ToolPad.h:38
Isis::Tool::mouseDoubleClick
virtual void mouseDoubleClick(QPoint p)
Definition: Tool.cpp:358
Isis::Workspace::cubeViewportList
QVector< MdiCubeViewport * > * cubeViewportList()
This method returns a Vector of MdiCubeViewports.
Definition: Workspace.cpp:238
RubberBandTool.h
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::MdiCubeViewport::registerTool
void registerTool(Tool *tool)
Registers the tool given tool.
Definition: MdiCubeViewport.cpp:47
QObject
QVector
This is free and unencumbered software released into the public domain.
Definition: Calculator.h:18
QAction
Isis::Tool::rubberBandComplete
virtual void rubberBandComplete()
Definition: Tool.h:141
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::RubberBandTool::disable
void disable()
This is called when something is not using me, so turn off events, reset & repaint to clear the clear...
Definition: RubberBandTool.cpp:322
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
Isis::Tool::mouseLeave
virtual void mouseLeave()
Definition: Tool.h:159
ToolList.h