00001 //------------------------------------------------------------------------------ 00002 // This file is part of the OpenStructure project <www.openstructure.org> 00003 // 00004 // Copyright (C) 2008-2011 by the OpenStructure authors 00005 // 00006 // This library is free software; you can redistribute it and/or modify it under 00007 // the terms of the GNU Lesser General Public License as published by the Free 00008 // Software Foundation; either version 3.0 of the License, or (at your option) 00009 // any later version. 00010 // This library is distributed in the hope that it will be useful, but WITHOUT 00011 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00012 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00013 // details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with this library; if not, write to the Free Software Foundation, Inc., 00017 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 //------------------------------------------------------------------------------ 00019 #ifndef OST_GUI_TOOL_HH 00020 #define OST_GUI_TOOL_HH 00021 00022 /* 00023 Author: Marco Biasini 00024 */ 00025 #include <vector> 00026 00027 00028 #include <ost/gui/module_config.hh> 00029 #include <ost/gfx/gfx_node.hh> 00030 #include <ost/gui/tools/mouse_event.hh> 00031 #include <ost/gui/tools/tool_options.hh> 00032 00033 #include <QIcon> 00034 00035 namespace ost { namespace gui { 00036 00037 class ToolOptions; 00038 class Tool; 00039 class GLCanvas; 00040 00062 class DLLEXPORT_OST_GUI Tool : public QObject { 00063 Q_OBJECT 00064 protected: 00065 Tool(const String& name); 00066 public: 00067 virtual ~Tool(); 00069 virtual void Click(const MouseEvent& event) { } 00070 00072 virtual void DoubleClick(const MouseEvent& event) { } 00073 00074 virtual void MousePress(const MouseEvent& event) { } 00075 00076 virtual void MouseMove(const MouseEvent& event) { } 00077 00078 virtual void RenderGL() { } 00079 00080 00082 virtual void Activate() { } 00083 00085 virtual void Deactivate() { } 00086 00088 virtual bool CanOperateOn(gfx::NodePtrList nodes)=0; 00089 ToolOptions* GetToolOptions() const; 00090 00091 const String& GetName() const; 00092 00093 virtual QIcon GetIcon() const; 00094 00095 private: 00096 String name_; 00097 ToolOptions* tool_options_; 00098 }; 00099 00100 00105 00106 }} 00107 00108 #endif