From: John L. <jr...@us...> - 2007-08-06 22:00:37
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15149/wxLua/modules/wxlua/include Modified Files: wxlcallb.h Log Message: Move wxWindow cleanup into wxLuaWinDestroyCallback from wxLuaCallback so we only have one connected wxEVT_DESTROY Index: wxlcallb.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlcallb.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** wxlcallb.h 3 Aug 2007 22:17:16 -0000 1.19 --- wxlcallb.h 6 Aug 2007 22:00:33 -0000 1.20 *************** *** 15,29 **** // ---------------------------------------------------------------------------- ! // wxLuaCallback - Forward events from C++ wxWidgets wxEvtHandlers to lua functions // ! // The wxLuaCallback is created with the wxLuaState, the stack index of the ! // lua function to call when an event is received, the window id ranges, and ! // the wxEventType to connect to the wxEvtHandler with this as the callback ! // user data for event. // // Do NOT delete this, the wxEvtHandler deletes the callback user data itself. // ! // The function wxLuaCallback::EventHandler generically handles the events and ! // forwards them to the event's wxLuaCallback callback user data CallFunction(). // ---------------------------------------------------------------------------- --- 15,29 ---- // ---------------------------------------------------------------------------- ! // wxLuaCallback - Forward events from C++ wxWidgets wxEvtHandlers to Lua functions // ! // The wxLuaCallback is created with the wxLuaState, the stack index of a ! // Lua function to call when a wxEvent is received, the window id ranges, and ! // the wxEventType to connect using wxEvtHandler::Connect() with this as the ! // callback user data for event. // // Do NOT delete this, the wxEvtHandler deletes the callback user data itself. // ! // The function EventHandler() generically handles the events and forwards them ! // to the event's wxLuaCallback callback user data function CallFunction(). // ---------------------------------------------------------------------------- *************** *** 37,41 **** // if only one event Id is needed set lastId = wxID_ANY wxLuaCallback( const wxLuaState& wxlState, int lua_func_stack_idx, ! wxWindowID winId, wxWindowID lastId, wxEventType eventType, wxEvtHandler *evtHandler ); --- 37,41 ---- // if only one event Id is needed set lastId = wxID_ANY wxLuaCallback( const wxLuaState& wxlState, int lua_func_stack_idx, ! wxWindowID win_id, wxWindowID last_id, wxEventType eventType, wxEvtHandler *evtHandler ); *************** *** 44,52 **** void ClearwxLuaState() { m_wxlState.UnRef(); } ! wxLuaState GetwxLuaState() const { return m_wxlState; } ! wxWindowID GetId() const { return m_id; } ! wxWindowID GetLastId() const { return m_lastId; } ! wxEventType GetEventType() const { return m_wxlBindEvent ? *m_wxlBindEvent->eventType : wxEVT_NULL; } ! wxEvtHandler* GetEvtHandler() const { return m_evtHandler; } const wxLuaBindEvent* GetwxLuaBindEvent() const { return m_wxlBindEvent; } --- 44,53 ---- void ClearwxLuaState() { m_wxlState.UnRef(); } ! wxLuaState GetwxLuaState() const { return m_wxlState; } ! wxWindowID GetId() const { return m_id; } ! wxWindowID GetLastId() const { return m_last_id; } ! wxEventType GetEventType() const { return m_wxlBindEvent ? *m_wxlBindEvent->eventType : wxEVT_NULL; } ! wxEvtHandler* GetEvtHandler() const { return m_evtHandler; } ! int GetLuaRoutine() const { return m_routine; } const wxLuaBindEvent* GetwxLuaBindEvent() const { return m_wxlBindEvent; } *************** *** 62,70 **** protected: ! int m_routine; // ref to the lua routine to call in the wxLuaReferences registry table ! wxLuaState m_wxlState; // store it since we're added to a list of it's callbacks. ! wxEvtHandler* m_evtHandler; ! wxWindowID m_id; ! wxWindowID m_lastId; const wxLuaBindEvent* m_wxlBindEvent; // data for this wxEventType --- 63,71 ---- protected: ! int m_routine; // ref to the lua routine to call in the wxLuaReferences registry table ! wxLuaState m_wxlState; // store it since we're added to a list of it's callbacks. ! wxEvtHandler* m_evtHandler; ! wxWindowID m_id; ! wxWindowID m_last_id; const wxLuaBindEvent* m_wxlBindEvent; // data for this wxEventType *************** *** 81,84 **** --- 82,88 ---- // // Do NOT delete this, the wxEvtHandler deletes the callback user data itself. + // + // The function EventHandler() generically handles the events and forwards them + // to the event's wxLuaWinDestroyCallback callback user data function OnDestroy(). // ---------------------------------------------------------------------------- *************** *** 93,100 **** wxLuaState GetwxLuaState() const { return m_wxlState; } ! wxWindow* GetWindow() const { return m_window; } // Central event handler that calls OnDestroy() for the actual ! // wxLuaWinDestroyCallback callback user data void EventHandler(wxWindowDestroyEvent& event); --- 97,105 ---- wxLuaState GetwxLuaState() const { return m_wxlState; } ! wxWindow* GetWindow() const { return m_window; } // Central event handler that calls OnDestroy() for the actual ! // wxLuaWinDestroyCallback callback user data. This function is treated like a ! // static function that all handlers of this class will call. void EventHandler(wxWindowDestroyEvent& event); *************** *** 103,108 **** protected: ! wxLuaState m_wxlState; // store it since we're added to a list of it's callbacks. ! wxWindow* m_window; private: --- 108,113 ---- protected: ! wxLuaState m_wxlState; // store it since we're added to a list of it's callbacks. ! wxWindow* m_window; private: |