00001 #ifndef GUI_CHECKBUTTON_HPP 00002 #define GUI_CHECKBUTTON_HPP 00003 00004 #include <utils.hpp> 00005 #include "gui_button.hpp" 00006 00007 namespace gui 00008 { 00010 00013 class check_button : public button 00014 { 00015 public : 00016 00018 explicit check_button(manager* pManager); 00019 00021 virtual ~check_button(); 00022 00024 00027 virtual std::string serialize(const std::string& sTab) const; 00028 00030 00032 virtual void copy_from(uiobject* pObj); 00033 00035 virtual void check(); 00036 00038 virtual void uncheck(); 00039 00041 00043 virtual void disable(); 00044 00046 virtual void enable(); 00047 00049 00052 virtual void release(); 00053 00055 00057 bool is_checked(); 00058 00060 00062 texture* get_checked_texture(); 00063 00065 00067 texture* get_disabled_checked_texture(); 00068 00070 00072 void set_checked_texture(texture* pTexture); 00073 00075 00077 void set_disabled_checked_texture(texture* pTexture); 00078 00080 virtual void create_glue(); 00081 00083 00085 virtual void parse_block(xml::block* pBlock); 00086 00088 static void register_glue(utils::wptr<lua::state> pLua); 00089 00090 protected : 00091 00092 texture* create_checked_texture_(); 00093 texture* create_disabled_checked_texture_(); 00094 00095 bool bChecked_; 00096 00097 texture* pCheckedTexture_; 00098 texture* pDisabledCheckedTexture_; 00099 00100 }; 00101 00105 class lua_check_button : public lua_button 00106 { 00107 public : 00108 00109 explicit lua_check_button(lua_State* pLua); 00110 00111 // Glues 00112 int _is_checked(lua_State*); 00113 int _get_checked_texture(lua_State*); 00114 int _get_disabled_checked_texture(lua_State*); 00115 int _set_checked(lua_State*); 00116 int _set_checked_texture(lua_State*); 00117 int _set_disabled_checked_texture(lua_State*); 00118 00119 static const char className[]; 00120 static const char* classList[]; 00121 static Lunar<lua_check_button>::RegType methods[]; 00122 00123 protected : 00124 00125 check_button* pCheckButtonParent_; 00126 }; 00127 00130 } 00131 00132 #endif