OpenStructure
Loading...
Searching...
No Matches
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-2020 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
29#include <ost/gfx/gfx_node.hh>
32
33#include <QIcon>
34
35namespace ost { namespace gui {
36
37class ToolOptions;
38class Tool;
39class GLCanvas;
40
62class DLLEXPORT_OST_GUI Tool : public QObject {
63 Q_OBJECT
64protected:
65 Tool(const String& name);
66public:
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;
90
91 const String& GetName() const;
92
93 virtual QIcon GetIcon() const;
94
95private:
96 String name_;
97 ToolOptions* tool_options_;
98};
99
100
105
106}}
107
108#endif
base class for tools
Definition tool.hh:62
virtual void DoubleClick(const MouseEvent &event)
Real click.
Definition tool.hh:72
const String & GetName() const
virtual void MousePress(const MouseEvent &event)
Definition tool.hh:74
virtual ~Tool()
virtual void Activate()
called when the tool becomes active
Definition tool.hh:82
virtual bool CanOperateOn(gfx::NodePtrList nodes)=0
whether the tool is capable of manipulating the given node
virtual void RenderGL()
Definition tool.hh:78
ToolOptions * GetToolOptions() const
Tool(const String &name)
virtual void Deactivate()
called when the tool becomes inactive
Definition tool.hh:85
virtual void MouseMove(const MouseEvent &event)
Definition tool.hh:76
virtual void Click(const MouseEvent &event)
left mouse click
Definition tool.hh:69
virtual QIcon GetIcon() const
#define DLLEXPORT_OST_GUI
std::string String
Definition base.hh:54
std::vector< GfxNodeP > NodePtrList
Definition base.dox:1