OpenWalnut
1.4.0
|
00001 //--------------------------------------------------------------------------- 00002 // 00003 // Project: OpenWalnut ( http://www.openwalnut.org ) 00004 // 00005 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS 00006 // For more information see http://www.openwalnut.org/copying 00007 // 00008 // This file is part of OpenWalnut. 00009 // 00010 // OpenWalnut is free software: you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as published by 00012 // the Free Software Foundation, either version 3 of the License, or 00013 // (at your option) any later version. 00014 // 00015 // OpenWalnut is distributed in the hope that it will be useful, 00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 // GNU Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public License 00021 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>. 00022 // 00023 //--------------------------------------------------------------------------- 00024 00025 #ifndef WCUSTOMWIDGET_H 00026 #define WCUSTOMWIDGET_H 00027 00028 #include <string> 00029 00030 #include <boost/shared_ptr.hpp> 00031 00032 #include <osg/ref_ptr> 00033 00034 #include "../graphicsEngine/WGEViewer.h" 00035 00036 class WGEGroupNode; 00037 00038 /** 00039 * Is just a short hand to the long name "osgGA::GUIEventAdapter". 00040 */ 00041 class GUIEvents : public osgGA::GUIEventAdapter 00042 { 00043 public: 00044 using osgGA::GUIEventAdapter::EventType; 00045 using osgGA::GUIEventAdapter::MouseButtonMask; 00046 using osgGA::GUIEventAdapter::KeySymbol; 00047 using osgGA::GUIEventAdapter::ModKeyMask; 00048 using osgGA::GUIEventAdapter::MouseYOrientation; 00049 using osgGA::GUIEventAdapter::ScrollingMotion; 00050 using osgGA::GUIEventAdapter::TabletPointerType; 00051 00052 private: 00053 /** 00054 * The constructor is private to forbid instance generation. 00055 */ 00056 GUIEvents() 00057 { 00058 } 00059 }; 00060 00061 /** 00062 * Custom widget which is created by a module to display custom information. 00063 */ 00064 class WCustomWidget 00065 { 00066 public: 00067 /** 00068 * Abbreviation for a shared pointer on a instance of this class. 00069 */ 00070 typedef boost::shared_ptr< WCustomWidget > SPtr; 00071 00072 /** 00073 * Abbreviation for a const shared pointer on a instance of this class. 00074 */ 00075 typedef boost::shared_ptr< const WCustomWidget > ConstSPtr; 00076 00077 /** 00078 * Constructor. Create a custom widget instance. 00079 * 00080 * \param title the title of the widget 00081 */ 00082 explicit WCustomWidget( std::string title ); 00083 00084 /** 00085 * Destructor 00086 */ 00087 virtual ~WCustomWidget(); 00088 00089 /** 00090 * Get the scene which is displayed 00091 * 00092 * \return the scene as osg::ref_ptr 00093 */ 00094 virtual osg::ref_ptr< WGEGroupNode > getScene() const = 0; 00095 00096 /** 00097 * Get the viewer which is used 00098 * 00099 * \return the viewer as boost::shard_ptr 00100 */ 00101 virtual boost::shared_ptr< WGEViewer > getViewer() const = 0; 00102 00103 /** 00104 * Get the title of the widget. 00105 * 00106 * \return title as string 00107 */ 00108 virtual std::string getTitle() const; 00109 00110 /** 00111 * Returns the height of the viewport of the camera. 00112 * 00113 * \return Height in pixels. 00114 */ 00115 virtual size_t height() const = 0; 00116 00117 /** 00118 * Returns the width of the viewport of the camera. 00119 * 00120 * \return Width in pixels. 00121 */ 00122 virtual size_t width() const = 0; 00123 00124 /** 00125 * Adds an event handler to the widget's view. 00126 * 00127 * \param handler Pointer to the handler. 00128 */ 00129 virtual void addEventHandler( osgGA::GUIEventHandler* handler ) = 0; 00130 00131 protected: 00132 private: 00133 /** 00134 * The widget's title string. 00135 */ 00136 std::string m_title; 00137 }; 00138 00139 #endif // WCUSTOMWIDGET_H