00001 #include "gui_layeredregion.hpp" 00002 #include "gui_uiobject.hpp" 00003 00004 #include <luapp_function.hpp> 00005 00006 namespace gui 00007 { 00008 lua_layered_region::lua_layered_region(lua_State* pLua) : lua_uiobject(pLua) 00009 { 00010 pLayeredRegionParent_ = dynamic_cast<layered_region*>(pParent_); 00011 if (pParent_ && !pLayeredRegionParent_) 00012 throw exception("lua_layered_region", "Dynamic cast failed !"); 00013 } 00014 00015 int lua_layered_region::_set_draw_layer(lua_State* pLua) 00016 { 00017 if (!check_parent_()) 00018 return 0; 00019 00020 lua::function mFunc("LayeredRegion:set_draw_layer", pLua); 00021 mFunc.add(0, "layer", lua::TYPE_STRING); 00022 if (mFunc.check()) 00023 pLayeredRegionParent_->set_draw_layer(mFunc.get(0)->get_string()); 00024 00025 return mFunc.on_return(); 00026 } 00027 00028 int lua_layered_region::_get_draw_layer(lua_State* pLua) 00029 { 00030 if (!check_parent_()) 00031 return 0; 00032 00033 lua::function mFunc("LayeredRegion:get_draw_layer", pLua, 1); 00034 00035 switch (pLayeredRegionParent_->get_draw_layer()) 00036 { 00037 case LAYER_BACKGROUND : mFunc.push(std::string("BACKGROUND")); break; 00038 case LAYER_BORDER : mFunc.push(std::string("BORDER")); break; 00039 case LAYER_ARTWORK : mFunc.push(std::string("ARTWORK")); break; 00040 case LAYER_OVERLAY : mFunc.push(std::string("OVERLAY")); break; 00041 case LAYER_HIGHLIGHT : mFunc.push(std::string("HIGHLIGHT")); break; 00042 case LAYER_SPECIALHIGH : mFunc.push(std::string("SPECIALHIGH")); break; 00043 } 00044 00045 return mFunc.on_return(); 00046 } 00047 }