11 #ifndef _WX_LUAEDITOR_H_
12 #define _WX_LUAEDITOR_H_
14 #include "wxlua/wxlstate.h"
16 class WXDLLIMPEXP_FWD_CORE wxMenu;
17 class WXDLLIMPEXP_FWD_CORE wxKeyEvent;
18 class WXDLLIMPEXP_FWD_CORE wxNotebook;
19 class WXDLLIMPEXP_FWD_CORE wxSplitterWindow;
20 class WXDLLIMPEXP_FWD_CORE wxToolBar;
21 class WXDLLIMPEXP_FWD_WXLUA wxLuaState;
22 class WXDLLIMPEXP_FWD_WXLUA wxLuaEvent;
27 #include "wx/stedit/stedit.h"
28 #include "wx/stedit/steshell.h"
32 #if !defined(wxCHECK_STE_VERSION)
33 #error "wxStEdit version is too old, need at least version 1.6.0"
35 #if !wxCHECK_STE_VERSION(1, 6, 0)
36 #error "wxStEdit version is too old, need at least version 1.6.0"
44 ID_WXLUAIDE_LOAD_LUA = ID_STE__LAST + 1,
45 ID_WXLUAIDE_SAVEAS_LUA,
47 ID_WXLUAIDE_BREAK_LUA,
48 ID_WXLUAIDE_SHOW_STACK,
50 ID_WXLUAIDE_TOGGLE_BREAKPOINT,
53 ID_WXLUAIDE_EDITOR_NOTEBOOK,
54 ID_WXLUAIDE_MSG_NOTEBOOK,
56 ID_WXLUAIDE_OUTPUT_WIN,
70 BEGIN_DECLARE_EVENT_TYPES()
71 DECLARE_LOCAL_EVENT_TYPE(wxEVT_LUASHELL_wxLUA_CREATION, 7000)
72 DECLARE_LOCAL_EVENT_TYPE(wxEVT_LUAIDE_wxLUA_CREATION, 7001)
73 END_DECLARE_EVENT_TYPES()
75 #define EVT_LUASHELL_wxLUA_CREATION(id, fn) wx__DECLARE_WXLUAEVT(wxEVT_LUASHELL_wxLUA_CREATION, id, fn)
76 #define EVT_LUAIDE_wxLUA_CREATION(id, fn) wx__DECLARE_WXLUAEVT(wxEVT_LUAIDE_wxLUA_CREATION, id, fn)
88 const wxPoint& pos = wxDefaultPosition,
89 const wxSize& size = wxDefaultSize,
91 const wxString& name = wxT(
"wxLuaShell")) : wxSTEditorShell()
94 Create(parent,
id, pos, size, style, name);
97 bool Create(wxWindow *parent, wxWindowID
id,
98 const wxPoint& pos = wxDefaultPosition,
99 const wxSize& size = wxDefaultSize,
101 const wxString& name = wxT(
"wxLuaShell"));
106 wxLuaState GetwxLuaState()
const {
return m_wxlState; }
108 virtual void SetwxLuaState(
const wxLuaState& wxlState,
bool is_static);
129 virtual bool RecreatewxLuaState(wxEvtHandler *wxlStateEvtHandler,
int win_id);
132 bool RunString(
const wxString&
string,
bool append_text =
false);
136 virtual size_t DoGetAutoCompleteKeyWords(
const wxString& root, wxArrayString& words);
139 void OnSTEEvent(wxSTEditorEvent& event);
140 void OnLua(wxLuaEvent& event);
142 virtual void UpdateItems(wxMenu *menu, wxMenuBar *menuBar, wxToolBar *toolBar);
145 wxLuaState m_wxlState;
146 bool m_wxlstate_static;
150 DECLARE_EVENT_TABLE();
164 const wxPoint& pos = wxDefaultPosition,
165 const wxSize& size = wxDefaultSize,
167 const wxString& name = wxT(
"wxLuaEditor")) : wxSTEditor()
170 Create(parent,
id, pos, size, style, name);
173 bool Create(wxWindow *parent, wxWindowID
id,
174 const wxPoint& pos = wxDefaultPosition,
175 const wxSize& size = wxDefaultSize,
177 const wxString& name = wxT(
"wxLuaEditor"));
181 wxLuaIDE* GetwxLuaIDE()
const {
return m_wxluaIDE; }
182 void SetwxLuaIDE(
wxLuaIDE* wxluaIDE) { m_wxluaIDE = wxluaIDE; }
186 marginError = STE_MARGIN_MARKER,
187 marginBreak = STE_MARGIN_MARKER,
189 markerError = STE_MARKER__MAX,
193 void ClearBreakpoints();
194 bool HasBreakpoint(
int line);
195 void AddBreakpoint(
int line);
196 void DeleteBreakpoint(
int line);
199 void OnMenu(wxCommandEvent& event);
200 virtual bool HandleMenuEvent(wxCommandEvent& event);
202 void OnMarginClick( wxStyledTextEvent &event );
204 virtual void UpdateItems(wxMenu *menu, wxMenuBar *menuBar, wxToolBar *toolBar);
211 DECLARE_EVENT_TABLE();
223 WXLUAIDE_TB_FILE = 0x0001,
224 WXLUAIDE_TB_LUA = 0x0002,
225 WXLUAIDE_TOOLBAR = WXLUAIDE_TB_FILE|WXLUAIDE_TB_LUA,
226 WXLUAIDE_DEFAULT = WXLUAIDE_TOOLBAR
233 wxLuaIDE( wxWindow *parent, wxWindowID
id,
234 const wxPoint& pos = wxDefaultPosition,
235 const wxSize& size = wxDefaultSize,
237 long options = WXLUAIDE_DEFAULT,
238 const wxString& name = wxT(
"wxLuaIDE")) : wxWindow()
241 Create(parent,
id, pos, size, style, options, name);
244 bool Create( wxWindow *parent, wxWindowID
id,
245 const wxPoint& pos = wxDefaultPosition,
246 const wxSize& size = wxDefaultSize,
248 long options = WXLUAIDE_DEFAULT,
249 const wxString& name = wxT(
"wxLuaIDE"));
254 wxLuaState GetwxLuaState()
const {
return m_wxlState; }
257 void SetwxLuaState(
const wxLuaState& wxlState,
bool is_static);
268 virtual bool RecreatewxLuaState(wxEvtHandler *wxlStateEvtHandler,
int win_id);
271 virtual void OutputLuaEvent(wxLuaEvent &event,
wxLuaShell *outputWin);
275 virtual void WriteMessage(
wxLuaShell *outputWin,
const wxString& str);
278 wxSplitterWindow *GetSplitterWin()
const {
return m_splitter; }
279 wxSTEditorNotebook *GetEditorNotebook()
const {
return m_editorNotebook; }
280 wxSTEditorNotebook *GetMsgNotebook()
const {
return m_msgNotebook; }
281 wxLuaShell *GetLuaOutputWin()
const {
return m_luaOutput; }
282 wxLuaShell *GetLuaShellWin()
const {
return m_luaShell; }
285 void SetMenuBar(wxMenuBar *menuBar);
286 wxMenuBar* GetMenuBar()
const {
return m_editorOptions.GetMenuBar(); }
288 void SetToolBar(wxToolBar *toolbar);
289 wxToolBar *GetToolBar()
const {
return m_editorOptions.GetToolBar(); }
291 void PopulateToolBar(wxToolBar *toolBar,
long options = WXLUAIDE_TOOLBAR)
const;
293 wxMenu* CreatewxLuaMenu()
const;
296 void OnMenu(wxCommandEvent &event);
297 virtual bool HandleMenuEvent(wxCommandEvent& event);
298 void OnLua(wxLuaEvent &event);
299 void OnSize(wxSizeEvent& event);
300 void OnCreateEditor(wxCommandEvent &event);
304 wxLuaState m_wxlState;
305 bool m_wxlstate_static;
307 wxSplitterWindow *m_splitter;
308 wxSTEditorNotebook *m_editorNotebook;
309 wxSTEditorNotebook *m_msgNotebook;
312 wxToolBar *m_toolBar;
313 wxSTEditorOptions m_editorOptions;
314 wxSTEditorOptions m_shellOptions;
318 wxSTERecursionGuardFlag m_rGuard_OnMenu;
319 wxSTERecursionGuardFlag m_rGuard_HandleMenuEvent;
325 DECLARE_EVENT_TABLE();
329 #endif // _WX_LUAEDITOR_H_