1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxStyledTextCtrl
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
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.
21 // Commands that can be bound to keystrokes {{{
31 @class wxStyledTextCtrl
33 A wxWidgets implementation of the Scintilla source code editing component.
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
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.
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/).
48 @beginEventEmissionTable{wxStyledTextEvent}
49 @event{EVT_STC_CHANGE(id, fn)}
51 @event{EVT_STC_STYLENEEDED(id, fn)}
53 @event{EVT_STC_CHARADDED(id, fn)}
55 @event{EVT_STC_SAVEPOINTREACHED(id, fn)}
57 @event{EVT_STC_SAVEPOINTLEFT(id, fn)}
59 @event{EVT_STC_ROMODIFYATTEMPT(id, fn)}
61 @event{EVT_STC_KEY(id, fn)}
63 @event{EVT_STC_DOUBLECLICK(id, fn)}
65 @event{EVT_STC_UPDATEUI(id, fn)}
67 @event{EVT_STC_MODIFIED(id, fn)}
69 @event{EVT_STC_MACRORECORD(id, fn)}
71 @event{EVT_STC_MARGINCLICK(id, fn)}
73 @event{EVT_STC_NEEDSHOWN(id, fn)}
75 @event{EVT_STC_PAINTED(id, fn)}
77 @event{EVT_STC_USERLISTSELECTION(id, fn)}
79 @event{EVT_STC_URIDROPPED(id, fn)}
81 @event{EVT_STC_DWELLSTART(id, fn)}
83 @event{EVT_STC_DWELLEND(id, fn)}
85 @event{EVT_STC_START_DRAG(id, fn)}
87 @event{EVT_STC_DRAG_OVER(id, fn)}
89 @event{EVT_STC_DO_DROP(id, fn)}
91 @event{EVT_STC_ZOOM(id, fn)}
93 @event{EVT_STC_HOTSPOT_CLICK(id, fn)}
95 @event{EVT_STC_HOTSPOT_DCLICK(id, fn)}
97 @event{EVT_STC_CALLTIP_CLICK(id, fn)}
99 @event{EVT_STC_AUTOCOMP_SELECTION(id, fn)}
101 @event{EVT_STC_INDICATOR_CLICK(id, fn)}
103 @event{EVT_STC_INDICATOR_RELEASE(id, fn)}
105 @event{EVT_STC_AUTOCOMP_CANCELLED(id, fn)}
107 @event{EVT_STC_AUTOCOMP_CHAR_DELETED(id, fn)}
109 @event{EVT_STC_HOTSPOT_RELEASE_CLICK(id, fn)}
116 @see wxStyledTextEvent
119 class wxStyledTextCtrl
: public wxControl
, public wxTextEntry
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
);
142 Create the UI elements for a STC that was created with the default ctor. (For 2-phase create.)
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
);
150 // **** Generated methods {{{
158 // **** Manually declared methods
162 Returns the line number of the line with the caret.
164 int GetCurrentLine();
167 Extract style settings from a spec-string which is composed of one or
168 more of the following comma separated elements:
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
179 void StyleSetSpec(int styleNum
, const wxString
& spec
);
183 Get the font of a style.
185 wxFont
StyleGetFont(int style
);
189 Set style size, face, bold, italic, and underline attributes from
190 a wxFont's attributes.
192 void StyleSetFont(int styleNum
, wxFont
& font
);
197 Set all font style attributes at once.
199 void StyleSetFontAttr(int styleNum
, int size
,
200 const wxString
& faceName
,
201 bool bold
, bool italic
,
203 wxFontEncoding encoding
=wxFONTENCODING_DEFAULT
);
207 Set the character set of the font in a style. Converts the Scintilla
208 character set values to a wxFontEncoding.
210 void StyleSetCharacterSet(int style
, int characterSet
);
213 Set the font encoding to be used by a style.
215 void StyleSetFontEncoding(int style
, wxFontEncoding encoding
);
219 Perform one of the operations defined by the wxSTC_CMD_* constants.
221 void CmdKeyExecute(int cmd
);
225 Set the left and right margin in the edit area, measured in pixels.
227 void SetMargins(int left
, int right
);
231 Retrieve the point in the window where a position is displayed.
233 wxPoint
PointFromPosition(int pos
);
237 Scroll enough to make the given line visible
239 void ScrollToLine(int line
);
243 Scroll enough to make the given column visible
245 void ScrollToColumn(int column
);
249 Send a message to Scintilla
251 wxIntPtr
SendMsg(int msg
, wxUIntPtr wp
=0, wxIntPtr lp
=0) const;
255 Set the vertical scrollbar to use instead of the ont that's built-in.
257 void SetVScrollBar(wxScrollBar
* bar
);
261 Set the horizontal scrollbar to use instead of the ont that's built-in.
263 void SetHScrollBar(wxScrollBar
* bar
);
266 Can be used to prevent the EVT_CHAR handler from adding the char
268 bool GetLastKeydownProcessed();
269 void SetLastKeydownProcessed(bool val
);
272 Write the contents of the editor to filename
274 bool SaveFile(const wxString
& filename
);
277 Load the contents of filename into the editor
279 bool LoadFile(const wxString
& filename
);
282 Allow for simulating a DnD DragOver
284 wxDragResult
DoDragOver(wxCoord x
, wxCoord y
, wxDragResult defaultRes
);
287 Allow for simulating a DnD DropText
289 bool DoDropText(long x
, long y
, const wxString
& data
);
292 Clear annotations from the given line.
294 void AnnotationClearLine(int line
);
298 Add text to the document at current position.
300 void AddTextRaw(const char* text
, int length
=-1);
303 Insert string at a position.
305 void InsertTextRaw(int pos
, const char* text
);
308 Retrieve the text of the line containing the caret.
309 Returns the index of the caret on the line.
311 wxCharBuffer
GetCurLineRaw(int* linePos
=NULL
);
314 Retrieve the contents of a line.
316 wxCharBuffer
GetLineRaw(int line
);
319 Retrieve the selected text.
321 wxCharBuffer
GetSelectedTextRaw();
324 Retrieve a range of text.
326 wxCharBuffer
GetTextRangeRaw(int startPos
, int endPos
);
329 Replace the contents of the document with the argument text.
331 void SetTextRaw(const char* text
);
334 Retrieve all the text in the document.
336 wxCharBuffer
GetTextRaw();
339 Append a string to the end of the document without changing the selection.
341 void AppendTextRaw(const char* text
, int length
=-1);
344 static wxVersionInfo
GetLibraryVersionInfo();
348 // wxTextEntryBase pure virtual methods
349 // ----------------------------------------------
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
);
355 virtual void SetInsertionPoint(long pos
);
356 virtual long GetInsertionPoint() const;
357 virtual long GetLastPosition() const;
359 virtual void SetSelection(long from
, long to
);
360 virtual void SelectNone();
361 virtual void GetSelection(long *from
, long *to
) const;
363 virtual bool IsEditable() const;
364 virtual void SetEditable(bool editable
);
366 // wxTextAreaBase pure virtual methods
367 // ---------------------------------------------
369 virtual int GetLineLength(long n
) const;
370 virtual wxString
GetLineText(long n
) const;
371 virtual int GetNumberOfLines() const;
373 virtual bool IsModified() const;
374 virtual void MarkDirty();
375 virtual void DiscardEdits();
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
);
381 virtual long XYToPosition(long x
, long y
) const;
382 virtual bool PositionToXY(long pos
, long *x
, long *y
) const;
384 virtual void ShowPosition(long pos
);
386 virtual wxTextCtrlHitTestResult
HitTest(const wxPoint
& pt
, long *pos
) const;
387 virtual wxTextCtrlHitTestResult
HitTest(const wxPoint
& pt
,
389 wxTextCoord
*row
) const;
392 //----------------------------------------------------------------------
395 @class wxStyledTextEvent
397 The type of events sent from wxStyledTextCtrl.
399 @todo list styled text ctrl events.
402 @category{events,stc}
405 class wxStyledTextEvent
: public wxCommandEvent
{
407 wxStyledTextEvent(wxEventType commandType
=0, int id
=0);
408 wxStyledTextEvent(const wxStyledTextEvent
& event
);
409 ~wxStyledTextEvent();
411 void SetPosition(int pos
);
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
);
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
);
435 int GetPosition() const;
437 int GetModifiers() const;
438 int GetModificationType() const;
439 wxString
GetText() const;
440 int GetLength() const;
441 int GetLinesAdded() 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;
452 int GetToken() const;
453 int GetAnnotationsLinesAdded() const;
454 int GetUpdated() const;
456 wxString
GetDragText();
458 wxDragResult
GetDragResult();
460 bool GetShift() const;
461 bool GetControl() const;
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
;