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"
57 #include "wx/dcbuffer.h"
60 #include "ScintillaWX.h"
62 //----------------------------------------------------------------------
64 const char wxSTCNameStr
[] = "stcwindow";
70 #define MAKELONG(a, b) ((a) | ((b) << 16))
73 static long wxColourAsLong(const wxColour
& co
) {
74 return (((long)co
.Blue() << 16) |
75 ((long)co
.Green() << 8) |
79 static wxColour
wxColourFromLong(long c
) {
81 clr
.Set((unsigned char)(c
& 0xff),
82 (unsigned char)((c
>> 8) & 0xff),
83 (unsigned char)((c
>> 16) & 0xff));
88 static wxColour
wxColourFromSpec(const wxString
& spec
) {
89 // spec should be a colour name or "#RRGGBB"
90 if (spec
.GetChar(0) == wxT('#')) {
92 long red
, green
, blue
;
93 red
= green
= blue
= 0;
94 spec
.Mid(1,2).ToLong(&red
, 16);
95 spec
.Mid(3,2).ToLong(&green
, 16);
96 spec
.Mid(5,2).ToLong(&blue
, 16);
97 return wxColour((unsigned char)red
,
102 return wxColour(spec
);
105 //----------------------------------------------------------------------
107 wxDEFINE_EVENT( wxEVT_STC_CHANGE
, wxStyledTextEvent
);
108 wxDEFINE_EVENT( wxEVT_STC_STYLENEEDED
, wxStyledTextEvent
);
109 wxDEFINE_EVENT( wxEVT_STC_CHARADDED
, wxStyledTextEvent
);
110 wxDEFINE_EVENT( wxEVT_STC_SAVEPOINTREACHED
, wxStyledTextEvent
);
111 wxDEFINE_EVENT( wxEVT_STC_SAVEPOINTLEFT
, wxStyledTextEvent
);
112 wxDEFINE_EVENT( wxEVT_STC_ROMODIFYATTEMPT
, wxStyledTextEvent
);
113 wxDEFINE_EVENT( wxEVT_STC_KEY
, wxStyledTextEvent
);
114 wxDEFINE_EVENT( wxEVT_STC_DOUBLECLICK
, wxStyledTextEvent
);
115 wxDEFINE_EVENT( wxEVT_STC_UPDATEUI
, wxStyledTextEvent
);
116 wxDEFINE_EVENT( wxEVT_STC_MODIFIED
, wxStyledTextEvent
);
117 wxDEFINE_EVENT( wxEVT_STC_MACRORECORD
, wxStyledTextEvent
);
118 wxDEFINE_EVENT( wxEVT_STC_MARGINCLICK
, wxStyledTextEvent
);
119 wxDEFINE_EVENT( wxEVT_STC_NEEDSHOWN
, wxStyledTextEvent
);
120 wxDEFINE_EVENT( wxEVT_STC_PAINTED
, wxStyledTextEvent
);
121 wxDEFINE_EVENT( wxEVT_STC_USERLISTSELECTION
, wxStyledTextEvent
);
122 wxDEFINE_EVENT( wxEVT_STC_URIDROPPED
, wxStyledTextEvent
);
123 wxDEFINE_EVENT( wxEVT_STC_DWELLSTART
, wxStyledTextEvent
);
124 wxDEFINE_EVENT( wxEVT_STC_DWELLEND
, wxStyledTextEvent
);
125 wxDEFINE_EVENT( wxEVT_STC_START_DRAG
, wxStyledTextEvent
);
126 wxDEFINE_EVENT( wxEVT_STC_DRAG_OVER
, wxStyledTextEvent
);
127 wxDEFINE_EVENT( wxEVT_STC_DO_DROP
, wxStyledTextEvent
);
128 wxDEFINE_EVENT( wxEVT_STC_ZOOM
, wxStyledTextEvent
);
129 wxDEFINE_EVENT( wxEVT_STC_HOTSPOT_CLICK
, wxStyledTextEvent
);
130 wxDEFINE_EVENT( wxEVT_STC_HOTSPOT_DCLICK
, wxStyledTextEvent
);
131 wxDEFINE_EVENT( wxEVT_STC_CALLTIP_CLICK
, wxStyledTextEvent
);
132 wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_SELECTION
, wxStyledTextEvent
);
133 wxDEFINE_EVENT( wxEVT_STC_INDICATOR_CLICK
, wxStyledTextEvent
);
134 wxDEFINE_EVENT( wxEVT_STC_INDICATOR_RELEASE
, wxStyledTextEvent
);
135 wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_CANCELLED
, wxStyledTextEvent
);
136 wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_CHAR_DELETED
, wxStyledTextEvent
);
137 wxDEFINE_EVENT( wxEVT_STC_HOTSPOT_RELEASE_CLICK
, wxStyledTextEvent
);
141 BEGIN_EVENT_TABLE(wxStyledTextCtrl
, wxControl
)
142 EVT_PAINT (wxStyledTextCtrl::OnPaint
)
143 EVT_SCROLLWIN (wxStyledTextCtrl::OnScrollWin
)
144 EVT_SCROLL (wxStyledTextCtrl::OnScroll
)
145 EVT_SIZE (wxStyledTextCtrl::OnSize
)
146 EVT_LEFT_DOWN (wxStyledTextCtrl::OnMouseLeftDown
)
147 // Let Scintilla see the double click as a second click
148 EVT_LEFT_DCLICK (wxStyledTextCtrl::OnMouseLeftDown
)
149 EVT_MOTION (wxStyledTextCtrl::OnMouseMove
)
150 EVT_LEFT_UP (wxStyledTextCtrl::OnMouseLeftUp
)
151 #if defined(__WXGTK__) || defined(__WXMAC__)
152 EVT_RIGHT_UP (wxStyledTextCtrl::OnMouseRightUp
)
154 EVT_CONTEXT_MENU (wxStyledTextCtrl::OnContextMenu
)
156 EVT_MOUSEWHEEL (wxStyledTextCtrl::OnMouseWheel
)
157 EVT_MIDDLE_UP (wxStyledTextCtrl::OnMouseMiddleUp
)
158 EVT_CHAR (wxStyledTextCtrl::OnChar
)
159 EVT_KEY_DOWN (wxStyledTextCtrl::OnKeyDown
)
160 EVT_KILL_FOCUS (wxStyledTextCtrl::OnLoseFocus
)
161 EVT_SET_FOCUS (wxStyledTextCtrl::OnGainFocus
)
162 EVT_SYS_COLOUR_CHANGED (wxStyledTextCtrl::OnSysColourChanged
)
163 EVT_ERASE_BACKGROUND (wxStyledTextCtrl::OnEraseBackground
)
164 EVT_MENU_RANGE (10, 16, wxStyledTextCtrl::OnMenu
)
165 EVT_LISTBOX_DCLICK (wxID_ANY
, wxStyledTextCtrl::OnListBox
)
169 IMPLEMENT_CLASS(wxStyledTextCtrl
, wxControl
)
170 IMPLEMENT_DYNAMIC_CLASS(wxStyledTextEvent
, wxCommandEvent
)
173 // forces the linking of the lexer modules
174 int Scintilla_LinkLexers();
177 //----------------------------------------------------------------------
178 // Constructor and Destructor
180 wxStyledTextCtrl::wxStyledTextCtrl(wxWindow
*parent
,
185 const wxString
& name
)
188 Create(parent
, id
, pos
, size
, style
, name
);
192 bool wxStyledTextCtrl::Create(wxWindow
*parent
,
197 const wxString
& name
)
199 style
|= wxVSCROLL
| wxHSCROLL
;
200 if (!wxControl::Create(parent
, id
, pos
, size
,
201 style
| wxWANTS_CHARS
| wxCLIP_CHILDREN
,
202 wxDefaultValidator
, name
))
206 Scintilla_LinkLexers();
208 m_swx
= new ScintillaWX(this);
210 m_lastKeyDownConsumed
= false;
214 // Put Scintilla into unicode (UTF-8) mode
215 SetCodePage(wxSTC_CP_UTF8
);
218 SetInitialSize(size
);
220 // Reduces flicker on GTK+/X11
221 SetBackgroundStyle(wxBG_STYLE_PAINT
);
223 // Make sure it can take the focus
230 wxStyledTextCtrl::~wxStyledTextCtrl() {
235 //----------------------------------------------------------------------
237 wxIntPtr
wxStyledTextCtrl::SendMsg(int msg
, wxUIntPtr wp
, wxIntPtr lp
) const
239 return m_swx
->WndProc(msg
, wp
, lp
);
242 //----------------------------------------------------------------------
244 // Set the vertical scrollbar to use instead of the ont that's built-in.
245 void wxStyledTextCtrl::SetVScrollBar(wxScrollBar
* bar
) {
248 // ensure that the built-in scrollbar is not visible
249 SetScrollbar(wxVERTICAL
, 0, 0, 0);
254 // Set the horizontal scrollbar to use instead of the ont that's built-in.
255 void wxStyledTextCtrl::SetHScrollBar(wxScrollBar
* bar
) {
258 // ensure that the built-in scrollbar is not visible
259 SetScrollbar(wxHORIZONTAL
, 0, 0, 0);
263 //----------------------------------------------------------------------
264 // Generated methods implementation section {{{
267 // Add text to the document at current position.
268 void wxStyledTextCtrl::AddText(const wxString
& text
) {
269 const wxWX2MBbuf buf
= wx2stc(text
);
270 SendMsg(2001, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
273 // Add array of cells to document.
274 void wxStyledTextCtrl::AddStyledText(const wxMemoryBuffer
& data
) {
275 SendMsg(2002, data
.GetDataLen(), (sptr_t
)data
.GetData());
278 // Insert string at a position.
279 void wxStyledTextCtrl::InsertText(int pos
, const wxString
& text
)
281 SendMsg(2003, pos
, (sptr_t
)(const char*)wx2stc(text
));
284 // Delete all text in the document.
285 void wxStyledTextCtrl::ClearAll()
290 // Delete a range of text in the document.
291 void wxStyledTextCtrl::DeleteRange(int pos
, int deleteLength
)
293 SendMsg(2645, pos
, deleteLength
);
296 // Set all style bytes to 0, remove all folding information.
297 void wxStyledTextCtrl::ClearDocumentStyle()
302 // Returns the number of bytes in the document.
303 int wxStyledTextCtrl::GetLength() const
305 return SendMsg(2006, 0, 0);
308 // Returns the character byte at the position.
309 int wxStyledTextCtrl::GetCharAt(int pos
) const {
310 return (unsigned char)SendMsg(2007, pos
, 0);
313 // Returns the position of the caret.
314 int wxStyledTextCtrl::GetCurrentPos() const
316 return SendMsg(2008, 0, 0);
319 // Returns the position of the opposite end of the selection to the caret.
320 int wxStyledTextCtrl::GetAnchor() const
322 return SendMsg(2009, 0, 0);
325 // Returns the style byte at the position.
326 int wxStyledTextCtrl::GetStyleAt(int pos
) const {
327 return (unsigned char)SendMsg(2010, pos
, 0);
330 // Redoes the next action on the undo history.
331 void wxStyledTextCtrl::Redo()
336 // Choose between collecting actions into the undo
337 // history and discarding them.
338 void wxStyledTextCtrl::SetUndoCollection(bool collectUndo
)
340 SendMsg(2012, collectUndo
, 0);
343 // Select all the text in the document.
344 void wxStyledTextCtrl::SelectAll()
349 // Remember the current position in the undo history as the position
350 // at which the document was saved.
351 void wxStyledTextCtrl::SetSavePoint()
356 // Retrieve a buffer of cells.
357 wxMemoryBuffer
wxStyledTextCtrl::GetStyledText(int startPos
, int endPos
) {
359 if (endPos
< startPos
) {
364 int len
= endPos
- startPos
;
365 if (!len
) return buf
;
367 tr
.lpstrText
= (char*)buf
.GetWriteBuf(len
*2+1);
368 tr
.chrg
.cpMin
= startPos
;
369 tr
.chrg
.cpMax
= endPos
;
370 len
= SendMsg(2015, 0, (sptr_t
)&tr
);
371 buf
.UngetWriteBuf(len
);
375 // Are there any redoable actions in the undo history?
376 bool wxStyledTextCtrl::CanRedo() const
378 return SendMsg(2016, 0, 0) != 0;
381 // Retrieve the line number at which a particular marker is located.
382 int wxStyledTextCtrl::MarkerLineFromHandle(int handle
)
384 return SendMsg(2017, handle
, 0);
388 void wxStyledTextCtrl::MarkerDeleteHandle(int handle
)
390 SendMsg(2018, handle
, 0);
393 // Is undo history being collected?
394 bool wxStyledTextCtrl::GetUndoCollection() const
396 return SendMsg(2019, 0, 0) != 0;
399 // Are white space characters currently visible?
400 // Returns one of SCWS_* constants.
401 int wxStyledTextCtrl::GetViewWhiteSpace() const
403 return SendMsg(2020, 0, 0);
406 // Make white space characters invisible, always visible or visible outside indentation.
407 void wxStyledTextCtrl::SetViewWhiteSpace(int viewWS
)
409 SendMsg(2021, viewWS
, 0);
412 // Find the position from a point within the window.
413 int wxStyledTextCtrl::PositionFromPoint(wxPoint pt
) const {
414 return SendMsg(2022, pt
.x
, pt
.y
);
417 // Find the position from a point within the window but return
418 // INVALID_POSITION if not close to text.
419 int wxStyledTextCtrl::PositionFromPointClose(int x
, int y
)
421 return SendMsg(2023, x
, y
);
424 // Set caret to start of a line and ensure it is visible.
425 void wxStyledTextCtrl::GotoLine(int line
)
427 SendMsg(2024, line
, 0);
430 // Set caret to a position and ensure it is visible.
431 void wxStyledTextCtrl::GotoPos(int pos
)
433 SendMsg(2025, pos
, 0);
436 // Set the selection anchor to a position. The anchor is the opposite
437 // end of the selection from the caret.
438 void wxStyledTextCtrl::SetAnchor(int posAnchor
)
440 SendMsg(2026, posAnchor
, 0);
443 // Retrieve the text of the line containing the caret.
444 // Returns the index of the caret on the line.
445 wxString
wxStyledTextCtrl::GetCurLine(int* linePos
) {
446 int len
= LineLength(GetCurrentLine());
448 if (linePos
) *linePos
= 0;
449 return wxEmptyString
;
452 wxMemoryBuffer
mbuf(len
+1);
453 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
455 int pos
= SendMsg(2027, len
+1, (sptr_t
)buf
);
456 mbuf
.UngetWriteBuf(len
);
458 if (linePos
) *linePos
= pos
;
462 // Retrieve the position of the last correctly styled character.
463 int wxStyledTextCtrl::GetEndStyled() const
465 return SendMsg(2028, 0, 0);
468 // Convert all line endings in the document to one mode.
469 void wxStyledTextCtrl::ConvertEOLs(int eolMode
)
471 SendMsg(2029, eolMode
, 0);
474 // Retrieve the current end of line mode - one of CRLF, CR, or LF.
475 int wxStyledTextCtrl::GetEOLMode() const
477 return SendMsg(2030, 0, 0);
480 // Set the current end of line mode.
481 void wxStyledTextCtrl::SetEOLMode(int eolMode
)
483 SendMsg(2031, eolMode
, 0);
486 // Set the current styling position to pos and the styling mask to mask.
487 // The styling mask can be used to protect some bits in each styling byte from modification.
488 void wxStyledTextCtrl::StartStyling(int pos
, int mask
)
490 SendMsg(2032, pos
, mask
);
493 // Change style from current styling position for length characters to a style
494 // and move the current styling position to after this newly styled segment.
495 void wxStyledTextCtrl::SetStyling(int length
, int style
)
497 SendMsg(2033, length
, style
);
500 // Is drawing done first into a buffer or direct to the screen?
501 bool wxStyledTextCtrl::GetBufferedDraw() const
503 return SendMsg(2034, 0, 0) != 0;
506 // If drawing is buffered then each line of text is drawn into a bitmap buffer
507 // before drawing it to the screen to avoid flicker.
508 void wxStyledTextCtrl::SetBufferedDraw(bool buffered
)
510 SendMsg(2035, buffered
, 0);
513 // Change the visible size of a tab to be a multiple of the width of a space character.
514 void wxStyledTextCtrl::SetTabWidth(int tabWidth
)
516 SendMsg(2036, tabWidth
, 0);
519 // Retrieve the visible size of a tab.
520 int wxStyledTextCtrl::GetTabWidth() const
522 return SendMsg(2121, 0, 0);
525 // Set the code page used to interpret the bytes of the document as characters.
526 void wxStyledTextCtrl::SetCodePage(int codePage
) {
528 wxASSERT_MSG(codePage
== wxSTC_CP_UTF8
,
529 wxT("Only wxSTC_CP_UTF8 may be used when wxUSE_UNICODE is on."));
531 wxASSERT_MSG(codePage
!= wxSTC_CP_UTF8
,
532 wxT("wxSTC_CP_UTF8 may not be used when wxUSE_UNICODE is off."));
534 SendMsg(2037, codePage
);
537 // Set the symbol used for a particular marker number,
538 // and optionally the fore and background colours.
539 void wxStyledTextCtrl::MarkerDefine(int markerNumber
, int markerSymbol
,
540 const wxColour
& foreground
,
541 const wxColour
& background
) {
543 SendMsg(2040, markerNumber
, markerSymbol
);
544 if (foreground
.IsOk())
545 MarkerSetForeground(markerNumber
, foreground
);
546 if (background
.IsOk())
547 MarkerSetBackground(markerNumber
, background
);
550 // Set the foreground colour used for a particular marker number.
551 void wxStyledTextCtrl::MarkerSetForeground(int markerNumber
, const wxColour
& fore
)
553 SendMsg(2041, markerNumber
, wxColourAsLong(fore
));
556 // Set the background colour used for a particular marker number.
557 void wxStyledTextCtrl::MarkerSetBackground(int markerNumber
, const wxColour
& back
)
559 SendMsg(2042, markerNumber
, wxColourAsLong(back
));
562 // Set the background colour used for a particular marker number when its folding block is selected.
563 void wxStyledTextCtrl::MarkerSetBackgroundSelected(int markerNumber
, const wxColour
& back
)
565 SendMsg(2292, markerNumber
, wxColourAsLong(back
));
568 // Enable/disable highlight for current folding bloc (smallest one that contains the caret)
569 void wxStyledTextCtrl::MarkerEnableHighlight(bool enabled
)
571 SendMsg(2293, enabled
, 0);
574 // Add a marker to a line, returning an ID which can be used to find or delete the marker.
575 int wxStyledTextCtrl::MarkerAdd(int line
, int markerNumber
)
577 return SendMsg(2043, line
, markerNumber
);
580 // Delete a marker from a line.
581 void wxStyledTextCtrl::MarkerDelete(int line
, int markerNumber
)
583 SendMsg(2044, line
, markerNumber
);
586 // Delete all markers with a particular number from all lines.
587 void wxStyledTextCtrl::MarkerDeleteAll(int markerNumber
)
589 SendMsg(2045, markerNumber
, 0);
592 // Get a bit mask of all the markers set on a line.
593 int wxStyledTextCtrl::MarkerGet(int line
)
595 return SendMsg(2046, line
, 0);
598 // Find the next line at or after lineStart that includes a marker in mask.
599 // Return -1 when no more lines.
600 int wxStyledTextCtrl::MarkerNext(int lineStart
, int markerMask
)
602 return SendMsg(2047, lineStart
, markerMask
);
605 // Find the previous line before lineStart that includes a marker in mask.
606 int wxStyledTextCtrl::MarkerPrevious(int lineStart
, int markerMask
)
608 return SendMsg(2048, lineStart
, markerMask
);
611 // Define a marker from a bitmap
612 void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber
, const wxBitmap
& bmp
) {
613 // convert bmp to a xpm in a string
614 wxMemoryOutputStream strm
;
615 wxImage img
= bmp
.ConvertToImage();
617 img
.ConvertAlphaToMask();
618 img
.SaveFile(strm
, wxBITMAP_TYPE_XPM
);
619 size_t len
= strm
.GetSize();
620 char* buff
= new char[len
+1];
621 strm
.CopyTo(buff
, len
);
623 SendMsg(2049, markerNumber
, (sptr_t
)buff
);
628 // Add a set of markers to a line.
629 void wxStyledTextCtrl::MarkerAddSet(int line
, int set
)
631 SendMsg(2466, line
, set
);
634 // Set the alpha used for a marker that is drawn in the text area, not the margin.
635 void wxStyledTextCtrl::MarkerSetAlpha(int markerNumber
, int alpha
)
637 SendMsg(2476, markerNumber
, alpha
);
640 // Set a margin to be either numeric or symbolic.
641 void wxStyledTextCtrl::SetMarginType(int margin
, int marginType
)
643 SendMsg(2240, margin
, marginType
);
646 // Retrieve the type of a margin.
647 int wxStyledTextCtrl::GetMarginType(int margin
) const
649 return SendMsg(2241, margin
, 0);
652 // Set the width of a margin to a width expressed in pixels.
653 void wxStyledTextCtrl::SetMarginWidth(int margin
, int pixelWidth
)
655 SendMsg(2242, margin
, pixelWidth
);
658 // Retrieve the width of a margin in pixels.
659 int wxStyledTextCtrl::GetMarginWidth(int margin
) const
661 return SendMsg(2243, margin
, 0);
664 // Set a mask that determines which markers are displayed in a margin.
665 void wxStyledTextCtrl::SetMarginMask(int margin
, int mask
)
667 SendMsg(2244, margin
, mask
);
670 // Retrieve the marker mask of a margin.
671 int wxStyledTextCtrl::GetMarginMask(int margin
) const
673 return SendMsg(2245, margin
, 0);
676 // Make a margin sensitive or insensitive to mouse clicks.
677 void wxStyledTextCtrl::SetMarginSensitive(int margin
, bool sensitive
)
679 SendMsg(2246, margin
, sensitive
);
682 // Retrieve the mouse click sensitivity of a margin.
683 bool wxStyledTextCtrl::GetMarginSensitive(int margin
) const
685 return SendMsg(2247, margin
, 0) != 0;
688 // Set the cursor shown when the mouse is inside a margin.
689 void wxStyledTextCtrl::SetMarginCursor(int margin
, int cursor
)
691 SendMsg(2248, margin
, cursor
);
694 // Retrieve the cursor shown in a margin.
695 int wxStyledTextCtrl::GetMarginCursor(int margin
) const
697 return SendMsg(2249, margin
, 0);
700 // Clear all the styles and make equivalent to the global default style.
701 void wxStyledTextCtrl::StyleClearAll()
706 // Set the foreground colour of a style.
707 void wxStyledTextCtrl::StyleSetForeground(int style
, const wxColour
& fore
)
709 SendMsg(2051, style
, wxColourAsLong(fore
));
712 // Set the background colour of a style.
713 void wxStyledTextCtrl::StyleSetBackground(int style
, const wxColour
& back
)
715 SendMsg(2052, style
, wxColourAsLong(back
));
718 // Set a style to be bold or not.
719 void wxStyledTextCtrl::StyleSetBold(int style
, bool bold
)
721 SendMsg(2053, style
, bold
);
724 // Set a style to be italic or not.
725 void wxStyledTextCtrl::StyleSetItalic(int style
, bool italic
)
727 SendMsg(2054, style
, italic
);
730 // Set the size of characters of a style.
731 void wxStyledTextCtrl::StyleSetSize(int style
, int sizePoints
)
733 SendMsg(2055, style
, sizePoints
);
736 // Set the font of a style.
737 void wxStyledTextCtrl::StyleSetFaceName(int style
, const wxString
& fontName
)
739 SendMsg(2056, style
, (sptr_t
)(const char*)wx2stc(fontName
));
742 // Set a style to have its end of line filled or not.
743 void wxStyledTextCtrl::StyleSetEOLFilled(int style
, bool filled
)
745 SendMsg(2057, style
, filled
);
748 // Reset the default style to its state at startup
749 void wxStyledTextCtrl::StyleResetDefault()
754 // Set a style to be underlined or not.
755 void wxStyledTextCtrl::StyleSetUnderline(int style
, bool underline
)
757 SendMsg(2059, style
, underline
);
760 // Get the foreground colour of a style.
761 wxColour
wxStyledTextCtrl::StyleGetForeground(int style
) const
763 long c
= SendMsg(2481, style
, 0);
764 return wxColourFromLong(c
);
767 // Get the background colour of a style.
768 wxColour
wxStyledTextCtrl::StyleGetBackground(int style
) const
770 long c
= SendMsg(2482, style
, 0);
771 return wxColourFromLong(c
);
774 // Get is a style bold or not.
775 bool wxStyledTextCtrl::StyleGetBold(int style
) const
777 return SendMsg(2483, style
, 0) != 0;
780 // Get is a style italic or not.
781 bool wxStyledTextCtrl::StyleGetItalic(int style
) const
783 return SendMsg(2484, style
, 0) != 0;
786 // Get the size of characters of a style.
787 int wxStyledTextCtrl::StyleGetSize(int style
) const
789 return SendMsg(2485, style
, 0);
792 // Get the font facename of a style
793 wxString
wxStyledTextCtrl::StyleGetFaceName(int style
) {
795 long len
= SendMsg(msg
, style
, 0);
796 wxMemoryBuffer
mbuf(len
+1);
797 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
798 SendMsg(msg
, style
, (sptr_t
)buf
);
799 mbuf
.UngetWriteBuf(len
);
804 // Get is a style to have its end of line filled or not.
805 bool wxStyledTextCtrl::StyleGetEOLFilled(int style
) const
807 return SendMsg(2487, style
, 0) != 0;
810 // Get is a style underlined or not.
811 bool wxStyledTextCtrl::StyleGetUnderline(int style
) const
813 return SendMsg(2488, style
, 0) != 0;
816 // Get is a style mixed case, or to force upper or lower case.
817 int wxStyledTextCtrl::StyleGetCase(int style
) const
819 return SendMsg(2489, style
, 0);
822 // Get the character set of the font in a style.
823 int wxStyledTextCtrl::StyleGetCharacterSet(int style
) const
825 return SendMsg(2490, style
, 0);
828 // Get is a style visible or not.
829 bool wxStyledTextCtrl::StyleGetVisible(int style
) const
831 return SendMsg(2491, style
, 0) != 0;
834 // Get is a style changeable or not (read only).
835 // Experimental feature, currently buggy.
836 bool wxStyledTextCtrl::StyleGetChangeable(int style
) const
838 return SendMsg(2492, style
, 0) != 0;
841 // Get is a style a hotspot or not.
842 bool wxStyledTextCtrl::StyleGetHotSpot(int style
) const
844 return SendMsg(2493, style
, 0) != 0;
847 // Set a style to be mixed case, or to force upper or lower case.
848 void wxStyledTextCtrl::StyleSetCase(int style
, int caseForce
)
850 SendMsg(2060, style
, caseForce
);
853 // Set the size of characters of a style. Size is in points multiplied by 100.
854 void wxStyledTextCtrl::StyleSetSizeFractional(int style
, int caseForce
)
856 SendMsg(2061, style
, caseForce
);
859 // Get the size of characters of a style in points multiplied by 100
860 int wxStyledTextCtrl::StyleGetSizeFractional(int style
) const
862 return SendMsg(2062, style
, 0);
865 // Set the weight of characters of a style.
866 void wxStyledTextCtrl::StyleSetWeight(int style
, int weight
)
868 SendMsg(2063, style
, weight
);
871 // Get the weight of characters of a style.
872 int wxStyledTextCtrl::StyleGetWeight(int style
) const
874 return SendMsg(2064, style
, 0);
877 // Set a style to be a hotspot or not.
878 void wxStyledTextCtrl::StyleSetHotSpot(int style
, bool hotspot
)
880 SendMsg(2409, style
, hotspot
);
883 // Set the foreground colour of the main and additional selections and whether to use this setting.
884 void wxStyledTextCtrl::SetSelForeground(bool useSetting
, const wxColour
& fore
)
886 SendMsg(2067, useSetting
, wxColourAsLong(fore
));
889 // Set the background colour of the main and additional selections and whether to use this setting.
890 void wxStyledTextCtrl::SetSelBackground(bool useSetting
, const wxColour
& back
)
892 SendMsg(2068, useSetting
, wxColourAsLong(back
));
895 // Get the alpha of the selection.
896 int wxStyledTextCtrl::GetSelAlpha() const
898 return SendMsg(2477, 0, 0);
901 // Set the alpha of the selection.
902 void wxStyledTextCtrl::SetSelAlpha(int alpha
)
904 SendMsg(2478, alpha
, 0);
907 // Is the selection end of line filled?
908 bool wxStyledTextCtrl::GetSelEOLFilled() const
910 return SendMsg(2479, 0, 0) != 0;
913 // Set the selection to have its end of line filled or not.
914 void wxStyledTextCtrl::SetSelEOLFilled(bool filled
)
916 SendMsg(2480, filled
, 0);
919 // Set the foreground colour of the caret.
920 void wxStyledTextCtrl::SetCaretForeground(const wxColour
& fore
)
922 SendMsg(2069, wxColourAsLong(fore
), 0);
925 // When key+modifier combination km is pressed perform msg.
926 void wxStyledTextCtrl::CmdKeyAssign(int key
, int modifiers
, int cmd
) {
927 SendMsg(2070, MAKELONG(key
, modifiers
), cmd
);
930 // When key+modifier combination km is pressed do nothing.
931 void wxStyledTextCtrl::CmdKeyClear(int key
, int modifiers
) {
932 SendMsg(2071, MAKELONG(key
, modifiers
));
935 // Drop all key mappings.
936 void wxStyledTextCtrl::CmdKeyClearAll()
941 // Set the styles for a segment of the document.
942 void wxStyledTextCtrl::SetStyleBytes(int length
, char* styleBytes
) {
943 SendMsg(2073, length
, (sptr_t
)styleBytes
);
946 // Set a style to be visible or not.
947 void wxStyledTextCtrl::StyleSetVisible(int style
, bool visible
)
949 SendMsg(2074, style
, visible
);
952 // Get the time in milliseconds that the caret is on and off.
953 int wxStyledTextCtrl::GetCaretPeriod() const
955 return SendMsg(2075, 0, 0);
958 // Get the time in milliseconds that the caret is on and off. 0 = steady on.
959 void wxStyledTextCtrl::SetCaretPeriod(int periodMilliseconds
)
961 SendMsg(2076, periodMilliseconds
, 0);
964 // Set the set of characters making up words for when moving or selecting by word.
965 // First sets defaults like SetCharsDefault.
966 void wxStyledTextCtrl::SetWordChars(const wxString
& characters
)
968 SendMsg(2077, 0, (sptr_t
)(const char*)wx2stc(characters
));
971 // Get the set of characters making up words for when moving or selecting by word.
972 wxString
wxStyledTextCtrl::GetWordChars() const {
974 int len
= SendMsg(msg
, 0, (sptr_t
)NULL
);
975 if (!len
) return wxEmptyString
;
977 wxMemoryBuffer
mbuf(len
+1);
978 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
979 SendMsg(msg
, 0, (sptr_t
)buf
);
980 mbuf
.UngetWriteBuf(len
);
985 // Start a sequence of actions that is undone and redone as a unit.
987 void wxStyledTextCtrl::BeginUndoAction()
992 // End a sequence of actions that is undone and redone as a unit.
993 void wxStyledTextCtrl::EndUndoAction()
998 // Set an indicator to plain, squiggle or TT.
999 void wxStyledTextCtrl::IndicatorSetStyle(int indic
, int style
)
1001 SendMsg(2080, indic
, style
);
1004 // Retrieve the style of an indicator.
1005 int wxStyledTextCtrl::IndicatorGetStyle(int indic
) const
1007 return SendMsg(2081, indic
, 0);
1010 // Set the foreground colour of an indicator.
1011 void wxStyledTextCtrl::IndicatorSetForeground(int indic
, const wxColour
& fore
)
1013 SendMsg(2082, indic
, wxColourAsLong(fore
));
1016 // Retrieve the foreground colour of an indicator.
1017 wxColour
wxStyledTextCtrl::IndicatorGetForeground(int indic
) const
1019 long c
= SendMsg(2083, indic
, 0);
1020 return wxColourFromLong(c
);
1023 // Set an indicator to draw under text or over(default).
1024 void wxStyledTextCtrl::IndicatorSetUnder(int indic
, bool under
)
1026 SendMsg(2510, indic
, under
);
1029 // Retrieve whether indicator drawn under or over text.
1030 bool wxStyledTextCtrl::IndicatorGetUnder(int indic
) const
1032 return SendMsg(2511, indic
, 0) != 0;
1035 // Set the foreground colour of all whitespace and whether to use this setting.
1036 void wxStyledTextCtrl::SetWhitespaceForeground(bool useSetting
, const wxColour
& fore
)
1038 SendMsg(2084, useSetting
, wxColourAsLong(fore
));
1041 // Set the background colour of all whitespace and whether to use this setting.
1042 void wxStyledTextCtrl::SetWhitespaceBackground(bool useSetting
, const wxColour
& back
)
1044 SendMsg(2085, useSetting
, wxColourAsLong(back
));
1047 // Set the size of the dots used to mark space characters.
1048 void wxStyledTextCtrl::SetWhitespaceSize(int size
)
1050 SendMsg(2086, size
, 0);
1053 // Get the size of the dots used to mark space characters.
1054 int wxStyledTextCtrl::GetWhitespaceSize() const
1056 return SendMsg(2087, 0, 0);
1059 // Divide each styling byte into lexical class bits (default: 5) and indicator
1060 // bits (default: 3). If a lexer requires more than 32 lexical states, then this
1061 // is used to expand the possible states.
1062 void wxStyledTextCtrl::SetStyleBits(int bits
)
1064 SendMsg(2090, bits
, 0);
1067 // Retrieve number of bits in style bytes used to hold the lexical state.
1068 int wxStyledTextCtrl::GetStyleBits() const
1070 return SendMsg(2091, 0, 0);
1073 // Used to hold extra styling information for each line.
1074 void wxStyledTextCtrl::SetLineState(int line
, int state
)
1076 SendMsg(2092, line
, state
);
1079 // Retrieve the extra styling information for a line.
1080 int wxStyledTextCtrl::GetLineState(int line
) const
1082 return SendMsg(2093, line
, 0);
1085 // Retrieve the last line number that has line state.
1086 int wxStyledTextCtrl::GetMaxLineState() const
1088 return SendMsg(2094, 0, 0);
1091 // Is the background of the line containing the caret in a different colour?
1092 bool wxStyledTextCtrl::GetCaretLineVisible() const
1094 return SendMsg(2095, 0, 0) != 0;
1097 // Display the background of the line containing the caret in a different colour.
1098 void wxStyledTextCtrl::SetCaretLineVisible(bool show
)
1100 SendMsg(2096, show
, 0);
1103 // Get the colour of the background of the line containing the caret.
1104 wxColour
wxStyledTextCtrl::GetCaretLineBackground() const
1106 long c
= SendMsg(2097, 0, 0);
1107 return wxColourFromLong(c
);
1110 // Set the colour of the background of the line containing the caret.
1111 void wxStyledTextCtrl::SetCaretLineBackground(const wxColour
& back
)
1113 SendMsg(2098, wxColourAsLong(back
), 0);
1116 // Set a style to be changeable or not (read only).
1117 // Experimental feature, currently buggy.
1118 void wxStyledTextCtrl::StyleSetChangeable(int style
, bool changeable
)
1120 SendMsg(2099, style
, changeable
);
1123 // Display a auto-completion list.
1124 // The lenEntered parameter indicates how many characters before
1125 // the caret should be used to provide context.
1126 void wxStyledTextCtrl::AutoCompShow(int lenEntered
, const wxString
& itemList
)
1128 SendMsg(2100, lenEntered
, (sptr_t
)(const char*)wx2stc(itemList
));
1131 // Remove the auto-completion list from the screen.
1132 void wxStyledTextCtrl::AutoCompCancel()
1134 SendMsg(2101, 0, 0);
1137 // Is there an auto-completion list visible?
1138 bool wxStyledTextCtrl::AutoCompActive()
1140 return SendMsg(2102, 0, 0) != 0;
1143 // Retrieve the position of the caret when the auto-completion list was displayed.
1144 int wxStyledTextCtrl::AutoCompPosStart()
1146 return SendMsg(2103, 0, 0);
1149 // User has selected an item so remove the list and insert the selection.
1150 void wxStyledTextCtrl::AutoCompComplete()
1152 SendMsg(2104, 0, 0);
1155 // Define a set of character that when typed cancel the auto-completion list.
1156 void wxStyledTextCtrl::AutoCompStops(const wxString
& characterSet
)
1158 SendMsg(2105, 0, (sptr_t
)(const char*)wx2stc(characterSet
));
1161 // Change the separator character in the string setting up an auto-completion list.
1162 // Default is space but can be changed if items contain space.
1163 void wxStyledTextCtrl::AutoCompSetSeparator(int separatorCharacter
)
1165 SendMsg(2106, separatorCharacter
, 0);
1168 // Retrieve the auto-completion list separator character.
1169 int wxStyledTextCtrl::AutoCompGetSeparator() const
1171 return SendMsg(2107, 0, 0);
1174 // Select the item in the auto-completion list that starts with a string.
1175 void wxStyledTextCtrl::AutoCompSelect(const wxString
& text
)
1177 SendMsg(2108, 0, (sptr_t
)(const char*)wx2stc(text
));
1180 // Should the auto-completion list be cancelled if the user backspaces to a
1181 // position before where the box was created.
1182 void wxStyledTextCtrl::AutoCompSetCancelAtStart(bool cancel
)
1184 SendMsg(2110, cancel
, 0);
1187 // Retrieve whether auto-completion cancelled by backspacing before start.
1188 bool wxStyledTextCtrl::AutoCompGetCancelAtStart() const
1190 return SendMsg(2111, 0, 0) != 0;
1193 // Define a set of characters that when typed will cause the autocompletion to
1194 // choose the selected item.
1195 void wxStyledTextCtrl::AutoCompSetFillUps(const wxString
& characterSet
)
1197 SendMsg(2112, 0, (sptr_t
)(const char*)wx2stc(characterSet
));
1200 // Should a single item auto-completion list automatically choose the item.
1201 void wxStyledTextCtrl::AutoCompSetChooseSingle(bool chooseSingle
)
1203 SendMsg(2113, chooseSingle
, 0);
1206 // Retrieve whether a single item auto-completion list automatically choose the item.
1207 bool wxStyledTextCtrl::AutoCompGetChooseSingle() const
1209 return SendMsg(2114, 0, 0) != 0;
1212 // Set whether case is significant when performing auto-completion searches.
1213 void wxStyledTextCtrl::AutoCompSetIgnoreCase(bool ignoreCase
)
1215 SendMsg(2115, ignoreCase
, 0);
1218 // Retrieve state of ignore case flag.
1219 bool wxStyledTextCtrl::AutoCompGetIgnoreCase() const
1221 return SendMsg(2116, 0, 0) != 0;
1224 // Display a list of strings and send notification when user chooses one.
1225 void wxStyledTextCtrl::UserListShow(int listType
, const wxString
& itemList
)
1227 SendMsg(2117, listType
, (sptr_t
)(const char*)wx2stc(itemList
));
1230 // Set whether or not autocompletion is hidden automatically when nothing matches.
1231 void wxStyledTextCtrl::AutoCompSetAutoHide(bool autoHide
)
1233 SendMsg(2118, autoHide
, 0);
1236 // Retrieve whether or not autocompletion is hidden automatically when nothing matches.
1237 bool wxStyledTextCtrl::AutoCompGetAutoHide() const
1239 return SendMsg(2119, 0, 0) != 0;
1242 // Set whether or not autocompletion deletes any word characters
1243 // after the inserted text upon completion.
1244 void wxStyledTextCtrl::AutoCompSetDropRestOfWord(bool dropRestOfWord
)
1246 SendMsg(2270, dropRestOfWord
, 0);
1249 // Retrieve whether or not autocompletion deletes any word characters
1250 // after the inserted text upon completion.
1251 bool wxStyledTextCtrl::AutoCompGetDropRestOfWord() const
1253 return SendMsg(2271, 0, 0) != 0;
1256 // Register an image for use in autocompletion lists.
1257 void wxStyledTextCtrl::RegisterImage(int type
, const wxBitmap
& bmp
) {
1258 // convert bmp to a xpm in a string
1259 wxMemoryOutputStream strm
;
1260 wxImage img
= bmp
.ConvertToImage();
1262 img
.ConvertAlphaToMask();
1263 img
.SaveFile(strm
, wxBITMAP_TYPE_XPM
);
1264 size_t len
= strm
.GetSize();
1265 char* buff
= new char[len
+1];
1266 strm
.CopyTo(buff
, len
);
1268 SendMsg(2405, type
, (sptr_t
)buff
);
1273 // Clear all the registered images.
1274 void wxStyledTextCtrl::ClearRegisteredImages()
1276 SendMsg(2408, 0, 0);
1279 // Retrieve the auto-completion list type-separator character.
1280 int wxStyledTextCtrl::AutoCompGetTypeSeparator() const
1282 return SendMsg(2285, 0, 0);
1285 // Change the type-separator character in the string setting up an auto-completion list.
1286 // Default is '?' but can be changed if items contain '?'.
1287 void wxStyledTextCtrl::AutoCompSetTypeSeparator(int separatorCharacter
)
1289 SendMsg(2286, separatorCharacter
, 0);
1292 // Set the maximum width, in characters, of auto-completion and user lists.
1293 // Set to 0 to autosize to fit longest item, which is the default.
1294 void wxStyledTextCtrl::AutoCompSetMaxWidth(int characterCount
)
1296 SendMsg(2208, characterCount
, 0);
1299 // Get the maximum width, in characters, of auto-completion and user lists.
1300 int wxStyledTextCtrl::AutoCompGetMaxWidth() const
1302 return SendMsg(2209, 0, 0);
1305 // Set the maximum height, in rows, of auto-completion and user lists.
1306 // The default is 5 rows.
1307 void wxStyledTextCtrl::AutoCompSetMaxHeight(int rowCount
)
1309 SendMsg(2210, rowCount
, 0);
1312 // Set the maximum height, in rows, of auto-completion and user lists.
1313 int wxStyledTextCtrl::AutoCompGetMaxHeight() const
1315 return SendMsg(2211, 0, 0);
1318 // Set the number of spaces used for one level of indentation.
1319 void wxStyledTextCtrl::SetIndent(int indentSize
)
1321 SendMsg(2122, indentSize
, 0);
1324 // Retrieve indentation size.
1325 int wxStyledTextCtrl::GetIndent() const
1327 return SendMsg(2123, 0, 0);
1330 // Indentation will only use space characters if useTabs is false, otherwise
1331 // it will use a combination of tabs and spaces.
1332 void wxStyledTextCtrl::SetUseTabs(bool useTabs
)
1334 SendMsg(2124, useTabs
, 0);
1337 // Retrieve whether tabs will be used in indentation.
1338 bool wxStyledTextCtrl::GetUseTabs() const
1340 return SendMsg(2125, 0, 0) != 0;
1343 // Change the indentation of a line to a number of columns.
1344 void wxStyledTextCtrl::SetLineIndentation(int line
, int indentSize
)
1346 SendMsg(2126, line
, indentSize
);
1349 // Retrieve the number of columns that a line is indented.
1350 int wxStyledTextCtrl::GetLineIndentation(int line
) const
1352 return SendMsg(2127, line
, 0);
1355 // Retrieve the position before the first non indentation character on a line.
1356 int wxStyledTextCtrl::GetLineIndentPosition(int line
) const
1358 return SendMsg(2128, line
, 0);
1361 // Retrieve the column number of a position, taking tab width into account.
1362 int wxStyledTextCtrl::GetColumn(int pos
) const
1364 return SendMsg(2129, pos
, 0);
1367 // Count characters between two positions.
1368 int wxStyledTextCtrl::CountCharacters(int startPos
, int endPos
)
1370 return SendMsg(2633, startPos
, endPos
);
1373 // Show or hide the horizontal scroll bar.
1374 void wxStyledTextCtrl::SetUseHorizontalScrollBar(bool show
)
1376 SendMsg(2130, show
, 0);
1379 // Is the horizontal scroll bar visible?
1380 bool wxStyledTextCtrl::GetUseHorizontalScrollBar() const
1382 return SendMsg(2131, 0, 0) != 0;
1385 // Show or hide indentation guides.
1386 void wxStyledTextCtrl::SetIndentationGuides(int indentView
)
1388 SendMsg(2132, indentView
, 0);
1391 // Are the indentation guides visible?
1392 int wxStyledTextCtrl::GetIndentationGuides() const
1394 return SendMsg(2133, 0, 0);
1397 // Set the highlighted indentation guide column.
1398 // 0 = no highlighted guide.
1399 void wxStyledTextCtrl::SetHighlightGuide(int column
)
1401 SendMsg(2134, column
, 0);
1404 // Get the highlighted indentation guide column.
1405 int wxStyledTextCtrl::GetHighlightGuide() const
1407 return SendMsg(2135, 0, 0);
1410 // Get the position after the last visible characters on a line.
1411 int wxStyledTextCtrl::GetLineEndPosition(int line
) const
1413 return SendMsg(2136, line
, 0);
1416 // Get the code page used to interpret the bytes of the document as characters.
1417 int wxStyledTextCtrl::GetCodePage() const
1419 return SendMsg(2137, 0, 0);
1422 // Get the foreground colour of the caret.
1423 wxColour
wxStyledTextCtrl::GetCaretForeground() const
1425 long c
= SendMsg(2138, 0, 0);
1426 return wxColourFromLong(c
);
1429 // In read-only mode?
1430 bool wxStyledTextCtrl::GetReadOnly() const
1432 return SendMsg(2140, 0, 0) != 0;
1435 // Sets the position of the caret.
1436 void wxStyledTextCtrl::SetCurrentPos(int pos
)
1438 SendMsg(2141, pos
, 0);
1441 // Sets the position that starts the selection - this becomes the anchor.
1442 void wxStyledTextCtrl::SetSelectionStart(int pos
)
1444 SendMsg(2142, pos
, 0);
1447 // Returns the position at the start of the selection.
1448 int wxStyledTextCtrl::GetSelectionStart() const
1450 return SendMsg(2143, 0, 0);
1453 // Sets the position that ends the selection - this becomes the currentPosition.
1454 void wxStyledTextCtrl::SetSelectionEnd(int pos
)
1456 SendMsg(2144, pos
, 0);
1459 // Returns the position at the end of the selection.
1460 int wxStyledTextCtrl::GetSelectionEnd() const
1462 return SendMsg(2145, 0, 0);
1465 // Set caret to a position, while removing any existing selection.
1466 void wxStyledTextCtrl::SetEmptySelection(int pos
)
1468 SendMsg(2556, pos
, 0);
1471 // Sets the print magnification added to the point size of each style for printing.
1472 void wxStyledTextCtrl::SetPrintMagnification(int magnification
)
1474 SendMsg(2146, magnification
, 0);
1477 // Returns the print magnification.
1478 int wxStyledTextCtrl::GetPrintMagnification() const
1480 return SendMsg(2147, 0, 0);
1483 // Modify colours when printing for clearer printed text.
1484 void wxStyledTextCtrl::SetPrintColourMode(int mode
)
1486 SendMsg(2148, mode
, 0);
1489 // Returns the print colour mode.
1490 int wxStyledTextCtrl::GetPrintColourMode() const
1492 return SendMsg(2149, 0, 0);
1495 // Find some text in the document.
1496 int wxStyledTextCtrl::FindText(int minPos
, int maxPos
,
1497 const wxString
& text
,
1500 ft
.chrg
.cpMin
= minPos
;
1501 ft
.chrg
.cpMax
= maxPos
;
1502 const wxWX2MBbuf buf
= wx2stc(text
);
1503 ft
.lpstrText
= (char*)(const char*)buf
;
1505 return SendMsg(2150, flags
, (sptr_t
)&ft
);
1508 // On Windows, will draw the document into a display context such as a printer.
1509 int wxStyledTextCtrl::FormatRange(bool doDraw
,
1518 if (endPos
< startPos
) {
1519 int temp
= startPos
;
1524 fr
.hdcTarget
= target
;
1525 fr
.rc
.top
= renderRect
.GetTop();
1526 fr
.rc
.left
= renderRect
.GetLeft();
1527 fr
.rc
.right
= renderRect
.GetRight();
1528 fr
.rc
.bottom
= renderRect
.GetBottom();
1529 fr
.rcPage
.top
= pageRect
.GetTop();
1530 fr
.rcPage
.left
= pageRect
.GetLeft();
1531 fr
.rcPage
.right
= pageRect
.GetRight();
1532 fr
.rcPage
.bottom
= pageRect
.GetBottom();
1533 fr
.chrg
.cpMin
= startPos
;
1534 fr
.chrg
.cpMax
= endPos
;
1536 return SendMsg(2151, doDraw
, (sptr_t
)&fr
);
1539 // Retrieve the display line at the top of the display.
1540 int wxStyledTextCtrl::GetFirstVisibleLine() const
1542 return SendMsg(2152, 0, 0);
1545 // Retrieve the contents of a line.
1546 wxString
wxStyledTextCtrl::GetLine(int line
) const {
1547 int len
= LineLength(line
);
1548 if (!len
) return wxEmptyString
;
1550 wxMemoryBuffer
mbuf(len
+1);
1551 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1552 SendMsg(2153, line
, (sptr_t
)buf
);
1553 mbuf
.UngetWriteBuf(len
);
1558 // Returns the number of lines in the document. There is always at least one.
1559 int wxStyledTextCtrl::GetLineCount() const
1561 return SendMsg(2154, 0, 0);
1564 // Sets the size in pixels of the left margin.
1565 void wxStyledTextCtrl::SetMarginLeft(int pixelWidth
)
1567 SendMsg(2155, 0, pixelWidth
);
1570 // Returns the size in pixels of the left margin.
1571 int wxStyledTextCtrl::GetMarginLeft() const
1573 return SendMsg(2156, 0, 0);
1576 // Sets the size in pixels of the right margin.
1577 void wxStyledTextCtrl::SetMarginRight(int pixelWidth
)
1579 SendMsg(2157, 0, pixelWidth
);
1582 // Returns the size in pixels of the right margin.
1583 int wxStyledTextCtrl::GetMarginRight() const
1585 return SendMsg(2158, 0, 0);
1588 // Is the document different from when it was last saved?
1589 bool wxStyledTextCtrl::GetModify() const
1591 return SendMsg(2159, 0, 0) != 0;
1594 // Retrieve the selected text.
1595 wxString
wxStyledTextCtrl::GetSelectedText() {
1596 const int len
= SendMsg(SCI_GETSELTEXT
, 0, (sptr_t
)0);
1597 if (!len
) return wxEmptyString
;
1599 wxMemoryBuffer
mbuf(len
+2);
1600 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1601 SendMsg(2161, 0, (sptr_t
)buf
);
1602 mbuf
.UngetWriteBuf(len
);
1607 // Retrieve a range of text.
1608 wxString
wxStyledTextCtrl::GetTextRange(int startPos
, int endPos
) {
1609 if (endPos
< startPos
) {
1610 int temp
= startPos
;
1614 int len
= endPos
- startPos
;
1615 if (!len
) return wxEmptyString
;
1616 wxMemoryBuffer
mbuf(len
+1);
1617 char* buf
= (char*)mbuf
.GetWriteBuf(len
);
1620 tr
.chrg
.cpMin
= startPos
;
1621 tr
.chrg
.cpMax
= endPos
;
1622 SendMsg(2162, 0, (sptr_t
)&tr
);
1623 mbuf
.UngetWriteBuf(len
);
1628 // Draw the selection in normal style or with selection highlighted.
1629 void wxStyledTextCtrl::HideSelection(bool normal
)
1631 SendMsg(2163, normal
, 0);
1634 // Retrieve the line containing a position.
1635 int wxStyledTextCtrl::LineFromPosition(int pos
) const
1637 return SendMsg(2166, pos
, 0);
1640 // Retrieve the position at the start of a line.
1641 int wxStyledTextCtrl::PositionFromLine(int line
) const
1643 return SendMsg(2167, line
, 0);
1646 // Scroll horizontally and vertically.
1647 void wxStyledTextCtrl::LineScroll(int columns
, int lines
)
1649 SendMsg(2168, columns
, lines
);
1652 // Ensure the caret is visible.
1653 void wxStyledTextCtrl::EnsureCaretVisible()
1655 SendMsg(2169, 0, 0);
1658 // Replace the selected text with the argument text.
1659 void wxStyledTextCtrl::ReplaceSelection(const wxString
& text
)
1661 SendMsg(2170, 0, (sptr_t
)(const char*)wx2stc(text
));
1664 // Set to read only or read write.
1665 void wxStyledTextCtrl::SetReadOnly(bool readOnly
)
1667 SendMsg(2171, readOnly
, 0);
1670 // Will a paste succeed?
1671 bool wxStyledTextCtrl::CanPaste() const
1673 return SendMsg(2173, 0, 0) != 0;
1676 // Are there any undoable actions in the undo history?
1677 bool wxStyledTextCtrl::CanUndo() const
1679 return SendMsg(2174, 0, 0) != 0;
1682 // Delete the undo history.
1683 void wxStyledTextCtrl::EmptyUndoBuffer()
1685 SendMsg(2175, 0, 0);
1688 // Undo one action in the undo history.
1689 void wxStyledTextCtrl::Undo()
1691 SendMsg(2176, 0, 0);
1694 // Cut the selection to the clipboard.
1695 void wxStyledTextCtrl::Cut()
1697 SendMsg(2177, 0, 0);
1700 // Copy the selection to the clipboard.
1701 void wxStyledTextCtrl::Copy()
1703 SendMsg(2178, 0, 0);
1706 // Paste the contents of the clipboard into the document replacing the selection.
1707 void wxStyledTextCtrl::Paste()
1709 SendMsg(2179, 0, 0);
1712 // Clear the selection.
1713 void wxStyledTextCtrl::Clear()
1715 SendMsg(2180, 0, 0);
1718 // Replace the contents of the document with the argument text.
1719 void wxStyledTextCtrl::SetText(const wxString
& text
)
1721 SendMsg(2181, 0, (sptr_t
)(const char*)wx2stc(text
));
1724 // Retrieve all the text in the document.
1725 wxString
wxStyledTextCtrl::GetText() const {
1726 int len
= GetTextLength();
1727 wxMemoryBuffer
mbuf(len
+1); // leave room for the null...
1728 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1729 SendMsg(2182, len
+1, (sptr_t
)buf
);
1730 mbuf
.UngetWriteBuf(len
);
1735 // Retrieve the number of characters in the document.
1736 int wxStyledTextCtrl::GetTextLength() const
1738 return SendMsg(2183, 0, 0);
1741 // Set to overtype (true) or insert mode.
1742 void wxStyledTextCtrl::SetOvertype(bool overtype
)
1744 SendMsg(2186, overtype
, 0);
1747 // Returns true if overtype mode is active otherwise false is returned.
1748 bool wxStyledTextCtrl::GetOvertype() const
1750 return SendMsg(2187, 0, 0) != 0;
1753 // Set the width of the insert mode caret.
1754 void wxStyledTextCtrl::SetCaretWidth(int pixelWidth
)
1756 SendMsg(2188, pixelWidth
, 0);
1759 // Returns the width of the insert mode caret.
1760 int wxStyledTextCtrl::GetCaretWidth() const
1762 return SendMsg(2189, 0, 0);
1765 // Sets the position that starts the target which is used for updating the
1766 // document without affecting the scroll position.
1767 void wxStyledTextCtrl::SetTargetStart(int pos
)
1769 SendMsg(2190, pos
, 0);
1772 // Get the position that starts the target.
1773 int wxStyledTextCtrl::GetTargetStart() const
1775 return SendMsg(2191, 0, 0);
1778 // Sets the position that ends the target which is used for updating the
1779 // document without affecting the scroll position.
1780 void wxStyledTextCtrl::SetTargetEnd(int pos
)
1782 SendMsg(2192, pos
, 0);
1785 // Get the position that ends the target.
1786 int wxStyledTextCtrl::GetTargetEnd() const
1788 return SendMsg(2193, 0, 0);
1791 // Replace the target text with the argument text.
1792 // Text is counted so it can contain NULs.
1793 // Returns the length of the replacement text.
1795 int wxStyledTextCtrl::ReplaceTarget(const wxString
& text
) {
1796 const wxWX2MBbuf buf
= wx2stc(text
);
1797 return SendMsg(2194, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
1800 // Replace the target text with the argument text after \d processing.
1801 // Text is counted so it can contain NULs.
1802 // Looks for \d where d is between 1 and 9 and replaces these with the strings
1803 // matched in the last search operation which were surrounded by \( and \).
1804 // Returns the length of the replacement text including any change
1805 // caused by processing the \d patterns.
1807 int wxStyledTextCtrl::ReplaceTargetRE(const wxString
& text
) {
1808 const wxWX2MBbuf buf
= wx2stc(text
);
1809 return SendMsg(2195, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
1812 // Search for a counted string in the target and set the target to the found
1813 // range. Text is counted so it can contain NULs.
1814 // Returns length of range or -1 for failure in which case target is not moved.
1816 int wxStyledTextCtrl::SearchInTarget(const wxString
& text
) {
1817 const wxWX2MBbuf buf
= wx2stc(text
);
1818 return SendMsg(2197, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
1821 // Set the search flags used by SearchInTarget.
1822 void wxStyledTextCtrl::SetSearchFlags(int flags
)
1824 SendMsg(2198, flags
, 0);
1827 // Get the search flags used by SearchInTarget.
1828 int wxStyledTextCtrl::GetSearchFlags() const
1830 return SendMsg(2199, 0, 0);
1833 // Show a call tip containing a definition near position pos.
1834 void wxStyledTextCtrl::CallTipShow(int pos
, const wxString
& definition
)
1836 SendMsg(2200, pos
, (sptr_t
)(const char*)wx2stc(definition
));
1839 // Remove the call tip from the screen.
1840 void wxStyledTextCtrl::CallTipCancel()
1842 SendMsg(2201, 0, 0);
1845 // Is there an active call tip?
1846 bool wxStyledTextCtrl::CallTipActive()
1848 return SendMsg(2202, 0, 0) != 0;
1851 // Retrieve the position where the caret was before displaying the call tip.
1852 int wxStyledTextCtrl::CallTipPosAtStart()
1854 return SendMsg(2203, 0, 0);
1857 // Highlight a segment of the definition.
1858 void wxStyledTextCtrl::CallTipSetHighlight(int start
, int end
)
1860 SendMsg(2204, start
, end
);
1863 // Set the background colour for the call tip.
1864 void wxStyledTextCtrl::CallTipSetBackground(const wxColour
& back
)
1866 SendMsg(2205, wxColourAsLong(back
), 0);
1869 // Set the foreground colour for the call tip.
1870 void wxStyledTextCtrl::CallTipSetForeground(const wxColour
& fore
)
1872 SendMsg(2206, wxColourAsLong(fore
), 0);
1875 // Set the foreground colour for the highlighted part of the call tip.
1876 void wxStyledTextCtrl::CallTipSetForegroundHighlight(const wxColour
& fore
)
1878 SendMsg(2207, wxColourAsLong(fore
), 0);
1881 // Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
1882 void wxStyledTextCtrl::CallTipUseStyle(int tabSize
)
1884 SendMsg(2212, tabSize
, 0);
1887 // Set position of calltip, above or below text.
1888 void wxStyledTextCtrl::CallTipSetPosition(bool above
)
1890 SendMsg(2213, above
, 0);
1893 // Find the display line of a document line taking hidden lines into account.
1894 int wxStyledTextCtrl::VisibleFromDocLine(int line
)
1896 return SendMsg(2220, line
, 0);
1899 // Find the document line of a display line taking hidden lines into account.
1900 int wxStyledTextCtrl::DocLineFromVisible(int lineDisplay
)
1902 return SendMsg(2221, lineDisplay
, 0);
1905 // The number of display lines needed to wrap a document line
1906 int wxStyledTextCtrl::WrapCount(int line
)
1908 return SendMsg(2235, line
, 0);
1911 // Set the fold level of a line.
1912 // This encodes an integer level along with flags indicating whether the
1913 // line is a header and whether it is effectively white space.
1914 void wxStyledTextCtrl::SetFoldLevel(int line
, int level
)
1916 SendMsg(2222, line
, level
);
1919 // Retrieve the fold level of a line.
1920 int wxStyledTextCtrl::GetFoldLevel(int line
) const
1922 return SendMsg(2223, line
, 0);
1925 // Find the last child line of a header line.
1926 int wxStyledTextCtrl::GetLastChild(int line
, int level
) const
1928 return SendMsg(2224, line
, level
);
1931 // Find the parent line of a child line.
1932 int wxStyledTextCtrl::GetFoldParent(int line
) const
1934 return SendMsg(2225, line
, 0);
1937 // Make a range of lines visible.
1938 void wxStyledTextCtrl::ShowLines(int lineStart
, int lineEnd
)
1940 SendMsg(2226, lineStart
, lineEnd
);
1943 // Make a range of lines invisible.
1944 void wxStyledTextCtrl::HideLines(int lineStart
, int lineEnd
)
1946 SendMsg(2227, lineStart
, lineEnd
);
1949 // Is a line visible?
1950 bool wxStyledTextCtrl::GetLineVisible(int line
) const
1952 return SendMsg(2228, line
, 0) != 0;
1955 // Are all lines visible?
1956 bool wxStyledTextCtrl::GetAllLinesVisible() const
1958 return SendMsg(2236, 0, 0) != 0;
1961 // Show the children of a header line.
1962 void wxStyledTextCtrl::SetFoldExpanded(int line
, bool expanded
)
1964 SendMsg(2229, line
, expanded
);
1967 // Is a header line expanded?
1968 bool wxStyledTextCtrl::GetFoldExpanded(int line
) const
1970 return SendMsg(2230, line
, 0) != 0;
1973 // Switch a header line between expanded and contracted.
1974 void wxStyledTextCtrl::ToggleFold(int line
)
1976 SendMsg(2231, line
, 0);
1979 // Ensure a particular line is visible by expanding any header line hiding it.
1980 void wxStyledTextCtrl::EnsureVisible(int line
)
1982 SendMsg(2232, line
, 0);
1985 // Set some style options for folding.
1986 void wxStyledTextCtrl::SetFoldFlags(int flags
)
1988 SendMsg(2233, flags
, 0);
1991 // Ensure a particular line is visible by expanding any header line hiding it.
1992 // Use the currently set visibility policy to determine which range to display.
1993 void wxStyledTextCtrl::EnsureVisibleEnforcePolicy(int line
)
1995 SendMsg(2234, line
, 0);
1998 // Sets whether a tab pressed when caret is within indentation indents.
1999 void wxStyledTextCtrl::SetTabIndents(bool tabIndents
)
2001 SendMsg(2260, tabIndents
, 0);
2004 // Does a tab pressed when caret is within indentation indent?
2005 bool wxStyledTextCtrl::GetTabIndents() const
2007 return SendMsg(2261, 0, 0) != 0;
2010 // Sets whether a backspace pressed when caret is within indentation unindents.
2011 void wxStyledTextCtrl::SetBackSpaceUnIndents(bool bsUnIndents
)
2013 SendMsg(2262, bsUnIndents
, 0);
2016 // Does a backspace pressed when caret is within indentation unindent?
2017 bool wxStyledTextCtrl::GetBackSpaceUnIndents() const
2019 return SendMsg(2263, 0, 0) != 0;
2022 // Sets the time the mouse must sit still to generate a mouse dwell event.
2023 void wxStyledTextCtrl::SetMouseDwellTime(int periodMilliseconds
)
2025 SendMsg(2264, periodMilliseconds
, 0);
2028 // Retrieve the time the mouse must sit still to generate a mouse dwell event.
2029 int wxStyledTextCtrl::GetMouseDwellTime() const
2031 return SendMsg(2265, 0, 0);
2034 // Get position of start of word.
2035 int wxStyledTextCtrl::WordStartPosition(int pos
, bool onlyWordCharacters
)
2037 return SendMsg(2266, pos
, onlyWordCharacters
);
2040 // Get position of end of word.
2041 int wxStyledTextCtrl::WordEndPosition(int pos
, bool onlyWordCharacters
)
2043 return SendMsg(2267, pos
, onlyWordCharacters
);
2046 // Sets whether text is word wrapped.
2047 void wxStyledTextCtrl::SetWrapMode(int mode
)
2049 SendMsg(2268, mode
, 0);
2052 // Retrieve whether text is word wrapped.
2053 int wxStyledTextCtrl::GetWrapMode() const
2055 return SendMsg(2269, 0, 0);
2058 // Set the display mode of visual flags for wrapped lines.
2059 void wxStyledTextCtrl::SetWrapVisualFlags(int wrapVisualFlags
)
2061 SendMsg(2460, wrapVisualFlags
, 0);
2064 // Retrive the display mode of visual flags for wrapped lines.
2065 int wxStyledTextCtrl::GetWrapVisualFlags() const
2067 return SendMsg(2461, 0, 0);
2070 // Set the location of visual flags for wrapped lines.
2071 void wxStyledTextCtrl::SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation
)
2073 SendMsg(2462, wrapVisualFlagsLocation
, 0);
2076 // Retrive the location of visual flags for wrapped lines.
2077 int wxStyledTextCtrl::GetWrapVisualFlagsLocation() const
2079 return SendMsg(2463, 0, 0);
2082 // Set the start indent for wrapped lines.
2083 void wxStyledTextCtrl::SetWrapStartIndent(int indent
)
2085 SendMsg(2464, indent
, 0);
2088 // Retrive the start indent for wrapped lines.
2089 int wxStyledTextCtrl::GetWrapStartIndent() const
2091 return SendMsg(2465, 0, 0);
2094 // Sets how wrapped sublines are placed. Default is fixed.
2095 void wxStyledTextCtrl::SetWrapIndentMode(int mode
)
2097 SendMsg(2472, mode
, 0);
2100 // Retrieve how wrapped sublines are placed. Default is fixed.
2101 int wxStyledTextCtrl::GetWrapIndentMode() const
2103 return SendMsg(2473, 0, 0);
2106 // Sets the degree of caching of layout information.
2107 void wxStyledTextCtrl::SetLayoutCache(int mode
)
2109 SendMsg(2272, mode
, 0);
2112 // Retrieve the degree of caching of layout information.
2113 int wxStyledTextCtrl::GetLayoutCache() const
2115 return SendMsg(2273, 0, 0);
2118 // Sets the document width assumed for scrolling.
2119 void wxStyledTextCtrl::SetScrollWidth(int pixelWidth
)
2121 SendMsg(2274, pixelWidth
, 0);
2124 // Retrieve the document width assumed for scrolling.
2125 int wxStyledTextCtrl::GetScrollWidth() const
2127 return SendMsg(2275, 0, 0);
2130 // Sets whether the maximum width line displayed is used to set scroll width.
2131 void wxStyledTextCtrl::SetScrollWidthTracking(bool tracking
)
2133 SendMsg(2516, tracking
, 0);
2136 // Retrieve whether the scroll width tracks wide lines.
2137 bool wxStyledTextCtrl::GetScrollWidthTracking() const
2139 return SendMsg(2517, 0, 0) != 0;
2142 // Measure the pixel width of some text in a particular style.
2143 // NUL terminated text argument.
2144 // Does not handle tab or control characters.
2145 int wxStyledTextCtrl::TextWidth(int style
, const wxString
& text
)
2147 return SendMsg(2276, style
, (sptr_t
)(const char*)wx2stc(text
));
2150 // Sets the scroll range so that maximum scroll position has
2151 // the last line at the bottom of the view (default).
2152 // Setting this to false allows scrolling one page below the last line.
2153 void wxStyledTextCtrl::SetEndAtLastLine(bool endAtLastLine
)
2155 SendMsg(2277, endAtLastLine
, 0);
2158 // Retrieve whether the maximum scroll position has the last
2159 // line at the bottom of the view.
2160 bool wxStyledTextCtrl::GetEndAtLastLine() const
2162 return SendMsg(2278, 0, 0) != 0;
2165 // Retrieve the height of a particular line of text in pixels.
2166 int wxStyledTextCtrl::TextHeight(int line
)
2168 return SendMsg(2279, line
, 0);
2171 // Show or hide the vertical scroll bar.
2172 void wxStyledTextCtrl::SetUseVerticalScrollBar(bool show
)
2174 SendMsg(2280, show
, 0);
2177 // Is the vertical scroll bar visible?
2178 bool wxStyledTextCtrl::GetUseVerticalScrollBar() const
2180 return SendMsg(2281, 0, 0) != 0;
2183 // Append a string to the end of the document without changing the selection.
2184 void wxStyledTextCtrl::AppendText(const wxString
& text
) {
2185 const wxWX2MBbuf buf
= wx2stc(text
);
2186 SendMsg(2282, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
2189 // Is drawing done in two phases with backgrounds drawn before foregrounds?
2190 bool wxStyledTextCtrl::GetTwoPhaseDraw() const
2192 return SendMsg(2283, 0, 0) != 0;
2195 // In twoPhaseDraw mode, drawing is performed in two phases, first the background
2196 // and then the foreground. This avoids chopping off characters that overlap the next run.
2197 void wxStyledTextCtrl::SetTwoPhaseDraw(bool twoPhase
)
2199 SendMsg(2284, twoPhase
, 0);
2202 // Scroll so that a display line is at the top of the display.
2203 void wxStyledTextCtrl::SetFirstVisibleLine(int lineDisplay
)
2205 SendMsg(2613, lineDisplay
, 0);
2208 // Change the effect of pasting when there are multiple selections.
2209 void wxStyledTextCtrl::SetMultiPaste(int multiPaste
)
2211 SendMsg(2614, multiPaste
, 0);
2214 // Retrieve the effect of pasting when there are multiple selections..
2215 int wxStyledTextCtrl::GetMultiPaste() const
2217 return SendMsg(2615, 0, 0);
2220 // Retrieve the value of a tag from a regular expression search.
2221 wxString
wxStyledTextCtrl::GetTag(int tagNumber
) const {
2223 int len
= SendMsg(msg
, tagNumber
, (sptr_t
)NULL
);
2224 if (!len
) return wxEmptyString
;
2226 wxMemoryBuffer
mbuf(len
+1);
2227 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
2228 SendMsg(msg
, tagNumber
, (sptr_t
)buf
);
2229 mbuf
.UngetWriteBuf(len
);
2234 // Make the target range start and end be the same as the selection range start and end.
2235 void wxStyledTextCtrl::TargetFromSelection()
2237 SendMsg(2287, 0, 0);
2240 // Join the lines in the target.
2241 void wxStyledTextCtrl::LinesJoin()
2243 SendMsg(2288, 0, 0);
2246 // Split the lines in the target into lines that are less wide than pixelWidth
2248 void wxStyledTextCtrl::LinesSplit(int pixelWidth
)
2250 SendMsg(2289, pixelWidth
, 0);
2253 // Set the colours used as a chequerboard pattern in the fold margin
2254 void wxStyledTextCtrl::SetFoldMarginColour(bool useSetting
, const wxColour
& back
)
2256 SendMsg(2290, useSetting
, wxColourAsLong(back
));
2258 void wxStyledTextCtrl::SetFoldMarginHiColour(bool useSetting
, const wxColour
& fore
)
2260 SendMsg(2291, useSetting
, wxColourAsLong(fore
));
2263 // Move caret down one line.
2264 void wxStyledTextCtrl::LineDown()
2266 SendMsg(2300, 0, 0);
2269 // Move caret down one line extending selection to new caret position.
2270 void wxStyledTextCtrl::LineDownExtend()
2272 SendMsg(2301, 0, 0);
2275 // Move caret up one line.
2276 void wxStyledTextCtrl::LineUp()
2278 SendMsg(2302, 0, 0);
2281 // Move caret up one line extending selection to new caret position.
2282 void wxStyledTextCtrl::LineUpExtend()
2284 SendMsg(2303, 0, 0);
2287 // Move caret left one character.
2288 void wxStyledTextCtrl::CharLeft()
2290 SendMsg(2304, 0, 0);
2293 // Move caret left one character extending selection to new caret position.
2294 void wxStyledTextCtrl::CharLeftExtend()
2296 SendMsg(2305, 0, 0);
2299 // Move caret right one character.
2300 void wxStyledTextCtrl::CharRight()
2302 SendMsg(2306, 0, 0);
2305 // Move caret right one character extending selection to new caret position.
2306 void wxStyledTextCtrl::CharRightExtend()
2308 SendMsg(2307, 0, 0);
2311 // Move caret left one word.
2312 void wxStyledTextCtrl::WordLeft()
2314 SendMsg(2308, 0, 0);
2317 // Move caret left one word extending selection to new caret position.
2318 void wxStyledTextCtrl::WordLeftExtend()
2320 SendMsg(2309, 0, 0);
2323 // Move caret right one word.
2324 void wxStyledTextCtrl::WordRight()
2326 SendMsg(2310, 0, 0);
2329 // Move caret right one word extending selection to new caret position.
2330 void wxStyledTextCtrl::WordRightExtend()
2332 SendMsg(2311, 0, 0);
2335 // Move caret to first position on line.
2336 void wxStyledTextCtrl::Home()
2338 SendMsg(2312, 0, 0);
2341 // Move caret to first position on line extending selection to new caret position.
2342 void wxStyledTextCtrl::HomeExtend()
2344 SendMsg(2313, 0, 0);
2347 // Move caret to last position on line.
2348 void wxStyledTextCtrl::LineEnd()
2350 SendMsg(2314, 0, 0);
2353 // Move caret to last position on line extending selection to new caret position.
2354 void wxStyledTextCtrl::LineEndExtend()
2356 SendMsg(2315, 0, 0);
2359 // Move caret to first position in document.
2360 void wxStyledTextCtrl::DocumentStart()
2362 SendMsg(2316, 0, 0);
2365 // Move caret to first position in document extending selection to new caret position.
2366 void wxStyledTextCtrl::DocumentStartExtend()
2368 SendMsg(2317, 0, 0);
2371 // Move caret to last position in document.
2372 void wxStyledTextCtrl::DocumentEnd()
2374 SendMsg(2318, 0, 0);
2377 // Move caret to last position in document extending selection to new caret position.
2378 void wxStyledTextCtrl::DocumentEndExtend()
2380 SendMsg(2319, 0, 0);
2383 // Move caret one page up.
2384 void wxStyledTextCtrl::PageUp()
2386 SendMsg(2320, 0, 0);
2389 // Move caret one page up extending selection to new caret position.
2390 void wxStyledTextCtrl::PageUpExtend()
2392 SendMsg(2321, 0, 0);
2395 // Move caret one page down.
2396 void wxStyledTextCtrl::PageDown()
2398 SendMsg(2322, 0, 0);
2401 // Move caret one page down extending selection to new caret position.
2402 void wxStyledTextCtrl::PageDownExtend()
2404 SendMsg(2323, 0, 0);
2407 // Switch from insert to overtype mode or the reverse.
2408 void wxStyledTextCtrl::EditToggleOvertype()
2410 SendMsg(2324, 0, 0);
2413 // Cancel any modes such as call tip or auto-completion list display.
2414 void wxStyledTextCtrl::Cancel()
2416 SendMsg(2325, 0, 0);
2419 // Delete the selection or if no selection, the character before the caret.
2420 void wxStyledTextCtrl::DeleteBack()
2422 SendMsg(2326, 0, 0);
2425 // If selection is empty or all on one line replace the selection with a tab character.
2426 // If more than one line selected, indent the lines.
2427 void wxStyledTextCtrl::Tab()
2429 SendMsg(2327, 0, 0);
2432 // Dedent the selected lines.
2433 void wxStyledTextCtrl::BackTab()
2435 SendMsg(2328, 0, 0);
2438 // Insert a new line, may use a CRLF, CR or LF depending on EOL mode.
2439 void wxStyledTextCtrl::NewLine()
2441 SendMsg(2329, 0, 0);
2444 // Insert a Form Feed character.
2445 void wxStyledTextCtrl::FormFeed()
2447 SendMsg(2330, 0, 0);
2450 // Move caret to before first visible character on line.
2451 // If already there move to first character on line.
2452 void wxStyledTextCtrl::VCHome()
2454 SendMsg(2331, 0, 0);
2457 // Like VCHome but extending selection to new caret position.
2458 void wxStyledTextCtrl::VCHomeExtend()
2460 SendMsg(2332, 0, 0);
2463 // Magnify the displayed text by increasing the sizes by 1 point.
2464 void wxStyledTextCtrl::ZoomIn()
2466 SendMsg(2333, 0, 0);
2469 // Make the displayed text smaller by decreasing the sizes by 1 point.
2470 void wxStyledTextCtrl::ZoomOut()
2472 SendMsg(2334, 0, 0);
2475 // Delete the word to the left of the caret.
2476 void wxStyledTextCtrl::DelWordLeft()
2478 SendMsg(2335, 0, 0);
2481 // Delete the word to the right of the caret.
2482 void wxStyledTextCtrl::DelWordRight()
2484 SendMsg(2336, 0, 0);
2487 // Delete the word to the right of the caret, but not the trailing non-word characters.
2488 void wxStyledTextCtrl::DelWordRightEnd()
2490 SendMsg(2518, 0, 0);
2493 // Cut the line containing the caret.
2494 void wxStyledTextCtrl::LineCut()
2496 SendMsg(2337, 0, 0);
2499 // Delete the line containing the caret.
2500 void wxStyledTextCtrl::LineDelete()
2502 SendMsg(2338, 0, 0);
2505 // Switch the current line with the previous.
2506 void wxStyledTextCtrl::LineTranspose()
2508 SendMsg(2339, 0, 0);
2511 // Duplicate the current line.
2512 void wxStyledTextCtrl::LineDuplicate()
2514 SendMsg(2404, 0, 0);
2517 // Transform the selection to lower case.
2518 void wxStyledTextCtrl::LowerCase()
2520 SendMsg(2340, 0, 0);
2523 // Transform the selection to upper case.
2524 void wxStyledTextCtrl::UpperCase()
2526 SendMsg(2341, 0, 0);
2529 // Scroll the document down, keeping the caret visible.
2530 void wxStyledTextCtrl::LineScrollDown()
2532 SendMsg(2342, 0, 0);
2535 // Scroll the document up, keeping the caret visible.
2536 void wxStyledTextCtrl::LineScrollUp()
2538 SendMsg(2343, 0, 0);
2541 // Delete the selection or if no selection, the character before the caret.
2542 // Will not delete the character before at the start of a line.
2543 void wxStyledTextCtrl::DeleteBackNotLine()
2545 SendMsg(2344, 0, 0);
2548 // Move caret to first position on display line.
2549 void wxStyledTextCtrl::HomeDisplay()
2551 SendMsg(2345, 0, 0);
2554 // Move caret to first position on display line extending selection to
2555 // new caret position.
2556 void wxStyledTextCtrl::HomeDisplayExtend()
2558 SendMsg(2346, 0, 0);
2561 // Move caret to last position on display line.
2562 void wxStyledTextCtrl::LineEndDisplay()
2564 SendMsg(2347, 0, 0);
2567 // Move caret to last position on display line extending selection to new
2569 void wxStyledTextCtrl::LineEndDisplayExtend()
2571 SendMsg(2348, 0, 0);
2574 // These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)?
2575 // except they behave differently when word-wrap is enabled:
2576 // They go first to the start / end of the display line, like (Home|LineEnd)Display
2577 // The difference is that, the cursor is already at the point, it goes on to the start
2578 // or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
2579 void wxStyledTextCtrl::HomeWrap()
2581 SendMsg(2349, 0, 0);
2583 void wxStyledTextCtrl::HomeWrapExtend()
2585 SendMsg(2450, 0, 0);
2587 void wxStyledTextCtrl::LineEndWrap()
2589 SendMsg(2451, 0, 0);
2591 void wxStyledTextCtrl::LineEndWrapExtend()
2593 SendMsg(2452, 0, 0);
2595 void wxStyledTextCtrl::VCHomeWrap()
2597 SendMsg(2453, 0, 0);
2599 void wxStyledTextCtrl::VCHomeWrapExtend()
2601 SendMsg(2454, 0, 0);
2604 // Copy the line containing the caret.
2605 void wxStyledTextCtrl::LineCopy()
2607 SendMsg(2455, 0, 0);
2610 // Move the caret inside current view if it's not there already.
2611 void wxStyledTextCtrl::MoveCaretInsideView()
2613 SendMsg(2401, 0, 0);
2616 // How many characters are on a line, including end of line characters?
2617 int wxStyledTextCtrl::LineLength(int line
) const
2619 return SendMsg(2350, line
, 0);
2622 // Highlight the characters at two positions.
2623 void wxStyledTextCtrl::BraceHighlight(int pos1
, int pos2
)
2625 SendMsg(2351, pos1
, pos2
);
2628 // Use specified indicator to highlight matching braces instead of changing their style.
2629 void wxStyledTextCtrl::BraceHighlightIndicator(bool useBraceHighlightIndicator
, int indicator
)
2631 SendMsg(2498, useBraceHighlightIndicator
, indicator
);
2634 // Highlight the character at a position indicating there is no matching brace.
2635 void wxStyledTextCtrl::BraceBadLight(int pos
)
2637 SendMsg(2352, pos
, 0);
2640 // Use specified indicator to highlight non matching brace instead of changing its style.
2641 void wxStyledTextCtrl::BraceBadLightIndicator(bool useBraceBadLightIndicator
, int indicator
)
2643 SendMsg(2499, useBraceBadLightIndicator
, indicator
);
2646 // Find the position of a matching brace or INVALID_POSITION if no match.
2647 int wxStyledTextCtrl::BraceMatch(int pos
)
2649 return SendMsg(2353, pos
, 0);
2652 // Are the end of line characters visible?
2653 bool wxStyledTextCtrl::GetViewEOL() const
2655 return SendMsg(2355, 0, 0) != 0;
2658 // Make the end of line characters visible or invisible.
2659 void wxStyledTextCtrl::SetViewEOL(bool visible
)
2661 SendMsg(2356, visible
, 0);
2664 // Retrieve a pointer to the document object.
2665 void* wxStyledTextCtrl::GetDocPointer() {
2666 return (void*)SendMsg(2357);
2669 // Change the document object used.
2670 void wxStyledTextCtrl::SetDocPointer(void* docPointer
) {
2671 SendMsg(2358, 0, (sptr_t
)docPointer
);
2674 // Set which document modification events are sent to the container.
2675 void wxStyledTextCtrl::SetModEventMask(int mask
)
2677 SendMsg(2359, mask
, 0);
2680 // Retrieve the column number which text should be kept within.
2681 int wxStyledTextCtrl::GetEdgeColumn() const
2683 return SendMsg(2360, 0, 0);
2686 // Set the column number of the edge.
2687 // If text goes past the edge then it is highlighted.
2688 void wxStyledTextCtrl::SetEdgeColumn(int column
)
2690 SendMsg(2361, column
, 0);
2693 // Retrieve the edge highlight mode.
2694 int wxStyledTextCtrl::GetEdgeMode() const
2696 return SendMsg(2362, 0, 0);
2699 // The edge may be displayed by a line (EDGE_LINE) or by highlighting text that
2700 // goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).
2701 void wxStyledTextCtrl::SetEdgeMode(int mode
)
2703 SendMsg(2363, mode
, 0);
2706 // Retrieve the colour used in edge indication.
2707 wxColour
wxStyledTextCtrl::GetEdgeColour() const
2709 long c
= SendMsg(2364, 0, 0);
2710 return wxColourFromLong(c
);
2713 // Change the colour used in edge indication.
2714 void wxStyledTextCtrl::SetEdgeColour(const wxColour
& edgeColour
)
2716 SendMsg(2365, wxColourAsLong(edgeColour
), 0);
2719 // Sets the current caret position to be the search anchor.
2720 void wxStyledTextCtrl::SearchAnchor()
2722 SendMsg(2366, 0, 0);
2725 // Find some text starting at the search anchor.
2726 // Does not ensure the selection is visible.
2727 int wxStyledTextCtrl::SearchNext(int flags
, const wxString
& text
)
2729 return SendMsg(2367, flags
, (sptr_t
)(const char*)wx2stc(text
));
2732 // Find some text starting at the search anchor and moving backwards.
2733 // Does not ensure the selection is visible.
2734 int wxStyledTextCtrl::SearchPrev(int flags
, const wxString
& text
)
2736 return SendMsg(2368, flags
, (sptr_t
)(const char*)wx2stc(text
));
2739 // Retrieves the number of lines completely visible.
2740 int wxStyledTextCtrl::LinesOnScreen() const
2742 return SendMsg(2370, 0, 0);
2745 // Set whether a pop up menu is displayed automatically when the user presses
2746 // the wrong mouse button.
2747 void wxStyledTextCtrl::UsePopUp(bool allowPopUp
)
2749 SendMsg(2371, allowPopUp
, 0);
2752 // Is the selection rectangular? The alternative is the more common stream selection.
2753 bool wxStyledTextCtrl::SelectionIsRectangle() const
2755 return SendMsg(2372, 0, 0) != 0;
2758 // Set the zoom level. This number of points is added to the size of all fonts.
2759 // It may be positive to magnify or negative to reduce.
2760 void wxStyledTextCtrl::SetZoom(int zoom
)
2762 SendMsg(2373, zoom
, 0);
2765 // Retrieve the zoom level.
2766 int wxStyledTextCtrl::GetZoom() const
2768 return SendMsg(2374, 0, 0);
2771 // Create a new document object.
2772 // Starts with reference count of 1 and not selected into editor.
2773 void* wxStyledTextCtrl::CreateDocument() {
2774 return (void*)SendMsg(2375);
2777 // Extend life of document.
2778 void wxStyledTextCtrl::AddRefDocument(void* docPointer
) {
2779 SendMsg(2376, 0, (sptr_t
)docPointer
);
2782 // Release a reference to the document, deleting document if it fades to black.
2783 void wxStyledTextCtrl::ReleaseDocument(void* docPointer
) {
2784 SendMsg(2377, 0, (sptr_t
)docPointer
);
2787 // Get which document modification events are sent to the container.
2788 int wxStyledTextCtrl::GetModEventMask() const
2790 return SendMsg(2378, 0, 0);
2793 // Change internal focus flag.
2794 void wxStyledTextCtrl::SetSTCFocus(bool focus
)
2796 SendMsg(2380, focus
, 0);
2799 // Get internal focus flag.
2800 bool wxStyledTextCtrl::GetSTCFocus() const
2802 return SendMsg(2381, 0, 0) != 0;
2805 // Change error status - 0 = OK.
2806 void wxStyledTextCtrl::SetStatus(int statusCode
)
2808 SendMsg(2382, statusCode
, 0);
2811 // Get error status.
2812 int wxStyledTextCtrl::GetStatus() const
2814 return SendMsg(2383, 0, 0);
2817 // Set whether the mouse is captured when its button is pressed.
2818 void wxStyledTextCtrl::SetMouseDownCaptures(bool captures
)
2820 SendMsg(2384, captures
, 0);
2823 // Get whether mouse gets captured.
2824 bool wxStyledTextCtrl::GetMouseDownCaptures() const
2826 return SendMsg(2385, 0, 0) != 0;
2829 // Sets the cursor to one of the SC_CURSOR* values.
2830 void wxStyledTextCtrl::SetSTCCursor(int cursorType
)
2832 SendMsg(2386, cursorType
, 0);
2836 int wxStyledTextCtrl::GetSTCCursor() const
2838 return SendMsg(2387, 0, 0);
2841 // Change the way control characters are displayed:
2842 // If symbol is < 32, keep the drawn way, else, use the given character.
2843 void wxStyledTextCtrl::SetControlCharSymbol(int symbol
)
2845 SendMsg(2388, symbol
, 0);
2848 // Get the way control characters are displayed.
2849 int wxStyledTextCtrl::GetControlCharSymbol() const
2851 return SendMsg(2389, 0, 0);
2854 // Move to the previous change in capitalisation.
2855 void wxStyledTextCtrl::WordPartLeft()
2857 SendMsg(2390, 0, 0);
2860 // Move to the previous change in capitalisation extending selection
2861 // to new caret position.
2862 void wxStyledTextCtrl::WordPartLeftExtend()
2864 SendMsg(2391, 0, 0);
2867 // Move to the change next in capitalisation.
2868 void wxStyledTextCtrl::WordPartRight()
2870 SendMsg(2392, 0, 0);
2873 // Move to the next change in capitalisation extending selection
2874 // to new caret position.
2875 void wxStyledTextCtrl::WordPartRightExtend()
2877 SendMsg(2393, 0, 0);
2880 // Set the way the display area is determined when a particular line
2881 // is to be moved to by Find, FindNext, GotoLine, etc.
2882 void wxStyledTextCtrl::SetVisiblePolicy(int visiblePolicy
, int visibleSlop
)
2884 SendMsg(2394, visiblePolicy
, visibleSlop
);
2887 // Delete back from the current position to the start of the line.
2888 void wxStyledTextCtrl::DelLineLeft()
2890 SendMsg(2395, 0, 0);
2893 // Delete forwards from the current position to the end of the line.
2894 void wxStyledTextCtrl::DelLineRight()
2896 SendMsg(2396, 0, 0);
2899 // Get and Set the xOffset (ie, horizontal scroll position).
2900 void wxStyledTextCtrl::SetXOffset(int newOffset
)
2902 SendMsg(2397, newOffset
, 0);
2904 int wxStyledTextCtrl::GetXOffset() const
2906 return SendMsg(2398, 0, 0);
2909 // Set the last x chosen value to be the caret x position.
2910 void wxStyledTextCtrl::ChooseCaretX()
2912 SendMsg(2399, 0, 0);
2915 // Set the way the caret is kept visible when going sideways.
2916 // The exclusion zone is given in pixels.
2917 void wxStyledTextCtrl::SetXCaretPolicy(int caretPolicy
, int caretSlop
)
2919 SendMsg(2402, caretPolicy
, caretSlop
);
2922 // Set the way the line the caret is on is kept visible.
2923 // The exclusion zone is given in lines.
2924 void wxStyledTextCtrl::SetYCaretPolicy(int caretPolicy
, int caretSlop
)
2926 SendMsg(2403, caretPolicy
, caretSlop
);
2929 // Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE).
2930 void wxStyledTextCtrl::SetPrintWrapMode(int mode
)
2932 SendMsg(2406, mode
, 0);
2935 // Is printing line wrapped?
2936 int wxStyledTextCtrl::GetPrintWrapMode() const
2938 return SendMsg(2407, 0, 0);
2941 // Set a fore colour for active hotspots.
2942 void wxStyledTextCtrl::SetHotspotActiveForeground(bool useSetting
, const wxColour
& fore
)
2944 SendMsg(2410, useSetting
, wxColourAsLong(fore
));
2947 // Get the fore colour for active hotspots.
2948 wxColour
wxStyledTextCtrl::GetHotspotActiveForeground() const
2950 long c
= SendMsg(2494, 0, 0);
2951 return wxColourFromLong(c
);
2954 // Set a back colour for active hotspots.
2955 void wxStyledTextCtrl::SetHotspotActiveBackground(bool useSetting
, const wxColour
& back
)
2957 SendMsg(2411, useSetting
, wxColourAsLong(back
));
2960 // Get the back colour for active hotspots.
2961 wxColour
wxStyledTextCtrl::GetHotspotActiveBackground() const
2963 long c
= SendMsg(2495, 0, 0);
2964 return wxColourFromLong(c
);
2967 // Enable / Disable underlining active hotspots.
2968 void wxStyledTextCtrl::SetHotspotActiveUnderline(bool underline
)
2970 SendMsg(2412, underline
, 0);
2973 // Get whether underlining for active hotspots.
2974 bool wxStyledTextCtrl::GetHotspotActiveUnderline() const
2976 return SendMsg(2496, 0, 0) != 0;
2979 // Limit hotspots to single line so hotspots on two lines don't merge.
2980 void wxStyledTextCtrl::SetHotspotSingleLine(bool singleLine
)
2982 SendMsg(2421, singleLine
, 0);
2985 // Get the HotspotSingleLine property
2986 bool wxStyledTextCtrl::GetHotspotSingleLine() const
2988 return SendMsg(2497, 0, 0) != 0;
2991 // Move caret between paragraphs (delimited by empty lines).
2992 void wxStyledTextCtrl::ParaDown()
2994 SendMsg(2413, 0, 0);
2996 void wxStyledTextCtrl::ParaDownExtend()
2998 SendMsg(2414, 0, 0);
3000 void wxStyledTextCtrl::ParaUp()
3002 SendMsg(2415, 0, 0);
3004 void wxStyledTextCtrl::ParaUpExtend()
3006 SendMsg(2416, 0, 0);
3009 // Given a valid document position, return the previous position taking code
3010 // page into account. Returns 0 if passed 0.
3011 int wxStyledTextCtrl::PositionBefore(int pos
)
3013 return SendMsg(2417, pos
, 0);
3016 // Given a valid document position, return the next position taking code
3017 // page into account. Maximum value returned is the last position in the document.
3018 int wxStyledTextCtrl::PositionAfter(int pos
)
3020 return SendMsg(2418, pos
, 0);
3023 // Copy a range of text to the clipboard. Positions are clipped into the document.
3024 void wxStyledTextCtrl::CopyRange(int start
, int end
)
3026 SendMsg(2419, start
, end
);
3029 // Copy argument text to the clipboard.
3030 void wxStyledTextCtrl::CopyText(int length
, const wxString
& text
)
3032 SendMsg(2420, length
, (sptr_t
)(const char*)wx2stc(text
));
3035 // Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE/SC_SEL_THIN) or
3036 // by lines (SC_SEL_LINES).
3037 void wxStyledTextCtrl::SetSelectionMode(int mode
)
3039 SendMsg(2422, mode
, 0);
3042 // Get the mode of the current selection.
3043 int wxStyledTextCtrl::GetSelectionMode() const
3045 return SendMsg(2423, 0, 0);
3048 // Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line).
3049 int wxStyledTextCtrl::GetLineSelStartPosition(int line
)
3051 return SendMsg(2424, line
, 0);
3054 // Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line).
3055 int wxStyledTextCtrl::GetLineSelEndPosition(int line
)
3057 return SendMsg(2425, line
, 0);
3060 // Move caret down one line, extending rectangular selection to new caret position.
3061 void wxStyledTextCtrl::LineDownRectExtend()
3063 SendMsg(2426, 0, 0);
3066 // Move caret up one line, extending rectangular selection to new caret position.
3067 void wxStyledTextCtrl::LineUpRectExtend()
3069 SendMsg(2427, 0, 0);
3072 // Move caret left one character, extending rectangular selection to new caret position.
3073 void wxStyledTextCtrl::CharLeftRectExtend()
3075 SendMsg(2428, 0, 0);
3078 // Move caret right one character, extending rectangular selection to new caret position.
3079 void wxStyledTextCtrl::CharRightRectExtend()
3081 SendMsg(2429, 0, 0);
3084 // Move caret to first position on line, extending rectangular selection to new caret position.
3085 void wxStyledTextCtrl::HomeRectExtend()
3087 SendMsg(2430, 0, 0);
3090 // Move caret to before first visible character on line.
3091 // If already there move to first character on line.
3092 // In either case, extend rectangular selection to new caret position.
3093 void wxStyledTextCtrl::VCHomeRectExtend()
3095 SendMsg(2431, 0, 0);
3098 // Move caret to last position on line, extending rectangular selection to new caret position.
3099 void wxStyledTextCtrl::LineEndRectExtend()
3101 SendMsg(2432, 0, 0);
3104 // Move caret one page up, extending rectangular selection to new caret position.
3105 void wxStyledTextCtrl::PageUpRectExtend()
3107 SendMsg(2433, 0, 0);
3110 // Move caret one page down, extending rectangular selection to new caret position.
3111 void wxStyledTextCtrl::PageDownRectExtend()
3113 SendMsg(2434, 0, 0);
3116 // Move caret to top of page, or one page up if already at top of page.
3117 void wxStyledTextCtrl::StutteredPageUp()
3119 SendMsg(2435, 0, 0);
3122 // Move caret to top of page, or one page up if already at top of page, extending selection to new caret position.
3123 void wxStyledTextCtrl::StutteredPageUpExtend()
3125 SendMsg(2436, 0, 0);
3128 // Move caret to bottom of page, or one page down if already at bottom of page.
3129 void wxStyledTextCtrl::StutteredPageDown()
3131 SendMsg(2437, 0, 0);
3134 // Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position.
3135 void wxStyledTextCtrl::StutteredPageDownExtend()
3137 SendMsg(2438, 0, 0);
3140 // Move caret left one word, position cursor at end of word.
3141 void wxStyledTextCtrl::WordLeftEnd()
3143 SendMsg(2439, 0, 0);
3146 // Move caret left one word, position cursor at end of word, extending selection to new caret position.
3147 void wxStyledTextCtrl::WordLeftEndExtend()
3149 SendMsg(2440, 0, 0);
3152 // Move caret right one word, position cursor at end of word.
3153 void wxStyledTextCtrl::WordRightEnd()
3155 SendMsg(2441, 0, 0);
3158 // Move caret right one word, position cursor at end of word, extending selection to new caret position.
3159 void wxStyledTextCtrl::WordRightEndExtend()
3161 SendMsg(2442, 0, 0);
3164 // Set the set of characters making up whitespace for when moving or selecting by word.
3165 // Should be called after SetWordChars.
3166 void wxStyledTextCtrl::SetWhitespaceChars(const wxString
& characters
)
3168 SendMsg(2443, 0, (sptr_t
)(const char*)wx2stc(characters
));
3171 // Get the set of characters making up whitespace for when moving or selecting by word.
3172 wxString
wxStyledTextCtrl::GetWhitespaceChars() const {
3174 int len
= SendMsg(msg
, 0, (sptr_t
)NULL
);
3175 if (!len
) return wxEmptyString
;
3177 wxMemoryBuffer
mbuf(len
+1);
3178 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3179 SendMsg(msg
, 0, (sptr_t
)buf
);
3180 mbuf
.UngetWriteBuf(len
);
3185 // Set the set of characters making up punctuation characters
3186 // Should be called after SetWordChars.
3187 void wxStyledTextCtrl::SetPunctuationChars(const wxString
& characters
)
3189 SendMsg(2648, 0, (sptr_t
)(const char*)wx2stc(characters
));
3192 // Get the set of characters making up punctuation characters
3193 wxString
wxStyledTextCtrl::GetPunctuationChars() const {
3195 int len
= SendMsg(msg
, 0, (sptr_t
)NULL
);
3196 if (!len
) return wxEmptyString
;
3198 wxMemoryBuffer
mbuf(len
+1);
3199 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3200 SendMsg(msg
, 0, (sptr_t
)buf
);
3201 mbuf
.UngetWriteBuf(len
);
3206 // Reset the set of characters for whitespace and word characters to the defaults.
3207 void wxStyledTextCtrl::SetCharsDefault()
3209 SendMsg(2444, 0, 0);
3212 // Get currently selected item position in the auto-completion list
3213 int wxStyledTextCtrl::AutoCompGetCurrent() const
3215 return SendMsg(2445, 0, 0);
3218 // Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference.
3219 void wxStyledTextCtrl::AutoCompSetCaseInsensitiveBehaviour(int behaviour
)
3221 SendMsg(2634, behaviour
, 0);
3224 // Get auto-completion case insensitive behaviour.
3225 int wxStyledTextCtrl::AutoCompGetCaseInsensitiveBehaviour() const
3227 return SendMsg(2635, 0, 0);
3230 // Enlarge the document to a particular size of text bytes.
3231 void wxStyledTextCtrl::Allocate(int bytes
)
3233 SendMsg(2446, bytes
, 0);
3236 // Find the position of a column on a line taking into account tabs and
3237 // multi-byte characters. If beyond end of line, return line end position.
3238 int wxStyledTextCtrl::FindColumn(int line
, int column
)
3240 return SendMsg(2456, line
, column
);
3243 // Can the caret preferred x position only be changed by explicit movement commands?
3244 int wxStyledTextCtrl::GetCaretSticky() const
3246 return SendMsg(2457, 0, 0);
3249 // Stop the caret preferred x position changing when the user types.
3250 void wxStyledTextCtrl::SetCaretSticky(int useCaretStickyBehaviour
)
3252 SendMsg(2458, useCaretStickyBehaviour
, 0);
3255 // Switch between sticky and non-sticky: meant to be bound to a key.
3256 void wxStyledTextCtrl::ToggleCaretSticky()
3258 SendMsg(2459, 0, 0);
3261 // Enable/Disable convert-on-paste for line endings
3262 void wxStyledTextCtrl::SetPasteConvertEndings(bool convert
)
3264 SendMsg(2467, convert
, 0);
3267 // Get convert-on-paste setting
3268 bool wxStyledTextCtrl::GetPasteConvertEndings() const
3270 return SendMsg(2468, 0, 0) != 0;
3273 // Duplicate the selection. If selection empty duplicate the line containing the caret.
3274 void wxStyledTextCtrl::SelectionDuplicate()
3276 SendMsg(2469, 0, 0);
3279 // Set background alpha of the caret line.
3280 void wxStyledTextCtrl::SetCaretLineBackAlpha(int alpha
)
3282 SendMsg(2470, alpha
, 0);
3285 // Get the background alpha of the caret line.
3286 int wxStyledTextCtrl::GetCaretLineBackAlpha() const
3288 return SendMsg(2471, 0, 0);
3291 // Set the style of the caret to be drawn.
3292 void wxStyledTextCtrl::SetCaretStyle(int caretStyle
)
3294 SendMsg(2512, caretStyle
, 0);
3297 // Returns the current style of the caret.
3298 int wxStyledTextCtrl::GetCaretStyle() const
3300 return SendMsg(2513, 0, 0);
3303 // Set the indicator used for IndicatorFillRange and IndicatorClearRange
3304 void wxStyledTextCtrl::SetIndicatorCurrent(int indicator
)
3306 SendMsg(2500, indicator
, 0);
3309 // Get the current indicator
3310 int wxStyledTextCtrl::GetIndicatorCurrent() const
3312 return SendMsg(2501, 0, 0);
3315 // Set the value used for IndicatorFillRange
3316 void wxStyledTextCtrl::SetIndicatorValue(int value
)
3318 SendMsg(2502, value
, 0);
3321 // Get the current indicator value
3322 int wxStyledTextCtrl::GetIndicatorValue() const
3324 return SendMsg(2503, 0, 0);
3327 // Turn a indicator on over a range.
3328 void wxStyledTextCtrl::IndicatorFillRange(int position
, int fillLength
)
3330 SendMsg(2504, position
, fillLength
);
3333 // Turn a indicator off over a range.
3334 void wxStyledTextCtrl::IndicatorClearRange(int position
, int clearLength
)
3336 SendMsg(2505, position
, clearLength
);
3339 // Are any indicators present at position?
3340 int wxStyledTextCtrl::IndicatorAllOnFor(int position
)
3342 return SendMsg(2506, position
, 0);
3345 // What value does a particular indicator have at at a position?
3346 int wxStyledTextCtrl::IndicatorValueAt(int indicator
, int position
)
3348 return SendMsg(2507, indicator
, position
);
3351 // Where does a particular indicator start?
3352 int wxStyledTextCtrl::IndicatorStart(int indicator
, int position
)
3354 return SendMsg(2508, indicator
, position
);
3357 // Where does a particular indicator end?
3358 int wxStyledTextCtrl::IndicatorEnd(int indicator
, int position
)
3360 return SendMsg(2509, indicator
, position
);
3363 // Set number of entries in position cache
3364 void wxStyledTextCtrl::SetPositionCacheSize(int size
)
3366 SendMsg(2514, size
, 0);
3369 // How many entries are allocated to the position cache?
3370 int wxStyledTextCtrl::GetPositionCacheSize() const
3372 return SendMsg(2515, 0, 0);
3375 // Copy the selection, if selection empty copy the line with the caret
3376 void wxStyledTextCtrl::CopyAllowLine()
3378 SendMsg(2519, 0, 0);
3381 // Compact the document buffer and return a read-only pointer to the
3382 // characters in the document.
3383 const char* wxStyledTextCtrl::GetCharacterPointer() const {
3384 return (const char*)SendMsg(2520, 0, 0);
3387 // Return a read-only pointer to a range of characters in the document.
3388 // May move the gap so that the range is contiguous, but will only move up
3389 // to rangeLength bytes.
3390 const char* wxStyledTextCtrl::GetRangePointer(int position
, int rangeLength
) const {
3391 return (const char*)SendMsg(2643, position
, rangeLength
);
3394 // Return a position which, to avoid performance costs, should not be within
3395 // the range of a call to GetRangePointer.
3396 int wxStyledTextCtrl::GetGapPosition() const
3398 return SendMsg(2644, 0, 0);
3401 // Always interpret keyboard input as Unicode
3402 void wxStyledTextCtrl::SetKeysUnicode(bool keysUnicode
)
3404 SendMsg(2521, keysUnicode
, 0);
3407 // Are keys always interpreted as Unicode?
3408 bool wxStyledTextCtrl::GetKeysUnicode() const
3410 return SendMsg(2522, 0, 0) != 0;
3413 // Set the alpha fill colour of the given indicator.
3414 void wxStyledTextCtrl::IndicatorSetAlpha(int indicator
, int alpha
)
3416 SendMsg(2523, indicator
, alpha
);
3419 // Get the alpha fill colour of the given indicator.
3420 int wxStyledTextCtrl::IndicatorGetAlpha(int indicator
) const
3422 return SendMsg(2524, indicator
, 0);
3425 // Set the alpha outline colour of the given indicator.
3426 void wxStyledTextCtrl::IndicatorSetOutlineAlpha(int indicator
, int alpha
)
3428 SendMsg(2558, indicator
, alpha
);
3431 // Get the alpha outline colour of the given indicator.
3432 int wxStyledTextCtrl::IndicatorGetOutlineAlpha(int indicator
) const
3434 return SendMsg(2559, indicator
, 0);
3437 // Set extra ascent for each line
3438 void wxStyledTextCtrl::SetExtraAscent(int extraAscent
)
3440 SendMsg(2525, extraAscent
, 0);
3443 // Get extra ascent for each line
3444 int wxStyledTextCtrl::GetExtraAscent() const
3446 return SendMsg(2526, 0, 0);
3449 // Set extra descent for each line
3450 void wxStyledTextCtrl::SetExtraDescent(int extraDescent
)
3452 SendMsg(2527, extraDescent
, 0);
3455 // Get extra descent for each line
3456 int wxStyledTextCtrl::GetExtraDescent() const
3458 return SendMsg(2528, 0, 0);
3461 // Which symbol was defined for markerNumber with MarkerDefine
3462 int wxStyledTextCtrl::GetMarkerSymbolDefined(int markerNumber
)
3464 return SendMsg(2529, markerNumber
, 0);
3467 // Set the text in the text margin for a line
3468 void wxStyledTextCtrl::MarginSetText(int line
, const wxString
& text
)
3470 SendMsg(2530, line
, (sptr_t
)(const char*)wx2stc(text
));
3473 // Get the text in the text margin for a line
3474 wxString
wxStyledTextCtrl::MarginGetText(int line
) const {
3476 long len
= SendMsg(msg
, line
, 0);
3478 wxMemoryBuffer
mbuf(len
+1);
3479 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3480 SendMsg(msg
, line
, (sptr_t
)buf
);
3481 mbuf
.UngetWriteBuf(len
);
3486 // Set the style number for the text margin for a line
3487 void wxStyledTextCtrl::MarginSetStyle(int line
, int style
)
3489 SendMsg(2532, line
, style
);
3492 // Get the style number for the text margin for a line
3493 int wxStyledTextCtrl::MarginGetStyle(int line
) const
3495 return SendMsg(2533, line
, 0);
3498 // Set the style in the text margin for a line
3499 void wxStyledTextCtrl::MarginSetStyles(int line
, const wxString
& styles
)
3501 SendMsg(2534, line
, (sptr_t
)(const char*)wx2stc(styles
));
3504 // Get the styles in the text margin for a line
3505 wxString
wxStyledTextCtrl::MarginGetStyles(int line
) const {
3507 long len
= SendMsg(msg
, line
, 0);
3509 wxMemoryBuffer
mbuf(len
+1);
3510 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3511 SendMsg(msg
, line
, (sptr_t
)buf
);
3512 mbuf
.UngetWriteBuf(len
);
3517 // Clear the margin text on all lines
3518 void wxStyledTextCtrl::MarginTextClearAll()
3520 SendMsg(2536, 0, 0);
3523 // Get the start of the range of style numbers used for margin text
3524 void wxStyledTextCtrl::MarginSetStyleOffset(int style
)
3526 SendMsg(2537, style
, 0);
3529 // Get the start of the range of style numbers used for margin text
3530 int wxStyledTextCtrl::MarginGetStyleOffset() const
3532 return SendMsg(2538, 0, 0);
3535 // Set the margin options.
3536 void wxStyledTextCtrl::SetMarginOptions(int marginOptions
)
3538 SendMsg(2539, marginOptions
, 0);
3541 // Get the margin options.
3542 int wxStyledTextCtrl::GetMarginOptions() const
3544 return SendMsg(2557, 0, 0);
3547 // Set the annotation text for a line
3548 void wxStyledTextCtrl::AnnotationSetText(int line
, const wxString
& text
)
3550 SendMsg(2540, line
, (sptr_t
)(const char*)wx2stc(text
));
3553 // Get the annotation text for a line
3554 wxString
wxStyledTextCtrl::AnnotationGetText(int line
) const {
3556 long len
= SendMsg(msg
, line
, 0);
3558 wxMemoryBuffer
mbuf(len
+1);
3559 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3560 SendMsg(msg
, line
, (sptr_t
)buf
);
3561 mbuf
.UngetWriteBuf(len
);
3566 // Set the style number for the annotations for a line
3567 void wxStyledTextCtrl::AnnotationSetStyle(int line
, int style
)
3569 SendMsg(2542, line
, style
);
3572 // Get the style number for the annotations for a line
3573 int wxStyledTextCtrl::AnnotationGetStyle(int line
) const
3575 return SendMsg(2543, line
, 0);
3578 // Set the annotation styles for a line
3579 void wxStyledTextCtrl::AnnotationSetStyles(int line
, const wxString
& styles
)
3581 SendMsg(2544, line
, (sptr_t
)(const char*)wx2stc(styles
));
3584 // Get the annotation styles for a line
3585 wxString
wxStyledTextCtrl::AnnotationGetStyles(int line
) const {
3587 long len
= SendMsg(msg
, line
, 0);
3589 wxMemoryBuffer
mbuf(len
+1);
3590 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3591 SendMsg(msg
, line
, (sptr_t
)buf
);
3592 mbuf
.UngetWriteBuf(len
);
3597 // Get the number of annotation lines for a line
3598 int wxStyledTextCtrl::AnnotationGetLines(int line
) const
3600 return SendMsg(2546, line
, 0);
3603 // Clear the annotations from all lines
3604 void wxStyledTextCtrl::AnnotationClearAll()
3606 SendMsg(2547, 0, 0);
3609 // Set the visibility for the annotations for a view
3610 void wxStyledTextCtrl::AnnotationSetVisible(int visible
)
3612 SendMsg(2548, visible
, 0);
3615 // Get the visibility for the annotations for a view
3616 int wxStyledTextCtrl::AnnotationGetVisible() const
3618 return SendMsg(2549, 0, 0);
3621 // Get the start of the range of style numbers used for annotations
3622 void wxStyledTextCtrl::AnnotationSetStyleOffset(int style
)
3624 SendMsg(2550, style
, 0);
3627 // Get the start of the range of style numbers used for annotations
3628 int wxStyledTextCtrl::AnnotationGetStyleOffset() const
3630 return SendMsg(2551, 0, 0);
3633 // Add a container action to the undo stack
3634 void wxStyledTextCtrl::AddUndoAction(int token
, int flags
)
3636 SendMsg(2560, token
, flags
);
3639 // Find the position of a character from a point within the window.
3640 int wxStyledTextCtrl::CharPositionFromPoint(int x
, int y
)
3642 return SendMsg(2561, x
, y
);
3645 // Find the position of a character from a point within the window.
3646 // Return INVALID_POSITION if not close to text.
3647 int wxStyledTextCtrl::CharPositionFromPointClose(int x
, int y
)
3649 return SendMsg(2562, x
, y
);
3652 // Set whether multiple selections can be made
3653 void wxStyledTextCtrl::SetMultipleSelection(bool multipleSelection
)
3655 SendMsg(2563, multipleSelection
, 0);
3658 // Whether multiple selections can be made
3659 bool wxStyledTextCtrl::GetMultipleSelection() const
3661 return SendMsg(2564, 0, 0) != 0;
3664 // Set whether typing can be performed into multiple selections
3665 void wxStyledTextCtrl::SetAdditionalSelectionTyping(bool additionalSelectionTyping
)
3667 SendMsg(2565, additionalSelectionTyping
, 0);
3670 // Whether typing can be performed into multiple selections
3671 bool wxStyledTextCtrl::GetAdditionalSelectionTyping() const
3673 return SendMsg(2566, 0, 0) != 0;
3676 // Set whether additional carets will blink
3677 void wxStyledTextCtrl::SetAdditionalCaretsBlink(bool additionalCaretsBlink
)
3679 SendMsg(2567, additionalCaretsBlink
, 0);
3682 // Whether additional carets will blink
3683 bool wxStyledTextCtrl::GetAdditionalCaretsBlink() const
3685 return SendMsg(2568, 0, 0) != 0;
3688 // Set whether additional carets are visible
3689 void wxStyledTextCtrl::SetAdditionalCaretsVisible(bool additionalCaretsBlink
)
3691 SendMsg(2608, additionalCaretsBlink
, 0);
3694 // Whether additional carets are visible
3695 bool wxStyledTextCtrl::GetAdditionalCaretsVisible() const
3697 return SendMsg(2609, 0, 0) != 0;
3700 // How many selections are there?
3701 int wxStyledTextCtrl::GetSelections() const
3703 return SendMsg(2570, 0, 0);
3706 // Clear selections to a single empty stream selection
3707 void wxStyledTextCtrl::ClearSelections()
3709 SendMsg(2571, 0, 0);
3713 int wxStyledTextCtrl::AddSelection(int caret
, int anchor
)
3715 return SendMsg(2573, caret
, anchor
);
3718 // Set the main selection
3719 void wxStyledTextCtrl::SetMainSelection(int selection
)
3721 SendMsg(2574, selection
, 0);
3724 // Which selection is the main selection
3725 int wxStyledTextCtrl::GetMainSelection() const
3727 return SendMsg(2575, 0, 0);
3729 void wxStyledTextCtrl::SetSelectionNCaret(int selection
, int pos
)
3731 SendMsg(2576, selection
, pos
);
3733 int wxStyledTextCtrl::GetSelectionNCaret(int selection
) const
3735 return SendMsg(2577, selection
, 0);
3737 void wxStyledTextCtrl::SetSelectionNAnchor(int selection
, int posAnchor
)
3739 SendMsg(2578, selection
, posAnchor
);
3741 int wxStyledTextCtrl::GetSelectionNAnchor(int selection
) const
3743 return SendMsg(2579, selection
, 0);
3745 void wxStyledTextCtrl::SetSelectionNCaretVirtualSpace(int selection
, int space
)
3747 SendMsg(2580, selection
, space
);
3749 int wxStyledTextCtrl::GetSelectionNCaretVirtualSpace(int selection
) const
3751 return SendMsg(2581, selection
, 0);
3753 void wxStyledTextCtrl::SetSelectionNAnchorVirtualSpace(int selection
, int space
)
3755 SendMsg(2582, selection
, space
);
3757 int wxStyledTextCtrl::GetSelectionNAnchorVirtualSpace(int selection
) const
3759 return SendMsg(2583, selection
, 0);
3762 // Sets the position that starts the selection - this becomes the anchor.
3763 void wxStyledTextCtrl::SetSelectionNStart(int selection
, int pos
)
3765 SendMsg(2584, selection
, pos
);
3768 // Returns the position at the start of the selection.
3769 int wxStyledTextCtrl::GetSelectionNStart(int selection
) const
3771 return SendMsg(2585, selection
, 0);
3774 // Sets the position that ends the selection - this becomes the currentPosition.
3775 void wxStyledTextCtrl::SetSelectionNEnd(int selection
, int pos
)
3777 SendMsg(2586, selection
, pos
);
3780 // Returns the position at the end of the selection.
3781 int wxStyledTextCtrl::GetSelectionNEnd(int selection
) const
3783 return SendMsg(2587, selection
, 0);
3785 void wxStyledTextCtrl::SetRectangularSelectionCaret(int pos
)
3787 SendMsg(2588, pos
, 0);
3789 int wxStyledTextCtrl::GetRectangularSelectionCaret() const
3791 return SendMsg(2589, 0, 0);
3793 void wxStyledTextCtrl::SetRectangularSelectionAnchor(int posAnchor
)
3795 SendMsg(2590, posAnchor
, 0);
3797 int wxStyledTextCtrl::GetRectangularSelectionAnchor() const
3799 return SendMsg(2591, 0, 0);
3801 void wxStyledTextCtrl::SetRectangularSelectionCaretVirtualSpace(int space
)
3803 SendMsg(2592, space
, 0);
3805 int wxStyledTextCtrl::GetRectangularSelectionCaretVirtualSpace() const
3807 return SendMsg(2593, 0, 0);
3809 void wxStyledTextCtrl::SetRectangularSelectionAnchorVirtualSpace(int space
)
3811 SendMsg(2594, space
, 0);
3813 int wxStyledTextCtrl::GetRectangularSelectionAnchorVirtualSpace() const
3815 return SendMsg(2595, 0, 0);
3817 void wxStyledTextCtrl::SetVirtualSpaceOptions(int virtualSpaceOptions
)
3819 SendMsg(2596, virtualSpaceOptions
, 0);
3821 int wxStyledTextCtrl::GetVirtualSpaceOptions() const
3823 return SendMsg(2597, 0, 0);
3826 // On GTK+, allow selecting the modifier key to use for mouse-based
3827 // rectangular selection. Often the window manager requires Alt+Mouse Drag
3828 // for moving windows.
3829 // Valid values are SCMOD_CTRL(default), SCMOD_ALT, or SCMOD_SUPER.
3830 void wxStyledTextCtrl::SetRectangularSelectionModifier(int modifier
)
3832 SendMsg(2598, modifier
, 0);
3835 // Get the modifier key used for rectangular selection.
3836 int wxStyledTextCtrl::GetRectangularSelectionModifier() const
3838 return SendMsg(2599, 0, 0);
3841 // Set the foreground colour of additional selections.
3842 // Must have previously called SetSelFore with non-zero first argument for this to have an effect.
3843 void wxStyledTextCtrl::SetAdditionalSelForeground(const wxColour
& fore
)
3845 SendMsg(2600, wxColourAsLong(fore
), 0);
3848 // Set the background colour of additional selections.
3849 // Must have previously called SetSelBack with non-zero first argument for this to have an effect.
3850 void wxStyledTextCtrl::SetAdditionalSelBackground(const wxColour
& back
)
3852 SendMsg(2601, wxColourAsLong(back
), 0);
3855 // Set the alpha of the selection.
3856 void wxStyledTextCtrl::SetAdditionalSelAlpha(int alpha
)
3858 SendMsg(2602, alpha
, 0);
3861 // Get the alpha of the selection.
3862 int wxStyledTextCtrl::GetAdditionalSelAlpha() const
3864 return SendMsg(2603, 0, 0);
3867 // Set the foreground colour of additional carets.
3868 void wxStyledTextCtrl::SetAdditionalCaretForeground(const wxColour
& fore
)
3870 SendMsg(2604, wxColourAsLong(fore
), 0);
3873 // Get the foreground colour of additional carets.
3874 wxColour
wxStyledTextCtrl::GetAdditionalCaretForeground() const
3876 long c
= SendMsg(2605, 0, 0);
3877 return wxColourFromLong(c
);
3880 // Set the main selection to the next selection.
3881 void wxStyledTextCtrl::RotateSelection()
3883 SendMsg(2606, 0, 0);
3886 // Swap that caret and anchor of the main selection.
3887 void wxStyledTextCtrl::SwapMainAnchorCaret()
3889 SendMsg(2607, 0, 0);
3892 // Indicate that the internal state of a lexer has changed over a range and therefore
3893 // there may be a need to redraw.
3894 int wxStyledTextCtrl::ChangeLexerState(int start
, int end
)
3896 return SendMsg(2617, start
, end
);
3899 // Find the next line at or after lineStart that is a contracted fold header line.
3900 // Return -1 when no more lines.
3901 int wxStyledTextCtrl::ContractedFoldNext(int lineStart
)
3903 return SendMsg(2618, lineStart
, 0);
3906 // Centre current line in window.
3907 void wxStyledTextCtrl::VerticalCentreCaret()
3909 SendMsg(2619, 0, 0);
3912 // Move the selected lines up one line, shifting the line above after the selection
3913 void wxStyledTextCtrl::MoveSelectedLinesUp()
3915 SendMsg(2620, 0, 0);
3918 // Move the selected lines down one line, shifting the line below before the selection
3919 void wxStyledTextCtrl::MoveSelectedLinesDown()
3921 SendMsg(2621, 0, 0);
3924 // Set the identifier reported as idFrom in notification messages.
3925 void wxStyledTextCtrl::SetIdentifier(int identifier
)
3927 SendMsg(2622, identifier
, 0);
3930 // Get the identifier.
3931 int wxStyledTextCtrl::GetIdentifier() const
3933 return SendMsg(2623, 0, 0);
3936 // Set the width for future RGBA image data.
3937 void wxStyledTextCtrl::RGBAImageSetWidth(int width
)
3939 SendMsg(2624, width
, 0);
3942 // Set the height for future RGBA image data.
3943 void wxStyledTextCtrl::RGBAImageSetHeight(int height
)
3945 SendMsg(2625, height
, 0);
3948 // Define a marker from RGBA data.
3949 // It has the width and height from RGBAImageSetWidth/Height
3950 void wxStyledTextCtrl::MarkerDefineRGBAImage(int markerNumber
, const unsigned char* pixels
) {
3951 SendMsg(2626, markerNumber
, (sptr_t
)pixels
);
3954 // Register an RGBA image for use in autocompletion lists.
3955 // It has the width and height from RGBAImageSetWidth/Height
3956 void wxStyledTextCtrl::RegisterRGBAImage(int type
, const unsigned char* pixels
) {
3957 SendMsg(2627, type
, (sptr_t
)pixels
);
3960 // Scroll to start of document.
3961 void wxStyledTextCtrl::ScrollToStart()
3963 SendMsg(2628, 0, 0);
3966 // Scroll to end of document.
3967 void wxStyledTextCtrl::ScrollToEnd()
3969 SendMsg(2629, 0, 0);
3972 // Set the technology used.
3973 void wxStyledTextCtrl::SetTechnology(int technology
)
3975 SendMsg(2630, technology
, 0);
3979 int wxStyledTextCtrl::GetTechnology() const
3981 return SendMsg(2631, 0, 0);
3984 // Create an ILoader*.
3985 void* wxStyledTextCtrl::CreateLoader(int bytes
) const {
3986 return (void*)(sptr_t
)SendMsg(2632, bytes
);
3989 // Start notifying the container of all key presses and commands.
3990 void wxStyledTextCtrl::StartRecord()
3992 SendMsg(3001, 0, 0);
3995 // Stop notifying the container of all key presses and commands.
3996 void wxStyledTextCtrl::StopRecord()
3998 SendMsg(3002, 0, 0);
4001 // Set the lexing language of the document.
4002 void wxStyledTextCtrl::SetLexer(int lexer
)
4004 SendMsg(4001, lexer
, 0);
4007 // Retrieve the lexing language of the document.
4008 int wxStyledTextCtrl::GetLexer() const
4010 return SendMsg(4002, 0, 0);
4013 // Colourise a segment of the document using the current lexing language.
4014 void wxStyledTextCtrl::Colourise(int start
, int end
)
4016 SendMsg(4003, start
, end
);
4019 // Set up a value that may be used by a lexer for some optional feature.
4020 void wxStyledTextCtrl::SetProperty(const wxString
& key
, const wxString
& value
)
4022 SendMsg(4004, (sptr_t
)(const char*)wx2stc(key
), (sptr_t
)(const char*)wx2stc(value
));
4025 // Set up the key words used by the lexer.
4026 void wxStyledTextCtrl::SetKeyWords(int keywordSet
, const wxString
& keyWords
)
4028 SendMsg(4005, keywordSet
, (sptr_t
)(const char*)wx2stc(keyWords
));
4031 // Set the lexing language of the document based on string name.
4032 void wxStyledTextCtrl::SetLexerLanguage(const wxString
& language
)
4034 SendMsg(4006, 0, (sptr_t
)(const char*)wx2stc(language
));
4037 // Retrieve a 'property' value previously set with SetProperty.
4038 wxString
wxStyledTextCtrl::GetProperty(const wxString
& key
) {
4039 int len
= SendMsg(SCI_GETPROPERTY
, (sptr_t
)(const char*)wx2stc(key
), 0);
4040 if (!len
) return wxEmptyString
;
4042 wxMemoryBuffer
mbuf(len
+1);
4043 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
4044 SendMsg(4008, (uptr_t
)(const char*)wx2stc(key
), (sptr_t
)buf
);
4045 mbuf
.UngetWriteBuf(len
);
4050 // Retrieve a 'property' value previously set with SetProperty,
4051 // with '$()' variable replacement on returned buffer.
4052 wxString
wxStyledTextCtrl::GetPropertyExpanded(const wxString
& key
) {
4053 int len
= SendMsg(SCI_GETPROPERTYEXPANDED
, (uptr_t
)(const char*)wx2stc(key
), 0);
4054 if (!len
) return wxEmptyString
;
4056 wxMemoryBuffer
mbuf(len
+1);
4057 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
4058 SendMsg(4009, (uptr_t
)(const char*)wx2stc(key
), (sptr_t
)buf
);
4059 mbuf
.UngetWriteBuf(len
);
4064 // Retrieve a 'property' value previously set with SetProperty,
4065 // interpreted as an int AFTER any '$()' variable replacement.
4066 int wxStyledTextCtrl::GetPropertyInt(const wxString
& key
) const
4068 return SendMsg(4010, (sptr_t
)(const char*)wx2stc(key
), 0);
4071 // Retrieve the number of bits the current lexer needs for styling.
4072 int wxStyledTextCtrl::GetStyleBitsNeeded() const
4074 return SendMsg(4011, 0, 0);
4077 // For private communication between an application and a known lexer.
4078 void* wxStyledTextCtrl::PrivateLexerCall(int operation
, void* pointer
) {
4079 return (void*)(sptr_t
)SendMsg(4013, operation
, (sptr_t
)pointer
);
4082 // Retrieve a '\n' separated list of properties understood by the current lexer.
4083 wxString
wxStyledTextCtrl::PropertyNames() const {
4085 int len
= SendMsg(msg
, 0, (sptr_t
)NULL
);
4086 if (!len
) return wxEmptyString
;
4088 wxMemoryBuffer
mbuf(len
+1);
4089 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
4090 SendMsg(msg
, 0, (sptr_t
)buf
);
4091 mbuf
.UngetWriteBuf(len
);
4096 // Retrieve the type of a property.
4097 int wxStyledTextCtrl::PropertyType(const wxString
& name
)
4099 return SendMsg(4015, (sptr_t
)(const char*)wx2stc(name
), 0);
4102 // Describe a property.
4103 wxString
wxStyledTextCtrl::DescribeProperty(const wxString
& name
) const {
4105 int len
= SendMsg(msg
, (sptr_t
)(const char*)wx2stc(name
), (sptr_t
)NULL
);
4106 if (!len
) return wxEmptyString
;
4108 wxMemoryBuffer
mbuf(len
+1);
4109 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
4110 SendMsg(msg
, (sptr_t
)(const char*)wx2stc(name
), (sptr_t
)buf
);
4111 mbuf
.UngetWriteBuf(len
);
4116 // Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer.
4117 wxString
wxStyledTextCtrl::DescribeKeyWordSets() const {
4119 int len
= SendMsg(msg
, 0, (sptr_t
)NULL
);
4120 if (!len
) return wxEmptyString
;
4122 wxMemoryBuffer
mbuf(len
+1);
4123 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
4124 SendMsg(msg
, 0, (sptr_t
)buf
);
4125 mbuf
.UngetWriteBuf(len
);
4131 //----------------------------------------------------------------------
4134 // Returns the line number of the line with the caret.
4135 int wxStyledTextCtrl::GetCurrentLine() {
4136 int line
= LineFromPosition(GetCurrentPos());
4141 // Extract style settings from a spec-string which is composed of one or
4142 // more of the following comma separated elements:
4144 // bold turns on bold
4145 // italic turns on italics
4146 // fore:[name or #RRGGBB] sets the foreground colour
4147 // back:[name or #RRGGBB] sets the background colour
4148 // face:[facename] sets the font face name to use
4149 // size:[num] sets the font size in points
4150 // eol turns on eol filling
4151 // underline turns on underlining
4153 void wxStyledTextCtrl::StyleSetSpec(int styleNum
, const wxString
& spec
) {
4155 wxStringTokenizer
tkz(spec
, wxT(","));
4156 while (tkz
.HasMoreTokens()) {
4157 wxString token
= tkz
.GetNextToken();
4159 wxString option
= token
.BeforeFirst(':');
4160 wxString val
= token
.AfterFirst(':');
4162 if (option
== wxT("bold"))
4163 StyleSetBold(styleNum
, true);
4165 else if (option
== wxT("italic"))
4166 StyleSetItalic(styleNum
, true);
4168 else if (option
== wxT("underline"))
4169 StyleSetUnderline(styleNum
, true);
4171 else if (option
== wxT("eol"))
4172 StyleSetEOLFilled(styleNum
, true);
4174 else if (option
== wxT("size")) {
4176 if (val
.ToLong(&points
))
4177 StyleSetSize(styleNum
, points
);
4180 else if (option
== wxT("face"))
4181 StyleSetFaceName(styleNum
, val
);
4183 else if (option
== wxT("fore"))
4184 StyleSetForeground(styleNum
, wxColourFromSpec(val
));
4186 else if (option
== wxT("back"))
4187 StyleSetBackground(styleNum
, wxColourFromSpec(val
));
4192 // Get the font of a style
4193 wxFont
wxStyledTextCtrl::StyleGetFont(int style
) {
4195 font
.SetPointSize(StyleGetSize(style
));
4196 font
.SetFaceName(StyleGetFaceName(style
));
4197 if( StyleGetBold(style
) )
4198 font
.SetWeight(wxFONTWEIGHT_BOLD
);
4200 font
.SetWeight(wxFONTWEIGHT_NORMAL
);
4202 if( StyleGetItalic(style
) )
4203 font
.SetStyle(wxFONTSTYLE_ITALIC
);
4205 font
.SetStyle(wxFONTSTYLE_NORMAL
);
4211 // Set style size, face, bold, italic, and underline attributes from
4212 // a wxFont's attributes.
4213 void wxStyledTextCtrl::StyleSetFont(int styleNum
, wxFont
& font
) {
4215 // Ensure that the native font is initialized
4217 GetTextExtent(wxT("X"), &x
, &y
, NULL
, NULL
, &font
);
4219 int size
= font
.GetPointSize();
4220 wxString faceName
= font
.GetFaceName();
4221 bool bold
= font
.GetWeight() == wxBOLD
;
4222 bool italic
= font
.GetStyle() != wxNORMAL
;
4223 bool under
= font
.GetUnderlined();
4224 wxFontEncoding encoding
= font
.GetEncoding();
4226 StyleSetFontAttr(styleNum
, size
, faceName
, bold
, italic
, under
, encoding
);
4229 // Set all font style attributes at once.
4230 void wxStyledTextCtrl::StyleSetFontAttr(int styleNum
, int size
,
4231 const wxString
& faceName
,
4232 bool bold
, bool italic
,
4234 wxFontEncoding encoding
) {
4235 StyleSetSize(styleNum
, size
);
4236 StyleSetFaceName(styleNum
, faceName
);
4237 StyleSetBold(styleNum
, bold
);
4238 StyleSetItalic(styleNum
, italic
);
4239 StyleSetUnderline(styleNum
, underline
);
4240 StyleSetFontEncoding(styleNum
, encoding
);
4244 // Set the character set of the font in a style. Converts the Scintilla
4245 // character set values to a wxFontEncoding.
4246 void wxStyledTextCtrl::StyleSetCharacterSet(int style
, int characterSet
)
4248 wxFontEncoding encoding
;
4250 // Translate the Scintilla characterSet to a wxFontEncoding
4251 switch (characterSet
) {
4253 case wxSTC_CHARSET_ANSI
:
4254 case wxSTC_CHARSET_DEFAULT
:
4255 encoding
= wxFONTENCODING_DEFAULT
;
4258 case wxSTC_CHARSET_BALTIC
:
4259 encoding
= wxFONTENCODING_ISO8859_13
;
4262 case wxSTC_CHARSET_CHINESEBIG5
:
4263 encoding
= wxFONTENCODING_CP950
;
4266 case wxSTC_CHARSET_EASTEUROPE
:
4267 encoding
= wxFONTENCODING_ISO8859_2
;
4270 case wxSTC_CHARSET_GB2312
:
4271 encoding
= wxFONTENCODING_CP936
;
4274 case wxSTC_CHARSET_GREEK
:
4275 encoding
= wxFONTENCODING_ISO8859_7
;
4278 case wxSTC_CHARSET_HANGUL
:
4279 encoding
= wxFONTENCODING_CP949
;
4282 case wxSTC_CHARSET_MAC
:
4283 encoding
= wxFONTENCODING_DEFAULT
;
4286 case wxSTC_CHARSET_OEM
:
4287 encoding
= wxFONTENCODING_DEFAULT
;
4290 case wxSTC_CHARSET_RUSSIAN
:
4291 encoding
= wxFONTENCODING_KOI8
;
4294 case wxSTC_CHARSET_SHIFTJIS
:
4295 encoding
= wxFONTENCODING_CP932
;
4298 case wxSTC_CHARSET_SYMBOL
:
4299 encoding
= wxFONTENCODING_DEFAULT
;
4302 case wxSTC_CHARSET_TURKISH
:
4303 encoding
= wxFONTENCODING_ISO8859_9
;
4306 case wxSTC_CHARSET_JOHAB
:
4307 encoding
= wxFONTENCODING_DEFAULT
;
4310 case wxSTC_CHARSET_HEBREW
:
4311 encoding
= wxFONTENCODING_ISO8859_8
;
4314 case wxSTC_CHARSET_ARABIC
:
4315 encoding
= wxFONTENCODING_ISO8859_6
;
4318 case wxSTC_CHARSET_VIETNAMESE
:
4319 encoding
= wxFONTENCODING_DEFAULT
;
4322 case wxSTC_CHARSET_THAI
:
4323 encoding
= wxFONTENCODING_ISO8859_11
;
4326 case wxSTC_CHARSET_CYRILLIC
:
4327 encoding
= wxFONTENCODING_ISO8859_5
;
4330 case wxSTC_CHARSET_8859_15
:
4331 encoding
= wxFONTENCODING_ISO8859_15
;;
4335 // We just have Scintilla track the wxFontEncoding for us. It gets used
4336 // in Font::Create in PlatWX.cpp. We add one to the value so that the
4337 // effective wxFONENCODING_DEFAULT == SC_SHARSET_DEFAULT and so when
4338 // Scintilla internally uses SC_CHARSET_DEFAULT we will translate it back
4339 // to wxFONENCODING_DEFAULT in Font::Create.
4340 SendMsg(SCI_STYLESETCHARACTERSET
, style
, encoding
+1);
4344 // Set the font encoding to be used by a style.
4345 void wxStyledTextCtrl::StyleSetFontEncoding(int style
, wxFontEncoding encoding
)
4347 SendMsg(SCI_STYLESETCHARACTERSET
, style
, encoding
+1);
4351 // Perform one of the operations defined by the wxSTC_CMD_* constants.
4352 void wxStyledTextCtrl::CmdKeyExecute(int cmd
) {
4357 // Set the left and right margin in the edit area, measured in pixels.
4358 void wxStyledTextCtrl::SetMargins(int left
, int right
) {
4359 SetMarginLeft(left
);
4360 SetMarginRight(right
);
4364 // Retrieve the point in the window where a position is displayed.
4365 wxPoint
wxStyledTextCtrl::PointFromPosition(int pos
) {
4366 int x
= SendMsg(SCI_POINTXFROMPOSITION
, 0, pos
);
4367 int y
= SendMsg(SCI_POINTYFROMPOSITION
, 0, pos
);
4368 return wxPoint(x
, y
);
4371 // Scroll enough to make the given line visible
4372 void wxStyledTextCtrl::ScrollToLine(int line
) {
4373 m_swx
->DoScrollToLine(line
);
4377 // Scroll enough to make the given column visible
4378 void wxStyledTextCtrl::ScrollToColumn(int column
) {
4379 m_swx
->DoScrollToColumn(column
);
4383 void wxStyledTextCtrl::DoSetValue(const wxString
& value
, int flags
)
4385 if ( flags
& SetValue_SelectionOnly
)
4386 ReplaceSelection(value
);
4390 // We don't send wxEVT_COMMAND_TEXT_UPDATED anyhow, so ignore the
4391 // SetValue_SendEvent bit of the flags
4395 wxStyledTextCtrl::DoSaveFile(const wxString
& filename
, int WXUNUSED(fileType
))
4397 #if wxUSE_FFILE || wxUSE_FILE
4400 // Take care to use "b" to ensure that possibly non-native EOLs in the file
4401 // contents are not mangled when saving it.
4402 wxFFile
file(filename
, wxS("wb"));
4404 wxFile
file(filename
, wxFile::write
);
4407 if ( file
.IsOpened() && file
.Write(GetValue(), *wxConvCurrent
) )
4414 #endif // !wxUSE_FFILE && !wxUSE_FILE
4420 wxStyledTextCtrl::DoLoadFile(const wxString
& filename
, int WXUNUSED(fileType
))
4422 #if wxUSE_FFILE || wxUSE_FILE
4425 // As above, we want to read the real EOLs from the file, e.g. without
4426 // translating them to just LFs under Windows, so that the original CR LF
4427 // are preserved when it's written back.
4428 wxFFile
file(filename
, wxS("rb"));
4430 wxFile
file(filename
);
4433 if ( file
.IsOpened() )
4436 if ( file
.ReadAll(&text
, *wxConvCurrent
) )
4438 // Detect the EOL: we use just the first line because there is not
4439 // much we can do if the file uses inconsistent EOLs anyhow, we'd
4440 // need to ask the user about the one we should really use and we
4441 // don't currently provide a way to do it.
4443 // We also only check for Unix and DOS EOLs but not classic Mac
4444 // CR-only one as it's obsolete by now.
4445 const wxString::size_type posLF
= text
.find('\n');
4446 if ( posLF
!= wxString::npos
)
4448 // Set EOL mode to ensure that the new lines inserted into the
4449 // text use the same EOLs as the existing ones.
4450 if ( posLF
> 0 && text
[posLF
- 1] == '\r' )
4451 SetEOLMode(wxSTC_EOL_CRLF
);
4453 SetEOLMode(wxSTC_EOL_LF
);
4455 //else: Use the default EOL for the current platform.
4464 #endif // !wxUSE_FFILE && !wxUSE_FILE
4469 // If we don't derive from wxTextAreaBase, we need to implement these methods
4470 // ourselves, otherwise we already inherit them.
4473 bool wxStyledTextCtrl::SaveFile(const wxString
& filename
)
4475 if ( filename
.empty() )
4478 return DoSaveFile(filename
, wxTEXT_TYPE_ANY
);
4481 bool wxStyledTextCtrl::LoadFile(const wxString
& filename
)
4483 if ( filename
.empty() )
4486 return DoLoadFile(filename
, wxTEXT_TYPE_ANY
);
4489 #endif // !wxUSE_TEXTCTRL
4491 #if wxUSE_DRAG_AND_DROP
4492 wxDragResult
wxStyledTextCtrl::DoDragOver(wxCoord x
, wxCoord y
, wxDragResult def
) {
4493 return m_swx
->DoDragOver(x
, y
, def
);
4497 bool wxStyledTextCtrl::DoDropText(long x
, long y
, const wxString
& data
) {
4498 return m_swx
->DoDropText(x
, y
, data
);
4503 void wxStyledTextCtrl::SetUseAntiAliasing(bool useAA
) {
4504 m_swx
->SetUseAntiAliasing(useAA
);
4507 bool wxStyledTextCtrl::GetUseAntiAliasing() {
4508 return m_swx
->GetUseAntiAliasing();
4511 void wxStyledTextCtrl::AnnotationClearLine(int line
) {
4512 SendMsg(SCI_ANNOTATIONSETTEXT
, line
, (sptr_t
)NULL
);
4518 void wxStyledTextCtrl::AddTextRaw(const char* text
, int length
)
4521 length
= strlen(text
);
4522 SendMsg(SCI_ADDTEXT
, length
, (sptr_t
)text
);
4525 void wxStyledTextCtrl::InsertTextRaw(int pos
, const char* text
)
4527 SendMsg(SCI_INSERTTEXT
, pos
, (sptr_t
)text
);
4530 wxCharBuffer
wxStyledTextCtrl::GetCurLineRaw(int* linePos
)
4532 int len
= LineLength(GetCurrentLine());
4534 if (linePos
) *linePos
= 0;
4539 wxCharBuffer
buf(len
);
4540 int pos
= SendMsg(SCI_GETCURLINE
, len
, (sptr_t
)buf
.data());
4541 if (linePos
) *linePos
= pos
;
4545 wxCharBuffer
wxStyledTextCtrl::GetLineRaw(int line
)
4547 int len
= LineLength(line
);
4553 wxCharBuffer
buf(len
);
4554 SendMsg(SCI_GETLINE
, line
, (sptr_t
)buf
.data());
4558 wxCharBuffer
wxStyledTextCtrl::GetSelectedTextRaw()
4560 // Calculate the length needed first.
4561 const int len
= SendMsg(SCI_GETSELTEXT
, 0, (sptr_t
)0);
4563 // And then really get the data.
4564 wxCharBuffer
buf(len
);
4565 SendMsg(SCI_GETSELTEXT
, 0, (sptr_t
)buf
.data());
4569 wxCharBuffer
wxStyledTextCtrl::GetTextRangeRaw(int startPos
, int endPos
)
4571 if (endPos
< startPos
) {
4572 int temp
= startPos
;
4576 int len
= endPos
- startPos
;
4582 wxCharBuffer
buf(len
);
4584 tr
.lpstrText
= buf
.data();
4585 tr
.chrg
.cpMin
= startPos
;
4586 tr
.chrg
.cpMax
= endPos
;
4587 SendMsg(SCI_GETTEXTRANGE
, 0, (sptr_t
)&tr
);
4591 void wxStyledTextCtrl::SetTextRaw(const char* text
)
4593 SendMsg(SCI_SETTEXT
, 0, (sptr_t
)text
);
4596 wxCharBuffer
wxStyledTextCtrl::GetTextRaw()
4598 int len
= GetTextLength();
4599 wxCharBuffer
buf(len
); // adds 1 for NUL automatically
4600 SendMsg(SCI_GETTEXT
, len
+ 1, (sptr_t
)buf
.data());
4604 void wxStyledTextCtrl::AppendTextRaw(const char* text
, int length
)
4607 length
= strlen(text
);
4608 SendMsg(SCI_APPENDTEXT
, length
, (sptr_t
)text
);
4615 //----------------------------------------------------------------------
4618 void wxStyledTextCtrl::OnPaint(wxPaintEvent
& WXUNUSED(evt
)) {
4620 wxBufferedPaintDC
dc(this);
4624 m_swx
->DoPaint(&dc
, GetUpdateRegion().GetBox());
4627 void wxStyledTextCtrl::OnScrollWin(wxScrollWinEvent
& evt
) {
4628 if (evt
.GetOrientation() == wxHORIZONTAL
)
4629 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
4631 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
4634 void wxStyledTextCtrl::OnScroll(wxScrollEvent
& evt
) {
4635 wxScrollBar
* sb
= wxDynamicCast(evt
.GetEventObject(), wxScrollBar
);
4637 if (sb
->IsVertical())
4638 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
4640 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
4644 void wxStyledTextCtrl::OnSize(wxSizeEvent
& WXUNUSED(evt
)) {
4646 wxSize sz
= GetClientSize();
4647 m_swx
->DoSize(sz
.x
, sz
.y
);
4651 void wxStyledTextCtrl::OnMouseLeftDown(wxMouseEvent
& evt
) {
4653 wxPoint pt
= evt
.GetPosition();
4654 m_swx
->DoLeftButtonDown(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
4655 evt
.ShiftDown(), evt
.ControlDown(), evt
.AltDown());
4658 void wxStyledTextCtrl::OnMouseMove(wxMouseEvent
& evt
) {
4659 wxPoint pt
= evt
.GetPosition();
4660 m_swx
->DoLeftButtonMove(Point(pt
.x
, pt
.y
));
4663 void wxStyledTextCtrl::OnMouseLeftUp(wxMouseEvent
& evt
) {
4664 wxPoint pt
= evt
.GetPosition();
4665 m_swx
->DoLeftButtonUp(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
4670 void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent
& evt
) {
4671 wxPoint pt
= evt
.GetPosition();
4672 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
4676 void wxStyledTextCtrl::OnMouseMiddleUp(wxMouseEvent
& evt
) {
4677 wxPoint pt
= evt
.GetPosition();
4678 m_swx
->DoMiddleButtonUp(Point(pt
.x
, pt
.y
));
4681 void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent
& evt
) {
4682 wxPoint pt
= evt
.GetPosition();
4683 ScreenToClient(&pt
.x
, &pt
.y
);
4685 Show context menu at event point if it's within the window,
4686 or at caret location if not
4688 wxHitTest ht
= this->HitTest(pt
);
4689 if (ht
!= wxHT_WINDOW_INSIDE
) {
4690 pt
= this->PointFromPosition(this->GetCurrentPos());
4692 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
4696 void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent
& evt
)
4698 m_swx
->DoMouseWheel(evt
.GetWheelRotation(),
4699 evt
.GetWheelDelta(),
4700 evt
.GetLinesPerAction(),
4702 evt
.IsPageScroll());
4706 void wxStyledTextCtrl::OnChar(wxKeyEvent
& evt
) {
4707 // On (some?) non-US PC keyboards the AltGr key is required to enter some
4708 // common characters. It comes to us as both Alt and Ctrl down so we need
4709 // to let the char through in that case, otherwise if only ctrl or only
4710 // alt let's skip it.
4711 bool ctrl
= evt
.ControlDown();
4713 // On the Mac the Alt key is just a modifier key (like Shift) so we need
4714 // to allow the char events to be processed when Alt is pressed.
4715 // TODO: Should we check MetaDown instead in this case?
4718 bool alt
= evt
.AltDown();
4720 bool skip
= ((ctrl
|| alt
) && ! (ctrl
&& alt
));
4723 // apparently if we don't do this, Unicode keys pressed after non-char
4724 // ASCII ones (e.g. Enter, Tab) are not taken into account (patch 1615989)
4725 if (m_lastKeyDownConsumed
&& evt
.GetUnicodeKey() > 255)
4726 m_lastKeyDownConsumed
= false;
4729 if (!m_lastKeyDownConsumed
&& !skip
) {
4731 int key
= evt
.GetUnicodeKey();
4734 // if the unicode key code is not really a unicode character (it may
4735 // be a function key or etc., the platforms appear to always give us a
4736 // small value in this case) then fallback to the ascii key code but
4737 // don't do anything for function keys or etc.
4739 key
= evt
.GetKeyCode();
4740 keyOk
= (key
<= 127);
4743 m_swx
->DoAddChar(key
);
4747 int key
= evt
.GetKeyCode();
4748 if (key
<= WXK_START
|| key
> WXK_COMMAND
) {
4749 m_swx
->DoAddChar(key
);
4759 void wxStyledTextCtrl::OnKeyDown(wxKeyEvent
& evt
) {
4760 int processed
= m_swx
->DoKeyDown(evt
, &m_lastKeyDownConsumed
);
4761 if (!processed
&& !m_lastKeyDownConsumed
)
4766 void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent
& evt
) {
4767 m_swx
->DoLoseFocus();
4772 void wxStyledTextCtrl::OnGainFocus(wxFocusEvent
& evt
) {
4773 m_swx
->DoGainFocus();
4778 void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent
& WXUNUSED(evt
)) {
4779 m_swx
->DoSysColourChange();
4783 void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent
& WXUNUSED(evt
)) {
4784 // do nothing to help avoid flashing
4789 void wxStyledTextCtrl::OnMenu(wxCommandEvent
& evt
) {
4790 m_swx
->DoCommand(evt
.GetId());
4794 void wxStyledTextCtrl::OnListBox(wxCommandEvent
& WXUNUSED(evt
)) {
4795 m_swx
->DoOnListBox();
4799 void wxStyledTextCtrl::OnIdle(wxIdleEvent
& evt
) {
4800 m_swx
->DoOnIdle(evt
);
4804 wxSize
wxStyledTextCtrl::DoGetBestSize() const
4806 // What would be the best size for a wxSTC?
4807 // Just give a reasonable minimum until something else can be figured out.
4808 return wxSize(200,100);
4812 //----------------------------------------------------------------------
4813 // Turn notifications from Scintilla into events
4816 void wxStyledTextCtrl::NotifyChange() {
4817 wxStyledTextEvent
evt(wxEVT_STC_CHANGE
, GetId());
4818 evt
.SetEventObject(this);
4819 GetEventHandler()->ProcessEvent(evt
);
4823 static void SetEventText(wxStyledTextEvent
& evt
, const char* text
,
4827 evt
.SetText(stc2wx(text
, length
));
4831 void wxStyledTextCtrl::NotifyParent(SCNotification
* _scn
) {
4832 SCNotification
& scn
= *_scn
;
4833 wxStyledTextEvent
evt(0, GetId());
4835 evt
.SetEventObject(this);
4836 evt
.SetPosition(scn
.position
);
4838 evt
.SetModifiers(scn
.modifiers
);
4840 switch (scn
.nmhdr
.code
) {
4841 case SCN_STYLENEEDED
:
4842 evt
.SetEventType(wxEVT_STC_STYLENEEDED
);
4846 evt
.SetEventType(wxEVT_STC_CHARADDED
);
4849 case SCN_SAVEPOINTREACHED
:
4850 evt
.SetEventType(wxEVT_STC_SAVEPOINTREACHED
);
4853 case SCN_SAVEPOINTLEFT
:
4854 evt
.SetEventType(wxEVT_STC_SAVEPOINTLEFT
);
4857 case SCN_MODIFYATTEMPTRO
:
4858 evt
.SetEventType(wxEVT_STC_ROMODIFYATTEMPT
);
4862 evt
.SetEventType(wxEVT_STC_KEY
);
4865 case SCN_DOUBLECLICK
:
4866 evt
.SetEventType(wxEVT_STC_DOUBLECLICK
);
4867 evt
.SetLine(scn
.line
);
4871 evt
.SetEventType(wxEVT_STC_UPDATEUI
);
4872 evt
.SetUpdated(scn
.updated
);
4876 evt
.SetEventType(wxEVT_STC_MODIFIED
);
4877 evt
.SetModificationType(scn
.modificationType
);
4878 SetEventText(evt
, scn
.text
, scn
.length
);
4879 evt
.SetLength(scn
.length
);
4880 evt
.SetLinesAdded(scn
.linesAdded
);
4881 evt
.SetLine(scn
.line
);
4882 evt
.SetFoldLevelNow(scn
.foldLevelNow
);
4883 evt
.SetFoldLevelPrev(scn
.foldLevelPrev
);
4884 evt
.SetToken(scn
.token
);
4885 evt
.SetAnnotationLinesAdded(scn
.annotationLinesAdded
);
4888 case SCN_MACRORECORD
:
4889 evt
.SetEventType(wxEVT_STC_MACRORECORD
);
4890 evt
.SetMessage(scn
.message
);
4891 evt
.SetWParam(scn
.wParam
);
4892 evt
.SetLParam(scn
.lParam
);
4895 case SCN_MARGINCLICK
:
4896 evt
.SetEventType(wxEVT_STC_MARGINCLICK
);
4897 evt
.SetMargin(scn
.margin
);
4901 evt
.SetEventType(wxEVT_STC_NEEDSHOWN
);
4902 evt
.SetLength(scn
.length
);
4906 evt
.SetEventType(wxEVT_STC_PAINTED
);
4909 case SCN_AUTOCSELECTION
:
4910 evt
.SetEventType(wxEVT_STC_AUTOCOMP_SELECTION
);
4911 evt
.SetListType(scn
.listType
);
4912 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
4913 evt
.SetPosition(scn
.lParam
);
4916 case SCN_USERLISTSELECTION
:
4917 evt
.SetEventType(wxEVT_STC_USERLISTSELECTION
);
4918 evt
.SetListType(scn
.listType
);
4919 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
4920 evt
.SetPosition(scn
.lParam
);
4923 case SCN_URIDROPPED
:
4924 evt
.SetEventType(wxEVT_STC_URIDROPPED
);
4925 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
4928 case SCN_DWELLSTART
:
4929 evt
.SetEventType(wxEVT_STC_DWELLSTART
);
4935 evt
.SetEventType(wxEVT_STC_DWELLEND
);
4941 evt
.SetEventType(wxEVT_STC_ZOOM
);
4944 case SCN_HOTSPOTCLICK
:
4945 evt
.SetEventType(wxEVT_STC_HOTSPOT_CLICK
);
4948 case SCN_HOTSPOTDOUBLECLICK
:
4949 evt
.SetEventType(wxEVT_STC_HOTSPOT_DCLICK
);
4952 case SCN_CALLTIPCLICK
:
4953 evt
.SetEventType(wxEVT_STC_CALLTIP_CLICK
);
4956 case SCN_INDICATORCLICK
:
4957 evt
.SetEventType(wxEVT_STC_INDICATOR_CLICK
);
4960 case SCN_INDICATORRELEASE
:
4961 evt
.SetEventType(wxEVT_STC_INDICATOR_RELEASE
);
4964 case SCN_AUTOCCANCELLED
:
4965 evt
.SetEventType(wxEVT_STC_AUTOCOMP_CANCELLED
);
4968 case SCN_AUTOCCHARDELETED
:
4969 evt
.SetEventType(wxEVT_STC_AUTOCOMP_CHAR_DELETED
);
4972 case SCN_HOTSPOTRELEASECLICK
:
4973 evt
.SetEventType(wxEVT_STC_HOTSPOT_RELEASE_CLICK
);
4980 GetEventHandler()->ProcessEvent(evt
);
4984 //----------------------------------------------------------------------
4985 //----------------------------------------------------------------------
4986 //----------------------------------------------------------------------
4988 wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType
, int id
)
4989 : wxCommandEvent(commandType
, id
)
4994 m_modificationType
= 0;
4999 m_foldLevelPrev
= 0;
5008 m_annotationLinesAdded
= 0;
5011 #if wxUSE_DRAG_AND_DROP
5012 m_dragFlags
= wxDrag_CopyOnly
;
5013 m_dragResult
= wxDragNone
;
5017 bool wxStyledTextEvent::GetShift() const { return (m_modifiers
& SCI_SHIFT
) != 0; }
5018 bool wxStyledTextEvent::GetControl() const { return (m_modifiers
& SCI_CTRL
) != 0; }
5019 bool wxStyledTextEvent::GetAlt() const { return (m_modifiers
& SCI_ALT
) != 0; }
5022 wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent
& event
):
5023 wxCommandEvent(event
)
5025 m_position
= event
.m_position
;
5026 m_key
= event
.m_key
;
5027 m_modifiers
= event
.m_modifiers
;
5028 m_modificationType
= event
.m_modificationType
;
5029 m_text
= event
.m_text
;
5030 m_length
= event
.m_length
;
5031 m_linesAdded
= event
.m_linesAdded
;
5032 m_line
= event
.m_line
;
5033 m_foldLevelNow
= event
.m_foldLevelNow
;
5034 m_foldLevelPrev
= event
.m_foldLevelPrev
;
5036 m_margin
= event
.m_margin
;
5038 m_message
= event
.m_message
;
5039 m_wParam
= event
.m_wParam
;
5040 m_lParam
= event
.m_lParam
;
5042 m_listType
= event
.m_listType
;
5046 m_token
= event
.m_token
;
5047 m_annotationLinesAdded
= event
.m_annotationLinesAdded
;
5048 m_updated
= event
.m_updated
;
5050 #if wxUSE_DRAG_AND_DROP
5051 m_dragText
= event
.m_dragText
;
5052 m_dragFlags
= event
.m_dragFlags
;
5053 m_dragResult
= event
.m_dragResult
;
5057 //----------------------------------------------------------------------
5058 //----------------------------------------------------------------------
5060 /*static*/ wxVersionInfo
wxStyledTextCtrl::GetLibraryVersionInfo()
5062 return wxVersionInfo("Scintilla", 3, 21, 0, "Scintilla 3.21");