]>
Commit | Line | Data |
---|---|---|
f97d84a6 | 1 | //////////////////////////////////////////////////////////////////////////// |
a5c2ccf2 | 2 | // Name: wx/stc/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 | ||
a5c2ccf2 VZ |
20 | /* |
21 | IMPORTANT: include/wx/stc/stc.h is generated by src/stc/gen_iface.py from | |
22 | src/stc/stc.h.in, don't edit stc.h file as your changes will be | |
23 | lost after the next regeneration, edit stc.h.in and rerun the | |
24 | gen_iface.py script instead! | |
25 | ||
26 | Parts of this file generated by the script are found in between | |
27 | the special "{{{" and "}}}" markers, the rest of it is copied | |
28 | verbatim from src.h.in. | |
29 | */ | |
30 | ||
ea88e9bc VS |
31 | #ifndef _WX_STC_STC_H_ |
32 | #define _WX_STC_STC_H_ | |
f97d84a6 | 33 | |
29825f5f | 34 | #include "wx/defs.h" |
f97d84a6 | 35 | |
29825f5f PC |
36 | #if wxUSE_STC |
37 | ||
38 | #include "wx/control.h" | |
d6655166 | 39 | #include "wx/dnd.h" |
29825f5f | 40 | #include "wx/stopwatch.h" |
f97d84a6 | 41 | |
93578927 | 42 | #include "wx/textentry.h" |
2bfca191 VZ |
43 | #if wxUSE_TEXTCTRL |
44 | #include "wx/textctrl.h" | |
45 | #endif // wxUSE_TEXTCTRL | |
46 | ||
7e0c58e9 | 47 | class WXDLLIMPEXP_FWD_CORE wxScrollBar; |
2b5f62a0 | 48 | |
9d41f689 RD |
49 | // SWIG can't handle "#if" type of conditionals, only "#ifdef" |
50 | #ifdef SWIG | |
51 | #define STC_USE_DND 1 | |
52 | #else | |
53 | #if wxUSE_DRAG_AND_DROP | |
54 | #define STC_USE_DND 1 | |
55 | #endif | |
56 | #endif | |
57 | ||
9c46ea66 | 58 | |
f97d84a6 | 59 | //---------------------------------------------------------------------- |
a5c2ccf2 | 60 | // STC constants generated section {{{ |
f97d84a6 RD |
61 | |
62 | %(VALUES)s | |
63 | ||
a5c2ccf2 VZ |
64 | //}}} |
65 | //---------------------------------------------------------------------- | |
2b5f62a0 | 66 | |
a5c2ccf2 VZ |
67 | //---------------------------------------------------------------------- |
68 | // Commands that can be bound to keystrokes section {{{ | |
88a8b04e | 69 | |
2b5f62a0 VZ |
70 | %(CMDS)s |
71 | ||
a5c2ccf2 | 72 | //}}} |
f97d84a6 RD |
73 | //---------------------------------------------------------------------- |
74 | ||
75 | class ScintillaWX; // forward declare | |
76 | class WordList; | |
77 | struct SCNotification; | |
78 | ||
2b5f62a0 | 79 | #ifndef SWIG |
23318a53 | 80 | extern WXDLLIMPEXP_DATA_STC(const char) wxSTCNameStr[]; |
7e0c58e9 RD |
81 | class WXDLLIMPEXP_FWD_STC wxStyledTextCtrl; |
82 | class WXDLLIMPEXP_FWD_STC wxStyledTextEvent; | |
2b5f62a0 | 83 | #endif |
f97d84a6 RD |
84 | |
85 | //---------------------------------------------------------------------- | |
86 | ||
8e0945da | 87 | class WXDLLIMPEXP_STC wxStyledTextCtrl : public wxControl |
93578927 | 88 | , public wxTextEntryBase |
2bfca191 VZ |
89 | #if wxUSE_TEXTCTRL |
90 | , public wxTextAreaBase | |
91 | #endif // wxUSE_TEXTCTRL | |
8e0945da | 92 | { |
f97d84a6 RD |
93 | public: |
94 | ||
95 | #ifdef SWIG | |
faadde7e RD |
96 | %%pythonAppend wxStyledTextCtrl "self._setOORInfo(self)" |
97 | %%pythonAppend wxStyledTextCtrl() "" | |
39c0acb6 | 98 | |
f325fa52 | 99 | wxStyledTextCtrl(wxWindow *parent, wxWindowID id=wxID_ANY, |
f97d84a6 RD |
100 | const wxPoint& pos = wxDefaultPosition, |
101 | const wxSize& size = wxDefaultSize, long style = 0, | |
137b5242 | 102 | const wxString& name = wxPySTCNameStr); |
3c1705d9 | 103 | %%RenameCtor(PreStyledTextCtrl, wxStyledTextCtrl()); |
dc8005e2 | 104 | |
f97d84a6 | 105 | #else |
f325fa52 | 106 | wxStyledTextCtrl(wxWindow *parent, wxWindowID id=wxID_ANY, |
f97d84a6 RD |
107 | const wxPoint& pos = wxDefaultPosition, |
108 | const wxSize& size = wxDefaultSize, long style = 0, | |
109 | const wxString& name = wxSTCNameStr); | |
39c0acb6 RD |
110 | wxStyledTextCtrl() { m_swx = NULL; } |
111 | ~wxStyledTextCtrl(); | |
dc8005e2 | 112 | |
f97d84a6 RD |
113 | #endif |
114 | ||
a48cb415 RD |
115 | bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, |
116 | const wxPoint& pos = wxDefaultPosition, | |
117 | const wxSize& size = wxDefaultSize, long style = 0, | |
118 | const wxString& name = wxSTCNameStr); | |
f97d84a6 | 119 | |
f97d84a6 | 120 | |
a5c2ccf2 VZ |
121 | //---------------------------------------------------------------------- |
122 | // Generated method declaration section {{{ | |
f97d84a6 RD |
123 | |
124 | %(METHOD_DEFS)s | |
125 | ||
a5c2ccf2 VZ |
126 | //}}} |
127 | //---------------------------------------------------------------------- | |
f97d84a6 | 128 | |
a5c2ccf2 | 129 | // Manually declared methods |
f97d84a6 RD |
130 | |
131 | // Returns the line number of the line with the caret. | |
132 | int GetCurrentLine(); | |
133 | ||
134 | // Extract style settings from a spec-string which is composed of one or | |
135 | // more of the following comma separated elements: | |
136 | // | |
137 | // bold turns on bold | |
138 | // italic turns on italics | |
5ee1d760 RD |
139 | // fore:[name or #RRGGBB] sets the foreground colour |
140 | // back:[name or #RRGGBB] sets the background colour | |
f97d84a6 RD |
141 | // face:[facename] sets the font face name to use |
142 | // size:[num] sets the font size in points | |
143 | // eol turns on eol filling | |
144 | // underline turns on underlining | |
145 | // | |
146 | void StyleSetSpec(int styleNum, const wxString& spec); | |
147 | ||
148 | ||
7e0c58e9 RD |
149 | // Get the font of a style. |
150 | wxFont StyleGetFont(int style); | |
151 | ||
f97d84a6 RD |
152 | |
153 | // Set style size, face, bold, italic, and underline attributes from | |
154 | // a wxFont's attributes. | |
155 | void StyleSetFont(int styleNum, wxFont& font); | |
156 | ||
157 | ||
158 | ||
159 | // Set all font style attributes at once. | |
160 | void StyleSetFontAttr(int styleNum, int size, | |
161 | const wxString& faceName, | |
162 | bool bold, bool italic, | |
3727c043 RD |
163 | bool underline, |
164 | wxFontEncoding encoding=wxFONTENCODING_DEFAULT); | |
f97d84a6 RD |
165 | |
166 | ||
3727c043 RD |
167 | // Set the character set of the font in a style. Converts the Scintilla |
168 | // character set values to a wxFontEncoding. | |
169 | void StyleSetCharacterSet(int style, int characterSet); | |
170 | ||
171 | // Set the font encoding to be used by a style. | |
172 | void StyleSetFontEncoding(int style, wxFontEncoding encoding); | |
a5c2ccf2 | 173 | |
f97d84a6 RD |
174 | |
175 | // Perform one of the operations defined by the wxSTC_CMD_* constants. | |
176 | void CmdKeyExecute(int cmd); | |
177 | ||
178 | ||
f97d84a6 RD |
179 | // Set the left and right margin in the edit area, measured in pixels. |
180 | void SetMargins(int left, int right); | |
181 | ||
182 | ||
f97d84a6 RD |
183 | // Retrieve the point in the window where a position is displayed. |
184 | wxPoint PointFromPosition(int pos); | |
185 | ||
186 | ||
187 | // Scroll enough to make the given line visible | |
188 | void ScrollToLine(int line); | |
189 | ||
190 | ||
191 | // Scroll enough to make the given column visible | |
192 | void ScrollToColumn(int column); | |
193 | ||
65ec6247 RD |
194 | |
195 | // Send a message to Scintilla | |
8e0945da VZ |
196 | // |
197 | // NB: this method is not really const as it can modify the control but it | |
198 | // has to be declared as such as it's called from both const and | |
199 | // non-const methods and we can't distinguish between the two | |
fafd43c5 | 200 | wxIntPtr SendMsg(int msg, wxUIntPtr wp=0, wxIntPtr lp=0) const; |
65ec6247 | 201 | |
5fa4613c RD |
202 | |
203 | // Set the vertical scrollbar to use instead of the ont that's built-in. | |
ccfc3219 | 204 | void SetVScrollBar(wxScrollBar* bar); |
5fa4613c RD |
205 | |
206 | ||
207 | // Set the horizontal scrollbar to use instead of the ont that's built-in. | |
ccfc3219 | 208 | void SetHScrollBar(wxScrollBar* bar); |
5fa4613c | 209 | |
0b9dfbc0 RD |
210 | // Can be used to prevent the EVT_CHAR handler from adding the char |
211 | bool GetLastKeydownProcessed() { return m_lastKeyDownConsumed; } | |
212 | void SetLastKeydownProcessed(bool val) { m_lastKeyDownConsumed = val; } | |
213 | ||
2bfca191 VZ |
214 | // if we derive from wxTextAreaBase it already provides these methods |
215 | #if !wxUSE_TEXTCTRL | |
51566b0b RD |
216 | // Write the contents of the editor to filename |
217 | bool SaveFile(const wxString& filename); | |
218 | ||
219 | // Load the contents of filename into the editor | |
220 | bool LoadFile(const wxString& filename); | |
2bfca191 | 221 | #endif // !wxUSE_TEXTCTRL |
51566b0b | 222 | |
9d41f689 | 223 | #ifdef STC_USE_DND |
4a65f2c8 | 224 | // Allow for simulating a DnD DragOver |
dc8005e2 | 225 | wxDragResult DoDragOver(wxCoord x, wxCoord y, wxDragResult def); |
4a65f2c8 RD |
226 | |
227 | // Allow for simulating a DnD DropText | |
228 | bool DoDropText(long x, long y, const wxString& data); | |
2fcce896 MB |
229 | #endif |
230 | ||
d1558f3d RD |
231 | // Specify whether anti-aliased fonts should be used. Will have no effect |
232 | // on some platforms, but on some (wxMac for example) can greatly improve | |
233 | // performance. | |
234 | void SetUseAntiAliasing(bool useAA); | |
4a65f2c8 | 235 | |
d1558f3d RD |
236 | // Returns the current UseAntiAliasing setting. |
237 | bool GetUseAntiAliasing(); | |
dc8005e2 | 238 | |
0b9dfbc0 | 239 | |
a5c2ccf2 | 240 | |
41a499cd RD |
241 | // The following methods are nearly equivallent to their similarly named |
242 | // cousins above. The difference is that these methods bypass wxString | |
243 | // and always use a char* even if used in a unicode build of wxWidgets. | |
244 | // In that case the character data will be utf-8 encoded since that is | |
245 | // what is used internally by Scintilla in unicode builds. | |
a5c2ccf2 | 246 | |
41a499cd RD |
247 | // Add text to the document at current position. |
248 | void AddTextRaw(const char* text); | |
249 | ||
250 | // Insert string at a position. | |
251 | void InsertTextRaw(int pos, const char* text); | |
252 | ||
253 | // Retrieve the text of the line containing the caret. | |
254 | // Returns the index of the caret on the line. | |
255 | #ifdef SWIG | |
256 | wxCharBuffer GetCurLineRaw(int* OUTPUT); | |
257 | #else | |
258 | wxCharBuffer GetCurLineRaw(int* linePos=NULL); | |
259 | #endif | |
260 | ||
261 | // Retrieve the contents of a line. | |
262 | wxCharBuffer GetLineRaw(int line); | |
263 | ||
264 | // Retrieve the selected text. | |
265 | wxCharBuffer GetSelectedTextRaw(); | |
266 | ||
267 | // Retrieve a range of text. | |
268 | wxCharBuffer GetTextRangeRaw(int startPos, int endPos); | |
269 | ||
270 | // Replace the contents of the document with the argument text. | |
271 | void SetTextRaw(const char* text); | |
272 | ||
273 | // Retrieve all the text in the document. | |
274 | wxCharBuffer GetTextRaw(); | |
275 | ||
276 | // Append a string to the end of the document without changing the selection. | |
277 | void AppendTextRaw(const char* text); | |
278 | ||
1ce1bd84 | 279 | #ifdef SWIG |
f2ccce28 | 280 | %%pythoncode "_stc_utf8_methods.py" |
1ce1bd84 | 281 | #endif |
f97d84a6 RD |
282 | |
283 | ||
93578927 VZ |
284 | // implement wxTextEntryBase pure virtual methods |
285 | // ---------------------------------------------- | |
286 | ||
287 | virtual void WriteText(const wxString& text) { AddText(text); } | |
93578927 VZ |
288 | virtual void Remove(long from, long to) |
289 | { | |
290 | Replace(from, to, ""); | |
291 | } | |
292 | virtual void Replace(long from, long to, const wxString& text) | |
293 | { | |
294 | SetTargetStart(from); | |
295 | SetTargetEnd(to); | |
296 | ReplaceTarget(text); | |
297 | } | |
298 | ||
299 | /* | |
300 | These functions are already declared in the generated section. | |
301 | ||
302 | virtual void Copy(); | |
303 | virtual void Cut(); | |
304 | virtual void Paste(); | |
305 | ||
306 | virtual void Undo(); | |
307 | virtual void Redo(); | |
308 | ||
309 | virtual bool CanUndo() const; | |
310 | virtual bool CanRedo() const; | |
311 | ||
312 | */ | |
313 | ||
314 | virtual void SetInsertionPoint(long pos) { SetCurrentPos(pos); } | |
315 | virtual long GetInsertionPoint() const { return GetCurrentPos(); } | |
316 | virtual long GetLastPosition() const { return GetTextLength(); } | |
317 | ||
318 | virtual void SetSelection(long from, long to) | |
319 | { | |
320 | if ( from == -1 && to == -1 ) | |
321 | { | |
322 | SelectAll(); | |
323 | } | |
324 | else | |
325 | { | |
326 | SetSelectionStart(from); | |
327 | SetSelectionEnd(to); | |
328 | } | |
329 | } | |
330 | ||
fa70ec2b RD |
331 | #ifdef SWIG |
332 | void GetSelection(long* OUTPUT, long* OUTPUT) const; | |
333 | #else | |
93578927 VZ |
334 | virtual void GetSelection(long *from, long *to) const |
335 | { | |
336 | if ( from ) | |
337 | *from = GetSelectionStart(); | |
338 | if ( to ) | |
339 | *to = GetSelectionEnd(); | |
340 | } | |
23318a53 | 341 | |
fa70ec2b RD |
342 | // kept for compatibility only |
343 | void GetSelection(int *from, int *to) | |
344 | { | |
345 | long f, t; | |
346 | GetSelection(&f, &t); | |
347 | if ( from ) | |
348 | *from = f; | |
349 | if ( to ) | |
350 | *to = t; | |
351 | } | |
352 | #endif | |
23318a53 | 353 | |
93578927 VZ |
354 | virtual bool IsEditable() const { return !GetReadOnly(); } |
355 | virtual void SetEditable(bool editable) { SetReadOnly(!editable); } | |
356 | ||
2bfca191 VZ |
357 | // implement wxTextAreaBase pure virtual methods |
358 | // --------------------------------------------- | |
359 | ||
360 | virtual int GetLineLength(long n) const { return GetLine(n).length(); } | |
361 | virtual wxString GetLineText(long n) const { return GetLine(n); } | |
362 | virtual int GetNumberOfLines() const { return GetLineCount(); } | |
363 | ||
364 | virtual bool IsModified() const { return GetModify(); } | |
365 | virtual void MarkDirty() { wxFAIL_MSG("not implemented"); } | |
366 | virtual void DiscardEdits() { SetSavePoint(); } | |
367 | ||
368 | virtual bool SetStyle(long WXUNUSED(start), long WXUNUSED(end), | |
369 | const wxTextAttr& WXUNUSED(style)) | |
370 | { | |
371 | wxFAIL_MSG("not implemented"); | |
372 | ||
373 | return false; | |
374 | } | |
375 | ||
376 | virtual bool GetStyle(long WXUNUSED(position), wxTextAttr& WXUNUSED(style)) | |
377 | { | |
378 | wxFAIL_MSG("not implemented"); | |
379 | ||
380 | return false; | |
381 | } | |
382 | ||
383 | virtual bool SetDefaultStyle(const wxTextAttr& WXUNUSED(style)) | |
384 | { | |
385 | wxFAIL_MSG("not implemented"); | |
386 | ||
387 | return false; | |
388 | } | |
389 | ||
390 | virtual long XYToPosition(long x, long y) const | |
391 | { | |
392 | long pos = PositionFromLine(y); | |
393 | pos += x; | |
394 | return pos; | |
395 | } | |
396 | ||
397 | virtual bool PositionToXY(long pos, long *x, long *y) const | |
398 | { | |
399 | if ( x ) | |
400 | *x = -1; // TODO | |
401 | ||
402 | if ( y ) | |
403 | { | |
404 | long l = LineFromPosition(pos); | |
405 | if ( l == -1 ) | |
406 | return false; | |
407 | *y = l; | |
408 | } | |
409 | ||
410 | return true; | |
411 | } | |
412 | ||
93578927 | 413 | virtual void ShowPosition(long pos) { GotoPos(pos); } |
2bfca191 | 414 | |
a2fd8a45 VZ |
415 | // FIXME-VC6: can't use wxWindow here because of "error C2603: illegal |
416 | // access declaration: 'wxWindow' is not a direct base of | |
417 | // 'wxStyledTextCtrl'" with VC6 | |
418 | using wxControl::HitTest; | |
2bfca191 VZ |
419 | |
420 | virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const | |
421 | { | |
422 | const long l = PositionFromPoint(pt); | |
423 | if ( l == -1 ) | |
424 | return wxTE_HT_BELOW; // we don't really know where it was | |
425 | ||
426 | if ( pos ) | |
427 | *pos = l; | |
428 | ||
429 | return wxTE_HT_ON_TEXT; | |
430 | } | |
431 | ||
0aa619b5 VZ |
432 | // just unhide it |
433 | virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, | |
434 | wxTextCoord *col, | |
435 | wxTextCoord *row) const | |
436 | { | |
437 | return wxTextAreaBase::HitTest(pt, col, row); | |
438 | } | |
439 | ||
5e6880e6 | 440 | protected: |
d0a22afc VZ |
441 | virtual wxString DoGetValue() const { return GetText(); } |
442 | virtual wxWindow *GetEditableWindow() { return this; } | |
443 | ||
444 | #ifndef SWIG | |
2bfca191 VZ |
445 | virtual bool DoLoadFile(const wxString& file, int fileType); |
446 | virtual bool DoSaveFile(const wxString& file, int fileType); | |
447 | ||
f97d84a6 RD |
448 | // Event handlers |
449 | void OnPaint(wxPaintEvent& evt); | |
450 | void OnScrollWin(wxScrollWinEvent& evt); | |
5fa4613c | 451 | void OnScroll(wxScrollEvent& evt); |
f97d84a6 RD |
452 | void OnSize(wxSizeEvent& evt); |
453 | void OnMouseLeftDown(wxMouseEvent& evt); | |
454 | void OnMouseMove(wxMouseEvent& evt); | |
455 | void OnMouseLeftUp(wxMouseEvent& evt); | |
ddf2da08 | 456 | void OnMouseRightUp(wxMouseEvent& evt); |
2b5f62a0 | 457 | void OnMouseMiddleUp(wxMouseEvent& evt); |
65ec6247 | 458 | void OnContextMenu(wxContextMenuEvent& evt); |
37d62433 | 459 | void OnMouseWheel(wxMouseEvent& evt); |
f97d84a6 RD |
460 | void OnChar(wxKeyEvent& evt); |
461 | void OnKeyDown(wxKeyEvent& evt); | |
462 | void OnLoseFocus(wxFocusEvent& evt); | |
463 | void OnGainFocus(wxFocusEvent& evt); | |
464 | void OnSysColourChanged(wxSysColourChangedEvent& evt); | |
465 | void OnEraseBackground(wxEraseEvent& evt); | |
466 | void OnMenu(wxCommandEvent& evt); | |
467 | void OnListBox(wxCommandEvent& evt); | |
8e54aaed | 468 | void OnIdle(wxIdleEvent& evt); |
dc8005e2 | 469 | |
8ae4f086 | 470 | virtual wxSize DoGetBestSize() const; |
f97d84a6 RD |
471 | |
472 | // Turn notifications from Scintilla into events | |
473 | void NotifyChange(); | |
474 | void NotifyParent(SCNotification* scn); | |
475 | ||
5e6880e6 | 476 | private: |
f97d84a6 | 477 | DECLARE_EVENT_TABLE() |
ba8a4f66 | 478 | DECLARE_DYNAMIC_CLASS(wxStyledTextCtrl) |
f97d84a6 | 479 | |
9e730a78 RD |
480 | protected: |
481 | ||
f97d84a6 RD |
482 | ScintillaWX* m_swx; |
483 | wxStopWatch m_stopWatch; | |
5fa4613c RD |
484 | wxScrollBar* m_vScrollBar; |
485 | wxScrollBar* m_hScrollBar; | |
f97d84a6 | 486 | |
d6582821 | 487 | bool m_lastKeyDownConsumed; |
f97d84a6 | 488 | |
60957703 VZ |
489 | // the timestamp that consists of the last wheel event |
490 | // added to the time taken to process that event. | |
491 | long m_lastWheelTimestamp; | |
492 | ||
f97d84a6 RD |
493 | friend class ScintillaWX; |
494 | friend class Platform; | |
2bfca191 | 495 | #endif // !SWIG |
f97d84a6 RD |
496 | }; |
497 | ||
498 | //---------------------------------------------------------------------- | |
499 | ||
ba8a4f66 | 500 | class WXDLLIMPEXP_STC wxStyledTextEvent : public wxCommandEvent { |
f97d84a6 RD |
501 | public: |
502 | wxStyledTextEvent(wxEventType commandType=0, int id=0); | |
4161723f RD |
503 | #ifndef SWIG |
504 | wxStyledTextEvent(const wxStyledTextEvent& event); | |
505 | #endif | |
f97d84a6 RD |
506 | ~wxStyledTextEvent() {} |
507 | ||
a29a241f RD |
508 | void SetPosition(int pos) { m_position = pos; } |
509 | void SetKey(int k) { m_key = k; } | |
510 | void SetModifiers(int m) { m_modifiers = m; } | |
511 | void SetModificationType(int t) { m_modificationType = t; } | |
10ef30eb | 512 | void SetText(const wxString& t) { m_text = t; } |
a29a241f RD |
513 | void SetLength(int len) { m_length = len; } |
514 | void SetLinesAdded(int num) { m_linesAdded = num; } | |
515 | void SetLine(int val) { m_line = val; } | |
516 | void SetFoldLevelNow(int val) { m_foldLevelNow = val; } | |
517 | void SetFoldLevelPrev(int val) { m_foldLevelPrev = val; } | |
518 | void SetMargin(int val) { m_margin = val; } | |
519 | void SetMessage(int val) { m_message = val; } | |
520 | void SetWParam(int val) { m_wParam = val; } | |
521 | void SetLParam(int val) { m_lParam = val; } | |
522 | void SetListType(int val) { m_listType = val; } | |
523 | void SetX(int val) { m_x = val; } | |
524 | void SetY(int val) { m_y = val; } | |
525 | void SetDragText(const wxString& val) { m_dragText = val; } | |
526 | void SetDragAllowMove(bool val) { m_dragAllowMove = val; } | |
92bbd64f | 527 | #ifdef STC_USE_DND |
a29a241f | 528 | void SetDragResult(wxDragResult val) { m_dragResult = val; } |
92bbd64f | 529 | #endif |
f97d84a6 RD |
530 | |
531 | int GetPosition() const { return m_position; } | |
532 | int GetKey() const { return m_key; } | |
533 | int GetModifiers() const { return m_modifiers; } | |
534 | int GetModificationType() const { return m_modificationType; } | |
535 | wxString GetText() const { return m_text; } | |
536 | int GetLength() const { return m_length; } | |
537 | int GetLinesAdded() const { return m_linesAdded; } | |
538 | int GetLine() const { return m_line; } | |
539 | int GetFoldLevelNow() const { return m_foldLevelNow; } | |
540 | int GetFoldLevelPrev() const { return m_foldLevelPrev; } | |
541 | int GetMargin() const { return m_margin; } | |
542 | int GetMessage() const { return m_message; } | |
543 | int GetWParam() const { return m_wParam; } | |
544 | int GetLParam() const { return m_lParam; } | |
65ec6247 RD |
545 | int GetListType() const { return m_listType; } |
546 | int GetX() const { return m_x; } | |
547 | int GetY() const { return m_y; } | |
a29a241f RD |
548 | wxString GetDragText() { return m_dragText; } |
549 | bool GetDragAllowMove() { return m_dragAllowMove; } | |
92bbd64f | 550 | #ifdef STC_USE_DND |
a29a241f | 551 | wxDragResult GetDragResult() { return m_dragResult; } |
92bbd64f | 552 | #endif |
f97d84a6 RD |
553 | |
554 | bool GetShift() const; | |
555 | bool GetControl() const; | |
556 | bool GetAlt() const; | |
557 | ||
5fa4613c | 558 | virtual wxEvent* Clone() const { return new wxStyledTextEvent(*this); } |
f97d84a6 RD |
559 | |
560 | #ifndef SWIG | |
561 | private: | |
562 | DECLARE_DYNAMIC_CLASS(wxStyledTextEvent) | |
563 | ||
564 | int m_position; | |
565 | int m_key; | |
566 | int m_modifiers; | |
567 | ||
568 | int m_modificationType; // wxEVT_STC_MODIFIED | |
569 | wxString m_text; | |
570 | int m_length; | |
571 | int m_linesAdded; | |
572 | int m_line; | |
573 | int m_foldLevelNow; | |
574 | int m_foldLevelPrev; | |
575 | ||
576 | int m_margin; // wxEVT_STC_MARGINCLICK | |
577 | ||
578 | int m_message; // wxEVT_STC_MACRORECORD | |
579 | int m_wParam; | |
580 | int m_lParam; | |
65ec6247 RD |
581 | |
582 | int m_listType; | |
583 | int m_x; | |
584 | int m_y; | |
a29a241f RD |
585 | |
586 | wxString m_dragText; // wxEVT_STC_START_DRAG, wxEVT_STC_DO_DROP | |
587 | bool m_dragAllowMove; // wxEVT_STC_START_DRAG | |
588 | ||
92bbd64f | 589 | #if wxUSE_DRAG_AND_DROP |
a29a241f | 590 | wxDragResult m_dragResult; // wxEVT_STC_DRAG_OVER,wxEVT_STC_DO_DROP |
f97d84a6 | 591 | #endif |
92bbd64f | 592 | #endif |
f97d84a6 RD |
593 | }; |
594 | ||
9e730a78 RD |
595 | |
596 | ||
d25f5fbb | 597 | #ifndef SWIG |
9b11752c VZ |
598 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CHANGE, wxStyledTextEvent ); |
599 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_STYLENEEDED, wxStyledTextEvent ); | |
600 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CHARADDED, wxStyledTextEvent ); | |
601 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_SAVEPOINTREACHED, wxStyledTextEvent ); | |
602 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_SAVEPOINTLEFT, wxStyledTextEvent ); | |
603 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_ROMODIFYATTEMPT, wxStyledTextEvent ); | |
604 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_KEY, wxStyledTextEvent ); | |
605 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_DOUBLECLICK, wxStyledTextEvent ); | |
606 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_UPDATEUI, wxStyledTextEvent ); | |
607 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_MODIFIED, wxStyledTextEvent ); | |
608 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_MACRORECORD, wxStyledTextEvent ); | |
609 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_MARGINCLICK, wxStyledTextEvent ); | |
610 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_NEEDSHOWN, wxStyledTextEvent ); | |
611 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_PAINTED, wxStyledTextEvent ); | |
612 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_USERLISTSELECTION, wxStyledTextEvent ); | |
613 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_URIDROPPED, wxStyledTextEvent ); | |
614 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_DWELLSTART, wxStyledTextEvent ); | |
615 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_DWELLEND, wxStyledTextEvent ); | |
616 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_START_DRAG, wxStyledTextEvent ); | |
617 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_DRAG_OVER, wxStyledTextEvent ); | |
618 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_DO_DROP, wxStyledTextEvent ); | |
619 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_ZOOM, wxStyledTextEvent ); | |
620 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_HOTSPOT_CLICK, wxStyledTextEvent ); | |
621 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_HOTSPOT_DCLICK, wxStyledTextEvent ); | |
622 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CALLTIP_CLICK, wxStyledTextEvent ); | |
623 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_SELECTION, wxStyledTextEvent ); | |
624 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_INDICATOR_CLICK, wxStyledTextEvent ); | |
625 | wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_INDICATOR_RELEASE, wxStyledTextEvent ); | |
d25f5fbb RD |
626 | #else |
627 | enum { | |
628 | wxEVT_STC_CHANGE, | |
629 | wxEVT_STC_STYLENEEDED, | |
630 | wxEVT_STC_CHARADDED, | |
d25f5fbb RD |
631 | wxEVT_STC_SAVEPOINTREACHED, |
632 | wxEVT_STC_SAVEPOINTLEFT, | |
633 | wxEVT_STC_ROMODIFYATTEMPT, | |
65ec6247 | 634 | wxEVT_STC_KEY, |
d25f5fbb | 635 | wxEVT_STC_DOUBLECLICK, |
65ec6247 | 636 | wxEVT_STC_UPDATEUI, |
d25f5fbb | 637 | wxEVT_STC_MODIFIED, |
d25f5fbb RD |
638 | wxEVT_STC_MACRORECORD, |
639 | wxEVT_STC_MARGINCLICK, | |
640 | wxEVT_STC_NEEDSHOWN, | |
65ec6247 RD |
641 | wxEVT_STC_PAINTED, |
642 | wxEVT_STC_USERLISTSELECTION, | |
643 | wxEVT_STC_URIDROPPED, | |
644 | wxEVT_STC_DWELLSTART, | |
645 | wxEVT_STC_DWELLEND, | |
a29a241f RD |
646 | wxEVT_STC_START_DRAG, |
647 | wxEVT_STC_DRAG_OVER, | |
648 | wxEVT_STC_DO_DROP, | |
a834585d | 649 | wxEVT_STC_ZOOM, |
9e730a78 RD |
650 | wxEVT_STC_HOTSPOT_CLICK, |
651 | wxEVT_STC_HOTSPOT_DCLICK, | |
1e9bafca | 652 | wxEVT_STC_CALLTIP_CLICK, |
7e0c58e9 RD |
653 | wxEVT_STC_AUTOCOMP_SELECTION, |
654 | wxEVT_STC_INDICATOR_CLICK, | |
655 | wxEVT_STC_INDICATOR_RELEASE | |
d25f5fbb RD |
656 | }; |
657 | #endif | |
f97d84a6 | 658 | |
f97d84a6 RD |
659 | |
660 | ||
661 | #ifndef SWIG | |
662 | typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&); | |
663 | ||
3c778901 VZ |
664 | #define wxStyledTextEventHandler( func ) \ |
665 | wxEVENT_HANDLER_CAST( wxStyledTextEventFunction, func ) | |
666 | ||
667 | #define EVT_STC_CHANGE(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHANGE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
668 | #define EVT_STC_STYLENEEDED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_STYLENEEDED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
669 | #define EVT_STC_CHARADDED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHARADDED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
670 | #define EVT_STC_SAVEPOINTREACHED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTREACHED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
671 | #define EVT_STC_SAVEPOINTLEFT(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTLEFT, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
672 | #define EVT_STC_ROMODIFYATTEMPT(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ROMODIFYATTEMPT, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
673 | #define EVT_STC_KEY(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_KEY, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
674 | #define EVT_STC_DOUBLECLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DOUBLECLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
675 | #define EVT_STC_UPDATEUI(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_UPDATEUI, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
676 | #define EVT_STC_MODIFIED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MODIFIED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
677 | #define EVT_STC_MACRORECORD(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MACRORECORD, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
678 | #define EVT_STC_MARGINCLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGINCLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
679 | #define EVT_STC_NEEDSHOWN(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_NEEDSHOWN, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
680 | #define EVT_STC_PAINTED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_PAINTED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
681 | #define EVT_STC_USERLISTSELECTION(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_USERLISTSELECTION, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
682 | #define EVT_STC_URIDROPPED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_URIDROPPED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
683 | #define EVT_STC_DWELLSTART(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLSTART, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
684 | #define EVT_STC_DWELLEND(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLEND, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
685 | #define EVT_STC_START_DRAG(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_START_DRAG, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
686 | #define EVT_STC_DRAG_OVER(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
687 | #define EVT_STC_DO_DROP(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
688 | #define EVT_STC_ZOOM(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ZOOM, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
689 | #define EVT_STC_HOTSPOT_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
690 | #define EVT_STC_HOTSPOT_DCLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_DCLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
691 | #define EVT_STC_CALLTIP_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CALLTIP_CLICK id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
692 | #define EVT_STC_AUTOCOMP_SELECTION(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_SELECTION id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
693 | #define EVT_STC_INDICATOR_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_INDICATOR_CLICK id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
694 | #define EVT_STC_INDICATOR_RELEASE(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_INDICATOR_RELEASE id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), | |
7e0c58e9 | 695 | |
1bc32508 | 696 | #endif |
f97d84a6 | 697 | |
29825f5f | 698 | #endif // wxUSE_STC |
ea88e9bc VS |
699 | |
700 | #endif // _WX_STC_STC_H_ |