00001 00007 /* 00008 This library is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU Lesser General Public 00010 License as published by the Free Software Foundation; either 00011 version 2.1 of the License, or (at your option) any later version. 00012 00013 This library is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Lesser General Public License for more details. 00017 00018 You should have received a copy of the GNU Lesser General Public 00019 License along with this library; if not, write to the Free Software 00020 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00021 */ 00022 00023 #ifndef OMGUI_COMMON_WIDGET_H 00024 #define OMGUI_COMMON_WIDGET_H 00025 00026 #include <omgui/api/widget.h> 00027 #include <omgui/widget.h> 00028 00029 namespace omgui { 00030 namespace common { 00031 00032 class Widget : public virtual omgui::api::Widget 00033 { 00034 public: 00035 Widget(); 00036 Widget(omgui::Widget *wrapper); 00037 00041 const omgui::Widget *get_wrapper() const 00042 { 00043 return m_wrapper; 00044 } 00045 00049 omgui::Widget *get_wrapper() 00050 { 00051 return m_wrapper; 00052 } 00053 00057 template<typename T> const T *get_wrapper() const 00058 { 00059 return dynamic_cast<const T*>(m_wrapper); 00060 } 00061 00065 template<typename T> T *get_wrapper() 00066 { 00067 return dynamic_cast<T*>(m_wrapper); 00068 } 00069 00073 omgui::object_id get_wrapper_id() const; 00074 00075 private: 00079 omgui::Widget * const m_wrapper; 00080 }; 00081 00082 } // common 00083 } // omgui 00084 00085 #endif // OMGUI_COMMON_WIDGET_H