1 ////////////////////////////////////////////////////////////////////////////
3 // Purpose: A wxWidgets implementation of Scintilla. This class is the
4 // one meant to be used directly by wx applications. It does not
5 // derive directly from the Scintilla classes, but instead
6 // delegates most things to the real Scintilla class.
7 // This allows the use of Scintilla without polluting the
8 // namespace with all the classes and identifiers from Scintilla.
12 // Created: 13-Jan-2000
14 // Copyright: (c) 2000 by Total Control Software
15 // Licence: wxWindows licence
16 /////////////////////////////////////////////////////////////////////////////
19 IMPORTANT: src/stc/stc.cpp is generated by src/stc/gen_iface.py from
20 src/stc/stc.cpp.in, don't edit stc.cpp file as your changes will be
21 lost after the next regeneration, edit stc.cpp.in and rerun the
22 gen_iface.py script instead!
24 Parts of this file generated by the script are found in between
25 the special "{{{" and "}}}" markers, the rest of it is copied
26 verbatim from src.h.in.
29 // For compilers that support precompilation, includes "wx.h".
30 #include "wx/wxprec.h"
38 #include "wx/stc/stc.h"
39 #include "wx/stc/private.h"
47 #include "wx/tokenzr.h"
48 #include "wx/mstream.h"
52 #include "ScintillaWX.h"
54 //----------------------------------------------------------------------
56 const char wxSTCNameStr
[] = "stcwindow";
62 #define MAKELONG(a, b) ((a) | ((b) << 16))
65 static long wxColourAsLong(const wxColour
& co
) {
66 return (((long)co
.Blue() << 16) |
67 ((long)co
.Green() << 8) |
71 static wxColour
wxColourFromLong(long c
) {
73 clr
.Set((unsigned char)(c
& 0xff),
74 (unsigned char)((c
>> 8) & 0xff),
75 (unsigned char)((c
>> 16) & 0xff));
80 static wxColour
wxColourFromSpec(const wxString
& spec
) {
81 // spec should be a colour name or "#RRGGBB"
82 if (spec
.GetChar(0) == wxT('#')) {
84 long red
, green
, blue
;
85 red
= green
= blue
= 0;
86 spec
.Mid(1,2).ToLong(&red
, 16);
87 spec
.Mid(3,2).ToLong(&green
, 16);
88 spec
.Mid(5,2).ToLong(&blue
, 16);
89 return wxColour((unsigned char)red
,
94 return wxColour(spec
);
97 //----------------------------------------------------------------------
99 wxDEFINE_EVENT( wxEVT_STC_CHANGE
, wxStyledTextEvent
);
100 wxDEFINE_EVENT( wxEVT_STC_STYLENEEDED
, wxStyledTextEvent
);
101 wxDEFINE_EVENT( wxEVT_STC_CHARADDED
, wxStyledTextEvent
);
102 wxDEFINE_EVENT( wxEVT_STC_SAVEPOINTREACHED
, wxStyledTextEvent
);
103 wxDEFINE_EVENT( wxEVT_STC_SAVEPOINTLEFT
, wxStyledTextEvent
);
104 wxDEFINE_EVENT( wxEVT_STC_ROMODIFYATTEMPT
, wxStyledTextEvent
);
105 wxDEFINE_EVENT( wxEVT_STC_KEY
, wxStyledTextEvent
);
106 wxDEFINE_EVENT( wxEVT_STC_DOUBLECLICK
, wxStyledTextEvent
);
107 wxDEFINE_EVENT( wxEVT_STC_UPDATEUI
, wxStyledTextEvent
);
108 wxDEFINE_EVENT( wxEVT_STC_MODIFIED
, wxStyledTextEvent
);
109 wxDEFINE_EVENT( wxEVT_STC_MACRORECORD
, wxStyledTextEvent
);
110 wxDEFINE_EVENT( wxEVT_STC_MARGINCLICK
, wxStyledTextEvent
);
111 wxDEFINE_EVENT( wxEVT_STC_NEEDSHOWN
, wxStyledTextEvent
);
112 wxDEFINE_EVENT( wxEVT_STC_PAINTED
, wxStyledTextEvent
);
113 wxDEFINE_EVENT( wxEVT_STC_USERLISTSELECTION
, wxStyledTextEvent
);
114 wxDEFINE_EVENT( wxEVT_STC_URIDROPPED
, wxStyledTextEvent
);
115 wxDEFINE_EVENT( wxEVT_STC_DWELLSTART
, wxStyledTextEvent
);
116 wxDEFINE_EVENT( wxEVT_STC_DWELLEND
, wxStyledTextEvent
);
117 wxDEFINE_EVENT( wxEVT_STC_START_DRAG
, wxStyledTextEvent
);
118 wxDEFINE_EVENT( wxEVT_STC_DRAG_OVER
, wxStyledTextEvent
);
119 wxDEFINE_EVENT( wxEVT_STC_DO_DROP
, wxStyledTextEvent
);
120 wxDEFINE_EVENT( wxEVT_STC_ZOOM
, wxStyledTextEvent
);
121 wxDEFINE_EVENT( wxEVT_STC_HOTSPOT_CLICK
, wxStyledTextEvent
);
122 wxDEFINE_EVENT( wxEVT_STC_HOTSPOT_DCLICK
, wxStyledTextEvent
);
123 wxDEFINE_EVENT( wxEVT_STC_CALLTIP_CLICK
, wxStyledTextEvent
);
124 wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_SELECTION
, wxStyledTextEvent
);
125 wxDEFINE_EVENT( wxEVT_STC_INDICATOR_CLICK
, wxStyledTextEvent
);
126 wxDEFINE_EVENT( wxEVT_STC_INDICATOR_RELEASE
, wxStyledTextEvent
);
127 wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_CANCELLED
, wxStyledTextEvent
);
128 wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_CHAR_DELETED
, wxStyledTextEvent
);
132 BEGIN_EVENT_TABLE(wxStyledTextCtrl
, wxControl
)
133 EVT_PAINT (wxStyledTextCtrl::OnPaint
)
134 EVT_SCROLLWIN (wxStyledTextCtrl::OnScrollWin
)
135 EVT_SCROLL (wxStyledTextCtrl::OnScroll
)
136 EVT_SIZE (wxStyledTextCtrl::OnSize
)
137 EVT_LEFT_DOWN (wxStyledTextCtrl::OnMouseLeftDown
)
138 // Let Scintilla see the double click as a second click
139 EVT_LEFT_DCLICK (wxStyledTextCtrl::OnMouseLeftDown
)
140 EVT_MOTION (wxStyledTextCtrl::OnMouseMove
)
141 EVT_LEFT_UP (wxStyledTextCtrl::OnMouseLeftUp
)
142 #if defined(__WXGTK__) || defined(__WXMAC__)
143 EVT_RIGHT_UP (wxStyledTextCtrl::OnMouseRightUp
)
145 EVT_CONTEXT_MENU (wxStyledTextCtrl::OnContextMenu
)
147 EVT_MOUSEWHEEL (wxStyledTextCtrl::OnMouseWheel
)
148 EVT_MIDDLE_UP (wxStyledTextCtrl::OnMouseMiddleUp
)
149 EVT_CHAR (wxStyledTextCtrl::OnChar
)
150 EVT_KEY_DOWN (wxStyledTextCtrl::OnKeyDown
)
151 EVT_KILL_FOCUS (wxStyledTextCtrl::OnLoseFocus
)
152 EVT_SET_FOCUS (wxStyledTextCtrl::OnGainFocus
)
153 EVT_SYS_COLOUR_CHANGED (wxStyledTextCtrl::OnSysColourChanged
)
154 EVT_ERASE_BACKGROUND (wxStyledTextCtrl::OnEraseBackground
)
155 EVT_MENU_RANGE (10, 16, wxStyledTextCtrl::OnMenu
)
156 EVT_LISTBOX_DCLICK (wxID_ANY
, wxStyledTextCtrl::OnListBox
)
160 IMPLEMENT_CLASS(wxStyledTextCtrl
, wxControl
)
161 IMPLEMENT_DYNAMIC_CLASS(wxStyledTextEvent
, wxCommandEvent
)
164 // forces the linking of the lexer modules
165 int Scintilla_LinkLexers();
168 //----------------------------------------------------------------------
169 // Constructor and Destructor
171 wxStyledTextCtrl::wxStyledTextCtrl(wxWindow
*parent
,
176 const wxString
& name
)
179 Create(parent
, id
, pos
, size
, style
, name
);
183 bool wxStyledTextCtrl::Create(wxWindow
*parent
,
188 const wxString
& name
)
190 style
|= wxVSCROLL
| wxHSCROLL
;
191 if (!wxControl::Create(parent
, id
, pos
, size
,
192 style
| wxWANTS_CHARS
| wxCLIP_CHILDREN
,
193 wxDefaultValidator
, name
))
197 Scintilla_LinkLexers();
199 m_swx
= new ScintillaWX(this);
201 m_lastKeyDownConsumed
= false;
205 // Put Scintilla into unicode (UTF-8) mode
206 SetCodePage(wxSTC_CP_UTF8
);
209 SetInitialSize(size
);
211 // Reduces flicker on GTK+/X11
212 SetBackgroundStyle(wxBG_STYLE_PAINT
);
214 // Make sure it can take the focus
221 wxStyledTextCtrl::~wxStyledTextCtrl() {
226 //----------------------------------------------------------------------
228 wxIntPtr
wxStyledTextCtrl::SendMsg(int msg
, wxUIntPtr wp
, wxIntPtr lp
) const
230 return m_swx
->WndProc(msg
, wp
, lp
);
233 //----------------------------------------------------------------------
235 // Set the vertical scrollbar to use instead of the ont that's built-in.
236 void wxStyledTextCtrl::SetVScrollBar(wxScrollBar
* bar
) {
239 // ensure that the built-in scrollbar is not visible
240 SetScrollbar(wxVERTICAL
, 0, 0, 0);
245 // Set the horizontal scrollbar to use instead of the ont that's built-in.
246 void wxStyledTextCtrl::SetHScrollBar(wxScrollBar
* bar
) {
249 // ensure that the built-in scrollbar is not visible
250 SetScrollbar(wxHORIZONTAL
, 0, 0, 0);
254 //----------------------------------------------------------------------
255 // Generated methods implementation section {{{
258 // Add text to the document at current position.
259 void wxStyledTextCtrl::AddText(const wxString
& text
) {
260 const wxWX2MBbuf buf
= wx2stc(text
);
261 SendMsg(2001, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
264 // Add array of cells to document.
265 void wxStyledTextCtrl::AddStyledText(const wxMemoryBuffer
& data
) {
266 SendMsg(2002, data
.GetDataLen(), (sptr_t
)data
.GetData());
269 // Insert string at a position.
270 void wxStyledTextCtrl::InsertText(int pos
, const wxString
& text
)
272 SendMsg(2003, pos
, (sptr_t
)(const char*)wx2stc(text
));
275 // Delete all text in the document.
276 void wxStyledTextCtrl::ClearAll()
281 // Set all style bytes to 0, remove all folding information.
282 void wxStyledTextCtrl::ClearDocumentStyle()
287 // Returns the number of bytes in the document.
288 int wxStyledTextCtrl::GetLength() const
290 return SendMsg(2006, 0, 0);
293 // Returns the character byte at the position.
294 int wxStyledTextCtrl::GetCharAt(int pos
) const {
295 return (unsigned char)SendMsg(2007, pos
, 0);
298 // Returns the position of the caret.
299 int wxStyledTextCtrl::GetCurrentPos() const
301 return SendMsg(2008, 0, 0);
304 // Returns the position of the opposite end of the selection to the caret.
305 int wxStyledTextCtrl::GetAnchor() const
307 return SendMsg(2009, 0, 0);
310 // Returns the style byte at the position.
311 int wxStyledTextCtrl::GetStyleAt(int pos
) const {
312 return (unsigned char)SendMsg(2010, pos
, 0);
315 // Redoes the next action on the undo history.
316 void wxStyledTextCtrl::Redo()
321 // Choose between collecting actions into the undo
322 // history and discarding them.
323 void wxStyledTextCtrl::SetUndoCollection(bool collectUndo
)
325 SendMsg(2012, collectUndo
, 0);
328 // Select all the text in the document.
329 void wxStyledTextCtrl::SelectAll()
334 // Remember the current position in the undo history as the position
335 // at which the document was saved.
336 void wxStyledTextCtrl::SetSavePoint()
341 // Retrieve a buffer of cells.
342 wxMemoryBuffer
wxStyledTextCtrl::GetStyledText(int startPos
, int endPos
) {
344 if (endPos
< startPos
) {
349 int len
= endPos
- startPos
;
350 if (!len
) return buf
;
352 tr
.lpstrText
= (char*)buf
.GetWriteBuf(len
*2+1);
353 tr
.chrg
.cpMin
= startPos
;
354 tr
.chrg
.cpMax
= endPos
;
355 len
= SendMsg(2015, 0, (sptr_t
)&tr
);
356 buf
.UngetWriteBuf(len
);
360 // Are there any redoable actions in the undo history?
361 bool wxStyledTextCtrl::CanRedo() const
363 return SendMsg(2016, 0, 0) != 0;
366 // Retrieve the line number at which a particular marker is located.
367 int wxStyledTextCtrl::MarkerLineFromHandle(int handle
)
369 return SendMsg(2017, handle
, 0);
373 void wxStyledTextCtrl::MarkerDeleteHandle(int handle
)
375 SendMsg(2018, handle
, 0);
378 // Is undo history being collected?
379 bool wxStyledTextCtrl::GetUndoCollection() const
381 return SendMsg(2019, 0, 0) != 0;
384 // Are white space characters currently visible?
385 // Returns one of SCWS_* constants.
386 int wxStyledTextCtrl::GetViewWhiteSpace() const
388 return SendMsg(2020, 0, 0);
391 // Make white space characters invisible, always visible or visible outside indentation.
392 void wxStyledTextCtrl::SetViewWhiteSpace(int viewWS
)
394 SendMsg(2021, viewWS
, 0);
397 // Find the position from a point within the window.
398 int wxStyledTextCtrl::PositionFromPoint(wxPoint pt
) const {
399 return SendMsg(2022, pt
.x
, pt
.y
);
402 // Find the position from a point within the window but return
403 // INVALID_POSITION if not close to text.
404 int wxStyledTextCtrl::PositionFromPointClose(int x
, int y
)
406 return SendMsg(2023, x
, y
);
409 // Set caret to start of a line and ensure it is visible.
410 void wxStyledTextCtrl::GotoLine(int line
)
412 SendMsg(2024, line
, 0);
415 // Set caret to a position and ensure it is visible.
416 void wxStyledTextCtrl::GotoPos(int pos
)
418 SendMsg(2025, pos
, 0);
421 // Set the selection anchor to a position. The anchor is the opposite
422 // end of the selection from the caret.
423 void wxStyledTextCtrl::SetAnchor(int posAnchor
)
425 SendMsg(2026, posAnchor
, 0);
428 // Retrieve the text of the line containing the caret.
429 // Returns the index of the caret on the line.
430 wxString
wxStyledTextCtrl::GetCurLine(int* linePos
) {
431 int len
= LineLength(GetCurrentLine());
433 if (linePos
) *linePos
= 0;
434 return wxEmptyString
;
437 wxMemoryBuffer
mbuf(len
+1);
438 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
440 int pos
= SendMsg(2027, len
+1, (sptr_t
)buf
);
441 mbuf
.UngetWriteBuf(len
);
443 if (linePos
) *linePos
= pos
;
447 // Retrieve the position of the last correctly styled character.
448 int wxStyledTextCtrl::GetEndStyled() const
450 return SendMsg(2028, 0, 0);
453 // Convert all line endings in the document to one mode.
454 void wxStyledTextCtrl::ConvertEOLs(int eolMode
)
456 SendMsg(2029, eolMode
, 0);
459 // Retrieve the current end of line mode - one of CRLF, CR, or LF.
460 int wxStyledTextCtrl::GetEOLMode() const
462 return SendMsg(2030, 0, 0);
465 // Set the current end of line mode.
466 void wxStyledTextCtrl::SetEOLMode(int eolMode
)
468 SendMsg(2031, eolMode
, 0);
471 // Set the current styling position to pos and the styling mask to mask.
472 // The styling mask can be used to protect some bits in each styling byte from modification.
473 void wxStyledTextCtrl::StartStyling(int pos
, int mask
)
475 SendMsg(2032, pos
, mask
);
478 // Change style from current styling position for length characters to a style
479 // and move the current styling position to after this newly styled segment.
480 void wxStyledTextCtrl::SetStyling(int length
, int style
)
482 SendMsg(2033, length
, style
);
485 // Is drawing done first into a buffer or direct to the screen?
486 bool wxStyledTextCtrl::GetBufferedDraw() const
488 return SendMsg(2034, 0, 0) != 0;
491 // If drawing is buffered then each line of text is drawn into a bitmap buffer
492 // before drawing it to the screen to avoid flicker.
493 void wxStyledTextCtrl::SetBufferedDraw(bool buffered
)
495 SendMsg(2035, buffered
, 0);
498 // Change the visible size of a tab to be a multiple of the width of a space character.
499 void wxStyledTextCtrl::SetTabWidth(int tabWidth
)
501 SendMsg(2036, tabWidth
, 0);
504 // Retrieve the visible size of a tab.
505 int wxStyledTextCtrl::GetTabWidth() const
507 return SendMsg(2121, 0, 0);
510 // Set the code page used to interpret the bytes of the document as characters.
511 void wxStyledTextCtrl::SetCodePage(int codePage
) {
513 wxASSERT_MSG(codePage
== wxSTC_CP_UTF8
,
514 wxT("Only wxSTC_CP_UTF8 may be used when wxUSE_UNICODE is on."));
516 wxASSERT_MSG(codePage
!= wxSTC_CP_UTF8
,
517 wxT("wxSTC_CP_UTF8 may not be used when wxUSE_UNICODE is off."));
519 SendMsg(2037, codePage
);
522 // Set the symbol used for a particular marker number,
523 // and optionally the fore and background colours.
524 void wxStyledTextCtrl::MarkerDefine(int markerNumber
, int markerSymbol
,
525 const wxColour
& foreground
,
526 const wxColour
& background
) {
528 SendMsg(2040, markerNumber
, markerSymbol
);
529 if (foreground
.IsOk())
530 MarkerSetForeground(markerNumber
, foreground
);
531 if (background
.IsOk())
532 MarkerSetBackground(markerNumber
, background
);
535 // Set the foreground colour used for a particular marker number.
536 void wxStyledTextCtrl::MarkerSetForeground(int markerNumber
, const wxColour
& fore
)
538 SendMsg(2041, markerNumber
, wxColourAsLong(fore
));
541 // Set the background colour used for a particular marker number.
542 void wxStyledTextCtrl::MarkerSetBackground(int markerNumber
, const wxColour
& back
)
544 SendMsg(2042, markerNumber
, wxColourAsLong(back
));
547 // Add a marker to a line, returning an ID which can be used to find or delete the marker.
548 int wxStyledTextCtrl::MarkerAdd(int line
, int markerNumber
)
550 return SendMsg(2043, line
, markerNumber
);
553 // Delete a marker from a line.
554 void wxStyledTextCtrl::MarkerDelete(int line
, int markerNumber
)
556 SendMsg(2044, line
, markerNumber
);
559 // Delete all markers with a particular number from all lines.
560 void wxStyledTextCtrl::MarkerDeleteAll(int markerNumber
)
562 SendMsg(2045, markerNumber
, 0);
565 // Get a bit mask of all the markers set on a line.
566 int wxStyledTextCtrl::MarkerGet(int line
)
568 return SendMsg(2046, line
, 0);
571 // Find the next line after lineStart that includes a marker in mask.
572 int wxStyledTextCtrl::MarkerNext(int lineStart
, int markerMask
)
574 return SendMsg(2047, lineStart
, markerMask
);
577 // Find the previous line before lineStart that includes a marker in mask.
578 int wxStyledTextCtrl::MarkerPrevious(int lineStart
, int markerMask
)
580 return SendMsg(2048, lineStart
, markerMask
);
583 // Define a marker from a bitmap
584 void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber
, const wxBitmap
& bmp
) {
585 // convert bmp to a xpm in a string
586 wxMemoryOutputStream strm
;
587 wxImage img
= bmp
.ConvertToImage();
589 img
.ConvertAlphaToMask();
590 img
.SaveFile(strm
, wxBITMAP_TYPE_XPM
);
591 size_t len
= strm
.GetSize();
592 char* buff
= new char[len
+1];
593 strm
.CopyTo(buff
, len
);
595 SendMsg(2049, markerNumber
, (sptr_t
)buff
);
600 // Add a set of markers to a line.
601 void wxStyledTextCtrl::MarkerAddSet(int line
, int set
)
603 SendMsg(2466, line
, set
);
606 // Set the alpha used for a marker that is drawn in the text area, not the margin.
607 void wxStyledTextCtrl::MarkerSetAlpha(int markerNumber
, int alpha
)
609 SendMsg(2476, markerNumber
, alpha
);
612 // Set a margin to be either numeric or symbolic.
613 void wxStyledTextCtrl::SetMarginType(int margin
, int marginType
)
615 SendMsg(2240, margin
, marginType
);
618 // Retrieve the type of a margin.
619 int wxStyledTextCtrl::GetMarginType(int margin
) const
621 return SendMsg(2241, margin
, 0);
624 // Set the width of a margin to a width expressed in pixels.
625 void wxStyledTextCtrl::SetMarginWidth(int margin
, int pixelWidth
)
627 SendMsg(2242, margin
, pixelWidth
);
630 // Retrieve the width of a margin in pixels.
631 int wxStyledTextCtrl::GetMarginWidth(int margin
) const
633 return SendMsg(2243, margin
, 0);
636 // Set a mask that determines which markers are displayed in a margin.
637 void wxStyledTextCtrl::SetMarginMask(int margin
, int mask
)
639 SendMsg(2244, margin
, mask
);
642 // Retrieve the marker mask of a margin.
643 int wxStyledTextCtrl::GetMarginMask(int margin
) const
645 return SendMsg(2245, margin
, 0);
648 // Make a margin sensitive or insensitive to mouse clicks.
649 void wxStyledTextCtrl::SetMarginSensitive(int margin
, bool sensitive
)
651 SendMsg(2246, margin
, sensitive
);
654 // Retrieve the mouse click sensitivity of a margin.
655 bool wxStyledTextCtrl::GetMarginSensitive(int margin
) const
657 return SendMsg(2247, margin
, 0) != 0;
660 // Clear all the styles and make equivalent to the global default style.
661 void wxStyledTextCtrl::StyleClearAll()
666 // Set the foreground colour of a style.
667 void wxStyledTextCtrl::StyleSetForeground(int style
, const wxColour
& fore
)
669 SendMsg(2051, style
, wxColourAsLong(fore
));
672 // Set the background colour of a style.
673 void wxStyledTextCtrl::StyleSetBackground(int style
, const wxColour
& back
)
675 SendMsg(2052, style
, wxColourAsLong(back
));
678 // Set a style to be bold or not.
679 void wxStyledTextCtrl::StyleSetBold(int style
, bool bold
)
681 SendMsg(2053, style
, bold
);
684 // Set a style to be italic or not.
685 void wxStyledTextCtrl::StyleSetItalic(int style
, bool italic
)
687 SendMsg(2054, style
, italic
);
690 // Set the size of characters of a style.
691 void wxStyledTextCtrl::StyleSetSize(int style
, int sizePoints
)
693 SendMsg(2055, style
, sizePoints
);
696 // Set the font of a style.
697 void wxStyledTextCtrl::StyleSetFaceName(int style
, const wxString
& fontName
)
699 SendMsg(2056, style
, (sptr_t
)(const char*)wx2stc(fontName
));
702 // Set a style to have its end of line filled or not.
703 void wxStyledTextCtrl::StyleSetEOLFilled(int style
, bool filled
)
705 SendMsg(2057, style
, filled
);
708 // Reset the default style to its state at startup
709 void wxStyledTextCtrl::StyleResetDefault()
714 // Set a style to be underlined or not.
715 void wxStyledTextCtrl::StyleSetUnderline(int style
, bool underline
)
717 SendMsg(2059, style
, underline
);
720 // Get the foreground colour of a style.
721 wxColour
wxStyledTextCtrl::StyleGetForeground(int style
) const
723 long c
= SendMsg(2481, style
, 0);
724 return wxColourFromLong(c
);
727 // Get the background colour of a style.
728 wxColour
wxStyledTextCtrl::StyleGetBackground(int style
) const
730 long c
= SendMsg(2482, style
, 0);
731 return wxColourFromLong(c
);
734 // Get is a style bold or not.
735 bool wxStyledTextCtrl::StyleGetBold(int style
) const
737 return SendMsg(2483, style
, 0) != 0;
740 // Get is a style italic or not.
741 bool wxStyledTextCtrl::StyleGetItalic(int style
) const
743 return SendMsg(2484, style
, 0) != 0;
746 // Get the size of characters of a style.
747 int wxStyledTextCtrl::StyleGetSize(int style
) const
749 return SendMsg(2485, style
, 0);
752 // Get the font facename of a style
753 wxString
wxStyledTextCtrl::StyleGetFaceName(int style
) {
755 long len
= SendMsg(msg
, style
, 0);
756 wxMemoryBuffer
mbuf(len
+1);
757 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
758 SendMsg(msg
, style
, (sptr_t
)buf
);
759 mbuf
.UngetWriteBuf(len
);
764 // Get is a style to have its end of line filled or not.
765 bool wxStyledTextCtrl::StyleGetEOLFilled(int style
) const
767 return SendMsg(2487, style
, 0) != 0;
770 // Get is a style underlined or not.
771 bool wxStyledTextCtrl::StyleGetUnderline(int style
) const
773 return SendMsg(2488, style
, 0) != 0;
776 // Get is a style mixed case, or to force upper or lower case.
777 int wxStyledTextCtrl::StyleGetCase(int style
) const
779 return SendMsg(2489, style
, 0);
782 // Get the character set of the font in a style.
783 int wxStyledTextCtrl::StyleGetCharacterSet(int style
) const
785 return SendMsg(2490, style
, 0);
788 // Get is a style visible or not.
789 bool wxStyledTextCtrl::StyleGetVisible(int style
) const
791 return SendMsg(2491, style
, 0) != 0;
794 // Get is a style changeable or not (read only).
795 // Experimental feature, currently buggy.
796 bool wxStyledTextCtrl::StyleGetChangeable(int style
) const
798 return SendMsg(2492, style
, 0) != 0;
801 // Get is a style a hotspot or not.
802 bool wxStyledTextCtrl::StyleGetHotSpot(int style
) const
804 return SendMsg(2493, style
, 0) != 0;
807 // Set a style to be mixed case, or to force upper or lower case.
808 void wxStyledTextCtrl::StyleSetCase(int style
, int caseForce
)
810 SendMsg(2060, style
, caseForce
);
813 // Set a style to be a hotspot or not.
814 void wxStyledTextCtrl::StyleSetHotSpot(int style
, bool hotspot
)
816 SendMsg(2409, style
, hotspot
);
819 // Set the foreground colour of the main and additional selections and whether to use this setting.
820 void wxStyledTextCtrl::SetSelForeground(bool useSetting
, const wxColour
& fore
)
822 SendMsg(2067, useSetting
, wxColourAsLong(fore
));
825 // Set the background colour of the main and additional selections and whether to use this setting.
826 void wxStyledTextCtrl::SetSelBackground(bool useSetting
, const wxColour
& back
)
828 SendMsg(2068, useSetting
, wxColourAsLong(back
));
831 // Get the alpha of the selection.
832 int wxStyledTextCtrl::GetSelAlpha() const
834 return SendMsg(2477, 0, 0);
837 // Set the alpha of the selection.
838 void wxStyledTextCtrl::SetSelAlpha(int alpha
)
840 SendMsg(2478, alpha
, 0);
843 // Is the selection end of line filled?
844 bool wxStyledTextCtrl::GetSelEOLFilled() const
846 return SendMsg(2479, 0, 0) != 0;
849 // Set the selection to have its end of line filled or not.
850 void wxStyledTextCtrl::SetSelEOLFilled(bool filled
)
852 SendMsg(2480, filled
, 0);
855 // Set the foreground colour of the caret.
856 void wxStyledTextCtrl::SetCaretForeground(const wxColour
& fore
)
858 SendMsg(2069, wxColourAsLong(fore
), 0);
861 // When key+modifier combination km is pressed perform msg.
862 void wxStyledTextCtrl::CmdKeyAssign(int key
, int modifiers
, int cmd
) {
863 SendMsg(2070, MAKELONG(key
, modifiers
), cmd
);
866 // When key+modifier combination km is pressed do nothing.
867 void wxStyledTextCtrl::CmdKeyClear(int key
, int modifiers
) {
868 SendMsg(2071, MAKELONG(key
, modifiers
));
871 // Drop all key mappings.
872 void wxStyledTextCtrl::CmdKeyClearAll()
877 // Set the styles for a segment of the document.
878 void wxStyledTextCtrl::SetStyleBytes(int length
, char* styleBytes
) {
879 SendMsg(2073, length
, (sptr_t
)styleBytes
);
882 // Set a style to be visible or not.
883 void wxStyledTextCtrl::StyleSetVisible(int style
, bool visible
)
885 SendMsg(2074, style
, visible
);
888 // Get the time in milliseconds that the caret is on and off.
889 int wxStyledTextCtrl::GetCaretPeriod() const
891 return SendMsg(2075, 0, 0);
894 // Get the time in milliseconds that the caret is on and off. 0 = steady on.
895 void wxStyledTextCtrl::SetCaretPeriod(int periodMilliseconds
)
897 SendMsg(2076, periodMilliseconds
, 0);
900 // Set the set of characters making up words for when moving or selecting by word.
901 // First sets defaults like SetCharsDefault.
902 void wxStyledTextCtrl::SetWordChars(const wxString
& characters
)
904 SendMsg(2077, 0, (sptr_t
)(const char*)wx2stc(characters
));
907 // Start a sequence of actions that is undone and redone as a unit.
909 void wxStyledTextCtrl::BeginUndoAction()
914 // End a sequence of actions that is undone and redone as a unit.
915 void wxStyledTextCtrl::EndUndoAction()
920 // Set an indicator to plain, squiggle or TT.
921 void wxStyledTextCtrl::IndicatorSetStyle(int indic
, int style
)
923 SendMsg(2080, indic
, style
);
926 // Retrieve the style of an indicator.
927 int wxStyledTextCtrl::IndicatorGetStyle(int indic
) const
929 return SendMsg(2081, indic
, 0);
932 // Set the foreground colour of an indicator.
933 void wxStyledTextCtrl::IndicatorSetForeground(int indic
, const wxColour
& fore
)
935 SendMsg(2082, indic
, wxColourAsLong(fore
));
938 // Retrieve the foreground colour of an indicator.
939 wxColour
wxStyledTextCtrl::IndicatorGetForeground(int indic
) const
941 long c
= SendMsg(2083, indic
, 0);
942 return wxColourFromLong(c
);
945 // Set an indicator to draw under text or over(default).
946 void wxStyledTextCtrl::IndicatorSetUnder(int indic
, bool under
)
948 SendMsg(2510, indic
, under
);
951 // Retrieve whether indicator drawn under or over text.
952 bool wxStyledTextCtrl::IndicatorGetUnder(int indic
) const
954 return SendMsg(2511, indic
, 0) != 0;
957 // Set the foreground colour of all whitespace and whether to use this setting.
958 void wxStyledTextCtrl::SetWhitespaceForeground(bool useSetting
, const wxColour
& fore
)
960 SendMsg(2084, useSetting
, wxColourAsLong(fore
));
963 // Set the background colour of all whitespace and whether to use this setting.
964 void wxStyledTextCtrl::SetWhitespaceBackground(bool useSetting
, const wxColour
& back
)
966 SendMsg(2085, useSetting
, wxColourAsLong(back
));
969 // Set the size of the dots used to mark space characters.
970 void wxStyledTextCtrl::SetWhitespaceSize(int size
)
972 SendMsg(2086, size
, 0);
975 // Get the size of the dots used to mark space characters.
976 int wxStyledTextCtrl::GetWhitespaceSize() const
978 return SendMsg(2087, 0, 0);
981 // Divide each styling byte into lexical class bits (default: 5) and indicator
982 // bits (default: 3). If a lexer requires more than 32 lexical states, then this
983 // is used to expand the possible states.
984 void wxStyledTextCtrl::SetStyleBits(int bits
)
986 SendMsg(2090, bits
, 0);
989 // Retrieve number of bits in style bytes used to hold the lexical state.
990 int wxStyledTextCtrl::GetStyleBits() const
992 return SendMsg(2091, 0, 0);
995 // Used to hold extra styling information for each line.
996 void wxStyledTextCtrl::SetLineState(int line
, int state
)
998 SendMsg(2092, line
, state
);
1001 // Retrieve the extra styling information for a line.
1002 int wxStyledTextCtrl::GetLineState(int line
) const
1004 return SendMsg(2093, line
, 0);
1007 // Retrieve the last line number that has line state.
1008 int wxStyledTextCtrl::GetMaxLineState() const
1010 return SendMsg(2094, 0, 0);
1013 // Is the background of the line containing the caret in a different colour?
1014 bool wxStyledTextCtrl::GetCaretLineVisible() const
1016 return SendMsg(2095, 0, 0) != 0;
1019 // Display the background of the line containing the caret in a different colour.
1020 void wxStyledTextCtrl::SetCaretLineVisible(bool show
)
1022 SendMsg(2096, show
, 0);
1025 // Get the colour of the background of the line containing the caret.
1026 wxColour
wxStyledTextCtrl::GetCaretLineBackground() const
1028 long c
= SendMsg(2097, 0, 0);
1029 return wxColourFromLong(c
);
1032 // Set the colour of the background of the line containing the caret.
1033 void wxStyledTextCtrl::SetCaretLineBackground(const wxColour
& back
)
1035 SendMsg(2098, wxColourAsLong(back
), 0);
1038 // Set a style to be changeable or not (read only).
1039 // Experimental feature, currently buggy.
1040 void wxStyledTextCtrl::StyleSetChangeable(int style
, bool changeable
)
1042 SendMsg(2099, style
, changeable
);
1045 // Display a auto-completion list.
1046 // The lenEntered parameter indicates how many characters before
1047 // the caret should be used to provide context.
1048 void wxStyledTextCtrl::AutoCompShow(int lenEntered
, const wxString
& itemList
)
1050 SendMsg(2100, lenEntered
, (sptr_t
)(const char*)wx2stc(itemList
));
1053 // Remove the auto-completion list from the screen.
1054 void wxStyledTextCtrl::AutoCompCancel()
1056 SendMsg(2101, 0, 0);
1059 // Is there an auto-completion list visible?
1060 bool wxStyledTextCtrl::AutoCompActive()
1062 return SendMsg(2102, 0, 0) != 0;
1065 // Retrieve the position of the caret when the auto-completion list was displayed.
1066 int wxStyledTextCtrl::AutoCompPosStart()
1068 return SendMsg(2103, 0, 0);
1071 // User has selected an item so remove the list and insert the selection.
1072 void wxStyledTextCtrl::AutoCompComplete()
1074 SendMsg(2104, 0, 0);
1077 // Define a set of character that when typed cancel the auto-completion list.
1078 void wxStyledTextCtrl::AutoCompStops(const wxString
& characterSet
)
1080 SendMsg(2105, 0, (sptr_t
)(const char*)wx2stc(characterSet
));
1083 // Change the separator character in the string setting up an auto-completion list.
1084 // Default is space but can be changed if items contain space.
1085 void wxStyledTextCtrl::AutoCompSetSeparator(int separatorCharacter
)
1087 SendMsg(2106, separatorCharacter
, 0);
1090 // Retrieve the auto-completion list separator character.
1091 int wxStyledTextCtrl::AutoCompGetSeparator() const
1093 return SendMsg(2107, 0, 0);
1096 // Select the item in the auto-completion list that starts with a string.
1097 void wxStyledTextCtrl::AutoCompSelect(const wxString
& text
)
1099 SendMsg(2108, 0, (sptr_t
)(const char*)wx2stc(text
));
1102 // Should the auto-completion list be cancelled if the user backspaces to a
1103 // position before where the box was created.
1104 void wxStyledTextCtrl::AutoCompSetCancelAtStart(bool cancel
)
1106 SendMsg(2110, cancel
, 0);
1109 // Retrieve whether auto-completion cancelled by backspacing before start.
1110 bool wxStyledTextCtrl::AutoCompGetCancelAtStart() const
1112 return SendMsg(2111, 0, 0) != 0;
1115 // Define a set of characters that when typed will cause the autocompletion to
1116 // choose the selected item.
1117 void wxStyledTextCtrl::AutoCompSetFillUps(const wxString
& characterSet
)
1119 SendMsg(2112, 0, (sptr_t
)(const char*)wx2stc(characterSet
));
1122 // Should a single item auto-completion list automatically choose the item.
1123 void wxStyledTextCtrl::AutoCompSetChooseSingle(bool chooseSingle
)
1125 SendMsg(2113, chooseSingle
, 0);
1128 // Retrieve whether a single item auto-completion list automatically choose the item.
1129 bool wxStyledTextCtrl::AutoCompGetChooseSingle() const
1131 return SendMsg(2114, 0, 0) != 0;
1134 // Set whether case is significant when performing auto-completion searches.
1135 void wxStyledTextCtrl::AutoCompSetIgnoreCase(bool ignoreCase
)
1137 SendMsg(2115, ignoreCase
, 0);
1140 // Retrieve state of ignore case flag.
1141 bool wxStyledTextCtrl::AutoCompGetIgnoreCase() const
1143 return SendMsg(2116, 0, 0) != 0;
1146 // Display a list of strings and send notification when user chooses one.
1147 void wxStyledTextCtrl::UserListShow(int listType
, const wxString
& itemList
)
1149 SendMsg(2117, listType
, (sptr_t
)(const char*)wx2stc(itemList
));
1152 // Set whether or not autocompletion is hidden automatically when nothing matches.
1153 void wxStyledTextCtrl::AutoCompSetAutoHide(bool autoHide
)
1155 SendMsg(2118, autoHide
, 0);
1158 // Retrieve whether or not autocompletion is hidden automatically when nothing matches.
1159 bool wxStyledTextCtrl::AutoCompGetAutoHide() const
1161 return SendMsg(2119, 0, 0) != 0;
1164 // Set whether or not autocompletion deletes any word characters
1165 // after the inserted text upon completion.
1166 void wxStyledTextCtrl::AutoCompSetDropRestOfWord(bool dropRestOfWord
)
1168 SendMsg(2270, dropRestOfWord
, 0);
1171 // Retrieve whether or not autocompletion deletes any word characters
1172 // after the inserted text upon completion.
1173 bool wxStyledTextCtrl::AutoCompGetDropRestOfWord() const
1175 return SendMsg(2271, 0, 0) != 0;
1178 // Register an image for use in autocompletion lists.
1179 void wxStyledTextCtrl::RegisterImage(int type
, const wxBitmap
& bmp
) {
1180 // convert bmp to a xpm in a string
1181 wxMemoryOutputStream strm
;
1182 wxImage img
= bmp
.ConvertToImage();
1184 img
.ConvertAlphaToMask();
1185 img
.SaveFile(strm
, wxBITMAP_TYPE_XPM
);
1186 size_t len
= strm
.GetSize();
1187 char* buff
= new char[len
+1];
1188 strm
.CopyTo(buff
, len
);
1190 SendMsg(2405, type
, (sptr_t
)buff
);
1195 // Clear all the registered images.
1196 void wxStyledTextCtrl::ClearRegisteredImages()
1198 SendMsg(2408, 0, 0);
1201 // Retrieve the auto-completion list type-separator character.
1202 int wxStyledTextCtrl::AutoCompGetTypeSeparator() const
1204 return SendMsg(2285, 0, 0);
1207 // Change the type-separator character in the string setting up an auto-completion list.
1208 // Default is '?' but can be changed if items contain '?'.
1209 void wxStyledTextCtrl::AutoCompSetTypeSeparator(int separatorCharacter
)
1211 SendMsg(2286, separatorCharacter
, 0);
1214 // Set the maximum width, in characters, of auto-completion and user lists.
1215 // Set to 0 to autosize to fit longest item, which is the default.
1216 void wxStyledTextCtrl::AutoCompSetMaxWidth(int characterCount
)
1218 SendMsg(2208, characterCount
, 0);
1221 // Get the maximum width, in characters, of auto-completion and user lists.
1222 int wxStyledTextCtrl::AutoCompGetMaxWidth() const
1224 return SendMsg(2209, 0, 0);
1227 // Set the maximum height, in rows, of auto-completion and user lists.
1228 // The default is 5 rows.
1229 void wxStyledTextCtrl::AutoCompSetMaxHeight(int rowCount
)
1231 SendMsg(2210, rowCount
, 0);
1234 // Set the maximum height, in rows, of auto-completion and user lists.
1235 int wxStyledTextCtrl::AutoCompGetMaxHeight() const
1237 return SendMsg(2211, 0, 0);
1240 // Set the number of spaces used for one level of indentation.
1241 void wxStyledTextCtrl::SetIndent(int indentSize
)
1243 SendMsg(2122, indentSize
, 0);
1246 // Retrieve indentation size.
1247 int wxStyledTextCtrl::GetIndent() const
1249 return SendMsg(2123, 0, 0);
1252 // Indentation will only use space characters if useTabs is false, otherwise
1253 // it will use a combination of tabs and spaces.
1254 void wxStyledTextCtrl::SetUseTabs(bool useTabs
)
1256 SendMsg(2124, useTabs
, 0);
1259 // Retrieve whether tabs will be used in indentation.
1260 bool wxStyledTextCtrl::GetUseTabs() const
1262 return SendMsg(2125, 0, 0) != 0;
1265 // Change the indentation of a line to a number of columns.
1266 void wxStyledTextCtrl::SetLineIndentation(int line
, int indentSize
)
1268 SendMsg(2126, line
, indentSize
);
1271 // Retrieve the number of columns that a line is indented.
1272 int wxStyledTextCtrl::GetLineIndentation(int line
) const
1274 return SendMsg(2127, line
, 0);
1277 // Retrieve the position before the first non indentation character on a line.
1278 int wxStyledTextCtrl::GetLineIndentPosition(int line
) const
1280 return SendMsg(2128, line
, 0);
1283 // Retrieve the column number of a position, taking tab width into account.
1284 int wxStyledTextCtrl::GetColumn(int pos
) const
1286 return SendMsg(2129, pos
, 0);
1289 // Show or hide the horizontal scroll bar.
1290 void wxStyledTextCtrl::SetUseHorizontalScrollBar(bool show
)
1292 SendMsg(2130, show
, 0);
1295 // Is the horizontal scroll bar visible?
1296 bool wxStyledTextCtrl::GetUseHorizontalScrollBar() const
1298 return SendMsg(2131, 0, 0) != 0;
1301 // Show or hide indentation guides.
1302 void wxStyledTextCtrl::SetIndentationGuides(int indentView
)
1304 SendMsg(2132, indentView
, 0);
1307 // Are the indentation guides visible?
1308 int wxStyledTextCtrl::GetIndentationGuides() const
1310 return SendMsg(2133, 0, 0);
1313 // Set the highlighted indentation guide column.
1314 // 0 = no highlighted guide.
1315 void wxStyledTextCtrl::SetHighlightGuide(int column
)
1317 SendMsg(2134, column
, 0);
1320 // Get the highlighted indentation guide column.
1321 int wxStyledTextCtrl::GetHighlightGuide() const
1323 return SendMsg(2135, 0, 0);
1326 // Get the position after the last visible characters on a line.
1327 int wxStyledTextCtrl::GetLineEndPosition(int line
) const
1329 return SendMsg(2136, line
, 0);
1332 // Get the code page used to interpret the bytes of the document as characters.
1333 int wxStyledTextCtrl::GetCodePage() const
1335 return SendMsg(2137, 0, 0);
1338 // Get the foreground colour of the caret.
1339 wxColour
wxStyledTextCtrl::GetCaretForeground() const
1341 long c
= SendMsg(2138, 0, 0);
1342 return wxColourFromLong(c
);
1345 // In read-only mode?
1346 bool wxStyledTextCtrl::GetReadOnly() const
1348 return SendMsg(2140, 0, 0) != 0;
1351 // Sets the position of the caret.
1352 void wxStyledTextCtrl::SetCurrentPos(int pos
)
1354 SendMsg(2141, pos
, 0);
1357 // Sets the position that starts the selection - this becomes the anchor.
1358 void wxStyledTextCtrl::SetSelectionStart(int pos
)
1360 SendMsg(2142, pos
, 0);
1363 // Returns the position at the start of the selection.
1364 int wxStyledTextCtrl::GetSelectionStart() const
1366 return SendMsg(2143, 0, 0);
1369 // Sets the position that ends the selection - this becomes the currentPosition.
1370 void wxStyledTextCtrl::SetSelectionEnd(int pos
)
1372 SendMsg(2144, pos
, 0);
1375 // Returns the position at the end of the selection.
1376 int wxStyledTextCtrl::GetSelectionEnd() const
1378 return SendMsg(2145, 0, 0);
1381 // Sets the print magnification added to the point size of each style for printing.
1382 void wxStyledTextCtrl::SetPrintMagnification(int magnification
)
1384 SendMsg(2146, magnification
, 0);
1387 // Returns the print magnification.
1388 int wxStyledTextCtrl::GetPrintMagnification() const
1390 return SendMsg(2147, 0, 0);
1393 // Modify colours when printing for clearer printed text.
1394 void wxStyledTextCtrl::SetPrintColourMode(int mode
)
1396 SendMsg(2148, mode
, 0);
1399 // Returns the print colour mode.
1400 int wxStyledTextCtrl::GetPrintColourMode() const
1402 return SendMsg(2149, 0, 0);
1405 // Find some text in the document.
1406 int wxStyledTextCtrl::FindText(int minPos
, int maxPos
,
1407 const wxString
& text
,
1410 ft
.chrg
.cpMin
= minPos
;
1411 ft
.chrg
.cpMax
= maxPos
;
1412 const wxWX2MBbuf buf
= wx2stc(text
);
1413 ft
.lpstrText
= (char*)(const char*)buf
;
1415 return SendMsg(2150, flags
, (sptr_t
)&ft
);
1418 // On Windows, will draw the document into a display context such as a printer.
1419 int wxStyledTextCtrl::FormatRange(bool doDraw
,
1428 if (endPos
< startPos
) {
1429 int temp
= startPos
;
1434 fr
.hdcTarget
= target
;
1435 fr
.rc
.top
= renderRect
.GetTop();
1436 fr
.rc
.left
= renderRect
.GetLeft();
1437 fr
.rc
.right
= renderRect
.GetRight();
1438 fr
.rc
.bottom
= renderRect
.GetBottom();
1439 fr
.rcPage
.top
= pageRect
.GetTop();
1440 fr
.rcPage
.left
= pageRect
.GetLeft();
1441 fr
.rcPage
.right
= pageRect
.GetRight();
1442 fr
.rcPage
.bottom
= pageRect
.GetBottom();
1443 fr
.chrg
.cpMin
= startPos
;
1444 fr
.chrg
.cpMax
= endPos
;
1446 return SendMsg(2151, doDraw
, (sptr_t
)&fr
);
1449 // Retrieve the display line at the top of the display.
1450 int wxStyledTextCtrl::GetFirstVisibleLine() const
1452 return SendMsg(2152, 0, 0);
1455 // Retrieve the contents of a line.
1456 wxString
wxStyledTextCtrl::GetLine(int line
) const {
1457 int len
= LineLength(line
);
1458 if (!len
) return wxEmptyString
;
1460 wxMemoryBuffer
mbuf(len
+1);
1461 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1462 SendMsg(2153, line
, (sptr_t
)buf
);
1463 mbuf
.UngetWriteBuf(len
);
1468 // Returns the number of lines in the document. There is always at least one.
1469 int wxStyledTextCtrl::GetLineCount() const
1471 return SendMsg(2154, 0, 0);
1474 // Sets the size in pixels of the left margin.
1475 void wxStyledTextCtrl::SetMarginLeft(int pixelWidth
)
1477 SendMsg(2155, 0, pixelWidth
);
1480 // Returns the size in pixels of the left margin.
1481 int wxStyledTextCtrl::GetMarginLeft() const
1483 return SendMsg(2156, 0, 0);
1486 // Sets the size in pixels of the right margin.
1487 void wxStyledTextCtrl::SetMarginRight(int pixelWidth
)
1489 SendMsg(2157, 0, pixelWidth
);
1492 // Returns the size in pixels of the right margin.
1493 int wxStyledTextCtrl::GetMarginRight() const
1495 return SendMsg(2158, 0, 0);
1498 // Is the document different from when it was last saved?
1499 bool wxStyledTextCtrl::GetModify() const
1501 return SendMsg(2159, 0, 0) != 0;
1504 // Retrieve the selected text.
1505 wxString
wxStyledTextCtrl::GetSelectedText() {
1506 const int len
= SendMsg(SCI_GETSELTEXT
, 0, (sptr_t
)0);
1507 if (!len
) return wxEmptyString
;
1509 wxMemoryBuffer
mbuf(len
+2);
1510 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1511 SendMsg(2161, 0, (sptr_t
)buf
);
1512 mbuf
.UngetWriteBuf(len
);
1517 // Retrieve a range of text.
1518 wxString
wxStyledTextCtrl::GetTextRange(int startPos
, int endPos
) {
1519 if (endPos
< startPos
) {
1520 int temp
= startPos
;
1524 int len
= endPos
- startPos
;
1525 if (!len
) return wxEmptyString
;
1526 wxMemoryBuffer
mbuf(len
+1);
1527 char* buf
= (char*)mbuf
.GetWriteBuf(len
);
1530 tr
.chrg
.cpMin
= startPos
;
1531 tr
.chrg
.cpMax
= endPos
;
1532 SendMsg(2162, 0, (sptr_t
)&tr
);
1533 mbuf
.UngetWriteBuf(len
);
1538 // Draw the selection in normal style or with selection highlighted.
1539 void wxStyledTextCtrl::HideSelection(bool normal
)
1541 SendMsg(2163, normal
, 0);
1544 // Retrieve the line containing a position.
1545 int wxStyledTextCtrl::LineFromPosition(int pos
) const
1547 return SendMsg(2166, pos
, 0);
1550 // Retrieve the position at the start of a line.
1551 int wxStyledTextCtrl::PositionFromLine(int line
) const
1553 return SendMsg(2167, line
, 0);
1556 // Scroll horizontally and vertically.
1557 void wxStyledTextCtrl::LineScroll(int columns
, int lines
)
1559 SendMsg(2168, columns
, lines
);
1562 // Ensure the caret is visible.
1563 void wxStyledTextCtrl::EnsureCaretVisible()
1565 SendMsg(2169, 0, 0);
1568 // Replace the selected text with the argument text.
1569 void wxStyledTextCtrl::ReplaceSelection(const wxString
& text
)
1571 SendMsg(2170, 0, (sptr_t
)(const char*)wx2stc(text
));
1574 // Set to read only or read write.
1575 void wxStyledTextCtrl::SetReadOnly(bool readOnly
)
1577 SendMsg(2171, readOnly
, 0);
1580 // Will a paste succeed?
1581 bool wxStyledTextCtrl::CanPaste() const
1583 return SendMsg(2173, 0, 0) != 0;
1586 // Are there any undoable actions in the undo history?
1587 bool wxStyledTextCtrl::CanUndo() const
1589 return SendMsg(2174, 0, 0) != 0;
1592 // Delete the undo history.
1593 void wxStyledTextCtrl::EmptyUndoBuffer()
1595 SendMsg(2175, 0, 0);
1598 // Undo one action in the undo history.
1599 void wxStyledTextCtrl::Undo()
1601 SendMsg(2176, 0, 0);
1604 // Cut the selection to the clipboard.
1605 void wxStyledTextCtrl::Cut()
1607 SendMsg(2177, 0, 0);
1610 // Copy the selection to the clipboard.
1611 void wxStyledTextCtrl::Copy()
1613 SendMsg(2178, 0, 0);
1616 // Paste the contents of the clipboard into the document replacing the selection.
1617 void wxStyledTextCtrl::Paste()
1619 SendMsg(2179, 0, 0);
1622 // Clear the selection.
1623 void wxStyledTextCtrl::Clear()
1625 SendMsg(2180, 0, 0);
1628 // Replace the contents of the document with the argument text.
1629 void wxStyledTextCtrl::SetText(const wxString
& text
)
1631 SendMsg(2181, 0, (sptr_t
)(const char*)wx2stc(text
));
1634 // Retrieve all the text in the document.
1635 wxString
wxStyledTextCtrl::GetText() const {
1636 int len
= GetTextLength();
1637 wxMemoryBuffer
mbuf(len
+1); // leave room for the null...
1638 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1639 SendMsg(2182, len
+1, (sptr_t
)buf
);
1640 mbuf
.UngetWriteBuf(len
);
1645 // Retrieve the number of characters in the document.
1646 int wxStyledTextCtrl::GetTextLength() const
1648 return SendMsg(2183, 0, 0);
1651 // Set to overtype (true) or insert mode.
1652 void wxStyledTextCtrl::SetOvertype(bool overtype
)
1654 SendMsg(2186, overtype
, 0);
1657 // Returns true if overtype mode is active otherwise false is returned.
1658 bool wxStyledTextCtrl::GetOvertype() const
1660 return SendMsg(2187, 0, 0) != 0;
1663 // Set the width of the insert mode caret.
1664 void wxStyledTextCtrl::SetCaretWidth(int pixelWidth
)
1666 SendMsg(2188, pixelWidth
, 0);
1669 // Returns the width of the insert mode caret.
1670 int wxStyledTextCtrl::GetCaretWidth() const
1672 return SendMsg(2189, 0, 0);
1675 // Sets the position that starts the target which is used for updating the
1676 // document without affecting the scroll position.
1677 void wxStyledTextCtrl::SetTargetStart(int pos
)
1679 SendMsg(2190, pos
, 0);
1682 // Get the position that starts the target.
1683 int wxStyledTextCtrl::GetTargetStart() const
1685 return SendMsg(2191, 0, 0);
1688 // Sets the position that ends the target which is used for updating the
1689 // document without affecting the scroll position.
1690 void wxStyledTextCtrl::SetTargetEnd(int pos
)
1692 SendMsg(2192, pos
, 0);
1695 // Get the position that ends the target.
1696 int wxStyledTextCtrl::GetTargetEnd() const
1698 return SendMsg(2193, 0, 0);
1701 // Replace the target text with the argument text.
1702 // Text is counted so it can contain NULs.
1703 // Returns the length of the replacement text.
1705 int wxStyledTextCtrl::ReplaceTarget(const wxString
& text
) {
1706 const wxWX2MBbuf buf
= wx2stc(text
);
1707 return SendMsg(2194, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
1710 // Replace the target text with the argument text after \d processing.
1711 // Text is counted so it can contain NULs.
1712 // Looks for \d where d is between 1 and 9 and replaces these with the strings
1713 // matched in the last search operation which were surrounded by \( and \).
1714 // Returns the length of the replacement text including any change
1715 // caused by processing the \d patterns.
1717 int wxStyledTextCtrl::ReplaceTargetRE(const wxString
& text
) {
1718 const wxWX2MBbuf buf
= wx2stc(text
);
1719 return SendMsg(2195, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
1722 // Search for a counted string in the target and set the target to the found
1723 // range. Text is counted so it can contain NULs.
1724 // Returns length of range or -1 for failure in which case target is not moved.
1726 int wxStyledTextCtrl::SearchInTarget(const wxString
& text
) {
1727 const wxWX2MBbuf buf
= wx2stc(text
);
1728 return SendMsg(2197, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
1731 // Set the search flags used by SearchInTarget.
1732 void wxStyledTextCtrl::SetSearchFlags(int flags
)
1734 SendMsg(2198, flags
, 0);
1737 // Get the search flags used by SearchInTarget.
1738 int wxStyledTextCtrl::GetSearchFlags() const
1740 return SendMsg(2199, 0, 0);
1743 // Show a call tip containing a definition near position pos.
1744 void wxStyledTextCtrl::CallTipShow(int pos
, const wxString
& definition
)
1746 SendMsg(2200, pos
, (sptr_t
)(const char*)wx2stc(definition
));
1749 // Remove the call tip from the screen.
1750 void wxStyledTextCtrl::CallTipCancel()
1752 SendMsg(2201, 0, 0);
1755 // Is there an active call tip?
1756 bool wxStyledTextCtrl::CallTipActive()
1758 return SendMsg(2202, 0, 0) != 0;
1761 // Retrieve the position where the caret was before displaying the call tip.
1762 int wxStyledTextCtrl::CallTipPosAtStart()
1764 return SendMsg(2203, 0, 0);
1767 // Highlight a segment of the definition.
1768 void wxStyledTextCtrl::CallTipSetHighlight(int start
, int end
)
1770 SendMsg(2204, start
, end
);
1773 // Set the background colour for the call tip.
1774 void wxStyledTextCtrl::CallTipSetBackground(const wxColour
& back
)
1776 SendMsg(2205, wxColourAsLong(back
), 0);
1779 // Set the foreground colour for the call tip.
1780 void wxStyledTextCtrl::CallTipSetForeground(const wxColour
& fore
)
1782 SendMsg(2206, wxColourAsLong(fore
), 0);
1785 // Set the foreground colour for the highlighted part of the call tip.
1786 void wxStyledTextCtrl::CallTipSetForegroundHighlight(const wxColour
& fore
)
1788 SendMsg(2207, wxColourAsLong(fore
), 0);
1791 // Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
1792 void wxStyledTextCtrl::CallTipUseStyle(int tabSize
)
1794 SendMsg(2212, tabSize
, 0);
1797 // Find the display line of a document line taking hidden lines into account.
1798 int wxStyledTextCtrl::VisibleFromDocLine(int line
)
1800 return SendMsg(2220, line
, 0);
1803 // Find the document line of a display line taking hidden lines into account.
1804 int wxStyledTextCtrl::DocLineFromVisible(int lineDisplay
)
1806 return SendMsg(2221, lineDisplay
, 0);
1809 // The number of display lines needed to wrap a document line
1810 int wxStyledTextCtrl::WrapCount(int line
)
1812 return SendMsg(2235, line
, 0);
1815 // Set the fold level of a line.
1816 // This encodes an integer level along with flags indicating whether the
1817 // line is a header and whether it is effectively white space.
1818 void wxStyledTextCtrl::SetFoldLevel(int line
, int level
)
1820 SendMsg(2222, line
, level
);
1823 // Retrieve the fold level of a line.
1824 int wxStyledTextCtrl::GetFoldLevel(int line
) const
1826 return SendMsg(2223, line
, 0);
1829 // Find the last child line of a header line.
1830 int wxStyledTextCtrl::GetLastChild(int line
, int level
) const
1832 return SendMsg(2224, line
, level
);
1835 // Find the parent line of a child line.
1836 int wxStyledTextCtrl::GetFoldParent(int line
) const
1838 return SendMsg(2225, line
, 0);
1841 // Make a range of lines visible.
1842 void wxStyledTextCtrl::ShowLines(int lineStart
, int lineEnd
)
1844 SendMsg(2226, lineStart
, lineEnd
);
1847 // Make a range of lines invisible.
1848 void wxStyledTextCtrl::HideLines(int lineStart
, int lineEnd
)
1850 SendMsg(2227, lineStart
, lineEnd
);
1853 // Is a line visible?
1854 bool wxStyledTextCtrl::GetLineVisible(int line
) const
1856 return SendMsg(2228, line
, 0) != 0;
1859 // Show the children of a header line.
1860 void wxStyledTextCtrl::SetFoldExpanded(int line
, bool expanded
)
1862 SendMsg(2229, line
, expanded
);
1865 // Is a header line expanded?
1866 bool wxStyledTextCtrl::GetFoldExpanded(int line
) const
1868 return SendMsg(2230, line
, 0) != 0;
1871 // Switch a header line between expanded and contracted.
1872 void wxStyledTextCtrl::ToggleFold(int line
)
1874 SendMsg(2231, line
, 0);
1877 // Ensure a particular line is visible by expanding any header line hiding it.
1878 void wxStyledTextCtrl::EnsureVisible(int line
)
1880 SendMsg(2232, line
, 0);
1883 // Set some style options for folding.
1884 void wxStyledTextCtrl::SetFoldFlags(int flags
)
1886 SendMsg(2233, flags
, 0);
1889 // Ensure a particular line is visible by expanding any header line hiding it.
1890 // Use the currently set visibility policy to determine which range to display.
1891 void wxStyledTextCtrl::EnsureVisibleEnforcePolicy(int line
)
1893 SendMsg(2234, line
, 0);
1896 // Sets whether a tab pressed when caret is within indentation indents.
1897 void wxStyledTextCtrl::SetTabIndents(bool tabIndents
)
1899 SendMsg(2260, tabIndents
, 0);
1902 // Does a tab pressed when caret is within indentation indent?
1903 bool wxStyledTextCtrl::GetTabIndents() const
1905 return SendMsg(2261, 0, 0) != 0;
1908 // Sets whether a backspace pressed when caret is within indentation unindents.
1909 void wxStyledTextCtrl::SetBackSpaceUnIndents(bool bsUnIndents
)
1911 SendMsg(2262, bsUnIndents
, 0);
1914 // Does a backspace pressed when caret is within indentation unindent?
1915 bool wxStyledTextCtrl::GetBackSpaceUnIndents() const
1917 return SendMsg(2263, 0, 0) != 0;
1920 // Sets the time the mouse must sit still to generate a mouse dwell event.
1921 void wxStyledTextCtrl::SetMouseDwellTime(int periodMilliseconds
)
1923 SendMsg(2264, periodMilliseconds
, 0);
1926 // Retrieve the time the mouse must sit still to generate a mouse dwell event.
1927 int wxStyledTextCtrl::GetMouseDwellTime() const
1929 return SendMsg(2265, 0, 0);
1932 // Get position of start of word.
1933 int wxStyledTextCtrl::WordStartPosition(int pos
, bool onlyWordCharacters
)
1935 return SendMsg(2266, pos
, onlyWordCharacters
);
1938 // Get position of end of word.
1939 int wxStyledTextCtrl::WordEndPosition(int pos
, bool onlyWordCharacters
)
1941 return SendMsg(2267, pos
, onlyWordCharacters
);
1944 // Sets whether text is word wrapped.
1945 void wxStyledTextCtrl::SetWrapMode(int mode
)
1947 SendMsg(2268, mode
, 0);
1950 // Retrieve whether text is word wrapped.
1951 int wxStyledTextCtrl::GetWrapMode() const
1953 return SendMsg(2269, 0, 0);
1956 // Set the display mode of visual flags for wrapped lines.
1957 void wxStyledTextCtrl::SetWrapVisualFlags(int wrapVisualFlags
)
1959 SendMsg(2460, wrapVisualFlags
, 0);
1962 // Retrive the display mode of visual flags for wrapped lines.
1963 int wxStyledTextCtrl::GetWrapVisualFlags() const
1965 return SendMsg(2461, 0, 0);
1968 // Set the location of visual flags for wrapped lines.
1969 void wxStyledTextCtrl::SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation
)
1971 SendMsg(2462, wrapVisualFlagsLocation
, 0);
1974 // Retrive the location of visual flags for wrapped lines.
1975 int wxStyledTextCtrl::GetWrapVisualFlagsLocation() const
1977 return SendMsg(2463, 0, 0);
1980 // Set the start indent for wrapped lines.
1981 void wxStyledTextCtrl::SetWrapStartIndent(int indent
)
1983 SendMsg(2464, indent
, 0);
1986 // Retrive the start indent for wrapped lines.
1987 int wxStyledTextCtrl::GetWrapStartIndent() const
1989 return SendMsg(2465, 0, 0);
1992 // Sets how wrapped sublines are placed. Default is fixed.
1993 void wxStyledTextCtrl::SetWrapIndentMode(int mode
)
1995 SendMsg(2472, mode
, 0);
1998 // Retrieve how wrapped sublines are placed. Default is fixed.
1999 int wxStyledTextCtrl::GetWrapIndentMode() const
2001 return SendMsg(2473, 0, 0);
2004 // Sets the degree of caching of layout information.
2005 void wxStyledTextCtrl::SetLayoutCache(int mode
)
2007 SendMsg(2272, mode
, 0);
2010 // Retrieve the degree of caching of layout information.
2011 int wxStyledTextCtrl::GetLayoutCache() const
2013 return SendMsg(2273, 0, 0);
2016 // Sets the document width assumed for scrolling.
2017 void wxStyledTextCtrl::SetScrollWidth(int pixelWidth
)
2019 SendMsg(2274, pixelWidth
, 0);
2022 // Retrieve the document width assumed for scrolling.
2023 int wxStyledTextCtrl::GetScrollWidth() const
2025 return SendMsg(2275, 0, 0);
2028 // Sets whether the maximum width line displayed is used to set scroll width.
2029 void wxStyledTextCtrl::SetScrollWidthTracking(bool tracking
)
2031 SendMsg(2516, tracking
, 0);
2034 // Retrieve whether the scroll width tracks wide lines.
2035 bool wxStyledTextCtrl::GetScrollWidthTracking() const
2037 return SendMsg(2517, 0, 0) != 0;
2040 // Measure the pixel width of some text in a particular style.
2041 // NUL terminated text argument.
2042 // Does not handle tab or control characters.
2043 int wxStyledTextCtrl::TextWidth(int style
, const wxString
& text
)
2045 return SendMsg(2276, style
, (sptr_t
)(const char*)wx2stc(text
));
2048 // Sets the scroll range so that maximum scroll position has
2049 // the last line at the bottom of the view (default).
2050 // Setting this to false allows scrolling one page below the last line.
2051 void wxStyledTextCtrl::SetEndAtLastLine(bool endAtLastLine
)
2053 SendMsg(2277, endAtLastLine
, 0);
2056 // Retrieve whether the maximum scroll position has the last
2057 // line at the bottom of the view.
2058 bool wxStyledTextCtrl::GetEndAtLastLine() const
2060 return SendMsg(2278, 0, 0) != 0;
2063 // Retrieve the height of a particular line of text in pixels.
2064 int wxStyledTextCtrl::TextHeight(int line
)
2066 return SendMsg(2279, line
, 0);
2069 // Show or hide the vertical scroll bar.
2070 void wxStyledTextCtrl::SetUseVerticalScrollBar(bool show
)
2072 SendMsg(2280, show
, 0);
2075 // Is the vertical scroll bar visible?
2076 bool wxStyledTextCtrl::GetUseVerticalScrollBar() const
2078 return SendMsg(2281, 0, 0) != 0;
2081 // Append a string to the end of the document without changing the selection.
2082 void wxStyledTextCtrl::AppendText(const wxString
& text
) {
2083 const wxWX2MBbuf buf
= wx2stc(text
);
2084 SendMsg(2282, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
2087 // Is drawing done in two phases with backgrounds drawn before foregrounds?
2088 bool wxStyledTextCtrl::GetTwoPhaseDraw() const
2090 return SendMsg(2283, 0, 0) != 0;
2093 // In twoPhaseDraw mode, drawing is performed in two phases, first the background
2094 // and then the foreground. This avoids chopping off characters that overlap the next run.
2095 void wxStyledTextCtrl::SetTwoPhaseDraw(bool twoPhase
)
2097 SendMsg(2284, twoPhase
, 0);
2100 // Scroll so that a display line is at the top of the display.
2101 void wxStyledTextCtrl::SetFirstVisibleLine(int lineDisplay
)
2103 SendMsg(2613, lineDisplay
, 0);
2106 // Make the target range start and end be the same as the selection range start and end.
2107 void wxStyledTextCtrl::TargetFromSelection()
2109 SendMsg(2287, 0, 0);
2112 // Join the lines in the target.
2113 void wxStyledTextCtrl::LinesJoin()
2115 SendMsg(2288, 0, 0);
2118 // Split the lines in the target into lines that are less wide than pixelWidth
2120 void wxStyledTextCtrl::LinesSplit(int pixelWidth
)
2122 SendMsg(2289, pixelWidth
, 0);
2125 // Set the colours used as a chequerboard pattern in the fold margin
2126 void wxStyledTextCtrl::SetFoldMarginColour(bool useSetting
, const wxColour
& back
)
2128 SendMsg(2290, useSetting
, wxColourAsLong(back
));
2130 void wxStyledTextCtrl::SetFoldMarginHiColour(bool useSetting
, const wxColour
& fore
)
2132 SendMsg(2291, useSetting
, wxColourAsLong(fore
));
2135 // Move caret down one line.
2136 void wxStyledTextCtrl::LineDown()
2138 SendMsg(2300, 0, 0);
2141 // Move caret down one line extending selection to new caret position.
2142 void wxStyledTextCtrl::LineDownExtend()
2144 SendMsg(2301, 0, 0);
2147 // Move caret up one line.
2148 void wxStyledTextCtrl::LineUp()
2150 SendMsg(2302, 0, 0);
2153 // Move caret up one line extending selection to new caret position.
2154 void wxStyledTextCtrl::LineUpExtend()
2156 SendMsg(2303, 0, 0);
2159 // Move caret left one character.
2160 void wxStyledTextCtrl::CharLeft()
2162 SendMsg(2304, 0, 0);
2165 // Move caret left one character extending selection to new caret position.
2166 void wxStyledTextCtrl::CharLeftExtend()
2168 SendMsg(2305, 0, 0);
2171 // Move caret right one character.
2172 void wxStyledTextCtrl::CharRight()
2174 SendMsg(2306, 0, 0);
2177 // Move caret right one character extending selection to new caret position.
2178 void wxStyledTextCtrl::CharRightExtend()
2180 SendMsg(2307, 0, 0);
2183 // Move caret left one word.
2184 void wxStyledTextCtrl::WordLeft()
2186 SendMsg(2308, 0, 0);
2189 // Move caret left one word extending selection to new caret position.
2190 void wxStyledTextCtrl::WordLeftExtend()
2192 SendMsg(2309, 0, 0);
2195 // Move caret right one word.
2196 void wxStyledTextCtrl::WordRight()
2198 SendMsg(2310, 0, 0);
2201 // Move caret right one word extending selection to new caret position.
2202 void wxStyledTextCtrl::WordRightExtend()
2204 SendMsg(2311, 0, 0);
2207 // Move caret to first position on line.
2208 void wxStyledTextCtrl::Home()
2210 SendMsg(2312, 0, 0);
2213 // Move caret to first position on line extending selection to new caret position.
2214 void wxStyledTextCtrl::HomeExtend()
2216 SendMsg(2313, 0, 0);
2219 // Move caret to last position on line.
2220 void wxStyledTextCtrl::LineEnd()
2222 SendMsg(2314, 0, 0);
2225 // Move caret to last position on line extending selection to new caret position.
2226 void wxStyledTextCtrl::LineEndExtend()
2228 SendMsg(2315, 0, 0);
2231 // Move caret to first position in document.
2232 void wxStyledTextCtrl::DocumentStart()
2234 SendMsg(2316, 0, 0);
2237 // Move caret to first position in document extending selection to new caret position.
2238 void wxStyledTextCtrl::DocumentStartExtend()
2240 SendMsg(2317, 0, 0);
2243 // Move caret to last position in document.
2244 void wxStyledTextCtrl::DocumentEnd()
2246 SendMsg(2318, 0, 0);
2249 // Move caret to last position in document extending selection to new caret position.
2250 void wxStyledTextCtrl::DocumentEndExtend()
2252 SendMsg(2319, 0, 0);
2255 // Move caret one page up.
2256 void wxStyledTextCtrl::PageUp()
2258 SendMsg(2320, 0, 0);
2261 // Move caret one page up extending selection to new caret position.
2262 void wxStyledTextCtrl::PageUpExtend()
2264 SendMsg(2321, 0, 0);
2267 // Move caret one page down.
2268 void wxStyledTextCtrl::PageDown()
2270 SendMsg(2322, 0, 0);
2273 // Move caret one page down extending selection to new caret position.
2274 void wxStyledTextCtrl::PageDownExtend()
2276 SendMsg(2323, 0, 0);
2279 // Switch from insert to overtype mode or the reverse.
2280 void wxStyledTextCtrl::EditToggleOvertype()
2282 SendMsg(2324, 0, 0);
2285 // Cancel any modes such as call tip or auto-completion list display.
2286 void wxStyledTextCtrl::Cancel()
2288 SendMsg(2325, 0, 0);
2291 // Delete the selection or if no selection, the character before the caret.
2292 void wxStyledTextCtrl::DeleteBack()
2294 SendMsg(2326, 0, 0);
2297 // If selection is empty or all on one line replace the selection with a tab character.
2298 // If more than one line selected, indent the lines.
2299 void wxStyledTextCtrl::Tab()
2301 SendMsg(2327, 0, 0);
2304 // Dedent the selected lines.
2305 void wxStyledTextCtrl::BackTab()
2307 SendMsg(2328, 0, 0);
2310 // Insert a new line, may use a CRLF, CR or LF depending on EOL mode.
2311 void wxStyledTextCtrl::NewLine()
2313 SendMsg(2329, 0, 0);
2316 // Insert a Form Feed character.
2317 void wxStyledTextCtrl::FormFeed()
2319 SendMsg(2330, 0, 0);
2322 // Move caret to before first visible character on line.
2323 // If already there move to first character on line.
2324 void wxStyledTextCtrl::VCHome()
2326 SendMsg(2331, 0, 0);
2329 // Like VCHome but extending selection to new caret position.
2330 void wxStyledTextCtrl::VCHomeExtend()
2332 SendMsg(2332, 0, 0);
2335 // Magnify the displayed text by increasing the sizes by 1 point.
2336 void wxStyledTextCtrl::ZoomIn()
2338 SendMsg(2333, 0, 0);
2341 // Make the displayed text smaller by decreasing the sizes by 1 point.
2342 void wxStyledTextCtrl::ZoomOut()
2344 SendMsg(2334, 0, 0);
2347 // Delete the word to the left of the caret.
2348 void wxStyledTextCtrl::DelWordLeft()
2350 SendMsg(2335, 0, 0);
2353 // Delete the word to the right of the caret.
2354 void wxStyledTextCtrl::DelWordRight()
2356 SendMsg(2336, 0, 0);
2359 // Delete the word to the right of the caret, but not the trailing non-word characters.
2360 void wxStyledTextCtrl::DelWordRightEnd()
2362 SendMsg(2518, 0, 0);
2365 // Cut the line containing the caret.
2366 void wxStyledTextCtrl::LineCut()
2368 SendMsg(2337, 0, 0);
2371 // Delete the line containing the caret.
2372 void wxStyledTextCtrl::LineDelete()
2374 SendMsg(2338, 0, 0);
2377 // Switch the current line with the previous.
2378 void wxStyledTextCtrl::LineTranspose()
2380 SendMsg(2339, 0, 0);
2383 // Duplicate the current line.
2384 void wxStyledTextCtrl::LineDuplicate()
2386 SendMsg(2404, 0, 0);
2389 // Transform the selection to lower case.
2390 void wxStyledTextCtrl::LowerCase()
2392 SendMsg(2340, 0, 0);
2395 // Transform the selection to upper case.
2396 void wxStyledTextCtrl::UpperCase()
2398 SendMsg(2341, 0, 0);
2401 // Scroll the document down, keeping the caret visible.
2402 void wxStyledTextCtrl::LineScrollDown()
2404 SendMsg(2342, 0, 0);
2407 // Scroll the document up, keeping the caret visible.
2408 void wxStyledTextCtrl::LineScrollUp()
2410 SendMsg(2343, 0, 0);
2413 // Delete the selection or if no selection, the character before the caret.
2414 // Will not delete the character before at the start of a line.
2415 void wxStyledTextCtrl::DeleteBackNotLine()
2417 SendMsg(2344, 0, 0);
2420 // Move caret to first position on display line.
2421 void wxStyledTextCtrl::HomeDisplay()
2423 SendMsg(2345, 0, 0);
2426 // Move caret to first position on display line extending selection to
2427 // new caret position.
2428 void wxStyledTextCtrl::HomeDisplayExtend()
2430 SendMsg(2346, 0, 0);
2433 // Move caret to last position on display line.
2434 void wxStyledTextCtrl::LineEndDisplay()
2436 SendMsg(2347, 0, 0);
2439 // Move caret to last position on display line extending selection to new
2441 void wxStyledTextCtrl::LineEndDisplayExtend()
2443 SendMsg(2348, 0, 0);
2446 // These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)?
2447 // except they behave differently when word-wrap is enabled:
2448 // They go first to the start / end of the display line, like (Home|LineEnd)Display
2449 // The difference is that, the cursor is already at the point, it goes on to the start
2450 // or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
2451 void wxStyledTextCtrl::HomeWrap()
2453 SendMsg(2349, 0, 0);
2455 void wxStyledTextCtrl::HomeWrapExtend()
2457 SendMsg(2450, 0, 0);
2459 void wxStyledTextCtrl::LineEndWrap()
2461 SendMsg(2451, 0, 0);
2463 void wxStyledTextCtrl::LineEndWrapExtend()
2465 SendMsg(2452, 0, 0);
2467 void wxStyledTextCtrl::VCHomeWrap()
2469 SendMsg(2453, 0, 0);
2471 void wxStyledTextCtrl::VCHomeWrapExtend()
2473 SendMsg(2454, 0, 0);
2476 // Copy the line containing the caret.
2477 void wxStyledTextCtrl::LineCopy()
2479 SendMsg(2455, 0, 0);
2482 // Move the caret inside current view if it's not there already.
2483 void wxStyledTextCtrl::MoveCaretInsideView()
2485 SendMsg(2401, 0, 0);
2488 // How many characters are on a line, including end of line characters?
2489 int wxStyledTextCtrl::LineLength(int line
) const
2491 return SendMsg(2350, line
, 0);
2494 // Highlight the characters at two positions.
2495 void wxStyledTextCtrl::BraceHighlight(int pos1
, int pos2
)
2497 SendMsg(2351, pos1
, pos2
);
2500 // Highlight the character at a position indicating there is no matching brace.
2501 void wxStyledTextCtrl::BraceBadLight(int pos
)
2503 SendMsg(2352, pos
, 0);
2506 // Find the position of a matching brace or INVALID_POSITION if no match.
2507 int wxStyledTextCtrl::BraceMatch(int pos
)
2509 return SendMsg(2353, pos
, 0);
2512 // Are the end of line characters visible?
2513 bool wxStyledTextCtrl::GetViewEOL() const
2515 return SendMsg(2355, 0, 0) != 0;
2518 // Make the end of line characters visible or invisible.
2519 void wxStyledTextCtrl::SetViewEOL(bool visible
)
2521 SendMsg(2356, visible
, 0);
2524 // Retrieve a pointer to the document object.
2525 void* wxStyledTextCtrl::GetDocPointer() {
2526 return (void*)SendMsg(2357);
2529 // Change the document object used.
2530 void wxStyledTextCtrl::SetDocPointer(void* docPointer
) {
2531 SendMsg(2358, 0, (sptr_t
)docPointer
);
2534 // Set which document modification events are sent to the container.
2535 void wxStyledTextCtrl::SetModEventMask(int mask
)
2537 SendMsg(2359, mask
, 0);
2540 // Retrieve the column number which text should be kept within.
2541 int wxStyledTextCtrl::GetEdgeColumn() const
2543 return SendMsg(2360, 0, 0);
2546 // Set the column number of the edge.
2547 // If text goes past the edge then it is highlighted.
2548 void wxStyledTextCtrl::SetEdgeColumn(int column
)
2550 SendMsg(2361, column
, 0);
2553 // Retrieve the edge highlight mode.
2554 int wxStyledTextCtrl::GetEdgeMode() const
2556 return SendMsg(2362, 0, 0);
2559 // The edge may be displayed by a line (EDGE_LINE) or by highlighting text that
2560 // goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).
2561 void wxStyledTextCtrl::SetEdgeMode(int mode
)
2563 SendMsg(2363, mode
, 0);
2566 // Retrieve the colour used in edge indication.
2567 wxColour
wxStyledTextCtrl::GetEdgeColour() const
2569 long c
= SendMsg(2364, 0, 0);
2570 return wxColourFromLong(c
);
2573 // Change the colour used in edge indication.
2574 void wxStyledTextCtrl::SetEdgeColour(const wxColour
& edgeColour
)
2576 SendMsg(2365, wxColourAsLong(edgeColour
), 0);
2579 // Sets the current caret position to be the search anchor.
2580 void wxStyledTextCtrl::SearchAnchor()
2582 SendMsg(2366, 0, 0);
2585 // Find some text starting at the search anchor.
2586 // Does not ensure the selection is visible.
2587 int wxStyledTextCtrl::SearchNext(int flags
, const wxString
& text
)
2589 return SendMsg(2367, flags
, (sptr_t
)(const char*)wx2stc(text
));
2592 // Find some text starting at the search anchor and moving backwards.
2593 // Does not ensure the selection is visible.
2594 int wxStyledTextCtrl::SearchPrev(int flags
, const wxString
& text
)
2596 return SendMsg(2368, flags
, (sptr_t
)(const char*)wx2stc(text
));
2599 // Retrieves the number of lines completely visible.
2600 int wxStyledTextCtrl::LinesOnScreen() const
2602 return SendMsg(2370, 0, 0);
2605 // Set whether a pop up menu is displayed automatically when the user presses
2606 // the wrong mouse button.
2607 void wxStyledTextCtrl::UsePopUp(bool allowPopUp
)
2609 SendMsg(2371, allowPopUp
, 0);
2612 // Is the selection rectangular? The alternative is the more common stream selection.
2613 bool wxStyledTextCtrl::SelectionIsRectangle() const
2615 return SendMsg(2372, 0, 0) != 0;
2618 // Set the zoom level. This number of points is added to the size of all fonts.
2619 // It may be positive to magnify or negative to reduce.
2620 void wxStyledTextCtrl::SetZoom(int zoom
)
2622 SendMsg(2373, zoom
, 0);
2625 // Retrieve the zoom level.
2626 int wxStyledTextCtrl::GetZoom() const
2628 return SendMsg(2374, 0, 0);
2631 // Create a new document object.
2632 // Starts with reference count of 1 and not selected into editor.
2633 void* wxStyledTextCtrl::CreateDocument() {
2634 return (void*)SendMsg(2375);
2637 // Extend life of document.
2638 void wxStyledTextCtrl::AddRefDocument(void* docPointer
) {
2639 SendMsg(2376, 0, (sptr_t
)docPointer
);
2642 // Release a reference to the document, deleting document if it fades to black.
2643 void wxStyledTextCtrl::ReleaseDocument(void* docPointer
) {
2644 SendMsg(2377, 0, (sptr_t
)docPointer
);
2647 // Get which document modification events are sent to the container.
2648 int wxStyledTextCtrl::GetModEventMask() const
2650 return SendMsg(2378, 0, 0);
2653 // Change internal focus flag.
2654 void wxStyledTextCtrl::SetSTCFocus(bool focus
)
2656 SendMsg(2380, focus
, 0);
2659 // Get internal focus flag.
2660 bool wxStyledTextCtrl::GetSTCFocus() const
2662 return SendMsg(2381, 0, 0) != 0;
2665 // Change error status - 0 = OK.
2666 void wxStyledTextCtrl::SetStatus(int statusCode
)
2668 SendMsg(2382, statusCode
, 0);
2671 // Get error status.
2672 int wxStyledTextCtrl::GetStatus() const
2674 return SendMsg(2383, 0, 0);
2677 // Set whether the mouse is captured when its button is pressed.
2678 void wxStyledTextCtrl::SetMouseDownCaptures(bool captures
)
2680 SendMsg(2384, captures
, 0);
2683 // Get whether mouse gets captured.
2684 bool wxStyledTextCtrl::GetMouseDownCaptures() const
2686 return SendMsg(2385, 0, 0) != 0;
2689 // Sets the cursor to one of the SC_CURSOR* values.
2690 void wxStyledTextCtrl::SetSTCCursor(int cursorType
)
2692 SendMsg(2386, cursorType
, 0);
2696 int wxStyledTextCtrl::GetSTCCursor() const
2698 return SendMsg(2387, 0, 0);
2701 // Change the way control characters are displayed:
2702 // If symbol is < 32, keep the drawn way, else, use the given character.
2703 void wxStyledTextCtrl::SetControlCharSymbol(int symbol
)
2705 SendMsg(2388, symbol
, 0);
2708 // Get the way control characters are displayed.
2709 int wxStyledTextCtrl::GetControlCharSymbol() const
2711 return SendMsg(2389, 0, 0);
2714 // Move to the previous change in capitalisation.
2715 void wxStyledTextCtrl::WordPartLeft()
2717 SendMsg(2390, 0, 0);
2720 // Move to the previous change in capitalisation extending selection
2721 // to new caret position.
2722 void wxStyledTextCtrl::WordPartLeftExtend()
2724 SendMsg(2391, 0, 0);
2727 // Move to the change next in capitalisation.
2728 void wxStyledTextCtrl::WordPartRight()
2730 SendMsg(2392, 0, 0);
2733 // Move to the next change in capitalisation extending selection
2734 // to new caret position.
2735 void wxStyledTextCtrl::WordPartRightExtend()
2737 SendMsg(2393, 0, 0);
2740 // Set the way the display area is determined when a particular line
2741 // is to be moved to by Find, FindNext, GotoLine, etc.
2742 void wxStyledTextCtrl::SetVisiblePolicy(int visiblePolicy
, int visibleSlop
)
2744 SendMsg(2394, visiblePolicy
, visibleSlop
);
2747 // Delete back from the current position to the start of the line.
2748 void wxStyledTextCtrl::DelLineLeft()
2750 SendMsg(2395, 0, 0);
2753 // Delete forwards from the current position to the end of the line.
2754 void wxStyledTextCtrl::DelLineRight()
2756 SendMsg(2396, 0, 0);
2759 // Get and Set the xOffset (ie, horizonal scroll position).
2760 void wxStyledTextCtrl::SetXOffset(int newOffset
)
2762 SendMsg(2397, newOffset
, 0);
2764 int wxStyledTextCtrl::GetXOffset() const
2766 return SendMsg(2398, 0, 0);
2769 // Set the last x chosen value to be the caret x position.
2770 void wxStyledTextCtrl::ChooseCaretX()
2772 SendMsg(2399, 0, 0);
2775 // Set the way the caret is kept visible when going sideway.
2776 // The exclusion zone is given in pixels.
2777 void wxStyledTextCtrl::SetXCaretPolicy(int caretPolicy
, int caretSlop
)
2779 SendMsg(2402, caretPolicy
, caretSlop
);
2782 // Set the way the line the caret is on is kept visible.
2783 // The exclusion zone is given in lines.
2784 void wxStyledTextCtrl::SetYCaretPolicy(int caretPolicy
, int caretSlop
)
2786 SendMsg(2403, caretPolicy
, caretSlop
);
2789 // Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE).
2790 void wxStyledTextCtrl::SetPrintWrapMode(int mode
)
2792 SendMsg(2406, mode
, 0);
2795 // Is printing line wrapped?
2796 int wxStyledTextCtrl::GetPrintWrapMode() const
2798 return SendMsg(2407, 0, 0);
2801 // Set a fore colour for active hotspots.
2802 void wxStyledTextCtrl::SetHotspotActiveForeground(bool useSetting
, const wxColour
& fore
)
2804 SendMsg(2410, useSetting
, wxColourAsLong(fore
));
2807 // Get the fore colour for active hotspots.
2808 wxColour
wxStyledTextCtrl::GetHotspotActiveForeground() const
2810 long c
= SendMsg(2494, 0, 0);
2811 return wxColourFromLong(c
);
2814 // Set a back colour for active hotspots.
2815 void wxStyledTextCtrl::SetHotspotActiveBackground(bool useSetting
, const wxColour
& back
)
2817 SendMsg(2411, useSetting
, wxColourAsLong(back
));
2820 // Get the back colour for active hotspots.
2821 wxColour
wxStyledTextCtrl::GetHotspotActiveBackground() const
2823 long c
= SendMsg(2495, 0, 0);
2824 return wxColourFromLong(c
);
2827 // Enable / Disable underlining active hotspots.
2828 void wxStyledTextCtrl::SetHotspotActiveUnderline(bool underline
)
2830 SendMsg(2412, underline
, 0);
2833 // Get whether underlining for active hotspots.
2834 bool wxStyledTextCtrl::GetHotspotActiveUnderline() const
2836 return SendMsg(2496, 0, 0) != 0;
2839 // Limit hotspots to single line so hotspots on two lines don't merge.
2840 void wxStyledTextCtrl::SetHotspotSingleLine(bool singleLine
)
2842 SendMsg(2421, singleLine
, 0);
2845 // Get the HotspotSingleLine property
2846 bool wxStyledTextCtrl::GetHotspotSingleLine() const
2848 return SendMsg(2497, 0, 0) != 0;
2851 // Move caret between paragraphs (delimited by empty lines).
2852 void wxStyledTextCtrl::ParaDown()
2854 SendMsg(2413, 0, 0);
2856 void wxStyledTextCtrl::ParaDownExtend()
2858 SendMsg(2414, 0, 0);
2860 void wxStyledTextCtrl::ParaUp()
2862 SendMsg(2415, 0, 0);
2864 void wxStyledTextCtrl::ParaUpExtend()
2866 SendMsg(2416, 0, 0);
2869 // Given a valid document position, return the previous position taking code
2870 // page into account. Returns 0 if passed 0.
2871 int wxStyledTextCtrl::PositionBefore(int pos
)
2873 return SendMsg(2417, pos
, 0);
2876 // Given a valid document position, return the next position taking code
2877 // page into account. Maximum value returned is the last position in the document.
2878 int wxStyledTextCtrl::PositionAfter(int pos
)
2880 return SendMsg(2418, pos
, 0);
2883 // Copy a range of text to the clipboard. Positions are clipped into the document.
2884 void wxStyledTextCtrl::CopyRange(int start
, int end
)
2886 SendMsg(2419, start
, end
);
2889 // Copy argument text to the clipboard.
2890 void wxStyledTextCtrl::CopyText(int length
, const wxString
& text
)
2892 SendMsg(2420, length
, (sptr_t
)(const char*)wx2stc(text
));
2895 // Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE/SC_SEL_THIN) or
2896 // by lines (SC_SEL_LINES).
2897 void wxStyledTextCtrl::SetSelectionMode(int mode
)
2899 SendMsg(2422, mode
, 0);
2902 // Get the mode of the current selection.
2903 int wxStyledTextCtrl::GetSelectionMode() const
2905 return SendMsg(2423, 0, 0);
2908 // Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line).
2909 int wxStyledTextCtrl::GetLineSelStartPosition(int line
)
2911 return SendMsg(2424, line
, 0);
2914 // Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line).
2915 int wxStyledTextCtrl::GetLineSelEndPosition(int line
)
2917 return SendMsg(2425, line
, 0);
2920 // Move caret down one line, extending rectangular selection to new caret position.
2921 void wxStyledTextCtrl::LineDownRectExtend()
2923 SendMsg(2426, 0, 0);
2926 // Move caret up one line, extending rectangular selection to new caret position.
2927 void wxStyledTextCtrl::LineUpRectExtend()
2929 SendMsg(2427, 0, 0);
2932 // Move caret left one character, extending rectangular selection to new caret position.
2933 void wxStyledTextCtrl::CharLeftRectExtend()
2935 SendMsg(2428, 0, 0);
2938 // Move caret right one character, extending rectangular selection to new caret position.
2939 void wxStyledTextCtrl::CharRightRectExtend()
2941 SendMsg(2429, 0, 0);
2944 // Move caret to first position on line, extending rectangular selection to new caret position.
2945 void wxStyledTextCtrl::HomeRectExtend()
2947 SendMsg(2430, 0, 0);
2950 // Move caret to before first visible character on line.
2951 // If already there move to first character on line.
2952 // In either case, extend rectangular selection to new caret position.
2953 void wxStyledTextCtrl::VCHomeRectExtend()
2955 SendMsg(2431, 0, 0);
2958 // Move caret to last position on line, extending rectangular selection to new caret position.
2959 void wxStyledTextCtrl::LineEndRectExtend()
2961 SendMsg(2432, 0, 0);
2964 // Move caret one page up, extending rectangular selection to new caret position.
2965 void wxStyledTextCtrl::PageUpRectExtend()
2967 SendMsg(2433, 0, 0);
2970 // Move caret one page down, extending rectangular selection to new caret position.
2971 void wxStyledTextCtrl::PageDownRectExtend()
2973 SendMsg(2434, 0, 0);
2976 // Move caret to top of page, or one page up if already at top of page.
2977 void wxStyledTextCtrl::StutteredPageUp()
2979 SendMsg(2435, 0, 0);
2982 // Move caret to top of page, or one page up if already at top of page, extending selection to new caret position.
2983 void wxStyledTextCtrl::StutteredPageUpExtend()
2985 SendMsg(2436, 0, 0);
2988 // Move caret to bottom of page, or one page down if already at bottom of page.
2989 void wxStyledTextCtrl::StutteredPageDown()
2991 SendMsg(2437, 0, 0);
2994 // Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position.
2995 void wxStyledTextCtrl::StutteredPageDownExtend()
2997 SendMsg(2438, 0, 0);
3000 // Move caret left one word, position cursor at end of word.
3001 void wxStyledTextCtrl::WordLeftEnd()
3003 SendMsg(2439, 0, 0);
3006 // Move caret left one word, position cursor at end of word, extending selection to new caret position.
3007 void wxStyledTextCtrl::WordLeftEndExtend()
3009 SendMsg(2440, 0, 0);
3012 // Move caret right one word, position cursor at end of word.
3013 void wxStyledTextCtrl::WordRightEnd()
3015 SendMsg(2441, 0, 0);
3018 // Move caret right one word, position cursor at end of word, extending selection to new caret position.
3019 void wxStyledTextCtrl::WordRightEndExtend()
3021 SendMsg(2442, 0, 0);
3024 // Set the set of characters making up whitespace for when moving or selecting by word.
3025 // Should be called after SetWordChars.
3026 void wxStyledTextCtrl::SetWhitespaceChars(const wxString
& characters
)
3028 SendMsg(2443, 0, (sptr_t
)(const char*)wx2stc(characters
));
3031 // Reset the set of characters for whitespace and word characters to the defaults.
3032 void wxStyledTextCtrl::SetCharsDefault()
3034 SendMsg(2444, 0, 0);
3037 // Get currently selected item position in the auto-completion list
3038 int wxStyledTextCtrl::AutoCompGetCurrent()
3040 return SendMsg(2445, 0, 0);
3043 // Enlarge the document to a particular size of text bytes.
3044 void wxStyledTextCtrl::Allocate(int bytes
)
3046 SendMsg(2446, bytes
, 0);
3049 // Find the position of a column on a line taking into account tabs and
3050 // multi-byte characters. If beyond end of line, return line end position.
3051 int wxStyledTextCtrl::FindColumn(int line
, int column
)
3053 return SendMsg(2456, line
, column
);
3056 // Can the caret preferred x position only be changed by explicit movement commands?
3057 bool wxStyledTextCtrl::GetCaretSticky() const
3059 return SendMsg(2457, 0, 0) != 0;
3062 // Stop the caret preferred x position changing when the user types.
3063 void wxStyledTextCtrl::SetCaretSticky(bool useCaretStickyBehaviour
)
3065 SendMsg(2458, useCaretStickyBehaviour
, 0);
3068 // Switch between sticky and non-sticky: meant to be bound to a key.
3069 void wxStyledTextCtrl::ToggleCaretSticky()
3071 SendMsg(2459, 0, 0);
3074 // Enable/Disable convert-on-paste for line endings
3075 void wxStyledTextCtrl::SetPasteConvertEndings(bool convert
)
3077 SendMsg(2467, convert
, 0);
3080 // Get convert-on-paste setting
3081 bool wxStyledTextCtrl::GetPasteConvertEndings() const
3083 return SendMsg(2468, 0, 0) != 0;
3086 // Duplicate the selection. If selection empty duplicate the line containing the caret.
3087 void wxStyledTextCtrl::SelectionDuplicate()
3089 SendMsg(2469, 0, 0);
3092 // Set background alpha of the caret line.
3093 void wxStyledTextCtrl::SetCaretLineBackAlpha(int alpha
)
3095 SendMsg(2470, alpha
, 0);
3098 // Get the background alpha of the caret line.
3099 int wxStyledTextCtrl::GetCaretLineBackAlpha() const
3101 return SendMsg(2471, 0, 0);
3104 // Set the style of the caret to be drawn.
3105 void wxStyledTextCtrl::SetCaretStyle(int caretStyle
)
3107 SendMsg(2512, caretStyle
, 0);
3110 // Returns the current style of the caret.
3111 int wxStyledTextCtrl::GetCaretStyle() const
3113 return SendMsg(2513, 0, 0);
3116 // Set the indicator used for IndicatorFillRange and IndicatorClearRange
3117 void wxStyledTextCtrl::SetIndicatorCurrent(int indicator
)
3119 SendMsg(2500, indicator
, 0);
3122 // Get the current indicator
3123 int wxStyledTextCtrl::GetIndicatorCurrent() const
3125 return SendMsg(2501, 0, 0);
3128 // Set the value used for IndicatorFillRange
3129 void wxStyledTextCtrl::SetIndicatorValue(int value
)
3131 SendMsg(2502, value
, 0);
3134 // Get the current indicator vaue
3135 int wxStyledTextCtrl::GetIndicatorValue() const
3137 return SendMsg(2503, 0, 0);
3140 // Turn a indicator on over a range.
3141 void wxStyledTextCtrl::IndicatorFillRange(int position
, int fillLength
)
3143 SendMsg(2504, position
, fillLength
);
3146 // Turn a indicator off over a range.
3147 void wxStyledTextCtrl::IndicatorClearRange(int position
, int clearLength
)
3149 SendMsg(2505, position
, clearLength
);
3152 // Are any indicators present at position?
3153 int wxStyledTextCtrl::IndicatorAllOnFor(int position
)
3155 return SendMsg(2506, position
, 0);
3158 // What value does a particular indicator have at at a position?
3159 int wxStyledTextCtrl::IndicatorValueAt(int indicator
, int position
)
3161 return SendMsg(2507, indicator
, position
);
3164 // Where does a particular indicator start?
3165 int wxStyledTextCtrl::IndicatorStart(int indicator
, int position
)
3167 return SendMsg(2508, indicator
, position
);
3170 // Where does a particular indicator end?
3171 int wxStyledTextCtrl::IndicatorEnd(int indicator
, int position
)
3173 return SendMsg(2509, indicator
, position
);
3176 // Set number of entries in position cache
3177 void wxStyledTextCtrl::SetPositionCacheSize(int size
)
3179 SendMsg(2514, size
, 0);
3182 // How many entries are allocated to the position cache?
3183 int wxStyledTextCtrl::GetPositionCacheSize() const
3185 return SendMsg(2515, 0, 0);
3188 // Copy the selection, if selection empty copy the line with the caret
3189 void wxStyledTextCtrl::CopyAllowLine()
3191 SendMsg(2519, 0, 0);
3194 // Compact the document buffer and return a read-only pointer to the
3195 // characters in the document.
3196 const char* wxStyledTextCtrl::GetCharacterPointer() {
3197 return (const char*)SendMsg(2520, 0, 0);
3200 // Always interpret keyboard input as Unicode
3201 void wxStyledTextCtrl::SetKeysUnicode(bool keysUnicode
)
3203 SendMsg(2521, keysUnicode
, 0);
3206 // Are keys always interpreted as Unicode?
3207 bool wxStyledTextCtrl::GetKeysUnicode() const
3209 return SendMsg(2522, 0, 0) != 0;
3212 // Set the alpha fill colour of the given indicator.
3213 void wxStyledTextCtrl::IndicatorSetAlpha(int indicator
, int alpha
)
3215 SendMsg(2523, indicator
, alpha
);
3218 // Get the alpha fill colour of the given indicator.
3219 int wxStyledTextCtrl::IndicatorGetAlpha(int indicator
) const
3221 return SendMsg(2524, indicator
, 0);
3224 // Set extra ascent for each line
3225 void wxStyledTextCtrl::SetExtraAscent(int extraAscent
)
3227 SendMsg(2525, extraAscent
, 0);
3230 // Get extra ascent for each line
3231 int wxStyledTextCtrl::GetExtraAscent() const
3233 return SendMsg(2526, 0, 0);
3236 // Set extra descent for each line
3237 void wxStyledTextCtrl::SetExtraDescent(int extraDescent
)
3239 SendMsg(2527, extraDescent
, 0);
3242 // Get extra descent for each line
3243 int wxStyledTextCtrl::GetExtraDescent() const
3245 return SendMsg(2528, 0, 0);
3248 // Which symbol was defined for markerNumber with MarkerDefine
3249 int wxStyledTextCtrl::GetMarkerSymbolDefined(int markerNumber
)
3251 return SendMsg(2529, markerNumber
, 0);
3254 // Set the text in the text margin for a line
3255 void wxStyledTextCtrl::MarginSetText(int line
, const wxString
& text
)
3257 SendMsg(2530, line
, (sptr_t
)(const char*)wx2stc(text
));
3260 // Get the text in the text margin for a line
3261 wxString
wxStyledTextCtrl::MarginGetText(int line
) const {
3263 long len
= SendMsg(msg
, line
, 0);
3265 wxMemoryBuffer
mbuf(len
+1);
3266 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3267 SendMsg(msg
, line
, (sptr_t
)buf
);
3268 mbuf
.UngetWriteBuf(len
);
3273 // Set the style number for the text margin for a line
3274 void wxStyledTextCtrl::MarginSetStyle(int line
, int style
)
3276 SendMsg(2532, line
, style
);
3279 // Get the style number for the text margin for a line
3280 int wxStyledTextCtrl::MarginGetStyle(int line
) const
3282 return SendMsg(2533, line
, 0);
3285 // Set the style in the text margin for a line
3286 void wxStyledTextCtrl::MarginSetStyles(int line
, const wxString
& styles
)
3288 SendMsg(2534, line
, (sptr_t
)(const char*)wx2stc(styles
));
3291 // Get the styles in the text margin for a line
3292 wxString
wxStyledTextCtrl::MarginGetStyles(int line
) const {
3294 long len
= SendMsg(msg
, line
, 0);
3296 wxMemoryBuffer
mbuf(len
+1);
3297 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3298 SendMsg(msg
, line
, (sptr_t
)buf
);
3299 mbuf
.UngetWriteBuf(len
);
3304 // Clear the margin text on all lines
3305 void wxStyledTextCtrl::MarginTextClearAll()
3307 SendMsg(2536, 0, 0);
3310 // Get the start of the range of style numbers used for margin text
3311 void wxStyledTextCtrl::MarginSetStyleOffset(int style
)
3313 SendMsg(2537, style
, 0);
3316 // Get the start of the range of style numbers used for margin text
3317 int wxStyledTextCtrl::MarginGetStyleOffset() const
3319 return SendMsg(2538, 0, 0);
3322 // Set the annotation text for a line
3323 void wxStyledTextCtrl::AnnotationSetText(int line
, const wxString
& text
)
3325 SendMsg(2540, line
, (sptr_t
)(const char*)wx2stc(text
));
3328 // Get the annotation text for a line
3329 wxString
wxStyledTextCtrl::AnnotationGetText(int line
) const {
3331 long len
= SendMsg(msg
, line
, 0);
3333 wxMemoryBuffer
mbuf(len
+1);
3334 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3335 SendMsg(msg
, line
, (sptr_t
)buf
);
3336 mbuf
.UngetWriteBuf(len
);
3341 // Set the style number for the annotations for a line
3342 void wxStyledTextCtrl::AnnotationSetStyle(int line
, int style
)
3344 SendMsg(2542, line
, style
);
3347 // Get the style number for the annotations for a line
3348 int wxStyledTextCtrl::AnnotationGetStyle(int line
) const
3350 return SendMsg(2543, line
, 0);
3353 // Set the annotation styles for a line
3354 void wxStyledTextCtrl::AnnotationSetStyles(int line
, const wxString
& styles
)
3356 SendMsg(2544, line
, (sptr_t
)(const char*)wx2stc(styles
));
3359 // Get the annotation styles for a line
3360 wxString
wxStyledTextCtrl::AnnotationGetStyles(int line
) const {
3362 long len
= SendMsg(msg
, line
, 0);
3364 wxMemoryBuffer
mbuf(len
+1);
3365 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3366 SendMsg(msg
, line
, (sptr_t
)buf
);
3367 mbuf
.UngetWriteBuf(len
);
3372 // Get the number of annotation lines for a line
3373 int wxStyledTextCtrl::AnnotationGetLines(int line
) const
3375 return SendMsg(2546, line
, 0);
3378 // Clear the annotations from all lines
3379 void wxStyledTextCtrl::AnnotationClearAll()
3381 SendMsg(2547, 0, 0);
3384 // Set the visibility for the annotations for a view
3385 void wxStyledTextCtrl::AnnotationSetVisible(int visible
)
3387 SendMsg(2548, visible
, 0);
3390 // Get the visibility for the annotations for a view
3391 int wxStyledTextCtrl::AnnotationGetVisible() const
3393 return SendMsg(2549, 0, 0);
3396 // Get the start of the range of style numbers used for annotations
3397 void wxStyledTextCtrl::AnnotationSetStyleOffset(int style
)
3399 SendMsg(2550, style
, 0);
3402 // Get the start of the range of style numbers used for annotations
3403 int wxStyledTextCtrl::AnnotationGetStyleOffset() const
3405 return SendMsg(2551, 0, 0);
3408 // Add a container action to the undo stack
3409 void wxStyledTextCtrl::AddUndoAction(int token
, int flags
)
3411 SendMsg(2560, token
, flags
);
3414 // Find the position of a character from a point within the window.
3415 int wxStyledTextCtrl::CharPositionFromPoint(int x
, int y
)
3417 return SendMsg(2561, x
, y
);
3420 // Find the position of a character from a point within the window.
3421 // Return INVALID_POSITION if not close to text.
3422 int wxStyledTextCtrl::CharPositionFromPointClose(int x
, int y
)
3424 return SendMsg(2562, x
, y
);
3427 // Set whether multiple selections can be made
3428 void wxStyledTextCtrl::SetMultipleSelection(bool multipleSelection
)
3430 SendMsg(2563, multipleSelection
, 0);
3433 // Whether multiple selections can be made
3434 bool wxStyledTextCtrl::GetMultipleSelection() const
3436 return SendMsg(2564, 0, 0) != 0;
3439 // Set whether typing can be performed into multiple selections
3440 void wxStyledTextCtrl::SetAdditionalSelectionTyping(bool additionalSelectionTyping
)
3442 SendMsg(2565, additionalSelectionTyping
, 0);
3445 // Whether typing can be performed into multiple selections
3446 bool wxStyledTextCtrl::GetAdditionalSelectionTyping() const
3448 return SendMsg(2566, 0, 0) != 0;
3451 // Set whether additional carets will blink
3452 void wxStyledTextCtrl::SetAdditionalCaretsBlink(bool additionalCaretsBlink
)
3454 SendMsg(2567, additionalCaretsBlink
, 0);
3457 // Whether additional carets will blink
3458 bool wxStyledTextCtrl::GetAdditionalCaretsBlink() const
3460 return SendMsg(2568, 0, 0) != 0;
3463 // Set whether additional carets are visible
3464 void wxStyledTextCtrl::SetAdditionalCaretsVisible(bool additionalCaretsBlink
)
3466 SendMsg(2608, additionalCaretsBlink
, 0);
3469 // Whether additional carets are visible
3470 bool wxStyledTextCtrl::GetAdditionalCaretsVisible() const
3472 return SendMsg(2609, 0, 0) != 0;
3475 // How many selections are there?
3476 int wxStyledTextCtrl::GetSelections() const
3478 return SendMsg(2570, 0, 0);
3481 // Clear selections to a single empty stream selection
3482 void wxStyledTextCtrl::ClearSelections()
3484 SendMsg(2571, 0, 0);
3488 int wxStyledTextCtrl::AddSelection(int caret
, int anchor
)
3490 return SendMsg(2573, caret
, anchor
);
3493 // Set the main selection
3494 void wxStyledTextCtrl::SetMainSelection(int selection
)
3496 SendMsg(2574, selection
, 0);
3499 // Which selection is the main selection
3500 int wxStyledTextCtrl::GetMainSelection() const
3502 return SendMsg(2575, 0, 0);
3504 void wxStyledTextCtrl::SetSelectionNCaret(int selection
, int pos
)
3506 SendMsg(2576, selection
, pos
);
3508 int wxStyledTextCtrl::GetSelectionNCaret(int selection
) const
3510 return SendMsg(2577, selection
, 0);
3512 void wxStyledTextCtrl::SetSelectionNAnchor(int selection
, int posAnchor
)
3514 SendMsg(2578, selection
, posAnchor
);
3516 int wxStyledTextCtrl::GetSelectionNAnchor(int selection
) const
3518 return SendMsg(2579, selection
, 0);
3520 void wxStyledTextCtrl::SetSelectionNCaretVirtualSpace(int selection
, int space
)
3522 SendMsg(2580, selection
, space
);
3524 int wxStyledTextCtrl::GetSelectionNCaretVirtualSpace(int selection
) const
3526 return SendMsg(2581, selection
, 0);
3528 void wxStyledTextCtrl::SetSelectionNAnchorVirtualSpace(int selection
, int space
)
3530 SendMsg(2582, selection
, space
);
3532 int wxStyledTextCtrl::GetSelectionNAnchorVirtualSpace(int selection
) const
3534 return SendMsg(2583, selection
, 0);
3537 // Sets the position that starts the selection - this becomes the anchor.
3538 void wxStyledTextCtrl::SetSelectionNStart(int selection
, int pos
)
3540 SendMsg(2584, selection
, pos
);
3543 // Returns the position at the start of the selection.
3544 int wxStyledTextCtrl::GetSelectionNStart(int selection
) const
3546 return SendMsg(2585, selection
, 0);
3549 // Sets the position that ends the selection - this becomes the currentPosition.
3550 void wxStyledTextCtrl::SetSelectionNEnd(int selection
, int pos
)
3552 SendMsg(2586, selection
, pos
);
3555 // Returns the position at the end of the selection.
3556 int wxStyledTextCtrl::GetSelectionNEnd(int selection
) const
3558 return SendMsg(2587, selection
, 0);
3560 void wxStyledTextCtrl::SetRectangularSelectionCaret(int pos
)
3562 SendMsg(2588, pos
, 0);
3564 int wxStyledTextCtrl::GetRectangularSelectionCaret() const
3566 return SendMsg(2589, 0, 0);
3568 void wxStyledTextCtrl::SetRectangularSelectionAnchor(int posAnchor
)
3570 SendMsg(2590, posAnchor
, 0);
3572 int wxStyledTextCtrl::GetRectangularSelectionAnchor() const
3574 return SendMsg(2591, 0, 0);
3576 void wxStyledTextCtrl::SetRectangularSelectionCaretVirtualSpace(int space
)
3578 SendMsg(2592, space
, 0);
3580 int wxStyledTextCtrl::GetRectangularSelectionCaretVirtualSpace() const
3582 return SendMsg(2593, 0, 0);
3584 void wxStyledTextCtrl::SetRectangularSelectionAnchorVirtualSpace(int space
)
3586 SendMsg(2594, space
, 0);
3588 int wxStyledTextCtrl::GetRectangularSelectionAnchorVirtualSpace() const
3590 return SendMsg(2595, 0, 0);
3592 void wxStyledTextCtrl::SetVirtualSpaceOptions(int virtualSpaceOptions
)
3594 SendMsg(2596, virtualSpaceOptions
, 0);
3596 int wxStyledTextCtrl::GetVirtualSpaceOptions() const
3598 return SendMsg(2597, 0, 0);
3601 // On GTK+, allow selecting the modifier key to use for mouse-based
3602 // rectangular selection. Often the window manager requires Alt+Mouse Drag
3603 // for moving windows.
3604 // Valid values are SCMOD_CTRL(default), SCMOD_ALT, or SCMOD_SUPER.
3605 void wxStyledTextCtrl::SetRectangularSelectionModifier(int modifier
)
3607 SendMsg(2598, modifier
, 0);
3610 // Get the modifier key used for rectangular selection.
3611 int wxStyledTextCtrl::GetRectangularSelectionModifier() const
3613 return SendMsg(2599, 0, 0);
3616 // Set the foreground colour of additional selections.
3617 // Must have previously called SetSelFore with non-zero first argument for this to have an effect.
3618 void wxStyledTextCtrl::SetAdditionalSelForeground(const wxColour
& fore
)
3620 SendMsg(2600, wxColourAsLong(fore
), 0);
3623 // Set the background colour of additional selections.
3624 // Must have previously called SetSelBack with non-zero first argument for this to have an effect.
3625 void wxStyledTextCtrl::SetAdditionalSelBackground(const wxColour
& back
)
3627 SendMsg(2601, wxColourAsLong(back
), 0);
3630 // Set the alpha of the selection.
3631 void wxStyledTextCtrl::SetAdditionalSelAlpha(int alpha
)
3633 SendMsg(2602, alpha
, 0);
3636 // Get the alpha of the selection.
3637 int wxStyledTextCtrl::GetAdditionalSelAlpha() const
3639 return SendMsg(2603, 0, 0);
3642 // Set the foreground colour of additional carets.
3643 void wxStyledTextCtrl::SetAdditionalCaretForeground(const wxColour
& fore
)
3645 SendMsg(2604, wxColourAsLong(fore
), 0);
3648 // Get the foreground colour of additional carets.
3649 wxColour
wxStyledTextCtrl::GetAdditionalCaretForeground() const
3651 long c
= SendMsg(2605, 0, 0);
3652 return wxColourFromLong(c
);
3655 // Set the main selection to the next selection.
3656 void wxStyledTextCtrl::RotateSelection()
3658 SendMsg(2606, 0, 0);
3661 // Swap that caret and anchor of the main selection.
3662 void wxStyledTextCtrl::SwapMainAnchorCaret()
3664 SendMsg(2607, 0, 0);
3667 // Start notifying the container of all key presses and commands.
3668 void wxStyledTextCtrl::StartRecord()
3670 SendMsg(3001, 0, 0);
3673 // Stop notifying the container of all key presses and commands.
3674 void wxStyledTextCtrl::StopRecord()
3676 SendMsg(3002, 0, 0);
3679 // Set the lexing language of the document.
3680 void wxStyledTextCtrl::SetLexer(int lexer
)
3682 SendMsg(4001, lexer
, 0);
3685 // Retrieve the lexing language of the document.
3686 int wxStyledTextCtrl::GetLexer() const
3688 return SendMsg(4002, 0, 0);
3691 // Colourise a segment of the document using the current lexing language.
3692 void wxStyledTextCtrl::Colourise(int start
, int end
)
3694 SendMsg(4003, start
, end
);
3697 // Set up a value that may be used by a lexer for some optional feature.
3698 void wxStyledTextCtrl::SetProperty(const wxString
& key
, const wxString
& value
)
3700 SendMsg(4004, (sptr_t
)(const char*)wx2stc(key
), (sptr_t
)(const char*)wx2stc(value
));
3703 // Set up the key words used by the lexer.
3704 void wxStyledTextCtrl::SetKeyWords(int keywordSet
, const wxString
& keyWords
)
3706 SendMsg(4005, keywordSet
, (sptr_t
)(const char*)wx2stc(keyWords
));
3709 // Set the lexing language of the document based on string name.
3710 void wxStyledTextCtrl::SetLexerLanguage(const wxString
& language
)
3712 SendMsg(4006, 0, (sptr_t
)(const char*)wx2stc(language
));
3715 // Retrieve a 'property' value previously set with SetProperty.
3716 wxString
wxStyledTextCtrl::GetProperty(const wxString
& key
) {
3717 int len
= SendMsg(SCI_GETPROPERTY
, (sptr_t
)(const char*)wx2stc(key
), 0);
3718 if (!len
) return wxEmptyString
;
3720 wxMemoryBuffer
mbuf(len
+1);
3721 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3722 SendMsg(4008, (uptr_t
)(const char*)wx2stc(key
), (sptr_t
)buf
);
3723 mbuf
.UngetWriteBuf(len
);
3728 // Retrieve a 'property' value previously set with SetProperty,
3729 // with '$()' variable replacement on returned buffer.
3730 wxString
wxStyledTextCtrl::GetPropertyExpanded(const wxString
& key
) {
3731 int len
= SendMsg(SCI_GETPROPERTYEXPANDED
, (uptr_t
)(const char*)wx2stc(key
), 0);
3732 if (!len
) return wxEmptyString
;
3734 wxMemoryBuffer
mbuf(len
+1);
3735 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3736 SendMsg(4009, (uptr_t
)(const char*)wx2stc(key
), (sptr_t
)buf
);
3737 mbuf
.UngetWriteBuf(len
);
3742 // Retrieve a 'property' value previously set with SetProperty,
3743 // interpreted as an int AFTER any '$()' variable replacement.
3744 int wxStyledTextCtrl::GetPropertyInt(const wxString
& key
) const
3746 return SendMsg(4010, (sptr_t
)(const char*)wx2stc(key
), 0);
3749 // Retrieve the number of bits the current lexer needs for styling.
3750 int wxStyledTextCtrl::GetStyleBitsNeeded() const
3752 return SendMsg(4011, 0, 0);
3756 //----------------------------------------------------------------------
3759 // Returns the line number of the line with the caret.
3760 int wxStyledTextCtrl::GetCurrentLine() {
3761 int line
= LineFromPosition(GetCurrentPos());
3766 // Extract style settings from a spec-string which is composed of one or
3767 // more of the following comma separated elements:
3769 // bold turns on bold
3770 // italic turns on italics
3771 // fore:[name or #RRGGBB] sets the foreground colour
3772 // back:[name or #RRGGBB] sets the background colour
3773 // face:[facename] sets the font face name to use
3774 // size:[num] sets the font size in points
3775 // eol turns on eol filling
3776 // underline turns on underlining
3778 void wxStyledTextCtrl::StyleSetSpec(int styleNum
, const wxString
& spec
) {
3780 wxStringTokenizer
tkz(spec
, wxT(","));
3781 while (tkz
.HasMoreTokens()) {
3782 wxString token
= tkz
.GetNextToken();
3784 wxString option
= token
.BeforeFirst(':');
3785 wxString val
= token
.AfterFirst(':');
3787 if (option
== wxT("bold"))
3788 StyleSetBold(styleNum
, true);
3790 else if (option
== wxT("italic"))
3791 StyleSetItalic(styleNum
, true);
3793 else if (option
== wxT("underline"))
3794 StyleSetUnderline(styleNum
, true);
3796 else if (option
== wxT("eol"))
3797 StyleSetEOLFilled(styleNum
, true);
3799 else if (option
== wxT("size")) {
3801 if (val
.ToLong(&points
))
3802 StyleSetSize(styleNum
, points
);
3805 else if (option
== wxT("face"))
3806 StyleSetFaceName(styleNum
, val
);
3808 else if (option
== wxT("fore"))
3809 StyleSetForeground(styleNum
, wxColourFromSpec(val
));
3811 else if (option
== wxT("back"))
3812 StyleSetBackground(styleNum
, wxColourFromSpec(val
));
3817 // Get the font of a style
3818 wxFont
wxStyledTextCtrl::StyleGetFont(int style
) {
3820 font
.SetPointSize(StyleGetSize(style
));
3821 font
.SetFaceName(StyleGetFaceName(style
));
3822 if( StyleGetBold(style
) )
3823 font
.SetWeight(wxFONTWEIGHT_BOLD
);
3825 font
.SetWeight(wxFONTWEIGHT_NORMAL
);
3827 if( StyleGetItalic(style
) )
3828 font
.SetStyle(wxFONTSTYLE_ITALIC
);
3830 font
.SetStyle(wxFONTSTYLE_NORMAL
);
3836 // Set style size, face, bold, italic, and underline attributes from
3837 // a wxFont's attributes.
3838 void wxStyledTextCtrl::StyleSetFont(int styleNum
, wxFont
& font
) {
3840 // Ensure that the native font is initialized
3842 GetTextExtent(wxT("X"), &x
, &y
, NULL
, NULL
, &font
);
3844 int size
= font
.GetPointSize();
3845 wxString faceName
= font
.GetFaceName();
3846 bool bold
= font
.GetWeight() == wxBOLD
;
3847 bool italic
= font
.GetStyle() != wxNORMAL
;
3848 bool under
= font
.GetUnderlined();
3849 wxFontEncoding encoding
= font
.GetEncoding();
3851 StyleSetFontAttr(styleNum
, size
, faceName
, bold
, italic
, under
, encoding
);
3854 // Set all font style attributes at once.
3855 void wxStyledTextCtrl::StyleSetFontAttr(int styleNum
, int size
,
3856 const wxString
& faceName
,
3857 bool bold
, bool italic
,
3859 wxFontEncoding encoding
) {
3860 StyleSetSize(styleNum
, size
);
3861 StyleSetFaceName(styleNum
, faceName
);
3862 StyleSetBold(styleNum
, bold
);
3863 StyleSetItalic(styleNum
, italic
);
3864 StyleSetUnderline(styleNum
, underline
);
3865 StyleSetFontEncoding(styleNum
, encoding
);
3869 // Set the character set of the font in a style. Converts the Scintilla
3870 // character set values to a wxFontEncoding.
3871 void wxStyledTextCtrl::StyleSetCharacterSet(int style
, int characterSet
)
3873 wxFontEncoding encoding
;
3875 // Translate the Scintilla characterSet to a wxFontEncoding
3876 switch (characterSet
) {
3878 case wxSTC_CHARSET_ANSI
:
3879 case wxSTC_CHARSET_DEFAULT
:
3880 encoding
= wxFONTENCODING_DEFAULT
;
3883 case wxSTC_CHARSET_BALTIC
:
3884 encoding
= wxFONTENCODING_ISO8859_13
;
3887 case wxSTC_CHARSET_CHINESEBIG5
:
3888 encoding
= wxFONTENCODING_CP950
;
3891 case wxSTC_CHARSET_EASTEUROPE
:
3892 encoding
= wxFONTENCODING_ISO8859_2
;
3895 case wxSTC_CHARSET_GB2312
:
3896 encoding
= wxFONTENCODING_CP936
;
3899 case wxSTC_CHARSET_GREEK
:
3900 encoding
= wxFONTENCODING_ISO8859_7
;
3903 case wxSTC_CHARSET_HANGUL
:
3904 encoding
= wxFONTENCODING_CP949
;
3907 case wxSTC_CHARSET_MAC
:
3908 encoding
= wxFONTENCODING_DEFAULT
;
3911 case wxSTC_CHARSET_OEM
:
3912 encoding
= wxFONTENCODING_DEFAULT
;
3915 case wxSTC_CHARSET_RUSSIAN
:
3916 encoding
= wxFONTENCODING_KOI8
;
3919 case wxSTC_CHARSET_SHIFTJIS
:
3920 encoding
= wxFONTENCODING_CP932
;
3923 case wxSTC_CHARSET_SYMBOL
:
3924 encoding
= wxFONTENCODING_DEFAULT
;
3927 case wxSTC_CHARSET_TURKISH
:
3928 encoding
= wxFONTENCODING_ISO8859_9
;
3931 case wxSTC_CHARSET_JOHAB
:
3932 encoding
= wxFONTENCODING_DEFAULT
;
3935 case wxSTC_CHARSET_HEBREW
:
3936 encoding
= wxFONTENCODING_ISO8859_8
;
3939 case wxSTC_CHARSET_ARABIC
:
3940 encoding
= wxFONTENCODING_ISO8859_6
;
3943 case wxSTC_CHARSET_VIETNAMESE
:
3944 encoding
= wxFONTENCODING_DEFAULT
;
3947 case wxSTC_CHARSET_THAI
:
3948 encoding
= wxFONTENCODING_ISO8859_11
;
3951 case wxSTC_CHARSET_CYRILLIC
:
3952 encoding
= wxFONTENCODING_ISO8859_5
;
3955 case wxSTC_CHARSET_8859_15
:
3956 encoding
= wxFONTENCODING_ISO8859_15
;;
3960 // We just have Scintilla track the wxFontEncoding for us. It gets used
3961 // in Font::Create in PlatWX.cpp. We add one to the value so that the
3962 // effective wxFONENCODING_DEFAULT == SC_SHARSET_DEFAULT and so when
3963 // Scintilla internally uses SC_CHARSET_DEFAULT we will translate it back
3964 // to wxFONENCODING_DEFAULT in Font::Create.
3965 SendMsg(SCI_STYLESETCHARACTERSET
, style
, encoding
+1);
3969 // Set the font encoding to be used by a style.
3970 void wxStyledTextCtrl::StyleSetFontEncoding(int style
, wxFontEncoding encoding
)
3972 SendMsg(SCI_STYLESETCHARACTERSET
, style
, encoding
+1);
3976 // Perform one of the operations defined by the wxSTC_CMD_* constants.
3977 void wxStyledTextCtrl::CmdKeyExecute(int cmd
) {
3982 // Set the left and right margin in the edit area, measured in pixels.
3983 void wxStyledTextCtrl::SetMargins(int left
, int right
) {
3984 SetMarginLeft(left
);
3985 SetMarginRight(right
);
3989 // Retrieve the point in the window where a position is displayed.
3990 wxPoint
wxStyledTextCtrl::PointFromPosition(int pos
) {
3991 int x
= SendMsg(SCI_POINTXFROMPOSITION
, 0, pos
);
3992 int y
= SendMsg(SCI_POINTYFROMPOSITION
, 0, pos
);
3993 return wxPoint(x
, y
);
3996 // Scroll enough to make the given line visible
3997 void wxStyledTextCtrl::ScrollToLine(int line
) {
3998 m_swx
->DoScrollToLine(line
);
4002 // Scroll enough to make the given column visible
4003 void wxStyledTextCtrl::ScrollToColumn(int column
) {
4004 m_swx
->DoScrollToColumn(column
);
4009 bool wxStyledTextCtrl::DoSaveFile(const wxString
& filename
, int fileType
)
4011 bool ok
= wxTextAreaBase::DoSaveFile(filename
, fileType
);
4013 bool wxStyledTextCtrl::SaveFile(const wxString
& filename
)
4016 wxFFile
file(filename
, wxT("w"));
4017 bool ok
= file
.IsOpened() && file
.Write(GetValue(), *wxConvCurrent
);
4020 #endif // wxUSE_FFILE
4030 bool wxStyledTextCtrl::DoLoadFile(const wxString
& filename
, int fileType
)
4032 bool ok
= wxTextAreaBase::DoLoadFile(filename
, fileType
);
4034 bool wxStyledTextCtrl::LoadFile(const wxString
& filename
)
4037 wxFFile
file(filename
);
4038 bool ok
= file
.IsOpened();
4042 ok
= file
.ReadAll(&text
, *wxConvCurrent
);
4050 #endif // wxUSE_FFILE
4060 #if wxUSE_DRAG_AND_DROP
4061 wxDragResult
wxStyledTextCtrl::DoDragOver(wxCoord x
, wxCoord y
, wxDragResult def
) {
4062 return m_swx
->DoDragOver(x
, y
, def
);
4066 bool wxStyledTextCtrl::DoDropText(long x
, long y
, const wxString
& data
) {
4067 return m_swx
->DoDropText(x
, y
, data
);
4072 void wxStyledTextCtrl::SetUseAntiAliasing(bool useAA
) {
4073 m_swx
->SetUseAntiAliasing(useAA
);
4076 bool wxStyledTextCtrl::GetUseAntiAliasing() {
4077 return m_swx
->GetUseAntiAliasing();
4084 void wxStyledTextCtrl::AddTextRaw(const char* text
, int length
)
4087 length
= strlen(text
);
4088 SendMsg(SCI_ADDTEXT
, length
, (sptr_t
)text
);
4091 void wxStyledTextCtrl::InsertTextRaw(int pos
, const char* text
)
4093 SendMsg(SCI_INSERTTEXT
, pos
, (sptr_t
)text
);
4096 wxCharBuffer
wxStyledTextCtrl::GetCurLineRaw(int* linePos
)
4098 int len
= LineLength(GetCurrentLine());
4100 if (linePos
) *linePos
= 0;
4105 wxCharBuffer
buf(len
);
4106 int pos
= SendMsg(SCI_GETCURLINE
, len
, (sptr_t
)buf
.data());
4107 if (linePos
) *linePos
= pos
;
4111 wxCharBuffer
wxStyledTextCtrl::GetLineRaw(int line
)
4113 int len
= LineLength(line
);
4119 wxCharBuffer
buf(len
);
4120 SendMsg(SCI_GETLINE
, line
, (sptr_t
)buf
.data());
4124 wxCharBuffer
wxStyledTextCtrl::GetSelectedTextRaw()
4126 // Calculate the length needed first.
4127 const int len
= SendMsg(SCI_GETSELTEXT
, 0, (sptr_t
)0);
4129 // And then really get the data.
4130 wxCharBuffer
buf(len
);
4131 SendMsg(SCI_GETSELTEXT
, 0, (sptr_t
)buf
.data());
4135 wxCharBuffer
wxStyledTextCtrl::GetTextRangeRaw(int startPos
, int endPos
)
4137 if (endPos
< startPos
) {
4138 int temp
= startPos
;
4142 int len
= endPos
- startPos
;
4148 wxCharBuffer
buf(len
);
4150 tr
.lpstrText
= buf
.data();
4151 tr
.chrg
.cpMin
= startPos
;
4152 tr
.chrg
.cpMax
= endPos
;
4153 SendMsg(SCI_GETTEXTRANGE
, 0, (sptr_t
)&tr
);
4157 void wxStyledTextCtrl::SetTextRaw(const char* text
)
4159 SendMsg(SCI_SETTEXT
, 0, (sptr_t
)text
);
4162 wxCharBuffer
wxStyledTextCtrl::GetTextRaw()
4164 int len
= GetTextLength();
4165 wxCharBuffer
buf(len
); // adds 1 for NUL automatically
4166 SendMsg(SCI_GETTEXT
, len
+ 1, (sptr_t
)buf
.data());
4170 void wxStyledTextCtrl::AppendTextRaw(const char* text
, int length
)
4173 length
= strlen(text
);
4174 SendMsg(SCI_APPENDTEXT
, length
, (sptr_t
)text
);
4181 //----------------------------------------------------------------------
4184 void wxStyledTextCtrl::OnPaint(wxPaintEvent
& WXUNUSED(evt
)) {
4186 m_swx
->DoPaint(&dc
, GetUpdateRegion().GetBox());
4189 void wxStyledTextCtrl::OnScrollWin(wxScrollWinEvent
& evt
) {
4190 if (evt
.GetOrientation() == wxHORIZONTAL
)
4191 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
4193 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
4196 void wxStyledTextCtrl::OnScroll(wxScrollEvent
& evt
) {
4197 wxScrollBar
* sb
= wxDynamicCast(evt
.GetEventObject(), wxScrollBar
);
4199 if (sb
->IsVertical())
4200 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
4202 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
4206 void wxStyledTextCtrl::OnSize(wxSizeEvent
& WXUNUSED(evt
)) {
4208 wxSize sz
= GetClientSize();
4209 m_swx
->DoSize(sz
.x
, sz
.y
);
4213 void wxStyledTextCtrl::OnMouseLeftDown(wxMouseEvent
& evt
) {
4215 wxPoint pt
= evt
.GetPosition();
4216 m_swx
->DoLeftButtonDown(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
4217 evt
.ShiftDown(), evt
.ControlDown(), evt
.AltDown());
4220 void wxStyledTextCtrl::OnMouseMove(wxMouseEvent
& evt
) {
4221 wxPoint pt
= evt
.GetPosition();
4222 m_swx
->DoLeftButtonMove(Point(pt
.x
, pt
.y
));
4225 void wxStyledTextCtrl::OnMouseLeftUp(wxMouseEvent
& evt
) {
4226 wxPoint pt
= evt
.GetPosition();
4227 m_swx
->DoLeftButtonUp(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
4232 void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent
& evt
) {
4233 wxPoint pt
= evt
.GetPosition();
4234 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
4238 void wxStyledTextCtrl::OnMouseMiddleUp(wxMouseEvent
& evt
) {
4239 wxPoint pt
= evt
.GetPosition();
4240 m_swx
->DoMiddleButtonUp(Point(pt
.x
, pt
.y
));
4243 void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent
& evt
) {
4244 wxPoint pt
= evt
.GetPosition();
4245 ScreenToClient(&pt
.x
, &pt
.y
);
4247 Show context menu at event point if it's within the window,
4248 or at caret location if not
4250 wxHitTest ht
= this->HitTest(pt
);
4251 if (ht
!= wxHT_WINDOW_INSIDE
) {
4252 pt
= this->PointFromPosition(this->GetCurrentPos());
4254 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
4258 void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent
& evt
)
4260 m_swx
->DoMouseWheel(evt
.GetWheelRotation(),
4261 evt
.GetWheelDelta(),
4262 evt
.GetLinesPerAction(),
4264 evt
.IsPageScroll());
4268 void wxStyledTextCtrl::OnChar(wxKeyEvent
& evt
) {
4269 // On (some?) non-US PC keyboards the AltGr key is required to enter some
4270 // common characters. It comes to us as both Alt and Ctrl down so we need
4271 // to let the char through in that case, otherwise if only ctrl or only
4272 // alt let's skip it.
4273 bool ctrl
= evt
.ControlDown();
4275 // On the Mac the Alt key is just a modifier key (like Shift) so we need
4276 // to allow the char events to be processed when Alt is pressed.
4277 // TODO: Should we check MetaDown instead in this case?
4280 bool alt
= evt
.AltDown();
4282 bool skip
= ((ctrl
|| alt
) && ! (ctrl
&& alt
));
4285 // apparently if we don't do this, Unicode keys pressed after non-char
4286 // ASCII ones (e.g. Enter, Tab) are not taken into account (patch 1615989)
4287 if (m_lastKeyDownConsumed
&& evt
.GetUnicodeKey() > 255)
4288 m_lastKeyDownConsumed
= false;
4291 if (!m_lastKeyDownConsumed
&& !skip
) {
4293 int key
= evt
.GetUnicodeKey();
4296 // if the unicode key code is not really a unicode character (it may
4297 // be a function key or etc., the platforms appear to always give us a
4298 // small value in this case) then fallback to the ascii key code but
4299 // don't do anything for function keys or etc.
4301 key
= evt
.GetKeyCode();
4302 keyOk
= (key
<= 127);
4305 m_swx
->DoAddChar(key
);
4309 int key
= evt
.GetKeyCode();
4310 if (key
<= WXK_START
|| key
> WXK_COMMAND
) {
4311 m_swx
->DoAddChar(key
);
4321 void wxStyledTextCtrl::OnKeyDown(wxKeyEvent
& evt
) {
4322 int processed
= m_swx
->DoKeyDown(evt
, &m_lastKeyDownConsumed
);
4323 if (!processed
&& !m_lastKeyDownConsumed
)
4328 void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent
& evt
) {
4329 m_swx
->DoLoseFocus();
4334 void wxStyledTextCtrl::OnGainFocus(wxFocusEvent
& evt
) {
4335 m_swx
->DoGainFocus();
4340 void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent
& WXUNUSED(evt
)) {
4341 m_swx
->DoSysColourChange();
4345 void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent
& WXUNUSED(evt
)) {
4346 // do nothing to help avoid flashing
4351 void wxStyledTextCtrl::OnMenu(wxCommandEvent
& evt
) {
4352 m_swx
->DoCommand(evt
.GetId());
4356 void wxStyledTextCtrl::OnListBox(wxCommandEvent
& WXUNUSED(evt
)) {
4357 m_swx
->DoOnListBox();
4361 void wxStyledTextCtrl::OnIdle(wxIdleEvent
& evt
) {
4362 m_swx
->DoOnIdle(evt
);
4366 wxSize
wxStyledTextCtrl::DoGetBestSize() const
4368 // What would be the best size for a wxSTC?
4369 // Just give a reasonable minimum until something else can be figured out.
4370 return wxSize(200,100);
4374 //----------------------------------------------------------------------
4375 // Turn notifications from Scintilla into events
4378 void wxStyledTextCtrl::NotifyChange() {
4379 wxStyledTextEvent
evt(wxEVT_STC_CHANGE
, GetId());
4380 evt
.SetEventObject(this);
4381 GetEventHandler()->ProcessEvent(evt
);
4385 static void SetEventText(wxStyledTextEvent
& evt
, const char* text
,
4389 evt
.SetText(stc2wx(text
, length
));
4393 void wxStyledTextCtrl::NotifyParent(SCNotification
* _scn
) {
4394 SCNotification
& scn
= *_scn
;
4395 wxStyledTextEvent
evt(0, GetId());
4397 evt
.SetEventObject(this);
4398 evt
.SetPosition(scn
.position
);
4400 evt
.SetModifiers(scn
.modifiers
);
4402 switch (scn
.nmhdr
.code
) {
4403 case SCN_STYLENEEDED
:
4404 evt
.SetEventType(wxEVT_STC_STYLENEEDED
);
4408 evt
.SetEventType(wxEVT_STC_CHARADDED
);
4411 case SCN_SAVEPOINTREACHED
:
4412 evt
.SetEventType(wxEVT_STC_SAVEPOINTREACHED
);
4415 case SCN_SAVEPOINTLEFT
:
4416 evt
.SetEventType(wxEVT_STC_SAVEPOINTLEFT
);
4419 case SCN_MODIFYATTEMPTRO
:
4420 evt
.SetEventType(wxEVT_STC_ROMODIFYATTEMPT
);
4424 evt
.SetEventType(wxEVT_STC_KEY
);
4427 case SCN_DOUBLECLICK
:
4428 evt
.SetEventType(wxEVT_STC_DOUBLECLICK
);
4432 evt
.SetEventType(wxEVT_STC_UPDATEUI
);
4436 evt
.SetEventType(wxEVT_STC_MODIFIED
);
4437 evt
.SetModificationType(scn
.modificationType
);
4438 SetEventText(evt
, scn
.text
, scn
.length
);
4439 evt
.SetLength(scn
.length
);
4440 evt
.SetLinesAdded(scn
.linesAdded
);
4441 evt
.SetLine(scn
.line
);
4442 evt
.SetFoldLevelNow(scn
.foldLevelNow
);
4443 evt
.SetFoldLevelPrev(scn
.foldLevelPrev
);
4446 case SCN_MACRORECORD
:
4447 evt
.SetEventType(wxEVT_STC_MACRORECORD
);
4448 evt
.SetMessage(scn
.message
);
4449 evt
.SetWParam(scn
.wParam
);
4450 evt
.SetLParam(scn
.lParam
);
4453 case SCN_MARGINCLICK
:
4454 evt
.SetEventType(wxEVT_STC_MARGINCLICK
);
4455 evt
.SetMargin(scn
.margin
);
4459 evt
.SetEventType(wxEVT_STC_NEEDSHOWN
);
4460 evt
.SetLength(scn
.length
);
4464 evt
.SetEventType(wxEVT_STC_PAINTED
);
4467 case SCN_AUTOCSELECTION
:
4468 evt
.SetEventType(wxEVT_STC_AUTOCOMP_SELECTION
);
4469 evt
.SetListType(scn
.listType
);
4470 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
4471 evt
.SetPosition(scn
.lParam
);
4474 case SCN_USERLISTSELECTION
:
4475 evt
.SetEventType(wxEVT_STC_USERLISTSELECTION
);
4476 evt
.SetListType(scn
.listType
);
4477 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
4478 evt
.SetPosition(scn
.lParam
);
4481 case SCN_URIDROPPED
:
4482 evt
.SetEventType(wxEVT_STC_URIDROPPED
);
4483 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
4486 case SCN_DWELLSTART
:
4487 evt
.SetEventType(wxEVT_STC_DWELLSTART
);
4493 evt
.SetEventType(wxEVT_STC_DWELLEND
);
4499 evt
.SetEventType(wxEVT_STC_ZOOM
);
4502 case SCN_HOTSPOTCLICK
:
4503 evt
.SetEventType(wxEVT_STC_HOTSPOT_CLICK
);
4506 case SCN_HOTSPOTDOUBLECLICK
:
4507 evt
.SetEventType(wxEVT_STC_HOTSPOT_DCLICK
);
4510 case SCN_CALLTIPCLICK
:
4511 evt
.SetEventType(wxEVT_STC_CALLTIP_CLICK
);
4514 case SCN_INDICATORCLICK
:
4515 evt
.SetEventType(wxEVT_STC_INDICATOR_CLICK
);
4518 case SCN_INDICATORRELEASE
:
4519 evt
.SetEventType(wxEVT_STC_INDICATOR_RELEASE
);
4522 case SCN_AUTOCCANCELLED
:
4523 evt
.SetEventType(wxEVT_STC_AUTOCOMP_CANCELLED
);
4526 case SCN_AUTOCCHARDELETED
:
4527 evt
.SetEventType(wxEVT_STC_AUTOCOMP_CHAR_DELETED
);
4534 GetEventHandler()->ProcessEvent(evt
);
4538 //----------------------------------------------------------------------
4539 //----------------------------------------------------------------------
4540 //----------------------------------------------------------------------
4542 wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType
, int id
)
4543 : wxCommandEvent(commandType
, id
)
4548 m_modificationType
= 0;
4553 m_foldLevelPrev
= 0;
4561 #if wxUSE_DRAG_AND_DROP
4562 m_dragFlags
= wxDrag_CopyOnly
;
4563 m_dragResult
= wxDragNone
;
4567 bool wxStyledTextEvent::GetShift() const { return (m_modifiers
& SCI_SHIFT
) != 0; }
4568 bool wxStyledTextEvent::GetControl() const { return (m_modifiers
& SCI_CTRL
) != 0; }
4569 bool wxStyledTextEvent::GetAlt() const { return (m_modifiers
& SCI_ALT
) != 0; }
4572 wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent
& event
):
4573 wxCommandEvent(event
)
4575 m_position
= event
.m_position
;
4576 m_key
= event
.m_key
;
4577 m_modifiers
= event
.m_modifiers
;
4578 m_modificationType
= event
.m_modificationType
;
4579 m_text
= event
.m_text
;
4580 m_length
= event
.m_length
;
4581 m_linesAdded
= event
.m_linesAdded
;
4582 m_line
= event
.m_line
;
4583 m_foldLevelNow
= event
.m_foldLevelNow
;
4584 m_foldLevelPrev
= event
.m_foldLevelPrev
;
4586 m_margin
= event
.m_margin
;
4588 m_message
= event
.m_message
;
4589 m_wParam
= event
.m_wParam
;
4590 m_lParam
= event
.m_lParam
;
4592 m_listType
= event
.m_listType
;
4596 #if wxUSE_DRAG_AND_DROP
4597 m_dragText
= event
.m_dragText
;
4598 m_dragFlags
= event
.m_dragFlags
;
4599 m_dragResult
= event
.m_dragResult
;
4603 //----------------------------------------------------------------------
4604 //----------------------------------------------------------------------
4606 /*static*/ wxVersionInfo
wxStyledTextCtrl::GetLibraryVersionInfo()
4608 return wxVersionInfo("Scintilla", 2, 3, 0, "Scintilla 2.03");