00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _WX_LUA_STACKTREE_H_
00011 #define _WX_LUA_STACKTREE_H_
00012
00013 #include "wx/dialog.h"
00014 #include "wx/listctrl.h"
00015 #include "wx/treectrl.h"
00016
00017 class WXDLLEXPORT wxListCtrl;
00018 class WXDLLEXPORT wxListEvent;
00019 class WXDLLEXPORT wxSplitterWindow;
00020 class WXDLLEXPORT wxProgressDialog;
00021
00022 #include "wxluadebug/include/wxluadebugdefs.h"
00023 #include "wxluadebug/include/wxldebug.h"
00024
00025 class WXDLLIMPEXP_WXLUADEBUG wxLuaDebugData;
00026
00027
00028
00029
00030
00031 enum
00032 {
00033 ID_WXLUA_STACK_CHOICE = 2000,
00034 ID_WXLUA_STACK_EXPAND_BUTTON,
00035 ID_WXLUA_STACK_COLLAPSE_BUTTON,
00036
00037 ID_WXLUA_STACK_FIND_COMBO,
00038 ID_WXLUA_STACK_FINDNEXT_BUTTON,
00039 ID_WXLUA_STACK_FINDPREV_BUTTON,
00040 ID_WXLUA_STACK_FINDMENU_BUTTON,
00041
00042 ID_WXLUA_STACK_SPLITTERWIN,
00043 ID_WXLUA_STACK_LISTCTRL,
00044 ID_WXLUA_STACK_TREECTRL,
00045
00046 ID_WXLUA_STACK_LISTMENU_COPY0,
00047 ID_WXLUA_STACK_LISTMENU_COPY1,
00048 ID_WXLUA_STACK_LISTMENU_COPY2,
00049 ID_WXLUA_STACK_LISTMENU_COPY3,
00050 ID_WXLUA_STACK_LISTMENU_COPY4,
00051
00052 ID_WXLUA_STACK_FINDMENU_CASE,
00053 ID_WXLUA_STACK_FINDMENU_WHOLE_STRING,
00054 ID_WXLUA_STACK_FINDMENU_ALL,
00055 ID_WXLUA_STACK_FINDMENU_NAME,
00056 ID_WXLUA_STACK_FINDMENU_LEVEL,
00057 ID_WXLUA_STACK_FINDMENU_KEYTYPE,
00058 ID_WXLUA_STACK_FINDMENU_VALUETYPE,
00059 ID_WXLUA_STACK_FINDMENU_VALUE
00060 };
00061
00062
00063
00064
00065
00066
00067
00068 class WXDLLIMPEXP_WXLUADEBUG wxLuaStackListData
00069 {
00070 public:
00071 wxLuaStackListData(int item_idx, int level,
00072 const wxLuaDebugData& parentDebugData,
00073 const wxLuaDebugData& childrenDebugData = wxNullLuaDebugData) :
00074 m_item_idx(item_idx), m_level(level),
00075 m_parentDebugData(parentDebugData),
00076 m_childrenDebugData(childrenDebugData) {}
00077
00078 wxLuaDebugItem* GetDebugItem() { return m_parentDebugData.Item(m_item_idx); }
00079
00080 int m_item_idx;
00081 int m_level;
00082 wxLuaDebugData m_parentDebugData;
00083 wxLuaDebugData m_childrenDebugData;
00084 wxTreeItemId m_treeId;
00085 };
00086
00087
00088
00089
00090
00091 class WXDLLIMPEXP_WXLUADEBUG wxLuaStackTreeData : public wxTreeItemData
00092 {
00093 public:
00094 wxLuaStackTreeData(wxLuaStackListData* stkData) : m_stkListData(stkData) {}
00095
00096 wxLuaStackListData* m_stkListData;
00097 };
00098
00099
00100
00101
00102
00103 class WXDLLIMPEXP_WXLUADEBUG wxLuaStackDialog : public wxDialog
00104 {
00105 public:
00106 wxLuaStackDialog() { Init(); }
00107
00108 wxLuaStackDialog(const wxLuaState& wxlState,
00109 wxWindow* parent, wxWindowID id = wxID_ANY,
00110 const wxString& title = wxT("wxLua Stack"),
00111 const wxPoint& pos = wxDefaultPosition,
00112 const wxSize& size = wxDefaultSize)
00113 {
00114 Init();
00115 Create(wxlState, parent, id, title, pos, size);
00116 }
00117
00118 virtual ~wxLuaStackDialog();
00119
00120 bool Create(const wxLuaState& wxlState,
00121 wxWindow* parent, wxWindowID id = wxID_ANY,
00122 const wxString& title = wxT("wxLua Stack"),
00123 const wxPoint& pos = wxDefaultPosition,
00124 const wxSize& size = wxDefaultSize);
00125
00126
00127 enum
00128 {
00129 IMG_UNKNOWN,
00130 IMG_NONE,
00131 IMG_NIL,
00132 IMG_BOOLEAN,
00133 IMG_LIGHTUSERDATA,
00134 IMG_NUMBER,
00135 IMG_STRING,
00136 IMG_TABLE,
00137 IMG_LUAFUNCTION,
00138 IMG_USERDATA,
00139 IMG_THREAD,
00140 IMG_INTEGER,
00141 IMG_CFUNCTION,
00142
00143 IMG_TABLE_OPEN,
00144 IMG__COUNT
00145 };
00146
00147
00148 enum
00149 {
00150 LIST_COL_KEY,
00151 LIST_COL_LEVEL,
00152 LIST_COL_KEY_TYPE,
00153 LIST_COL_VALUE_TYPE,
00154 LIST_COL_VALUE
00155 };
00156
00157
00158
00159 virtual wxBitmap CreateBmpString(const wxBitmap& bmp, const wxString& s);
00160
00161 virtual int GetItemImage(const wxLuaDebugItem *dbgItem);
00162
00163 virtual wxString GetItemText(long item, long column, bool exact_value = false);
00164
00165
00166
00167 virtual void EnumerateStack();
00168 virtual void EnumerateStackEntry(int nEntry);
00169 virtual void EnumerateTable(int nRef, int nEntry, long lc_item);
00170 virtual void EnumerateGlobalData(long lc_item);
00171
00172
00173
00174 void FillStackCombobox(const wxLuaDebugData& debugData);
00175
00176
00177 void FillStackEntry(int nEntry, const wxLuaDebugData& debugData);
00178
00179 void FillTableEntry(long lc_item, const wxLuaDebugData& debugData);
00180
00181
00182
00183
00184 void BeginBatch();
00185 void EndBatch();
00186
00187 long FindListItem(wxLuaStackListData* stkListData, bool get_parent = false) const;
00188
00189 void OnExpandButton(wxCommandEvent& event);
00190 void OnMenu(wxCommandEvent& event);
00191 void OnFind(wxCommandEvent& event);
00192
00193
00194 void OnSelectStack(wxCommandEvent &event);
00195 void SelectStack(int stack_sel);
00196
00197 void OnTreeItem(wxTreeEvent &event);
00198
00199 void OnListItem(wxListEvent &event);
00200
00201 void OnListRightClick(wxListEvent &event);
00202
00203
00204 bool ExpandItem(long lc_item);
00205
00206 bool ExpandItemChildren(long lc_item);
00207
00208 bool CollapseItem(long lc_item);
00209
00210
00211 void SetShowDuplicateExpandMessage(bool show) { m_show_dup_expand_msg = show; }
00212
00213
00214 void DeleteAllListItemData();
00215 void RemoveAllLuaReferences();
00216
00217 wxSplitterWindow* m_splitterWin;
00218 wxListCtrl* m_listCtrl;
00219 wxTreeCtrl* m_treeCtrl;
00220 wxMenu* m_listMenu;
00221
00222 wxChoice* m_stackChoice;
00223 int m_stack_sel;
00224 wxArrayInt m_stackEntries;
00225
00226 wxComboBox* m_findComboBox;
00227 wxMenu* m_findMenu;
00228
00229 wxLuaState m_wxlState;
00230 wxArrayInt m_luaReferences;
00231
00232 wxImageList* m_imageList;
00233 wxColour m_typeColours[IMG__COUNT];
00234 int m_img_font_size;
00235
00236 bool m_show_dup_expand_msg;
00237 int m_batch_count;
00238
00239 wxLongToLongHashMap m_expandedItems;
00240
00241 wxArrayPtrVoid m_listData;
00242
00243 static wxSize m_defaultSize;
00244
00245 private:
00246 void Init();
00247
00248 DECLARE_ABSTRACT_CLASS(wxLuaStackDialog)
00249 DECLARE_EVENT_TABLE()
00250 };
00251
00252 #endif //_WX_LUA_STACKTREE_H_