Debian Codegraph @

CodeLite/cl_command_event.h

raw
1 //////////////////////////////////////////////////////////////////////////////
2 //////////////////////////////////////////////////////////////////////////////
3 //
4 // copyright : (C) 2014 Eran Ifrah
5 // file name : cl_command_event.h
6 //
7 // -------------------------------------------------------------------------
8 // A
9 // _____ _ _ _ _
10 // / __ \ | | | | (_) |
11 // | / \/ ___ __| | ___| | _| |_ ___
12 // | | / _ \ / _ |/ _ \ | | | __/ _ )
13 // | \__/\ (_) | (_| | __/ |___| | || __/
14 // \____/\___/ \__,_|\___\_____/_|\__\___|
15 //
16 // F i l e
17 //
18 // This program is free software; you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation; either version 2 of the License, or
21 // (at your option) any later version.
22 //
23 //////////////////////////////////////////////////////////////////////////////
24 //////////////////////////////////////////////////////////////////////////////
25
26 #ifndef CLCOMMANDEVENT_H
27 #define CLCOMMANDEVENT_H
28
29 #include "LSP/CompletionItem.h"
30 #include "UIBreakpoint.hpp"
31 #include "asyncprocess.h"
32 #include "clDebuggerBreakpoint.hpp"
33 #include "clEditorConfig.h"
34 #include "clGotoEntry.h"
35 #include "codelite_exports.h"
36 #include "entry.h"
37 #include "ssh_account_info.h"
38 #include "wxCodeCompletionBoxEntry.hpp"
39
40 #include <vector>
41 #include <wx/arrstr.h>
42 #include <wx/event.h>
43 #include <wx/sharedptr.h>
44
45 // Set of flags that can be passed within the 'S{G}etInt' function of clCommandEvent
46 enum {
47 kEventImportingFolder = 0x00000001,
48 };
49
50 #if !wxUSE_GUI
51 // To allow building libcodelite without UI we need these 2 event types (wxCommandEvent and wxNotifyEvent)
52 class WXDLLIMPEXP_CL wxCommandEvent : public wxEvent, public wxEventBasicPayloadMixin
53 {
54 public:
55 wxCommandEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
56 : wxEvent(winid, commandType)
57 {
58 m_clientData = NULL;
59 m_clientObject = NULL;
60 m_isCommandEvent = true;
61
62 // the command events are propagated upwards by default
63 m_propagationLevel = wxEVENT_PROPAGATE_MAX;
64 }
65
66 wxCommandEvent(const wxCommandEvent& event)
67 : wxEvent(event)
68 , wxEventBasicPayloadMixin(event)
69 , m_clientData(event.m_clientData)
70 , m_clientObject(event.m_clientObject)
71 {
72 // Because GetString() can retrieve the string text only on demand, we
73 // need to copy it explicitly.
74 if(m_cmdString.empty())
75 m_cmdString = event.GetString();
76 }
77
78 virtual ~wxCommandEvent() {}
79
80 // Set/Get client data from controls
81 void SetClientData(void* clientData) { m_clientData = clientData; }
82 void* GetClientData() const { return m_clientData; }
83
84 // Set/Get client object from controls
85 void SetClientObject(wxClientData* clientObject) { m_clientObject = clientObject; }
86 wxClientData* GetClientObject() const { return m_clientObject; }
87
88 // Note: this shadows wxEventBasicPayloadMixin::GetString(), because it does some
89 // GUI-specific hacks
90 wxString GetString() const { return m_cmdString; }
91
92 // Get listbox selection if single-choice
93 int GetSelection() const { return m_commandInt; }
94
95 // Get checkbox value
96 bool IsChecked() const { return m_commandInt != 0; }
97
98 // true if the listbox event was a selection.
99 bool IsSelection() const { return (m_extraLong != 0); }
100
101 virtual wxEvent* Clone() const wxOVERRIDE { return new wxCommandEvent(*this); }
102 virtual wxEventCategory GetEventCategory() const wxOVERRIDE { return wxEVT_CATEGORY_USER_INPUT; }
103
104 protected:
105 void* m_clientData; // Arbitrary client data
106 wxClientData* m_clientObject; // Arbitrary client object
107 };
108
109 // this class adds a possibility to react (from the user) code to a control
110 // notification: allow or veto the operation being reported.
111 class WXDLLIMPEXP_CL wxNotifyEvent : public wxCommandEvent
112 {
113 public:
114 wxNotifyEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
115 : wxCommandEvent(commandType, winid)
116 {
117 m_bAllow = true;
118 }
119
120 wxNotifyEvent(const wxNotifyEvent& event)
121 : wxCommandEvent(event)
122 {
123 m_bAllow = event.m_bAllow;
124 }
125
126 // veto the operation (usually it's allowed by default)
127 void Veto() { m_bAllow = false; }
128
129 // allow the operation if it was disabled by default
130 void Allow() { m_bAllow = true; }
131
132 // for implementation code only: is the operation allowed?
133 bool IsAllowed() const { return m_bAllow; }
134
135 virtual wxEvent* Clone() const wxOVERRIDE { return new wxNotifyEvent(*this); }
136
137 private:
138 bool m_bAllow;
139 };
140
141 #endif // !wxUSE_GUI
142
143 /// a wxCommandEvent that takes ownership of the clientData
144 class WXDLLIMPEXP_CL clCommandEvent : public wxCommandEvent
145 {
146 protected:
147 wxSharedPtr<wxClientData> m_ptr;
148 wxArrayString m_strings;
149 wxString m_fileName;
150 wxString m_oldName;
151 bool m_answer;
152 bool m_allowed;
153 int m_lineNumber;
154 bool m_selected;
155
156 public:
157 clCommandEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
158 clCommandEvent(const clCommandEvent& event);
159 clCommandEvent& operator=(const clCommandEvent& src);
160 virtual ~clCommandEvent();
161
162 clCommandEvent& SetSelected(bool selected)
163 {
164 this->m_selected = selected;
165 return *this;
166 }
167 bool IsSelected() const { return m_selected; }
168
169 // Veto management
170 void Veto() { this->m_allowed = false; }
171 void Allow() { this->m_allowed = true; }
172
173 // Hides wxCommandEvent::Set{Get}ClientObject
174 void SetClientObject(wxClientData* clientObject);
175
176 wxClientData* GetClientObject() const;
177 virtual wxEvent* Clone() const;
178
179 clCommandEvent& SetLineNumber(int lineNumber)
180 {
181 this->m_lineNumber = lineNumber;
182 return *this;
183 }
184 int GetLineNumber() const { return m_lineNumber; }
185 clCommandEvent& SetAllowed(bool allowed)
186 {
187 this->m_allowed = allowed;
188 return *this;
189 }
190 clCommandEvent& SetAnswer(bool answer)
191 {
192 this->m_answer = answer;
193 return *this;
194 }
195 clCommandEvent& SetFileName(const wxString& fileName)
196 {
197 this->m_fileName = fileName;
198 return *this;
199 }
200 clCommandEvent& SetOldName(const wxString& oldName)
201 {
202 this->m_oldName = oldName;
203 return *this;
204 }
205 clCommandEvent& SetPtr(const wxSharedPtr<wxClientData>& ptr)
206 {
207 this->m_ptr = ptr;
208 return *this;
209 }
210 clCommandEvent& SetStrings(const wxArrayString& strings)
211 {
212 this->m_strings = strings;
213 return *this;
214 }
215 bool IsAllowed() const { return m_allowed; }
216 bool IsAnswer() const { return m_answer; }
217 const wxString& GetFileName() const { return m_fileName; }
218 const wxString& GetOldName() const { return m_oldName; }
219 const wxSharedPtr<wxClientData>& GetPtr() const { return m_ptr; }
220 const wxArrayString& GetStrings() const { return m_strings; }
221 wxArrayString& GetStrings() { return m_strings; }
222 };
223
224 typedef void (wxEvtHandler::*clCommandEventFunction)(clCommandEvent&);
225 #define clCommandEventHandler(func) wxEVENT_HANDLER_CAST(clCommandEventFunction, func)
226
227 /// Source control event
228 class WXDLLIMPEXP_CL clSourceControlEvent : public clCommandEvent
229 {
230 protected:
231 wxString m_sourceControlName;
232
233 public:
234 clSourceControlEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
235 clSourceControlEvent(const clSourceControlEvent& event);
236 clSourceControlEvent& operator=(const clSourceControlEvent& src);
237 virtual ~clSourceControlEvent();
238 virtual wxEvent* Clone() const;
239 void SetSourceControlName(const wxString& sourceControlName) { this->m_sourceControlName = sourceControlName; }
240 const wxString& GetSourceControlName() const { return m_sourceControlName; }
241 };
242
243 typedef void (wxEvtHandler::*clSourceControlEventFunction)(clSourceControlEvent&);
244 #define clSourceControlEventHandler(func) wxEVENT_HANDLER_CAST(clSourceControlEventFunction, func)
245
246 /// Source control event
247 struct WXDLLIMPEXP_CL RecentWorkspace {
248 wxString m_category;
249 wxString m_account; // for remote workspaces, which account does this workspace belongs to
250 wxString m_name;
251 wxString path;
252 };
253
254 class WXDLLIMPEXP_CL clRecentWorkspaceEvent : public clCommandEvent
255 {
256 protected:
257 std::vector<RecentWorkspace> m_workspaces;
258
259 public:
260 clRecentWorkspaceEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
261 clRecentWorkspaceEvent(const clRecentWorkspaceEvent& event);
262 clRecentWorkspaceEvent& operator=(const clRecentWorkspaceEvent& src);
263 virtual ~clRecentWorkspaceEvent();
264 virtual wxEvent* Clone() const;
265
266 void SetWorkspaces(const std::vector<RecentWorkspace>& workspaces) { this->m_workspaces = workspaces; }
267 const std::vector<RecentWorkspace>& GetWorkspaces() const { return m_workspaces; }
268 std::vector<RecentWorkspace>& GetWorkspaces() { return m_workspaces; }
269 };
270
271 typedef void (wxEvtHandler::*clRecentWorkspaceEventFunction)(clRecentWorkspaceEvent&);
272 #define clRecentWorkspaceEventHandler(func) wxEVENT_HANDLER_CAST(clRecentWorkspaceEventFunction, func)
273
274 /// a clCodeCompletionEvent
275 class WXDLLIMPEXP_CL clCodeCompletionEvent : public clCommandEvent
276 {
277 wxString m_word;
278 int m_position;
279 wxString m_tooltip;
280 bool m_insideCommentOrString;
281 wxCodeCompletionBoxEntry::Ptr_t m_entry;
282 wxArrayString m_definitions;
283 wxCodeCompletionBoxEntry::Vec_t m_entries;
284 LSP::CompletionItem::eTriggerKind m_triggerKind = LSP::CompletionItem::kTriggerUnknown;
285
286 // semantic highlights. We support 2 types variables and classes
287 wxString m_variables;
288 wxString m_classes;
289
290 public:
291 clCodeCompletionEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
292 clCodeCompletionEvent(const clCodeCompletionEvent& event);
293 clCodeCompletionEvent& operator=(const clCodeCompletionEvent& src);
294 virtual ~clCodeCompletionEvent();
295 virtual wxEvent* Clone() const;
296
297 void SetDefinitions(const wxArrayString& definitions) { this->m_definitions = definitions; }
298 const wxArrayString& GetDefinitions() const { return m_definitions; }
299 void SetEntry(wxCodeCompletionBoxEntry::Ptr_t entry) { this->m_entry = entry; }
300 wxCodeCompletionBoxEntry::Ptr_t GetEntry() { return m_entry; }
301
302 void SetInsideCommentOrString(bool insideCommentOrString) { this->m_insideCommentOrString = insideCommentOrString; }
303
304 bool IsInsideCommentOrString() const { return m_insideCommentOrString; }
305 void SetEntries(const wxCodeCompletionBoxEntry::Vec_t& entries) { this->m_entries = entries; }
306 const wxCodeCompletionBoxEntry::Vec_t& GetEntries() const { return m_entries; }
307 wxCodeCompletionBoxEntry::Vec_t& GetEntries() { return m_entries; }
308
309 const LSP::CompletionItem::eTriggerKind& GetTriggerKind() const { return m_triggerKind; }
310 void SetTriggerKind(const LSP::CompletionItem::eTriggerKind& triggerKind) { this->m_triggerKind = triggerKind; }
311
312 void SetWord(const wxString& word) { this->m_word = word; }
313
314 void SetClasses(const wxString& classes) { this->m_classes = classes; }
315 void SetVariables(const wxString& variables) { this->m_variables = variables; }
316 const wxString& GetClasses() const { return m_classes; }
317 const wxString& GetVariables() const { return m_variables; }
318
319 /**
320 * @brief return the user typed word up to the caret position
321 */
322 const wxString& GetWord() const { return m_word; }
323 void SetPosition(int position) { this->m_position = position; }
324 /**
325 * @brief return the editor position
326 */
327 int GetPosition() const { return m_position; }
328 void SetTooltip(const wxString& tooltip) { this->m_tooltip = tooltip; }
329 const wxString& GetTooltip() const { return m_tooltip; }
330 };
331
332 typedef void (wxEvtHandler::*clCodeCompletionEventFunction)(clCodeCompletionEvent&);
333 #define clCodeCompletionEventHandler(func) wxEVENT_HANDLER_CAST(clCodeCompletionEventFunction, func)
334
335 class WXDLLIMPEXP_CL clColourEvent : public clCommandEvent
336 {
337 #if wxUSE_GUI
338 wxColour m_bgColour;
339 wxColour m_fgColour;
340 wxColour m_borderColour;
341 wxWindow* m_page;
342 #endif
343 bool m_isActiveTab;
344
345 public:
346 clColourEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
347 clColourEvent(const clColourEvent& event);
348 clColourEvent& operator=(const clColourEvent& src);
349 virtual ~clColourEvent();
350 virtual wxEvent* Clone() const { return new clColourEvent(*this); };
351
352 #if wxUSE_GUI
353 void SetBorderColour(const wxColour& borderColour) { this->m_borderColour = borderColour; }
354 const wxColour& GetBorderColour() const { return m_borderColour; }
355 void SetPage(wxWindow* page) { this->m_page = page; }
356 wxWindow* GetPage() { return m_page; }
357 void SetBgColour(const wxColour& bgColour) { this->m_bgColour = bgColour; }
358 void SetFgColour(const wxColour& fgColour) { this->m_fgColour = fgColour; }
359 const wxColour& GetBgColour() const { return m_bgColour; }
360 const wxColour& GetFgColour() const { return m_fgColour; }
361 #endif
362 void SetIsActiveTab(bool isActiveTab) { this->m_isActiveTab = isActiveTab; }
363 bool IsActiveTab() const { return m_isActiveTab; }
364 };
365
366 typedef void (wxEvtHandler::*clColourEventFunction)(clColourEvent&);
367 #define clColourEventHandler(func) wxEVENT_HANDLER_CAST(clColourEventFunction, func)
368
369 // -------------------------------------------------------------------------
370 // -------------------------------------------------------------------------
371 class WXDLLIMPEXP_CL clBuildEvent : public clCommandEvent
372 {
373 public:
374 enum eFlags {
375 kClean = (1 << 0),
376 kBuild = (1 << 1),
377 kCustomProject = (1 << 2),
378 };
379
380 protected:
381 wxString m_projectName;
382 wxString m_configurationName;
383 wxString m_command;
384 bool m_projectOnly;
385 size_t m_warningCount;
386 size_t m_errorCount;
387 wxString m_kind;
388 bool m_isRunning = false;
389 bool m_cleanLog = true;
390 size_t m_flags = 0;
391 wxString m_toolchain;
392
393 public:
394 clBuildEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
395 clBuildEvent(const clBuildEvent& event);
396 clBuildEvent& operator=(const clBuildEvent& src);
397 virtual ~clBuildEvent();
398 virtual wxEvent* Clone() const { return new clBuildEvent(*this); };
399
400 void SetFlag(eFlags f, bool b)
401 {
402 if(b) {
403 m_flags |= f;
404 } else {
405 m_flags &= ~f;
406 }
407 }
408
409 void SetToolchain(const wxString& toolchain) { this->m_toolchain = toolchain; }
410 const wxString& GetToolchain() const { return m_toolchain; }
411 bool HasFlag(eFlags f) const { return m_flags & f; }
412 void SetIsRunning(bool isRunning) { this->m_isRunning = isRunning; }
413 bool IsRunning() const { return m_isRunning; }
414 void SetCleanLog(bool cleanLog) { this->m_cleanLog = cleanLog; }
415 bool IsCleanLog() const { return m_cleanLog; }
416 void SetKind(const wxString& kind) { this->m_kind = kind; }
417 const wxString& GetKind() const { return this->m_kind; }
418
419 void SetProjectOnly(bool projectOnly) { this->m_projectOnly = projectOnly; }
420 bool IsProjectOnly() const { return m_projectOnly; }
421 void SetCommand(const wxString& command) { this->m_command = command; }
422 const wxString& GetCommand() const { return m_command; }
423 void SetConfigurationName(const wxString& configurationName) { this->m_configurationName = configurationName; }
424 void SetProjectName(const wxString& projectName) { this->m_projectName = projectName; }
425 const wxString& GetConfigurationName() const { return m_configurationName; }
426 const wxString& GetProjectName() const { return m_projectName; }
427
428 void SetErrorCount(size_t errorCount) { this->m_errorCount = errorCount; }
429 void SetWarningCount(size_t warningCount) { this->m_warningCount = warningCount; }
430 size_t GetErrorCount() const { return m_errorCount; }
431 size_t GetWarningCount() const { return m_warningCount; }
432 };
433
434 typedef void (wxEvtHandler::*clBuildEventFunction)(clBuildEvent&);
435 #define clBuildEventHandler(func) wxEVENT_HANDLER_CAST(clBuildEventFunction, func)
436
437 // -------------------------------------------------------------------------
438 // clDebugEvent
439 // -------------------------------------------------------------------------
440 class WXDLLIMPEXP_CL clDebugEvent : public clCommandEvent
441 {
442 wxString m_projectName; // wxEVT_DBG_UI_START_OR_CONT
443 wxString m_configurationName; // wxEVT_DBG_UI_START_OR_CONT
444 wxString m_debuggerName; // holds the selected debugger name. wxEVT_DBG_UI_START_OR_CONT, wxEVT_DBG_UI_QUICK_DEBUG,
445 // wxEVT_DBG_UI_CORE_FILE
446 wxString m_executableName; // This will be set for wxEVT_DBG_UI_QUICK_DEBUG and wxEVT_DBG_UI_CORE_FILE
447 wxString m_coreFile; // wxEVT_DBG_UI_CORE_FILE
448 wxString m_workingDirectory; // wxEVT_DBG_UI_CORE_FILE, wxEVT_DBG_UI_QUICK_DEBUG
449 wxString m_arguments; // wxEVT_DBG_UI_QUICK_DEBUG
450 wxString m_startupCommands; // wxEVT_DBG_UI_QUICK_DEBUG
451 size_t m_features;
452 wxString m_memoryAddress; // wxEVT_DEBUGGER_SET_MEMORY
453 wxString m_memoryBlockValue; // wxEVT_DEBUGGER_SET_MEMORY
454 size_t m_memoryBlockSize; // wxEVT_DEBUGGER_SET_MEMORY
455 clDebuggerBreakpoint::Vec_t m_breakpoints;
456 bool m_isSSHDebugging = false;
457 wxString m_sshAccount;
458 wxString m_alternateDebuggerPath; // Holds the path to an alternate debugger executable
459 UIBreakpoint m_uiBreakpoint;
460
461 public:
462 // Special features not available by all the debuggers
463 enum eFeatures {
464 kStepInst = (1 << 0), // single step instruction
465 kInterrupt = (1 << 1), // interrup the running process
466 kShowCursor = (1 << 2), // show the current active line
467 kJumpToCursor = (1 << 3), // Jump to the caret line, without executing the code in between
468 kRunToCursor = (1 << 4), // execute all the code until reaching the caret
469 kReverseDebugging = (1 << 5), // execute all the code until reaching the caret
470 kAllFeatures = kStepInst | kInterrupt | kShowCursor | kJumpToCursor | kRunToCursor | kReverseDebugging,
471 };
472
473 public:
474 clDebugEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
475 clDebugEvent(const clDebugEvent& event);
476 clDebugEvent& operator=(const clDebugEvent& other);
477
478 virtual ~clDebugEvent();
479 virtual wxEvent* Clone() const { return new clDebugEvent(*this); };
480
481 void SetUiBreakpoint(const UIBreakpoint& uiBreakpoint) { this->m_uiBreakpoint = uiBreakpoint; }
482 const UIBreakpoint& GetUiBreakpoint() const { return m_uiBreakpoint; }
483
484 void SetAlternateDebuggerPath(const wxString& alternateDebuggerPath)
485 {
486 this->m_alternateDebuggerPath = alternateDebuggerPath;
487 }
488 const wxString& GetAlternateDebuggerPath() const { return m_alternateDebuggerPath; }
489 void SetSshAccount(const wxString& sshAccount) { this->m_sshAccount = sshAccount; }
490 const wxString& GetSshAccount() const { return m_sshAccount; }
491 void SetIsSSHDebugging(bool isSSHDebugging) { this->m_isSSHDebugging = isSSHDebugging; }
492 bool IsSSHDebugging() const { return m_isSSHDebugging; }
493 void SetFeatures(size_t features) { m_features = features; }
494 size_t GetFeatures() const { return m_features; }
495 void SetDebuggerName(const wxString& debuggerName) { this->m_debuggerName = debuggerName; }
496 const wxString& GetDebuggerName() const { return m_debuggerName; }
497 void SetArguments(const wxString& arguments) { this->m_arguments = arguments; }
498 void SetCoreFile(const wxString& coreFile) { this->m_coreFile = coreFile; }
499 void SetExecutableName(const wxString& executableName) { this->m_executableName = executableName; }
500 void SetStartupCommands(const wxString& startupCommands) { this->m_startupCommands = startupCommands; }
501 void SetWorkingDirectory(const wxString& workingDirectory) { this->m_workingDirectory = workingDirectory; }
502 const wxString& GetArguments() const { return m_arguments; }
503 const wxString& GetCoreFile() const { return m_coreFile; }
504 const wxString& GetExecutableName() const { return m_executableName; }
505 const wxString& GetStartupCommands() const { return m_startupCommands; }
506 const wxString& GetWorkingDirectory() const { return m_workingDirectory; }
507 void SetConfigurationName(const wxString& configurationName) { this->m_configurationName = configurationName; }
508 void SetProjectName(const wxString& projectName) { this->m_projectName = projectName; }
509 const wxString& GetConfigurationName() const { return m_configurationName; }
510 const wxString& GetProjectName() const { return m_projectName; }
511 void SetMemoryAddress(const wxString& memoryAddress) { this->m_memoryAddress = memoryAddress; }
512 void SetMemoryBlockSize(size_t memoryBlockSize) { this->m_memoryBlockSize = memoryBlockSize; }
513 void SetMemoryBlockValue(const wxString& memoryBlockValue) { this->m_memoryBlockValue = memoryBlockValue; }
514 const wxString& GetMemoryAddress() const { return m_memoryAddress; }
515 size_t GetMemoryBlockSize() const { return m_memoryBlockSize; }
516 const wxString& GetMemoryBlockValue() const { return m_memoryBlockValue; }
517 void SetBreakpoints(const clDebuggerBreakpoint::Vec_t& breakpoints) { this->m_breakpoints = breakpoints; }
518 const clDebuggerBreakpoint::Vec_t& GetBreakpoints() const { return m_breakpoints; }
519 clDebuggerBreakpoint::Vec_t& GetBreakpoints() { return m_breakpoints; }
520 };
521
522 typedef void (wxEvtHandler::*clDebugEventFunction)(clDebugEvent&);
523 #define clDebugEventHandler(func) wxEVENT_HANDLER_CAST(clDebugEventFunction, func)
524
525 // ------------------------------------------------------------------
526 // clNewProjectEvent
527 // ------------------------------------------------------------------
528 class WXDLLIMPEXP_CL clNewProjectEvent : public clCommandEvent
529 {
530 public:
531 struct Template {
532 wxString m_category;
533 wxString m_categoryPng;
534 wxString m_template;
535 wxString m_templatePng;
536 wxString m_toolchain;
537 wxString m_debugger;
538 bool m_allowSeparateFolder;
539 Template()
540 : m_allowSeparateFolder(true)
541 {
542 }
543 typedef std::vector<clNewProjectEvent::Template> Vec_t;
544 };
545
546 protected:
547 clNewProjectEvent::Template::Vec_t m_templates;
548 wxString m_toolchain;
549 wxString m_debugger;
550 wxString m_projectName;
551 wxString m_projectFolder;
552 wxString m_templateName;
553
554 public:
555 clNewProjectEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
556 clNewProjectEvent(const clNewProjectEvent& event);
557 clNewProjectEvent& operator=(const clNewProjectEvent& src);
558 virtual ~clNewProjectEvent();
559 virtual wxEvent* Clone() const { return new clNewProjectEvent(*this); };
560
561 void SetTemplates(const clNewProjectEvent::Template::Vec_t& templates) { this->m_templates = templates; }
562 const clNewProjectEvent::Template::Vec_t& GetTemplates() const { return m_templates; }
563 clNewProjectEvent::Template::Vec_t& GetTemplates() { return m_templates; }
564
565 void SetDebugger(const wxString& debugger) { this->m_debugger = debugger; }
566 void SetProjectFolder(const wxString& projectFolder) { this->m_projectFolder = projectFolder; }
567 void SetProjectName(const wxString& projectName) { this->m_projectName = projectName; }
568 void SetToolchain(const wxString& toolchain) { this->m_toolchain = toolchain; }
569 const wxString& GetDebugger() const { return m_debugger; }
570 const wxString& GetProjectFolder() const { return m_projectFolder; }
571 const wxString& GetProjectName() const { return m_projectName; }
572 const wxString& GetToolchain() const { return m_toolchain; }
573 void SetTemplateName(const wxString& templateName) { this->m_templateName = templateName; }
574 const wxString& GetTemplateName() const { return m_templateName; }
575 };
576
577 typedef void (wxEvtHandler::*clNewProjectEventFunction)(clNewProjectEvent&);
578 #define clNewProjectEventHandler(func) wxEVENT_HANDLER_CAST(clNewProjectEventFunction, func)
579
580 // --------------------------------------------------------------
581 // Compiler event
582 // --------------------------------------------------------------
583 class WXDLLIMPEXP_CL clCompilerEvent : public clCommandEvent
584 {
585 public:
586 clCompilerEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
587 clCompilerEvent(const clCompilerEvent& event);
588 clCompilerEvent& operator=(const clCompilerEvent& src);
589 virtual ~clCompilerEvent();
590 virtual wxEvent* Clone() const { return new clCompilerEvent(*this); }
591 };
592
593 typedef void (wxEvtHandler::*clCompilerEventFunction)(clCompilerEvent&);
594 #define clCompilerEventHandler(func) wxEVENT_HANDLER_CAST(clCompilerEventFunction, func)
595
596 // --------------------------------------------------------------
597 // GotoAnything event
598 // --------------------------------------------------------------
599 class WXDLLIMPEXP_CL clGotoEvent : public clCommandEvent
600 {
601 clGotoEntry::Vec_t m_entries;
602 clGotoEntry m_entry;
603
604 public:
605 clGotoEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
606 clGotoEvent(const clGotoEvent& src);
607 clGotoEvent& operator=(const clGotoEvent& src);
608 virtual ~clGotoEvent();
609 virtual wxEvent* Clone() const { return new clGotoEvent(*this); }
610 const clGotoEntry::Vec_t& GetEntries() const { return m_entries; }
611 clGotoEntry::Vec_t& GetEntries() { return m_entries; }
612 void SetEntries(const clGotoEntry::Vec_t& entries) { m_entries = entries; }
613 void SetEntry(const clGotoEntry& entry) { this->m_entry = entry; }
614 const clGotoEntry& GetEntry() const { return m_entry; }
615 };
616
617 typedef void (wxEvtHandler::*clGotoEventFunction)(clGotoEvent&);
618 #define clGotoEventHandler(func) wxEVENT_HANDLER_CAST(clGotoEventFunction, func)
619
620 // --------------------------------------------------------------
621 // Processs event
622 // --------------------------------------------------------------
623 class IProcess;
624 class WXDLLIMPEXP_CL clProcessEvent : public clCommandEvent
625 {
626 wxString m_output;
627 IProcess* m_process;
628
629 public:
630 clProcessEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
631 clProcessEvent(const clProcessEvent& event);
632 clProcessEvent& operator=(const clProcessEvent& src);
633 virtual ~clProcessEvent();
634 virtual wxEvent* Clone() const { return new clProcessEvent(*this); }
635
636 void SetOutput(const wxString& output) { this->m_output = output; }
637 void SetProcess(IProcess* process) { this->m_process = process; }
638 const wxString& GetOutput() const { return m_output; }
639 IProcess* GetProcess() { return m_process; }
640 };
641
642 typedef void (wxEvtHandler::*clProcessEventFunction)(clProcessEvent&);
643 #define clProcessEventHandler(func) wxEVENT_HANDLER_CAST(clProcessEventFunction, func)
644
645 //---------------------------------------------------------------
646 // Source formatting event
647 //---------------------------------------------------------------
648 class WXDLLIMPEXP_CL clSourceFormatEvent : public clCommandEvent
649 {
650 wxString m_inputString;
651 wxString m_formattedString;
652
653 public:
654 clSourceFormatEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
655 clSourceFormatEvent(const clSourceFormatEvent& event);
656 clSourceFormatEvent& operator=(const clSourceFormatEvent& src);
657 virtual ~clSourceFormatEvent();
658 virtual wxEvent* Clone() const { return new clSourceFormatEvent(*this); }
659 void SetFormattedString(const wxString& formattedString) { this->m_formattedString = formattedString; }
660 void SetInputString(const wxString& inputString) { this->m_inputString = inputString; }
661 const wxString& GetFormattedString() const { return m_formattedString; }
662 const wxString& GetInputString() const { return m_inputString; }
663 };
664
665 typedef void (wxEvtHandler::*clSourceFormatEventFunction)(clSourceFormatEvent&);
666 #define clSourceFormatEventHandler(func) wxEVENT_HANDLER_CAST(clSourceFormatEventFunction, func)
667
668 //---------------------------------------------------------------
669 // Context menu event
670 //---------------------------------------------------------------
671 class WXDLLIMPEXP_CL clContextMenuEvent : public clCommandEvent
672 {
673 #if wxUSE_GUI
674 wxMenu* m_menu;
675 #endif
676 wxObject* m_editor;
677 wxString m_path;
678
679 public:
680 clContextMenuEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
681 clContextMenuEvent(const clContextMenuEvent& event);
682 clContextMenuEvent& operator=(const clContextMenuEvent& src);
683 virtual ~clContextMenuEvent();
684 virtual wxEvent* Clone() const { return new clContextMenuEvent(*this); }
685 #if wxUSE_GUI
686 void SetMenu(wxMenu* menu) { this->m_menu = menu; }
687 wxMenu* GetMenu() { return m_menu; }
688 #endif
689 void SetEditor(wxObject* editor) { this->m_editor = editor; }
690 wxObject* GetEditor() { return m_editor; }
691 const wxString& GetPath() const { return m_path; }
692 void SetPath(const wxString& path) { m_path = path; }
693 };
694
695 typedef void (wxEvtHandler::*clContextMenuEventFunction)(clContextMenuEvent&);
696 #define clContextMenuEventHandler(func) wxEVENT_HANDLER_CAST(clContextMenuEventFunction, func)
697
698 //---------------------------------------------------------------
699 // Execute event
700 //---------------------------------------------------------------
701 class WXDLLIMPEXP_CL clExecuteEvent : public clCommandEvent
702 {
703 wxString m_targetName;
704
705 public:
706 clExecuteEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
707 clExecuteEvent(const clExecuteEvent& event);
708 clExecuteEvent& operator=(const clExecuteEvent& src);
709 virtual ~clExecuteEvent();
710 virtual wxEvent* Clone() const { return new clExecuteEvent(*this); }
711
712 void SetTargetName(const wxString& targetName) { this->m_targetName = targetName; }
713 const wxString& GetTargetName() const { return m_targetName; }
714 };
715
716 typedef void (wxEvtHandler::*clExecuteEventFunction)(clExecuteEvent&);
717 #define clExecuteEventHandler(func) wxEVENT_HANDLER_CAST(clExecuteEventFunction, func)
718
719 //---------------------------------------------------------------
720 // Execute event
721 //---------------------------------------------------------------
722 class WXDLLIMPEXP_CL clProjectSettingsEvent : public clCommandEvent
723 {
724 wxString m_configName;
725 wxString m_projectName;
726
727 public:
728 clProjectSettingsEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
729 clProjectSettingsEvent(const clProjectSettingsEvent& event);
730 clProjectSettingsEvent& operator=(const clProjectSettingsEvent& src);
731 virtual ~clProjectSettingsEvent();
732 virtual wxEvent* Clone() const { return new clProjectSettingsEvent(*this); }
733 void SetConfigName(const wxString& configName) { this->m_configName = configName; }
734 void SetProjectName(const wxString& projectName) { this->m_projectName = projectName; }
735 const wxString& GetConfigName() const { return m_configName; }
736 const wxString& GetProjectName() const { return m_projectName; }
737 };
738
739 typedef void (wxEvtHandler::*clProjectSettingsEventFunction)(clProjectSettingsEvent&);
740 #define clProjectSettingsEventHandler(func) wxEVENT_HANDLER_CAST(clProjectSettingsEventFunction, func)
741
742 //---------------------------------------------------------------
743 // Find event
744 //---------------------------------------------------------------
745 class WXDLLIMPEXP_CL clFindEvent : public clCommandEvent
746 {
747 wxStyledTextCtrl* m_ctrl;
748
749 public:
750 clFindEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
751 clFindEvent(const clFindEvent& event);
752 clFindEvent& operator=(const clFindEvent& src);
753 virtual ~clFindEvent();
754 virtual wxEvent* Clone() const { return new clFindEvent(*this); }
755
756 void SetCtrl(wxStyledTextCtrl* ctrl) { this->m_ctrl = ctrl; }
757 wxStyledTextCtrl* GetCtrl() { return m_ctrl; }
758 };
759
760 typedef void (wxEvtHandler::*clFindEventFunction)(clFindEvent&);
761 #define clFindEventHandler(func) wxEVENT_HANDLER_CAST(clFindEventFunction, func)
762
763 //---------------------------------------------------------------
764 // Find in files event
765 //---------------------------------------------------------------
766 class WXDLLIMPEXP_CL clFindInFilesEvent : public clCommandEvent
767 {
768 public:
769 struct Location {
770 size_t line = 0;
771 size_t column_start = 0;
772 size_t column_end = 0;
773 wxString pattern;
774 typedef std::vector<Location> vec_t;
775 };
776
777 struct Match {
778 wxString file;
779 Location::vec_t locations;
780 typedef std::vector<Match> vec_t;
781 };
782
783 protected:
784 wxString m_paths;
785 wxString m_fileMask;
786 size_t m_options = 0;
787 wxString m_transientPaths;
788 Match::vec_t m_matches;
789
790 public:
791 clFindInFilesEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
792 clFindInFilesEvent(const clFindInFilesEvent& event);
793 clFindInFilesEvent& operator=(const clFindInFilesEvent& src);
794 virtual ~clFindInFilesEvent();
795 virtual wxEvent* Clone() const { return new clFindInFilesEvent(*this); }
796 void SetFileMask(const wxString& fileMask) { this->m_fileMask = fileMask; }
797 void SetOptions(size_t options) { this->m_options = options; }
798 const wxString& GetFileMask() const { return m_fileMask; }
799 size_t GetOptions() const { return m_options; }
800 void SetPaths(const wxString& paths) { this->m_paths = paths; }
801 const wxString& GetPaths() const { return m_paths; }
802 void SetTransientPaths(const wxString& transientPaths) { this->m_transientPaths = transientPaths; }
803 const wxString& GetTransientPaths() const { return m_transientPaths; }
804 Match::vec_t& GetMatches() { return m_matches; }
805 const Match::vec_t& GetMatches() const { return m_matches; }
806 void SetMatches(const Match::vec_t& matches) { m_matches = matches; }
807 };
808
809 typedef void (wxEvtHandler::*clFindInFilesEventFunction)(clFindInFilesEvent&);
810 #define clFindInFilesEventHandler(func) wxEVENT_HANDLER_CAST(clFindInFilesEventFunction, func)
811
812 // --------------------------------------------------------------
813 // Parsing event
814 // --------------------------------------------------------------
815 class WXDLLIMPEXP_CL clParseEvent : public clCommandEvent
816 {
817 size_t m_curfileIndex;
818 size_t m_totalFiles;
819
820 public:
821 clParseEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
822 clParseEvent(const clParseEvent& event);
823 clParseEvent& operator=(const clParseEvent& src);
824 virtual ~clParseEvent();
825 virtual wxEvent* Clone() const { return new clParseEvent(*this); }
826 void SetCurfileIndex(size_t curfileIndex) { this->m_curfileIndex = curfileIndex; }
827 void SetTotalFiles(size_t totalFiles) { this->m_totalFiles = totalFiles; }
828 size_t GetCurfileIndex() const { return m_curfileIndex; }
829 size_t GetTotalFiles() const { return m_totalFiles; }
830 };
831
832 typedef void (wxEvtHandler::*clParseEventFunction)(clParseEvent&);
833 #define clParseEventHandler(func) wxEVENT_HANDLER_CAST(clParseEventFunction, func)
834
835 // --------------------------------------------------------------
836 // clEditorConfigEvent event
837 // --------------------------------------------------------------
838 class WXDLLIMPEXP_CL clEditorConfigEvent : public clCommandEvent
839 {
840 clEditorConfigSection m_editorConfigSection;
841
842 public:
843 clEditorConfigEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
844 clEditorConfigEvent(const clEditorConfigEvent& event);
845 clEditorConfigEvent& operator=(const clEditorConfigEvent& src);
846 virtual ~clEditorConfigEvent();
847 virtual wxEvent* Clone() const { return new clEditorConfigEvent(*this); }
848 void SetEditorConfig(const clEditorConfigSection& editorConfig) { this->m_editorConfigSection = editorConfig; }
849 const clEditorConfigSection& GetEditorConfig() const { return m_editorConfigSection; }
850 };
851
852 typedef void (wxEvtHandler::*clEditorConfigEventFunction)(clEditorConfigEvent&);
853 #define clEditorConfigEventHandler(func) wxEVENT_HANDLER_CAST(clEditorConfigEventFunction, func)
854
855 //---------------------------------------------------------------
856 // Language Server events
857 //---------------------------------------------------------------
858 class WXDLLIMPEXP_CL clLanguageServerEvent : public clCommandEvent
859 {
860 public:
861 enum eFlags {
862 kEnabled = (1 << 0),
863 kDisaplyDiags = (1 << 2),
864 };
865
866 enum eAction {
867 kInvalidAction = 0,
868 kDelete = 1,
869 kConfigure = 2,
870 kRestart = 3,
871 kRestartAll = 4,
872 kOpenSettings = 5,
873 kEnable = 6,
874 };
875
876 protected:
877 wxString m_lspName;
878 wxString m_lspCommand;
879 size_t m_flags = 0;
880 size_t m_priority = 50;
881 wxString m_connectionString;
882 clEnvList_t m_enviroment;
883 wxString m_initOptions;
884 wxArrayString m_languages;
885 eAction m_action = kInvalidAction;
886 wxString m_rootUri;
887
888 public:
889 clLanguageServerEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
890 clLanguageServerEvent(const clLanguageServerEvent& event);
891 clLanguageServerEvent& operator=(const clLanguageServerEvent& src);
892 virtual ~clLanguageServerEvent();
893 virtual wxEvent* Clone() const;
894 void SetConnectionString(const wxString& connectionString) { this->m_connectionString = connectionString; }
895 void SetFlags(size_t flags) { this->m_flags = flags; }
896 void SetInitOptions(const wxString& initOptions) { this->m_initOptions = initOptions; }
897 void SetLanguages(const wxArrayString& languages) { this->m_languages = languages; }
898 void SetLspCommand(const wxString& lspCommand) { this->m_lspCommand = lspCommand; }
899 void SetLspName(const wxString& lspName) { this->m_lspName = lspName; }
900 void SetPriority(size_t priority) { this->m_priority = priority; }
901 const wxString& GetConnectionString() const { return m_connectionString; }
902 size_t GetFlags() const { return m_flags; }
903 const wxString& GetInitOptions() const { return m_initOptions; }
904 const wxArrayString& GetLanguages() const { return m_languages; }
905 const wxString& GetLspCommand() const { return m_lspCommand; }
906 const wxString& GetLspName() const { return m_lspName; }
907 size_t GetPriority() const { return m_priority; }
908 void SetAction(const eAction& action) { this->m_action = action; }
909 const eAction& GetAction() const { return m_action; }
910 void SetRootUri(const wxString& rootUri) { this->m_rootUri = rootUri; }
911 const wxString& GetRootUri() const { return m_rootUri; }
912 void SetEnviroment(const clEnvList_t& enviroment) { this->m_enviroment = enviroment; }
913 const clEnvList_t& GetEnviroment() const { return m_enviroment; }
914 };
915
916 typedef void (wxEvtHandler::*clLanguageServerEventFunction)(clLanguageServerEvent&);
917 #define clLanguageServerEventHandler(func) wxEVENT_HANDLER_CAST(clLanguageServerEventFunction, func)
918
919 #endif // CLCOMMANDEVENT_H