From: John L. <jr...@us...> - 2005-11-26 03:15:28
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18390/wxLua/modules/wxlua/include Modified Files: internal.h wxlstate.h Log Message: fix wxMessageDialog in dialogs.i, at least for 2.6 cleanup wxLuaObject to use a single int and enum to store allocation type wxLuaState can now attach to lua_States or wxLuaStateRefData wxLuaDebugEvent to use copy constructor for clone enum debugCommands and debugEvents to wxLuaDebugCommands/Events_Type Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** wxlstate.h 25 Nov 2005 10:09:11 -0000 1.2 --- wxlstate.h 26 Nov 2005 03:15:19 -0000 1.3 *************** *** 52,56 **** //---------------------------------------------------------------------------- ! // wxLuaStateRefData //---------------------------------------------------------------------------- --- 52,57 ---- //---------------------------------------------------------------------------- ! // wxLuaStateRefData - the internal data for the wxLuaState. ! // please use the wxLuaStare accessor functions //---------------------------------------------------------------------------- *************** *** 59,66 **** public: wxLuaStateRefData(); ! wxLuaStateRefData( const wxLuaStateRefData& data ); virtual ~wxLuaStateRefData(); ! // destroy and cleanup the lua_State, returns sucess // if 'force' then make sure all wxWindows are destroyed. bool Destroy(bool force); --- 60,67 ---- public: wxLuaStateRefData(); ! //wxLuaStateRefData( const wxLuaStateRefData& data ); virtual ~wxLuaStateRefData(); ! // destroy and cleanup the lua_State, returns success // if 'force' then make sure all wxWindows are destroyed. bool Destroy(bool force); *************** *** 74,95 **** wxLuaBindingList m_bindings; // A list of generated lua bindings ! bool m_typesRegistered; // Is the binding registered ! int m_startTag; // The first wxLua allocated lua tag ! int m_lastTag; // The last wxLua lua tag of registered classes ! int m_functionTag; // The lua tag for function objects. ! int m_wxLuaTable; // The lua tag for the wxLua private tables ! int m_wxLuaNull; // The lua tag for wxLuaNull (for NULL pointers) ! int m_wxDeleteTable; // The lua tag for the wxWindow destroy tracking table ! wxEventType m_inEventType; // wxEventType set when in event, else -1 ! wxHashTable *m_pDerivedList; // The list of derived objects. ! wxHashTable *m_pTrackedList; // The list of tracked objects. ! wxList *m_pAppHandlerList; // The list of event objects associated with the application object ! wxList *m_pDestroyHandlerList; // The list of wxLuaDestroyCallbacks installed ! wxList *m_pWindowList; // The list of all wxWindow objects, wxWidgets will delete these ! // but for an embedded program they must be deleted before ! // deleting shutting down the interpreter, else they dangle ! // used in ~wxLuaInterpreter wxArrayInt m_usedIndexes; --- 75,96 ---- wxLuaBindingList m_bindings; // A list of generated lua bindings ! bool m_typesRegistered; // Is the binding registered ! int m_startTag; // The first wxLua allocated lua tag ! int m_lastTag; // The last wxLua lua tag of registered classes ! int m_functionTag; // The lua tag for function objects. ! int m_wxLuaTable; // The lua tag for the wxLua private tables ! int m_wxLuaNull; // The lua tag for wxLuaNull (for NULL pointers) ! int m_wxDeleteTable; // The lua tag for the wxWindow destroy tracking table ! wxEventType m_inEventType; // wxEventType set when in event, else -1 ! wxHashTable* m_pDerivedList; // derived objects. ! wxHashTable* m_pTrackedList; // tracked objects. ! wxList m_pAppHandlerList; // event objects associated with the application object ! wxList m_pDestroyHandlerList; // wxLuaDestroyCallbacks installed ! wxList m_pWindowList; // all wxWindow objects, wxWidgets will delete these ! // but for an embedded program they must be deleted before ! // shutting down the interpreter, else they dangle ! // used in destructor wxArrayInt m_usedIndexes; *************** *** 107,113 **** enum wxLuaState_Type { ! WXLUASTATE_CREATE = 1, // Create a new lua_State ! WXLUASTATE_ATTACH = 2, // Attach to c currently created lua_State ! WXLUASTATE_SETSTATE = 3 // Merely set the lua_State and don't close it // when destroyed }; --- 108,113 ---- enum wxLuaState_Type { ! WXLUASTATE_ATTACH = 1, // Attach to a currently created lua_State ! WXLUASTATE_SETSTATE = 2 // Only set the lua_State and don't close it // when destroyed }; *************** *** 116,121 **** { public: ! wxLuaState() : wxObject() {} ! wxLuaState(lua_State* L, wxLuaState_Type type) { Create(L, type); } wxLuaState(const wxLuaState& wxlState) { Create(wxlState); } --- 116,121 ---- { public: ! wxLuaState(bool create = false) : wxObject() { if (create) Create(); } ! wxLuaState(lua_State* L, wxLuaState_Type type = WXLUASTATE_ATTACH) { Create(L, type); } wxLuaState(const wxLuaState& wxlState) { Create(wxlState); } *************** *** 127,133 **** // Ref the given wxLuaState void Create(const wxLuaState& wxlState); // Create a new lua_State if L = NULL or just attach to the // input lua_State ! bool Create(lua_State* L = NULL, wxLuaState_Type type = WXLUASTATE_CREATE); // Is this wxLuaState valid, has refed data --- 127,137 ---- // Ref the given wxLuaState void Create(const wxLuaState& wxlState); + // Create a new lua_State + bool Create(); // Create a new lua_State if L = NULL or just attach to the // input lua_State ! bool Create(lua_State* L, wxLuaState_Type type = WXLUASTATE_ATTACH); ! // attach to the refData ! bool Create(wxLuaStateRefData* refData); // Is this wxLuaState valid, has refed data *************** *** 308,312 **** // ref counting code virtual wxObjectRefData *CreateRefData() const; ! virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; DECLARE_DYNAMIC_CLASS(wxLuaState) --- 312,316 ---- // ref counting code virtual wxObjectRefData *CreateRefData() const; ! //virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const; DECLARE_DYNAMIC_CLASS(wxLuaState) Index: internal.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/internal.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** internal.h 25 Nov 2005 10:09:11 -0000 1.6 --- internal.h 26 Nov 2005 03:15:19 -0000 1.7 *************** *** 195,208 **** #endif class WXDLLIMPEXP_WXLUA wxLuaObject : public wxObject { public: ! wxLuaObject(); ! wxLuaObject(lua_State *, int iParam, int iRef = 1); ~wxLuaObject(); bool GetObject(); ! void SetObject(int iParam); void SetObject(lua_State *, int iParam); bool *GetBoolPtr(); int *GetIntPtr(); --- 195,224 ---- #endif + enum wxLuaObject_Type + { + wxLUAOBJECT_NONE = 0, // nothing is allocated + wxLUAOBJECT_BOOL = 1, // bool allocated + wxLUAOBJECT_INT = 2, // int allocated + wxLUAOBJECT_STRING = 4, // wxString allocated + wxLUAOBJECT_ARRAYINT = 8 // wxArrayInt allocated + }; + class WXDLLIMPEXP_WXLUA wxLuaObject : public wxObject { public: ! wxLuaObject(); ! // Constructor that is passed a lua state and a parameter index. ! wxLuaObject(lua_State *, int iParam, int iRef = 1); ~wxLuaObject(); + + // Get the value of the reference object (or a proxy if the object has + // been aliased for a wxValidator class. bool GetObject(); ! // Remove any existing reference and allocated another ! void SetObject(int iParam); ! // Set the reference and lua state up from a supplied parameter. void SetObject(lua_State *, int iParam); + // The following methods are used by the wxValidator interface bool *GetBoolPtr(); int *GetIntPtr(); *************** *** 210,215 **** wxArrayInt *GetArrayPtr(); ! int GetAllocationFlags() const; ! void ModifyAllocationFlags(int iValue); lua_State *GetLuaState() const { return m_luaState; } --- 226,235 ---- wxArrayInt *GetArrayPtr(); ! // Return a flag value that indicated whether the ! // object is being used by a wxValidator class (else 0). ! int GetAllocationFlags() const { return m_alloc_flags; } ! bool HasAllocationFlag(wxLuaObject_Type flag) const { return (m_alloc_flags & flag) != 0; } ! // Allow the flag value to be manipulated. ! void ModifyAllocationFlags(int iValue); lua_State *GetLuaState() const { return m_luaState; } *************** *** 218,229 **** lua_State *m_luaState; int m_iReference; - bool m_allocatedBool; bool m_bool; - bool m_allocatedInt; int m_int; - bool m_allocatedString; wxString m_string; - bool m_allocatedArray; wxArrayInt m_arrayInt; DECLARE_DYNAMIC_CLASS(wxLuaObject) }; --- 238,246 ---- lua_State *m_luaState; int m_iReference; bool m_bool; int m_int; wxString m_string; wxArrayInt m_arrayInt; + int m_alloc_flags; DECLARE_DYNAMIC_CLASS(wxLuaObject) }; |