OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
tool.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_GUI_TOOL_HH
20 #define OST_GUI_TOOL_HH
21 
22 /*
23  Author: Marco Biasini
24  */
25 #include <vector>
26 
27 
28 #include <ost/gui/module_config.hh>
29 #include <ost/gfx/gfx_node.hh>
32 
33 #include <QIcon>
34 
35 namespace ost { namespace gui {
36 
37 class ToolOptions;
38 class Tool;
39 class GLCanvas;
40 
62 class DLLEXPORT_OST_GUI Tool : public QObject {
63  Q_OBJECT
64 protected:
65  Tool(const String& name);
66 public:
67  virtual ~Tool();
69  virtual void Click(const MouseEvent& event) { }
70 
72  virtual void DoubleClick(const MouseEvent& event) { }
73 
74  virtual void MousePress(const MouseEvent& event) { }
75 
76  virtual void MouseMove(const MouseEvent& event) { }
77 
78  virtual void RenderGL() { }
79 
80 
82  virtual void Activate() { }
83 
85  virtual void Deactivate() { }
86 
88  virtual bool CanOperateOn(gfx::NodePtrList nodes)=0;
89  ToolOptions* GetToolOptions() const;
90 
91  const String& GetName() const;
92 
93  virtual QIcon GetIcon() const;
94 
95 private:
96  String name_;
97  ToolOptions* tool_options_;
98 };
99 
100 
105 
106 }}
107 
108 #endif
virtual void MouseMove(const MouseEvent &event)
Definition: tool.hh:76
std::string String
Definition: base.hh:54
base class for tools
Definition: tool.hh:62
virtual void RenderGL()
Definition: tool.hh:78
virtual void DoubleClick(const MouseEvent &event)
Real click.
Definition: tool.hh:72
virtual void MousePress(const MouseEvent &event)
Definition: tool.hh:74
#define DLLEXPORT_OST_GUI
virtual void Click(const MouseEvent &event)
left mouse click
Definition: tool.hh:69
virtual void Activate()
called when the tool becomes active
Definition: tool.hh:82
std::vector< GfxNodeP > NodePtrList
Definition: gfx_node_fw.hh:34
virtual void Deactivate()
called when the tool becomes inactive
Definition: tool.hh:85