gui manager hacks

This commit is contained in:
Vladislav Khorev 2014-01-06 18:57:43 +00:00
parent a968ce2ad0
commit 91638909f6
4 changed files with 22 additions and 3 deletions

View File

@ -158,6 +158,8 @@ public:
void DeleteWidgetOnUpdate(const std::string& name); void DeleteWidgetOnUpdate(const std::string& name);
void DeleteWidgetGroupOnUpdate(const std::string& groupName); void DeleteWidgetGroupOnUpdate(const std::string& groupName);
void DeleteWidgetLaterOnUpdate(const std::string& name);
void DeleteWidgetGroupLaterOnUpdate(const std::string& groupName);
void Update(cardinal dt); void Update(cardinal dt);
void Draw(); void Draw();

View File

@ -37,6 +37,7 @@ namespace SE
void TryUpdateMainThreadId(); void TryUpdateMainThreadId();
void PerformInMainThreadAsync(boost::function<void()> f); void PerformInMainThreadAsync(boost::function<void()> f);
void PerformInMainThreadAsyncLater(boost::function<void()> f);
template<typename RETURNTYPE> template<typename RETURNTYPE>
RETURNTYPE PerformInMainThread(boost::function<RETURNTYPE()> f); RETURNTYPE PerformInMainThread(boost::function<RETURNTYPE()> f);

View File

@ -90,16 +90,29 @@ void TGUIManager::DeleteWidgetGroup(std::string groupName)
void TGUIManager::DeleteWidgetOnUpdate(const std::string& name) void TGUIManager::DeleteWidgetOnUpdate(const std::string& name)
{ {
//PerformInMainThreadAsyncLater(boost::bind(&TGUIManager::DeleteWidget, this, name));
PerformInMainThreadAsync(boost::bind(&TGUIManager::DeleteWidget, this, name)); PerformInMainThreadAsync(boost::bind(&TGUIManager::DeleteWidget, this, name));
//PostUpdateSignal.connect(boost::bind(&TGUIManager::DeleteWidget, this, name));
} }
void TGUIManager::DeleteWidgetGroupOnUpdate(const std::string& groupName) void TGUIManager::DeleteWidgetGroupOnUpdate(const std::string& groupName)
{ {
//PerformInMainThreadAsyncLater(boost::bind(&TGUIManager::DeleteWidgetGroup, this, groupName));
PerformInMainThreadAsync(boost::bind(&TGUIManager::DeleteWidgetGroup, this, groupName)); PerformInMainThreadAsync(boost::bind(&TGUIManager::DeleteWidgetGroup, this, groupName));
//PostUpdateSignal.connect(boost::bind(&TGUIManager::DeleteWidgetGroup, this, groupName));
} }
void TGUIManager::DeleteWidgetLaterOnUpdate(const std::string& name)
{
PerformInMainThreadAsyncLater(boost::bind(&TGUIManager::DeleteWidget, this, name));
}
void TGUIManager::DeleteWidgetGroupLaterOnUpdate(const std::string& groupName)
{
PerformInMainThreadAsyncLater(boost::bind(&TGUIManager::DeleteWidgetGroup, this, groupName));
}
void TGUIManager::AddWidgetTransformTask(TWidgetTransformTask widgetTransformTask) void TGUIManager::AddWidgetTransformTask(TWidgetTransformTask widgetTransformTask)

View File

@ -46,8 +46,11 @@ namespace SE
} }
}
void PerformInMainThreadAsyncLater(boost::function<void()> f)
{
ST::MainThreadIoService.post(f);
} }
#endif #endif