1 ////////////////////////////////////////////////////////////////////////////
3 // Purpose: A wxWidgets implementation of Scintilla. This class is the
4 // one meant to be used directly by wx applications. It does not
5 // derive directly from the Scintilla classes, but instead
6 // delegates most things to the real Scintilla class.
7 // This allows the use of Scintilla without polluting the
8 // namespace with all the classes and identifiers from Scintilla.
12 // Created: 13-Jan-2000
14 // Copyright: (c) 2000 by Total Control Software
15 // Licence: wxWindows licence
16 /////////////////////////////////////////////////////////////////////////////
19 IMPORTANT: src/stc/stc.cpp is generated by src/stc/gen_iface.py from
20 src/stc/stc.cpp.in, don't edit stc.cpp file as your changes will be
21 lost after the next regeneration, edit stc.cpp.in and rerun the
22 gen_iface.py script instead!
24 Parts of this file generated by the script are found in between
25 the special "{{{" and "}}}" markers, the rest of it is copied
26 verbatim from src.h.in.
29 // For compilers that support precompilation, includes "wx.h".
30 #include "wx/wxprec.h"
38 #include "wx/stc/stc.h"
39 #include "wx/stc/private.h"
47 #include "wx/tokenzr.h"
48 #include "wx/mstream.h"
52 #include "ScintillaWX.h"
54 //----------------------------------------------------------------------
56 const char wxSTCNameStr
[] = "stcwindow";
62 #define MAKELONG(a, b) ((a) | ((b) << 16))
65 static long wxColourAsLong(const wxColour
& co
) {
66 return (((long)co
.Blue() << 16) |
67 ((long)co
.Green() << 8) |
71 static wxColour
wxColourFromLong(long c
) {
73 clr
.Set((unsigned char)(c
& 0xff),
74 (unsigned char)((c
>> 8) & 0xff),
75 (unsigned char)((c
>> 16) & 0xff));
80 static wxColour
wxColourFromSpec(const wxString
& spec
) {
81 // spec should be a colour name or "#RRGGBB"
82 if (spec
.GetChar(0) == wxT('#')) {
84 long red
, green
, blue
;
85 red
= green
= blue
= 0;
86 spec
.Mid(1,2).ToLong(&red
, 16);
87 spec
.Mid(3,2).ToLong(&green
, 16);
88 spec
.Mid(5,2).ToLong(&blue
, 16);
89 return wxColour((unsigned char)red
,
94 return wxColour(spec
);
97 //----------------------------------------------------------------------
99 wxDEFINE_EVENT( wxEVT_STC_CHANGE
, wxStyledTextEvent
);
100 wxDEFINE_EVENT( wxEVT_STC_STYLENEEDED
, wxStyledTextEvent
);
101 wxDEFINE_EVENT( wxEVT_STC_CHARADDED
, wxStyledTextEvent
);
102 wxDEFINE_EVENT( wxEVT_STC_SAVEPOINTREACHED
, wxStyledTextEvent
);
103 wxDEFINE_EVENT( wxEVT_STC_SAVEPOINTLEFT
, wxStyledTextEvent
);
104 wxDEFINE_EVENT( wxEVT_STC_ROMODIFYATTEMPT
, wxStyledTextEvent
);
105 wxDEFINE_EVENT( wxEVT_STC_KEY
, wxStyledTextEvent
);
106 wxDEFINE_EVENT( wxEVT_STC_DOUBLECLICK
, wxStyledTextEvent
);
107 wxDEFINE_EVENT( wxEVT_STC_UPDATEUI
, wxStyledTextEvent
);
108 wxDEFINE_EVENT( wxEVT_STC_MODIFIED
, wxStyledTextEvent
);
109 wxDEFINE_EVENT( wxEVT_STC_MACRORECORD
, wxStyledTextEvent
);
110 wxDEFINE_EVENT( wxEVT_STC_MARGINCLICK
, wxStyledTextEvent
);
111 wxDEFINE_EVENT( wxEVT_STC_NEEDSHOWN
, wxStyledTextEvent
);
112 wxDEFINE_EVENT( wxEVT_STC_PAINTED
, wxStyledTextEvent
);
113 wxDEFINE_EVENT( wxEVT_STC_USERLISTSELECTION
, wxStyledTextEvent
);
114 wxDEFINE_EVENT( wxEVT_STC_URIDROPPED
, wxStyledTextEvent
);
115 wxDEFINE_EVENT( wxEVT_STC_DWELLSTART
, wxStyledTextEvent
);
116 wxDEFINE_EVENT( wxEVT_STC_DWELLEND
, wxStyledTextEvent
);
117 wxDEFINE_EVENT( wxEVT_STC_START_DRAG
, wxStyledTextEvent
);
118 wxDEFINE_EVENT( wxEVT_STC_DRAG_OVER
, wxStyledTextEvent
);
119 wxDEFINE_EVENT( wxEVT_STC_DO_DROP
, wxStyledTextEvent
);
120 wxDEFINE_EVENT( wxEVT_STC_ZOOM
, wxStyledTextEvent
);
121 wxDEFINE_EVENT( wxEVT_STC_HOTSPOT_CLICK
, wxStyledTextEvent
);
122 wxDEFINE_EVENT( wxEVT_STC_HOTSPOT_DCLICK
, wxStyledTextEvent
);
123 wxDEFINE_EVENT( wxEVT_STC_CALLTIP_CLICK
, wxStyledTextEvent
);
124 wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_SELECTION
, wxStyledTextEvent
);
125 wxDEFINE_EVENT( wxEVT_STC_INDICATOR_CLICK
, wxStyledTextEvent
);
126 wxDEFINE_EVENT( wxEVT_STC_INDICATOR_RELEASE
, wxStyledTextEvent
);
127 wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_CANCELLED
, wxStyledTextEvent
);
128 wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_CHAR_DELETED
, wxStyledTextEvent
);
132 BEGIN_EVENT_TABLE(wxStyledTextCtrl
, wxControl
)
133 EVT_PAINT (wxStyledTextCtrl
::OnPaint
)
134 EVT_SCROLLWIN (wxStyledTextCtrl
::OnScrollWin
)
135 EVT_SCROLL (wxStyledTextCtrl
::OnScroll
)
136 EVT_SIZE (wxStyledTextCtrl
::OnSize
)
137 EVT_LEFT_DOWN (wxStyledTextCtrl
::OnMouseLeftDown
)
138 // Let Scintilla see the double click as a second click
139 EVT_LEFT_DCLICK (wxStyledTextCtrl
::OnMouseLeftDown
)
140 EVT_MOTION (wxStyledTextCtrl
::OnMouseMove
)
141 EVT_LEFT_UP (wxStyledTextCtrl
::OnMouseLeftUp
)
142 #if defined(__WXGTK__) || defined(__WXMAC__)
143 EVT_RIGHT_UP (wxStyledTextCtrl
::OnMouseRightUp
)
145 EVT_CONTEXT_MENU (wxStyledTextCtrl
::OnContextMenu
)
147 EVT_MOUSEWHEEL (wxStyledTextCtrl
::OnMouseWheel
)
148 EVT_MIDDLE_UP (wxStyledTextCtrl
::OnMouseMiddleUp
)
149 EVT_CHAR (wxStyledTextCtrl
::OnChar
)
150 EVT_KEY_DOWN (wxStyledTextCtrl
::OnKeyDown
)
151 EVT_KILL_FOCUS (wxStyledTextCtrl
::OnLoseFocus
)
152 EVT_SET_FOCUS (wxStyledTextCtrl
::OnGainFocus
)
153 EVT_SYS_COLOUR_CHANGED (wxStyledTextCtrl
::OnSysColourChanged
)
154 EVT_ERASE_BACKGROUND (wxStyledTextCtrl
::OnEraseBackground
)
155 EVT_MENU_RANGE (10, 16, wxStyledTextCtrl
::OnMenu
)
156 EVT_LISTBOX_DCLICK (wxID_ANY
, wxStyledTextCtrl
::OnListBox
)
160 IMPLEMENT_CLASS(wxStyledTextCtrl
, wxControl
)
161 IMPLEMENT_DYNAMIC_CLASS(wxStyledTextEvent
, wxCommandEvent
)
164 // forces the linking of the lexer modules
165 int Scintilla_LinkLexers();
168 //----------------------------------------------------------------------
169 // Constructor and Destructor
171 wxStyledTextCtrl
::wxStyledTextCtrl(wxWindow
*parent
,
176 const wxString
& name
)
179 Create(parent
, id
, pos
, size
, style
, name
);
183 bool wxStyledTextCtrl
::Create(wxWindow
*parent
,
188 const wxString
& name
)
190 style
|= wxVSCROLL
| wxHSCROLL
;
191 if (!wxControl
::Create(parent
, id
, pos
, size
,
192 style
| wxWANTS_CHARS
| wxCLIP_CHILDREN
,
193 wxDefaultValidator
, name
))
197 Scintilla_LinkLexers();
199 m_swx
= new ScintillaWX(this);
201 m_lastKeyDownConsumed
= false;
205 // Put Scintilla into unicode (UTF-8) mode
206 SetCodePage(wxSTC_CP_UTF8
);
209 SetInitialSize(size
);
211 // Reduces flicker on GTK+/X11
212 SetBackgroundStyle(wxBG_STYLE_PAINT
);
214 // Make sure it can take the focus
221 wxStyledTextCtrl
::~wxStyledTextCtrl() {
226 //----------------------------------------------------------------------
228 wxIntPtr wxStyledTextCtrl
::SendMsg(int msg
, wxUIntPtr wp
, wxIntPtr lp
) const
230 return m_swx
->WndProc(msg
, wp
, lp
);
233 //----------------------------------------------------------------------
235 // Set the vertical scrollbar to use instead of the ont that's built-in.
236 void wxStyledTextCtrl
::SetVScrollBar(wxScrollBar
* bar
) {
239 // ensure that the built-in scrollbar is not visible
240 SetScrollbar(wxVERTICAL
, 0, 0, 0);
245 // Set the horizontal scrollbar to use instead of the ont that's built-in.
246 void wxStyledTextCtrl
::SetHScrollBar(wxScrollBar
* bar
) {
249 // ensure that the built-in scrollbar is not visible
250 SetScrollbar(wxHORIZONTAL
, 0, 0, 0);
254 //----------------------------------------------------------------------
255 // Generated methods implementation section {{{
258 // Add text to the document at current position.
259 void wxStyledTextCtrl
::AddText(const wxString
& text
) {
260 const wxWX2MBbuf buf
= wx2stc(text
);
261 SendMsg(2001, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
264 // Add array of cells to document.
265 void wxStyledTextCtrl
::AddStyledText(const wxMemoryBuffer
& data
) {
266 SendMsg(2002, data
.GetDataLen(), (sptr_t
)data
.GetData());
269 // Insert string at a position.
270 void wxStyledTextCtrl
::InsertText(int pos
, const wxString
& text
)
272 SendMsg(2003, pos
, (sptr_t
)(const char*)wx2stc(text
));
275 // Delete all text in the document.
276 void wxStyledTextCtrl
::ClearAll()
281 // Delete a range of text in the document.
282 void wxStyledTextCtrl
::DeleteRange(int pos
, int deleteLength
)
284 SendMsg(2645, pos
, deleteLength
);
287 // Set all style bytes to 0, remove all folding information.
288 void wxStyledTextCtrl
::ClearDocumentStyle()
293 // Returns the number of bytes in the document.
294 int wxStyledTextCtrl
::GetLength() const
296 return SendMsg(2006, 0, 0);
299 // Returns the character byte at the position.
300 int wxStyledTextCtrl
::GetCharAt(int pos
) const {
301 return (unsigned char)SendMsg(2007, pos
, 0);
304 // Returns the position of the caret.
305 int wxStyledTextCtrl
::GetCurrentPos() const
307 return SendMsg(2008, 0, 0);
310 // Returns the position of the opposite end of the selection to the caret.
311 int wxStyledTextCtrl
::GetAnchor() const
313 return SendMsg(2009, 0, 0);
316 // Returns the style byte at the position.
317 int wxStyledTextCtrl
::GetStyleAt(int pos
) const {
318 return (unsigned char)SendMsg(2010, pos
, 0);
321 // Redoes the next action on the undo history.
322 void wxStyledTextCtrl
::Redo()
327 // Choose between collecting actions into the undo
328 // history and discarding them.
329 void wxStyledTextCtrl
::SetUndoCollection(bool collectUndo
)
331 SendMsg(2012, collectUndo
, 0);
334 // Select all the text in the document.
335 void wxStyledTextCtrl
::SelectAll()
340 // Remember the current position in the undo history as the position
341 // at which the document was saved.
342 void wxStyledTextCtrl
::SetSavePoint()
347 // Retrieve a buffer of cells.
348 wxMemoryBuffer wxStyledTextCtrl
::GetStyledText(int startPos
, int endPos
) {
350 if (endPos
< startPos
) {
355 int len
= endPos
- startPos
;
356 if (!len
) return buf
;
358 tr
.lpstrText
= (char*)buf
.GetWriteBuf(len
*2+1);
359 tr
.chrg
.cpMin
= startPos
;
360 tr
.chrg
.cpMax
= endPos
;
361 len
= SendMsg(2015, 0, (sptr_t
)&tr
);
362 buf
.UngetWriteBuf(len
);
366 // Are there any redoable actions in the undo history?
367 bool wxStyledTextCtrl
::CanRedo() const
369 return SendMsg(2016, 0, 0) != 0;
372 // Retrieve the line number at which a particular marker is located.
373 int wxStyledTextCtrl
::MarkerLineFromHandle(int handle
)
375 return SendMsg(2017, handle
, 0);
379 void wxStyledTextCtrl
::MarkerDeleteHandle(int handle
)
381 SendMsg(2018, handle
, 0);
384 // Is undo history being collected?
385 bool wxStyledTextCtrl
::GetUndoCollection() const
387 return SendMsg(2019, 0, 0) != 0;
390 // Are white space characters currently visible?
391 // Returns one of SCWS_* constants.
392 int wxStyledTextCtrl
::GetViewWhiteSpace() const
394 return SendMsg(2020, 0, 0);
397 // Make white space characters invisible, always visible or visible outside indentation.
398 void wxStyledTextCtrl
::SetViewWhiteSpace(int viewWS
)
400 SendMsg(2021, viewWS
, 0);
403 // Find the position from a point within the window.
404 int wxStyledTextCtrl
::PositionFromPoint(wxPoint pt
) const {
405 return SendMsg(2022, pt
.x
, pt
.y
);
408 // Find the position from a point within the window but return
409 // INVALID_POSITION if not close to text.
410 int wxStyledTextCtrl
::PositionFromPointClose(int x
, int y
)
412 return SendMsg(2023, x
, y
);
415 // Set caret to start of a line and ensure it is visible.
416 void wxStyledTextCtrl
::GotoLine(int line
)
418 SendMsg(2024, line
, 0);
421 // Set caret to a position and ensure it is visible.
422 void wxStyledTextCtrl
::GotoPos(int pos
)
424 SendMsg(2025, pos
, 0);
427 // Set the selection anchor to a position. The anchor is the opposite
428 // end of the selection from the caret.
429 void wxStyledTextCtrl
::SetAnchor(int posAnchor
)
431 SendMsg(2026, posAnchor
, 0);
434 // Retrieve the text of the line containing the caret.
435 // Returns the index of the caret on the line.
436 wxString wxStyledTextCtrl
::GetCurLine(int* linePos
) {
437 int len
= LineLength(GetCurrentLine());
439 if (linePos
) *linePos
= 0;
440 return wxEmptyString
;
443 wxMemoryBuffer
mbuf(len
+1);
444 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
446 int pos
= SendMsg(2027, len
+1, (sptr_t
)buf
);
447 mbuf
.UngetWriteBuf(len
);
449 if (linePos
) *linePos
= pos
;
453 // Retrieve the position of the last correctly styled character.
454 int wxStyledTextCtrl
::GetEndStyled() const
456 return SendMsg(2028, 0, 0);
459 // Convert all line endings in the document to one mode.
460 void wxStyledTextCtrl
::ConvertEOLs(int eolMode
)
462 SendMsg(2029, eolMode
, 0);
465 // Retrieve the current end of line mode - one of CRLF, CR, or LF.
466 int wxStyledTextCtrl
::GetEOLMode() const
468 return SendMsg(2030, 0, 0);
471 // Set the current end of line mode.
472 void wxStyledTextCtrl
::SetEOLMode(int eolMode
)
474 SendMsg(2031, eolMode
, 0);
477 // Set the current styling position to pos and the styling mask to mask.
478 // The styling mask can be used to protect some bits in each styling byte from modification.
479 void wxStyledTextCtrl
::StartStyling(int pos
, int mask
)
481 SendMsg(2032, pos
, mask
);
484 // Change style from current styling position for length characters to a style
485 // and move the current styling position to after this newly styled segment.
486 void wxStyledTextCtrl
::SetStyling(int length
, int style
)
488 SendMsg(2033, length
, style
);
491 // Is drawing done first into a buffer or direct to the screen?
492 bool wxStyledTextCtrl
::GetBufferedDraw() const
494 return SendMsg(2034, 0, 0) != 0;
497 // If drawing is buffered then each line of text is drawn into a bitmap buffer
498 // before drawing it to the screen to avoid flicker.
499 void wxStyledTextCtrl
::SetBufferedDraw(bool buffered
)
501 SendMsg(2035, buffered
, 0);
504 // Change the visible size of a tab to be a multiple of the width of a space character.
505 void wxStyledTextCtrl
::SetTabWidth(int tabWidth
)
507 SendMsg(2036, tabWidth
, 0);
510 // Retrieve the visible size of a tab.
511 int wxStyledTextCtrl
::GetTabWidth() const
513 return SendMsg(2121, 0, 0);
516 // Set the code page used to interpret the bytes of the document as characters.
517 void wxStyledTextCtrl
::SetCodePage(int codePage
) {
519 wxASSERT_MSG(codePage
== wxSTC_CP_UTF8
,
520 wxT("Only wxSTC_CP_UTF8 may be used when wxUSE_UNICODE is on."));
522 wxASSERT_MSG(codePage
!= wxSTC_CP_UTF8
,
523 wxT("wxSTC_CP_UTF8 may not be used when wxUSE_UNICODE is off."));
525 SendMsg(2037, codePage
);
528 // Set the symbol used for a particular marker number,
529 // and optionally the fore and background colours.
530 void wxStyledTextCtrl
::MarkerDefine(int markerNumber
, int markerSymbol
,
531 const wxColour
& foreground
,
532 const wxColour
& background
) {
534 SendMsg(2040, markerNumber
, markerSymbol
);
535 if (foreground
.IsOk())
536 MarkerSetForeground(markerNumber
, foreground
);
537 if (background
.IsOk())
538 MarkerSetBackground(markerNumber
, background
);
541 // Set the foreground colour used for a particular marker number.
542 void wxStyledTextCtrl
::MarkerSetForeground(int markerNumber
, const wxColour
& fore
)
544 SendMsg(2041, markerNumber
, wxColourAsLong(fore
));
547 // Set the background colour used for a particular marker number.
548 void wxStyledTextCtrl
::MarkerSetBackground(int markerNumber
, const wxColour
& back
)
550 SendMsg(2042, markerNumber
, wxColourAsLong(back
));
553 // Set the background colour used for a particular marker number when its folding block is selected.
554 void wxStyledTextCtrl
::MarkerSetBackSelected(int markerNumber
, const wxColour
& back
)
556 SendMsg(2292, markerNumber
, wxColourAsLong(back
));
559 // Enable/disable highlight for current folding bloc (smallest one that contains the caret)
560 void wxStyledTextCtrl
::MarkerEnableHighlight(bool enabled
)
562 SendMsg(2293, enabled
, 0);
565 // Add a marker to a line, returning an ID which can be used to find or delete the marker.
566 int wxStyledTextCtrl
::MarkerAdd(int line
, int markerNumber
)
568 return SendMsg(2043, line
, markerNumber
);
571 // Delete a marker from a line.
572 void wxStyledTextCtrl
::MarkerDelete(int line
, int markerNumber
)
574 SendMsg(2044, line
, markerNumber
);
577 // Delete all markers with a particular number from all lines.
578 void wxStyledTextCtrl
::MarkerDeleteAll(int markerNumber
)
580 SendMsg(2045, markerNumber
, 0);
583 // Get a bit mask of all the markers set on a line.
584 int wxStyledTextCtrl
::MarkerGet(int line
)
586 return SendMsg(2046, line
, 0);
589 // Find the next line at or after lineStart that includes a marker in mask.
590 // Return -1 when no more lines.
591 int wxStyledTextCtrl
::MarkerNext(int lineStart
, int markerMask
)
593 return SendMsg(2047, lineStart
, markerMask
);
596 // Find the previous line before lineStart that includes a marker in mask.
597 int wxStyledTextCtrl
::MarkerPrevious(int lineStart
, int markerMask
)
599 return SendMsg(2048, lineStart
, markerMask
);
602 // Define a marker from a bitmap
603 void wxStyledTextCtrl
::MarkerDefineBitmap(int markerNumber
, const wxBitmap
& bmp
) {
604 // convert bmp to a xpm in a string
605 wxMemoryOutputStream strm
;
606 wxImage img
= bmp
.ConvertToImage();
608 img
.ConvertAlphaToMask();
609 img
.SaveFile(strm
, wxBITMAP_TYPE_XPM
);
610 size_t len
= strm
.GetSize();
611 char* buff
= new char[len
+1];
612 strm
.CopyTo(buff
, len
);
614 SendMsg(2049, markerNumber
, (sptr_t
)buff
);
619 // Add a set of markers to a line.
620 void wxStyledTextCtrl
::MarkerAddSet(int line
, int set
)
622 SendMsg(2466, line
, set
);
625 // Set the alpha used for a marker that is drawn in the text area, not the margin.
626 void wxStyledTextCtrl
::MarkerSetAlpha(int markerNumber
, int alpha
)
628 SendMsg(2476, markerNumber
, alpha
);
631 // Set a margin to be either numeric or symbolic.
632 void wxStyledTextCtrl
::SetMarginType(int margin
, int marginType
)
634 SendMsg(2240, margin
, marginType
);
637 // Retrieve the type of a margin.
638 int wxStyledTextCtrl
::GetMarginType(int margin
) const
640 return SendMsg(2241, margin
, 0);
643 // Set the width of a margin to a width expressed in pixels.
644 void wxStyledTextCtrl
::SetMarginWidth(int margin
, int pixelWidth
)
646 SendMsg(2242, margin
, pixelWidth
);
649 // Retrieve the width of a margin in pixels.
650 int wxStyledTextCtrl
::GetMarginWidth(int margin
) const
652 return SendMsg(2243, margin
, 0);
655 // Set a mask that determines which markers are displayed in a margin.
656 void wxStyledTextCtrl
::SetMarginMask(int margin
, int mask
)
658 SendMsg(2244, margin
, mask
);
661 // Retrieve the marker mask of a margin.
662 int wxStyledTextCtrl
::GetMarginMask(int margin
) const
664 return SendMsg(2245, margin
, 0);
667 // Make a margin sensitive or insensitive to mouse clicks.
668 void wxStyledTextCtrl
::SetMarginSensitive(int margin
, bool sensitive
)
670 SendMsg(2246, margin
, sensitive
);
673 // Retrieve the mouse click sensitivity of a margin.
674 bool wxStyledTextCtrl
::GetMarginSensitive(int margin
) const
676 return SendMsg(2247, margin
, 0) != 0;
679 // Set the cursor shown when the mouse is inside a margin.
680 void wxStyledTextCtrl
::SetMarginCursorN(int margin
, int cursor
)
682 SendMsg(2248, margin
, cursor
);
685 // Retrieve the cursor shown in a margin.
686 int wxStyledTextCtrl
::GetMarginCursorN(int margin
) const
688 return SendMsg(2249, margin
, 0);
691 // Clear all the styles and make equivalent to the global default style.
692 void wxStyledTextCtrl
::StyleClearAll()
697 // Set the foreground colour of a style.
698 void wxStyledTextCtrl
::StyleSetForeground(int style
, const wxColour
& fore
)
700 SendMsg(2051, style
, wxColourAsLong(fore
));
703 // Set the background colour of a style.
704 void wxStyledTextCtrl
::StyleSetBackground(int style
, const wxColour
& back
)
706 SendMsg(2052, style
, wxColourAsLong(back
));
709 // Set a style to be bold or not.
710 void wxStyledTextCtrl
::StyleSetBold(int style
, bool bold
)
712 SendMsg(2053, style
, bold
);
715 // Set a style to be italic or not.
716 void wxStyledTextCtrl
::StyleSetItalic(int style
, bool italic
)
718 SendMsg(2054, style
, italic
);
721 // Set the size of characters of a style.
722 void wxStyledTextCtrl
::StyleSetSize(int style
, int sizePoints
)
724 SendMsg(2055, style
, sizePoints
);
727 // Set the font of a style.
728 void wxStyledTextCtrl
::StyleSetFaceName(int style
, const wxString
& fontName
)
730 SendMsg(2056, style
, (sptr_t
)(const char*)wx2stc(fontName
));
733 // Set a style to have its end of line filled or not.
734 void wxStyledTextCtrl
::StyleSetEOLFilled(int style
, bool filled
)
736 SendMsg(2057, style
, filled
);
739 // Reset the default style to its state at startup
740 void wxStyledTextCtrl
::StyleResetDefault()
745 // Set a style to be underlined or not.
746 void wxStyledTextCtrl
::StyleSetUnderline(int style
, bool underline
)
748 SendMsg(2059, style
, underline
);
751 // Get the foreground colour of a style.
752 wxColour wxStyledTextCtrl
::StyleGetForeground(int style
) const
754 long c
= SendMsg(2481, style
, 0);
755 return wxColourFromLong(c
);
758 // Get the background colour of a style.
759 wxColour wxStyledTextCtrl
::StyleGetBackground(int style
) const
761 long c
= SendMsg(2482, style
, 0);
762 return wxColourFromLong(c
);
765 // Get is a style bold or not.
766 bool wxStyledTextCtrl
::StyleGetBold(int style
) const
768 return SendMsg(2483, style
, 0) != 0;
771 // Get is a style italic or not.
772 bool wxStyledTextCtrl
::StyleGetItalic(int style
) const
774 return SendMsg(2484, style
, 0) != 0;
777 // Get the size of characters of a style.
778 int wxStyledTextCtrl
::StyleGetSize(int style
) const
780 return SendMsg(2485, style
, 0);
783 // Get the font facename of a style
784 wxString wxStyledTextCtrl
::StyleGetFaceName(int style
) {
786 long len
= SendMsg(msg
, style
, 0);
787 wxMemoryBuffer
mbuf(len
+1);
788 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
789 SendMsg(msg
, style
, (sptr_t
)buf
);
790 mbuf
.UngetWriteBuf(len
);
795 // Get is a style to have its end of line filled or not.
796 bool wxStyledTextCtrl
::StyleGetEOLFilled(int style
) const
798 return SendMsg(2487, style
, 0) != 0;
801 // Get is a style underlined or not.
802 bool wxStyledTextCtrl
::StyleGetUnderline(int style
) const
804 return SendMsg(2488, style
, 0) != 0;
807 // Get is a style mixed case, or to force upper or lower case.
808 int wxStyledTextCtrl
::StyleGetCase(int style
) const
810 return SendMsg(2489, style
, 0);
813 // Get the character set of the font in a style.
814 int wxStyledTextCtrl
::StyleGetCharacterSet(int style
) const
816 return SendMsg(2490, style
, 0);
819 // Get is a style visible or not.
820 bool wxStyledTextCtrl
::StyleGetVisible(int style
) const
822 return SendMsg(2491, style
, 0) != 0;
825 // Get is a style changeable or not (read only).
826 // Experimental feature, currently buggy.
827 bool wxStyledTextCtrl
::StyleGetChangeable(int style
) const
829 return SendMsg(2492, style
, 0) != 0;
832 // Get is a style a hotspot or not.
833 bool wxStyledTextCtrl
::StyleGetHotSpot(int style
) const
835 return SendMsg(2493, style
, 0) != 0;
838 // Set a style to be mixed case, or to force upper or lower case.
839 void wxStyledTextCtrl
::StyleSetCase(int style
, int caseForce
)
841 SendMsg(2060, style
, caseForce
);
844 // Set the size of characters of a style. Size is in points multiplied by 100.
845 void wxStyledTextCtrl
::StyleSetSizeFractional(int style
, int caseForce
)
847 SendMsg(2061, style
, caseForce
);
850 // Get the size of characters of a style in points multiplied by 100
851 int wxStyledTextCtrl
::StyleGetSizeFractional(int style
) const
853 return SendMsg(2062, style
, 0);
856 // Set the weight of characters of a style.
857 void wxStyledTextCtrl
::StyleSetWeight(int style
, int weight
)
859 SendMsg(2063, style
, weight
);
862 // Get the weight of characters of a style.
863 int wxStyledTextCtrl
::StyleGetWeight(int style
) const
865 return SendMsg(2064, style
, 0);
868 // Set a style to be a hotspot or not.
869 void wxStyledTextCtrl
::StyleSetHotSpot(int style
, bool hotspot
)
871 SendMsg(2409, style
, hotspot
);
874 // Set the foreground colour of the main and additional selections and whether to use this setting.
875 void wxStyledTextCtrl
::SetSelForeground(bool useSetting
, const wxColour
& fore
)
877 SendMsg(2067, useSetting
, wxColourAsLong(fore
));
880 // Set the background colour of the main and additional selections and whether to use this setting.
881 void wxStyledTextCtrl
::SetSelBackground(bool useSetting
, const wxColour
& back
)
883 SendMsg(2068, useSetting
, wxColourAsLong(back
));
886 // Get the alpha of the selection.
887 int wxStyledTextCtrl
::GetSelAlpha() const
889 return SendMsg(2477, 0, 0);
892 // Set the alpha of the selection.
893 void wxStyledTextCtrl
::SetSelAlpha(int alpha
)
895 SendMsg(2478, alpha
, 0);
898 // Is the selection end of line filled?
899 bool wxStyledTextCtrl
::GetSelEOLFilled() const
901 return SendMsg(2479, 0, 0) != 0;
904 // Set the selection to have its end of line filled or not.
905 void wxStyledTextCtrl
::SetSelEOLFilled(bool filled
)
907 SendMsg(2480, filled
, 0);
910 // Set the foreground colour of the caret.
911 void wxStyledTextCtrl
::SetCaretForeground(const wxColour
& fore
)
913 SendMsg(2069, wxColourAsLong(fore
), 0);
916 // When key+modifier combination km is pressed perform msg.
917 void wxStyledTextCtrl
::CmdKeyAssign(int key
, int modifiers
, int cmd
) {
918 SendMsg(2070, MAKELONG(key
, modifiers
), cmd
);
921 // When key+modifier combination km is pressed do nothing.
922 void wxStyledTextCtrl
::CmdKeyClear(int key
, int modifiers
) {
923 SendMsg(2071, MAKELONG(key
, modifiers
));
926 // Drop all key mappings.
927 void wxStyledTextCtrl
::CmdKeyClearAll()
932 // Set the styles for a segment of the document.
933 void wxStyledTextCtrl
::SetStyleBytes(int length
, char* styleBytes
) {
934 SendMsg(2073, length
, (sptr_t
)styleBytes
);
937 // Set a style to be visible or not.
938 void wxStyledTextCtrl
::StyleSetVisible(int style
, bool visible
)
940 SendMsg(2074, style
, visible
);
943 // Get the time in milliseconds that the caret is on and off.
944 int wxStyledTextCtrl
::GetCaretPeriod() const
946 return SendMsg(2075, 0, 0);
949 // Get the time in milliseconds that the caret is on and off. 0 = steady on.
950 void wxStyledTextCtrl
::SetCaretPeriod(int periodMilliseconds
)
952 SendMsg(2076, periodMilliseconds
, 0);
955 // Set the set of characters making up words for when moving or selecting by word.
956 // First sets defaults like SetCharsDefault.
957 void wxStyledTextCtrl
::SetWordChars(const wxString
& characters
)
959 SendMsg(2077, 0, (sptr_t
)(const char*)wx2stc(characters
));
962 // Get the set of characters making up words for when moving or selecting by word.
963 wxString wxStyledTextCtrl
::GetWordChars() const {
965 int len
= SendMsg(msg
, NULL
);
966 if (!len
) return wxEmptyString
;
968 wxMemoryBuffer
mbuf(len
+1);
969 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
970 SendMsg(msg
, (sptr_t
)buf
);
971 mbuf
.UngetWriteBuf(len
);
976 // Start a sequence of actions that is undone and redone as a unit.
978 void wxStyledTextCtrl
::BeginUndoAction()
983 // End a sequence of actions that is undone and redone as a unit.
984 void wxStyledTextCtrl
::EndUndoAction()
989 // Set an indicator to plain, squiggle or TT.
990 void wxStyledTextCtrl
::IndicatorSetStyle(int indic
, int style
)
992 SendMsg(2080, indic
, style
);
995 // Retrieve the style of an indicator.
996 int wxStyledTextCtrl
::IndicatorGetStyle(int indic
) const
998 return SendMsg(2081, indic
, 0);
1001 // Set the foreground colour of an indicator.
1002 void wxStyledTextCtrl
::IndicatorSetForeground(int indic
, const wxColour
& fore
)
1004 SendMsg(2082, indic
, wxColourAsLong(fore
));
1007 // Retrieve the foreground colour of an indicator.
1008 wxColour wxStyledTextCtrl
::IndicatorGetForeground(int indic
) const
1010 long c
= SendMsg(2083, indic
, 0);
1011 return wxColourFromLong(c
);
1014 // Set an indicator to draw under text or over(default).
1015 void wxStyledTextCtrl
::IndicatorSetUnder(int indic
, bool under
)
1017 SendMsg(2510, indic
, under
);
1020 // Retrieve whether indicator drawn under or over text.
1021 bool wxStyledTextCtrl
::IndicatorGetUnder(int indic
) const
1023 return SendMsg(2511, indic
, 0) != 0;
1026 // Set the foreground colour of all whitespace and whether to use this setting.
1027 void wxStyledTextCtrl
::SetWhitespaceForeground(bool useSetting
, const wxColour
& fore
)
1029 SendMsg(2084, useSetting
, wxColourAsLong(fore
));
1032 // Set the background colour of all whitespace and whether to use this setting.
1033 void wxStyledTextCtrl
::SetWhitespaceBackground(bool useSetting
, const wxColour
& back
)
1035 SendMsg(2085, useSetting
, wxColourAsLong(back
));
1038 // Set the size of the dots used to mark space characters.
1039 void wxStyledTextCtrl
::SetWhitespaceSize(int size
)
1041 SendMsg(2086, size
, 0);
1044 // Get the size of the dots used to mark space characters.
1045 int wxStyledTextCtrl
::GetWhitespaceSize() const
1047 return SendMsg(2087, 0, 0);
1050 // Divide each styling byte into lexical class bits (default: 5) and indicator
1051 // bits (default: 3). If a lexer requires more than 32 lexical states, then this
1052 // is used to expand the possible states.
1053 void wxStyledTextCtrl
::SetStyleBits(int bits
)
1055 SendMsg(2090, bits
, 0);
1058 // Retrieve number of bits in style bytes used to hold the lexical state.
1059 int wxStyledTextCtrl
::GetStyleBits() const
1061 return SendMsg(2091, 0, 0);
1064 // Used to hold extra styling information for each line.
1065 void wxStyledTextCtrl
::SetLineState(int line
, int state
)
1067 SendMsg(2092, line
, state
);
1070 // Retrieve the extra styling information for a line.
1071 int wxStyledTextCtrl
::GetLineState(int line
) const
1073 return SendMsg(2093, line
, 0);
1076 // Retrieve the last line number that has line state.
1077 int wxStyledTextCtrl
::GetMaxLineState() const
1079 return SendMsg(2094, 0, 0);
1082 // Is the background of the line containing the caret in a different colour?
1083 bool wxStyledTextCtrl
::GetCaretLineVisible() const
1085 return SendMsg(2095, 0, 0) != 0;
1088 // Display the background of the line containing the caret in a different colour.
1089 void wxStyledTextCtrl
::SetCaretLineVisible(bool show
)
1091 SendMsg(2096, show
, 0);
1094 // Get the colour of the background of the line containing the caret.
1095 wxColour wxStyledTextCtrl
::GetCaretLineBackground() const
1097 long c
= SendMsg(2097, 0, 0);
1098 return wxColourFromLong(c
);
1101 // Set the colour of the background of the line containing the caret.
1102 void wxStyledTextCtrl
::SetCaretLineBackground(const wxColour
& back
)
1104 SendMsg(2098, wxColourAsLong(back
), 0);
1107 // Set a style to be changeable or not (read only).
1108 // Experimental feature, currently buggy.
1109 void wxStyledTextCtrl
::StyleSetChangeable(int style
, bool changeable
)
1111 SendMsg(2099, style
, changeable
);
1114 // Display a auto-completion list.
1115 // The lenEntered parameter indicates how many characters before
1116 // the caret should be used to provide context.
1117 void wxStyledTextCtrl
::AutoCompShow(int lenEntered
, const wxString
& itemList
)
1119 SendMsg(2100, lenEntered
, (sptr_t
)(const char*)wx2stc(itemList
));
1122 // Remove the auto-completion list from the screen.
1123 void wxStyledTextCtrl
::AutoCompCancel()
1125 SendMsg(2101, 0, 0);
1128 // Is there an auto-completion list visible?
1129 bool wxStyledTextCtrl
::AutoCompActive()
1131 return SendMsg(2102, 0, 0) != 0;
1134 // Retrieve the position of the caret when the auto-completion list was displayed.
1135 int wxStyledTextCtrl
::AutoCompPosStart()
1137 return SendMsg(2103, 0, 0);
1140 // User has selected an item so remove the list and insert the selection.
1141 void wxStyledTextCtrl
::AutoCompComplete()
1143 SendMsg(2104, 0, 0);
1146 // Define a set of character that when typed cancel the auto-completion list.
1147 void wxStyledTextCtrl
::AutoCompStops(const wxString
& characterSet
)
1149 SendMsg(2105, 0, (sptr_t
)(const char*)wx2stc(characterSet
));
1152 // Change the separator character in the string setting up an auto-completion list.
1153 // Default is space but can be changed if items contain space.
1154 void wxStyledTextCtrl
::AutoCompSetSeparator(int separatorCharacter
)
1156 SendMsg(2106, separatorCharacter
, 0);
1159 // Retrieve the auto-completion list separator character.
1160 int wxStyledTextCtrl
::AutoCompGetSeparator() const
1162 return SendMsg(2107, 0, 0);
1165 // Select the item in the auto-completion list that starts with a string.
1166 void wxStyledTextCtrl
::AutoCompSelect(const wxString
& text
)
1168 SendMsg(2108, 0, (sptr_t
)(const char*)wx2stc(text
));
1171 // Should the auto-completion list be cancelled if the user backspaces to a
1172 // position before where the box was created.
1173 void wxStyledTextCtrl
::AutoCompSetCancelAtStart(bool cancel
)
1175 SendMsg(2110, cancel
, 0);
1178 // Retrieve whether auto-completion cancelled by backspacing before start.
1179 bool wxStyledTextCtrl
::AutoCompGetCancelAtStart() const
1181 return SendMsg(2111, 0, 0) != 0;
1184 // Define a set of characters that when typed will cause the autocompletion to
1185 // choose the selected item.
1186 void wxStyledTextCtrl
::AutoCompSetFillUps(const wxString
& characterSet
)
1188 SendMsg(2112, 0, (sptr_t
)(const char*)wx2stc(characterSet
));
1191 // Should a single item auto-completion list automatically choose the item.
1192 void wxStyledTextCtrl
::AutoCompSetChooseSingle(bool chooseSingle
)
1194 SendMsg(2113, chooseSingle
, 0);
1197 // Retrieve whether a single item auto-completion list automatically choose the item.
1198 bool wxStyledTextCtrl
::AutoCompGetChooseSingle() const
1200 return SendMsg(2114, 0, 0) != 0;
1203 // Set whether case is significant when performing auto-completion searches.
1204 void wxStyledTextCtrl
::AutoCompSetIgnoreCase(bool ignoreCase
)
1206 SendMsg(2115, ignoreCase
, 0);
1209 // Retrieve state of ignore case flag.
1210 bool wxStyledTextCtrl
::AutoCompGetIgnoreCase() const
1212 return SendMsg(2116, 0, 0) != 0;
1215 // Display a list of strings and send notification when user chooses one.
1216 void wxStyledTextCtrl
::UserListShow(int listType
, const wxString
& itemList
)
1218 SendMsg(2117, listType
, (sptr_t
)(const char*)wx2stc(itemList
));
1221 // Set whether or not autocompletion is hidden automatically when nothing matches.
1222 void wxStyledTextCtrl
::AutoCompSetAutoHide(bool autoHide
)
1224 SendMsg(2118, autoHide
, 0);
1227 // Retrieve whether or not autocompletion is hidden automatically when nothing matches.
1228 bool wxStyledTextCtrl
::AutoCompGetAutoHide() const
1230 return SendMsg(2119, 0, 0) != 0;
1233 // Set whether or not autocompletion deletes any word characters
1234 // after the inserted text upon completion.
1235 void wxStyledTextCtrl
::AutoCompSetDropRestOfWord(bool dropRestOfWord
)
1237 SendMsg(2270, dropRestOfWord
, 0);
1240 // Retrieve whether or not autocompletion deletes any word characters
1241 // after the inserted text upon completion.
1242 bool wxStyledTextCtrl
::AutoCompGetDropRestOfWord() const
1244 return SendMsg(2271, 0, 0) != 0;
1247 // Register an image for use in autocompletion lists.
1248 void wxStyledTextCtrl
::RegisterImage(int type
, const wxBitmap
& bmp
) {
1249 // convert bmp to a xpm in a string
1250 wxMemoryOutputStream strm
;
1251 wxImage img
= bmp
.ConvertToImage();
1253 img
.ConvertAlphaToMask();
1254 img
.SaveFile(strm
, wxBITMAP_TYPE_XPM
);
1255 size_t len
= strm
.GetSize();
1256 char* buff
= new char[len
+1];
1257 strm
.CopyTo(buff
, len
);
1259 SendMsg(2405, type
, (sptr_t
)buff
);
1264 // Clear all the registered images.
1265 void wxStyledTextCtrl
::ClearRegisteredImages()
1267 SendMsg(2408, 0, 0);
1270 // Retrieve the auto-completion list type-separator character.
1271 int wxStyledTextCtrl
::AutoCompGetTypeSeparator() const
1273 return SendMsg(2285, 0, 0);
1276 // Change the type-separator character in the string setting up an auto-completion list.
1277 // Default is '?' but can be changed if items contain '?'.
1278 void wxStyledTextCtrl
::AutoCompSetTypeSeparator(int separatorCharacter
)
1280 SendMsg(2286, separatorCharacter
, 0);
1283 // Set the maximum width, in characters, of auto-completion and user lists.
1284 // Set to 0 to autosize to fit longest item, which is the default.
1285 void wxStyledTextCtrl
::AutoCompSetMaxWidth(int characterCount
)
1287 SendMsg(2208, characterCount
, 0);
1290 // Get the maximum width, in characters, of auto-completion and user lists.
1291 int wxStyledTextCtrl
::AutoCompGetMaxWidth() const
1293 return SendMsg(2209, 0, 0);
1296 // Set the maximum height, in rows, of auto-completion and user lists.
1297 // The default is 5 rows.
1298 void wxStyledTextCtrl
::AutoCompSetMaxHeight(int rowCount
)
1300 SendMsg(2210, rowCount
, 0);
1303 // Set the maximum height, in rows, of auto-completion and user lists.
1304 int wxStyledTextCtrl
::AutoCompGetMaxHeight() const
1306 return SendMsg(2211, 0, 0);
1309 // Set the number of spaces used for one level of indentation.
1310 void wxStyledTextCtrl
::SetIndent(int indentSize
)
1312 SendMsg(2122, indentSize
, 0);
1315 // Retrieve indentation size.
1316 int wxStyledTextCtrl
::GetIndent() const
1318 return SendMsg(2123, 0, 0);
1321 // Indentation will only use space characters if useTabs is false, otherwise
1322 // it will use a combination of tabs and spaces.
1323 void wxStyledTextCtrl
::SetUseTabs(bool useTabs
)
1325 SendMsg(2124, useTabs
, 0);
1328 // Retrieve whether tabs will be used in indentation.
1329 bool wxStyledTextCtrl
::GetUseTabs() const
1331 return SendMsg(2125, 0, 0) != 0;
1334 // Change the indentation of a line to a number of columns.
1335 void wxStyledTextCtrl
::SetLineIndentation(int line
, int indentSize
)
1337 SendMsg(2126, line
, indentSize
);
1340 // Retrieve the number of columns that a line is indented.
1341 int wxStyledTextCtrl
::GetLineIndentation(int line
) const
1343 return SendMsg(2127, line
, 0);
1346 // Retrieve the position before the first non indentation character on a line.
1347 int wxStyledTextCtrl
::GetLineIndentPosition(int line
) const
1349 return SendMsg(2128, line
, 0);
1352 // Retrieve the column number of a position, taking tab width into account.
1353 int wxStyledTextCtrl
::GetColumn(int pos
) const
1355 return SendMsg(2129, pos
, 0);
1358 // Count characters between two positions.
1359 int wxStyledTextCtrl
::CountCharacters(int startPos
, int endPos
)
1361 return SendMsg(2633, startPos
, endPos
);
1364 // Show or hide the horizontal scroll bar.
1365 void wxStyledTextCtrl
::SetUseHorizontalScrollBar(bool show
)
1367 SendMsg(2130, show
, 0);
1370 // Is the horizontal scroll bar visible?
1371 bool wxStyledTextCtrl
::GetUseHorizontalScrollBar() const
1373 return SendMsg(2131, 0, 0) != 0;
1376 // Show or hide indentation guides.
1377 void wxStyledTextCtrl
::SetIndentationGuides(int indentView
)
1379 SendMsg(2132, indentView
, 0);
1382 // Are the indentation guides visible?
1383 int wxStyledTextCtrl
::GetIndentationGuides() const
1385 return SendMsg(2133, 0, 0);
1388 // Set the highlighted indentation guide column.
1389 // 0 = no highlighted guide.
1390 void wxStyledTextCtrl
::SetHighlightGuide(int column
)
1392 SendMsg(2134, column
, 0);
1395 // Get the highlighted indentation guide column.
1396 int wxStyledTextCtrl
::GetHighlightGuide() const
1398 return SendMsg(2135, 0, 0);
1401 // Get the position after the last visible characters on a line.
1402 int wxStyledTextCtrl
::GetLineEndPosition(int line
) const
1404 return SendMsg(2136, line
, 0);
1407 // Get the code page used to interpret the bytes of the document as characters.
1408 int wxStyledTextCtrl
::GetCodePage() const
1410 return SendMsg(2137, 0, 0);
1413 // Get the foreground colour of the caret.
1414 wxColour wxStyledTextCtrl
::GetCaretForeground() const
1416 long c
= SendMsg(2138, 0, 0);
1417 return wxColourFromLong(c
);
1420 // In read-only mode?
1421 bool wxStyledTextCtrl
::GetReadOnly() const
1423 return SendMsg(2140, 0, 0) != 0;
1426 // Sets the position of the caret.
1427 void wxStyledTextCtrl
::SetCurrentPos(int pos
)
1429 SendMsg(2141, pos
, 0);
1432 // Sets the position that starts the selection - this becomes the anchor.
1433 void wxStyledTextCtrl
::SetSelectionStart(int pos
)
1435 SendMsg(2142, pos
, 0);
1438 // Returns the position at the start of the selection.
1439 int wxStyledTextCtrl
::GetSelectionStart() const
1441 return SendMsg(2143, 0, 0);
1444 // Sets the position that ends the selection - this becomes the currentPosition.
1445 void wxStyledTextCtrl
::SetSelectionEnd(int pos
)
1447 SendMsg(2144, pos
, 0);
1450 // Returns the position at the end of the selection.
1451 int wxStyledTextCtrl
::GetSelectionEnd() const
1453 return SendMsg(2145, 0, 0);
1456 // Set caret to a position, while removing any existing selection.
1457 void wxStyledTextCtrl
::SetEmptySelection(int pos
)
1459 SendMsg(2556, pos
, 0);
1462 // Sets the print magnification added to the point size of each style for printing.
1463 void wxStyledTextCtrl
::SetPrintMagnification(int magnification
)
1465 SendMsg(2146, magnification
, 0);
1468 // Returns the print magnification.
1469 int wxStyledTextCtrl
::GetPrintMagnification() const
1471 return SendMsg(2147, 0, 0);
1474 // Modify colours when printing for clearer printed text.
1475 void wxStyledTextCtrl
::SetPrintColourMode(int mode
)
1477 SendMsg(2148, mode
, 0);
1480 // Returns the print colour mode.
1481 int wxStyledTextCtrl
::GetPrintColourMode() const
1483 return SendMsg(2149, 0, 0);
1486 // Find some text in the document.
1487 int wxStyledTextCtrl
::FindText(int minPos
, int maxPos
,
1488 const wxString
& text
,
1491 ft
.chrg
.cpMin
= minPos
;
1492 ft
.chrg
.cpMax
= maxPos
;
1493 const wxWX2MBbuf buf
= wx2stc(text
);
1494 ft
.lpstrText
= (char*)(const char*)buf
;
1496 return SendMsg(2150, flags
, (sptr_t
)&ft
);
1499 // On Windows, will draw the document into a display context such as a printer.
1500 int wxStyledTextCtrl
::FormatRange(bool doDraw
,
1509 if (endPos
< startPos
) {
1510 int temp
= startPos
;
1515 fr
.hdcTarget
= target
;
1516 fr
.rc
.top
= renderRect
.GetTop();
1517 fr
.rc
.left
= renderRect
.GetLeft();
1518 fr
.rc
.right
= renderRect
.GetRight();
1519 fr
.rc
.bottom
= renderRect
.GetBottom();
1520 fr
.rcPage
.top
= pageRect
.GetTop();
1521 fr
.rcPage
.left
= pageRect
.GetLeft();
1522 fr
.rcPage
.right
= pageRect
.GetRight();
1523 fr
.rcPage
.bottom
= pageRect
.GetBottom();
1524 fr
.chrg
.cpMin
= startPos
;
1525 fr
.chrg
.cpMax
= endPos
;
1527 return SendMsg(2151, doDraw
, (sptr_t
)&fr
);
1530 // Retrieve the display line at the top of the display.
1531 int wxStyledTextCtrl
::GetFirstVisibleLine() const
1533 return SendMsg(2152, 0, 0);
1536 // Retrieve the contents of a line.
1537 wxString wxStyledTextCtrl
::GetLine(int line
) const {
1538 int len
= LineLength(line
);
1539 if (!len
) return wxEmptyString
;
1541 wxMemoryBuffer
mbuf(len
+1);
1542 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1543 SendMsg(2153, line
, (sptr_t
)buf
);
1544 mbuf
.UngetWriteBuf(len
);
1549 // Returns the number of lines in the document. There is always at least one.
1550 int wxStyledTextCtrl
::GetLineCount() const
1552 return SendMsg(2154, 0, 0);
1555 // Sets the size in pixels of the left margin.
1556 void wxStyledTextCtrl
::SetMarginLeft(int pixelWidth
)
1558 SendMsg(2155, 0, pixelWidth
);
1561 // Returns the size in pixels of the left margin.
1562 int wxStyledTextCtrl
::GetMarginLeft() const
1564 return SendMsg(2156, 0, 0);
1567 // Sets the size in pixels of the right margin.
1568 void wxStyledTextCtrl
::SetMarginRight(int pixelWidth
)
1570 SendMsg(2157, 0, pixelWidth
);
1573 // Returns the size in pixels of the right margin.
1574 int wxStyledTextCtrl
::GetMarginRight() const
1576 return SendMsg(2158, 0, 0);
1579 // Is the document different from when it was last saved?
1580 bool wxStyledTextCtrl
::GetModify() const
1582 return SendMsg(2159, 0, 0) != 0;
1585 // Retrieve the selected text.
1586 wxString wxStyledTextCtrl
::GetSelectedText() {
1587 const int len
= SendMsg(SCI_GETSELTEXT
, 0, (sptr_t
)0);
1588 if (!len
) return wxEmptyString
;
1590 wxMemoryBuffer
mbuf(len
+2);
1591 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1592 SendMsg(2161, 0, (sptr_t
)buf
);
1593 mbuf
.UngetWriteBuf(len
);
1598 // Retrieve a range of text.
1599 wxString wxStyledTextCtrl
::GetTextRange(int startPos
, int endPos
) {
1600 if (endPos
< startPos
) {
1601 int temp
= startPos
;
1605 int len
= endPos
- startPos
;
1606 if (!len
) return wxEmptyString
;
1607 wxMemoryBuffer
mbuf(len
+1);
1608 char* buf
= (char*)mbuf
.GetWriteBuf(len
);
1611 tr
.chrg
.cpMin
= startPos
;
1612 tr
.chrg
.cpMax
= endPos
;
1613 SendMsg(2162, 0, (sptr_t
)&tr
);
1614 mbuf
.UngetWriteBuf(len
);
1619 // Draw the selection in normal style or with selection highlighted.
1620 void wxStyledTextCtrl
::HideSelection(bool normal
)
1622 SendMsg(2163, normal
, 0);
1625 // Retrieve the line containing a position.
1626 int wxStyledTextCtrl
::LineFromPosition(int pos
) const
1628 return SendMsg(2166, pos
, 0);
1631 // Retrieve the position at the start of a line.
1632 int wxStyledTextCtrl
::PositionFromLine(int line
) const
1634 return SendMsg(2167, line
, 0);
1637 // Scroll horizontally and vertically.
1638 void wxStyledTextCtrl
::LineScroll(int columns
, int lines
)
1640 SendMsg(2168, columns
, lines
);
1643 // Ensure the caret is visible.
1644 void wxStyledTextCtrl
::EnsureCaretVisible()
1646 SendMsg(2169, 0, 0);
1649 // Replace the selected text with the argument text.
1650 void wxStyledTextCtrl
::ReplaceSelection(const wxString
& text
)
1652 SendMsg(2170, 0, (sptr_t
)(const char*)wx2stc(text
));
1655 // Set to read only or read write.
1656 void wxStyledTextCtrl
::SetReadOnly(bool readOnly
)
1658 SendMsg(2171, readOnly
, 0);
1661 // Will a paste succeed?
1662 bool wxStyledTextCtrl
::CanPaste() const
1664 return SendMsg(2173, 0, 0) != 0;
1667 // Are there any undoable actions in the undo history?
1668 bool wxStyledTextCtrl
::CanUndo() const
1670 return SendMsg(2174, 0, 0) != 0;
1673 // Delete the undo history.
1674 void wxStyledTextCtrl
::EmptyUndoBuffer()
1676 SendMsg(2175, 0, 0);
1679 // Undo one action in the undo history.
1680 void wxStyledTextCtrl
::Undo()
1682 SendMsg(2176, 0, 0);
1685 // Cut the selection to the clipboard.
1686 void wxStyledTextCtrl
::Cut()
1688 SendMsg(2177, 0, 0);
1691 // Copy the selection to the clipboard.
1692 void wxStyledTextCtrl
::Copy()
1694 SendMsg(2178, 0, 0);
1697 // Paste the contents of the clipboard into the document replacing the selection.
1698 void wxStyledTextCtrl
::Paste()
1700 SendMsg(2179, 0, 0);
1703 // Clear the selection.
1704 void wxStyledTextCtrl
::Clear()
1706 SendMsg(2180, 0, 0);
1709 // Replace the contents of the document with the argument text.
1710 void wxStyledTextCtrl
::SetText(const wxString
& text
)
1712 SendMsg(2181, 0, (sptr_t
)(const char*)wx2stc(text
));
1715 // Retrieve all the text in the document.
1716 wxString wxStyledTextCtrl
::GetText() const {
1717 int len
= GetTextLength();
1718 wxMemoryBuffer
mbuf(len
+1); // leave room for the null...
1719 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1720 SendMsg(2182, len
+1, (sptr_t
)buf
);
1721 mbuf
.UngetWriteBuf(len
);
1726 // Retrieve the number of characters in the document.
1727 int wxStyledTextCtrl
::GetTextLength() const
1729 return SendMsg(2183, 0, 0);
1732 // Set to overtype (true) or insert mode.
1733 void wxStyledTextCtrl
::SetOvertype(bool overtype
)
1735 SendMsg(2186, overtype
, 0);
1738 // Returns true if overtype mode is active otherwise false is returned.
1739 bool wxStyledTextCtrl
::GetOvertype() const
1741 return SendMsg(2187, 0, 0) != 0;
1744 // Set the width of the insert mode caret.
1745 void wxStyledTextCtrl
::SetCaretWidth(int pixelWidth
)
1747 SendMsg(2188, pixelWidth
, 0);
1750 // Returns the width of the insert mode caret.
1751 int wxStyledTextCtrl
::GetCaretWidth() const
1753 return SendMsg(2189, 0, 0);
1756 // Sets the position that starts the target which is used for updating the
1757 // document without affecting the scroll position.
1758 void wxStyledTextCtrl
::SetTargetStart(int pos
)
1760 SendMsg(2190, pos
, 0);
1763 // Get the position that starts the target.
1764 int wxStyledTextCtrl
::GetTargetStart() const
1766 return SendMsg(2191, 0, 0);
1769 // Sets the position that ends the target which is used for updating the
1770 // document without affecting the scroll position.
1771 void wxStyledTextCtrl
::SetTargetEnd(int pos
)
1773 SendMsg(2192, pos
, 0);
1776 // Get the position that ends the target.
1777 int wxStyledTextCtrl
::GetTargetEnd() const
1779 return SendMsg(2193, 0, 0);
1782 // Replace the target text with the argument text.
1783 // Text is counted so it can contain NULs.
1784 // Returns the length of the replacement text.
1786 int wxStyledTextCtrl
::ReplaceTarget(const wxString
& text
) {
1787 const wxWX2MBbuf buf
= wx2stc(text
);
1788 return SendMsg(2194, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
1791 // Replace the target text with the argument text after \d processing.
1792 // Text is counted so it can contain NULs.
1793 // Looks for \d where d is between 1 and 9 and replaces these with the strings
1794 // matched in the last search operation which were surrounded by \( and \).
1795 // Returns the length of the replacement text including any change
1796 // caused by processing the \d patterns.
1798 int wxStyledTextCtrl
::ReplaceTargetRE(const wxString
& text
) {
1799 const wxWX2MBbuf buf
= wx2stc(text
);
1800 return SendMsg(2195, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
1803 // Search for a counted string in the target and set the target to the found
1804 // range. Text is counted so it can contain NULs.
1805 // Returns length of range or -1 for failure in which case target is not moved.
1807 int wxStyledTextCtrl
::SearchInTarget(const wxString
& text
) {
1808 const wxWX2MBbuf buf
= wx2stc(text
);
1809 return SendMsg(2197, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
1812 // Set the search flags used by SearchInTarget.
1813 void wxStyledTextCtrl
::SetSearchFlags(int flags
)
1815 SendMsg(2198, flags
, 0);
1818 // Get the search flags used by SearchInTarget.
1819 int wxStyledTextCtrl
::GetSearchFlags() const
1821 return SendMsg(2199, 0, 0);
1824 // Show a call tip containing a definition near position pos.
1825 void wxStyledTextCtrl
::CallTipShow(int pos
, const wxString
& definition
)
1827 SendMsg(2200, pos
, (sptr_t
)(const char*)wx2stc(definition
));
1830 // Remove the call tip from the screen.
1831 void wxStyledTextCtrl
::CallTipCancel()
1833 SendMsg(2201, 0, 0);
1836 // Is there an active call tip?
1837 bool wxStyledTextCtrl
::CallTipActive()
1839 return SendMsg(2202, 0, 0) != 0;
1842 // Retrieve the position where the caret was before displaying the call tip.
1843 int wxStyledTextCtrl
::CallTipPosAtStart()
1845 return SendMsg(2203, 0, 0);
1848 // Highlight a segment of the definition.
1849 void wxStyledTextCtrl
::CallTipSetHighlight(int start
, int end
)
1851 SendMsg(2204, start
, end
);
1854 // Set the background colour for the call tip.
1855 void wxStyledTextCtrl
::CallTipSetBackground(const wxColour
& back
)
1857 SendMsg(2205, wxColourAsLong(back
), 0);
1860 // Set the foreground colour for the call tip.
1861 void wxStyledTextCtrl
::CallTipSetForeground(const wxColour
& fore
)
1863 SendMsg(2206, wxColourAsLong(fore
), 0);
1866 // Set the foreground colour for the highlighted part of the call tip.
1867 void wxStyledTextCtrl
::CallTipSetForegroundHighlight(const wxColour
& fore
)
1869 SendMsg(2207, wxColourAsLong(fore
), 0);
1872 // Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
1873 void wxStyledTextCtrl
::CallTipUseStyle(int tabSize
)
1875 SendMsg(2212, tabSize
, 0);
1878 // Set position of calltip, above or below text.
1879 void wxStyledTextCtrl
::CallTipSetPosition(bool above
)
1881 SendMsg(2213, above
, 0);
1884 // Find the display line of a document line taking hidden lines into account.
1885 int wxStyledTextCtrl
::VisibleFromDocLine(int line
)
1887 return SendMsg(2220, line
, 0);
1890 // Find the document line of a display line taking hidden lines into account.
1891 int wxStyledTextCtrl
::DocLineFromVisible(int lineDisplay
)
1893 return SendMsg(2221, lineDisplay
, 0);
1896 // The number of display lines needed to wrap a document line
1897 int wxStyledTextCtrl
::WrapCount(int line
)
1899 return SendMsg(2235, line
, 0);
1902 // Set the fold level of a line.
1903 // This encodes an integer level along with flags indicating whether the
1904 // line is a header and whether it is effectively white space.
1905 void wxStyledTextCtrl
::SetFoldLevel(int line
, int level
)
1907 SendMsg(2222, line
, level
);
1910 // Retrieve the fold level of a line.
1911 int wxStyledTextCtrl
::GetFoldLevel(int line
) const
1913 return SendMsg(2223, line
, 0);
1916 // Find the last child line of a header line.
1917 int wxStyledTextCtrl
::GetLastChild(int line
, int level
) const
1919 return SendMsg(2224, line
, level
);
1922 // Find the parent line of a child line.
1923 int wxStyledTextCtrl
::GetFoldParent(int line
) const
1925 return SendMsg(2225, line
, 0);
1928 // Make a range of lines visible.
1929 void wxStyledTextCtrl
::ShowLines(int lineStart
, int lineEnd
)
1931 SendMsg(2226, lineStart
, lineEnd
);
1934 // Make a range of lines invisible.
1935 void wxStyledTextCtrl
::HideLines(int lineStart
, int lineEnd
)
1937 SendMsg(2227, lineStart
, lineEnd
);
1940 // Is a line visible?
1941 bool wxStyledTextCtrl
::GetLineVisible(int line
) const
1943 return SendMsg(2228, line
, 0) != 0;
1946 // Are all lines visible?
1947 bool wxStyledTextCtrl
::GetAllLinesVisible() const
1949 return SendMsg(2236, 0, 0) != 0;
1952 // Show the children of a header line.
1953 void wxStyledTextCtrl
::SetFoldExpanded(int line
, bool expanded
)
1955 SendMsg(2229, line
, expanded
);
1958 // Is a header line expanded?
1959 bool wxStyledTextCtrl
::GetFoldExpanded(int line
) const
1961 return SendMsg(2230, line
, 0) != 0;
1964 // Switch a header line between expanded and contracted.
1965 void wxStyledTextCtrl
::ToggleFold(int line
)
1967 SendMsg(2231, line
, 0);
1970 // Ensure a particular line is visible by expanding any header line hiding it.
1971 void wxStyledTextCtrl
::EnsureVisible(int line
)
1973 SendMsg(2232, line
, 0);
1976 // Set some style options for folding.
1977 void wxStyledTextCtrl
::SetFoldFlags(int flags
)
1979 SendMsg(2233, flags
, 0);
1982 // Ensure a particular line is visible by expanding any header line hiding it.
1983 // Use the currently set visibility policy to determine which range to display.
1984 void wxStyledTextCtrl
::EnsureVisibleEnforcePolicy(int line
)
1986 SendMsg(2234, line
, 0);
1989 // Sets whether a tab pressed when caret is within indentation indents.
1990 void wxStyledTextCtrl
::SetTabIndents(bool tabIndents
)
1992 SendMsg(2260, tabIndents
, 0);
1995 // Does a tab pressed when caret is within indentation indent?
1996 bool wxStyledTextCtrl
::GetTabIndents() const
1998 return SendMsg(2261, 0, 0) != 0;
2001 // Sets whether a backspace pressed when caret is within indentation unindents.
2002 void wxStyledTextCtrl
::SetBackSpaceUnIndents(bool bsUnIndents
)
2004 SendMsg(2262, bsUnIndents
, 0);
2007 // Does a backspace pressed when caret is within indentation unindent?
2008 bool wxStyledTextCtrl
::GetBackSpaceUnIndents() const
2010 return SendMsg(2263, 0, 0) != 0;
2013 // Sets the time the mouse must sit still to generate a mouse dwell event.
2014 void wxStyledTextCtrl
::SetMouseDwellTime(int periodMilliseconds
)
2016 SendMsg(2264, periodMilliseconds
, 0);
2019 // Retrieve the time the mouse must sit still to generate a mouse dwell event.
2020 int wxStyledTextCtrl
::GetMouseDwellTime() const
2022 return SendMsg(2265, 0, 0);
2025 // Get position of start of word.
2026 int wxStyledTextCtrl
::WordStartPosition(int pos
, bool onlyWordCharacters
)
2028 return SendMsg(2266, pos
, onlyWordCharacters
);
2031 // Get position of end of word.
2032 int wxStyledTextCtrl
::WordEndPosition(int pos
, bool onlyWordCharacters
)
2034 return SendMsg(2267, pos
, onlyWordCharacters
);
2037 // Sets whether text is word wrapped.
2038 void wxStyledTextCtrl
::SetWrapMode(int mode
)
2040 SendMsg(2268, mode
, 0);
2043 // Retrieve whether text is word wrapped.
2044 int wxStyledTextCtrl
::GetWrapMode() const
2046 return SendMsg(2269, 0, 0);
2049 // Set the display mode of visual flags for wrapped lines.
2050 void wxStyledTextCtrl
::SetWrapVisualFlags(int wrapVisualFlags
)
2052 SendMsg(2460, wrapVisualFlags
, 0);
2055 // Retrive the display mode of visual flags for wrapped lines.
2056 int wxStyledTextCtrl
::GetWrapVisualFlags() const
2058 return SendMsg(2461, 0, 0);
2061 // Set the location of visual flags for wrapped lines.
2062 void wxStyledTextCtrl
::SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation
)
2064 SendMsg(2462, wrapVisualFlagsLocation
, 0);
2067 // Retrive the location of visual flags for wrapped lines.
2068 int wxStyledTextCtrl
::GetWrapVisualFlagsLocation() const
2070 return SendMsg(2463, 0, 0);
2073 // Set the start indent for wrapped lines.
2074 void wxStyledTextCtrl
::SetWrapStartIndent(int indent
)
2076 SendMsg(2464, indent
, 0);
2079 // Retrive the start indent for wrapped lines.
2080 int wxStyledTextCtrl
::GetWrapStartIndent() const
2082 return SendMsg(2465, 0, 0);
2085 // Sets how wrapped sublines are placed. Default is fixed.
2086 void wxStyledTextCtrl
::SetWrapIndentMode(int mode
)
2088 SendMsg(2472, mode
, 0);
2091 // Retrieve how wrapped sublines are placed. Default is fixed.
2092 int wxStyledTextCtrl
::GetWrapIndentMode() const
2094 return SendMsg(2473, 0, 0);
2097 // Sets the degree of caching of layout information.
2098 void wxStyledTextCtrl
::SetLayoutCache(int mode
)
2100 SendMsg(2272, mode
, 0);
2103 // Retrieve the degree of caching of layout information.
2104 int wxStyledTextCtrl
::GetLayoutCache() const
2106 return SendMsg(2273, 0, 0);
2109 // Sets the document width assumed for scrolling.
2110 void wxStyledTextCtrl
::SetScrollWidth(int pixelWidth
)
2112 SendMsg(2274, pixelWidth
, 0);
2115 // Retrieve the document width assumed for scrolling.
2116 int wxStyledTextCtrl
::GetScrollWidth() const
2118 return SendMsg(2275, 0, 0);
2121 // Sets whether the maximum width line displayed is used to set scroll width.
2122 void wxStyledTextCtrl
::SetScrollWidthTracking(bool tracking
)
2124 SendMsg(2516, tracking
, 0);
2127 // Retrieve whether the scroll width tracks wide lines.
2128 bool wxStyledTextCtrl
::GetScrollWidthTracking() const
2130 return SendMsg(2517, 0, 0) != 0;
2133 // Measure the pixel width of some text in a particular style.
2134 // NUL terminated text argument.
2135 // Does not handle tab or control characters.
2136 int wxStyledTextCtrl
::TextWidth(int style
, const wxString
& text
)
2138 return SendMsg(2276, style
, (sptr_t
)(const char*)wx2stc(text
));
2141 // Sets the scroll range so that maximum scroll position has
2142 // the last line at the bottom of the view (default).
2143 // Setting this to false allows scrolling one page below the last line.
2144 void wxStyledTextCtrl
::SetEndAtLastLine(bool endAtLastLine
)
2146 SendMsg(2277, endAtLastLine
, 0);
2149 // Retrieve whether the maximum scroll position has the last
2150 // line at the bottom of the view.
2151 bool wxStyledTextCtrl
::GetEndAtLastLine() const
2153 return SendMsg(2278, 0, 0) != 0;
2156 // Retrieve the height of a particular line of text in pixels.
2157 int wxStyledTextCtrl
::TextHeight(int line
)
2159 return SendMsg(2279, line
, 0);
2162 // Show or hide the vertical scroll bar.
2163 void wxStyledTextCtrl
::SetUseVerticalScrollBar(bool show
)
2165 SendMsg(2280, show
, 0);
2168 // Is the vertical scroll bar visible?
2169 bool wxStyledTextCtrl
::GetUseVerticalScrollBar() const
2171 return SendMsg(2281, 0, 0) != 0;
2174 // Append a string to the end of the document without changing the selection.
2175 void wxStyledTextCtrl
::AppendText(const wxString
& text
) {
2176 const wxWX2MBbuf buf
= wx2stc(text
);
2177 SendMsg(2282, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
2180 // Is drawing done in two phases with backgrounds drawn before foregrounds?
2181 bool wxStyledTextCtrl
::GetTwoPhaseDraw() const
2183 return SendMsg(2283, 0, 0) != 0;
2186 // In twoPhaseDraw mode, drawing is performed in two phases, first the background
2187 // and then the foreground. This avoids chopping off characters that overlap the next run.
2188 void wxStyledTextCtrl
::SetTwoPhaseDraw(bool twoPhase
)
2190 SendMsg(2284, twoPhase
, 0);
2193 // Scroll so that a display line is at the top of the display.
2194 void wxStyledTextCtrl
::SetFirstVisibleLine(int lineDisplay
)
2196 SendMsg(2613, lineDisplay
, 0);
2199 // Change the effect of pasting when there are multiple selections.
2200 void wxStyledTextCtrl
::SetMultiPaste(int multiPaste
)
2202 SendMsg(2614, multiPaste
, 0);
2205 // Retrieve the effect of pasting when there are multiple selections..
2206 int wxStyledTextCtrl
::GetMultiPaste() const
2208 return SendMsg(2615, 0, 0);
2211 // Retrieve the value of a tag from a regular expression search.
2212 wxString wxStyledTextCtrl
::GetTag(int tagNumber
) const {
2214 int len
= SendMsg(msg
, tagNumber
, NULL
);
2215 if (!len
) return wxEmptyString
;
2217 wxMemoryBuffer
mbuf(len
+1);
2218 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
2219 SendMsg(msg
, tagNumber
, (sptr_t
)buf
);
2220 mbuf
.UngetWriteBuf(len
);
2225 // Make the target range start and end be the same as the selection range start and end.
2226 void wxStyledTextCtrl
::TargetFromSelection()
2228 SendMsg(2287, 0, 0);
2231 // Join the lines in the target.
2232 void wxStyledTextCtrl
::LinesJoin()
2234 SendMsg(2288, 0, 0);
2237 // Split the lines in the target into lines that are less wide than pixelWidth
2239 void wxStyledTextCtrl
::LinesSplit(int pixelWidth
)
2241 SendMsg(2289, pixelWidth
, 0);
2244 // Set the colours used as a chequerboard pattern in the fold margin
2245 void wxStyledTextCtrl
::SetFoldMarginColour(bool useSetting
, const wxColour
& back
)
2247 SendMsg(2290, useSetting
, wxColourAsLong(back
));
2249 void wxStyledTextCtrl
::SetFoldMarginHiColour(bool useSetting
, const wxColour
& fore
)
2251 SendMsg(2291, useSetting
, wxColourAsLong(fore
));
2254 // Move caret down one line.
2255 void wxStyledTextCtrl
::LineDown()
2257 SendMsg(2300, 0, 0);
2260 // Move caret down one line extending selection to new caret position.
2261 void wxStyledTextCtrl
::LineDownExtend()
2263 SendMsg(2301, 0, 0);
2266 // Move caret up one line.
2267 void wxStyledTextCtrl
::LineUp()
2269 SendMsg(2302, 0, 0);
2272 // Move caret up one line extending selection to new caret position.
2273 void wxStyledTextCtrl
::LineUpExtend()
2275 SendMsg(2303, 0, 0);
2278 // Move caret left one character.
2279 void wxStyledTextCtrl
::CharLeft()
2281 SendMsg(2304, 0, 0);
2284 // Move caret left one character extending selection to new caret position.
2285 void wxStyledTextCtrl
::CharLeftExtend()
2287 SendMsg(2305, 0, 0);
2290 // Move caret right one character.
2291 void wxStyledTextCtrl
::CharRight()
2293 SendMsg(2306, 0, 0);
2296 // Move caret right one character extending selection to new caret position.
2297 void wxStyledTextCtrl
::CharRightExtend()
2299 SendMsg(2307, 0, 0);
2302 // Move caret left one word.
2303 void wxStyledTextCtrl
::WordLeft()
2305 SendMsg(2308, 0, 0);
2308 // Move caret left one word extending selection to new caret position.
2309 void wxStyledTextCtrl
::WordLeftExtend()
2311 SendMsg(2309, 0, 0);
2314 // Move caret right one word.
2315 void wxStyledTextCtrl
::WordRight()
2317 SendMsg(2310, 0, 0);
2320 // Move caret right one word extending selection to new caret position.
2321 void wxStyledTextCtrl
::WordRightExtend()
2323 SendMsg(2311, 0, 0);
2326 // Move caret to first position on line.
2327 void wxStyledTextCtrl
::Home()
2329 SendMsg(2312, 0, 0);
2332 // Move caret to first position on line extending selection to new caret position.
2333 void wxStyledTextCtrl
::HomeExtend()
2335 SendMsg(2313, 0, 0);
2338 // Move caret to last position on line.
2339 void wxStyledTextCtrl
::LineEnd()
2341 SendMsg(2314, 0, 0);
2344 // Move caret to last position on line extending selection to new caret position.
2345 void wxStyledTextCtrl
::LineEndExtend()
2347 SendMsg(2315, 0, 0);
2350 // Move caret to first position in document.
2351 void wxStyledTextCtrl
::DocumentStart()
2353 SendMsg(2316, 0, 0);
2356 // Move caret to first position in document extending selection to new caret position.
2357 void wxStyledTextCtrl
::DocumentStartExtend()
2359 SendMsg(2317, 0, 0);
2362 // Move caret to last position in document.
2363 void wxStyledTextCtrl
::DocumentEnd()
2365 SendMsg(2318, 0, 0);
2368 // Move caret to last position in document extending selection to new caret position.
2369 void wxStyledTextCtrl
::DocumentEndExtend()
2371 SendMsg(2319, 0, 0);
2374 // Move caret one page up.
2375 void wxStyledTextCtrl
::PageUp()
2377 SendMsg(2320, 0, 0);
2380 // Move caret one page up extending selection to new caret position.
2381 void wxStyledTextCtrl
::PageUpExtend()
2383 SendMsg(2321, 0, 0);
2386 // Move caret one page down.
2387 void wxStyledTextCtrl
::PageDown()
2389 SendMsg(2322, 0, 0);
2392 // Move caret one page down extending selection to new caret position.
2393 void wxStyledTextCtrl
::PageDownExtend()
2395 SendMsg(2323, 0, 0);
2398 // Switch from insert to overtype mode or the reverse.
2399 void wxStyledTextCtrl
::EditToggleOvertype()
2401 SendMsg(2324, 0, 0);
2404 // Cancel any modes such as call tip or auto-completion list display.
2405 void wxStyledTextCtrl
::Cancel()
2407 SendMsg(2325, 0, 0);
2410 // Delete the selection or if no selection, the character before the caret.
2411 void wxStyledTextCtrl
::DeleteBack()
2413 SendMsg(2326, 0, 0);
2416 // If selection is empty or all on one line replace the selection with a tab character.
2417 // If more than one line selected, indent the lines.
2418 void wxStyledTextCtrl
::Tab()
2420 SendMsg(2327, 0, 0);
2423 // Dedent the selected lines.
2424 void wxStyledTextCtrl
::BackTab()
2426 SendMsg(2328, 0, 0);
2429 // Insert a new line, may use a CRLF, CR or LF depending on EOL mode.
2430 void wxStyledTextCtrl
::NewLine()
2432 SendMsg(2329, 0, 0);
2435 // Insert a Form Feed character.
2436 void wxStyledTextCtrl
::FormFeed()
2438 SendMsg(2330, 0, 0);
2441 // Move caret to before first visible character on line.
2442 // If already there move to first character on line.
2443 void wxStyledTextCtrl
::VCHome()
2445 SendMsg(2331, 0, 0);
2448 // Like VCHome but extending selection to new caret position.
2449 void wxStyledTextCtrl
::VCHomeExtend()
2451 SendMsg(2332, 0, 0);
2454 // Magnify the displayed text by increasing the sizes by 1 point.
2455 void wxStyledTextCtrl
::ZoomIn()
2457 SendMsg(2333, 0, 0);
2460 // Make the displayed text smaller by decreasing the sizes by 1 point.
2461 void wxStyledTextCtrl
::ZoomOut()
2463 SendMsg(2334, 0, 0);
2466 // Delete the word to the left of the caret.
2467 void wxStyledTextCtrl
::DelWordLeft()
2469 SendMsg(2335, 0, 0);
2472 // Delete the word to the right of the caret.
2473 void wxStyledTextCtrl
::DelWordRight()
2475 SendMsg(2336, 0, 0);
2478 // Delete the word to the right of the caret, but not the trailing non-word characters.
2479 void wxStyledTextCtrl
::DelWordRightEnd()
2481 SendMsg(2518, 0, 0);
2484 // Cut the line containing the caret.
2485 void wxStyledTextCtrl
::LineCut()
2487 SendMsg(2337, 0, 0);
2490 // Delete the line containing the caret.
2491 void wxStyledTextCtrl
::LineDelete()
2493 SendMsg(2338, 0, 0);
2496 // Switch the current line with the previous.
2497 void wxStyledTextCtrl
::LineTranspose()
2499 SendMsg(2339, 0, 0);
2502 // Duplicate the current line.
2503 void wxStyledTextCtrl
::LineDuplicate()
2505 SendMsg(2404, 0, 0);
2508 // Transform the selection to lower case.
2509 void wxStyledTextCtrl
::LowerCase()
2511 SendMsg(2340, 0, 0);
2514 // Transform the selection to upper case.
2515 void wxStyledTextCtrl
::UpperCase()
2517 SendMsg(2341, 0, 0);
2520 // Scroll the document down, keeping the caret visible.
2521 void wxStyledTextCtrl
::LineScrollDown()
2523 SendMsg(2342, 0, 0);
2526 // Scroll the document up, keeping the caret visible.
2527 void wxStyledTextCtrl
::LineScrollUp()
2529 SendMsg(2343, 0, 0);
2532 // Delete the selection or if no selection, the character before the caret.
2533 // Will not delete the character before at the start of a line.
2534 void wxStyledTextCtrl
::DeleteBackNotLine()
2536 SendMsg(2344, 0, 0);
2539 // Move caret to first position on display line.
2540 void wxStyledTextCtrl
::HomeDisplay()
2542 SendMsg(2345, 0, 0);
2545 // Move caret to first position on display line extending selection to
2546 // new caret position.
2547 void wxStyledTextCtrl
::HomeDisplayExtend()
2549 SendMsg(2346, 0, 0);
2552 // Move caret to last position on display line.
2553 void wxStyledTextCtrl
::LineEndDisplay()
2555 SendMsg(2347, 0, 0);
2558 // Move caret to last position on display line extending selection to new
2560 void wxStyledTextCtrl
::LineEndDisplayExtend()
2562 SendMsg(2348, 0, 0);
2565 // These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)?
2566 // except they behave differently when word-wrap is enabled:
2567 // They go first to the start / end of the display line, like (Home|LineEnd)Display
2568 // The difference is that, the cursor is already at the point, it goes on to the start
2569 // or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
2570 void wxStyledTextCtrl
::HomeWrap()
2572 SendMsg(2349, 0, 0);
2574 void wxStyledTextCtrl
::HomeWrapExtend()
2576 SendMsg(2450, 0, 0);
2578 void wxStyledTextCtrl
::LineEndWrap()
2580 SendMsg(2451, 0, 0);
2582 void wxStyledTextCtrl
::LineEndWrapExtend()
2584 SendMsg(2452, 0, 0);
2586 void wxStyledTextCtrl
::VCHomeWrap()
2588 SendMsg(2453, 0, 0);
2590 void wxStyledTextCtrl
::VCHomeWrapExtend()
2592 SendMsg(2454, 0, 0);
2595 // Copy the line containing the caret.
2596 void wxStyledTextCtrl
::LineCopy()
2598 SendMsg(2455, 0, 0);
2601 // Move the caret inside current view if it's not there already.
2602 void wxStyledTextCtrl
::MoveCaretInsideView()
2604 SendMsg(2401, 0, 0);
2607 // How many characters are on a line, including end of line characters?
2608 int wxStyledTextCtrl
::LineLength(int line
) const
2610 return SendMsg(2350, line
, 0);
2613 // Highlight the characters at two positions.
2614 void wxStyledTextCtrl
::BraceHighlight(int pos1
, int pos2
)
2616 SendMsg(2351, pos1
, pos2
);
2619 // Use specified indicator to highlight matching braces instead of changing their style.
2620 void wxStyledTextCtrl
::BraceHighlightIndicator(bool useBraceHighlightIndicator
, int indicator
)
2622 SendMsg(2498, useBraceHighlightIndicator
, indicator
);
2625 // Highlight the character at a position indicating there is no matching brace.
2626 void wxStyledTextCtrl
::BraceBadLight(int pos
)
2628 SendMsg(2352, pos
, 0);
2631 // Use specified indicator to highlight non matching brace instead of changing its style.
2632 void wxStyledTextCtrl
::BraceBadLightIndicator(bool useBraceBadLightIndicator
, int indicator
)
2634 SendMsg(2499, useBraceBadLightIndicator
, indicator
);
2637 // Find the position of a matching brace or INVALID_POSITION if no match.
2638 int wxStyledTextCtrl
::BraceMatch(int pos
)
2640 return SendMsg(2353, pos
, 0);
2643 // Are the end of line characters visible?
2644 bool wxStyledTextCtrl
::GetViewEOL() const
2646 return SendMsg(2355, 0, 0) != 0;
2649 // Make the end of line characters visible or invisible.
2650 void wxStyledTextCtrl
::SetViewEOL(bool visible
)
2652 SendMsg(2356, visible
, 0);
2655 // Retrieve a pointer to the document object.
2656 void* wxStyledTextCtrl
::GetDocPointer() {
2657 return (void*)SendMsg(2357);
2660 // Change the document object used.
2661 void wxStyledTextCtrl
::SetDocPointer(void* docPointer
) {
2662 SendMsg(2358, 0, (sptr_t
)docPointer
);
2665 // Set which document modification events are sent to the container.
2666 void wxStyledTextCtrl
::SetModEventMask(int mask
)
2668 SendMsg(2359, mask
, 0);
2671 // Retrieve the column number which text should be kept within.
2672 int wxStyledTextCtrl
::GetEdgeColumn() const
2674 return SendMsg(2360, 0, 0);
2677 // Set the column number of the edge.
2678 // If text goes past the edge then it is highlighted.
2679 void wxStyledTextCtrl
::SetEdgeColumn(int column
)
2681 SendMsg(2361, column
, 0);
2684 // Retrieve the edge highlight mode.
2685 int wxStyledTextCtrl
::GetEdgeMode() const
2687 return SendMsg(2362, 0, 0);
2690 // The edge may be displayed by a line (EDGE_LINE) or by highlighting text that
2691 // goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).
2692 void wxStyledTextCtrl
::SetEdgeMode(int mode
)
2694 SendMsg(2363, mode
, 0);
2697 // Retrieve the colour used in edge indication.
2698 wxColour wxStyledTextCtrl
::GetEdgeColour() const
2700 long c
= SendMsg(2364, 0, 0);
2701 return wxColourFromLong(c
);
2704 // Change the colour used in edge indication.
2705 void wxStyledTextCtrl
::SetEdgeColour(const wxColour
& edgeColour
)
2707 SendMsg(2365, wxColourAsLong(edgeColour
), 0);
2710 // Sets the current caret position to be the search anchor.
2711 void wxStyledTextCtrl
::SearchAnchor()
2713 SendMsg(2366, 0, 0);
2716 // Find some text starting at the search anchor.
2717 // Does not ensure the selection is visible.
2718 int wxStyledTextCtrl
::SearchNext(int flags
, const wxString
& text
)
2720 return SendMsg(2367, flags
, (sptr_t
)(const char*)wx2stc(text
));
2723 // Find some text starting at the search anchor and moving backwards.
2724 // Does not ensure the selection is visible.
2725 int wxStyledTextCtrl
::SearchPrev(int flags
, const wxString
& text
)
2727 return SendMsg(2368, flags
, (sptr_t
)(const char*)wx2stc(text
));
2730 // Retrieves the number of lines completely visible.
2731 int wxStyledTextCtrl
::LinesOnScreen() const
2733 return SendMsg(2370, 0, 0);
2736 // Set whether a pop up menu is displayed automatically when the user presses
2737 // the wrong mouse button.
2738 void wxStyledTextCtrl
::UsePopUp(bool allowPopUp
)
2740 SendMsg(2371, allowPopUp
, 0);
2743 // Is the selection rectangular? The alternative is the more common stream selection.
2744 bool wxStyledTextCtrl
::SelectionIsRectangle() const
2746 return SendMsg(2372, 0, 0) != 0;
2749 // Set the zoom level. This number of points is added to the size of all fonts.
2750 // It may be positive to magnify or negative to reduce.
2751 void wxStyledTextCtrl
::SetZoom(int zoom
)
2753 SendMsg(2373, zoom
, 0);
2756 // Retrieve the zoom level.
2757 int wxStyledTextCtrl
::GetZoom() const
2759 return SendMsg(2374, 0, 0);
2762 // Create a new document object.
2763 // Starts with reference count of 1 and not selected into editor.
2764 void* wxStyledTextCtrl
::CreateDocument() {
2765 return (void*)SendMsg(2375);
2768 // Extend life of document.
2769 void wxStyledTextCtrl
::AddRefDocument(void* docPointer
) {
2770 SendMsg(2376, 0, (sptr_t
)docPointer
);
2773 // Release a reference to the document, deleting document if it fades to black.
2774 void wxStyledTextCtrl
::ReleaseDocument(void* docPointer
) {
2775 SendMsg(2377, 0, (sptr_t
)docPointer
);
2778 // Get which document modification events are sent to the container.
2779 int wxStyledTextCtrl
::GetModEventMask() const
2781 return SendMsg(2378, 0, 0);
2784 // Change internal focus flag.
2785 void wxStyledTextCtrl
::SetSTCFocus(bool focus
)
2787 SendMsg(2380, focus
, 0);
2790 // Get internal focus flag.
2791 bool wxStyledTextCtrl
::GetSTCFocus() const
2793 return SendMsg(2381, 0, 0) != 0;
2796 // Change error status - 0 = OK.
2797 void wxStyledTextCtrl
::SetStatus(int statusCode
)
2799 SendMsg(2382, statusCode
, 0);
2802 // Get error status.
2803 int wxStyledTextCtrl
::GetStatus() const
2805 return SendMsg(2383, 0, 0);
2808 // Set whether the mouse is captured when its button is pressed.
2809 void wxStyledTextCtrl
::SetMouseDownCaptures(bool captures
)
2811 SendMsg(2384, captures
, 0);
2814 // Get whether mouse gets captured.
2815 bool wxStyledTextCtrl
::GetMouseDownCaptures() const
2817 return SendMsg(2385, 0, 0) != 0;
2820 // Sets the cursor to one of the SC_CURSOR* values.
2821 void wxStyledTextCtrl
::SetSTCCursor(int cursorType
)
2823 SendMsg(2386, cursorType
, 0);
2827 int wxStyledTextCtrl
::GetSTCCursor() const
2829 return SendMsg(2387, 0, 0);
2832 // Change the way control characters are displayed:
2833 // If symbol is < 32, keep the drawn way, else, use the given character.
2834 void wxStyledTextCtrl
::SetControlCharSymbol(int symbol
)
2836 SendMsg(2388, symbol
, 0);
2839 // Get the way control characters are displayed.
2840 int wxStyledTextCtrl
::GetControlCharSymbol() const
2842 return SendMsg(2389, 0, 0);
2845 // Move to the previous change in capitalisation.
2846 void wxStyledTextCtrl
::WordPartLeft()
2848 SendMsg(2390, 0, 0);
2851 // Move to the previous change in capitalisation extending selection
2852 // to new caret position.
2853 void wxStyledTextCtrl
::WordPartLeftExtend()
2855 SendMsg(2391, 0, 0);
2858 // Move to the change next in capitalisation.
2859 void wxStyledTextCtrl
::WordPartRight()
2861 SendMsg(2392, 0, 0);
2864 // Move to the next change in capitalisation extending selection
2865 // to new caret position.
2866 void wxStyledTextCtrl
::WordPartRightExtend()
2868 SendMsg(2393, 0, 0);
2871 // Set the way the display area is determined when a particular line
2872 // is to be moved to by Find, FindNext, GotoLine, etc.
2873 void wxStyledTextCtrl
::SetVisiblePolicy(int visiblePolicy
, int visibleSlop
)
2875 SendMsg(2394, visiblePolicy
, visibleSlop
);
2878 // Delete back from the current position to the start of the line.
2879 void wxStyledTextCtrl
::DelLineLeft()
2881 SendMsg(2395, 0, 0);
2884 // Delete forwards from the current position to the end of the line.
2885 void wxStyledTextCtrl
::DelLineRight()
2887 SendMsg(2396, 0, 0);
2890 // Get and Set the xOffset (ie, horizontal scroll position).
2891 void wxStyledTextCtrl
::SetXOffset(int newOffset
)
2893 SendMsg(2397, newOffset
, 0);
2895 int wxStyledTextCtrl
::GetXOffset() const
2897 return SendMsg(2398, 0, 0);
2900 // Set the last x chosen value to be the caret x position.
2901 void wxStyledTextCtrl
::ChooseCaretX()
2903 SendMsg(2399, 0, 0);
2906 // Set the way the caret is kept visible when going sideways.
2907 // The exclusion zone is given in pixels.
2908 void wxStyledTextCtrl
::SetXCaretPolicy(int caretPolicy
, int caretSlop
)
2910 SendMsg(2402, caretPolicy
, caretSlop
);
2913 // Set the way the line the caret is on is kept visible.
2914 // The exclusion zone is given in lines.
2915 void wxStyledTextCtrl
::SetYCaretPolicy(int caretPolicy
, int caretSlop
)
2917 SendMsg(2403, caretPolicy
, caretSlop
);
2920 // Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE).
2921 void wxStyledTextCtrl
::SetPrintWrapMode(int mode
)
2923 SendMsg(2406, mode
, 0);
2926 // Is printing line wrapped?
2927 int wxStyledTextCtrl
::GetPrintWrapMode() const
2929 return SendMsg(2407, 0, 0);
2932 // Set a fore colour for active hotspots.
2933 void wxStyledTextCtrl
::SetHotspotActiveForeground(bool useSetting
, const wxColour
& fore
)
2935 SendMsg(2410, useSetting
, wxColourAsLong(fore
));
2938 // Get the fore colour for active hotspots.
2939 wxColour wxStyledTextCtrl
::GetHotspotActiveForeground() const
2941 long c
= SendMsg(2494, 0, 0);
2942 return wxColourFromLong(c
);
2945 // Set a back colour for active hotspots.
2946 void wxStyledTextCtrl
::SetHotspotActiveBackground(bool useSetting
, const wxColour
& back
)
2948 SendMsg(2411, useSetting
, wxColourAsLong(back
));
2951 // Get the back colour for active hotspots.
2952 wxColour wxStyledTextCtrl
::GetHotspotActiveBackground() const
2954 long c
= SendMsg(2495, 0, 0);
2955 return wxColourFromLong(c
);
2958 // Enable / Disable underlining active hotspots.
2959 void wxStyledTextCtrl
::SetHotspotActiveUnderline(bool underline
)
2961 SendMsg(2412, underline
, 0);
2964 // Get whether underlining for active hotspots.
2965 bool wxStyledTextCtrl
::GetHotspotActiveUnderline() const
2967 return SendMsg(2496, 0, 0) != 0;
2970 // Limit hotspots to single line so hotspots on two lines don't merge.
2971 void wxStyledTextCtrl
::SetHotspotSingleLine(bool singleLine
)
2973 SendMsg(2421, singleLine
, 0);
2976 // Get the HotspotSingleLine property
2977 bool wxStyledTextCtrl
::GetHotspotSingleLine() const
2979 return SendMsg(2497, 0, 0) != 0;
2982 // Move caret between paragraphs (delimited by empty lines).
2983 void wxStyledTextCtrl
::ParaDown()
2985 SendMsg(2413, 0, 0);
2987 void wxStyledTextCtrl
::ParaDownExtend()
2989 SendMsg(2414, 0, 0);
2991 void wxStyledTextCtrl
::ParaUp()
2993 SendMsg(2415, 0, 0);
2995 void wxStyledTextCtrl
::ParaUpExtend()
2997 SendMsg(2416, 0, 0);
3000 // Given a valid document position, return the previous position taking code
3001 // page into account. Returns 0 if passed 0.
3002 int wxStyledTextCtrl
::PositionBefore(int pos
)
3004 return SendMsg(2417, pos
, 0);
3007 // Given a valid document position, return the next position taking code
3008 // page into account. Maximum value returned is the last position in the document.
3009 int wxStyledTextCtrl
::PositionAfter(int pos
)
3011 return SendMsg(2418, pos
, 0);
3014 // Copy a range of text to the clipboard. Positions are clipped into the document.
3015 void wxStyledTextCtrl
::CopyRange(int start
, int end
)
3017 SendMsg(2419, start
, end
);
3020 // Copy argument text to the clipboard.
3021 void wxStyledTextCtrl
::CopyText(int length
, const wxString
& text
)
3023 SendMsg(2420, length
, (sptr_t
)(const char*)wx2stc(text
));
3026 // Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE/SC_SEL_THIN) or
3027 // by lines (SC_SEL_LINES).
3028 void wxStyledTextCtrl
::SetSelectionMode(int mode
)
3030 SendMsg(2422, mode
, 0);
3033 // Get the mode of the current selection.
3034 int wxStyledTextCtrl
::GetSelectionMode() const
3036 return SendMsg(2423, 0, 0);
3039 // Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line).
3040 int wxStyledTextCtrl
::GetLineSelStartPosition(int line
)
3042 return SendMsg(2424, line
, 0);
3045 // Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line).
3046 int wxStyledTextCtrl
::GetLineSelEndPosition(int line
)
3048 return SendMsg(2425, line
, 0);
3051 // Move caret down one line, extending rectangular selection to new caret position.
3052 void wxStyledTextCtrl
::LineDownRectExtend()
3054 SendMsg(2426, 0, 0);
3057 // Move caret up one line, extending rectangular selection to new caret position.
3058 void wxStyledTextCtrl
::LineUpRectExtend()
3060 SendMsg(2427, 0, 0);
3063 // Move caret left one character, extending rectangular selection to new caret position.
3064 void wxStyledTextCtrl
::CharLeftRectExtend()
3066 SendMsg(2428, 0, 0);
3069 // Move caret right one character, extending rectangular selection to new caret position.
3070 void wxStyledTextCtrl
::CharRightRectExtend()
3072 SendMsg(2429, 0, 0);
3075 // Move caret to first position on line, extending rectangular selection to new caret position.
3076 void wxStyledTextCtrl
::HomeRectExtend()
3078 SendMsg(2430, 0, 0);
3081 // Move caret to before first visible character on line.
3082 // If already there move to first character on line.
3083 // In either case, extend rectangular selection to new caret position.
3084 void wxStyledTextCtrl
::VCHomeRectExtend()
3086 SendMsg(2431, 0, 0);
3089 // Move caret to last position on line, extending rectangular selection to new caret position.
3090 void wxStyledTextCtrl
::LineEndRectExtend()
3092 SendMsg(2432, 0, 0);
3095 // Move caret one page up, extending rectangular selection to new caret position.
3096 void wxStyledTextCtrl
::PageUpRectExtend()
3098 SendMsg(2433, 0, 0);
3101 // Move caret one page down, extending rectangular selection to new caret position.
3102 void wxStyledTextCtrl
::PageDownRectExtend()
3104 SendMsg(2434, 0, 0);
3107 // Move caret to top of page, or one page up if already at top of page.
3108 void wxStyledTextCtrl
::StutteredPageUp()
3110 SendMsg(2435, 0, 0);
3113 // Move caret to top of page, or one page up if already at top of page, extending selection to new caret position.
3114 void wxStyledTextCtrl
::StutteredPageUpExtend()
3116 SendMsg(2436, 0, 0);
3119 // Move caret to bottom of page, or one page down if already at bottom of page.
3120 void wxStyledTextCtrl
::StutteredPageDown()
3122 SendMsg(2437, 0, 0);
3125 // Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position.
3126 void wxStyledTextCtrl
::StutteredPageDownExtend()
3128 SendMsg(2438, 0, 0);
3131 // Move caret left one word, position cursor at end of word.
3132 void wxStyledTextCtrl
::WordLeftEnd()
3134 SendMsg(2439, 0, 0);
3137 // Move caret left one word, position cursor at end of word, extending selection to new caret position.
3138 void wxStyledTextCtrl
::WordLeftEndExtend()
3140 SendMsg(2440, 0, 0);
3143 // Move caret right one word, position cursor at end of word.
3144 void wxStyledTextCtrl
::WordRightEnd()
3146 SendMsg(2441, 0, 0);
3149 // Move caret right one word, position cursor at end of word, extending selection to new caret position.
3150 void wxStyledTextCtrl
::WordRightEndExtend()
3152 SendMsg(2442, 0, 0);
3155 // Set the set of characters making up whitespace for when moving or selecting by word.
3156 // Should be called after SetWordChars.
3157 void wxStyledTextCtrl
::SetWhitespaceChars(const wxString
& characters
)
3159 SendMsg(2443, 0, (sptr_t
)(const char*)wx2stc(characters
));
3162 // Get the set of characters making up whitespace for when moving or selecting by word.
3163 wxString wxStyledTextCtrl
::GetWhitespaceChars() const {
3165 int len
= SendMsg(msg
, NULL
);
3166 if (!len
) return wxEmptyString
;
3168 wxMemoryBuffer
mbuf(len
+1);
3169 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3170 SendMsg(msg
, (sptr_t
)buf
);
3171 mbuf
.UngetWriteBuf(len
);
3176 // Set the set of characters making up punctuation characters
3177 // Should be called after SetWordChars.
3178 void wxStyledTextCtrl
::SetPunctuationChars(const wxString
& characters
)
3180 SendMsg(2648, 0, (sptr_t
)(const char*)wx2stc(characters
));
3183 // Get the set of characters making up punctuation characters
3184 wxString wxStyledTextCtrl
::GetPunctuationChars() const {
3186 int len
= SendMsg(msg
, NULL
);
3187 if (!len
) return wxEmptyString
;
3189 wxMemoryBuffer
mbuf(len
+1);
3190 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3191 SendMsg(msg
, (sptr_t
)buf
);
3192 mbuf
.UngetWriteBuf(len
);
3197 // Reset the set of characters for whitespace and word characters to the defaults.
3198 void wxStyledTextCtrl
::SetCharsDefault()
3200 SendMsg(2444, 0, 0);
3203 // Get currently selected item position in the auto-completion list
3204 int wxStyledTextCtrl
::AutoCompGetCurrent() const
3206 return SendMsg(2445, 0, 0);
3209 // Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference.
3210 void wxStyledTextCtrl
::AutoCSetCaseInsensitiveBehaviour(int behaviour
)
3212 SendMsg(2634, behaviour
, 0);
3215 // Get auto-completion case insensitive behaviour.
3216 int wxStyledTextCtrl
::AutoCGetCaseInsensitiveBehaviour() const
3218 return SendMsg(2635, 0, 0);
3221 // Enlarge the document to a particular size of text bytes.
3222 void wxStyledTextCtrl
::Allocate(int bytes
)
3224 SendMsg(2446, bytes
, 0);
3227 // Find the position of a column on a line taking into account tabs and
3228 // multi-byte characters. If beyond end of line, return line end position.
3229 int wxStyledTextCtrl
::FindColumn(int line
, int column
)
3231 return SendMsg(2456, line
, column
);
3234 // Can the caret preferred x position only be changed by explicit movement commands?
3235 int wxStyledTextCtrl
::GetCaretSticky() const
3237 return SendMsg(2457, 0, 0);
3240 // Stop the caret preferred x position changing when the user types.
3241 void wxStyledTextCtrl
::SetCaretSticky(int useCaretStickyBehaviour
)
3243 SendMsg(2458, useCaretStickyBehaviour
, 0);
3246 // Switch between sticky and non-sticky: meant to be bound to a key.
3247 void wxStyledTextCtrl
::ToggleCaretSticky()
3249 SendMsg(2459, 0, 0);
3252 // Enable/Disable convert-on-paste for line endings
3253 void wxStyledTextCtrl
::SetPasteConvertEndings(bool convert
)
3255 SendMsg(2467, convert
, 0);
3258 // Get convert-on-paste setting
3259 bool wxStyledTextCtrl
::GetPasteConvertEndings() const
3261 return SendMsg(2468, 0, 0) != 0;
3264 // Duplicate the selection. If selection empty duplicate the line containing the caret.
3265 void wxStyledTextCtrl
::SelectionDuplicate()
3267 SendMsg(2469, 0, 0);
3270 // Set background alpha of the caret line.
3271 void wxStyledTextCtrl
::SetCaretLineBackAlpha(int alpha
)
3273 SendMsg(2470, alpha
, 0);
3276 // Get the background alpha of the caret line.
3277 int wxStyledTextCtrl
::GetCaretLineBackAlpha() const
3279 return SendMsg(2471, 0, 0);
3282 // Set the style of the caret to be drawn.
3283 void wxStyledTextCtrl
::SetCaretStyle(int caretStyle
)
3285 SendMsg(2512, caretStyle
, 0);
3288 // Returns the current style of the caret.
3289 int wxStyledTextCtrl
::GetCaretStyle() const
3291 return SendMsg(2513, 0, 0);
3294 // Set the indicator used for IndicatorFillRange and IndicatorClearRange
3295 void wxStyledTextCtrl
::SetIndicatorCurrent(int indicator
)
3297 SendMsg(2500, indicator
, 0);
3300 // Get the current indicator
3301 int wxStyledTextCtrl
::GetIndicatorCurrent() const
3303 return SendMsg(2501, 0, 0);
3306 // Set the value used for IndicatorFillRange
3307 void wxStyledTextCtrl
::SetIndicatorValue(int value
)
3309 SendMsg(2502, value
, 0);
3312 // Get the current indicator value
3313 int wxStyledTextCtrl
::GetIndicatorValue() const
3315 return SendMsg(2503, 0, 0);
3318 // Turn a indicator on over a range.
3319 void wxStyledTextCtrl
::IndicatorFillRange(int position
, int fillLength
)
3321 SendMsg(2504, position
, fillLength
);
3324 // Turn a indicator off over a range.
3325 void wxStyledTextCtrl
::IndicatorClearRange(int position
, int clearLength
)
3327 SendMsg(2505, position
, clearLength
);
3330 // Are any indicators present at position?
3331 int wxStyledTextCtrl
::IndicatorAllOnFor(int position
)
3333 return SendMsg(2506, position
, 0);
3336 // What value does a particular indicator have at at a position?
3337 int wxStyledTextCtrl
::IndicatorValueAt(int indicator
, int position
)
3339 return SendMsg(2507, indicator
, position
);
3342 // Where does a particular indicator start?
3343 int wxStyledTextCtrl
::IndicatorStart(int indicator
, int position
)
3345 return SendMsg(2508, indicator
, position
);
3348 // Where does a particular indicator end?
3349 int wxStyledTextCtrl
::IndicatorEnd(int indicator
, int position
)
3351 return SendMsg(2509, indicator
, position
);
3354 // Set number of entries in position cache
3355 void wxStyledTextCtrl
::SetPositionCacheSize(int size
)
3357 SendMsg(2514, size
, 0);
3360 // How many entries are allocated to the position cache?
3361 int wxStyledTextCtrl
::GetPositionCacheSize() const
3363 return SendMsg(2515, 0, 0);
3366 // Copy the selection, if selection empty copy the line with the caret
3367 void wxStyledTextCtrl
::CopyAllowLine()
3369 SendMsg(2519, 0, 0);
3372 // Compact the document buffer and return a read-only pointer to the
3373 // characters in the document.
3374 const char* wxStyledTextCtrl
::GetCharacterPointer() {
3375 return (const char*)SendMsg(2520, 0, 0);
3378 // Return a read-only pointer to a range of characters in the document.
3379 // May move the gap so that the range is contiguous, but will only move up
3380 // to rangeLength bytes.
3381 int wxStyledTextCtrl
::GetRangePointer(int position
, int rangeLength
) const
3383 return SendMsg(2643, position
, rangeLength
);
3386 // Return a position which, to avoid performance costs, should not be within
3387 // the range of a call to GetRangePointer.
3388 int wxStyledTextCtrl
::GetGapPosition() const
3390 return SendMsg(2644, 0, 0);
3393 // Always interpret keyboard input as Unicode
3394 void wxStyledTextCtrl
::SetKeysUnicode(bool keysUnicode
)
3396 SendMsg(2521, keysUnicode
, 0);
3399 // Are keys always interpreted as Unicode?
3400 bool wxStyledTextCtrl
::GetKeysUnicode() const
3402 return SendMsg(2522, 0, 0) != 0;
3405 // Set the alpha fill colour of the given indicator.
3406 void wxStyledTextCtrl
::IndicatorSetAlpha(int indicator
, int alpha
)
3408 SendMsg(2523, indicator
, alpha
);
3411 // Get the alpha fill colour of the given indicator.
3412 int wxStyledTextCtrl
::IndicatorGetAlpha(int indicator
) const
3414 return SendMsg(2524, indicator
, 0);
3417 // Set the alpha outline colour of the given indicator.
3418 void wxStyledTextCtrl
::IndicSetOutlineAlpha(int indicator
, int alpha
)
3420 SendMsg(2558, indicator
, alpha
);
3423 // Get the alpha outline colour of the given indicator.
3424 int wxStyledTextCtrl
::IndicGetOutlineAlpha(int indicator
) const
3426 return SendMsg(2559, indicator
, 0);
3429 // Set extra ascent for each line
3430 void wxStyledTextCtrl
::SetExtraAscent(int extraAscent
)
3432 SendMsg(2525, extraAscent
, 0);
3435 // Get extra ascent for each line
3436 int wxStyledTextCtrl
::GetExtraAscent() const
3438 return SendMsg(2526, 0, 0);
3441 // Set extra descent for each line
3442 void wxStyledTextCtrl
::SetExtraDescent(int extraDescent
)
3444 SendMsg(2527, extraDescent
, 0);
3447 // Get extra descent for each line
3448 int wxStyledTextCtrl
::GetExtraDescent() const
3450 return SendMsg(2528, 0, 0);
3453 // Which symbol was defined for markerNumber with MarkerDefine
3454 int wxStyledTextCtrl
::GetMarkerSymbolDefined(int markerNumber
)
3456 return SendMsg(2529, markerNumber
, 0);
3459 // Set the text in the text margin for a line
3460 void wxStyledTextCtrl
::MarginSetText(int line
, const wxString
& text
)
3462 SendMsg(2530, line
, (sptr_t
)(const char*)wx2stc(text
));
3465 // Get the text in the text margin for a line
3466 wxString wxStyledTextCtrl
::MarginGetText(int line
) const {
3468 long len
= SendMsg(msg
, line
, 0);
3470 wxMemoryBuffer
mbuf(len
+1);
3471 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3472 SendMsg(msg
, line
, (sptr_t
)buf
);
3473 mbuf
.UngetWriteBuf(len
);
3478 // Set the style number for the text margin for a line
3479 void wxStyledTextCtrl
::MarginSetStyle(int line
, int style
)
3481 SendMsg(2532, line
, style
);
3484 // Get the style number for the text margin for a line
3485 int wxStyledTextCtrl
::MarginGetStyle(int line
) const
3487 return SendMsg(2533, line
, 0);
3490 // Set the style in the text margin for a line
3491 void wxStyledTextCtrl
::MarginSetStyles(int line
, const wxString
& styles
)
3493 SendMsg(2534, line
, (sptr_t
)(const char*)wx2stc(styles
));
3496 // Get the styles in the text margin for a line
3497 wxString wxStyledTextCtrl
::MarginGetStyles(int line
) const {
3499 long len
= SendMsg(msg
, line
, 0);
3501 wxMemoryBuffer
mbuf(len
+1);
3502 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3503 SendMsg(msg
, line
, (sptr_t
)buf
);
3504 mbuf
.UngetWriteBuf(len
);
3509 // Clear the margin text on all lines
3510 void wxStyledTextCtrl
::MarginTextClearAll()
3512 SendMsg(2536, 0, 0);
3515 // Get the start of the range of style numbers used for margin text
3516 void wxStyledTextCtrl
::MarginSetStyleOffset(int style
)
3518 SendMsg(2537, style
, 0);
3521 // Get the start of the range of style numbers used for margin text
3522 int wxStyledTextCtrl
::MarginGetStyleOffset() const
3524 return SendMsg(2538, 0, 0);
3527 // Set the margin options.
3528 void wxStyledTextCtrl
::SetMarginOptions(int marginOptions
)
3530 SendMsg(2539, marginOptions
, 0);
3533 // Get the margin options.
3534 int wxStyledTextCtrl
::GetMarginOptions() const
3536 return SendMsg(2557, 0, 0);
3539 // Set the annotation text for a line
3540 void wxStyledTextCtrl
::AnnotationSetText(int line
, const wxString
& text
)
3542 SendMsg(2540, line
, (sptr_t
)(const char*)wx2stc(text
));
3545 // Get the annotation text for a line
3546 wxString wxStyledTextCtrl
::AnnotationGetText(int line
) const {
3548 long len
= SendMsg(msg
, line
, 0);
3550 wxMemoryBuffer
mbuf(len
+1);
3551 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3552 SendMsg(msg
, line
, (sptr_t
)buf
);
3553 mbuf
.UngetWriteBuf(len
);
3558 // Set the style number for the annotations for a line
3559 void wxStyledTextCtrl
::AnnotationSetStyle(int line
, int style
)
3561 SendMsg(2542, line
, style
);
3564 // Get the style number for the annotations for a line
3565 int wxStyledTextCtrl
::AnnotationGetStyle(int line
) const
3567 return SendMsg(2543, line
, 0);
3570 // Set the annotation styles for a line
3571 void wxStyledTextCtrl
::AnnotationSetStyles(int line
, const wxString
& styles
)
3573 SendMsg(2544, line
, (sptr_t
)(const char*)wx2stc(styles
));
3576 // Get the annotation styles for a line
3577 wxString wxStyledTextCtrl
::AnnotationGetStyles(int line
) const {
3579 long len
= SendMsg(msg
, line
, 0);
3581 wxMemoryBuffer
mbuf(len
+1);
3582 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3583 SendMsg(msg
, line
, (sptr_t
)buf
);
3584 mbuf
.UngetWriteBuf(len
);
3589 // Get the number of annotation lines for a line
3590 int wxStyledTextCtrl
::AnnotationGetLines(int line
) const
3592 return SendMsg(2546, line
, 0);
3595 // Clear the annotations from all lines
3596 void wxStyledTextCtrl
::AnnotationClearAll()
3598 SendMsg(2547, 0, 0);
3601 // Set the visibility for the annotations for a view
3602 void wxStyledTextCtrl
::AnnotationSetVisible(int visible
)
3604 SendMsg(2548, visible
, 0);
3607 // Get the visibility for the annotations for a view
3608 int wxStyledTextCtrl
::AnnotationGetVisible() const
3610 return SendMsg(2549, 0, 0);
3613 // Get the start of the range of style numbers used for annotations
3614 void wxStyledTextCtrl
::AnnotationSetStyleOffset(int style
)
3616 SendMsg(2550, style
, 0);
3619 // Get the start of the range of style numbers used for annotations
3620 int wxStyledTextCtrl
::AnnotationGetStyleOffset() const
3622 return SendMsg(2551, 0, 0);
3625 // Add a container action to the undo stack
3626 void wxStyledTextCtrl
::AddUndoAction(int token
, int flags
)
3628 SendMsg(2560, token
, flags
);
3631 // Find the position of a character from a point within the window.
3632 int wxStyledTextCtrl
::CharPositionFromPoint(int x
, int y
)
3634 return SendMsg(2561, x
, y
);
3637 // Find the position of a character from a point within the window.
3638 // Return INVALID_POSITION if not close to text.
3639 int wxStyledTextCtrl
::CharPositionFromPointClose(int x
, int y
)
3641 return SendMsg(2562, x
, y
);
3644 // Set whether multiple selections can be made
3645 void wxStyledTextCtrl
::SetMultipleSelection(bool multipleSelection
)
3647 SendMsg(2563, multipleSelection
, 0);
3650 // Whether multiple selections can be made
3651 bool wxStyledTextCtrl
::GetMultipleSelection() const
3653 return SendMsg(2564, 0, 0) != 0;
3656 // Set whether typing can be performed into multiple selections
3657 void wxStyledTextCtrl
::SetAdditionalSelectionTyping(bool additionalSelectionTyping
)
3659 SendMsg(2565, additionalSelectionTyping
, 0);
3662 // Whether typing can be performed into multiple selections
3663 bool wxStyledTextCtrl
::GetAdditionalSelectionTyping() const
3665 return SendMsg(2566, 0, 0) != 0;
3668 // Set whether additional carets will blink
3669 void wxStyledTextCtrl
::SetAdditionalCaretsBlink(bool additionalCaretsBlink
)
3671 SendMsg(2567, additionalCaretsBlink
, 0);
3674 // Whether additional carets will blink
3675 bool wxStyledTextCtrl
::GetAdditionalCaretsBlink() const
3677 return SendMsg(2568, 0, 0) != 0;
3680 // Set whether additional carets are visible
3681 void wxStyledTextCtrl
::SetAdditionalCaretsVisible(bool additionalCaretsBlink
)
3683 SendMsg(2608, additionalCaretsBlink
, 0);
3686 // Whether additional carets are visible
3687 bool wxStyledTextCtrl
::GetAdditionalCaretsVisible() const
3689 return SendMsg(2609, 0, 0) != 0;
3692 // How many selections are there?
3693 int wxStyledTextCtrl
::GetSelections() const
3695 return SendMsg(2570, 0, 0);
3698 // Clear selections to a single empty stream selection
3699 void wxStyledTextCtrl
::ClearSelections()
3701 SendMsg(2571, 0, 0);
3705 int wxStyledTextCtrl
::AddSelection(int caret
, int anchor
)
3707 return SendMsg(2573, caret
, anchor
);
3710 // Set the main selection
3711 void wxStyledTextCtrl
::SetMainSelection(int selection
)
3713 SendMsg(2574, selection
, 0);
3716 // Which selection is the main selection
3717 int wxStyledTextCtrl
::GetMainSelection() const
3719 return SendMsg(2575, 0, 0);
3721 void wxStyledTextCtrl
::SetSelectionNCaret(int selection
, int pos
)
3723 SendMsg(2576, selection
, pos
);
3725 int wxStyledTextCtrl
::GetSelectionNCaret(int selection
) const
3727 return SendMsg(2577, selection
, 0);
3729 void wxStyledTextCtrl
::SetSelectionNAnchor(int selection
, int posAnchor
)
3731 SendMsg(2578, selection
, posAnchor
);
3733 int wxStyledTextCtrl
::GetSelectionNAnchor(int selection
) const
3735 return SendMsg(2579, selection
, 0);
3737 void wxStyledTextCtrl
::SetSelectionNCaretVirtualSpace(int selection
, int space
)
3739 SendMsg(2580, selection
, space
);
3741 int wxStyledTextCtrl
::GetSelectionNCaretVirtualSpace(int selection
) const
3743 return SendMsg(2581, selection
, 0);
3745 void wxStyledTextCtrl
::SetSelectionNAnchorVirtualSpace(int selection
, int space
)
3747 SendMsg(2582, selection
, space
);
3749 int wxStyledTextCtrl
::GetSelectionNAnchorVirtualSpace(int selection
) const
3751 return SendMsg(2583, selection
, 0);
3754 // Sets the position that starts the selection - this becomes the anchor.
3755 void wxStyledTextCtrl
::SetSelectionNStart(int selection
, int pos
)
3757 SendMsg(2584, selection
, pos
);
3760 // Returns the position at the start of the selection.
3761 int wxStyledTextCtrl
::GetSelectionNStart(int selection
) const
3763 return SendMsg(2585, selection
, 0);
3766 // Sets the position that ends the selection - this becomes the currentPosition.
3767 void wxStyledTextCtrl
::SetSelectionNEnd(int selection
, int pos
)
3769 SendMsg(2586, selection
, pos
);
3772 // Returns the position at the end of the selection.
3773 int wxStyledTextCtrl
::GetSelectionNEnd(int selection
) const
3775 return SendMsg(2587, selection
, 0);
3777 void wxStyledTextCtrl
::SetRectangularSelectionCaret(int pos
)
3779 SendMsg(2588, pos
, 0);
3781 int wxStyledTextCtrl
::GetRectangularSelectionCaret() const
3783 return SendMsg(2589, 0, 0);
3785 void wxStyledTextCtrl
::SetRectangularSelectionAnchor(int posAnchor
)
3787 SendMsg(2590, posAnchor
, 0);
3789 int wxStyledTextCtrl
::GetRectangularSelectionAnchor() const
3791 return SendMsg(2591, 0, 0);
3793 void wxStyledTextCtrl
::SetRectangularSelectionCaretVirtualSpace(int space
)
3795 SendMsg(2592, space
, 0);
3797 int wxStyledTextCtrl
::GetRectangularSelectionCaretVirtualSpace() const
3799 return SendMsg(2593, 0, 0);
3801 void wxStyledTextCtrl
::SetRectangularSelectionAnchorVirtualSpace(int space
)
3803 SendMsg(2594, space
, 0);
3805 int wxStyledTextCtrl
::GetRectangularSelectionAnchorVirtualSpace() const
3807 return SendMsg(2595, 0, 0);
3809 void wxStyledTextCtrl
::SetVirtualSpaceOptions(int virtualSpaceOptions
)
3811 SendMsg(2596, virtualSpaceOptions
, 0);
3813 int wxStyledTextCtrl
::GetVirtualSpaceOptions() const
3815 return SendMsg(2597, 0, 0);
3818 // On GTK+, allow selecting the modifier key to use for mouse-based
3819 // rectangular selection. Often the window manager requires Alt+Mouse Drag
3820 // for moving windows.
3821 // Valid values are SCMOD_CTRL(default), SCMOD_ALT, or SCMOD_SUPER.
3822 void wxStyledTextCtrl
::SetRectangularSelectionModifier(int modifier
)
3824 SendMsg(2598, modifier
, 0);
3827 // Get the modifier key used for rectangular selection.
3828 int wxStyledTextCtrl
::GetRectangularSelectionModifier() const
3830 return SendMsg(2599, 0, 0);
3833 // Set the foreground colour of additional selections.
3834 // Must have previously called SetSelFore with non-zero first argument for this to have an effect.
3835 void wxStyledTextCtrl
::SetAdditionalSelForeground(const wxColour
& fore
)
3837 SendMsg(2600, wxColourAsLong(fore
), 0);
3840 // Set the background colour of additional selections.
3841 // Must have previously called SetSelBack with non-zero first argument for this to have an effect.
3842 void wxStyledTextCtrl
::SetAdditionalSelBackground(const wxColour
& back
)
3844 SendMsg(2601, wxColourAsLong(back
), 0);
3847 // Set the alpha of the selection.
3848 void wxStyledTextCtrl
::SetAdditionalSelAlpha(int alpha
)
3850 SendMsg(2602, alpha
, 0);
3853 // Get the alpha of the selection.
3854 int wxStyledTextCtrl
::GetAdditionalSelAlpha() const
3856 return SendMsg(2603, 0, 0);
3859 // Set the foreground colour of additional carets.
3860 void wxStyledTextCtrl
::SetAdditionalCaretForeground(const wxColour
& fore
)
3862 SendMsg(2604, wxColourAsLong(fore
), 0);
3865 // Get the foreground colour of additional carets.
3866 wxColour wxStyledTextCtrl
::GetAdditionalCaretForeground() const
3868 long c
= SendMsg(2605, 0, 0);
3869 return wxColourFromLong(c
);
3872 // Set the main selection to the next selection.
3873 void wxStyledTextCtrl
::RotateSelection()
3875 SendMsg(2606, 0, 0);
3878 // Swap that caret and anchor of the main selection.
3879 void wxStyledTextCtrl
::SwapMainAnchorCaret()
3881 SendMsg(2607, 0, 0);
3884 // Indicate that the internal state of a lexer has changed over a range and therefore
3885 // there may be a need to redraw.
3886 int wxStyledTextCtrl
::ChangeLexerState(int start
, int end
)
3888 return SendMsg(2617, start
, end
);
3891 // Find the next line at or after lineStart that is a contracted fold header line.
3892 // Return -1 when no more lines.
3893 int wxStyledTextCtrl
::ContractedFoldNext(int lineStart
)
3895 return SendMsg(2618, lineStart
, 0);
3898 // Centre current line in window.
3899 void wxStyledTextCtrl
::VerticalCentreCaret()
3901 SendMsg(2619, 0, 0);
3904 // Move the selected lines up one line, shifting the line above after the selection
3905 void wxStyledTextCtrl
::MoveSelectedLinesUp()
3907 SendMsg(2620, 0, 0);
3910 // Move the selected lines down one line, shifting the line below before the selection
3911 void wxStyledTextCtrl
::MoveSelectedLinesDown()
3913 SendMsg(2621, 0, 0);
3916 // Set the identifier reported as idFrom in notification messages.
3917 void wxStyledTextCtrl
::SetIdentifier(int identifier
)
3919 SendMsg(2622, identifier
, 0);
3922 // Get the identifier.
3923 int wxStyledTextCtrl
::GetIdentifier() const
3925 return SendMsg(2623, 0, 0);
3928 // Set the width for future RGBA image data.
3929 void wxStyledTextCtrl
::RGBAImageSetWidth(int width
)
3931 SendMsg(2624, width
, 0);
3934 // Set the height for future RGBA image data.
3935 void wxStyledTextCtrl
::RGBAImageSetHeight(int height
)
3937 SendMsg(2625, height
, 0);
3940 // Define a marker from RGBA data.
3941 // It has the width and height from RGBAImageSetWidth/Height
3942 void wxStyledTextCtrl
::MarkerDefineRGBAImage(int markerNumber
, const wxString
& pixels
)
3944 SendMsg(2626, markerNumber
, (sptr_t
)(const char*)wx2stc(pixels
));
3947 // Register an RGBA image for use in autocompletion lists.
3948 // It has the width and height from RGBAImageSetWidth/Height
3949 void wxStyledTextCtrl
::RegisterRGBAImage(int type
, const wxString
& pixels
)
3951 SendMsg(2627, type
, (sptr_t
)(const char*)wx2stc(pixels
));
3954 // Scroll to start of document.
3955 void wxStyledTextCtrl
::ScrollToStart()
3957 SendMsg(2628, 0, 0);
3960 // Scroll to end of document.
3961 void wxStyledTextCtrl
::ScrollToEnd()
3963 SendMsg(2629, 0, 0);
3966 // Set the technology used.
3967 void wxStyledTextCtrl
::SetTechnology(int technology
)
3969 SendMsg(2630, technology
, 0);
3973 int wxStyledTextCtrl
::GetTechnology() const
3975 return SendMsg(2631, 0, 0);
3978 // Create an ILoader*.
3979 int wxStyledTextCtrl
::CreateLoader(int bytes
)
3981 return SendMsg(2632, bytes
, 0);
3984 // On OS X, show a find indicator.
3985 void wxStyledTextCtrl
::FindIndicatorShow(int start
, int end
)
3987 SendMsg(2640, start
, end
);
3990 // On OS X, flash a find indicator, then fade out.
3991 void wxStyledTextCtrl
::FindIndicatorFlash(int start
, int end
)
3993 SendMsg(2641, start
, end
);
3996 // On OS X, hide the find indicator.
3997 void wxStyledTextCtrl
::FindIndicatorHide()
3999 SendMsg(2642, 0, 0);
4002 // Start notifying the container of all key presses and commands.
4003 void wxStyledTextCtrl
::StartRecord()
4005 SendMsg(3001, 0, 0);
4008 // Stop notifying the container of all key presses and commands.
4009 void wxStyledTextCtrl
::StopRecord()
4011 SendMsg(3002, 0, 0);
4014 // Set the lexing language of the document.
4015 void wxStyledTextCtrl
::SetLexer(int lexer
)
4017 SendMsg(4001, lexer
, 0);
4020 // Retrieve the lexing language of the document.
4021 int wxStyledTextCtrl
::GetLexer() const
4023 return SendMsg(4002, 0, 0);
4026 // Colourise a segment of the document using the current lexing language.
4027 void wxStyledTextCtrl
::Colourise(int start
, int end
)
4029 SendMsg(4003, start
, end
);
4032 // Set up a value that may be used by a lexer for some optional feature.
4033 void wxStyledTextCtrl
::SetProperty(const wxString
& key
, const wxString
& value
)
4035 SendMsg(4004, (sptr_t
)(const char*)wx2stc(key
), (sptr_t
)(const char*)wx2stc(value
));
4038 // Set up the key words used by the lexer.
4039 void wxStyledTextCtrl
::SetKeyWords(int keywordSet
, const wxString
& keyWords
)
4041 SendMsg(4005, keywordSet
, (sptr_t
)(const char*)wx2stc(keyWords
));
4044 // Set the lexing language of the document based on string name.
4045 void wxStyledTextCtrl
::SetLexerLanguage(const wxString
& language
)
4047 SendMsg(4006, 0, (sptr_t
)(const char*)wx2stc(language
));
4050 // Retrieve a 'property' value previously set with SetProperty.
4051 wxString wxStyledTextCtrl
::GetProperty(const wxString
& key
) {
4052 int len
= SendMsg(SCI_GETPROPERTY
, (sptr_t
)(const char*)wx2stc(key
), 0);
4053 if (!len
) return wxEmptyString
;
4055 wxMemoryBuffer
mbuf(len
+1);
4056 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
4057 SendMsg(4008, (uptr_t
)(const char*)wx2stc(key
), (sptr_t
)buf
);
4058 mbuf
.UngetWriteBuf(len
);
4063 // Retrieve a 'property' value previously set with SetProperty,
4064 // with '$()' variable replacement on returned buffer.
4065 wxString wxStyledTextCtrl
::GetPropertyExpanded(const wxString
& key
) {
4066 int len
= SendMsg(SCI_GETPROPERTYEXPANDED
, (uptr_t
)(const char*)wx2stc(key
), 0);
4067 if (!len
) return wxEmptyString
;
4069 wxMemoryBuffer
mbuf(len
+1);
4070 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
4071 SendMsg(4009, (uptr_t
)(const char*)wx2stc(key
), (sptr_t
)buf
);
4072 mbuf
.UngetWriteBuf(len
);
4077 // Retrieve a 'property' value previously set with SetProperty,
4078 // interpreted as an int AFTER any '$()' variable replacement.
4079 int wxStyledTextCtrl
::GetPropertyInt(const wxString
& key
) const
4081 return SendMsg(4010, (sptr_t
)(const char*)wx2stc(key
), 0);
4084 // Retrieve the number of bits the current lexer needs for styling.
4085 int wxStyledTextCtrl
::GetStyleBitsNeeded() const
4087 return SendMsg(4011, 0, 0);
4090 // For private communication between an application and a known lexer.
4091 int wxStyledTextCtrl
::PrivateLexerCall(int operation
, int pointer
)
4093 return SendMsg(4013, operation
, pointer
);
4096 // Retrieve a '\n' separated list of properties understood by the current lexer.
4097 wxString wxStyledTextCtrl
::PropertyNames() const {
4099 int len
= SendMsg(msg
, NULL
);
4100 if (!len
) return wxEmptyString
;
4102 wxMemoryBuffer
mbuf(len
+1);
4103 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
4104 SendMsg(msg
, (sptr_t
)buf
);
4105 mbuf
.UngetWriteBuf(len
);
4110 // Retrieve the type of a property.
4111 int wxStyledTextCtrl
::PropertyType(const wxString
& name
)
4113 return SendMsg(4015, (sptr_t
)(const char*)wx2stc(name
), 0);
4116 // Describe a property.
4117 wxString wxStyledTextCtrl
::DescribeProperty(const wxString
& name
) const {
4119 int len
= SendMsg(msg
, (sptr_t
)(const char*)wx2stc(name
), NULL
);
4120 if (!len
) return wxEmptyString
;
4122 wxMemoryBuffer
mbuf(len
+1);
4123 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
4124 SendMsg(msg
, (sptr_t
)(const char*)wx2stc(name
), (sptr_t
)buf
);
4125 mbuf
.UngetWriteBuf(len
);
4130 // Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer.
4131 wxString wxStyledTextCtrl
::DescribeKeyWordSets() const {
4133 int len
= SendMsg(msg
, NULL
);
4134 if (!len
) return wxEmptyString
;
4136 wxMemoryBuffer
mbuf(len
+1);
4137 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
4138 SendMsg(msg
, (sptr_t
)buf
);
4139 mbuf
.UngetWriteBuf(len
);
4145 //----------------------------------------------------------------------
4148 // Returns the line number of the line with the caret.
4149 int wxStyledTextCtrl
::GetCurrentLine() {
4150 int line
= LineFromPosition(GetCurrentPos());
4155 // Extract style settings from a spec-string which is composed of one or
4156 // more of the following comma separated elements:
4158 // bold turns on bold
4159 // italic turns on italics
4160 // fore:[name or #RRGGBB] sets the foreground colour
4161 // back:[name or #RRGGBB] sets the background colour
4162 // face:[facename] sets the font face name to use
4163 // size:[num] sets the font size in points
4164 // eol turns on eol filling
4165 // underline turns on underlining
4167 void wxStyledTextCtrl
::StyleSetSpec(int styleNum
, const wxString
& spec
) {
4169 wxStringTokenizer
tkz(spec
, wxT(","));
4170 while (tkz
.HasMoreTokens()) {
4171 wxString token
= tkz
.GetNextToken();
4173 wxString option
= token
.BeforeFirst(':');
4174 wxString val
= token
.AfterFirst(':');
4176 if (option
== wxT("bold"))
4177 StyleSetBold(styleNum
, true);
4179 else if (option
== wxT("italic"))
4180 StyleSetItalic(styleNum
, true);
4182 else if (option
== wxT("underline"))
4183 StyleSetUnderline(styleNum
, true);
4185 else if (option
== wxT("eol"))
4186 StyleSetEOLFilled(styleNum
, true);
4188 else if (option
== wxT("size")) {
4190 if (val
.ToLong(&points
))
4191 StyleSetSize(styleNum
, points
);
4194 else if (option
== wxT("face"))
4195 StyleSetFaceName(styleNum
, val
);
4197 else if (option
== wxT("fore"))
4198 StyleSetForeground(styleNum
, wxColourFromSpec(val
));
4200 else if (option
== wxT("back"))
4201 StyleSetBackground(styleNum
, wxColourFromSpec(val
));
4206 // Get the font of a style
4207 wxFont wxStyledTextCtrl
::StyleGetFont(int style
) {
4209 font
.SetPointSize(StyleGetSize(style
));
4210 font
.SetFaceName(StyleGetFaceName(style
));
4211 if( StyleGetBold(style
) )
4212 font
.SetWeight(wxFONTWEIGHT_BOLD
);
4214 font
.SetWeight(wxFONTWEIGHT_NORMAL
);
4216 if( StyleGetItalic(style
) )
4217 font
.SetStyle(wxFONTSTYLE_ITALIC
);
4219 font
.SetStyle(wxFONTSTYLE_NORMAL
);
4225 // Set style size, face, bold, italic, and underline attributes from
4226 // a wxFont's attributes.
4227 void wxStyledTextCtrl
::StyleSetFont(int styleNum
, wxFont
& font
) {
4229 // Ensure that the native font is initialized
4231 GetTextExtent(wxT("X"), &x
, &y
, NULL
, NULL
, &font
);
4233 int size
= font
.GetPointSize();
4234 wxString faceName
= font
.GetFaceName();
4235 bool bold
= font
.GetWeight() == wxBOLD
;
4236 bool italic
= font
.GetStyle() != wxNORMAL
;
4237 bool under
= font
.GetUnderlined();
4238 wxFontEncoding encoding
= font
.GetEncoding();
4240 StyleSetFontAttr(styleNum
, size
, faceName
, bold
, italic
, under
, encoding
);
4243 // Set all font style attributes at once.
4244 void wxStyledTextCtrl
::StyleSetFontAttr(int styleNum
, int size
,
4245 const wxString
& faceName
,
4246 bool bold
, bool italic
,
4248 wxFontEncoding encoding
) {
4249 StyleSetSize(styleNum
, size
);
4250 StyleSetFaceName(styleNum
, faceName
);
4251 StyleSetBold(styleNum
, bold
);
4252 StyleSetItalic(styleNum
, italic
);
4253 StyleSetUnderline(styleNum
, underline
);
4254 StyleSetFontEncoding(styleNum
, encoding
);
4258 // Set the character set of the font in a style. Converts the Scintilla
4259 // character set values to a wxFontEncoding.
4260 void wxStyledTextCtrl
::StyleSetCharacterSet(int style
, int characterSet
)
4262 wxFontEncoding encoding
;
4264 // Translate the Scintilla characterSet to a wxFontEncoding
4265 switch (characterSet
) {
4267 case wxSTC_CHARSET_ANSI
:
4268 case wxSTC_CHARSET_DEFAULT
:
4269 encoding
= wxFONTENCODING_DEFAULT
;
4272 case wxSTC_CHARSET_BALTIC
:
4273 encoding
= wxFONTENCODING_ISO8859_13
;
4276 case wxSTC_CHARSET_CHINESEBIG5
:
4277 encoding
= wxFONTENCODING_CP950
;
4280 case wxSTC_CHARSET_EASTEUROPE
:
4281 encoding
= wxFONTENCODING_ISO8859_2
;
4284 case wxSTC_CHARSET_GB2312
:
4285 encoding
= wxFONTENCODING_CP936
;
4288 case wxSTC_CHARSET_GREEK
:
4289 encoding
= wxFONTENCODING_ISO8859_7
;
4292 case wxSTC_CHARSET_HANGUL
:
4293 encoding
= wxFONTENCODING_CP949
;
4296 case wxSTC_CHARSET_MAC
:
4297 encoding
= wxFONTENCODING_DEFAULT
;
4300 case wxSTC_CHARSET_OEM
:
4301 encoding
= wxFONTENCODING_DEFAULT
;
4304 case wxSTC_CHARSET_RUSSIAN
:
4305 encoding
= wxFONTENCODING_KOI8
;
4308 case wxSTC_CHARSET_SHIFTJIS
:
4309 encoding
= wxFONTENCODING_CP932
;
4312 case wxSTC_CHARSET_SYMBOL
:
4313 encoding
= wxFONTENCODING_DEFAULT
;
4316 case wxSTC_CHARSET_TURKISH
:
4317 encoding
= wxFONTENCODING_ISO8859_9
;
4320 case wxSTC_CHARSET_JOHAB
:
4321 encoding
= wxFONTENCODING_DEFAULT
;
4324 case wxSTC_CHARSET_HEBREW
:
4325 encoding
= wxFONTENCODING_ISO8859_8
;
4328 case wxSTC_CHARSET_ARABIC
:
4329 encoding
= wxFONTENCODING_ISO8859_6
;
4332 case wxSTC_CHARSET_VIETNAMESE
:
4333 encoding
= wxFONTENCODING_DEFAULT
;
4336 case wxSTC_CHARSET_THAI
:
4337 encoding
= wxFONTENCODING_ISO8859_11
;
4340 case wxSTC_CHARSET_CYRILLIC
:
4341 encoding
= wxFONTENCODING_ISO8859_5
;
4344 case wxSTC_CHARSET_8859_15
:
4345 encoding
= wxFONTENCODING_ISO8859_15
;;
4349 // We just have Scintilla track the wxFontEncoding for us. It gets used
4350 // in Font::Create in PlatWX.cpp. We add one to the value so that the
4351 // effective wxFONENCODING_DEFAULT == SC_SHARSET_DEFAULT and so when
4352 // Scintilla internally uses SC_CHARSET_DEFAULT we will translate it back
4353 // to wxFONENCODING_DEFAULT in Font::Create.
4354 SendMsg(SCI_STYLESETCHARACTERSET
, style
, encoding
+1);
4358 // Set the font encoding to be used by a style.
4359 void wxStyledTextCtrl
::StyleSetFontEncoding(int style
, wxFontEncoding encoding
)
4361 SendMsg(SCI_STYLESETCHARACTERSET
, style
, encoding
+1);
4365 // Perform one of the operations defined by the wxSTC_CMD_* constants.
4366 void wxStyledTextCtrl
::CmdKeyExecute(int cmd
) {
4371 // Set the left and right margin in the edit area, measured in pixels.
4372 void wxStyledTextCtrl
::SetMargins(int left
, int right
) {
4373 SetMarginLeft(left
);
4374 SetMarginRight(right
);
4378 // Retrieve the point in the window where a position is displayed.
4379 wxPoint wxStyledTextCtrl
::PointFromPosition(int pos
) {
4380 int x
= SendMsg(SCI_POINTXFROMPOSITION
, 0, pos
);
4381 int y
= SendMsg(SCI_POINTYFROMPOSITION
, 0, pos
);
4382 return wxPoint(x
, y
);
4385 // Scroll enough to make the given line visible
4386 void wxStyledTextCtrl
::ScrollToLine(int line
) {
4387 m_swx
->DoScrollToLine(line
);
4391 // Scroll enough to make the given column visible
4392 void wxStyledTextCtrl
::ScrollToColumn(int column
) {
4393 m_swx
->DoScrollToColumn(column
);
4398 bool wxStyledTextCtrl
::DoSaveFile(const wxString
& filename
, int fileType
)
4400 bool ok
= wxTextAreaBase
::DoSaveFile(filename
, fileType
);
4402 bool wxStyledTextCtrl
::SaveFile(const wxString
& filename
)
4405 wxFFile
file(filename
, wxT("w"));
4406 bool ok
= file
.IsOpened() && file
.Write(GetValue(), *wxConvCurrent
);
4409 #endif // wxUSE_FFILE
4419 bool wxStyledTextCtrl
::DoLoadFile(const wxString
& filename
, int fileType
)
4421 bool ok
= wxTextAreaBase
::DoLoadFile(filename
, fileType
);
4423 bool wxStyledTextCtrl
::LoadFile(const wxString
& filename
)
4426 wxFFile
file(filename
);
4427 bool ok
= file
.IsOpened();
4431 ok
= file
.ReadAll(&text
, *wxConvCurrent
);
4439 #endif // wxUSE_FFILE
4449 #if wxUSE_DRAG_AND_DROP
4450 wxDragResult wxStyledTextCtrl
::DoDragOver(wxCoord x
, wxCoord y
, wxDragResult def
) {
4451 return m_swx
->DoDragOver(x
, y
, def
);
4455 bool wxStyledTextCtrl
::DoDropText(long x
, long y
, const wxString
& data
) {
4456 return m_swx
->DoDropText(x
, y
, data
);
4461 void wxStyledTextCtrl
::SetUseAntiAliasing(bool useAA
) {
4462 m_swx
->SetUseAntiAliasing(useAA
);
4465 bool wxStyledTextCtrl
::GetUseAntiAliasing() {
4466 return m_swx
->GetUseAntiAliasing();
4473 void wxStyledTextCtrl
::AddTextRaw(const char* text
, int length
)
4476 length
= strlen(text
);
4477 SendMsg(SCI_ADDTEXT
, length
, (sptr_t
)text
);
4480 void wxStyledTextCtrl
::InsertTextRaw(int pos
, const char* text
)
4482 SendMsg(SCI_INSERTTEXT
, pos
, (sptr_t
)text
);
4485 wxCharBuffer wxStyledTextCtrl
::GetCurLineRaw(int* linePos
)
4487 int len
= LineLength(GetCurrentLine());
4489 if (linePos
) *linePos
= 0;
4494 wxCharBuffer
buf(len
);
4495 int pos
= SendMsg(SCI_GETCURLINE
, len
, (sptr_t
)buf
.data());
4496 if (linePos
) *linePos
= pos
;
4500 wxCharBuffer wxStyledTextCtrl
::GetLineRaw(int line
)
4502 int len
= LineLength(line
);
4508 wxCharBuffer
buf(len
);
4509 SendMsg(SCI_GETLINE
, line
, (sptr_t
)buf
.data());
4513 wxCharBuffer wxStyledTextCtrl
::GetSelectedTextRaw()
4515 // Calculate the length needed first.
4516 const int len
= SendMsg(SCI_GETSELTEXT
, 0, (sptr_t
)0);
4518 // And then really get the data.
4519 wxCharBuffer
buf(len
);
4520 SendMsg(SCI_GETSELTEXT
, 0, (sptr_t
)buf
.data());
4524 wxCharBuffer wxStyledTextCtrl
::GetTextRangeRaw(int startPos
, int endPos
)
4526 if (endPos
< startPos
) {
4527 int temp
= startPos
;
4531 int len
= endPos
- startPos
;
4537 wxCharBuffer
buf(len
);
4539 tr
.lpstrText
= buf
.data();
4540 tr
.chrg
.cpMin
= startPos
;
4541 tr
.chrg
.cpMax
= endPos
;
4542 SendMsg(SCI_GETTEXTRANGE
, 0, (sptr_t
)&tr
);
4546 void wxStyledTextCtrl
::SetTextRaw(const char* text
)
4548 SendMsg(SCI_SETTEXT
, 0, (sptr_t
)text
);
4551 wxCharBuffer wxStyledTextCtrl
::GetTextRaw()
4553 int len
= GetTextLength();
4554 wxCharBuffer
buf(len
); // adds 1 for NUL automatically
4555 SendMsg(SCI_GETTEXT
, len
+ 1, (sptr_t
)buf
.data());
4559 void wxStyledTextCtrl
::AppendTextRaw(const char* text
, int length
)
4562 length
= strlen(text
);
4563 SendMsg(SCI_APPENDTEXT
, length
, (sptr_t
)text
);
4570 //----------------------------------------------------------------------
4573 void wxStyledTextCtrl
::OnPaint(wxPaintEvent
& WXUNUSED(evt
)) {
4575 m_swx
->DoPaint(&dc
, GetUpdateRegion().GetBox());
4578 void wxStyledTextCtrl
::OnScrollWin(wxScrollWinEvent
& evt
) {
4579 if (evt
.GetOrientation() == wxHORIZONTAL
)
4580 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
4582 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
4585 void wxStyledTextCtrl
::OnScroll(wxScrollEvent
& evt
) {
4586 wxScrollBar
* sb
= wxDynamicCast(evt
.GetEventObject(), wxScrollBar
);
4588 if (sb
->IsVertical())
4589 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
4591 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
4595 void wxStyledTextCtrl
::OnSize(wxSizeEvent
& WXUNUSED(evt
)) {
4597 wxSize sz
= GetClientSize();
4598 m_swx
->DoSize(sz
.x
, sz
.y
);
4602 void wxStyledTextCtrl
::OnMouseLeftDown(wxMouseEvent
& evt
) {
4604 wxPoint pt
= evt
.GetPosition();
4605 m_swx
->DoLeftButtonDown(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
4606 evt
.ShiftDown(), evt
.ControlDown(), evt
.AltDown());
4609 void wxStyledTextCtrl
::OnMouseMove(wxMouseEvent
& evt
) {
4610 wxPoint pt
= evt
.GetPosition();
4611 m_swx
->DoLeftButtonMove(Point(pt
.x
, pt
.y
));
4614 void wxStyledTextCtrl
::OnMouseLeftUp(wxMouseEvent
& evt
) {
4615 wxPoint pt
= evt
.GetPosition();
4616 m_swx
->DoLeftButtonUp(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
4621 void wxStyledTextCtrl
::OnMouseRightUp(wxMouseEvent
& evt
) {
4622 wxPoint pt
= evt
.GetPosition();
4623 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
4627 void wxStyledTextCtrl
::OnMouseMiddleUp(wxMouseEvent
& evt
) {
4628 wxPoint pt
= evt
.GetPosition();
4629 m_swx
->DoMiddleButtonUp(Point(pt
.x
, pt
.y
));
4632 void wxStyledTextCtrl
::OnContextMenu(wxContextMenuEvent
& evt
) {
4633 wxPoint pt
= evt
.GetPosition();
4634 ScreenToClient(&pt
.x
, &pt
.y
);
4636 Show context menu at event point if it's within the window,
4637 or at caret location if not
4639 wxHitTest ht
= this->HitTest(pt
);
4640 if (ht
!= wxHT_WINDOW_INSIDE
) {
4641 pt
= this->PointFromPosition(this->GetCurrentPos());
4643 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
4647 void wxStyledTextCtrl
::OnMouseWheel(wxMouseEvent
& evt
)
4649 m_swx
->DoMouseWheel(evt
.GetWheelRotation(),
4650 evt
.GetWheelDelta(),
4651 evt
.GetLinesPerAction(),
4653 evt
.IsPageScroll());
4657 void wxStyledTextCtrl
::OnChar(wxKeyEvent
& evt
) {
4658 // On (some?) non-US PC keyboards the AltGr key is required to enter some
4659 // common characters. It comes to us as both Alt and Ctrl down so we need
4660 // to let the char through in that case, otherwise if only ctrl or only
4661 // alt let's skip it.
4662 bool ctrl
= evt
.ControlDown();
4664 // On the Mac the Alt key is just a modifier key (like Shift) so we need
4665 // to allow the char events to be processed when Alt is pressed.
4666 // TODO: Should we check MetaDown instead in this case?
4669 bool alt
= evt
.AltDown();
4671 bool skip
= ((ctrl
|| alt
) && ! (ctrl
&& alt
));
4674 // apparently if we don't do this, Unicode keys pressed after non-char
4675 // ASCII ones (e.g. Enter, Tab) are not taken into account (patch 1615989)
4676 if (m_lastKeyDownConsumed
&& evt
.GetUnicodeKey() > 255)
4677 m_lastKeyDownConsumed
= false;
4680 if (!m_lastKeyDownConsumed
&& !skip
) {
4682 int key
= evt
.GetUnicodeKey();
4685 // if the unicode key code is not really a unicode character (it may
4686 // be a function key or etc., the platforms appear to always give us a
4687 // small value in this case) then fallback to the ascii key code but
4688 // don't do anything for function keys or etc.
4690 key
= evt
.GetKeyCode();
4691 keyOk
= (key
<= 127);
4694 m_swx
->DoAddChar(key
);
4698 int key
= evt
.GetKeyCode();
4699 if (key
<= WXK_START
|| key
> WXK_COMMAND
) {
4700 m_swx
->DoAddChar(key
);
4710 void wxStyledTextCtrl
::OnKeyDown(wxKeyEvent
& evt
) {
4711 int processed
= m_swx
->DoKeyDown(evt
, &m_lastKeyDownConsumed
);
4712 if (!processed
&& !m_lastKeyDownConsumed
)
4717 void wxStyledTextCtrl
::OnLoseFocus(wxFocusEvent
& evt
) {
4718 m_swx
->DoLoseFocus();
4723 void wxStyledTextCtrl
::OnGainFocus(wxFocusEvent
& evt
) {
4724 m_swx
->DoGainFocus();
4729 void wxStyledTextCtrl
::OnSysColourChanged(wxSysColourChangedEvent
& WXUNUSED(evt
)) {
4730 m_swx
->DoSysColourChange();
4734 void wxStyledTextCtrl
::OnEraseBackground(wxEraseEvent
& WXUNUSED(evt
)) {
4735 // do nothing to help avoid flashing
4740 void wxStyledTextCtrl
::OnMenu(wxCommandEvent
& evt
) {
4741 m_swx
->DoCommand(evt
.GetId());
4745 void wxStyledTextCtrl
::OnListBox(wxCommandEvent
& WXUNUSED(evt
)) {
4746 m_swx
->DoOnListBox();
4750 void wxStyledTextCtrl
::OnIdle(wxIdleEvent
& evt
) {
4751 m_swx
->DoOnIdle(evt
);
4755 wxSize wxStyledTextCtrl
::DoGetBestSize() const
4757 // What would be the best size for a wxSTC?
4758 // Just give a reasonable minimum until something else can be figured out.
4759 return wxSize(200,100);
4763 //----------------------------------------------------------------------
4764 // Turn notifications from Scintilla into events
4767 void wxStyledTextCtrl
::NotifyChange() {
4768 wxStyledTextEvent
evt(wxEVT_STC_CHANGE
, GetId());
4769 evt
.SetEventObject(this);
4770 GetEventHandler()->ProcessEvent(evt
);
4774 static void SetEventText(wxStyledTextEvent
& evt
, const char* text
,
4778 evt
.SetText(stc2wx(text
, length
));
4782 void wxStyledTextCtrl
::NotifyParent(SCNotification
* _scn
) {
4783 SCNotification
& scn
= *_scn
;
4784 wxStyledTextEvent
evt(0, GetId());
4786 evt
.SetEventObject(this);
4787 evt
.SetPosition(scn
.position
);
4789 evt
.SetModifiers(scn
.modifiers
);
4791 switch (scn
.nmhdr
.code
) {
4792 case SCN_STYLENEEDED
:
4793 evt
.SetEventType(wxEVT_STC_STYLENEEDED
);
4797 evt
.SetEventType(wxEVT_STC_CHARADDED
);
4800 case SCN_SAVEPOINTREACHED
:
4801 evt
.SetEventType(wxEVT_STC_SAVEPOINTREACHED
);
4804 case SCN_SAVEPOINTLEFT
:
4805 evt
.SetEventType(wxEVT_STC_SAVEPOINTLEFT
);
4808 case SCN_MODIFYATTEMPTRO
:
4809 evt
.SetEventType(wxEVT_STC_ROMODIFYATTEMPT
);
4813 evt
.SetEventType(wxEVT_STC_KEY
);
4816 case SCN_DOUBLECLICK
:
4817 evt
.SetEventType(wxEVT_STC_DOUBLECLICK
);
4821 evt
.SetEventType(wxEVT_STC_UPDATEUI
);
4825 evt
.SetEventType(wxEVT_STC_MODIFIED
);
4826 evt
.SetModificationType(scn
.modificationType
);
4827 SetEventText(evt
, scn
.text
, scn
.length
);
4828 evt
.SetLength(scn
.length
);
4829 evt
.SetLinesAdded(scn
.linesAdded
);
4830 evt
.SetLine(scn
.line
);
4831 evt
.SetFoldLevelNow(scn
.foldLevelNow
);
4832 evt
.SetFoldLevelPrev(scn
.foldLevelPrev
);
4835 case SCN_MACRORECORD
:
4836 evt
.SetEventType(wxEVT_STC_MACRORECORD
);
4837 evt
.SetMessage(scn
.message
);
4838 evt
.SetWParam(scn
.wParam
);
4839 evt
.SetLParam(scn
.lParam
);
4842 case SCN_MARGINCLICK
:
4843 evt
.SetEventType(wxEVT_STC_MARGINCLICK
);
4844 evt
.SetMargin(scn
.margin
);
4848 evt
.SetEventType(wxEVT_STC_NEEDSHOWN
);
4849 evt
.SetLength(scn
.length
);
4853 evt
.SetEventType(wxEVT_STC_PAINTED
);
4856 case SCN_AUTOCSELECTION
:
4857 evt
.SetEventType(wxEVT_STC_AUTOCOMP_SELECTION
);
4858 evt
.SetListType(scn
.listType
);
4859 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
4860 evt
.SetPosition(scn
.lParam
);
4863 case SCN_USERLISTSELECTION
:
4864 evt
.SetEventType(wxEVT_STC_USERLISTSELECTION
);
4865 evt
.SetListType(scn
.listType
);
4866 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
4867 evt
.SetPosition(scn
.lParam
);
4870 case SCN_URIDROPPED
:
4871 evt
.SetEventType(wxEVT_STC_URIDROPPED
);
4872 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
4875 case SCN_DWELLSTART
:
4876 evt
.SetEventType(wxEVT_STC_DWELLSTART
);
4882 evt
.SetEventType(wxEVT_STC_DWELLEND
);
4888 evt
.SetEventType(wxEVT_STC_ZOOM
);
4891 case SCN_HOTSPOTCLICK
:
4892 evt
.SetEventType(wxEVT_STC_HOTSPOT_CLICK
);
4895 case SCN_HOTSPOTDOUBLECLICK
:
4896 evt
.SetEventType(wxEVT_STC_HOTSPOT_DCLICK
);
4899 case SCN_CALLTIPCLICK
:
4900 evt
.SetEventType(wxEVT_STC_CALLTIP_CLICK
);
4903 case SCN_INDICATORCLICK
:
4904 evt
.SetEventType(wxEVT_STC_INDICATOR_CLICK
);
4907 case SCN_INDICATORRELEASE
:
4908 evt
.SetEventType(wxEVT_STC_INDICATOR_RELEASE
);
4911 case SCN_AUTOCCANCELLED
:
4912 evt
.SetEventType(wxEVT_STC_AUTOCOMP_CANCELLED
);
4915 case SCN_AUTOCCHARDELETED
:
4916 evt
.SetEventType(wxEVT_STC_AUTOCOMP_CHAR_DELETED
);
4923 GetEventHandler()->ProcessEvent(evt
);
4927 //----------------------------------------------------------------------
4928 //----------------------------------------------------------------------
4929 //----------------------------------------------------------------------
4931 wxStyledTextEvent
::wxStyledTextEvent(wxEventType commandType
, int id
)
4932 : wxCommandEvent(commandType
, id
)
4937 m_modificationType
= 0;
4942 m_foldLevelPrev
= 0;
4950 #if wxUSE_DRAG_AND_DROP
4951 m_dragFlags
= wxDrag_CopyOnly
;
4952 m_dragResult
= wxDragNone
;
4956 bool wxStyledTextEvent
::GetShift() const { return (m_modifiers
& SCI_SHIFT
) != 0; }
4957 bool wxStyledTextEvent
::GetControl() const { return (m_modifiers
& SCI_CTRL
) != 0; }
4958 bool wxStyledTextEvent
::GetAlt() const { return (m_modifiers
& SCI_ALT
) != 0; }
4961 wxStyledTextEvent
::wxStyledTextEvent(const wxStyledTextEvent
& event
):
4962 wxCommandEvent(event
)
4964 m_position
= event
.m_position
;
4965 m_key
= event
.m_key
;
4966 m_modifiers
= event
.m_modifiers
;
4967 m_modificationType
= event
.m_modificationType
;
4968 m_text
= event
.m_text
;
4969 m_length
= event
.m_length
;
4970 m_linesAdded
= event
.m_linesAdded
;
4971 m_line
= event
.m_line
;
4972 m_foldLevelNow
= event
.m_foldLevelNow
;
4973 m_foldLevelPrev
= event
.m_foldLevelPrev
;
4975 m_margin
= event
.m_margin
;
4977 m_message
= event
.m_message
;
4978 m_wParam
= event
.m_wParam
;
4979 m_lParam
= event
.m_lParam
;
4981 m_listType
= event
.m_listType
;
4985 #if wxUSE_DRAG_AND_DROP
4986 m_dragText
= event
.m_dragText
;
4987 m_dragFlags
= event
.m_dragFlags
;
4988 m_dragResult
= event
.m_dragResult
;
4992 //----------------------------------------------------------------------
4993 //----------------------------------------------------------------------
4995 /*static*/ wxVersionInfo wxStyledTextCtrl
::GetLibraryVersionInfo()
4997 return wxVersionInfo("Scintilla", 2, 3, 0, "Scintilla 2.03");