File: menu_event_handlers.h

package info (click to toggle)
codelite 12.0+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 95,112 kB
  • sloc: cpp: 424,040; ansic: 18,284; php: 9,569; lex: 4,186; yacc: 2,820; python: 2,294; sh: 312; makefile: 51; xml: 13
file content (195 lines) | stat: -rw-r--r-- 6,126 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
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//
// copyright            : (C) 2008 by Eran Ifrah
// file name            : menu_event_handlers.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 MENU_EVENT_HANDLERS_H
#define MENU_EVENT_HANDLERS_H

#include "wx/event.h"
#include "smart_ptr.h"
#include <wx/xrc/xmlres.h>

/**
 * The interface for menu event handler classes
 */
class MenuEventHandler
{
protected:
    int m_id;

public:
    MenuEventHandler(int id)
        : m_id(id){};
    virtual ~MenuEventHandler(){};

    // handle an event
    virtual void ProcessCommandEvent(wxWindow* owner, wxCommandEvent& event) = 0;
    virtual void ProcessUpdateUIEvent(wxWindow* owner, wxUpdateUIEvent& event) = 0;

    // Setters/Getters
    const int& GetEventId() const { return m_id; }
    void SetEventId(const int& id) { m_id = id; }
};

typedef SmartPtr<MenuEventHandler> MenuEventHandlerPtr;

//-----------------------------------------------------------------
// Define here a class per event/group
//-----------------------------------------------------------------

//------------------------------------
// Common edit tasks
//------------------------------------
class EditHandler : public MenuEventHandler
{
public:
    EditHandler(int id)
        : MenuEventHandler(id){};
    virtual ~EditHandler(){};

public:
    virtual void ProcessCommandEvent(wxWindow* owner, wxCommandEvent& event);
    virtual void ProcessUpdateUIEvent(wxWindow* owner, wxUpdateUIEvent& event);
};

//------------------------------------
// Brace matching
//------------------------------------
class BraceMatchHandler : public MenuEventHandler
{
public:
    BraceMatchHandler(int id)
        : MenuEventHandler(id){};
    virtual ~BraceMatchHandler(){};

public:
    virtual void ProcessCommandEvent(wxWindow* owner, wxCommandEvent& event);
    virtual void ProcessUpdateUIEvent(wxWindow* owner, wxUpdateUIEvent& event);
};

//------------------------------------
// Find / Repalce
//------------------------------------
class FindReplaceHandler : public MenuEventHandler
{
public:
    FindReplaceHandler(int id)
        : MenuEventHandler(id){};
    virtual ~FindReplaceHandler(){};

public:
    virtual void ProcessCommandEvent(wxWindow* owner, wxCommandEvent& event);
    virtual void ProcessUpdateUIEvent(wxWindow* owner, wxUpdateUIEvent& event);
};

//------------------------------------
// Goto
//------------------------------------
class GotoHandler : public MenuEventHandler
{
public:
    GotoHandler(int id)
        : MenuEventHandler(id){};
    virtual ~GotoHandler(){};

public:
    virtual void ProcessCommandEvent(wxWindow* owner, wxCommandEvent& event);
    virtual void ProcessUpdateUIEvent(wxWindow* owner, wxUpdateUIEvent& event);
};

//------------------------------------
// Bookmarks
//------------------------------------
class BookmarkHandler : public MenuEventHandler
{
public:
    BookmarkHandler(int id)
        : MenuEventHandler(id){};
    virtual ~BookmarkHandler(){};

public:
    virtual void ProcessCommandEvent(wxWindow* owner, wxCommandEvent& event);
    virtual void ProcessUpdateUIEvent(wxWindow* owner, wxUpdateUIEvent& event);
};

//------------------------------------
// Go to definition
//------------------------------------
class GotoDefinitionHandler : public MenuEventHandler
{
public:
    GotoDefinitionHandler(int id)
        : MenuEventHandler(id){};
    virtual ~GotoDefinitionHandler(){};

public:
    virtual void ProcessCommandEvent(wxWindow* owner, wxCommandEvent& event);
    virtual void ProcessUpdateUIEvent(wxWindow* owner, wxUpdateUIEvent& event);
};

//-------------------------------------------------
// Word wrap
//-------------------------------------------------
class WordWrapHandler : public MenuEventHandler
{
public:
    WordWrapHandler(int id)
        : MenuEventHandler(id){};
    virtual ~WordWrapHandler(){};

public:
    virtual void ProcessCommandEvent(wxWindow* owner, wxCommandEvent& event);
    virtual void ProcessUpdateUIEvent(wxWindow* owner, wxUpdateUIEvent& event);
};

//-------------------------------------------------
// Folding
//-------------------------------------------------
class FoldHandler : public MenuEventHandler
{
public:
    FoldHandler(int id)
        : MenuEventHandler(id){};
    virtual ~FoldHandler(){};

public:
    virtual void ProcessCommandEvent(wxWindow* owner, wxCommandEvent& event);
    virtual void ProcessUpdateUIEvent(wxWindow* owner, wxUpdateUIEvent& event);
};

//-------------------------------------------------
// Debugger handler
//-------------------------------------------------
class DebuggerMenuHandler : public MenuEventHandler
{
public:
    DebuggerMenuHandler(int id)
        : MenuEventHandler(id){};
    virtual ~DebuggerMenuHandler(){};

public:
    virtual void ProcessCommandEvent(wxWindow* owner, wxCommandEvent& event);
    virtual void ProcessUpdateUIEvent(wxWindow* owner, wxUpdateUIEvent& event);
};

#endif // MENU_EVENT_HANDLERS_H