-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMiniStyledTextCtrlEvent.h
59 lines (43 loc) · 2.02 KB
/
MiniStyledTextCtrlEvent.h
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
#ifndef MINI_STYLED_TEXT_CTRL_EVENT_H
#define MINI_STYLED_TEXT_CTRL_EVENT_H
#include <wx/event.h>
extern const wxEventType MiniStyledTextCtrlCommandEvent;
class MiniStyledTextCtrlLineClickedEvent: public wxCommandEvent
{
public:
explicit MiniStyledTextCtrlLineClickedEvent(wxEventType commandType = MiniStyledTextCtrlCommandEvent, int id = 0):
wxCommandEvent(commandType, id),
line(0)
{}
// You *must* copy here the data to be transported
explicit MiniStyledTextCtrlLineClickedEvent(const MiniStyledTextCtrlLineClickedEvent &event):
wxCommandEvent(event)
{
this->SetLine( event.GetLine() );
}
// Required for sending with wxPostEvent()
wxEvent* Clone() const { return new MiniStyledTextCtrlLineClickedEvent(*this); }
int GetLine() const { return line; }
void SetLine( const int& li ) { line = li; }
private:
int line;
};
typedef void (wxEvtHandler::*MiniStyledTextCtrlLineClickedEventFunction)(MiniStyledTextCtrlLineClickedEvent &);
// This #define simplifies the one below, and makes the syntax less
// ugly if you want to use Connect() instead of an event table.
#define MiniStyledTextCtrlLineClickedEventHandler(func) \
(wxObjectEventFunction)(wxEventFunction)(wxCommandEventFunction) \
wxStaticCastEvent(MiniStyledTextCtrlLineClickedEventFunction, &fn)
// Define the event table entry. Yes, it really *does* end in a comma.
#define EVT_MINI_STYLED_TEXT_CTRL_COMMAND(id, fn) \
DECLARE_EVENT_TABLE_ENTRY( MiniStyledTextCtrlCommandEvent, id, wxID_ANY, \
(wxObjectEventFunction)(wxEventFunction) \
(wxCommandEventFunction) wxStaticCastEvent( \
MiniStyledTextCtrlLineClickedEventFunction, &fn ), (wxObject*) NULL ),
// Define the event table entry. Yes, it really *does* end in a comma.
#define EVT_MINI_STYLED_TEXT_CTRL_COMMAND_RANGE(id1, id2, fn) \
DECLARE_EVENT_TABLE_ENTRY( MiniStyledTextCtrlCommandEvent, id1, id2, \
(wxObjectEventFunction)(wxEventFunction) \
(wxCommandEventFunction) wxStaticCastEvent( \
MiniStyledTextCtrlLineClickedEventFunction, &fn ), (wxObject*) NULL ),
#endif