diff --git a/src/xrGame/ui/UIScriptWnd.cpp b/src/xrGame/ui/UIScriptWnd.cpp index 12ee2221410..57c3f8a5bdb 100644 --- a/src/xrGame/ui/UIScriptWnd.cpp +++ b/src/xrGame/ui/UIScriptWnd.cpp @@ -8,60 +8,64 @@ CUIDialogWndEx::CUIDialogWndEx() CUIDialogWndEx::~CUIDialogWndEx() { - delete_data(m_callbacks); + delete_data(m_callbacks); } -void CUIDialogWndEx::Register (CUIWindow* pChild) +void CUIDialogWndEx::Register (CUIWindow* pChild) { - pChild->SetMessageTarget(this); + pChild->SetMessageTarget(this); } void CUIDialogWndEx::Register(CUIWindow* pChild, LPCSTR name) { - pChild->SetWindowName(name); - pChild->SetMessageTarget(this); + pChild->SetWindowName(name); + pChild->SetMessageTarget(this); } void CUIDialogWndEx::SendMessage(CUIWindow* pWnd, s16 msg, void* pData) { - event_comparer ec(pWnd,msg); + event_comparer ec(pWnd,msg); - CALLBACK_IT it = std::find_if(m_callbacks.begin(),m_callbacks.end(),ec); - if(it==m_callbacks.end()) - return inherited::SendMessage(pWnd, msg, pData); + CALLBACK_IT it = std::find_if(m_callbacks.begin(),m_callbacks.end(),ec); + if(it==m_callbacks.end()) + return inherited::SendMessage(pWnd, msg, pData); - ((*it)->m_callback)(); + ((*it)->m_callback)(); -// if ( (*it)->m_cpp_callback ) -// (*it)->m_cpp_callback(pData); +// if ( (*it)->m_cpp_callback ) +// (*it)->m_cpp_callback(pData); } bool CUIDialogWndEx::Load(LPCSTR xml_name) { - return true; + return true; } -SCallbackInfo* CUIDialogWndEx::NewCallback () +SCallbackInfo* CUIDialogWndEx::NewCallback () { - m_callbacks.push_back( xr_new() ); - return m_callbacks.back(); + m_callbacks.push_back( xr_new() ); + return m_callbacks.back(); } -void CUIDialogWndEx::AddCallback (LPCSTR control_id, s16 evt, const luabind::functor &functor, const luabind::object &object) +void CUIDialogWndEx::AddCallback(LPCSTR control_id, s16 evt, const luabind::functor &functor, const luabind::object &object) +{ AddCallback(control_id, evt, functor, object); } + +void CUIDialogWndEx::AddCallback(LPCSTR control_id, s16 evt, + const luabind::object &functor, const luabind::object &object) { - SCallbackInfo* c = NewCallback (); - c->m_callback.set (functor,object); - c->m_control_name = control_id; - c->m_event = evt; + SCallbackInfo* c = NewCallback (); + c->m_callback.set (functor,object); + c->m_control_name = control_id; + c->m_event = evt; } bool CUIDialogWndEx::OnKeyboardAction(int dik, EUIMessages keyboard_action) { - return inherited::OnKeyboardAction(dik,keyboard_action); + return inherited::OnKeyboardAction(dik,keyboard_action); } void CUIDialogWndEx::Update() { - inherited::Update(); + inherited::Update(); } diff --git a/src/xrGame/ui/UIScriptWnd.h b/src/xrGame/ui/UIScriptWnd.h index 901f3307b34..c4dfd5f67f0 100644 --- a/src/xrGame/ui/UIScriptWnd.h +++ b/src/xrGame/ui/UIScriptWnd.h @@ -21,8 +21,10 @@ typedef CALLBACKS::iterator CALLBACK_IT; void Register (CUIWindow* pChild, LPCSTR name); CUIDialogWndEx (); virtual ~CUIDialogWndEx (); + // XXX: declaration without implementation void AddCallback (LPCSTR control_id, s16 event, const luabind::functor &lua_function); void AddCallback (LPCSTR control_id, s16 event, const luabind::functor &functor, const luabind::object &object); + void AddCallback(const char *controlId, s16 event, const luabind::object &functor, const luabind::object &object); virtual void Update (); virtual bool OnKeyboardAction (int dik, EUIMessages keyboard_action); virtual bool Dispatch (int cmd, int param) {return true;} diff --git a/src/xrGame/ui/UIScriptWnd_script.cpp b/src/xrGame/ui/UIScriptWnd_script.cpp index 795c31476fc..b2dd3d46f6d 100644 --- a/src/xrGame/ui/UIScriptWnd_script.cpp +++ b/src/xrGame/ui/UIScriptWnd_script.cpp @@ -40,7 +40,7 @@ export_class &script_register_ui_window1(export_class &instance) { instance .def( constructor<>()) - .def("AddCallback", (void(BaseType::*)(LPCSTR, s16, const luabind::functor&, const luabind::object&))&BaseType::AddCallback) + .def("AddCallback", (void(BaseType::*)(LPCSTR, s16, const luabind::object&, const luabind::object&))&BaseType::AddCallback) .def("Register", (void (BaseType::*)(CUIWindow*,LPCSTR))&BaseType::Register); return (instance); }