00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef OMGUI_WIN32_WIDGET_H
00026 #define OMGUI_WIN32_WIDGET_H
00027
00028 #include <omgui/win32/win.h>
00029 #include <omgui/common/widget.h>
00030
00031
00032 #include <omgui/widget.h>
00033
00034 namespace omgui {
00035 namespace win32 {
00036
00037 class Widget : public virtual omgui::common::Widget
00038 {
00039 private:
00040 bool m_delete;
00041
00042 protected:
00043 HWND m_hwnd;
00044 WNDPROC m_old_proc;
00045 bool m_hidden;
00046
00047 omgui::Size m_min_size, m_max_size, m_natural_size;
00048
00049 Widget();
00050
00051 public:
00055 void invalidate_parent();
00056
00057
00058 virtual void set_size(const omgui::Size &s);
00059 virtual void set_min_size(const omgui::Size &s);
00060 virtual void set_max_size(const omgui::Size &s);
00061 virtual void set_natural_size(const omgui::Size &s);
00062 virtual void set_position(const omgui::Point &p);
00063 virtual void set_rect(const omgui::Rect &r);
00064 virtual omgui::Size get_size() const;
00065 virtual omgui::Size get_min_size() const;
00066 virtual omgui::Size get_max_size() const;
00067 virtual omgui::Size get_natural_size() const;
00068 virtual omgui::Point get_position() const;
00069 virtual omgui::Rect get_rect() const;
00070
00071
00072 virtual void *get_handle() const { return m_hwnd; }
00073 virtual void enable(bool e);
00074 virtual void show(bool show, bool focus);
00075 virtual bool is_enabled() const;
00076 virtual bool is_shown() const;
00077 virtual bool is_hidden() const;
00078 virtual void destroy();
00079 virtual Pointer<omgui::Panel> get_parent() const;
00080 virtual Pointer<omgui::Window> get_parent_window() const;
00081
00085 void set_window_text(const string &str);
00086 string get_window_text() const;
00087
00093 void add_ex_style(int style);
00094
00100 void remove_ex_style(int style);
00101
00107 bool process_menu_command(menu_id id);
00108
00114 bool process_notification(int notification, HWND hwnd);
00115
00119 int get_window_styles() const;
00120
00124 HFONT get_hfont() const;
00125
00129 static void set_default_font(HWND h);
00130
00134 void set_default_font();
00135
00136 virtual ~Widget();
00137
00138 protected:
00142 void set_window_pos(int x, int y, int w, int h, int flags = 0);
00143
00144 void set_old_proc(WNDPROC proc) { m_old_proc = proc; }
00145
00152 virtual int process_message(HWND hwnd, UINT msg, WPARAM w_param, LPARAM l_param);
00153
00169 void create(const omgui::initializer::WidgetData ¶ms, bool parent_required,
00170 LPCTSTR class_name, LPCTSTR window_name, int styles, int styles_ex = 0,
00171 int x = 0, int y = 0, int w = 0, int h = 0, HMENU menu = 0);
00172
00176 virtual void post_create(const omgui::initializer::WidgetData ¶ms);
00177
00178 friend class CreationHook;
00179 friend LRESULT CALLBACK widget_wndproc(HWND hwnd, UINT msg, WPARAM w_param, LPARAM l_param);
00180 };
00181
00182 }
00183 }
00184
00185 #endif // OMGUI_WIN32_WIDGET_H