]>
Commit | Line | Data |
---|---|---|
f97d84a6 RD |
1 | //////////////////////////////////////////////////////////////////////////// |
2 | // Name: stc.h | |
be698f50 | 3 | // Purpose: A wxWidgets implementation of Scintilla. This class is the |
f97d84a6 RD |
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 | ||
d6655166 WS |
24 | #include "wx/wx.h" |
25 | #include "wx/dnd.h" | |
f97d84a6 | 26 | |
39c0acb6 | 27 | |
7ba1412f RD |
28 | #ifdef WXMAKINGDLL_STC |
29 | #define WXDLLIMPEXP_STC WXEXPORT | |
30 | #elif defined(WXUSINGDLL) | |
31 | #define WXDLLIMPEXP_STC WXIMPORT | |
32 | #else // not making nor using DLL | |
33 | #define WXDLLIMPEXP_STC | |
34 | #endif | |
402ce755 | 35 | |
2b5f62a0 | 36 | |
9d41f689 RD |
37 | // SWIG can't handle "#if" type of conditionals, only "#ifdef" |
38 | #ifdef SWIG | |
39 | #define STC_USE_DND 1 | |
40 | #else | |
41 | #if wxUSE_DRAG_AND_DROP | |
42 | #define STC_USE_DND 1 | |
43 | #endif | |
44 | #endif | |
45 | ||
9c46ea66 RD |
46 | //---------------------------------------------------------------------- |
47 | ||
48 | // Should a wxPopupWindow be used for the call tips and autocomplete windows? | |
49 | #ifndef wxSTC_USE_POPUP | |
50 | #define wxSTC_USE_POPUP 1 | |
51 | #endif | |
52 | ||
f97d84a6 RD |
53 | //---------------------------------------------------------------------- |
54 | // BEGIN generated section. The following code is automatically generated | |
55 | // by gen_iface.py. Do not edit this file. Edit stc.h.in instead | |
56 | // and regenerate | |
57 | ||
58 | %(VALUES)s | |
59 | ||
2b5f62a0 VZ |
60 | |
61 | //----------------------------------------- | |
62 | // Commands that can be bound to keystrokes | |
88a8b04e | 63 | |
2b5f62a0 VZ |
64 | %(CMDS)s |
65 | ||
66 | ||
f97d84a6 | 67 | // END of generated section |
f97d84a6 RD |
68 | //---------------------------------------------------------------------- |
69 | ||
70 | class ScintillaWX; // forward declare | |
71 | class WordList; | |
72 | struct SCNotification; | |
73 | ||
2b5f62a0 | 74 | #ifndef SWIG |
7ba1412f RD |
75 | extern WXDLLIMPEXP_STC const wxChar* wxSTCNameStr; |
76 | class WXDLLIMPEXP_STC wxStyledTextCtrl; | |
77 | class WXDLLIMPEXP_STC wxStyledTextEvent; | |
2b5f62a0 | 78 | #endif |
f97d84a6 RD |
79 | |
80 | //---------------------------------------------------------------------- | |
81 | ||
ba8a4f66 | 82 | class WXDLLIMPEXP_STC wxStyledTextCtrl : public wxControl { |
f97d84a6 RD |
83 | public: |
84 | ||
85 | #ifdef SWIG | |
faadde7e RD |
86 | %%pythonAppend wxStyledTextCtrl "self._setOORInfo(self)" |
87 | %%pythonAppend wxStyledTextCtrl() "" | |
39c0acb6 | 88 | |
f325fa52 | 89 | wxStyledTextCtrl(wxWindow *parent, wxWindowID id=wxID_ANY, |
f97d84a6 RD |
90 | const wxPoint& pos = wxDefaultPosition, |
91 | const wxSize& size = wxDefaultSize, long style = 0, | |
137b5242 | 92 | const wxString& name = wxPySTCNameStr); |
3c1705d9 | 93 | %%RenameCtor(PreStyledTextCtrl, wxStyledTextCtrl()); |
dc8005e2 | 94 | |
f97d84a6 | 95 | #else |
f325fa52 | 96 | wxStyledTextCtrl(wxWindow *parent, wxWindowID id=wxID_ANY, |
f97d84a6 RD |
97 | const wxPoint& pos = wxDefaultPosition, |
98 | const wxSize& size = wxDefaultSize, long style = 0, | |
99 | const wxString& name = wxSTCNameStr); | |
39c0acb6 RD |
100 | wxStyledTextCtrl() { m_swx = NULL; } |
101 | ~wxStyledTextCtrl(); | |
dc8005e2 | 102 | |
f97d84a6 RD |
103 | #endif |
104 | ||
a48cb415 RD |
105 | bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, |
106 | const wxPoint& pos = wxDefaultPosition, | |
107 | const wxSize& size = wxDefaultSize, long style = 0, | |
108 | const wxString& name = wxSTCNameStr); | |
f97d84a6 | 109 | |
f97d84a6 RD |
110 | |
111 | //---------------------------------------------------------------------- | |
112 | // BEGIN generated section. The following code is automatically generated | |
113 | // by gen_iface.py. Do not edit this file. Edit stc.h.in instead | |
114 | // and regenerate | |
115 | ||
116 | %(METHOD_DEFS)s | |
117 | ||
118 | // END of generated section | |
119 | //---------------------------------------------------------------------- | |
120 | // Others... | |
121 | ||
122 | ||
123 | // Returns the line number of the line with the caret. | |
124 | int GetCurrentLine(); | |
125 | ||
126 | // Extract style settings from a spec-string which is composed of one or | |
127 | // more of the following comma separated elements: | |
128 | // | |
129 | // bold turns on bold | |
130 | // italic turns on italics | |
5ee1d760 RD |
131 | // fore:[name or #RRGGBB] sets the foreground colour |
132 | // back:[name or #RRGGBB] sets the background colour | |
f97d84a6 RD |
133 | // face:[facename] sets the font face name to use |
134 | // size:[num] sets the font size in points | |
135 | // eol turns on eol filling | |
136 | // underline turns on underlining | |
137 | // | |
138 | void StyleSetSpec(int styleNum, const wxString& spec); | |
139 | ||
140 | ||
141 | ||
142 | // Set style size, face, bold, italic, and underline attributes from | |
143 | // a wxFont's attributes. | |
144 | void StyleSetFont(int styleNum, wxFont& font); | |
145 | ||
146 | ||
147 | ||
148 | // Set all font style attributes at once. | |
149 | void StyleSetFontAttr(int styleNum, int size, | |
150 | const wxString& faceName, | |
151 | bool bold, bool italic, | |
3727c043 RD |
152 | bool underline, |
153 | wxFontEncoding encoding=wxFONTENCODING_DEFAULT); | |
f97d84a6 RD |
154 | |
155 | ||
3727c043 RD |
156 | // Set the character set of the font in a style. Converts the Scintilla |
157 | // character set values to a wxFontEncoding. | |
158 | void StyleSetCharacterSet(int style, int characterSet); | |
159 | ||
160 | // Set the font encoding to be used by a style. | |
161 | void StyleSetFontEncoding(int style, wxFontEncoding encoding); | |
162 | ||
f97d84a6 RD |
163 | |
164 | // Perform one of the operations defined by the wxSTC_CMD_* constants. | |
165 | void CmdKeyExecute(int cmd); | |
166 | ||
167 | ||
f97d84a6 RD |
168 | // Set the left and right margin in the edit area, measured in pixels. |
169 | void SetMargins(int left, int right); | |
170 | ||
171 | ||
172 | // Retrieve the start and end positions of the current selection. | |
173 | #ifdef SWIG | |
174 | void GetSelection(int* OUTPUT, int* OUTPUT); | |
175 | #else | |
176 | void GetSelection(int* startPos, int* endPos); | |
177 | #endif | |
178 | ||
179 | // Retrieve the point in the window where a position is displayed. | |
180 | wxPoint PointFromPosition(int pos); | |
181 | ||
182 | ||
183 | // Scroll enough to make the given line visible | |
184 | void ScrollToLine(int line); | |
185 | ||
186 | ||
187 | // Scroll enough to make the given column visible | |
188 | void ScrollToColumn(int column); | |
189 | ||
65ec6247 RD |
190 | |
191 | // Send a message to Scintilla | |
192 | long SendMsg(int msg, long wp=0, long lp=0); | |
193 | ||
5fa4613c RD |
194 | |
195 | // Set the vertical scrollbar to use instead of the ont that's built-in. | |
ccfc3219 | 196 | void SetVScrollBar(wxScrollBar* bar); |
5fa4613c RD |
197 | |
198 | ||
199 | // Set the horizontal scrollbar to use instead of the ont that's built-in. | |
ccfc3219 | 200 | void SetHScrollBar(wxScrollBar* bar); |
5fa4613c | 201 | |
0b9dfbc0 RD |
202 | // Can be used to prevent the EVT_CHAR handler from adding the char |
203 | bool GetLastKeydownProcessed() { return m_lastKeyDownConsumed; } | |
204 | void SetLastKeydownProcessed(bool val) { m_lastKeyDownConsumed = val; } | |
205 | ||
51566b0b RD |
206 | // Write the contents of the editor to filename |
207 | bool SaveFile(const wxString& filename); | |
208 | ||
209 | // Load the contents of filename into the editor | |
210 | bool LoadFile(const wxString& filename); | |
211 | ||
9d41f689 | 212 | #ifdef STC_USE_DND |
4a65f2c8 | 213 | // Allow for simulating a DnD DragOver |
dc8005e2 | 214 | wxDragResult DoDragOver(wxCoord x, wxCoord y, wxDragResult def); |
4a65f2c8 RD |
215 | |
216 | // Allow for simulating a DnD DropText | |
217 | bool DoDropText(long x, long y, const wxString& data); | |
2fcce896 MB |
218 | #endif |
219 | ||
d1558f3d RD |
220 | // Specify whether anti-aliased fonts should be used. Will have no effect |
221 | // on some platforms, but on some (wxMac for example) can greatly improve | |
222 | // performance. | |
223 | void SetUseAntiAliasing(bool useAA); | |
4a65f2c8 | 224 | |
d1558f3d RD |
225 | // Returns the current UseAntiAliasing setting. |
226 | bool GetUseAntiAliasing(); | |
dc8005e2 | 227 | |
0b9dfbc0 | 228 | |
41a499cd RD |
229 | |
230 | // The following methods are nearly equivallent to their similarly named | |
231 | // cousins above. The difference is that these methods bypass wxString | |
232 | // and always use a char* even if used in a unicode build of wxWidgets. | |
233 | // In that case the character data will be utf-8 encoded since that is | |
234 | // what is used internally by Scintilla in unicode builds. | |
235 | ||
236 | // Add text to the document at current position. | |
237 | void AddTextRaw(const char* text); | |
238 | ||
239 | // Insert string at a position. | |
240 | void InsertTextRaw(int pos, const char* text); | |
241 | ||
242 | // Retrieve the text of the line containing the caret. | |
243 | // Returns the index of the caret on the line. | |
244 | #ifdef SWIG | |
245 | wxCharBuffer GetCurLineRaw(int* OUTPUT); | |
246 | #else | |
247 | wxCharBuffer GetCurLineRaw(int* linePos=NULL); | |
248 | #endif | |
249 | ||
250 | // Retrieve the contents of a line. | |
251 | wxCharBuffer GetLineRaw(int line); | |
252 | ||
253 | // Retrieve the selected text. | |
254 | wxCharBuffer GetSelectedTextRaw(); | |
255 | ||
256 | // Retrieve a range of text. | |
257 | wxCharBuffer GetTextRangeRaw(int startPos, int endPos); | |
258 | ||
259 | // Replace the contents of the document with the argument text. | |
260 | void SetTextRaw(const char* text); | |
261 | ||
262 | // Retrieve all the text in the document. | |
263 | wxCharBuffer GetTextRaw(); | |
264 | ||
265 | // Append a string to the end of the document without changing the selection. | |
266 | void AppendTextRaw(const char* text); | |
267 | ||
1ce1bd84 | 268 | #ifdef SWIG |
f2ccce28 | 269 | %%pythoncode "_stc_utf8_methods.py" |
1ce1bd84 | 270 | #endif |
f97d84a6 RD |
271 | //---------------------------------------------------------------------- |
272 | ||
273 | ||
274 | #ifndef SWIG | |
5e6880e6 | 275 | protected: |
f97d84a6 RD |
276 | // Event handlers |
277 | void OnPaint(wxPaintEvent& evt); | |
278 | void OnScrollWin(wxScrollWinEvent& evt); | |
5fa4613c | 279 | void OnScroll(wxScrollEvent& evt); |
f97d84a6 RD |
280 | void OnSize(wxSizeEvent& evt); |
281 | void OnMouseLeftDown(wxMouseEvent& evt); | |
282 | void OnMouseMove(wxMouseEvent& evt); | |
283 | void OnMouseLeftUp(wxMouseEvent& evt); | |
ddf2da08 | 284 | void OnMouseRightUp(wxMouseEvent& evt); |
2b5f62a0 | 285 | void OnMouseMiddleUp(wxMouseEvent& evt); |
65ec6247 | 286 | void OnContextMenu(wxContextMenuEvent& evt); |
37d62433 | 287 | void OnMouseWheel(wxMouseEvent& evt); |
f97d84a6 RD |
288 | void OnChar(wxKeyEvent& evt); |
289 | void OnKeyDown(wxKeyEvent& evt); | |
290 | void OnLoseFocus(wxFocusEvent& evt); | |
291 | void OnGainFocus(wxFocusEvent& evt); | |
292 | void OnSysColourChanged(wxSysColourChangedEvent& evt); | |
293 | void OnEraseBackground(wxEraseEvent& evt); | |
294 | void OnMenu(wxCommandEvent& evt); | |
295 | void OnListBox(wxCommandEvent& evt); | |
8e54aaed | 296 | void OnIdle(wxIdleEvent& evt); |
dc8005e2 | 297 | |
8ae4f086 | 298 | virtual wxSize DoGetBestSize() const; |
f97d84a6 RD |
299 | |
300 | // Turn notifications from Scintilla into events | |
301 | void NotifyChange(); | |
302 | void NotifyParent(SCNotification* scn); | |
303 | ||
5e6880e6 | 304 | private: |
f97d84a6 | 305 | DECLARE_EVENT_TABLE() |
ba8a4f66 | 306 | DECLARE_DYNAMIC_CLASS(wxStyledTextCtrl) |
f97d84a6 | 307 | |
9e730a78 RD |
308 | protected: |
309 | ||
f97d84a6 RD |
310 | ScintillaWX* m_swx; |
311 | wxStopWatch m_stopWatch; | |
5fa4613c RD |
312 | wxScrollBar* m_vScrollBar; |
313 | wxScrollBar* m_hScrollBar; | |
f97d84a6 | 314 | |
d6582821 | 315 | bool m_lastKeyDownConsumed; |
f97d84a6 RD |
316 | |
317 | friend class ScintillaWX; | |
318 | friend class Platform; | |
319 | #endif | |
320 | }; | |
321 | ||
322 | //---------------------------------------------------------------------- | |
323 | ||
ba8a4f66 | 324 | class WXDLLIMPEXP_STC wxStyledTextEvent : public wxCommandEvent { |
f97d84a6 RD |
325 | public: |
326 | wxStyledTextEvent(wxEventType commandType=0, int id=0); | |
4161723f RD |
327 | #ifndef SWIG |
328 | wxStyledTextEvent(const wxStyledTextEvent& event); | |
329 | #endif | |
f97d84a6 RD |
330 | ~wxStyledTextEvent() {} |
331 | ||
a29a241f RD |
332 | void SetPosition(int pos) { m_position = pos; } |
333 | void SetKey(int k) { m_key = k; } | |
334 | void SetModifiers(int m) { m_modifiers = m; } | |
335 | void SetModificationType(int t) { m_modificationType = t; } | |
10ef30eb | 336 | void SetText(const wxString& t) { m_text = t; } |
a29a241f RD |
337 | void SetLength(int len) { m_length = len; } |
338 | void SetLinesAdded(int num) { m_linesAdded = num; } | |
339 | void SetLine(int val) { m_line = val; } | |
340 | void SetFoldLevelNow(int val) { m_foldLevelNow = val; } | |
341 | void SetFoldLevelPrev(int val) { m_foldLevelPrev = val; } | |
342 | void SetMargin(int val) { m_margin = val; } | |
343 | void SetMessage(int val) { m_message = val; } | |
344 | void SetWParam(int val) { m_wParam = val; } | |
345 | void SetLParam(int val) { m_lParam = val; } | |
346 | void SetListType(int val) { m_listType = val; } | |
347 | void SetX(int val) { m_x = val; } | |
348 | void SetY(int val) { m_y = val; } | |
349 | void SetDragText(const wxString& val) { m_dragText = val; } | |
350 | void SetDragAllowMove(bool val) { m_dragAllowMove = val; } | |
92bbd64f | 351 | #ifdef STC_USE_DND |
a29a241f | 352 | void SetDragResult(wxDragResult val) { m_dragResult = val; } |
92bbd64f | 353 | #endif |
f97d84a6 RD |
354 | |
355 | int GetPosition() const { return m_position; } | |
356 | int GetKey() const { return m_key; } | |
357 | int GetModifiers() const { return m_modifiers; } | |
358 | int GetModificationType() const { return m_modificationType; } | |
359 | wxString GetText() const { return m_text; } | |
360 | int GetLength() const { return m_length; } | |
361 | int GetLinesAdded() const { return m_linesAdded; } | |
362 | int GetLine() const { return m_line; } | |
363 | int GetFoldLevelNow() const { return m_foldLevelNow; } | |
364 | int GetFoldLevelPrev() const { return m_foldLevelPrev; } | |
365 | int GetMargin() const { return m_margin; } | |
366 | int GetMessage() const { return m_message; } | |
367 | int GetWParam() const { return m_wParam; } | |
368 | int GetLParam() const { return m_lParam; } | |
65ec6247 RD |
369 | int GetListType() const { return m_listType; } |
370 | int GetX() const { return m_x; } | |
371 | int GetY() const { return m_y; } | |
a29a241f RD |
372 | wxString GetDragText() { return m_dragText; } |
373 | bool GetDragAllowMove() { return m_dragAllowMove; } | |
92bbd64f | 374 | #ifdef STC_USE_DND |
a29a241f | 375 | wxDragResult GetDragResult() { return m_dragResult; } |
92bbd64f | 376 | #endif |
f97d84a6 RD |
377 | |
378 | bool GetShift() const; | |
379 | bool GetControl() const; | |
380 | bool GetAlt() const; | |
381 | ||
5fa4613c | 382 | virtual wxEvent* Clone() const { return new wxStyledTextEvent(*this); } |
f97d84a6 RD |
383 | |
384 | #ifndef SWIG | |
385 | private: | |
386 | DECLARE_DYNAMIC_CLASS(wxStyledTextEvent) | |
387 | ||
388 | int m_position; | |
389 | int m_key; | |
390 | int m_modifiers; | |
391 | ||
392 | int m_modificationType; // wxEVT_STC_MODIFIED | |
393 | wxString m_text; | |
394 | int m_length; | |
395 | int m_linesAdded; | |
396 | int m_line; | |
397 | int m_foldLevelNow; | |
398 | int m_foldLevelPrev; | |
399 | ||
400 | int m_margin; // wxEVT_STC_MARGINCLICK | |
401 | ||
402 | int m_message; // wxEVT_STC_MACRORECORD | |
403 | int m_wParam; | |
404 | int m_lParam; | |
65ec6247 RD |
405 | |
406 | int m_listType; | |
407 | int m_x; | |
408 | int m_y; | |
a29a241f RD |
409 | |
410 | wxString m_dragText; // wxEVT_STC_START_DRAG, wxEVT_STC_DO_DROP | |
411 | bool m_dragAllowMove; // wxEVT_STC_START_DRAG | |
412 | ||
92bbd64f | 413 | #if wxUSE_DRAG_AND_DROP |
a29a241f | 414 | wxDragResult m_dragResult; // wxEVT_STC_DRAG_OVER,wxEVT_STC_DO_DROP |
f97d84a6 | 415 | #endif |
92bbd64f | 416 | #endif |
f97d84a6 RD |
417 | }; |
418 | ||
9e730a78 RD |
419 | |
420 | ||
d25f5fbb RD |
421 | #ifndef SWIG |
422 | BEGIN_DECLARE_EVENT_TYPES() | |
7ba1412f RD |
423 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_CHANGE, 1650) |
424 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_STYLENEEDED, 1651) | |
425 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_CHARADDED, 1652) | |
426 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_SAVEPOINTREACHED, 1653) | |
427 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_SAVEPOINTLEFT, 1654) | |
428 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_ROMODIFYATTEMPT, 1655) | |
429 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_KEY, 1656) | |
430 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_DOUBLECLICK, 1657) | |
431 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_UPDATEUI, 1658) | |
432 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_MODIFIED, 1659) | |
433 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_MACRORECORD, 1660) | |
434 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_MARGINCLICK, 1661) | |
435 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_NEEDSHOWN, 1662) | |
7ba1412f RD |
436 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_PAINTED, 1664) |
437 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_USERLISTSELECTION, 1665) | |
438 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_URIDROPPED, 1666) | |
439 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_DWELLSTART, 1667) | |
440 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_DWELLEND, 1668) | |
441 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_START_DRAG, 1669) | |
442 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_DRAG_OVER, 1670) | |
443 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_DO_DROP, 1671) | |
444 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_ZOOM, 1672) | |
445 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_HOTSPOT_CLICK, 1673) | |
446 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_HOTSPOT_DCLICK, 1674) | |
447 | DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_CALLTIP_CLICK, 1675) | |
d25f5fbb RD |
448 | END_DECLARE_EVENT_TYPES() |
449 | #else | |
450 | enum { | |
451 | wxEVT_STC_CHANGE, | |
452 | wxEVT_STC_STYLENEEDED, | |
453 | wxEVT_STC_CHARADDED, | |
d25f5fbb RD |
454 | wxEVT_STC_SAVEPOINTREACHED, |
455 | wxEVT_STC_SAVEPOINTLEFT, | |
456 | wxEVT_STC_ROMODIFYATTEMPT, | |
65ec6247 | 457 | wxEVT_STC_KEY, |
d25f5fbb | 458 | wxEVT_STC_DOUBLECLICK, |
65ec6247 | 459 | wxEVT_STC_UPDATEUI, |
d25f5fbb | 460 | wxEVT_STC_MODIFIED, |
d25f5fbb RD |
461 | wxEVT_STC_MACRORECORD, |
462 | wxEVT_STC_MARGINCLICK, | |
463 | wxEVT_STC_NEEDSHOWN, | |
65ec6247 RD |
464 | wxEVT_STC_PAINTED, |
465 | wxEVT_STC_USERLISTSELECTION, | |
466 | wxEVT_STC_URIDROPPED, | |
467 | wxEVT_STC_DWELLSTART, | |
468 | wxEVT_STC_DWELLEND, | |
a29a241f RD |
469 | wxEVT_STC_START_DRAG, |
470 | wxEVT_STC_DRAG_OVER, | |
471 | wxEVT_STC_DO_DROP, | |
a834585d | 472 | wxEVT_STC_ZOOM, |
9e730a78 RD |
473 | wxEVT_STC_HOTSPOT_CLICK, |
474 | wxEVT_STC_HOTSPOT_DCLICK, | |
475 | wxEVT_STC_CALLTIP_CLICK | |
d25f5fbb RD |
476 | }; |
477 | #endif | |
f97d84a6 | 478 | |
f97d84a6 RD |
479 | |
480 | ||
481 | #ifndef SWIG | |
482 | typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&); | |
483 | ||
dc8005e2 RD |
484 | #define EVT_STC_CHANGE(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHANGE, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), |
485 | #define EVT_STC_STYLENEEDED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_STYLENEEDED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), | |
486 | #define EVT_STC_CHARADDED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHARADDED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), | |
487 | #define EVT_STC_SAVEPOINTREACHED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTREACHED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), | |
488 | #define EVT_STC_SAVEPOINTLEFT(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTLEFT, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), | |
489 | #define EVT_STC_ROMODIFYATTEMPT(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ROMODIFYATTEMPT, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), | |
490 | #define EVT_STC_KEY(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_KEY, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), | |
491 | #define EVT_STC_DOUBLECLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DOUBLECLICK, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), | |
492 | #define EVT_STC_UPDATEUI(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_UPDATEUI, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), | |
493 | #define EVT_STC_MODIFIED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MODIFIED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), | |
494 | #define EVT_STC_MACRORECORD(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MACRORECORD, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), | |
495 | #define EVT_STC_MARGINCLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGINCLICK, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), | |
496 | #define EVT_STC_NEEDSHOWN(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_NEEDSHOWN, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), | |
497 | #define EVT_STC_PAINTED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_PAINTED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), | |
498 | #define EVT_STC_USERLISTSELECTION(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_USERLISTSELECTION, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), | |
499 | #define EVT_STC_URIDROPPED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_URIDROPPED, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), | |
500 | #define EVT_STC_DWELLSTART(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLSTART, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), | |
501 | #define EVT_STC_DWELLEND(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLEND, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), | |
502 | #define EVT_STC_START_DRAG(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_START_DRAG, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), | |
503 | #define EVT_STC_DRAG_OVER(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), | |
504 | #define EVT_STC_DO_DROP(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), | |
505 | #define EVT_STC_ZOOM(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ZOOM, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), | |
506 | #define EVT_STC_HOTSPOT_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_CLICK, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), | |
507 | #define EVT_STC_HOTSPOT_DCLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_DCLICK, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), | |
508 | #define EVT_STC_CALLTIP_CLICK(id, fn)) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CALLTIP_CLICK id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ), | |
9e730a78 | 509 | |
1bc32508 | 510 | #endif |
f97d84a6 RD |
511 | |
512 | //---------------------------------------------------------------------- | |
0c5b83b0 RD |
513 | // Utility functions used within wxSTC |
514 | ||
515 | #ifndef SWIG | |
6636ac1e RD |
516 | #if wxUSE_UNICODE |
517 | ||
518 | wxString stc2wx(const char* str); | |
519 | wxString stc2wx(const char* str, size_t len); | |
520 | const wxWX2MBbuf wx2stc(const wxString& str); | |
521 | ||
522 | #else // not UNICODE | |
0c5b83b0 RD |
523 | |
524 | inline wxString stc2wx(const char* str) { | |
0c5b83b0 | 525 | return wxString(str); |
0c5b83b0 | 526 | } |
d99859e4 | 527 | inline wxString stc2wx(const char* str, size_t len) { |
0c5b83b0 | 528 | return wxString(str, len); |
0c5b83b0 | 529 | } |
0c5b83b0 RD |
530 | inline const wxWX2MBbuf wx2stc(const wxString& str) { |
531 | return str.mbc_str(); | |
532 | } | |
0c5b83b0 | 533 | |
6636ac1e RD |
534 | #endif // UNICODE |
535 | #endif // SWIG | |
0c5b83b0 | 536 | |
f97d84a6 RD |
537 | //---------------------------------------------------------------------- |
538 | #endif | |
539 | ||
540 |