]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: stc/stc.h | |
3 | // Purpose: interface of wxStyledTextCtrl | |
4 | // Author: wxWidgets team | |
5 | // Licence: wxWindows licence | |
6 | ///////////////////////////////////////////////////////////////////////////// | |
7 | ||
8 | /* | |
9 | IMPORTANT: This file is generated by src/stc/gen_iface.py from | |
10 | src/stc/stc.interface.h.in. Do not edit the file in | |
11 | interface/wx/stc or your changes will be lost. | |
12 | */ | |
13 | ||
14 | ||
15 | // STC constants {{{ | |
16 | ||
17 | %(VALUES)s | |
18 | ||
19 | //}}} | |
20 | ||
21 | // Commands that can be bound to keystrokes {{{ | |
22 | ||
23 | %(CMDS)s | |
24 | ||
25 | //}}} | |
26 | ||
27 | ||
28 | ||
29 | ||
30 | /** | |
31 | @class wxStyledTextCtrl | |
32 | ||
33 | A wxWidgets implementation of the Scintilla source code editing component. | |
34 | ||
35 | As well as features found in standard text editing components, Scintilla | |
36 | includes features especially useful when editing and debugging source code. | |
37 | These include support for syntax styling, error indicators, code completion | |
38 | and call tips. | |
39 | ||
40 | The selection margin can contain markers like those used in debuggers to indicate | |
41 | breakpoints and the current line. Styling choices are more open than with many | |
42 | editors, allowing the use of proportional fonts, bold and italics, multiple | |
43 | foreground and background colours and multiple fonts. | |
44 | ||
45 | wxStyledTextCtrl is a 1 to 1 mapping of "raw" scintilla interface, whose | |
46 | documentation can be found in the Scintilla website (http://www.scintilla.org/). | |
47 | ||
48 | @beginEventEmissionTable{wxStyledTextEvent} | |
49 | @event{EVT_STC_CHANGE(id, fn)} | |
50 | TOWRITE | |
51 | @event{EVT_STC_STYLENEEDED(id, fn)} | |
52 | TOWRITE | |
53 | @event{EVT_STC_CHARADDED(id, fn)} | |
54 | TOWRITE | |
55 | @event{EVT_STC_SAVEPOINTREACHED(id, fn)} | |
56 | TOWRITE | |
57 | @event{EVT_STC_SAVEPOINTLEFT(id, fn)} | |
58 | TOWRITE | |
59 | @event{EVT_STC_ROMODIFYATTEMPT(id, fn)} | |
60 | TOWRITE | |
61 | @event{EVT_STC_KEY(id, fn)} | |
62 | TOWRITE | |
63 | @event{EVT_STC_DOUBLECLICK(id, fn)} | |
64 | TOWRITE | |
65 | @event{EVT_STC_UPDATEUI(id, fn)} | |
66 | TOWRITE | |
67 | @event{EVT_STC_MODIFIED(id, fn)} | |
68 | TOWRITE | |
69 | @event{EVT_STC_MACRORECORD(id, fn)} | |
70 | TOWRITE | |
71 | @event{EVT_STC_MARGINCLICK(id, fn)} | |
72 | TOWRITE | |
73 | @event{EVT_STC_NEEDSHOWN(id, fn)} | |
74 | TOWRITE | |
75 | @event{EVT_STC_PAINTED(id, fn)} | |
76 | TOWRITE | |
77 | @event{EVT_STC_USERLISTSELECTION(id, fn)} | |
78 | TOWRITE | |
79 | @event{EVT_STC_URIDROPPED(id, fn)} | |
80 | TOWRITE | |
81 | @event{EVT_STC_DWELLSTART(id, fn)} | |
82 | TOWRITE | |
83 | @event{EVT_STC_DWELLEND(id, fn)} | |
84 | TOWRITE | |
85 | @event{EVT_STC_START_DRAG(id, fn)} | |
86 | TOWRITE | |
87 | @event{EVT_STC_DRAG_OVER(id, fn)} | |
88 | TOWRITE | |
89 | @event{EVT_STC_DO_DROP(id, fn)} | |
90 | TOWRITE | |
91 | @event{EVT_STC_ZOOM(id, fn)} | |
92 | TOWRITE | |
93 | @event{EVT_STC_HOTSPOT_CLICK(id, fn)} | |
94 | TOWRITE | |
95 | @event{EVT_STC_HOTSPOT_DCLICK(id, fn)} | |
96 | TOWRITE | |
97 | @event{EVT_STC_CALLTIP_CLICK(id, fn)} | |
98 | TOWRITE | |
99 | @event{EVT_STC_AUTOCOMP_SELECTION(id, fn)} | |
100 | TOWRITE | |
101 | @event{EVT_STC_INDICATOR_CLICK(id, fn)} | |
102 | TOWRITE | |
103 | @event{EVT_STC_INDICATOR_RELEASE(id, fn)} | |
104 | TOWRITE | |
105 | @event{EVT_STC_AUTOCOMP_CANCELLED(id, fn)} | |
106 | TOWRITE | |
107 | @event{EVT_STC_AUTOCOMP_CHAR_DELETED(id, fn)} | |
108 | TOWRITE | |
109 | @event{EVT_STC_HOTSPOT_RELEASE_CLICK(id, fn)} | |
110 | TOWRITE | |
111 | @endEventTable | |
112 | ||
113 | @library{wxbase} | |
114 | @category{stc} | |
115 | ||
116 | @see wxStyledTextEvent | |
117 | */ | |
118 | ||
119 | class wxStyledTextCtrl : public wxControl, public wxTextEntry | |
120 | { | |
121 | public: | |
122 | ||
123 | /** | |
124 | Ctor. | |
125 | */ | |
126 | wxStyledTextCtrl(wxWindow *parent, wxWindowID id=wxID_ANY, | |
127 | const wxPoint& pos = wxDefaultPosition, | |
128 | const wxSize& size = wxDefaultSize, long style = 0, | |
129 | const wxString& name = wxSTCNameStr); | |
130 | /** | |
131 | Default ctor. | |
132 | */ | |
133 | wxStyledTextCtrl(); | |
134 | ||
135 | ||
136 | /** | |
137 | Destructor. | |
138 | */ | |
139 | ~wxStyledTextCtrl(); | |
140 | ||
141 | /** | |
142 | Create the UI elements for a STC that was created with the default ctor. (For 2-phase create.) | |
143 | */ | |
144 | bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, | |
145 | const wxPoint& pos = wxDefaultPosition, | |
146 | const wxSize& size = wxDefaultSize, long style = 0, | |
147 | const wxString& name = wxSTCNameStr); | |
148 | ||
149 | ||
150 | // **** Generated methods {{{ | |
151 | ||
152 | %(METHOD_IDEFS)s | |
153 | ||
154 | //}}} | |
155 | ||
156 | ||
157 | ||
158 | // **** Manually declared methods | |
159 | ||
160 | ||
161 | /** | |
162 | Returns the line number of the line with the caret. | |
163 | */ | |
164 | int GetCurrentLine(); | |
165 | ||
166 | /** | |
167 | Extract style settings from a spec-string which is composed of one or | |
168 | more of the following comma separated elements: | |
169 | ||
170 | bold turns on bold | |
171 | italic turns on italics | |
172 | fore:[name or #RRGGBB] sets the foreground colour | |
173 | back:[name or #RRGGBB] sets the background colour | |
174 | face:[facename] sets the font face name to use | |
175 | size:[num] sets the font size in points | |
176 | eol turns on eol filling | |
177 | underline turns on underlining | |
178 | */ | |
179 | void StyleSetSpec(int styleNum, const wxString& spec); | |
180 | ||
181 | ||
182 | /** | |
183 | Get the font of a style. | |
184 | */ | |
185 | wxFont StyleGetFont(int style); | |
186 | ||
187 | ||
188 | /** | |
189 | Set style size, face, bold, italic, and underline attributes from | |
190 | a wxFont's attributes. | |
191 | */ | |
192 | void StyleSetFont(int styleNum, wxFont& font); | |
193 | ||
194 | ||
195 | ||
196 | /** | |
197 | Set all font style attributes at once. | |
198 | */ | |
199 | void StyleSetFontAttr(int styleNum, int size, | |
200 | const wxString& faceName, | |
201 | bool bold, bool italic, | |
202 | bool underline, | |
203 | wxFontEncoding encoding=wxFONTENCODING_DEFAULT); | |
204 | ||
205 | ||
206 | /** | |
207 | Set the character set of the font in a style. Converts the Scintilla | |
208 | character set values to a wxFontEncoding. | |
209 | */ | |
210 | void StyleSetCharacterSet(int style, int characterSet); | |
211 | ||
212 | /** | |
213 | Set the font encoding to be used by a style. | |
214 | */ | |
215 | void StyleSetFontEncoding(int style, wxFontEncoding encoding); | |
216 | ||
217 | ||
218 | /** | |
219 | Perform one of the operations defined by the wxSTC_CMD_* constants. | |
220 | */ | |
221 | void CmdKeyExecute(int cmd); | |
222 | ||
223 | ||
224 | /** | |
225 | Set the left and right margin in the edit area, measured in pixels. | |
226 | */ | |
227 | void SetMargins(int left, int right); | |
228 | ||
229 | ||
230 | /** | |
231 | Retrieve the point in the window where a position is displayed. | |
232 | */ | |
233 | wxPoint PointFromPosition(int pos); | |
234 | ||
235 | ||
236 | /** | |
237 | Scroll enough to make the given line visible | |
238 | */ | |
239 | void ScrollToLine(int line); | |
240 | ||
241 | ||
242 | /** | |
243 | Scroll enough to make the given column visible | |
244 | */ | |
245 | void ScrollToColumn(int column); | |
246 | ||
247 | ||
248 | /** | |
249 | Send a message to Scintilla | |
250 | */ | |
251 | wxIntPtr SendMsg(int msg, wxUIntPtr wp=0, wxIntPtr lp=0) const; | |
252 | ||
253 | ||
254 | /** | |
255 | Set the vertical scrollbar to use instead of the ont that's built-in. | |
256 | */ | |
257 | void SetVScrollBar(wxScrollBar* bar); | |
258 | ||
259 | ||
260 | /** | |
261 | Set the horizontal scrollbar to use instead of the ont that's built-in. | |
262 | */ | |
263 | void SetHScrollBar(wxScrollBar* bar); | |
264 | ||
265 | /** | |
266 | Can be used to prevent the EVT_CHAR handler from adding the char | |
267 | */ | |
268 | bool GetLastKeydownProcessed(); | |
269 | void SetLastKeydownProcessed(bool val); | |
270 | ||
271 | /** | |
272 | Write the contents of the editor to filename | |
273 | */ | |
274 | bool SaveFile(const wxString& filename); | |
275 | ||
276 | /** | |
277 | Load the contents of filename into the editor | |
278 | */ | |
279 | bool LoadFile(const wxString& filename); | |
280 | ||
281 | /** | |
282 | Allow for simulating a DnD DragOver | |
283 | */ | |
284 | wxDragResult DoDragOver(wxCoord x, wxCoord y, wxDragResult defaultRes); | |
285 | ||
286 | /** | |
287 | Allow for simulating a DnD DropText | |
288 | */ | |
289 | bool DoDropText(long x, long y, const wxString& data); | |
290 | ||
291 | /** | |
292 | Clear annotations from the given line. | |
293 | */ | |
294 | void AnnotationClearLine(int line); | |
295 | ||
296 | ||
297 | /** | |
298 | Add text to the document at current position. | |
299 | */ | |
300 | void AddTextRaw(const char* text, int length=-1); | |
301 | ||
302 | /** | |
303 | Insert string at a position. | |
304 | */ | |
305 | void InsertTextRaw(int pos, const char* text); | |
306 | ||
307 | /** | |
308 | Retrieve the text of the line containing the caret. | |
309 | Returns the index of the caret on the line. | |
310 | */ | |
311 | wxCharBuffer GetCurLineRaw(int* linePos=NULL); | |
312 | ||
313 | /** | |
314 | Retrieve the contents of a line. | |
315 | */ | |
316 | wxCharBuffer GetLineRaw(int line); | |
317 | ||
318 | /** | |
319 | Retrieve the selected text. | |
320 | */ | |
321 | wxCharBuffer GetSelectedTextRaw(); | |
322 | ||
323 | /** | |
324 | Retrieve a range of text. | |
325 | */ | |
326 | wxCharBuffer GetTextRangeRaw(int startPos, int endPos); | |
327 | ||
328 | /** | |
329 | Replace the contents of the document with the argument text. | |
330 | */ | |
331 | void SetTextRaw(const char* text); | |
332 | ||
333 | /** | |
334 | Retrieve all the text in the document. | |
335 | */ | |
336 | wxCharBuffer GetTextRaw(); | |
337 | ||
338 | /** | |
339 | Append a string to the end of the document without changing the selection. | |
340 | */ | |
341 | void AppendTextRaw(const char* text, int length=-1); | |
342 | ||
343 | ||
344 | static wxVersionInfo GetLibraryVersionInfo(); | |
345 | ||
346 | ||
347 | ||
348 | // wxTextEntryBase pure virtual methods | |
349 | // ---------------------------------------------- | |
350 | ||
351 | virtual void WriteText(const wxString& text); | |
352 | virtual void Remove(long from, long to); | |
353 | virtual void Replace(long from, long to, const wxString& text); | |
354 | ||
355 | virtual void SetInsertionPoint(long pos); | |
356 | virtual long GetInsertionPoint() const; | |
357 | virtual long GetLastPosition() const; | |
358 | ||
359 | virtual void SetSelection(long from, long to); | |
360 | virtual void SelectNone(); | |
361 | virtual void GetSelection(long *from, long *to) const; | |
362 | ||
363 | virtual bool IsEditable() const; | |
364 | virtual void SetEditable(bool editable); | |
365 | ||
366 | // wxTextAreaBase pure virtual methods | |
367 | // --------------------------------------------- | |
368 | ||
369 | virtual int GetLineLength(long n) const; | |
370 | virtual wxString GetLineText(long n) const; | |
371 | virtual int GetNumberOfLines() const; | |
372 | ||
373 | virtual bool IsModified() const; | |
374 | virtual void MarkDirty(); | |
375 | virtual void DiscardEdits(); | |
376 | ||
377 | virtual bool SetStyle(long start, long end, const wxTextAttr& style); | |
378 | virtual bool GetStyle(long position, wxTextAttr& style); | |
379 | virtual bool SetDefaultStyle(const wxTextAttr& style); | |
380 | ||
381 | virtual long XYToPosition(long x, long y) const; | |
382 | virtual bool PositionToXY(long pos, long *x, long *y) const; | |
383 | ||
384 | virtual void ShowPosition(long pos); | |
385 | ||
386 | virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const; | |
387 | virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, | |
388 | wxTextCoord *col, | |
389 | wxTextCoord *row) const; | |
390 | }; | |
391 | ||
392 | //---------------------------------------------------------------------- | |
393 | ||
394 | /** | |
395 | @class wxStyledTextEvent | |
396 | ||
397 | The type of events sent from wxStyledTextCtrl. | |
398 | ||
399 | @todo list styled text ctrl events. | |
400 | ||
401 | @library{stc} | |
402 | @category{events,stc} | |
403 | */ | |
404 | ||
405 | class wxStyledTextEvent : public wxCommandEvent { | |
406 | public: | |
407 | wxStyledTextEvent(wxEventType commandType=0, int id=0); | |
408 | wxStyledTextEvent(const wxStyledTextEvent& event); | |
409 | ~wxStyledTextEvent(); | |
410 | ||
411 | void SetPosition(int pos); | |
412 | void SetKey(int k); | |
413 | void SetModifiers(int m); | |
414 | void SetModificationType(int t); | |
415 | void SetText(const wxString& t); | |
416 | void SetLength(int len); | |
417 | void SetLinesAdded(int num); | |
418 | void SetLine(int val); | |
419 | void SetFoldLevelNow(int val); | |
420 | void SetFoldLevelPrev(int val); | |
421 | void SetMargin(int val); | |
422 | void SetMessage(int val); | |
423 | void SetWParam(int val); | |
424 | void SetLParam(int val); | |
425 | void SetListType(int val); | |
426 | void SetX(int val); | |
427 | void SetY(int val); | |
428 | void SetToken(int val); | |
429 | void SetAnnotationLinesAdded(int val); | |
430 | void SetUpdated(int val); | |
431 | void SetDragText(const wxString& val); | |
432 | void SetDragFlags(int flags); | |
433 | void SetDragResult(wxDragResult val); | |
434 | ||
435 | int GetPosition() const; | |
436 | int GetKey() const; | |
437 | int GetModifiers() const; | |
438 | int GetModificationType() const; | |
439 | wxString GetText() const; | |
440 | int GetLength() const; | |
441 | int GetLinesAdded() const; | |
442 | int GetLine() const; | |
443 | int GetFoldLevelNow() const; | |
444 | int GetFoldLevelPrev() const; | |
445 | int GetMargin() const; | |
446 | int GetMessage() const; | |
447 | int GetWParam() const; | |
448 | int GetLParam() const; | |
449 | int GetListType() const; | |
450 | int GetX() const; | |
451 | int GetY() const; | |
452 | int GetToken() const; | |
453 | int GetAnnotationsLinesAdded() const; | |
454 | int GetUpdated() const; | |
455 | ||
456 | wxString GetDragText(); | |
457 | int GetDragFlags(); | |
458 | wxDragResult GetDragResult(); | |
459 | ||
460 | bool GetShift() const; | |
461 | bool GetControl() const; | |
462 | bool GetAlt() const; | |
463 | }; | |
464 | ||
465 | ||
466 | ||
467 | const wxEventType wxEVT_STC_CHANGE; | |
468 | const wxEventType wxEVT_STC_STYLENEEDED; | |
469 | const wxEventType wxEVT_STC_CHARADDED; | |
470 | const wxEventType wxEVT_STC_SAVEPOINTREACHED; | |
471 | const wxEventType wxEVT_STC_SAVEPOINTLEFT; | |
472 | const wxEventType wxEVT_STC_ROMODIFYATTEMPT; | |
473 | const wxEventType wxEVT_STC_KEY; | |
474 | const wxEventType wxEVT_STC_DOUBLECLICK; | |
475 | const wxEventType wxEVT_STC_UPDATEUI; | |
476 | const wxEventType wxEVT_STC_MODIFIED; | |
477 | const wxEventType wxEVT_STC_MACRORECORD; | |
478 | const wxEventType wxEVT_STC_MARGINCLICK; | |
479 | const wxEventType wxEVT_STC_NEEDSHOWN; | |
480 | const wxEventType wxEVT_STC_PAINTED; | |
481 | const wxEventType wxEVT_STC_USERLISTSELECTION; | |
482 | const wxEventType wxEVT_STC_URIDROPPED; | |
483 | const wxEventType wxEVT_STC_DWELLSTART; | |
484 | const wxEventType wxEVT_STC_DWELLEND; | |
485 | const wxEventType wxEVT_STC_START_DRAG; | |
486 | const wxEventType wxEVT_STC_DRAG_OVER; | |
487 | const wxEventType wxEVT_STC_DO_DROP; | |
488 | const wxEventType wxEVT_STC_ZOOM; | |
489 | const wxEventType wxEVT_STC_HOTSPOT_CLICK; | |
490 | const wxEventType wxEVT_STC_HOTSPOT_DCLICK; | |
491 | const wxEventType wxEVT_STC_CALLTIP_CLICK; | |
492 | const wxEventType wxEVT_STC_AUTOCOMP_SELECTION; | |
493 | const wxEventType wxEVT_STC_INDICATOR_CLICK; | |
494 | const wxEventType wxEVT_STC_INDICATOR_RELEASE; | |
495 | const wxEventType wxEVT_STC_AUTOCOMP_CANCELLED; | |
496 | const wxEventType wxEVT_STC_AUTOCOMP_CHAR_DELETED; | |
497 | const wxEventType wxEVT_STC_HOTSPOT_RELEASE_CLICK; |