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