~efargaspro/+junk/codeblocks-16.01-release

« back to all changes in this revision

Viewing changes to src/plugins/contrib/wxSmithSTC/stedit/include/wx/stedit/steevent.h

  • Committer: damienlmoore at gmail
  • Date: 2016-02-02 02:43:22 UTC
  • Revision ID: damienlmoore@gmail.com-20160202024322-yql5qmtbwdyamdwd
Code::BlocksĀ 16.01

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
///////////////////////////////////////////////////////////////////////////////
 
2
// Name:        steevent.h
 
3
// Purpose:     wxSTEditorEvent
 
4
// Author:      John Labenski
 
5
// Modified by:
 
6
// Created:     11/05/2002
 
7
// Copyright:   (c) John Labenski
 
8
// Licence:     wxWidgets licence
 
9
///////////////////////////////////////////////////////////////////////////////
 
10
 
 
11
/// @file steevent.h
 
12
/// @brief wxSTEditorEvent, a wxCommandEvent derived class for wxSTEditor events and wxEVT_ST* declarations.
 
13
 
 
14
#ifndef _STEEVENT_H_
 
15
#define _STEEVENT_H_
 
16
 
 
17
#include <wx/defs.h>
 
18
#include <wx/event.h>
 
19
 
 
20
#include "wx/stedit/stedefs.h"
 
21
 
 
22
class WXDLLIMPEXP_FWD_STEDIT wxSTEditor;
 
23
 
 
24
//-----------------------------------------------------------------------------
 
25
/// @class wxSTEditorEvent
 
26
/// @brief A specialized wxCommandEvent for use with the wxSTEditor.
 
27
//-----------------------------------------------------------------------------
 
28
class WXDLLIMPEXP_STEDIT wxSTEditorEvent : public wxCommandEvent
 
29
{
 
30
public:
 
31
    wxSTEditorEvent() : wxCommandEvent() {}
 
32
    wxSTEditorEvent(const wxSTEditorEvent& event) : wxCommandEvent(event) {}
 
33
    wxSTEditorEvent( int id, wxEventType type, wxObject* obj,
 
34
                     int stateChange, int stateValues,
 
35
                     const wxString& fileName );
 
36
 
 
37
    virtual ~wxSTEditorEvent() {}
 
38
 
 
39
    /// Has the state of the editor changed see STE_StateType for different states.
 
40
    /// Can OR states together to see if any of them have changed.
 
41
    bool HasStateChange(int stateChange) const         { return (GetStateChange() & stateChange) != 0; }
 
42
    bool GetStateValue(STE_StateType stateValue) const { return (GetStateValues() & stateValue)  != 0; }
 
43
 
 
44
    /// Get the changes of the wxSTEditor::GetState() for the wxEVT_STEDITOR_STATE_CHANGED.
 
45
    int  GetStateChange() const          { return GetInt(); }
 
46
    /// Get the wxSTEditor::GetState() for any wxEVT_STEDITOR_* events.
 
47
    int  GetStateValues() const          { return int(GetExtraLong()); }
 
48
    void SetStateChange(int stateChange) { SetInt(stateChange); }
 
49
    void SetStateValues(int stateValues) { SetExtraLong(stateValues); }
 
50
 
 
51
    ///. Get the filename of the wxStEditor for wxEVT_STEDITOR_* events.
 
52
    wxFileName GetFileName() const                 { return wxFileName(GetString()); }
 
53
    void SetFileName( const wxFileName& fileName ) { SetString( fileName.GetFullPath() ); }
 
54
 
 
55
    wxSTEditor* GetEditor() const;
 
56
 
 
57
    // implementation
 
58
    virtual wxEvent *Clone() const { return new wxSTEditorEvent(*this); }
 
59
 
 
60
private:
 
61
    DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSTEditorEvent)
 
62
};
 
63
 
 
64
// --------------------------------------------------------------------------
 
65
/// @name wxSTEditor wxEvent types
 
66
 
 
67
BEGIN_DECLARE_EVENT_TYPES()
 
68
/// @{
 
69
    /// wxSTEditor created, event.GetEventObject() is the editor, use to setup after constructor
 
70
    /// and at the end of the call to wxSTEditor::CreateOptions(...).
 
71
    ///   (this is a wxCommandEvent)
 
72
    DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STEDIT, wxEVT_STEDITOR_CREATED, 0)
 
73
    /// wxSTEditorSplitter created, event.GetEventObject() is the splitter, use to setup after constructor.
 
74
    ///   (this is a wxCommandEvent)
 
75
    DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STEDIT, wxEVT_STSPLITTER_CREATED, 0)
 
76
    /// wxSTEditorNotebook created, event.GetEventObject() is the notebook, use to setup after constructor.
 
77
    ///   (this is a wxCommandEvent)
 
78
    DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STEDIT, wxEVT_STNOTEBOOK_CREATED, 0)
 
79
 
 
80
    /// The state of the editor has changed see STE_StateType for the types of changes.
 
81
    /// An event to update the gui only when items change to avoid UpdateUI overkill.
 
82
    ///   (this is a wxSTEditorEvent)
 
83
    DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STEDIT, wxEVT_STEDITOR_STATE_CHANGED, 0)
 
84
    /// This wxSTEditor has the focus now, (serves to pass EVT_SET_FOCUS to parents).
 
85
    ///   (this is a wxSTEditorEvent)
 
86
    DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STEDIT, wxEVT_STEDITOR_SET_FOCUS, 0)
 
87
    /// The popup menu for the wxSTEditor is about to be shown, maybe you want to update it?
 
88
    ///   (this is a wxSTEditorEvent)
 
89
    DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STEDIT, wxEVT_STEDITOR_POPUPMENU, 0)
 
90
 
 
91
    /// The margin has been double clicked in the same line.
 
92
    ///   (this is a wxStyledTextEvent)
 
93
    DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STEDIT, wxEVT_STEDITOR_MARGINDCLICK, 0)
 
94
 
 
95
    /// A wxSTEditor is about to be created for the wxSTEditorSplitter.
 
96
    /// event.GetEventObject() is the parent wxSTEditorSplitter.
 
97
    /// You can set the event.SetEventObject() to a "new wxSTEditor" or a
 
98
    /// subclassed one of your own and this editor will be used instead.
 
99
    /// Make sure that the parent of your editor is the splitter
 
100
    ///    (ie. the original event.GetEventObject())
 
101
    /// event.GetInt() is the preferred id (probably wxID_ANY)
 
102
    ///   (this is a wxCommandEvent)
 
103
    DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STEDIT, wxEVT_STSPLITTER_CREATE_EDITOR, 0)
 
104
 
 
105
    /// A wxSTEditorSplitter is about to be created for the wxSTEditorNotebook.
 
106
    /// event.GetEventObject() is the parent wxSTEditorNotebook.
 
107
    /// You can set the event.SetEventObject() to a "new wxSTEditorSplitter" or a
 
108
    /// subclassed one of your own and this splitter will be used instead.
 
109
    /// Make sure that the parent of your splitter is the notebook
 
110
    ///    (ie. the original event.GetEventObject())
 
111
    /// event.GetInt() is the preferred id (probably wxID_ANY)
 
112
    ///   (this is a wxCommandEvent)
 
113
    DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STEDIT, wxEVT_STNOTEBOOK_CREATE_SPLITTER, 0)
 
114
 
 
115
    /// The user has clicked on one of the splitter buttons in the
 
116
    ///   wxSTEditor. This event is received by the splitter and then
 
117
    ///   the splitting occurs. The event.GetInt() is enum wxSPLIT_VERTICAL
 
118
    ///   or wxSPLIT_HORIZONTAL.
 
119
    ///   (this is a wxCommandEvent)
 
120
    DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STEDIT, wxEVT_STSPLITTER_SPLIT_BEGIN, 0)
 
121
 
 
122
    /// The wxNotebook doesn't always send enough events to follow it's state.
 
123
    ///  This event is sent whenever the selection or page count changes
 
124
    ///  eg. When all the pages are deleted, gtk doesn't notify you that the
 
125
    ///  selection is now -1
 
126
    ///   (this is a wxNotebookEvent)
 
127
    DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STEDIT, wxEVT_STNOTEBOOK_PAGE_CHANGED, 0)
 
128
 
 
129
    /// Enter has been pressed on the last line of the wxSTEditorShell.
 
130
    ///   event.GetString() contains the contents of the line.
 
131
    ///   (this is a wxSTEditorEvent)
 
132
    DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STEDIT, wxEVT_STESHELL_ENTER, 0)
 
133
 
 
134
    /// New find-all results are in a wxSTEditorFindResultsEditor.
 
135
    ///   event.GetEventObject() is the wxSTEditorFindResultsEditor with the results.
 
136
    /// This event is sent since the parents of the wxSTEditorFindResultsEditor,
 
137
    ///    be they a notebook, splitter, separate dialog, know how to show it.
 
138
    ///   (this is a wxCommandEvent)
 
139
    DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STEDIT, wxEVT_STEFIND_RESULTS_NEED_SHOWN, 0)
 
140
 
 
141
    /// Go to the file and line in an editor, probably from a previous find all.
 
142
    ///   event.GetString() can be parsed using wxSTEditorFindReplaceData::ParseFindAllString()
 
143
    ///   event.GetExtraLong() is the index into the wxSTEditorFindReplaceData::GetFindAllStrings().
 
144
    ///   event.GetEventObject() is the wxSTEditorFindResultsEditor who's results was selected.
 
145
    ///   (this is a wxFindDialogEvent)
 
146
    DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STEDIT, wxEVT_STEFIND_GOTO, 0)
 
147
 
 
148
/// @}
 
149
END_DECLARE_EVENT_TYPES()
 
150
 
 
151
 
 
152
#if !defined(wxStyledTextEventHandler) // not in < wx29
 
153
typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&);
 
154
 
 
155
#define wxStyledTextEventHandler( func ) \
 
156
    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxStyledTextEventFunction, &func)
 
157
    //wxEVENT_HANDLER_CAST( wxStyledTextEventFunction, func )
 
158
#endif // !defined(wxStyledTextEventHandler)
 
159
 
 
160
typedef void (wxEvtHandler::*wxSTEditorEventFunction)(wxSTEditorEvent&);
 
161
 
 
162
#define wxSTEditorEventHandler(func) \
 
163
    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSTEditorEventFunction, &func)
 
164
#define StyledTextEventHandler(func) \
 
165
    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxStyledTextEventFunction, &func)
 
166
 
 
167
#define wx__DECLARE_STEEVT(evt, id, fn)  wx__DECLARE_EVT1( evt, id, wxSTEditorEventHandler(fn))
 
168
#define wx__DECLARE_STEVT(evt, id, fn)   wx__DECLARE_EVT1( evt, id, StyledTextEventHandler(fn))
 
169
 
 
170
// --------------------------------------------------------------------------
 
171
/// @name wxSTEditor static EVT_ST*() wxEvent handlers.
 
172
// --------------------------------------------------------------------------
 
173
/// @{
 
174
 
 
175
#define EVT_STEDITOR_CREATED(id, fn)            EVT_COMMAND(id, wxEVT_STEDITOR_CREATED,   fn)
 
176
#define EVT_STSPLITTER_CREATED(id, fn)          EVT_COMMAND(id, wxEVT_STSPLITTER_CREATED, fn)
 
177
#define EVT_STNOTEBOOK_CREATED(id, fn)          EVT_COMMAND(id, wxEVT_STNOTEBOOK_CREATED, fn)
 
178
 
 
179
#define EVT_STEDITOR_STATE_CHANGED(id, fn)      wx__DECLARE_STEEVT(wxEVT_STEDITOR_STATE_CHANGED, id, fn)
 
180
#define EVT_STEDITOR_SET_FOCUS(id, fn)          wx__DECLARE_STEEVT(wxEVT_STEDITOR_SET_FOCUS,     id, fn)
 
181
#define EVT_STEDITOR_POPUPMENU(id, fn)          wx__DECLARE_STEEVT(wxEVT_STEDITOR_POPUPMENU,     id, fn)
 
182
 
 
183
#define EVT_STEDITOR_MARGINDCLICK(id, fn)       wx__DECLARE_STEVT(wxEVT_STEDITOR_MARGINDCLICK,   id, fn)
 
184
 
 
185
#define EVT_STSPLITTER_CREATE_EDITOR(id, fn)    EVT_COMMAND(id, wxEVT_STSPLITTER_CREATE_EDITOR,   fn)
 
186
#define EVT_STNOTEBOOK_CREATE_SPLITTER(id, fn)  EVT_COMMAND(id, wxEVT_STNOTEBOOK_CREATE_SPLITTER, fn)
 
187
 
 
188
#define EVT_STNOTEBOOK_PAGE_CHANGED(id, fn)     wx__DECLARE_EVT1(wxEVT_STNOTEBOOK_PAGE_CHANGED, id, wxNotebookEventHandler(fn))
 
189
 
 
190
#define EVT_STSPLITTER_SPLIT_BEGIN(id, fn)      wx__DECLARE_EVT1(wxEVT_STSPLITTER_SPLIT_BEGIN,  id, wxCommandEventHandler(fn))
 
191
 
 
192
#define EVT_STESHELL_ENTER(id, fn)              wx__DECLARE_STEEVT(wxEVT_STESHELL_ENTER, id, fn)
 
193
 
 
194
#define EVT_STEFIND_RESULTS_NEED_SHOWN(id, fn)  wx__DECLARE_EVT1(wxEVT_STEFIND_RESULTS_NEED_SHOWN, id, wxCommandEventHandler(fn))
 
195
#define EVT_STEFIND_GOTO(id, fn)                wx__DECLARE_EVT1(wxEVT_STEFIND_GOTO,               id, wxFindDialogEventHandler(fn))
 
196
 
 
197
/// @}
 
198
 
 
199
#endif  // _STEEVENT_H_