widget.h

Go to the documentation of this file.
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_WIDGET_H
00024 #define OMGUI_WIDGET_H
00025 
00026 #include <omgui/object.h>
00027 #include <omgui/event.h>
00028 
00029 namespace omgui {
00030     
00031 class Panel;
00032 class Window;
00033 
00046 class OMGUI_API Widget : public Object
00047 {
00048 public:
00049     typedef omgui::api::Widget api_type;
00050     typedef omgui::event_traits<Widget> event_traits;
00051 
00055     void add_ref();
00056 
00061     void release();
00062 
00067     omgui::Connection connect(event_id event, SlotBase* slot, int priority = SIGNAL_PRIORITY_NORMAL);
00068 
00092     void set_min_size(const omgui::Size &s);
00093 
00102     void set_max_size(const omgui::Size &s);
00103 
00107     omgui::Size get_size() const;
00108 
00115     omgui::Size get_min_size() const;
00116 
00123     omgui::Size get_max_size() const;
00124 
00132     void set_natural_size(const omgui::Size &s);
00133 
00140     omgui::Size get_natural_size() const;
00141 
00146     omgui::Point get_position() const;
00147 
00151     omgui::Rect get_rect() const;
00152 
00161     void set_size(const omgui::Size &s);
00162 
00167     void set_position(const omgui::Point &p);
00168 
00174     void set_rect(const omgui::Rect &r);
00175 
00182     void *get_handle() const;
00183 
00187     void enable(bool e);
00188     void disable();
00189 
00197     void show(bool show = true, bool focus = false);
00198     void hide();
00199 
00206     bool is_enabled() const;
00207 
00216     bool is_shown() const;
00217 
00230     bool is_hidden() const;
00231 
00235     void destroy();
00236 
00244     Pointer<Panel> get_parent() const;
00245 
00254     Pointer<Window> get_parent_window() const;
00255 
00256     ~Widget();
00257 
00258 private:
00259     api_type *m_impl;
00260     int m_refcount;
00261 
00262 protected:
00263     Widget(object_id id, api_type *impl);
00264     
00265 
00266     template<typename T> T *get_impl() const
00267     {
00268         return dynamic_cast<T*>(m_impl);
00269     }
00270 
00271 public:
00272     api_type *get_impl() const;
00273 };
00274 
00275 } // omgui
00276 
00277 #endif // OMGUI_WIDGET_H

doxygen SourceForge.net Logo