File: cl_command_event.h

package info (click to toggle)
codelite 17.0.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 136,204 kB
  • sloc: cpp: 491,547; ansic: 280,393; php: 10,259; sh: 8,930; lisp: 7,664; vhdl: 6,518; python: 6,020; lex: 4,920; yacc: 3,123; perl: 2,385; javascript: 1,715; cs: 1,193; xml: 1,110; makefile: 804; cobol: 741; sql: 709; ruby: 620; f90: 566; ada: 534; asm: 464; fortran: 350; objc: 289; tcl: 258; java: 157; erlang: 61; pascal: 51; ml: 49; awk: 44; haskell: 36
file content (919 lines) | stat: -rw-r--r-- 38,512 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//
// copyright            : (C) 2014 Eran Ifrah
// file name            : cl_command_event.h
//
// -------------------------------------------------------------------------
// A
//              _____           _      _     _ _
//             /  __ \         | |    | |   (_) |
//             | /  \/ ___   __| | ___| |    _| |_ ___
//             | |    / _ \ / _  |/ _ \ |   | | __/ _ )
//             | \__/\ (_) | (_| |  __/ |___| | ||  __/
//              \____/\___/ \__,_|\___\_____/_|\__\___|
//
//                                                  F i l e
//
//    This program is free software; you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation; either version 2 of the License, or
//    (at your option) any later version.
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

#ifndef CLCOMMANDEVENT_H
#define CLCOMMANDEVENT_H

#include "LSP/CompletionItem.h"
#include "UIBreakpoint.hpp"
#include "asyncprocess.h"
#include "clDebuggerBreakpoint.hpp"
#include "clEditorConfig.h"
#include "clGotoEntry.h"
#include "codelite_exports.h"
#include "entry.h"
#include "ssh_account_info.h"
#include "wxCodeCompletionBoxEntry.hpp"

#include <vector>
#include <wx/arrstr.h>
#include <wx/event.h>
#include <wx/sharedptr.h>

// Set of flags that can be passed within the 'S{G}etInt' function of clCommandEvent
enum {
    kEventImportingFolder = 0x00000001,
};

#if !wxUSE_GUI
// To allow building libcodelite without UI we need these 2 event types (wxCommandEvent and wxNotifyEvent)
class WXDLLIMPEXP_CL wxCommandEvent : public wxEvent, public wxEventBasicPayloadMixin
{
public:
    wxCommandEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
        : wxEvent(winid, commandType)
    {
        m_clientData = NULL;
        m_clientObject = NULL;
        m_isCommandEvent = true;

        // the command events are propagated upwards by default
        m_propagationLevel = wxEVENT_PROPAGATE_MAX;
    }

    wxCommandEvent(const wxCommandEvent& event)
        : wxEvent(event)
        , wxEventBasicPayloadMixin(event)
        , m_clientData(event.m_clientData)
        , m_clientObject(event.m_clientObject)
    {
        // Because GetString() can retrieve the string text only on demand, we
        // need to copy it explicitly.
        if(m_cmdString.empty())
            m_cmdString = event.GetString();
    }

    virtual ~wxCommandEvent() {}

    // Set/Get client data from controls
    void SetClientData(void* clientData) { m_clientData = clientData; }
    void* GetClientData() const { return m_clientData; }

    // Set/Get client object from controls
    void SetClientObject(wxClientData* clientObject) { m_clientObject = clientObject; }
    wxClientData* GetClientObject() const { return m_clientObject; }

    // Note: this shadows wxEventBasicPayloadMixin::GetString(), because it does some
    // GUI-specific hacks
    wxString GetString() const { return m_cmdString; }

    // Get listbox selection if single-choice
    int GetSelection() const { return m_commandInt; }

    // Get checkbox value
    bool IsChecked() const { return m_commandInt != 0; }

    // true if the listbox event was a selection.
    bool IsSelection() const { return (m_extraLong != 0); }

    virtual wxEvent* Clone() const wxOVERRIDE { return new wxCommandEvent(*this); }
    virtual wxEventCategory GetEventCategory() const wxOVERRIDE { return wxEVT_CATEGORY_USER_INPUT; }

protected:
    void* m_clientData;           // Arbitrary client data
    wxClientData* m_clientObject; // Arbitrary client object
};

// this class adds a possibility to react (from the user) code to a control
// notification: allow or veto the operation being reported.
class WXDLLIMPEXP_CL wxNotifyEvent : public wxCommandEvent
{
public:
    wxNotifyEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
        : wxCommandEvent(commandType, winid)
    {
        m_bAllow = true;
    }

    wxNotifyEvent(const wxNotifyEvent& event)
        : wxCommandEvent(event)
    {
        m_bAllow = event.m_bAllow;
    }

    // veto the operation (usually it's allowed by default)
    void Veto() { m_bAllow = false; }

    // allow the operation if it was disabled by default
    void Allow() { m_bAllow = true; }

    // for implementation code only: is the operation allowed?
    bool IsAllowed() const { return m_bAllow; }

    virtual wxEvent* Clone() const wxOVERRIDE { return new wxNotifyEvent(*this); }

private:
    bool m_bAllow;
};

#endif // !wxUSE_GUI

/// a wxCommandEvent that takes ownership of the clientData
class WXDLLIMPEXP_CL clCommandEvent : public wxCommandEvent
{
protected:
    wxSharedPtr<wxClientData> m_ptr;
    wxArrayString m_strings;
    wxString m_fileName;
    wxString m_oldName;
    bool m_answer;
    bool m_allowed;
    int m_lineNumber;
    bool m_selected;

public:
    clCommandEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
    clCommandEvent(const clCommandEvent& event);
    clCommandEvent& operator=(const clCommandEvent& src);
    virtual ~clCommandEvent();

    clCommandEvent& SetSelected(bool selected)
    {
        this->m_selected = selected;
        return *this;
    }
    bool IsSelected() const { return m_selected; }

    // Veto management
    void Veto() { this->m_allowed = false; }
    void Allow() { this->m_allowed = true; }

    // Hides wxCommandEvent::Set{Get}ClientObject
    void SetClientObject(wxClientData* clientObject);

    wxClientData* GetClientObject() const;
    virtual wxEvent* Clone() const;

    clCommandEvent& SetLineNumber(int lineNumber)
    {
        this->m_lineNumber = lineNumber;
        return *this;
    }
    int GetLineNumber() const { return m_lineNumber; }
    clCommandEvent& SetAllowed(bool allowed)
    {
        this->m_allowed = allowed;
        return *this;
    }
    clCommandEvent& SetAnswer(bool answer)
    {
        this->m_answer = answer;
        return *this;
    }
    clCommandEvent& SetFileName(const wxString& fileName)
    {
        this->m_fileName = fileName;
        return *this;
    }
    clCommandEvent& SetOldName(const wxString& oldName)
    {
        this->m_oldName = oldName;
        return *this;
    }
    clCommandEvent& SetPtr(const wxSharedPtr<wxClientData>& ptr)
    {
        this->m_ptr = ptr;
        return *this;
    }
    clCommandEvent& SetStrings(const wxArrayString& strings)
    {
        this->m_strings = strings;
        return *this;
    }
    bool IsAllowed() const { return m_allowed; }
    bool IsAnswer() const { return m_answer; }
    const wxString& GetFileName() const { return m_fileName; }
    const wxString& GetOldName() const { return m_oldName; }
    const wxSharedPtr<wxClientData>& GetPtr() const { return m_ptr; }
    const wxArrayString& GetStrings() const { return m_strings; }
    wxArrayString& GetStrings() { return m_strings; }
};

typedef void (wxEvtHandler::*clCommandEventFunction)(clCommandEvent&);
#define clCommandEventHandler(func) wxEVENT_HANDLER_CAST(clCommandEventFunction, func)

/// Source control event
class WXDLLIMPEXP_CL clSourceControlEvent : public clCommandEvent
{
protected:
    wxString m_sourceControlName;

public:
    clSourceControlEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
    clSourceControlEvent(const clSourceControlEvent& event);
    clSourceControlEvent& operator=(const clSourceControlEvent& src);
    virtual ~clSourceControlEvent();
    virtual wxEvent* Clone() const;
    void SetSourceControlName(const wxString& sourceControlName) { this->m_sourceControlName = sourceControlName; }
    const wxString& GetSourceControlName() const { return m_sourceControlName; }
};

typedef void (wxEvtHandler::*clSourceControlEventFunction)(clSourceControlEvent&);
#define clSourceControlEventHandler(func) wxEVENT_HANDLER_CAST(clSourceControlEventFunction, func)

/// Source control event
struct WXDLLIMPEXP_CL RecentWorkspace {
    wxString m_category;
    wxString m_account; // for remote workspaces, which account does this workspace belongs to
    wxString m_name;
    wxString path;
};

class WXDLLIMPEXP_CL clRecentWorkspaceEvent : public clCommandEvent
{
protected:
    std::vector<RecentWorkspace> m_workspaces;

public:
    clRecentWorkspaceEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
    clRecentWorkspaceEvent(const clRecentWorkspaceEvent& event);
    clRecentWorkspaceEvent& operator=(const clRecentWorkspaceEvent& src);
    virtual ~clRecentWorkspaceEvent();
    virtual wxEvent* Clone() const;

    void SetWorkspaces(const std::vector<RecentWorkspace>& workspaces) { this->m_workspaces = workspaces; }
    const std::vector<RecentWorkspace>& GetWorkspaces() const { return m_workspaces; }
    std::vector<RecentWorkspace>& GetWorkspaces() { return m_workspaces; }
};

typedef void (wxEvtHandler::*clRecentWorkspaceEventFunction)(clRecentWorkspaceEvent&);
#define clRecentWorkspaceEventHandler(func) wxEVENT_HANDLER_CAST(clRecentWorkspaceEventFunction, func)

/// a clCodeCompletionEvent
class WXDLLIMPEXP_CL clCodeCompletionEvent : public clCommandEvent
{
    wxString m_word;
    int m_position;
    wxString m_tooltip;
    bool m_insideCommentOrString;
    wxCodeCompletionBoxEntry::Ptr_t m_entry;
    wxArrayString m_definitions;
    wxCodeCompletionBoxEntry::Vec_t m_entries;
    LSP::CompletionItem::eTriggerKind m_triggerKind = LSP::CompletionItem::kTriggerUnknown;

    // semantic highlights. We support 2 types variables and classes
    wxString m_variables;
    wxString m_classes;

public:
    clCodeCompletionEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
    clCodeCompletionEvent(const clCodeCompletionEvent& event);
    clCodeCompletionEvent& operator=(const clCodeCompletionEvent& src);
    virtual ~clCodeCompletionEvent();
    virtual wxEvent* Clone() const;

    void SetDefinitions(const wxArrayString& definitions) { this->m_definitions = definitions; }
    const wxArrayString& GetDefinitions() const { return m_definitions; }
    void SetEntry(wxCodeCompletionBoxEntry::Ptr_t entry) { this->m_entry = entry; }
    wxCodeCompletionBoxEntry::Ptr_t GetEntry() { return m_entry; }

    void SetInsideCommentOrString(bool insideCommentOrString) { this->m_insideCommentOrString = insideCommentOrString; }

    bool IsInsideCommentOrString() const { return m_insideCommentOrString; }
    void SetEntries(const wxCodeCompletionBoxEntry::Vec_t& entries) { this->m_entries = entries; }
    const wxCodeCompletionBoxEntry::Vec_t& GetEntries() const { return m_entries; }
    wxCodeCompletionBoxEntry::Vec_t& GetEntries() { return m_entries; }

    const LSP::CompletionItem::eTriggerKind& GetTriggerKind() const { return m_triggerKind; }
    void SetTriggerKind(const LSP::CompletionItem::eTriggerKind& triggerKind) { this->m_triggerKind = triggerKind; }

    void SetWord(const wxString& word) { this->m_word = word; }

    void SetClasses(const wxString& classes) { this->m_classes = classes; }
    void SetVariables(const wxString& variables) { this->m_variables = variables; }
    const wxString& GetClasses() const { return m_classes; }
    const wxString& GetVariables() const { return m_variables; }

    /**
     * @brief return the user typed word up to the caret position
     */
    const wxString& GetWord() const { return m_word; }
    void SetPosition(int position) { this->m_position = position; }
    /**
     * @brief return the editor position
     */
    int GetPosition() const { return m_position; }
    void SetTooltip(const wxString& tooltip) { this->m_tooltip = tooltip; }
    const wxString& GetTooltip() const { return m_tooltip; }
};

typedef void (wxEvtHandler::*clCodeCompletionEventFunction)(clCodeCompletionEvent&);
#define clCodeCompletionEventHandler(func) wxEVENT_HANDLER_CAST(clCodeCompletionEventFunction, func)

class WXDLLIMPEXP_CL clColourEvent : public clCommandEvent
{
#if wxUSE_GUI
    wxColour m_bgColour;
    wxColour m_fgColour;
    wxColour m_borderColour;
    wxWindow* m_page;
#endif
    bool m_isActiveTab;

public:
    clColourEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
    clColourEvent(const clColourEvent& event);
    clColourEvent& operator=(const clColourEvent& src);
    virtual ~clColourEvent();
    virtual wxEvent* Clone() const { return new clColourEvent(*this); };

#if wxUSE_GUI
    void SetBorderColour(const wxColour& borderColour) { this->m_borderColour = borderColour; }
    const wxColour& GetBorderColour() const { return m_borderColour; }
    void SetPage(wxWindow* page) { this->m_page = page; }
    wxWindow* GetPage() { return m_page; }
    void SetBgColour(const wxColour& bgColour) { this->m_bgColour = bgColour; }
    void SetFgColour(const wxColour& fgColour) { this->m_fgColour = fgColour; }
    const wxColour& GetBgColour() const { return m_bgColour; }
    const wxColour& GetFgColour() const { return m_fgColour; }
#endif
    void SetIsActiveTab(bool isActiveTab) { this->m_isActiveTab = isActiveTab; }
    bool IsActiveTab() const { return m_isActiveTab; }
};

typedef void (wxEvtHandler::*clColourEventFunction)(clColourEvent&);
#define clColourEventHandler(func) wxEVENT_HANDLER_CAST(clColourEventFunction, func)

// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
class WXDLLIMPEXP_CL clBuildEvent : public clCommandEvent
{
public:
    enum eFlags {
        kClean = (1 << 0),
        kBuild = (1 << 1),
        kCustomProject = (1 << 2),
    };

protected:
    wxString m_projectName;
    wxString m_configurationName;
    wxString m_command;
    bool m_projectOnly;
    size_t m_warningCount;
    size_t m_errorCount;
    wxString m_kind;
    bool m_isRunning = false;
    bool m_cleanLog = true;
    size_t m_flags = 0;
    wxString m_toolchain;

public:
    clBuildEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
    clBuildEvent(const clBuildEvent& event);
    clBuildEvent& operator=(const clBuildEvent& src);
    virtual ~clBuildEvent();
    virtual wxEvent* Clone() const { return new clBuildEvent(*this); };

    void SetFlag(eFlags f, bool b)
    {
        if(b) {
            m_flags |= f;
        } else {
            m_flags &= ~f;
        }
    }

    void SetToolchain(const wxString& toolchain) { this->m_toolchain = toolchain; }
    const wxString& GetToolchain() const { return m_toolchain; }
    bool HasFlag(eFlags f) const { return m_flags & f; }
    void SetIsRunning(bool isRunning) { this->m_isRunning = isRunning; }
    bool IsRunning() const { return m_isRunning; }
    void SetCleanLog(bool cleanLog) { this->m_cleanLog = cleanLog; }
    bool IsCleanLog() const { return m_cleanLog; }
    void SetKind(const wxString& kind) { this->m_kind = kind; }
    const wxString& GetKind() const { return this->m_kind; }

    void SetProjectOnly(bool projectOnly) { this->m_projectOnly = projectOnly; }
    bool IsProjectOnly() const { return m_projectOnly; }
    void SetCommand(const wxString& command) { this->m_command = command; }
    const wxString& GetCommand() const { return m_command; }
    void SetConfigurationName(const wxString& configurationName) { this->m_configurationName = configurationName; }
    void SetProjectName(const wxString& projectName) { this->m_projectName = projectName; }
    const wxString& GetConfigurationName() const { return m_configurationName; }
    const wxString& GetProjectName() const { return m_projectName; }

    void SetErrorCount(size_t errorCount) { this->m_errorCount = errorCount; }
    void SetWarningCount(size_t warningCount) { this->m_warningCount = warningCount; }
    size_t GetErrorCount() const { return m_errorCount; }
    size_t GetWarningCount() const { return m_warningCount; }
};

typedef void (wxEvtHandler::*clBuildEventFunction)(clBuildEvent&);
#define clBuildEventHandler(func) wxEVENT_HANDLER_CAST(clBuildEventFunction, func)

// -------------------------------------------------------------------------
// clDebugEvent
// -------------------------------------------------------------------------
class WXDLLIMPEXP_CL clDebugEvent : public clCommandEvent
{
    wxString m_projectName;       // wxEVT_DBG_UI_START_OR_CONT
    wxString m_configurationName; // wxEVT_DBG_UI_START_OR_CONT
    wxString m_debuggerName; // holds the selected debugger name. wxEVT_DBG_UI_START_OR_CONT, wxEVT_DBG_UI_QUICK_DEBUG,
                             // wxEVT_DBG_UI_CORE_FILE
    wxString m_executableName;   // This will be set for wxEVT_DBG_UI_QUICK_DEBUG and wxEVT_DBG_UI_CORE_FILE
    wxString m_coreFile;         // wxEVT_DBG_UI_CORE_FILE
    wxString m_workingDirectory; // wxEVT_DBG_UI_CORE_FILE, wxEVT_DBG_UI_QUICK_DEBUG
    wxString m_arguments;        // wxEVT_DBG_UI_QUICK_DEBUG
    wxString m_startupCommands;  // wxEVT_DBG_UI_QUICK_DEBUG
    size_t m_features;
    wxString m_memoryAddress;    // wxEVT_DEBUGGER_SET_MEMORY
    wxString m_memoryBlockValue; // wxEVT_DEBUGGER_SET_MEMORY
    size_t m_memoryBlockSize;    // wxEVT_DEBUGGER_SET_MEMORY
    clDebuggerBreakpoint::Vec_t m_breakpoints;
    bool m_isSSHDebugging = false;
    wxString m_sshAccount;
    wxString m_alternateDebuggerPath; // Holds the path to an alternate debugger executable
    UIBreakpoint m_uiBreakpoint;

public:
    // Special features not available by all the debuggers
    enum eFeatures {
        kStepInst = (1 << 0),         // single step instruction
        kInterrupt = (1 << 1),        // interrup the running process
        kShowCursor = (1 << 2),       // show the current active line
        kJumpToCursor = (1 << 3),     // Jump to the caret line, without executing the code in between
        kRunToCursor = (1 << 4),      // execute all the code until reaching the caret
        kReverseDebugging = (1 << 5), // execute all the code until reaching the caret
        kAllFeatures = kStepInst | kInterrupt | kShowCursor | kJumpToCursor | kRunToCursor | kReverseDebugging,
    };

public:
    clDebugEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
    clDebugEvent(const clDebugEvent& event);
    clDebugEvent& operator=(const clDebugEvent& other);

    virtual ~clDebugEvent();
    virtual wxEvent* Clone() const { return new clDebugEvent(*this); };

    void SetUiBreakpoint(const UIBreakpoint& uiBreakpoint) { this->m_uiBreakpoint = uiBreakpoint; }
    const UIBreakpoint& GetUiBreakpoint() const { return m_uiBreakpoint; }

    void SetAlternateDebuggerPath(const wxString& alternateDebuggerPath)
    {
        this->m_alternateDebuggerPath = alternateDebuggerPath;
    }
    const wxString& GetAlternateDebuggerPath() const { return m_alternateDebuggerPath; }
    void SetSshAccount(const wxString& sshAccount) { this->m_sshAccount = sshAccount; }
    const wxString& GetSshAccount() const { return m_sshAccount; }
    void SetIsSSHDebugging(bool isSSHDebugging) { this->m_isSSHDebugging = isSSHDebugging; }
    bool IsSSHDebugging() const { return m_isSSHDebugging; }
    void SetFeatures(size_t features) { m_features = features; }
    size_t GetFeatures() const { return m_features; }
    void SetDebuggerName(const wxString& debuggerName) { this->m_debuggerName = debuggerName; }
    const wxString& GetDebuggerName() const { return m_debuggerName; }
    void SetArguments(const wxString& arguments) { this->m_arguments = arguments; }
    void SetCoreFile(const wxString& coreFile) { this->m_coreFile = coreFile; }
    void SetExecutableName(const wxString& executableName) { this->m_executableName = executableName; }
    void SetStartupCommands(const wxString& startupCommands) { this->m_startupCommands = startupCommands; }
    void SetWorkingDirectory(const wxString& workingDirectory) { this->m_workingDirectory = workingDirectory; }
    const wxString& GetArguments() const { return m_arguments; }
    const wxString& GetCoreFile() const { return m_coreFile; }
    const wxString& GetExecutableName() const { return m_executableName; }
    const wxString& GetStartupCommands() const { return m_startupCommands; }
    const wxString& GetWorkingDirectory() const { return m_workingDirectory; }
    void SetConfigurationName(const wxString& configurationName) { this->m_configurationName = configurationName; }
    void SetProjectName(const wxString& projectName) { this->m_projectName = projectName; }
    const wxString& GetConfigurationName() const { return m_configurationName; }
    const wxString& GetProjectName() const { return m_projectName; }
    void SetMemoryAddress(const wxString& memoryAddress) { this->m_memoryAddress = memoryAddress; }
    void SetMemoryBlockSize(size_t memoryBlockSize) { this->m_memoryBlockSize = memoryBlockSize; }
    void SetMemoryBlockValue(const wxString& memoryBlockValue) { this->m_memoryBlockValue = memoryBlockValue; }
    const wxString& GetMemoryAddress() const { return m_memoryAddress; }
    size_t GetMemoryBlockSize() const { return m_memoryBlockSize; }
    const wxString& GetMemoryBlockValue() const { return m_memoryBlockValue; }
    void SetBreakpoints(const clDebuggerBreakpoint::Vec_t& breakpoints) { this->m_breakpoints = breakpoints; }
    const clDebuggerBreakpoint::Vec_t& GetBreakpoints() const { return m_breakpoints; }
    clDebuggerBreakpoint::Vec_t& GetBreakpoints() { return m_breakpoints; }
};

typedef void (wxEvtHandler::*clDebugEventFunction)(clDebugEvent&);
#define clDebugEventHandler(func) wxEVENT_HANDLER_CAST(clDebugEventFunction, func)

// ------------------------------------------------------------------
// clNewProjectEvent
// ------------------------------------------------------------------
class WXDLLIMPEXP_CL clNewProjectEvent : public clCommandEvent
{
public:
    struct Template {
        wxString m_category;
        wxString m_categoryPng;
        wxString m_template;
        wxString m_templatePng;
        wxString m_toolchain;
        wxString m_debugger;
        bool m_allowSeparateFolder;
        Template()
            : m_allowSeparateFolder(true)
        {
        }
        typedef std::vector<clNewProjectEvent::Template> Vec_t;
    };

protected:
    clNewProjectEvent::Template::Vec_t m_templates;
    wxString m_toolchain;
    wxString m_debugger;
    wxString m_projectName;
    wxString m_projectFolder;
    wxString m_templateName;

public:
    clNewProjectEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
    clNewProjectEvent(const clNewProjectEvent& event);
    clNewProjectEvent& operator=(const clNewProjectEvent& src);
    virtual ~clNewProjectEvent();
    virtual wxEvent* Clone() const { return new clNewProjectEvent(*this); };

    void SetTemplates(const clNewProjectEvent::Template::Vec_t& templates) { this->m_templates = templates; }
    const clNewProjectEvent::Template::Vec_t& GetTemplates() const { return m_templates; }
    clNewProjectEvent::Template::Vec_t& GetTemplates() { return m_templates; }

    void SetDebugger(const wxString& debugger) { this->m_debugger = debugger; }
    void SetProjectFolder(const wxString& projectFolder) { this->m_projectFolder = projectFolder; }
    void SetProjectName(const wxString& projectName) { this->m_projectName = projectName; }
    void SetToolchain(const wxString& toolchain) { this->m_toolchain = toolchain; }
    const wxString& GetDebugger() const { return m_debugger; }
    const wxString& GetProjectFolder() const { return m_projectFolder; }
    const wxString& GetProjectName() const { return m_projectName; }
    const wxString& GetToolchain() const { return m_toolchain; }
    void SetTemplateName(const wxString& templateName) { this->m_templateName = templateName; }
    const wxString& GetTemplateName() const { return m_templateName; }
};

typedef void (wxEvtHandler::*clNewProjectEventFunction)(clNewProjectEvent&);
#define clNewProjectEventHandler(func) wxEVENT_HANDLER_CAST(clNewProjectEventFunction, func)

// --------------------------------------------------------------
// Compiler event
// --------------------------------------------------------------
class WXDLLIMPEXP_CL clCompilerEvent : public clCommandEvent
{
public:
    clCompilerEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
    clCompilerEvent(const clCompilerEvent& event);
    clCompilerEvent& operator=(const clCompilerEvent& src);
    virtual ~clCompilerEvent();
    virtual wxEvent* Clone() const { return new clCompilerEvent(*this); }
};

typedef void (wxEvtHandler::*clCompilerEventFunction)(clCompilerEvent&);
#define clCompilerEventHandler(func) wxEVENT_HANDLER_CAST(clCompilerEventFunction, func)

// --------------------------------------------------------------
// GotoAnything event
// --------------------------------------------------------------
class WXDLLIMPEXP_CL clGotoEvent : public clCommandEvent
{
    clGotoEntry::Vec_t m_entries;
    clGotoEntry m_entry;

public:
    clGotoEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
    clGotoEvent(const clGotoEvent& src);
    clGotoEvent& operator=(const clGotoEvent& src);
    virtual ~clGotoEvent();
    virtual wxEvent* Clone() const { return new clGotoEvent(*this); }
    const clGotoEntry::Vec_t& GetEntries() const { return m_entries; }
    clGotoEntry::Vec_t& GetEntries() { return m_entries; }
    void SetEntries(const clGotoEntry::Vec_t& entries) { m_entries = entries; }
    void SetEntry(const clGotoEntry& entry) { this->m_entry = entry; }
    const clGotoEntry& GetEntry() const { return m_entry; }
};

typedef void (wxEvtHandler::*clGotoEventFunction)(clGotoEvent&);
#define clGotoEventHandler(func) wxEVENT_HANDLER_CAST(clGotoEventFunction, func)

// --------------------------------------------------------------
// Processs event
// --------------------------------------------------------------
class IProcess;
class WXDLLIMPEXP_CL clProcessEvent : public clCommandEvent
{
    wxString m_output;
    IProcess* m_process;

public:
    clProcessEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
    clProcessEvent(const clProcessEvent& event);
    clProcessEvent& operator=(const clProcessEvent& src);
    virtual ~clProcessEvent();
    virtual wxEvent* Clone() const { return new clProcessEvent(*this); }

    void SetOutput(const wxString& output) { this->m_output = output; }
    void SetProcess(IProcess* process) { this->m_process = process; }
    const wxString& GetOutput() const { return m_output; }
    IProcess* GetProcess() { return m_process; }
};

typedef void (wxEvtHandler::*clProcessEventFunction)(clProcessEvent&);
#define clProcessEventHandler(func) wxEVENT_HANDLER_CAST(clProcessEventFunction, func)

//---------------------------------------------------------------
// Source formatting event
//---------------------------------------------------------------
class WXDLLIMPEXP_CL clSourceFormatEvent : public clCommandEvent
{
    wxString m_inputString;
    wxString m_formattedString;

public:
    clSourceFormatEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
    clSourceFormatEvent(const clSourceFormatEvent& event);
    clSourceFormatEvent& operator=(const clSourceFormatEvent& src);
    virtual ~clSourceFormatEvent();
    virtual wxEvent* Clone() const { return new clSourceFormatEvent(*this); }
    void SetFormattedString(const wxString& formattedString) { this->m_formattedString = formattedString; }
    void SetInputString(const wxString& inputString) { this->m_inputString = inputString; }
    const wxString& GetFormattedString() const { return m_formattedString; }
    const wxString& GetInputString() const { return m_inputString; }
};

typedef void (wxEvtHandler::*clSourceFormatEventFunction)(clSourceFormatEvent&);
#define clSourceFormatEventHandler(func) wxEVENT_HANDLER_CAST(clSourceFormatEventFunction, func)

//---------------------------------------------------------------
// Context menu event
//---------------------------------------------------------------
class WXDLLIMPEXP_CL clContextMenuEvent : public clCommandEvent
{
#if wxUSE_GUI
    wxMenu* m_menu;
#endif
    wxObject* m_editor;
    wxString m_path;

public:
    clContextMenuEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
    clContextMenuEvent(const clContextMenuEvent& event);
    clContextMenuEvent& operator=(const clContextMenuEvent& src);
    virtual ~clContextMenuEvent();
    virtual wxEvent* Clone() const { return new clContextMenuEvent(*this); }
#if wxUSE_GUI
    void SetMenu(wxMenu* menu) { this->m_menu = menu; }
    wxMenu* GetMenu() { return m_menu; }
#endif
    void SetEditor(wxObject* editor) { this->m_editor = editor; }
    wxObject* GetEditor() { return m_editor; }
    const wxString& GetPath() const { return m_path; }
    void SetPath(const wxString& path) { m_path = path; }
};

typedef void (wxEvtHandler::*clContextMenuEventFunction)(clContextMenuEvent&);
#define clContextMenuEventHandler(func) wxEVENT_HANDLER_CAST(clContextMenuEventFunction, func)

//---------------------------------------------------------------
// Execute event
//---------------------------------------------------------------
class WXDLLIMPEXP_CL clExecuteEvent : public clCommandEvent
{
    wxString m_targetName;

public:
    clExecuteEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
    clExecuteEvent(const clExecuteEvent& event);
    clExecuteEvent& operator=(const clExecuteEvent& src);
    virtual ~clExecuteEvent();
    virtual wxEvent* Clone() const { return new clExecuteEvent(*this); }

    void SetTargetName(const wxString& targetName) { this->m_targetName = targetName; }
    const wxString& GetTargetName() const { return m_targetName; }
};

typedef void (wxEvtHandler::*clExecuteEventFunction)(clExecuteEvent&);
#define clExecuteEventHandler(func) wxEVENT_HANDLER_CAST(clExecuteEventFunction, func)

//---------------------------------------------------------------
// Execute event
//---------------------------------------------------------------
class WXDLLIMPEXP_CL clProjectSettingsEvent : public clCommandEvent
{
    wxString m_configName;
    wxString m_projectName;

public:
    clProjectSettingsEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
    clProjectSettingsEvent(const clProjectSettingsEvent& event);
    clProjectSettingsEvent& operator=(const clProjectSettingsEvent& src);
    virtual ~clProjectSettingsEvent();
    virtual wxEvent* Clone() const { return new clProjectSettingsEvent(*this); }
    void SetConfigName(const wxString& configName) { this->m_configName = configName; }
    void SetProjectName(const wxString& projectName) { this->m_projectName = projectName; }
    const wxString& GetConfigName() const { return m_configName; }
    const wxString& GetProjectName() const { return m_projectName; }
};

typedef void (wxEvtHandler::*clProjectSettingsEventFunction)(clProjectSettingsEvent&);
#define clProjectSettingsEventHandler(func) wxEVENT_HANDLER_CAST(clProjectSettingsEventFunction, func)

//---------------------------------------------------------------
// Find event
//---------------------------------------------------------------
class WXDLLIMPEXP_CL clFindEvent : public clCommandEvent
{
    wxStyledTextCtrl* m_ctrl;

public:
    clFindEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
    clFindEvent(const clFindEvent& event);
    clFindEvent& operator=(const clFindEvent& src);
    virtual ~clFindEvent();
    virtual wxEvent* Clone() const { return new clFindEvent(*this); }

    void SetCtrl(wxStyledTextCtrl* ctrl) { this->m_ctrl = ctrl; }
    wxStyledTextCtrl* GetCtrl() { return m_ctrl; }
};

typedef void (wxEvtHandler::*clFindEventFunction)(clFindEvent&);
#define clFindEventHandler(func) wxEVENT_HANDLER_CAST(clFindEventFunction, func)

//---------------------------------------------------------------
// Find in files event
//---------------------------------------------------------------
class WXDLLIMPEXP_CL clFindInFilesEvent : public clCommandEvent
{
public:
    struct Location {
        size_t line = 0;
        size_t column_start = 0;
        size_t column_end = 0;
        wxString pattern;
        typedef std::vector<Location> vec_t;
    };

    struct Match {
        wxString file;
        Location::vec_t locations;
        typedef std::vector<Match> vec_t;
    };

protected:
    wxString m_paths;
    wxString m_fileMask;
    size_t m_options = 0;
    wxString m_transientPaths;
    Match::vec_t m_matches;

public:
    clFindInFilesEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
    clFindInFilesEvent(const clFindInFilesEvent& event);
    clFindInFilesEvent& operator=(const clFindInFilesEvent& src);
    virtual ~clFindInFilesEvent();
    virtual wxEvent* Clone() const { return new clFindInFilesEvent(*this); }
    void SetFileMask(const wxString& fileMask) { this->m_fileMask = fileMask; }
    void SetOptions(size_t options) { this->m_options = options; }
    const wxString& GetFileMask() const { return m_fileMask; }
    size_t GetOptions() const { return m_options; }
    void SetPaths(const wxString& paths) { this->m_paths = paths; }
    const wxString& GetPaths() const { return m_paths; }
    void SetTransientPaths(const wxString& transientPaths) { this->m_transientPaths = transientPaths; }
    const wxString& GetTransientPaths() const { return m_transientPaths; }
    Match::vec_t& GetMatches() { return m_matches; }
    const Match::vec_t& GetMatches() const { return m_matches; }
    void SetMatches(const Match::vec_t& matches) { m_matches = matches; }
};

typedef void (wxEvtHandler::*clFindInFilesEventFunction)(clFindInFilesEvent&);
#define clFindInFilesEventHandler(func) wxEVENT_HANDLER_CAST(clFindInFilesEventFunction, func)

// --------------------------------------------------------------
// Parsing event
// --------------------------------------------------------------
class WXDLLIMPEXP_CL clParseEvent : public clCommandEvent
{
    size_t m_curfileIndex;
    size_t m_totalFiles;

public:
    clParseEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
    clParseEvent(const clParseEvent& event);
    clParseEvent& operator=(const clParseEvent& src);
    virtual ~clParseEvent();
    virtual wxEvent* Clone() const { return new clParseEvent(*this); }
    void SetCurfileIndex(size_t curfileIndex) { this->m_curfileIndex = curfileIndex; }
    void SetTotalFiles(size_t totalFiles) { this->m_totalFiles = totalFiles; }
    size_t GetCurfileIndex() const { return m_curfileIndex; }
    size_t GetTotalFiles() const { return m_totalFiles; }
};

typedef void (wxEvtHandler::*clParseEventFunction)(clParseEvent&);
#define clParseEventHandler(func) wxEVENT_HANDLER_CAST(clParseEventFunction, func)

// --------------------------------------------------------------
// clEditorConfigEvent event
// --------------------------------------------------------------
class WXDLLIMPEXP_CL clEditorConfigEvent : public clCommandEvent
{
    clEditorConfigSection m_editorConfigSection;

public:
    clEditorConfigEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
    clEditorConfigEvent(const clEditorConfigEvent& event);
    clEditorConfigEvent& operator=(const clEditorConfigEvent& src);
    virtual ~clEditorConfigEvent();
    virtual wxEvent* Clone() const { return new clEditorConfigEvent(*this); }
    void SetEditorConfig(const clEditorConfigSection& editorConfig) { this->m_editorConfigSection = editorConfig; }
    const clEditorConfigSection& GetEditorConfig() const { return m_editorConfigSection; }
};

typedef void (wxEvtHandler::*clEditorConfigEventFunction)(clEditorConfigEvent&);
#define clEditorConfigEventHandler(func) wxEVENT_HANDLER_CAST(clEditorConfigEventFunction, func)

//---------------------------------------------------------------
// Language Server events
//---------------------------------------------------------------
class WXDLLIMPEXP_CL clLanguageServerEvent : public clCommandEvent
{
public:
    enum eFlags {
        kEnabled = (1 << 0),
        kDisaplyDiags = (1 << 2),
    };

    enum eAction {
        kInvalidAction = 0,
        kDelete = 1,
        kConfigure = 2,
        kRestart = 3,
        kRestartAll = 4,
        kOpenSettings = 5,
        kEnable = 6,
    };

protected:
    wxString m_lspName;
    wxString m_lspCommand;
    size_t m_flags = 0;
    size_t m_priority = 50;
    wxString m_connectionString;
    clEnvList_t m_enviroment;
    wxString m_initOptions;
    wxArrayString m_languages;
    eAction m_action = kInvalidAction;
    wxString m_rootUri;

public:
    clLanguageServerEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
    clLanguageServerEvent(const clLanguageServerEvent& event);
    clLanguageServerEvent& operator=(const clLanguageServerEvent& src);
    virtual ~clLanguageServerEvent();
    virtual wxEvent* Clone() const;
    void SetConnectionString(const wxString& connectionString) { this->m_connectionString = connectionString; }
    void SetFlags(size_t flags) { this->m_flags = flags; }
    void SetInitOptions(const wxString& initOptions) { this->m_initOptions = initOptions; }
    void SetLanguages(const wxArrayString& languages) { this->m_languages = languages; }
    void SetLspCommand(const wxString& lspCommand) { this->m_lspCommand = lspCommand; }
    void SetLspName(const wxString& lspName) { this->m_lspName = lspName; }
    void SetPriority(size_t priority) { this->m_priority = priority; }
    const wxString& GetConnectionString() const { return m_connectionString; }
    size_t GetFlags() const { return m_flags; }
    const wxString& GetInitOptions() const { return m_initOptions; }
    const wxArrayString& GetLanguages() const { return m_languages; }
    const wxString& GetLspCommand() const { return m_lspCommand; }
    const wxString& GetLspName() const { return m_lspName; }
    size_t GetPriority() const { return m_priority; }
    void SetAction(const eAction& action) { this->m_action = action; }
    const eAction& GetAction() const { return m_action; }
    void SetRootUri(const wxString& rootUri) { this->m_rootUri = rootUri; }
    const wxString& GetRootUri() const { return m_rootUri; }
    void SetEnviroment(const clEnvList_t& enviroment) { this->m_enviroment = enviroment; }
    const clEnvList_t& GetEnviroment() const { return m_enviroment; }
};

typedef void (wxEvtHandler::*clLanguageServerEventFunction)(clLanguageServerEvent&);
#define clLanguageServerEventHandler(func) wxEVENT_HANDLER_CAST(clLanguageServerEventFunction, func)

#endif // CLCOMMANDEVENT_H