]> git.saurik.com Git - wxWidgets.git/blame - src/stc/stc.h.in
fixed yet another bug in wxActivateEvent handling
[wxWidgets.git] / src / stc / stc.h.in
CommitLineData
f97d84a6
RD
1////////////////////////////////////////////////////////////////////////////
2// Name: stc.h
3// Purpose: A wxWindows implementation of Scintilla. This class is the
4// one meant to be used directly by wx applications. It does not
5// derive directly from the Scintilla classes, and in fact there
6// is no mention of Scintilla classes at all in this header.
7// This class delegates all method calls and events to the
8// Scintilla objects and so forth. This allows the use of
9// Scintilla without polluting the namespace with all the
10// classes and itentifiers from Scintilla.
11//
12// Author: Robin Dunn
13//
14// Created: 13-Jan-2000
15// RCS-ID: $Id$
16// Copyright: (c) 2000 by Total Control Software
17// Licence: wxWindows license
18/////////////////////////////////////////////////////////////////////////////
19
20#ifndef __stc_h__
21#define __stc_h__
22
23
24#include <wx/wx.h>
25
26//----------------------------------------------------------------------
27// BEGIN generated section. The following code is automatically generated
28// by gen_iface.py. Do not edit this file. Edit stc.h.in instead
29// and regenerate
30
31%(VALUES)s
32
33// END of generated section
34//----------------------------------------------------------------------
35// Others
36
37#define wxSTC_MASK_FOLDERS ((1 << wxSTC_MARKNUM_FOLDER) | (1 << wxSTC_MARKNUM_FOLDEROPEN))
38
39
40
41//----------------------------------------------------------------------
42
43class ScintillaWX; // forward declare
44class WordList;
45struct SCNotification;
46
47
48extern const wxChar* wxSTCNameStr;
49
50//----------------------------------------------------------------------
51
52class wxStyledTextCtrl : public wxControl {
53public:
54
55#ifdef SWIG
56 wxStyledTextCtrl(wxWindow *parent, wxWindowID id,
57 const wxPoint& pos = wxDefaultPosition,
58 const wxSize& size = wxDefaultSize, long style = 0,
59 const char* name = "styledtext");
60#else
61 wxStyledTextCtrl(wxWindow *parent, wxWindowID id,
62 const wxPoint& pos = wxDefaultPosition,
63 const wxSize& size = wxDefaultSize, long style = 0,
64 const wxString& name = wxSTCNameStr);
65#endif
66
67
68#ifndef SWIG
69 ~wxStyledTextCtrl();
70#endif
71
72//----------------------------------------------------------------------
73// BEGIN generated section. The following code is automatically generated
74// by gen_iface.py. Do not edit this file. Edit stc.h.in instead
75// and regenerate
76
77%(METHOD_DEFS)s
78
79// END of generated section
80//----------------------------------------------------------------------
81// Others...
82
83
84 // Returns the line number of the line with the caret.
85 int GetCurrentLine();
86
87 // Extract style settings from a spec-string which is composed of one or
88 // more of the following comma separated elements:
89 //
90 // bold turns on bold
91 // italic turns on italics
92 // fore:#RRGGBB sets the foreground colour
93 // back:#RRGGBB sets the background colour
94 // face:[facename] sets the font face name to use
95 // size:[num] sets the font size in points
96 // eol turns on eol filling
97 // underline turns on underlining
98 //
99 void StyleSetSpec(int styleNum, const wxString& spec);
100
101
102
103 // Set style size, face, bold, italic, and underline attributes from
104 // a wxFont's attributes.
105 void StyleSetFont(int styleNum, wxFont& font);
106
107
108
109 // Set all font style attributes at once.
110 void StyleSetFontAttr(int styleNum, int size,
111 const wxString& faceName,
112 bool bold, bool italic,
113 bool underline);
114
115
116
117 // Perform one of the operations defined by the wxSTC_CMD_* constants.
118 void CmdKeyExecute(int cmd);
119
120
121
122 // Set the left and right margin in the edit area, measured in pixels.
123 void SetMargins(int left, int right);
124
125
126 // Retrieve the start and end positions of the current selection.
127#ifdef SWIG
128 void GetSelection(int* OUTPUT, int* OUTPUT);
129#else
130 void GetSelection(int* startPos, int* endPos);
131#endif
132
133 // Retrieve the point in the window where a position is displayed.
134 wxPoint PointFromPosition(int pos);
135
136
137 // Scroll enough to make the given line visible
138 void ScrollToLine(int line);
139
140
141 // Scroll enough to make the given column visible
142 void ScrollToColumn(int column);
143
65ec6247
RD
144
145 // Send a message to Scintilla
146 long SendMsg(int msg, long wp=0, long lp=0);
147
f97d84a6
RD
148//----------------------------------------------------------------------
149
150
151#ifndef SWIG
152private:
153 // Event handlers
154 void OnPaint(wxPaintEvent& evt);
155 void OnScrollWin(wxScrollWinEvent& evt);
156 void OnSize(wxSizeEvent& evt);
157 void OnMouseLeftDown(wxMouseEvent& evt);
158 void OnMouseMove(wxMouseEvent& evt);
159 void OnMouseLeftUp(wxMouseEvent& evt);
65ec6247 160 void OnContextMenu(wxContextMenuEvent& evt);
37d62433 161 void OnMouseWheel(wxMouseEvent& evt);
f97d84a6
RD
162 void OnChar(wxKeyEvent& evt);
163 void OnKeyDown(wxKeyEvent& evt);
164 void OnLoseFocus(wxFocusEvent& evt);
165 void OnGainFocus(wxFocusEvent& evt);
166 void OnSysColourChanged(wxSysColourChangedEvent& evt);
167 void OnEraseBackground(wxEraseEvent& evt);
168 void OnMenu(wxCommandEvent& evt);
169 void OnListBox(wxCommandEvent& evt);
170
171
172 // Turn notifications from Scintilla into events
173 void NotifyChange();
174 void NotifyParent(SCNotification* scn);
175
f97d84a6
RD
176private:
177 DECLARE_EVENT_TABLE()
178 DECLARE_CLASS(wxStyledTextCtrl)
179
180 ScintillaWX* m_swx;
181 wxStopWatch m_stopWatch;
182
d6582821 183 bool m_lastKeyDownConsumed;
f97d84a6
RD
184
185 friend class ScintillaWX;
186 friend class Platform;
187#endif
188};
189
190//----------------------------------------------------------------------
191
192class wxStyledTextEvent : public wxCommandEvent {
193public:
194 wxStyledTextEvent(wxEventType commandType=0, int id=0);
195 ~wxStyledTextEvent() {}
196
197 void SetPosition(int pos) { m_position = pos; }
198 void SetKey(int k) { m_key = k; }
199 void SetModifiers(int m) { m_modifiers = m; }
200 void SetModificationType(int t) { m_modificationType = t; }
201 void SetText(const char* t) { m_text = t; }
202 void SetLength(int len) { m_length = len; }
203 void SetLinesAdded(int num) { m_linesAdded = num; }
204 void SetLine(int val) { m_line = val; }
205 void SetFoldLevelNow(int val) { m_foldLevelNow = val; }
206 void SetFoldLevelPrev(int val) { m_foldLevelPrev = val; }
207 void SetMargin(int val) { m_margin = val; }
208 void SetMessage(int val) { m_message = val; }
209 void SetWParam(int val) { m_wParam = val; }
210 void SetLParam(int val) { m_lParam = val; }
65ec6247
RD
211 void SetListType(int val) { m_listType = val; }
212 void SetX(int val) { m_x = val; }
213 void SetY(int val) { m_y = val; }
f97d84a6
RD
214
215 int GetPosition() const { return m_position; }
216 int GetKey() const { return m_key; }
217 int GetModifiers() const { return m_modifiers; }
218 int GetModificationType() const { return m_modificationType; }
219 wxString GetText() const { return m_text; }
220 int GetLength() const { return m_length; }
221 int GetLinesAdded() const { return m_linesAdded; }
222 int GetLine() const { return m_line; }
223 int GetFoldLevelNow() const { return m_foldLevelNow; }
224 int GetFoldLevelPrev() const { return m_foldLevelPrev; }
225 int GetMargin() const { return m_margin; }
226 int GetMessage() const { return m_message; }
227 int GetWParam() const { return m_wParam; }
228 int GetLParam() const { return m_lParam; }
65ec6247
RD
229 int GetListType() const { return m_listType; }
230 int GetX() const { return m_x; }
231 int GetY() const { return m_y; }
f97d84a6
RD
232
233 bool GetShift() const;
234 bool GetControl() const;
235 bool GetAlt() const;
236
237 void CopyObject(wxObject& obj) const;
238
239#ifndef SWIG
240private:
241 DECLARE_DYNAMIC_CLASS(wxStyledTextEvent)
242
243 int m_position;
244 int m_key;
245 int m_modifiers;
246
247 int m_modificationType; // wxEVT_STC_MODIFIED
248 wxString m_text;
249 int m_length;
250 int m_linesAdded;
251 int m_line;
252 int m_foldLevelNow;
253 int m_foldLevelPrev;
254
255 int m_margin; // wxEVT_STC_MARGINCLICK
256
257 int m_message; // wxEVT_STC_MACRORECORD
258 int m_wParam;
259 int m_lParam;
65ec6247
RD
260
261 int m_listType;
262 int m_x;
263 int m_y;
f97d84a6
RD
264#endif
265};
266
d25f5fbb
RD
267#ifndef SWIG
268BEGIN_DECLARE_EVENT_TYPES()
65ec6247
RD
269 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHANGE, 1650)
270 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_STYLENEEDED, 1651)
271 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHARADDED, 1652)
272 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_SAVEPOINTREACHED, 1653)
273 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_SAVEPOINTLEFT, 1654)
274 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_ROMODIFYATTEMPT, 1655)
275 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_KEY, 1656)
276 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DOUBLECLICK, 1657)
277 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_UPDATEUI, 1658)
278 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MODIFIED, 1659)
279 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MACRORECORD, 1660)
280 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_MARGINCLICK, 1661)
281 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_NEEDSHOWN, 1662)
282 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_POSCHANGED, 1663)
283 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_PAINTED, 1664)
284 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_USERLISTSELECTION, 1665)
285 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_URIDROPPED, 1666)
286 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLSTART, 1667)
287 DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLEND, 1668)
d25f5fbb
RD
288END_DECLARE_EVENT_TYPES()
289#else
290 enum {
291 wxEVT_STC_CHANGE,
292 wxEVT_STC_STYLENEEDED,
293 wxEVT_STC_CHARADDED,
d25f5fbb
RD
294 wxEVT_STC_SAVEPOINTREACHED,
295 wxEVT_STC_SAVEPOINTLEFT,
296 wxEVT_STC_ROMODIFYATTEMPT,
65ec6247 297 wxEVT_STC_KEY,
d25f5fbb 298 wxEVT_STC_DOUBLECLICK,
65ec6247 299 wxEVT_STC_UPDATEUI,
d25f5fbb 300 wxEVT_STC_MODIFIED,
d25f5fbb
RD
301 wxEVT_STC_MACRORECORD,
302 wxEVT_STC_MARGINCLICK,
303 wxEVT_STC_NEEDSHOWN,
65ec6247
RD
304 wxEVT_STC_POSCHANGED,
305 wxEVT_STC_PAINTED,
306 wxEVT_STC_USERLISTSELECTION,
307 wxEVT_STC_URIDROPPED,
308 wxEVT_STC_DWELLSTART,
309 wxEVT_STC_DWELLEND,
d25f5fbb
RD
310 };
311#endif
f97d84a6 312
f97d84a6
RD
313
314
315#ifndef SWIG
316typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&);
317
65ec6247
RD
318#define EVT_STC_CHANGE(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHANGE, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
319#define EVT_STC_STYLENEEDED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_STYLENEEDED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
320#define EVT_STC_CHARADDED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHARADDED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
321#define EVT_STC_SAVEPOINTREACHED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTREACHED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
322#define EVT_STC_SAVEPOINTLEFT(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTLEFT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
323#define EVT_STC_ROMODIFYATTEMPT(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ROMODIFYATTEMPT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
324#define EVT_STC_KEY(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_KEY, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
325#define EVT_STC_DOUBLECLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DOUBLECLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
326#define EVT_STC_UPDATEUI(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_UPDATEUI, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
327#define EVT_STC_MODIFIED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MODIFIED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
328#define EVT_STC_MACRORECORD(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MACRORECORD, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
329#define EVT_STC_MARGINCLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGINCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
330#define EVT_STC_NEEDSHOWN(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_NEEDSHOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
331#define EVT_STC_POSCHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_POSCHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
332#define EVT_STC_PAINTED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_PAINTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
333#define EVT_STC_USERLISTSELECTION(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_USERLISTSELECTION, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
334#define EVT_STC_URIDROPPED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_URIDROPPED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
335#define EVT_STC_DWELLSTART(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLSTART, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
336#define EVT_STC_DWELLEND(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLEND, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
337
f97d84a6
RD
338
339#endif
340
341//----------------------------------------------------------------------
342//----------------------------------------------------------------------
343#endif
344
345