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"
56 #include "ScintillaWX.h"
58 //----------------------------------------------------------------------
60 const char wxSTCNameStr
[] = "stcwindow";
66 #define MAKELONG(a, b) ((a) | ((b) << 16))
69 static long wxColourAsLong(const wxColour
& co
) {
70 return (((long)co
.Blue() << 16) |
71 ((long)co
.Green() << 8) |
75 static wxColour
wxColourFromLong(long c
) {
77 clr
.Set((unsigned char)(c
& 0xff),
78 (unsigned char)((c
>> 8) & 0xff),
79 (unsigned char)((c
>> 16) & 0xff));
84 static wxColour
wxColourFromSpec(const wxString
& spec
) {
85 // spec should be a colour name or "#RRGGBB"
86 if (spec
.GetChar(0) == wxT('#')) {
88 long red
, green
, blue
;
89 red
= green
= blue
= 0;
90 spec
.Mid(1,2).ToLong(&red
, 16);
91 spec
.Mid(3,2).ToLong(&green
, 16);
92 spec
.Mid(5,2).ToLong(&blue
, 16);
93 return wxColour((unsigned char)red
,
98 return wxColour(spec
);
101 //----------------------------------------------------------------------
103 wxDEFINE_EVENT( wxEVT_STC_CHANGE
, wxStyledTextEvent
);
104 wxDEFINE_EVENT( wxEVT_STC_STYLENEEDED
, wxStyledTextEvent
);
105 wxDEFINE_EVENT( wxEVT_STC_CHARADDED
, wxStyledTextEvent
);
106 wxDEFINE_EVENT( wxEVT_STC_SAVEPOINTREACHED
, wxStyledTextEvent
);
107 wxDEFINE_EVENT( wxEVT_STC_SAVEPOINTLEFT
, wxStyledTextEvent
);
108 wxDEFINE_EVENT( wxEVT_STC_ROMODIFYATTEMPT
, wxStyledTextEvent
);
109 wxDEFINE_EVENT( wxEVT_STC_KEY
, wxStyledTextEvent
);
110 wxDEFINE_EVENT( wxEVT_STC_DOUBLECLICK
, wxStyledTextEvent
);
111 wxDEFINE_EVENT( wxEVT_STC_UPDATEUI
, wxStyledTextEvent
);
112 wxDEFINE_EVENT( wxEVT_STC_MODIFIED
, wxStyledTextEvent
);
113 wxDEFINE_EVENT( wxEVT_STC_MACRORECORD
, wxStyledTextEvent
);
114 wxDEFINE_EVENT( wxEVT_STC_MARGINCLICK
, wxStyledTextEvent
);
115 wxDEFINE_EVENT( wxEVT_STC_NEEDSHOWN
, wxStyledTextEvent
);
116 wxDEFINE_EVENT( wxEVT_STC_PAINTED
, wxStyledTextEvent
);
117 wxDEFINE_EVENT( wxEVT_STC_USERLISTSELECTION
, wxStyledTextEvent
);
118 wxDEFINE_EVENT( wxEVT_STC_URIDROPPED
, wxStyledTextEvent
);
119 wxDEFINE_EVENT( wxEVT_STC_DWELLSTART
, wxStyledTextEvent
);
120 wxDEFINE_EVENT( wxEVT_STC_DWELLEND
, wxStyledTextEvent
);
121 wxDEFINE_EVENT( wxEVT_STC_START_DRAG
, wxStyledTextEvent
);
122 wxDEFINE_EVENT( wxEVT_STC_DRAG_OVER
, wxStyledTextEvent
);
123 wxDEFINE_EVENT( wxEVT_STC_DO_DROP
, wxStyledTextEvent
);
124 wxDEFINE_EVENT( wxEVT_STC_ZOOM
, wxStyledTextEvent
);
125 wxDEFINE_EVENT( wxEVT_STC_HOTSPOT_CLICK
, wxStyledTextEvent
);
126 wxDEFINE_EVENT( wxEVT_STC_HOTSPOT_DCLICK
, wxStyledTextEvent
);
127 wxDEFINE_EVENT( wxEVT_STC_CALLTIP_CLICK
, wxStyledTextEvent
);
128 wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_SELECTION
, wxStyledTextEvent
);
129 wxDEFINE_EVENT( wxEVT_STC_INDICATOR_CLICK
, wxStyledTextEvent
);
130 wxDEFINE_EVENT( wxEVT_STC_INDICATOR_RELEASE
, wxStyledTextEvent
);
131 wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_CANCELLED
, wxStyledTextEvent
);
132 wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_CHAR_DELETED
, wxStyledTextEvent
);
133 wxDEFINE_EVENT( wxEVT_STC_HOTSPOT_RELEASE_CLICK
, wxStyledTextEvent
);
137 BEGIN_EVENT_TABLE(wxStyledTextCtrl
, wxControl
)
138 EVT_PAINT (wxStyledTextCtrl::OnPaint
)
139 EVT_SCROLLWIN (wxStyledTextCtrl::OnScrollWin
)
140 EVT_SCROLL (wxStyledTextCtrl::OnScroll
)
141 EVT_SIZE (wxStyledTextCtrl::OnSize
)
142 EVT_LEFT_DOWN (wxStyledTextCtrl::OnMouseLeftDown
)
143 // Let Scintilla see the double click as a second click
144 EVT_LEFT_DCLICK (wxStyledTextCtrl::OnMouseLeftDown
)
145 EVT_MOTION (wxStyledTextCtrl::OnMouseMove
)
146 EVT_LEFT_UP (wxStyledTextCtrl::OnMouseLeftUp
)
147 #if defined(__WXGTK__) || defined(__WXMAC__)
148 EVT_RIGHT_UP (wxStyledTextCtrl::OnMouseRightUp
)
150 EVT_CONTEXT_MENU (wxStyledTextCtrl::OnContextMenu
)
152 EVT_MOUSEWHEEL (wxStyledTextCtrl::OnMouseWheel
)
153 EVT_MIDDLE_UP (wxStyledTextCtrl::OnMouseMiddleUp
)
154 EVT_CHAR (wxStyledTextCtrl::OnChar
)
155 EVT_KEY_DOWN (wxStyledTextCtrl::OnKeyDown
)
156 EVT_KILL_FOCUS (wxStyledTextCtrl::OnLoseFocus
)
157 EVT_SET_FOCUS (wxStyledTextCtrl::OnGainFocus
)
158 EVT_SYS_COLOUR_CHANGED (wxStyledTextCtrl::OnSysColourChanged
)
159 EVT_ERASE_BACKGROUND (wxStyledTextCtrl::OnEraseBackground
)
160 EVT_MENU_RANGE (10, 16, wxStyledTextCtrl::OnMenu
)
161 EVT_LISTBOX_DCLICK (wxID_ANY
, wxStyledTextCtrl::OnListBox
)
165 IMPLEMENT_CLASS(wxStyledTextCtrl
, wxControl
)
166 IMPLEMENT_DYNAMIC_CLASS(wxStyledTextEvent
, wxCommandEvent
)
169 // forces the linking of the lexer modules
170 int Scintilla_LinkLexers();
173 //----------------------------------------------------------------------
174 // Constructor and Destructor
176 wxStyledTextCtrl::wxStyledTextCtrl(wxWindow
*parent
,
181 const wxString
& name
)
184 Create(parent
, id
, pos
, size
, style
, name
);
188 bool wxStyledTextCtrl::Create(wxWindow
*parent
,
193 const wxString
& name
)
195 style
|= wxVSCROLL
| wxHSCROLL
;
196 if (!wxControl::Create(parent
, id
, pos
, size
,
197 style
| wxWANTS_CHARS
| wxCLIP_CHILDREN
,
198 wxDefaultValidator
, name
))
202 Scintilla_LinkLexers();
204 m_swx
= new ScintillaWX(this);
206 m_lastKeyDownConsumed
= false;
210 // Put Scintilla into unicode (UTF-8) mode
211 SetCodePage(wxSTC_CP_UTF8
);
214 SetInitialSize(size
);
216 // Reduces flicker on GTK+/X11
217 SetBackgroundStyle(wxBG_STYLE_PAINT
);
219 // Make sure it can take the focus
226 wxStyledTextCtrl::~wxStyledTextCtrl() {
231 //----------------------------------------------------------------------
233 wxIntPtr
wxStyledTextCtrl::SendMsg(int msg
, wxUIntPtr wp
, wxIntPtr lp
) const
235 return m_swx
->WndProc(msg
, wp
, lp
);
238 //----------------------------------------------------------------------
240 // Set the vertical scrollbar to use instead of the ont that's built-in.
241 void wxStyledTextCtrl::SetVScrollBar(wxScrollBar
* bar
) {
244 // ensure that the built-in scrollbar is not visible
245 SetScrollbar(wxVERTICAL
, 0, 0, 0);
250 // Set the horizontal scrollbar to use instead of the ont that's built-in.
251 void wxStyledTextCtrl::SetHScrollBar(wxScrollBar
* bar
) {
254 // ensure that the built-in scrollbar is not visible
255 SetScrollbar(wxHORIZONTAL
, 0, 0, 0);
259 //----------------------------------------------------------------------
260 // Generated methods implementation section {{{
263 // Add text to the document at current position.
264 void wxStyledTextCtrl::AddText(const wxString
& text
) {
265 const wxWX2MBbuf buf
= wx2stc(text
);
266 SendMsg(2001, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
269 // Add array of cells to document.
270 void wxStyledTextCtrl::AddStyledText(const wxMemoryBuffer
& data
) {
271 SendMsg(2002, data
.GetDataLen(), (sptr_t
)data
.GetData());
274 // Insert string at a position.
275 void wxStyledTextCtrl::InsertText(int pos
, const wxString
& text
)
277 SendMsg(2003, pos
, (sptr_t
)(const char*)wx2stc(text
));
280 // Delete all text in the document.
281 void wxStyledTextCtrl::ClearAll()
286 // Delete a range of text in the document.
287 void wxStyledTextCtrl::DeleteRange(int pos
, int deleteLength
)
289 SendMsg(2645, pos
, deleteLength
);
292 // Set all style bytes to 0, remove all folding information.
293 void wxStyledTextCtrl::ClearDocumentStyle()
298 // Returns the number of bytes in the document.
299 int wxStyledTextCtrl::GetLength() const
301 return SendMsg(2006, 0, 0);
304 // Returns the character byte at the position.
305 int wxStyledTextCtrl::GetCharAt(int pos
) const {
306 return (unsigned char)SendMsg(2007, pos
, 0);
309 // Returns the position of the caret.
310 int wxStyledTextCtrl::GetCurrentPos() const
312 return SendMsg(2008, 0, 0);
315 // Returns the position of the opposite end of the selection to the caret.
316 int wxStyledTextCtrl::GetAnchor() const
318 return SendMsg(2009, 0, 0);
321 // Returns the style byte at the position.
322 int wxStyledTextCtrl::GetStyleAt(int pos
) const {
323 return (unsigned char)SendMsg(2010, pos
, 0);
326 // Redoes the next action on the undo history.
327 void wxStyledTextCtrl::Redo()
332 // Choose between collecting actions into the undo
333 // history and discarding them.
334 void wxStyledTextCtrl::SetUndoCollection(bool collectUndo
)
336 SendMsg(2012, collectUndo
, 0);
339 // Select all the text in the document.
340 void wxStyledTextCtrl::SelectAll()
345 // Remember the current position in the undo history as the position
346 // at which the document was saved.
347 void wxStyledTextCtrl::SetSavePoint()
352 // Retrieve a buffer of cells.
353 wxMemoryBuffer
wxStyledTextCtrl::GetStyledText(int startPos
, int endPos
) {
355 if (endPos
< startPos
) {
360 int len
= endPos
- startPos
;
361 if (!len
) return buf
;
363 tr
.lpstrText
= (char*)buf
.GetWriteBuf(len
*2+1);
364 tr
.chrg
.cpMin
= startPos
;
365 tr
.chrg
.cpMax
= endPos
;
366 len
= SendMsg(2015, 0, (sptr_t
)&tr
);
367 buf
.UngetWriteBuf(len
);
371 // Are there any redoable actions in the undo history?
372 bool wxStyledTextCtrl::CanRedo() const
374 return SendMsg(2016, 0, 0) != 0;
377 // Retrieve the line number at which a particular marker is located.
378 int wxStyledTextCtrl::MarkerLineFromHandle(int handle
)
380 return SendMsg(2017, handle
, 0);
384 void wxStyledTextCtrl::MarkerDeleteHandle(int handle
)
386 SendMsg(2018, handle
, 0);
389 // Is undo history being collected?
390 bool wxStyledTextCtrl::GetUndoCollection() const
392 return SendMsg(2019, 0, 0) != 0;
395 // Are white space characters currently visible?
396 // Returns one of SCWS_* constants.
397 int wxStyledTextCtrl::GetViewWhiteSpace() const
399 return SendMsg(2020, 0, 0);
402 // Make white space characters invisible, always visible or visible outside indentation.
403 void wxStyledTextCtrl::SetViewWhiteSpace(int viewWS
)
405 SendMsg(2021, viewWS
, 0);
408 // Find the position from a point within the window.
409 int wxStyledTextCtrl::PositionFromPoint(wxPoint pt
) const {
410 return SendMsg(2022, pt
.x
, pt
.y
);
413 // Find the position from a point within the window but return
414 // INVALID_POSITION if not close to text.
415 int wxStyledTextCtrl::PositionFromPointClose(int x
, int y
)
417 return SendMsg(2023, x
, y
);
420 // Set caret to start of a line and ensure it is visible.
421 void wxStyledTextCtrl::GotoLine(int line
)
423 SendMsg(2024, line
, 0);
426 // Set caret to a position and ensure it is visible.
427 void wxStyledTextCtrl::GotoPos(int pos
)
429 SendMsg(2025, pos
, 0);
432 // Set the selection anchor to a position. The anchor is the opposite
433 // end of the selection from the caret.
434 void wxStyledTextCtrl::SetAnchor(int posAnchor
)
436 SendMsg(2026, posAnchor
, 0);
439 // Retrieve the text of the line containing the caret.
440 // Returns the index of the caret on the line.
441 wxString
wxStyledTextCtrl::GetCurLine(int* linePos
) {
442 int len
= LineLength(GetCurrentLine());
444 if (linePos
) *linePos
= 0;
445 return wxEmptyString
;
448 wxMemoryBuffer
mbuf(len
+1);
449 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
451 int pos
= SendMsg(2027, len
+1, (sptr_t
)buf
);
452 mbuf
.UngetWriteBuf(len
);
454 if (linePos
) *linePos
= pos
;
458 // Retrieve the position of the last correctly styled character.
459 int wxStyledTextCtrl::GetEndStyled() const
461 return SendMsg(2028, 0, 0);
464 // Convert all line endings in the document to one mode.
465 void wxStyledTextCtrl::ConvertEOLs(int eolMode
)
467 SendMsg(2029, eolMode
, 0);
470 // Retrieve the current end of line mode - one of CRLF, CR, or LF.
471 int wxStyledTextCtrl::GetEOLMode() const
473 return SendMsg(2030, 0, 0);
476 // Set the current end of line mode.
477 void wxStyledTextCtrl::SetEOLMode(int eolMode
)
479 SendMsg(2031, eolMode
, 0);
482 // Set the current styling position to pos and the styling mask to mask.
483 // The styling mask can be used to protect some bits in each styling byte from modification.
484 void wxStyledTextCtrl::StartStyling(int pos
, int mask
)
486 SendMsg(2032, pos
, mask
);
489 // Change style from current styling position for length characters to a style
490 // and move the current styling position to after this newly styled segment.
491 void wxStyledTextCtrl::SetStyling(int length
, int style
)
493 SendMsg(2033, length
, style
);
496 // Is drawing done first into a buffer or direct to the screen?
497 bool wxStyledTextCtrl::GetBufferedDraw() const
499 return SendMsg(2034, 0, 0) != 0;
502 // If drawing is buffered then each line of text is drawn into a bitmap buffer
503 // before drawing it to the screen to avoid flicker.
504 void wxStyledTextCtrl::SetBufferedDraw(bool buffered
)
506 SendMsg(2035, buffered
, 0);
509 // Change the visible size of a tab to be a multiple of the width of a space character.
510 void wxStyledTextCtrl::SetTabWidth(int tabWidth
)
512 SendMsg(2036, tabWidth
, 0);
515 // Retrieve the visible size of a tab.
516 int wxStyledTextCtrl::GetTabWidth() const
518 return SendMsg(2121, 0, 0);
521 // Set the code page used to interpret the bytes of the document as characters.
522 void wxStyledTextCtrl::SetCodePage(int codePage
) {
524 wxASSERT_MSG(codePage
== wxSTC_CP_UTF8
,
525 wxT("Only wxSTC_CP_UTF8 may be used when wxUSE_UNICODE is on."));
527 wxASSERT_MSG(codePage
!= wxSTC_CP_UTF8
,
528 wxT("wxSTC_CP_UTF8 may not be used when wxUSE_UNICODE is off."));
530 SendMsg(2037, codePage
);
533 // Set the symbol used for a particular marker number,
534 // and optionally the fore and background colours.
535 void wxStyledTextCtrl::MarkerDefine(int markerNumber
, int markerSymbol
,
536 const wxColour
& foreground
,
537 const wxColour
& background
) {
539 SendMsg(2040, markerNumber
, markerSymbol
);
540 if (foreground
.IsOk())
541 MarkerSetForeground(markerNumber
, foreground
);
542 if (background
.IsOk())
543 MarkerSetBackground(markerNumber
, background
);
546 // Set the foreground colour used for a particular marker number.
547 void wxStyledTextCtrl::MarkerSetForeground(int markerNumber
, const wxColour
& fore
)
549 SendMsg(2041, markerNumber
, wxColourAsLong(fore
));
552 // Set the background colour used for a particular marker number.
553 void wxStyledTextCtrl::MarkerSetBackground(int markerNumber
, const wxColour
& back
)
555 SendMsg(2042, markerNumber
, wxColourAsLong(back
));
558 // Set the background colour used for a particular marker number when its folding block is selected.
559 void wxStyledTextCtrl::MarkerSetBackgroundSelected(int markerNumber
, const wxColour
& back
)
561 SendMsg(2292, markerNumber
, wxColourAsLong(back
));
564 // Enable/disable highlight for current folding bloc (smallest one that contains the caret)
565 void wxStyledTextCtrl::MarkerEnableHighlight(bool enabled
)
567 SendMsg(2293, enabled
, 0);
570 // Add a marker to a line, returning an ID which can be used to find or delete the marker.
571 int wxStyledTextCtrl::MarkerAdd(int line
, int markerNumber
)
573 return SendMsg(2043, line
, markerNumber
);
576 // Delete a marker from a line.
577 void wxStyledTextCtrl::MarkerDelete(int line
, int markerNumber
)
579 SendMsg(2044, line
, markerNumber
);
582 // Delete all markers with a particular number from all lines.
583 void wxStyledTextCtrl::MarkerDeleteAll(int markerNumber
)
585 SendMsg(2045, markerNumber
, 0);
588 // Get a bit mask of all the markers set on a line.
589 int wxStyledTextCtrl::MarkerGet(int line
)
591 return SendMsg(2046, line
, 0);
594 // Find the next line at or after lineStart that includes a marker in mask.
595 // Return -1 when no more lines.
596 int wxStyledTextCtrl::MarkerNext(int lineStart
, int markerMask
)
598 return SendMsg(2047, lineStart
, markerMask
);
601 // Find the previous line before lineStart that includes a marker in mask.
602 int wxStyledTextCtrl::MarkerPrevious(int lineStart
, int markerMask
)
604 return SendMsg(2048, lineStart
, markerMask
);
607 // Define a marker from a bitmap
608 void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber
, const wxBitmap
& bmp
) {
609 // convert bmp to a xpm in a string
610 wxMemoryOutputStream strm
;
611 wxImage img
= bmp
.ConvertToImage();
613 img
.ConvertAlphaToMask();
614 img
.SaveFile(strm
, wxBITMAP_TYPE_XPM
);
615 size_t len
= strm
.GetSize();
616 char* buff
= new char[len
+1];
617 strm
.CopyTo(buff
, len
);
619 SendMsg(2049, markerNumber
, (sptr_t
)buff
);
624 // Add a set of markers to a line.
625 void wxStyledTextCtrl::MarkerAddSet(int line
, int set
)
627 SendMsg(2466, line
, set
);
630 // Set the alpha used for a marker that is drawn in the text area, not the margin.
631 void wxStyledTextCtrl::MarkerSetAlpha(int markerNumber
, int alpha
)
633 SendMsg(2476, markerNumber
, alpha
);
636 // Set a margin to be either numeric or symbolic.
637 void wxStyledTextCtrl::SetMarginType(int margin
, int marginType
)
639 SendMsg(2240, margin
, marginType
);
642 // Retrieve the type of a margin.
643 int wxStyledTextCtrl::GetMarginType(int margin
) const
645 return SendMsg(2241, margin
, 0);
648 // Set the width of a margin to a width expressed in pixels.
649 void wxStyledTextCtrl::SetMarginWidth(int margin
, int pixelWidth
)
651 SendMsg(2242, margin
, pixelWidth
);
654 // Retrieve the width of a margin in pixels.
655 int wxStyledTextCtrl::GetMarginWidth(int margin
) const
657 return SendMsg(2243, margin
, 0);
660 // Set a mask that determines which markers are displayed in a margin.
661 void wxStyledTextCtrl::SetMarginMask(int margin
, int mask
)
663 SendMsg(2244, margin
, mask
);
666 // Retrieve the marker mask of a margin.
667 int wxStyledTextCtrl::GetMarginMask(int margin
) const
669 return SendMsg(2245, margin
, 0);
672 // Make a margin sensitive or insensitive to mouse clicks.
673 void wxStyledTextCtrl::SetMarginSensitive(int margin
, bool sensitive
)
675 SendMsg(2246, margin
, sensitive
);
678 // Retrieve the mouse click sensitivity of a margin.
679 bool wxStyledTextCtrl::GetMarginSensitive(int margin
) const
681 return SendMsg(2247, margin
, 0) != 0;
684 // Set the cursor shown when the mouse is inside a margin.
685 void wxStyledTextCtrl::SetMarginCursor(int margin
, int cursor
)
687 SendMsg(2248, margin
, cursor
);
690 // Retrieve the cursor shown in a margin.
691 int wxStyledTextCtrl::GetMarginCursor(int margin
) const
693 return SendMsg(2249, margin
, 0);
696 // Clear all the styles and make equivalent to the global default style.
697 void wxStyledTextCtrl::StyleClearAll()
702 // Set the foreground colour of a style.
703 void wxStyledTextCtrl::StyleSetForeground(int style
, const wxColour
& fore
)
705 SendMsg(2051, style
, wxColourAsLong(fore
));
708 // Set the background colour of a style.
709 void wxStyledTextCtrl::StyleSetBackground(int style
, const wxColour
& back
)
711 SendMsg(2052, style
, wxColourAsLong(back
));
714 // Set a style to be bold or not.
715 void wxStyledTextCtrl::StyleSetBold(int style
, bool bold
)
717 SendMsg(2053, style
, bold
);
720 // Set a style to be italic or not.
721 void wxStyledTextCtrl::StyleSetItalic(int style
, bool italic
)
723 SendMsg(2054, style
, italic
);
726 // Set the size of characters of a style.
727 void wxStyledTextCtrl::StyleSetSize(int style
, int sizePoints
)
729 SendMsg(2055, style
, sizePoints
);
732 // Set the font of a style.
733 void wxStyledTextCtrl::StyleSetFaceName(int style
, const wxString
& fontName
)
735 SendMsg(2056, style
, (sptr_t
)(const char*)wx2stc(fontName
));
738 // Set a style to have its end of line filled or not.
739 void wxStyledTextCtrl::StyleSetEOLFilled(int style
, bool filled
)
741 SendMsg(2057, style
, filled
);
744 // Reset the default style to its state at startup
745 void wxStyledTextCtrl::StyleResetDefault()
750 // Set a style to be underlined or not.
751 void wxStyledTextCtrl::StyleSetUnderline(int style
, bool underline
)
753 SendMsg(2059, style
, underline
);
756 // Get the foreground colour of a style.
757 wxColour
wxStyledTextCtrl::StyleGetForeground(int style
) const
759 long c
= SendMsg(2481, style
, 0);
760 return wxColourFromLong(c
);
763 // Get the background colour of a style.
764 wxColour
wxStyledTextCtrl::StyleGetBackground(int style
) const
766 long c
= SendMsg(2482, style
, 0);
767 return wxColourFromLong(c
);
770 // Get is a style bold or not.
771 bool wxStyledTextCtrl::StyleGetBold(int style
) const
773 return SendMsg(2483, style
, 0) != 0;
776 // Get is a style italic or not.
777 bool wxStyledTextCtrl::StyleGetItalic(int style
) const
779 return SendMsg(2484, style
, 0) != 0;
782 // Get the size of characters of a style.
783 int wxStyledTextCtrl::StyleGetSize(int style
) const
785 return SendMsg(2485, style
, 0);
788 // Get the font facename of a style
789 wxString
wxStyledTextCtrl::StyleGetFaceName(int style
) {
791 long len
= SendMsg(msg
, style
, 0);
792 wxMemoryBuffer
mbuf(len
+1);
793 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
794 SendMsg(msg
, style
, (sptr_t
)buf
);
795 mbuf
.UngetWriteBuf(len
);
800 // Get is a style to have its end of line filled or not.
801 bool wxStyledTextCtrl::StyleGetEOLFilled(int style
) const
803 return SendMsg(2487, style
, 0) != 0;
806 // Get is a style underlined or not.
807 bool wxStyledTextCtrl::StyleGetUnderline(int style
) const
809 return SendMsg(2488, style
, 0) != 0;
812 // Get is a style mixed case, or to force upper or lower case.
813 int wxStyledTextCtrl::StyleGetCase(int style
) const
815 return SendMsg(2489, style
, 0);
818 // Get the character set of the font in a style.
819 int wxStyledTextCtrl::StyleGetCharacterSet(int style
) const
821 return SendMsg(2490, style
, 0);
824 // Get is a style visible or not.
825 bool wxStyledTextCtrl::StyleGetVisible(int style
) const
827 return SendMsg(2491, style
, 0) != 0;
830 // Get is a style changeable or not (read only).
831 // Experimental feature, currently buggy.
832 bool wxStyledTextCtrl::StyleGetChangeable(int style
) const
834 return SendMsg(2492, style
, 0) != 0;
837 // Get is a style a hotspot or not.
838 bool wxStyledTextCtrl::StyleGetHotSpot(int style
) const
840 return SendMsg(2493, style
, 0) != 0;
843 // Set a style to be mixed case, or to force upper or lower case.
844 void wxStyledTextCtrl::StyleSetCase(int style
, int caseForce
)
846 SendMsg(2060, style
, caseForce
);
849 // Set the size of characters of a style. Size is in points multiplied by 100.
850 void wxStyledTextCtrl::StyleSetSizeFractional(int style
, int caseForce
)
852 SendMsg(2061, style
, caseForce
);
855 // Get the size of characters of a style in points multiplied by 100
856 int wxStyledTextCtrl::StyleGetSizeFractional(int style
) const
858 return SendMsg(2062, style
, 0);
861 // Set the weight of characters of a style.
862 void wxStyledTextCtrl::StyleSetWeight(int style
, int weight
)
864 SendMsg(2063, style
, weight
);
867 // Get the weight of characters of a style.
868 int wxStyledTextCtrl::StyleGetWeight(int style
) const
870 return SendMsg(2064, style
, 0);
873 // Set a style to be a hotspot or not.
874 void wxStyledTextCtrl::StyleSetHotSpot(int style
, bool hotspot
)
876 SendMsg(2409, style
, hotspot
);
879 // Set the foreground colour of the main and additional selections and whether to use this setting.
880 void wxStyledTextCtrl::SetSelForeground(bool useSetting
, const wxColour
& fore
)
882 SendMsg(2067, useSetting
, wxColourAsLong(fore
));
885 // Set the background colour of the main and additional selections and whether to use this setting.
886 void wxStyledTextCtrl::SetSelBackground(bool useSetting
, const wxColour
& back
)
888 SendMsg(2068, useSetting
, wxColourAsLong(back
));
891 // Get the alpha of the selection.
892 int wxStyledTextCtrl::GetSelAlpha() const
894 return SendMsg(2477, 0, 0);
897 // Set the alpha of the selection.
898 void wxStyledTextCtrl::SetSelAlpha(int alpha
)
900 SendMsg(2478, alpha
, 0);
903 // Is the selection end of line filled?
904 bool wxStyledTextCtrl::GetSelEOLFilled() const
906 return SendMsg(2479, 0, 0) != 0;
909 // Set the selection to have its end of line filled or not.
910 void wxStyledTextCtrl::SetSelEOLFilled(bool filled
)
912 SendMsg(2480, filled
, 0);
915 // Set the foreground colour of the caret.
916 void wxStyledTextCtrl::SetCaretForeground(const wxColour
& fore
)
918 SendMsg(2069, wxColourAsLong(fore
), 0);
921 // When key+modifier combination km is pressed perform msg.
922 void wxStyledTextCtrl::CmdKeyAssign(int key
, int modifiers
, int cmd
) {
923 SendMsg(2070, MAKELONG(key
, modifiers
), cmd
);
926 // When key+modifier combination km is pressed do nothing.
927 void wxStyledTextCtrl::CmdKeyClear(int key
, int modifiers
) {
928 SendMsg(2071, MAKELONG(key
, modifiers
));
931 // Drop all key mappings.
932 void wxStyledTextCtrl::CmdKeyClearAll()
937 // Set the styles for a segment of the document.
938 void wxStyledTextCtrl::SetStyleBytes(int length
, char* styleBytes
) {
939 SendMsg(2073, length
, (sptr_t
)styleBytes
);
942 // Set a style to be visible or not.
943 void wxStyledTextCtrl::StyleSetVisible(int style
, bool visible
)
945 SendMsg(2074, style
, visible
);
948 // Get the time in milliseconds that the caret is on and off.
949 int wxStyledTextCtrl::GetCaretPeriod() const
951 return SendMsg(2075, 0, 0);
954 // Get the time in milliseconds that the caret is on and off. 0 = steady on.
955 void wxStyledTextCtrl::SetCaretPeriod(int periodMilliseconds
)
957 SendMsg(2076, periodMilliseconds
, 0);
960 // Set the set of characters making up words for when moving or selecting by word.
961 // First sets defaults like SetCharsDefault.
962 void wxStyledTextCtrl::SetWordChars(const wxString
& characters
)
964 SendMsg(2077, 0, (sptr_t
)(const char*)wx2stc(characters
));
967 // Get the set of characters making up words for when moving or selecting by word.
968 wxString
wxStyledTextCtrl::GetWordChars() const {
970 int len
= SendMsg(msg
, 0, (sptr_t
)NULL
);
971 if (!len
) return wxEmptyString
;
973 wxMemoryBuffer
mbuf(len
+1);
974 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
975 SendMsg(msg
, 0, (sptr_t
)buf
);
976 mbuf
.UngetWriteBuf(len
);
981 // Start a sequence of actions that is undone and redone as a unit.
983 void wxStyledTextCtrl::BeginUndoAction()
988 // End a sequence of actions that is undone and redone as a unit.
989 void wxStyledTextCtrl::EndUndoAction()
994 // Set an indicator to plain, squiggle or TT.
995 void wxStyledTextCtrl::IndicatorSetStyle(int indic
, int style
)
997 SendMsg(2080, indic
, style
);
1000 // Retrieve the style of an indicator.
1001 int wxStyledTextCtrl::IndicatorGetStyle(int indic
) const
1003 return SendMsg(2081, indic
, 0);
1006 // Set the foreground colour of an indicator.
1007 void wxStyledTextCtrl::IndicatorSetForeground(int indic
, const wxColour
& fore
)
1009 SendMsg(2082, indic
, wxColourAsLong(fore
));
1012 // Retrieve the foreground colour of an indicator.
1013 wxColour
wxStyledTextCtrl::IndicatorGetForeground(int indic
) const
1015 long c
= SendMsg(2083, indic
, 0);
1016 return wxColourFromLong(c
);
1019 // Set an indicator to draw under text or over(default).
1020 void wxStyledTextCtrl::IndicatorSetUnder(int indic
, bool under
)
1022 SendMsg(2510, indic
, under
);
1025 // Retrieve whether indicator drawn under or over text.
1026 bool wxStyledTextCtrl::IndicatorGetUnder(int indic
) const
1028 return SendMsg(2511, indic
, 0) != 0;
1031 // Set the foreground colour of all whitespace and whether to use this setting.
1032 void wxStyledTextCtrl::SetWhitespaceForeground(bool useSetting
, const wxColour
& fore
)
1034 SendMsg(2084, useSetting
, wxColourAsLong(fore
));
1037 // Set the background colour of all whitespace and whether to use this setting.
1038 void wxStyledTextCtrl::SetWhitespaceBackground(bool useSetting
, const wxColour
& back
)
1040 SendMsg(2085, useSetting
, wxColourAsLong(back
));
1043 // Set the size of the dots used to mark space characters.
1044 void wxStyledTextCtrl::SetWhitespaceSize(int size
)
1046 SendMsg(2086, size
, 0);
1049 // Get the size of the dots used to mark space characters.
1050 int wxStyledTextCtrl::GetWhitespaceSize() const
1052 return SendMsg(2087, 0, 0);
1055 // Divide each styling byte into lexical class bits (default: 5) and indicator
1056 // bits (default: 3). If a lexer requires more than 32 lexical states, then this
1057 // is used to expand the possible states.
1058 void wxStyledTextCtrl::SetStyleBits(int bits
)
1060 SendMsg(2090, bits
, 0);
1063 // Retrieve number of bits in style bytes used to hold the lexical state.
1064 int wxStyledTextCtrl::GetStyleBits() const
1066 return SendMsg(2091, 0, 0);
1069 // Used to hold extra styling information for each line.
1070 void wxStyledTextCtrl::SetLineState(int line
, int state
)
1072 SendMsg(2092, line
, state
);
1075 // Retrieve the extra styling information for a line.
1076 int wxStyledTextCtrl::GetLineState(int line
) const
1078 return SendMsg(2093, line
, 0);
1081 // Retrieve the last line number that has line state.
1082 int wxStyledTextCtrl::GetMaxLineState() const
1084 return SendMsg(2094, 0, 0);
1087 // Is the background of the line containing the caret in a different colour?
1088 bool wxStyledTextCtrl::GetCaretLineVisible() const
1090 return SendMsg(2095, 0, 0) != 0;
1093 // Display the background of the line containing the caret in a different colour.
1094 void wxStyledTextCtrl::SetCaretLineVisible(bool show
)
1096 SendMsg(2096, show
, 0);
1099 // Get the colour of the background of the line containing the caret.
1100 wxColour
wxStyledTextCtrl::GetCaretLineBackground() const
1102 long c
= SendMsg(2097, 0, 0);
1103 return wxColourFromLong(c
);
1106 // Set the colour of the background of the line containing the caret.
1107 void wxStyledTextCtrl::SetCaretLineBackground(const wxColour
& back
)
1109 SendMsg(2098, wxColourAsLong(back
), 0);
1112 // Set a style to be changeable or not (read only).
1113 // Experimental feature, currently buggy.
1114 void wxStyledTextCtrl::StyleSetChangeable(int style
, bool changeable
)
1116 SendMsg(2099, style
, changeable
);
1119 // Display a auto-completion list.
1120 // The lenEntered parameter indicates how many characters before
1121 // the caret should be used to provide context.
1122 void wxStyledTextCtrl::AutoCompShow(int lenEntered
, const wxString
& itemList
)
1124 SendMsg(2100, lenEntered
, (sptr_t
)(const char*)wx2stc(itemList
));
1127 // Remove the auto-completion list from the screen.
1128 void wxStyledTextCtrl::AutoCompCancel()
1130 SendMsg(2101, 0, 0);
1133 // Is there an auto-completion list visible?
1134 bool wxStyledTextCtrl::AutoCompActive()
1136 return SendMsg(2102, 0, 0) != 0;
1139 // Retrieve the position of the caret when the auto-completion list was displayed.
1140 int wxStyledTextCtrl::AutoCompPosStart()
1142 return SendMsg(2103, 0, 0);
1145 // User has selected an item so remove the list and insert the selection.
1146 void wxStyledTextCtrl::AutoCompComplete()
1148 SendMsg(2104, 0, 0);
1151 // Define a set of character that when typed cancel the auto-completion list.
1152 void wxStyledTextCtrl::AutoCompStops(const wxString
& characterSet
)
1154 SendMsg(2105, 0, (sptr_t
)(const char*)wx2stc(characterSet
));
1157 // Change the separator character in the string setting up an auto-completion list.
1158 // Default is space but can be changed if items contain space.
1159 void wxStyledTextCtrl::AutoCompSetSeparator(int separatorCharacter
)
1161 SendMsg(2106, separatorCharacter
, 0);
1164 // Retrieve the auto-completion list separator character.
1165 int wxStyledTextCtrl::AutoCompGetSeparator() const
1167 return SendMsg(2107, 0, 0);
1170 // Select the item in the auto-completion list that starts with a string.
1171 void wxStyledTextCtrl::AutoCompSelect(const wxString
& text
)
1173 SendMsg(2108, 0, (sptr_t
)(const char*)wx2stc(text
));
1176 // Should the auto-completion list be cancelled if the user backspaces to a
1177 // position before where the box was created.
1178 void wxStyledTextCtrl::AutoCompSetCancelAtStart(bool cancel
)
1180 SendMsg(2110, cancel
, 0);
1183 // Retrieve whether auto-completion cancelled by backspacing before start.
1184 bool wxStyledTextCtrl::AutoCompGetCancelAtStart() const
1186 return SendMsg(2111, 0, 0) != 0;
1189 // Define a set of characters that when typed will cause the autocompletion to
1190 // choose the selected item.
1191 void wxStyledTextCtrl::AutoCompSetFillUps(const wxString
& characterSet
)
1193 SendMsg(2112, 0, (sptr_t
)(const char*)wx2stc(characterSet
));
1196 // Should a single item auto-completion list automatically choose the item.
1197 void wxStyledTextCtrl::AutoCompSetChooseSingle(bool chooseSingle
)
1199 SendMsg(2113, chooseSingle
, 0);
1202 // Retrieve whether a single item auto-completion list automatically choose the item.
1203 bool wxStyledTextCtrl::AutoCompGetChooseSingle() const
1205 return SendMsg(2114, 0, 0) != 0;
1208 // Set whether case is significant when performing auto-completion searches.
1209 void wxStyledTextCtrl::AutoCompSetIgnoreCase(bool ignoreCase
)
1211 SendMsg(2115, ignoreCase
, 0);
1214 // Retrieve state of ignore case flag.
1215 bool wxStyledTextCtrl::AutoCompGetIgnoreCase() const
1217 return SendMsg(2116, 0, 0) != 0;
1220 // Display a list of strings and send notification when user chooses one.
1221 void wxStyledTextCtrl::UserListShow(int listType
, const wxString
& itemList
)
1223 SendMsg(2117, listType
, (sptr_t
)(const char*)wx2stc(itemList
));
1226 // Set whether or not autocompletion is hidden automatically when nothing matches.
1227 void wxStyledTextCtrl::AutoCompSetAutoHide(bool autoHide
)
1229 SendMsg(2118, autoHide
, 0);
1232 // Retrieve whether or not autocompletion is hidden automatically when nothing matches.
1233 bool wxStyledTextCtrl::AutoCompGetAutoHide() const
1235 return SendMsg(2119, 0, 0) != 0;
1238 // Set whether or not autocompletion deletes any word characters
1239 // after the inserted text upon completion.
1240 void wxStyledTextCtrl::AutoCompSetDropRestOfWord(bool dropRestOfWord
)
1242 SendMsg(2270, dropRestOfWord
, 0);
1245 // Retrieve whether or not autocompletion deletes any word characters
1246 // after the inserted text upon completion.
1247 bool wxStyledTextCtrl::AutoCompGetDropRestOfWord() const
1249 return SendMsg(2271, 0, 0) != 0;
1252 // Register an image for use in autocompletion lists.
1253 void wxStyledTextCtrl::RegisterImage(int type
, const wxBitmap
& bmp
) {
1254 // convert bmp to a xpm in a string
1255 wxMemoryOutputStream strm
;
1256 wxImage img
= bmp
.ConvertToImage();
1258 img
.ConvertAlphaToMask();
1259 img
.SaveFile(strm
, wxBITMAP_TYPE_XPM
);
1260 size_t len
= strm
.GetSize();
1261 char* buff
= new char[len
+1];
1262 strm
.CopyTo(buff
, len
);
1264 SendMsg(2405, type
, (sptr_t
)buff
);
1269 // Clear all the registered images.
1270 void wxStyledTextCtrl::ClearRegisteredImages()
1272 SendMsg(2408, 0, 0);
1275 // Retrieve the auto-completion list type-separator character.
1276 int wxStyledTextCtrl::AutoCompGetTypeSeparator() const
1278 return SendMsg(2285, 0, 0);
1281 // Change the type-separator character in the string setting up an auto-completion list.
1282 // Default is '?' but can be changed if items contain '?'.
1283 void wxStyledTextCtrl::AutoCompSetTypeSeparator(int separatorCharacter
)
1285 SendMsg(2286, separatorCharacter
, 0);
1288 // Set the maximum width, in characters, of auto-completion and user lists.
1289 // Set to 0 to autosize to fit longest item, which is the default.
1290 void wxStyledTextCtrl::AutoCompSetMaxWidth(int characterCount
)
1292 SendMsg(2208, characterCount
, 0);
1295 // Get the maximum width, in characters, of auto-completion and user lists.
1296 int wxStyledTextCtrl::AutoCompGetMaxWidth() const
1298 return SendMsg(2209, 0, 0);
1301 // Set the maximum height, in rows, of auto-completion and user lists.
1302 // The default is 5 rows.
1303 void wxStyledTextCtrl::AutoCompSetMaxHeight(int rowCount
)
1305 SendMsg(2210, rowCount
, 0);
1308 // Set the maximum height, in rows, of auto-completion and user lists.
1309 int wxStyledTextCtrl::AutoCompGetMaxHeight() const
1311 return SendMsg(2211, 0, 0);
1314 // Set the number of spaces used for one level of indentation.
1315 void wxStyledTextCtrl::SetIndent(int indentSize
)
1317 SendMsg(2122, indentSize
, 0);
1320 // Retrieve indentation size.
1321 int wxStyledTextCtrl::GetIndent() const
1323 return SendMsg(2123, 0, 0);
1326 // Indentation will only use space characters if useTabs is false, otherwise
1327 // it will use a combination of tabs and spaces.
1328 void wxStyledTextCtrl::SetUseTabs(bool useTabs
)
1330 SendMsg(2124, useTabs
, 0);
1333 // Retrieve whether tabs will be used in indentation.
1334 bool wxStyledTextCtrl::GetUseTabs() const
1336 return SendMsg(2125, 0, 0) != 0;
1339 // Change the indentation of a line to a number of columns.
1340 void wxStyledTextCtrl::SetLineIndentation(int line
, int indentSize
)
1342 SendMsg(2126, line
, indentSize
);
1345 // Retrieve the number of columns that a line is indented.
1346 int wxStyledTextCtrl::GetLineIndentation(int line
) const
1348 return SendMsg(2127, line
, 0);
1351 // Retrieve the position before the first non indentation character on a line.
1352 int wxStyledTextCtrl::GetLineIndentPosition(int line
) const
1354 return SendMsg(2128, line
, 0);
1357 // Retrieve the column number of a position, taking tab width into account.
1358 int wxStyledTextCtrl::GetColumn(int pos
) const
1360 return SendMsg(2129, pos
, 0);
1363 // Count characters between two positions.
1364 int wxStyledTextCtrl::CountCharacters(int startPos
, int endPos
)
1366 return SendMsg(2633, startPos
, endPos
);
1369 // Show or hide the horizontal scroll bar.
1370 void wxStyledTextCtrl::SetUseHorizontalScrollBar(bool show
)
1372 SendMsg(2130, show
, 0);
1375 // Is the horizontal scroll bar visible?
1376 bool wxStyledTextCtrl::GetUseHorizontalScrollBar() const
1378 return SendMsg(2131, 0, 0) != 0;
1381 // Show or hide indentation guides.
1382 void wxStyledTextCtrl::SetIndentationGuides(int indentView
)
1384 SendMsg(2132, indentView
, 0);
1387 // Are the indentation guides visible?
1388 int wxStyledTextCtrl::GetIndentationGuides() const
1390 return SendMsg(2133, 0, 0);
1393 // Set the highlighted indentation guide column.
1394 // 0 = no highlighted guide.
1395 void wxStyledTextCtrl::SetHighlightGuide(int column
)
1397 SendMsg(2134, column
, 0);
1400 // Get the highlighted indentation guide column.
1401 int wxStyledTextCtrl::GetHighlightGuide() const
1403 return SendMsg(2135, 0, 0);
1406 // Get the position after the last visible characters on a line.
1407 int wxStyledTextCtrl::GetLineEndPosition(int line
) const
1409 return SendMsg(2136, line
, 0);
1412 // Get the code page used to interpret the bytes of the document as characters.
1413 int wxStyledTextCtrl::GetCodePage() const
1415 return SendMsg(2137, 0, 0);
1418 // Get the foreground colour of the caret.
1419 wxColour
wxStyledTextCtrl::GetCaretForeground() const
1421 long c
= SendMsg(2138, 0, 0);
1422 return wxColourFromLong(c
);
1425 // In read-only mode?
1426 bool wxStyledTextCtrl::GetReadOnly() const
1428 return SendMsg(2140, 0, 0) != 0;
1431 // Sets the position of the caret.
1432 void wxStyledTextCtrl::SetCurrentPos(int pos
)
1434 SendMsg(2141, pos
, 0);
1437 // Sets the position that starts the selection - this becomes the anchor.
1438 void wxStyledTextCtrl::SetSelectionStart(int pos
)
1440 SendMsg(2142, pos
, 0);
1443 // Returns the position at the start of the selection.
1444 int wxStyledTextCtrl::GetSelectionStart() const
1446 return SendMsg(2143, 0, 0);
1449 // Sets the position that ends the selection - this becomes the currentPosition.
1450 void wxStyledTextCtrl::SetSelectionEnd(int pos
)
1452 SendMsg(2144, pos
, 0);
1455 // Returns the position at the end of the selection.
1456 int wxStyledTextCtrl::GetSelectionEnd() const
1458 return SendMsg(2145, 0, 0);
1461 // Set caret to a position, while removing any existing selection.
1462 void wxStyledTextCtrl::SetEmptySelection(int pos
)
1464 SendMsg(2556, pos
, 0);
1467 // Sets the print magnification added to the point size of each style for printing.
1468 void wxStyledTextCtrl::SetPrintMagnification(int magnification
)
1470 SendMsg(2146, magnification
, 0);
1473 // Returns the print magnification.
1474 int wxStyledTextCtrl::GetPrintMagnification() const
1476 return SendMsg(2147, 0, 0);
1479 // Modify colours when printing for clearer printed text.
1480 void wxStyledTextCtrl::SetPrintColourMode(int mode
)
1482 SendMsg(2148, mode
, 0);
1485 // Returns the print colour mode.
1486 int wxStyledTextCtrl::GetPrintColourMode() const
1488 return SendMsg(2149, 0, 0);
1491 // Find some text in the document.
1492 int wxStyledTextCtrl::FindText(int minPos
, int maxPos
,
1493 const wxString
& text
,
1496 ft
.chrg
.cpMin
= minPos
;
1497 ft
.chrg
.cpMax
= maxPos
;
1498 const wxWX2MBbuf buf
= wx2stc(text
);
1499 ft
.lpstrText
= (char*)(const char*)buf
;
1501 return SendMsg(2150, flags
, (sptr_t
)&ft
);
1504 // On Windows, will draw the document into a display context such as a printer.
1505 int wxStyledTextCtrl::FormatRange(bool doDraw
,
1514 if (endPos
< startPos
) {
1515 int temp
= startPos
;
1520 fr
.hdcTarget
= target
;
1521 fr
.rc
.top
= renderRect
.GetTop();
1522 fr
.rc
.left
= renderRect
.GetLeft();
1523 fr
.rc
.right
= renderRect
.GetRight();
1524 fr
.rc
.bottom
= renderRect
.GetBottom();
1525 fr
.rcPage
.top
= pageRect
.GetTop();
1526 fr
.rcPage
.left
= pageRect
.GetLeft();
1527 fr
.rcPage
.right
= pageRect
.GetRight();
1528 fr
.rcPage
.bottom
= pageRect
.GetBottom();
1529 fr
.chrg
.cpMin
= startPos
;
1530 fr
.chrg
.cpMax
= endPos
;
1532 return SendMsg(2151, doDraw
, (sptr_t
)&fr
);
1535 // Retrieve the display line at the top of the display.
1536 int wxStyledTextCtrl::GetFirstVisibleLine() const
1538 return SendMsg(2152, 0, 0);
1541 // Retrieve the contents of a line.
1542 wxString
wxStyledTextCtrl::GetLine(int line
) const {
1543 int len
= LineLength(line
);
1544 if (!len
) return wxEmptyString
;
1546 wxMemoryBuffer
mbuf(len
+1);
1547 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1548 SendMsg(2153, line
, (sptr_t
)buf
);
1549 mbuf
.UngetWriteBuf(len
);
1554 // Returns the number of lines in the document. There is always at least one.
1555 int wxStyledTextCtrl::GetLineCount() const
1557 return SendMsg(2154, 0, 0);
1560 // Sets the size in pixels of the left margin.
1561 void wxStyledTextCtrl::SetMarginLeft(int pixelWidth
)
1563 SendMsg(2155, 0, pixelWidth
);
1566 // Returns the size in pixels of the left margin.
1567 int wxStyledTextCtrl::GetMarginLeft() const
1569 return SendMsg(2156, 0, 0);
1572 // Sets the size in pixels of the right margin.
1573 void wxStyledTextCtrl::SetMarginRight(int pixelWidth
)
1575 SendMsg(2157, 0, pixelWidth
);
1578 // Returns the size in pixels of the right margin.
1579 int wxStyledTextCtrl::GetMarginRight() const
1581 return SendMsg(2158, 0, 0);
1584 // Is the document different from when it was last saved?
1585 bool wxStyledTextCtrl::GetModify() const
1587 return SendMsg(2159, 0, 0) != 0;
1590 // Retrieve the selected text.
1591 wxString
wxStyledTextCtrl::GetSelectedText() {
1592 const int len
= SendMsg(SCI_GETSELTEXT
, 0, (sptr_t
)0);
1593 if (!len
) return wxEmptyString
;
1595 wxMemoryBuffer
mbuf(len
+2);
1596 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1597 SendMsg(2161, 0, (sptr_t
)buf
);
1598 mbuf
.UngetWriteBuf(len
);
1603 // Retrieve a range of text.
1604 wxString
wxStyledTextCtrl::GetTextRange(int startPos
, int endPos
) {
1605 if (endPos
< startPos
) {
1606 int temp
= startPos
;
1610 int len
= endPos
- startPos
;
1611 if (!len
) return wxEmptyString
;
1612 wxMemoryBuffer
mbuf(len
+1);
1613 char* buf
= (char*)mbuf
.GetWriteBuf(len
);
1616 tr
.chrg
.cpMin
= startPos
;
1617 tr
.chrg
.cpMax
= endPos
;
1618 SendMsg(2162, 0, (sptr_t
)&tr
);
1619 mbuf
.UngetWriteBuf(len
);
1624 // Draw the selection in normal style or with selection highlighted.
1625 void wxStyledTextCtrl::HideSelection(bool normal
)
1627 SendMsg(2163, normal
, 0);
1630 // Retrieve the line containing a position.
1631 int wxStyledTextCtrl::LineFromPosition(int pos
) const
1633 return SendMsg(2166, pos
, 0);
1636 // Retrieve the position at the start of a line.
1637 int wxStyledTextCtrl::PositionFromLine(int line
) const
1639 return SendMsg(2167, line
, 0);
1642 // Scroll horizontally and vertically.
1643 void wxStyledTextCtrl::LineScroll(int columns
, int lines
)
1645 SendMsg(2168, columns
, lines
);
1648 // Ensure the caret is visible.
1649 void wxStyledTextCtrl::EnsureCaretVisible()
1651 SendMsg(2169, 0, 0);
1654 // Replace the selected text with the argument text.
1655 void wxStyledTextCtrl::ReplaceSelection(const wxString
& text
)
1657 SendMsg(2170, 0, (sptr_t
)(const char*)wx2stc(text
));
1660 // Set to read only or read write.
1661 void wxStyledTextCtrl::SetReadOnly(bool readOnly
)
1663 SendMsg(2171, readOnly
, 0);
1666 // Will a paste succeed?
1667 bool wxStyledTextCtrl::CanPaste() const
1669 return SendMsg(2173, 0, 0) != 0;
1672 // Are there any undoable actions in the undo history?
1673 bool wxStyledTextCtrl::CanUndo() const
1675 return SendMsg(2174, 0, 0) != 0;
1678 // Delete the undo history.
1679 void wxStyledTextCtrl::EmptyUndoBuffer()
1681 SendMsg(2175, 0, 0);
1684 // Undo one action in the undo history.
1685 void wxStyledTextCtrl::Undo()
1687 SendMsg(2176, 0, 0);
1690 // Cut the selection to the clipboard.
1691 void wxStyledTextCtrl::Cut()
1693 SendMsg(2177, 0, 0);
1696 // Copy the selection to the clipboard.
1697 void wxStyledTextCtrl::Copy()
1699 SendMsg(2178, 0, 0);
1702 // Paste the contents of the clipboard into the document replacing the selection.
1703 void wxStyledTextCtrl::Paste()
1705 SendMsg(2179, 0, 0);
1708 // Clear the selection.
1709 void wxStyledTextCtrl::Clear()
1711 SendMsg(2180, 0, 0);
1714 // Replace the contents of the document with the argument text.
1715 void wxStyledTextCtrl::SetText(const wxString
& text
)
1717 SendMsg(2181, 0, (sptr_t
)(const char*)wx2stc(text
));
1720 // Retrieve all the text in the document.
1721 wxString
wxStyledTextCtrl::GetText() const {
1722 int len
= GetTextLength();
1723 wxMemoryBuffer
mbuf(len
+1); // leave room for the null...
1724 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1725 SendMsg(2182, len
+1, (sptr_t
)buf
);
1726 mbuf
.UngetWriteBuf(len
);
1731 // Retrieve the number of characters in the document.
1732 int wxStyledTextCtrl::GetTextLength() const
1734 return SendMsg(2183, 0, 0);
1737 // Set to overtype (true) or insert mode.
1738 void wxStyledTextCtrl::SetOvertype(bool overtype
)
1740 SendMsg(2186, overtype
, 0);
1743 // Returns true if overtype mode is active otherwise false is returned.
1744 bool wxStyledTextCtrl::GetOvertype() const
1746 return SendMsg(2187, 0, 0) != 0;
1749 // Set the width of the insert mode caret.
1750 void wxStyledTextCtrl::SetCaretWidth(int pixelWidth
)
1752 SendMsg(2188, pixelWidth
, 0);
1755 // Returns the width of the insert mode caret.
1756 int wxStyledTextCtrl::GetCaretWidth() const
1758 return SendMsg(2189, 0, 0);
1761 // Sets the position that starts the target which is used for updating the
1762 // document without affecting the scroll position.
1763 void wxStyledTextCtrl::SetTargetStart(int pos
)
1765 SendMsg(2190, pos
, 0);
1768 // Get the position that starts the target.
1769 int wxStyledTextCtrl::GetTargetStart() const
1771 return SendMsg(2191, 0, 0);
1774 // Sets the position that ends the target which is used for updating the
1775 // document without affecting the scroll position.
1776 void wxStyledTextCtrl::SetTargetEnd(int pos
)
1778 SendMsg(2192, pos
, 0);
1781 // Get the position that ends the target.
1782 int wxStyledTextCtrl::GetTargetEnd() const
1784 return SendMsg(2193, 0, 0);
1787 // Replace the target text with the argument text.
1788 // Text is counted so it can contain NULs.
1789 // Returns the length of the replacement text.
1791 int wxStyledTextCtrl::ReplaceTarget(const wxString
& text
) {
1792 const wxWX2MBbuf buf
= wx2stc(text
);
1793 return SendMsg(2194, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
1796 // Replace the target text with the argument text after \d processing.
1797 // Text is counted so it can contain NULs.
1798 // Looks for \d where d is between 1 and 9 and replaces these with the strings
1799 // matched in the last search operation which were surrounded by \( and \).
1800 // Returns the length of the replacement text including any change
1801 // caused by processing the \d patterns.
1803 int wxStyledTextCtrl::ReplaceTargetRE(const wxString
& text
) {
1804 const wxWX2MBbuf buf
= wx2stc(text
);
1805 return SendMsg(2195, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
1808 // Search for a counted string in the target and set the target to the found
1809 // range. Text is counted so it can contain NULs.
1810 // Returns length of range or -1 for failure in which case target is not moved.
1812 int wxStyledTextCtrl::SearchInTarget(const wxString
& text
) {
1813 const wxWX2MBbuf buf
= wx2stc(text
);
1814 return SendMsg(2197, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
1817 // Set the search flags used by SearchInTarget.
1818 void wxStyledTextCtrl::SetSearchFlags(int flags
)
1820 SendMsg(2198, flags
, 0);
1823 // Get the search flags used by SearchInTarget.
1824 int wxStyledTextCtrl::GetSearchFlags() const
1826 return SendMsg(2199, 0, 0);
1829 // Show a call tip containing a definition near position pos.
1830 void wxStyledTextCtrl::CallTipShow(int pos
, const wxString
& definition
)
1832 SendMsg(2200, pos
, (sptr_t
)(const char*)wx2stc(definition
));
1835 // Remove the call tip from the screen.
1836 void wxStyledTextCtrl::CallTipCancel()
1838 SendMsg(2201, 0, 0);
1841 // Is there an active call tip?
1842 bool wxStyledTextCtrl::CallTipActive()
1844 return SendMsg(2202, 0, 0) != 0;
1847 // Retrieve the position where the caret was before displaying the call tip.
1848 int wxStyledTextCtrl::CallTipPosAtStart()
1850 return SendMsg(2203, 0, 0);
1853 // Highlight a segment of the definition.
1854 void wxStyledTextCtrl::CallTipSetHighlight(int start
, int end
)
1856 SendMsg(2204, start
, end
);
1859 // Set the background colour for the call tip.
1860 void wxStyledTextCtrl::CallTipSetBackground(const wxColour
& back
)
1862 SendMsg(2205, wxColourAsLong(back
), 0);
1865 // Set the foreground colour for the call tip.
1866 void wxStyledTextCtrl::CallTipSetForeground(const wxColour
& fore
)
1868 SendMsg(2206, wxColourAsLong(fore
), 0);
1871 // Set the foreground colour for the highlighted part of the call tip.
1872 void wxStyledTextCtrl::CallTipSetForegroundHighlight(const wxColour
& fore
)
1874 SendMsg(2207, wxColourAsLong(fore
), 0);
1877 // Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
1878 void wxStyledTextCtrl::CallTipUseStyle(int tabSize
)
1880 SendMsg(2212, tabSize
, 0);
1883 // Set position of calltip, above or below text.
1884 void wxStyledTextCtrl::CallTipSetPosition(bool above
)
1886 SendMsg(2213, above
, 0);
1889 // Find the display line of a document line taking hidden lines into account.
1890 int wxStyledTextCtrl::VisibleFromDocLine(int line
)
1892 return SendMsg(2220, line
, 0);
1895 // Find the document line of a display line taking hidden lines into account.
1896 int wxStyledTextCtrl::DocLineFromVisible(int lineDisplay
)
1898 return SendMsg(2221, lineDisplay
, 0);
1901 // The number of display lines needed to wrap a document line
1902 int wxStyledTextCtrl::WrapCount(int line
)
1904 return SendMsg(2235, line
, 0);
1907 // Set the fold level of a line.
1908 // This encodes an integer level along with flags indicating whether the
1909 // line is a header and whether it is effectively white space.
1910 void wxStyledTextCtrl::SetFoldLevel(int line
, int level
)
1912 SendMsg(2222, line
, level
);
1915 // Retrieve the fold level of a line.
1916 int wxStyledTextCtrl::GetFoldLevel(int line
) const
1918 return SendMsg(2223, line
, 0);
1921 // Find the last child line of a header line.
1922 int wxStyledTextCtrl::GetLastChild(int line
, int level
) const
1924 return SendMsg(2224, line
, level
);
1927 // Find the parent line of a child line.
1928 int wxStyledTextCtrl::GetFoldParent(int line
) const
1930 return SendMsg(2225, line
, 0);
1933 // Make a range of lines visible.
1934 void wxStyledTextCtrl::ShowLines(int lineStart
, int lineEnd
)
1936 SendMsg(2226, lineStart
, lineEnd
);
1939 // Make a range of lines invisible.
1940 void wxStyledTextCtrl::HideLines(int lineStart
, int lineEnd
)
1942 SendMsg(2227, lineStart
, lineEnd
);
1945 // Is a line visible?
1946 bool wxStyledTextCtrl::GetLineVisible(int line
) const
1948 return SendMsg(2228, line
, 0) != 0;
1951 // Are all lines visible?
1952 bool wxStyledTextCtrl::GetAllLinesVisible() const
1954 return SendMsg(2236, 0, 0) != 0;
1957 // Show the children of a header line.
1958 void wxStyledTextCtrl::SetFoldExpanded(int line
, bool expanded
)
1960 SendMsg(2229, line
, expanded
);
1963 // Is a header line expanded?
1964 bool wxStyledTextCtrl::GetFoldExpanded(int line
) const
1966 return SendMsg(2230, line
, 0) != 0;
1969 // Switch a header line between expanded and contracted.
1970 void wxStyledTextCtrl::ToggleFold(int line
)
1972 SendMsg(2231, line
, 0);
1975 // Ensure a particular line is visible by expanding any header line hiding it.
1976 void wxStyledTextCtrl::EnsureVisible(int line
)
1978 SendMsg(2232, line
, 0);
1981 // Set some style options for folding.
1982 void wxStyledTextCtrl::SetFoldFlags(int flags
)
1984 SendMsg(2233, flags
, 0);
1987 // Ensure a particular line is visible by expanding any header line hiding it.
1988 // Use the currently set visibility policy to determine which range to display.
1989 void wxStyledTextCtrl::EnsureVisibleEnforcePolicy(int line
)
1991 SendMsg(2234, line
, 0);
1994 // Sets whether a tab pressed when caret is within indentation indents.
1995 void wxStyledTextCtrl::SetTabIndents(bool tabIndents
)
1997 SendMsg(2260, tabIndents
, 0);
2000 // Does a tab pressed when caret is within indentation indent?
2001 bool wxStyledTextCtrl::GetTabIndents() const
2003 return SendMsg(2261, 0, 0) != 0;
2006 // Sets whether a backspace pressed when caret is within indentation unindents.
2007 void wxStyledTextCtrl::SetBackSpaceUnIndents(bool bsUnIndents
)
2009 SendMsg(2262, bsUnIndents
, 0);
2012 // Does a backspace pressed when caret is within indentation unindent?
2013 bool wxStyledTextCtrl::GetBackSpaceUnIndents() const
2015 return SendMsg(2263, 0, 0) != 0;
2018 // Sets the time the mouse must sit still to generate a mouse dwell event.
2019 void wxStyledTextCtrl::SetMouseDwellTime(int periodMilliseconds
)
2021 SendMsg(2264, periodMilliseconds
, 0);
2024 // Retrieve the time the mouse must sit still to generate a mouse dwell event.
2025 int wxStyledTextCtrl::GetMouseDwellTime() const
2027 return SendMsg(2265, 0, 0);
2030 // Get position of start of word.
2031 int wxStyledTextCtrl::WordStartPosition(int pos
, bool onlyWordCharacters
)
2033 return SendMsg(2266, pos
, onlyWordCharacters
);
2036 // Get position of end of word.
2037 int wxStyledTextCtrl::WordEndPosition(int pos
, bool onlyWordCharacters
)
2039 return SendMsg(2267, pos
, onlyWordCharacters
);
2042 // Sets whether text is word wrapped.
2043 void wxStyledTextCtrl::SetWrapMode(int mode
)
2045 SendMsg(2268, mode
, 0);
2048 // Retrieve whether text is word wrapped.
2049 int wxStyledTextCtrl::GetWrapMode() const
2051 return SendMsg(2269, 0, 0);
2054 // Set the display mode of visual flags for wrapped lines.
2055 void wxStyledTextCtrl::SetWrapVisualFlags(int wrapVisualFlags
)
2057 SendMsg(2460, wrapVisualFlags
, 0);
2060 // Retrive the display mode of visual flags for wrapped lines.
2061 int wxStyledTextCtrl::GetWrapVisualFlags() const
2063 return SendMsg(2461, 0, 0);
2066 // Set the location of visual flags for wrapped lines.
2067 void wxStyledTextCtrl::SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation
)
2069 SendMsg(2462, wrapVisualFlagsLocation
, 0);
2072 // Retrive the location of visual flags for wrapped lines.
2073 int wxStyledTextCtrl::GetWrapVisualFlagsLocation() const
2075 return SendMsg(2463, 0, 0);
2078 // Set the start indent for wrapped lines.
2079 void wxStyledTextCtrl::SetWrapStartIndent(int indent
)
2081 SendMsg(2464, indent
, 0);
2084 // Retrive the start indent for wrapped lines.
2085 int wxStyledTextCtrl::GetWrapStartIndent() const
2087 return SendMsg(2465, 0, 0);
2090 // Sets how wrapped sublines are placed. Default is fixed.
2091 void wxStyledTextCtrl::SetWrapIndentMode(int mode
)
2093 SendMsg(2472, mode
, 0);
2096 // Retrieve how wrapped sublines are placed. Default is fixed.
2097 int wxStyledTextCtrl::GetWrapIndentMode() const
2099 return SendMsg(2473, 0, 0);
2102 // Sets the degree of caching of layout information.
2103 void wxStyledTextCtrl::SetLayoutCache(int mode
)
2105 SendMsg(2272, mode
, 0);
2108 // Retrieve the degree of caching of layout information.
2109 int wxStyledTextCtrl::GetLayoutCache() const
2111 return SendMsg(2273, 0, 0);
2114 // Sets the document width assumed for scrolling.
2115 void wxStyledTextCtrl::SetScrollWidth(int pixelWidth
)
2117 SendMsg(2274, pixelWidth
, 0);
2120 // Retrieve the document width assumed for scrolling.
2121 int wxStyledTextCtrl::GetScrollWidth() const
2123 return SendMsg(2275, 0, 0);
2126 // Sets whether the maximum width line displayed is used to set scroll width.
2127 void wxStyledTextCtrl::SetScrollWidthTracking(bool tracking
)
2129 SendMsg(2516, tracking
, 0);
2132 // Retrieve whether the scroll width tracks wide lines.
2133 bool wxStyledTextCtrl::GetScrollWidthTracking() const
2135 return SendMsg(2517, 0, 0) != 0;
2138 // Measure the pixel width of some text in a particular style.
2139 // NUL terminated text argument.
2140 // Does not handle tab or control characters.
2141 int wxStyledTextCtrl::TextWidth(int style
, const wxString
& text
)
2143 return SendMsg(2276, style
, (sptr_t
)(const char*)wx2stc(text
));
2146 // Sets the scroll range so that maximum scroll position has
2147 // the last line at the bottom of the view (default).
2148 // Setting this to false allows scrolling one page below the last line.
2149 void wxStyledTextCtrl::SetEndAtLastLine(bool endAtLastLine
)
2151 SendMsg(2277, endAtLastLine
, 0);
2154 // Retrieve whether the maximum scroll position has the last
2155 // line at the bottom of the view.
2156 bool wxStyledTextCtrl::GetEndAtLastLine() const
2158 return SendMsg(2278, 0, 0) != 0;
2161 // Retrieve the height of a particular line of text in pixels.
2162 int wxStyledTextCtrl::TextHeight(int line
)
2164 return SendMsg(2279, line
, 0);
2167 // Show or hide the vertical scroll bar.
2168 void wxStyledTextCtrl::SetUseVerticalScrollBar(bool show
)
2170 SendMsg(2280, show
, 0);
2173 // Is the vertical scroll bar visible?
2174 bool wxStyledTextCtrl::GetUseVerticalScrollBar() const
2176 return SendMsg(2281, 0, 0) != 0;
2179 // Append a string to the end of the document without changing the selection.
2180 void wxStyledTextCtrl::AppendText(const wxString
& text
) {
2181 const wxWX2MBbuf buf
= wx2stc(text
);
2182 SendMsg(2282, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
2185 // Is drawing done in two phases with backgrounds drawn before foregrounds?
2186 bool wxStyledTextCtrl::GetTwoPhaseDraw() const
2188 return SendMsg(2283, 0, 0) != 0;
2191 // In twoPhaseDraw mode, drawing is performed in two phases, first the background
2192 // and then the foreground. This avoids chopping off characters that overlap the next run.
2193 void wxStyledTextCtrl::SetTwoPhaseDraw(bool twoPhase
)
2195 SendMsg(2284, twoPhase
, 0);
2198 // Scroll so that a display line is at the top of the display.
2199 void wxStyledTextCtrl::SetFirstVisibleLine(int lineDisplay
)
2201 SendMsg(2613, lineDisplay
, 0);
2204 // Change the effect of pasting when there are multiple selections.
2205 void wxStyledTextCtrl::SetMultiPaste(int multiPaste
)
2207 SendMsg(2614, multiPaste
, 0);
2210 // Retrieve the effect of pasting when there are multiple selections..
2211 int wxStyledTextCtrl::GetMultiPaste() const
2213 return SendMsg(2615, 0, 0);
2216 // Retrieve the value of a tag from a regular expression search.
2217 wxString
wxStyledTextCtrl::GetTag(int tagNumber
) const {
2219 int len
= SendMsg(msg
, tagNumber
, (sptr_t
)NULL
);
2220 if (!len
) return wxEmptyString
;
2222 wxMemoryBuffer
mbuf(len
+1);
2223 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
2224 SendMsg(msg
, tagNumber
, (sptr_t
)buf
);
2225 mbuf
.UngetWriteBuf(len
);
2230 // Make the target range start and end be the same as the selection range start and end.
2231 void wxStyledTextCtrl::TargetFromSelection()
2233 SendMsg(2287, 0, 0);
2236 // Join the lines in the target.
2237 void wxStyledTextCtrl::LinesJoin()
2239 SendMsg(2288, 0, 0);
2242 // Split the lines in the target into lines that are less wide than pixelWidth
2244 void wxStyledTextCtrl::LinesSplit(int pixelWidth
)
2246 SendMsg(2289, pixelWidth
, 0);
2249 // Set the colours used as a chequerboard pattern in the fold margin
2250 void wxStyledTextCtrl::SetFoldMarginColour(bool useSetting
, const wxColour
& back
)
2252 SendMsg(2290, useSetting
, wxColourAsLong(back
));
2254 void wxStyledTextCtrl::SetFoldMarginHiColour(bool useSetting
, const wxColour
& fore
)
2256 SendMsg(2291, useSetting
, wxColourAsLong(fore
));
2259 // Move caret down one line.
2260 void wxStyledTextCtrl::LineDown()
2262 SendMsg(2300, 0, 0);
2265 // Move caret down one line extending selection to new caret position.
2266 void wxStyledTextCtrl::LineDownExtend()
2268 SendMsg(2301, 0, 0);
2271 // Move caret up one line.
2272 void wxStyledTextCtrl::LineUp()
2274 SendMsg(2302, 0, 0);
2277 // Move caret up one line extending selection to new caret position.
2278 void wxStyledTextCtrl::LineUpExtend()
2280 SendMsg(2303, 0, 0);
2283 // Move caret left one character.
2284 void wxStyledTextCtrl::CharLeft()
2286 SendMsg(2304, 0, 0);
2289 // Move caret left one character extending selection to new caret position.
2290 void wxStyledTextCtrl::CharLeftExtend()
2292 SendMsg(2305, 0, 0);
2295 // Move caret right one character.
2296 void wxStyledTextCtrl::CharRight()
2298 SendMsg(2306, 0, 0);
2301 // Move caret right one character extending selection to new caret position.
2302 void wxStyledTextCtrl::CharRightExtend()
2304 SendMsg(2307, 0, 0);
2307 // Move caret left one word.
2308 void wxStyledTextCtrl::WordLeft()
2310 SendMsg(2308, 0, 0);
2313 // Move caret left one word extending selection to new caret position.
2314 void wxStyledTextCtrl::WordLeftExtend()
2316 SendMsg(2309, 0, 0);
2319 // Move caret right one word.
2320 void wxStyledTextCtrl::WordRight()
2322 SendMsg(2310, 0, 0);
2325 // Move caret right one word extending selection to new caret position.
2326 void wxStyledTextCtrl::WordRightExtend()
2328 SendMsg(2311, 0, 0);
2331 // Move caret to first position on line.
2332 void wxStyledTextCtrl::Home()
2334 SendMsg(2312, 0, 0);
2337 // Move caret to first position on line extending selection to new caret position.
2338 void wxStyledTextCtrl::HomeExtend()
2340 SendMsg(2313, 0, 0);
2343 // Move caret to last position on line.
2344 void wxStyledTextCtrl::LineEnd()
2346 SendMsg(2314, 0, 0);
2349 // Move caret to last position on line extending selection to new caret position.
2350 void wxStyledTextCtrl::LineEndExtend()
2352 SendMsg(2315, 0, 0);
2355 // Move caret to first position in document.
2356 void wxStyledTextCtrl::DocumentStart()
2358 SendMsg(2316, 0, 0);
2361 // Move caret to first position in document extending selection to new caret position.
2362 void wxStyledTextCtrl::DocumentStartExtend()
2364 SendMsg(2317, 0, 0);
2367 // Move caret to last position in document.
2368 void wxStyledTextCtrl::DocumentEnd()
2370 SendMsg(2318, 0, 0);
2373 // Move caret to last position in document extending selection to new caret position.
2374 void wxStyledTextCtrl::DocumentEndExtend()
2376 SendMsg(2319, 0, 0);
2379 // Move caret one page up.
2380 void wxStyledTextCtrl::PageUp()
2382 SendMsg(2320, 0, 0);
2385 // Move caret one page up extending selection to new caret position.
2386 void wxStyledTextCtrl::PageUpExtend()
2388 SendMsg(2321, 0, 0);
2391 // Move caret one page down.
2392 void wxStyledTextCtrl::PageDown()
2394 SendMsg(2322, 0, 0);
2397 // Move caret one page down extending selection to new caret position.
2398 void wxStyledTextCtrl::PageDownExtend()
2400 SendMsg(2323, 0, 0);
2403 // Switch from insert to overtype mode or the reverse.
2404 void wxStyledTextCtrl::EditToggleOvertype()
2406 SendMsg(2324, 0, 0);
2409 // Cancel any modes such as call tip or auto-completion list display.
2410 void wxStyledTextCtrl::Cancel()
2412 SendMsg(2325, 0, 0);
2415 // Delete the selection or if no selection, the character before the caret.
2416 void wxStyledTextCtrl::DeleteBack()
2418 SendMsg(2326, 0, 0);
2421 // If selection is empty or all on one line replace the selection with a tab character.
2422 // If more than one line selected, indent the lines.
2423 void wxStyledTextCtrl::Tab()
2425 SendMsg(2327, 0, 0);
2428 // Dedent the selected lines.
2429 void wxStyledTextCtrl::BackTab()
2431 SendMsg(2328, 0, 0);
2434 // Insert a new line, may use a CRLF, CR or LF depending on EOL mode.
2435 void wxStyledTextCtrl::NewLine()
2437 SendMsg(2329, 0, 0);
2440 // Insert a Form Feed character.
2441 void wxStyledTextCtrl::FormFeed()
2443 SendMsg(2330, 0, 0);
2446 // Move caret to before first visible character on line.
2447 // If already there move to first character on line.
2448 void wxStyledTextCtrl::VCHome()
2450 SendMsg(2331, 0, 0);
2453 // Like VCHome but extending selection to new caret position.
2454 void wxStyledTextCtrl::VCHomeExtend()
2456 SendMsg(2332, 0, 0);
2459 // Magnify the displayed text by increasing the sizes by 1 point.
2460 void wxStyledTextCtrl::ZoomIn()
2462 SendMsg(2333, 0, 0);
2465 // Make the displayed text smaller by decreasing the sizes by 1 point.
2466 void wxStyledTextCtrl::ZoomOut()
2468 SendMsg(2334, 0, 0);
2471 // Delete the word to the left of the caret.
2472 void wxStyledTextCtrl::DelWordLeft()
2474 SendMsg(2335, 0, 0);
2477 // Delete the word to the right of the caret.
2478 void wxStyledTextCtrl::DelWordRight()
2480 SendMsg(2336, 0, 0);
2483 // Delete the word to the right of the caret, but not the trailing non-word characters.
2484 void wxStyledTextCtrl::DelWordRightEnd()
2486 SendMsg(2518, 0, 0);
2489 // Cut the line containing the caret.
2490 void wxStyledTextCtrl::LineCut()
2492 SendMsg(2337, 0, 0);
2495 // Delete the line containing the caret.
2496 void wxStyledTextCtrl::LineDelete()
2498 SendMsg(2338, 0, 0);
2501 // Switch the current line with the previous.
2502 void wxStyledTextCtrl::LineTranspose()
2504 SendMsg(2339, 0, 0);
2507 // Duplicate the current line.
2508 void wxStyledTextCtrl::LineDuplicate()
2510 SendMsg(2404, 0, 0);
2513 // Transform the selection to lower case.
2514 void wxStyledTextCtrl::LowerCase()
2516 SendMsg(2340, 0, 0);
2519 // Transform the selection to upper case.
2520 void wxStyledTextCtrl::UpperCase()
2522 SendMsg(2341, 0, 0);
2525 // Scroll the document down, keeping the caret visible.
2526 void wxStyledTextCtrl::LineScrollDown()
2528 SendMsg(2342, 0, 0);
2531 // Scroll the document up, keeping the caret visible.
2532 void wxStyledTextCtrl::LineScrollUp()
2534 SendMsg(2343, 0, 0);
2537 // Delete the selection or if no selection, the character before the caret.
2538 // Will not delete the character before at the start of a line.
2539 void wxStyledTextCtrl::DeleteBackNotLine()
2541 SendMsg(2344, 0, 0);
2544 // Move caret to first position on display line.
2545 void wxStyledTextCtrl::HomeDisplay()
2547 SendMsg(2345, 0, 0);
2550 // Move caret to first position on display line extending selection to
2551 // new caret position.
2552 void wxStyledTextCtrl::HomeDisplayExtend()
2554 SendMsg(2346, 0, 0);
2557 // Move caret to last position on display line.
2558 void wxStyledTextCtrl::LineEndDisplay()
2560 SendMsg(2347, 0, 0);
2563 // Move caret to last position on display line extending selection to new
2565 void wxStyledTextCtrl::LineEndDisplayExtend()
2567 SendMsg(2348, 0, 0);
2570 // These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)?
2571 // except they behave differently when word-wrap is enabled:
2572 // They go first to the start / end of the display line, like (Home|LineEnd)Display
2573 // The difference is that, the cursor is already at the point, it goes on to the start
2574 // or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
2575 void wxStyledTextCtrl::HomeWrap()
2577 SendMsg(2349, 0, 0);
2579 void wxStyledTextCtrl::HomeWrapExtend()
2581 SendMsg(2450, 0, 0);
2583 void wxStyledTextCtrl::LineEndWrap()
2585 SendMsg(2451, 0, 0);
2587 void wxStyledTextCtrl::LineEndWrapExtend()
2589 SendMsg(2452, 0, 0);
2591 void wxStyledTextCtrl::VCHomeWrap()
2593 SendMsg(2453, 0, 0);
2595 void wxStyledTextCtrl::VCHomeWrapExtend()
2597 SendMsg(2454, 0, 0);
2600 // Copy the line containing the caret.
2601 void wxStyledTextCtrl::LineCopy()
2603 SendMsg(2455, 0, 0);
2606 // Move the caret inside current view if it's not there already.
2607 void wxStyledTextCtrl::MoveCaretInsideView()
2609 SendMsg(2401, 0, 0);
2612 // How many characters are on a line, including end of line characters?
2613 int wxStyledTextCtrl::LineLength(int line
) const
2615 return SendMsg(2350, line
, 0);
2618 // Highlight the characters at two positions.
2619 void wxStyledTextCtrl::BraceHighlight(int pos1
, int pos2
)
2621 SendMsg(2351, pos1
, pos2
);
2624 // Use specified indicator to highlight matching braces instead of changing their style.
2625 void wxStyledTextCtrl::BraceHighlightIndicator(bool useBraceHighlightIndicator
, int indicator
)
2627 SendMsg(2498, useBraceHighlightIndicator
, indicator
);
2630 // Highlight the character at a position indicating there is no matching brace.
2631 void wxStyledTextCtrl::BraceBadLight(int pos
)
2633 SendMsg(2352, pos
, 0);
2636 // Use specified indicator to highlight non matching brace instead of changing its style.
2637 void wxStyledTextCtrl::BraceBadLightIndicator(bool useBraceBadLightIndicator
, int indicator
)
2639 SendMsg(2499, useBraceBadLightIndicator
, indicator
);
2642 // Find the position of a matching brace or INVALID_POSITION if no match.
2643 int wxStyledTextCtrl::BraceMatch(int pos
)
2645 return SendMsg(2353, pos
, 0);
2648 // Are the end of line characters visible?
2649 bool wxStyledTextCtrl::GetViewEOL() const
2651 return SendMsg(2355, 0, 0) != 0;
2654 // Make the end of line characters visible or invisible.
2655 void wxStyledTextCtrl::SetViewEOL(bool visible
)
2657 SendMsg(2356, visible
, 0);
2660 // Retrieve a pointer to the document object.
2661 void* wxStyledTextCtrl::GetDocPointer() {
2662 return (void*)SendMsg(2357);
2665 // Change the document object used.
2666 void wxStyledTextCtrl::SetDocPointer(void* docPointer
) {
2667 SendMsg(2358, 0, (sptr_t
)docPointer
);
2670 // Set which document modification events are sent to the container.
2671 void wxStyledTextCtrl::SetModEventMask(int mask
)
2673 SendMsg(2359, mask
, 0);
2676 // Retrieve the column number which text should be kept within.
2677 int wxStyledTextCtrl::GetEdgeColumn() const
2679 return SendMsg(2360, 0, 0);
2682 // Set the column number of the edge.
2683 // If text goes past the edge then it is highlighted.
2684 void wxStyledTextCtrl::SetEdgeColumn(int column
)
2686 SendMsg(2361, column
, 0);
2689 // Retrieve the edge highlight mode.
2690 int wxStyledTextCtrl::GetEdgeMode() const
2692 return SendMsg(2362, 0, 0);
2695 // The edge may be displayed by a line (EDGE_LINE) or by highlighting text that
2696 // goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).
2697 void wxStyledTextCtrl::SetEdgeMode(int mode
)
2699 SendMsg(2363, mode
, 0);
2702 // Retrieve the colour used in edge indication.
2703 wxColour
wxStyledTextCtrl::GetEdgeColour() const
2705 long c
= SendMsg(2364, 0, 0);
2706 return wxColourFromLong(c
);
2709 // Change the colour used in edge indication.
2710 void wxStyledTextCtrl::SetEdgeColour(const wxColour
& edgeColour
)
2712 SendMsg(2365, wxColourAsLong(edgeColour
), 0);
2715 // Sets the current caret position to be the search anchor.
2716 void wxStyledTextCtrl::SearchAnchor()
2718 SendMsg(2366, 0, 0);
2721 // Find some text starting at the search anchor.
2722 // Does not ensure the selection is visible.
2723 int wxStyledTextCtrl::SearchNext(int flags
, const wxString
& text
)
2725 return SendMsg(2367, flags
, (sptr_t
)(const char*)wx2stc(text
));
2728 // Find some text starting at the search anchor and moving backwards.
2729 // Does not ensure the selection is visible.
2730 int wxStyledTextCtrl::SearchPrev(int flags
, const wxString
& text
)
2732 return SendMsg(2368, flags
, (sptr_t
)(const char*)wx2stc(text
));
2735 // Retrieves the number of lines completely visible.
2736 int wxStyledTextCtrl::LinesOnScreen() const
2738 return SendMsg(2370, 0, 0);
2741 // Set whether a pop up menu is displayed automatically when the user presses
2742 // the wrong mouse button.
2743 void wxStyledTextCtrl::UsePopUp(bool allowPopUp
)
2745 SendMsg(2371, allowPopUp
, 0);
2748 // Is the selection rectangular? The alternative is the more common stream selection.
2749 bool wxStyledTextCtrl::SelectionIsRectangle() const
2751 return SendMsg(2372, 0, 0) != 0;
2754 // Set the zoom level. This number of points is added to the size of all fonts.
2755 // It may be positive to magnify or negative to reduce.
2756 void wxStyledTextCtrl::SetZoom(int zoom
)
2758 SendMsg(2373, zoom
, 0);
2761 // Retrieve the zoom level.
2762 int wxStyledTextCtrl::GetZoom() const
2764 return SendMsg(2374, 0, 0);
2767 // Create a new document object.
2768 // Starts with reference count of 1 and not selected into editor.
2769 void* wxStyledTextCtrl::CreateDocument() {
2770 return (void*)SendMsg(2375);
2773 // Extend life of document.
2774 void wxStyledTextCtrl::AddRefDocument(void* docPointer
) {
2775 SendMsg(2376, 0, (sptr_t
)docPointer
);
2778 // Release a reference to the document, deleting document if it fades to black.
2779 void wxStyledTextCtrl::ReleaseDocument(void* docPointer
) {
2780 SendMsg(2377, 0, (sptr_t
)docPointer
);
2783 // Get which document modification events are sent to the container.
2784 int wxStyledTextCtrl::GetModEventMask() const
2786 return SendMsg(2378, 0, 0);
2789 // Change internal focus flag.
2790 void wxStyledTextCtrl::SetSTCFocus(bool focus
)
2792 SendMsg(2380, focus
, 0);
2795 // Get internal focus flag.
2796 bool wxStyledTextCtrl::GetSTCFocus() const
2798 return SendMsg(2381, 0, 0) != 0;
2801 // Change error status - 0 = OK.
2802 void wxStyledTextCtrl::SetStatus(int statusCode
)
2804 SendMsg(2382, statusCode
, 0);
2807 // Get error status.
2808 int wxStyledTextCtrl::GetStatus() const
2810 return SendMsg(2383, 0, 0);
2813 // Set whether the mouse is captured when its button is pressed.
2814 void wxStyledTextCtrl::SetMouseDownCaptures(bool captures
)
2816 SendMsg(2384, captures
, 0);
2819 // Get whether mouse gets captured.
2820 bool wxStyledTextCtrl::GetMouseDownCaptures() const
2822 return SendMsg(2385, 0, 0) != 0;
2825 // Sets the cursor to one of the SC_CURSOR* values.
2826 void wxStyledTextCtrl::SetSTCCursor(int cursorType
)
2828 SendMsg(2386, cursorType
, 0);
2832 int wxStyledTextCtrl::GetSTCCursor() const
2834 return SendMsg(2387, 0, 0);
2837 // Change the way control characters are displayed:
2838 // If symbol is < 32, keep the drawn way, else, use the given character.
2839 void wxStyledTextCtrl::SetControlCharSymbol(int symbol
)
2841 SendMsg(2388, symbol
, 0);
2844 // Get the way control characters are displayed.
2845 int wxStyledTextCtrl::GetControlCharSymbol() const
2847 return SendMsg(2389, 0, 0);
2850 // Move to the previous change in capitalisation.
2851 void wxStyledTextCtrl::WordPartLeft()
2853 SendMsg(2390, 0, 0);
2856 // Move to the previous change in capitalisation extending selection
2857 // to new caret position.
2858 void wxStyledTextCtrl::WordPartLeftExtend()
2860 SendMsg(2391, 0, 0);
2863 // Move to the change next in capitalisation.
2864 void wxStyledTextCtrl::WordPartRight()
2866 SendMsg(2392, 0, 0);
2869 // Move to the next change in capitalisation extending selection
2870 // to new caret position.
2871 void wxStyledTextCtrl::WordPartRightExtend()
2873 SendMsg(2393, 0, 0);
2876 // Set the way the display area is determined when a particular line
2877 // is to be moved to by Find, FindNext, GotoLine, etc.
2878 void wxStyledTextCtrl::SetVisiblePolicy(int visiblePolicy
, int visibleSlop
)
2880 SendMsg(2394, visiblePolicy
, visibleSlop
);
2883 // Delete back from the current position to the start of the line.
2884 void wxStyledTextCtrl::DelLineLeft()
2886 SendMsg(2395, 0, 0);
2889 // Delete forwards from the current position to the end of the line.
2890 void wxStyledTextCtrl::DelLineRight()
2892 SendMsg(2396, 0, 0);
2895 // Get and Set the xOffset (ie, horizontal scroll position).
2896 void wxStyledTextCtrl::SetXOffset(int newOffset
)
2898 SendMsg(2397, newOffset
, 0);
2900 int wxStyledTextCtrl::GetXOffset() const
2902 return SendMsg(2398, 0, 0);
2905 // Set the last x chosen value to be the caret x position.
2906 void wxStyledTextCtrl::ChooseCaretX()
2908 SendMsg(2399, 0, 0);
2911 // Set the way the caret is kept visible when going sideways.
2912 // The exclusion zone is given in pixels.
2913 void wxStyledTextCtrl::SetXCaretPolicy(int caretPolicy
, int caretSlop
)
2915 SendMsg(2402, caretPolicy
, caretSlop
);
2918 // Set the way the line the caret is on is kept visible.
2919 // The exclusion zone is given in lines.
2920 void wxStyledTextCtrl::SetYCaretPolicy(int caretPolicy
, int caretSlop
)
2922 SendMsg(2403, caretPolicy
, caretSlop
);
2925 // Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE).
2926 void wxStyledTextCtrl::SetPrintWrapMode(int mode
)
2928 SendMsg(2406, mode
, 0);
2931 // Is printing line wrapped?
2932 int wxStyledTextCtrl::GetPrintWrapMode() const
2934 return SendMsg(2407, 0, 0);
2937 // Set a fore colour for active hotspots.
2938 void wxStyledTextCtrl::SetHotspotActiveForeground(bool useSetting
, const wxColour
& fore
)
2940 SendMsg(2410, useSetting
, wxColourAsLong(fore
));
2943 // Get the fore colour for active hotspots.
2944 wxColour
wxStyledTextCtrl::GetHotspotActiveForeground() const
2946 long c
= SendMsg(2494, 0, 0);
2947 return wxColourFromLong(c
);
2950 // Set a back colour for active hotspots.
2951 void wxStyledTextCtrl::SetHotspotActiveBackground(bool useSetting
, const wxColour
& back
)
2953 SendMsg(2411, useSetting
, wxColourAsLong(back
));
2956 // Get the back colour for active hotspots.
2957 wxColour
wxStyledTextCtrl::GetHotspotActiveBackground() const
2959 long c
= SendMsg(2495, 0, 0);
2960 return wxColourFromLong(c
);
2963 // Enable / Disable underlining active hotspots.
2964 void wxStyledTextCtrl::SetHotspotActiveUnderline(bool underline
)
2966 SendMsg(2412, underline
, 0);
2969 // Get whether underlining for active hotspots.
2970 bool wxStyledTextCtrl::GetHotspotActiveUnderline() const
2972 return SendMsg(2496, 0, 0) != 0;
2975 // Limit hotspots to single line so hotspots on two lines don't merge.
2976 void wxStyledTextCtrl::SetHotspotSingleLine(bool singleLine
)
2978 SendMsg(2421, singleLine
, 0);
2981 // Get the HotspotSingleLine property
2982 bool wxStyledTextCtrl::GetHotspotSingleLine() const
2984 return SendMsg(2497, 0, 0) != 0;
2987 // Move caret between paragraphs (delimited by empty lines).
2988 void wxStyledTextCtrl::ParaDown()
2990 SendMsg(2413, 0, 0);
2992 void wxStyledTextCtrl::ParaDownExtend()
2994 SendMsg(2414, 0, 0);
2996 void wxStyledTextCtrl::ParaUp()
2998 SendMsg(2415, 0, 0);
3000 void wxStyledTextCtrl::ParaUpExtend()
3002 SendMsg(2416, 0, 0);
3005 // Given a valid document position, return the previous position taking code
3006 // page into account. Returns 0 if passed 0.
3007 int wxStyledTextCtrl::PositionBefore(int pos
)
3009 return SendMsg(2417, pos
, 0);
3012 // Given a valid document position, return the next position taking code
3013 // page into account. Maximum value returned is the last position in the document.
3014 int wxStyledTextCtrl::PositionAfter(int pos
)
3016 return SendMsg(2418, pos
, 0);
3019 // Copy a range of text to the clipboard. Positions are clipped into the document.
3020 void wxStyledTextCtrl::CopyRange(int start
, int end
)
3022 SendMsg(2419, start
, end
);
3025 // Copy argument text to the clipboard.
3026 void wxStyledTextCtrl::CopyText(int length
, const wxString
& text
)
3028 SendMsg(2420, length
, (sptr_t
)(const char*)wx2stc(text
));
3031 // Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE/SC_SEL_THIN) or
3032 // by lines (SC_SEL_LINES).
3033 void wxStyledTextCtrl::SetSelectionMode(int mode
)
3035 SendMsg(2422, mode
, 0);
3038 // Get the mode of the current selection.
3039 int wxStyledTextCtrl::GetSelectionMode() const
3041 return SendMsg(2423, 0, 0);
3044 // Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line).
3045 int wxStyledTextCtrl::GetLineSelStartPosition(int line
)
3047 return SendMsg(2424, line
, 0);
3050 // Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line).
3051 int wxStyledTextCtrl::GetLineSelEndPosition(int line
)
3053 return SendMsg(2425, line
, 0);
3056 // Move caret down one line, extending rectangular selection to new caret position.
3057 void wxStyledTextCtrl::LineDownRectExtend()
3059 SendMsg(2426, 0, 0);
3062 // Move caret up one line, extending rectangular selection to new caret position.
3063 void wxStyledTextCtrl::LineUpRectExtend()
3065 SendMsg(2427, 0, 0);
3068 // Move caret left one character, extending rectangular selection to new caret position.
3069 void wxStyledTextCtrl::CharLeftRectExtend()
3071 SendMsg(2428, 0, 0);
3074 // Move caret right one character, extending rectangular selection to new caret position.
3075 void wxStyledTextCtrl::CharRightRectExtend()
3077 SendMsg(2429, 0, 0);
3080 // Move caret to first position on line, extending rectangular selection to new caret position.
3081 void wxStyledTextCtrl::HomeRectExtend()
3083 SendMsg(2430, 0, 0);
3086 // Move caret to before first visible character on line.
3087 // If already there move to first character on line.
3088 // In either case, extend rectangular selection to new caret position.
3089 void wxStyledTextCtrl::VCHomeRectExtend()
3091 SendMsg(2431, 0, 0);
3094 // Move caret to last position on line, extending rectangular selection to new caret position.
3095 void wxStyledTextCtrl::LineEndRectExtend()
3097 SendMsg(2432, 0, 0);
3100 // Move caret one page up, extending rectangular selection to new caret position.
3101 void wxStyledTextCtrl::PageUpRectExtend()
3103 SendMsg(2433, 0, 0);
3106 // Move caret one page down, extending rectangular selection to new caret position.
3107 void wxStyledTextCtrl::PageDownRectExtend()
3109 SendMsg(2434, 0, 0);
3112 // Move caret to top of page, or one page up if already at top of page.
3113 void wxStyledTextCtrl::StutteredPageUp()
3115 SendMsg(2435, 0, 0);
3118 // Move caret to top of page, or one page up if already at top of page, extending selection to new caret position.
3119 void wxStyledTextCtrl::StutteredPageUpExtend()
3121 SendMsg(2436, 0, 0);
3124 // Move caret to bottom of page, or one page down if already at bottom of page.
3125 void wxStyledTextCtrl::StutteredPageDown()
3127 SendMsg(2437, 0, 0);
3130 // Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position.
3131 void wxStyledTextCtrl::StutteredPageDownExtend()
3133 SendMsg(2438, 0, 0);
3136 // Move caret left one word, position cursor at end of word.
3137 void wxStyledTextCtrl::WordLeftEnd()
3139 SendMsg(2439, 0, 0);
3142 // Move caret left one word, position cursor at end of word, extending selection to new caret position.
3143 void wxStyledTextCtrl::WordLeftEndExtend()
3145 SendMsg(2440, 0, 0);
3148 // Move caret right one word, position cursor at end of word.
3149 void wxStyledTextCtrl::WordRightEnd()
3151 SendMsg(2441, 0, 0);
3154 // Move caret right one word, position cursor at end of word, extending selection to new caret position.
3155 void wxStyledTextCtrl::WordRightEndExtend()
3157 SendMsg(2442, 0, 0);
3160 // Set the set of characters making up whitespace for when moving or selecting by word.
3161 // Should be called after SetWordChars.
3162 void wxStyledTextCtrl::SetWhitespaceChars(const wxString
& characters
)
3164 SendMsg(2443, 0, (sptr_t
)(const char*)wx2stc(characters
));
3167 // Get the set of characters making up whitespace for when moving or selecting by word.
3168 wxString
wxStyledTextCtrl::GetWhitespaceChars() const {
3170 int len
= SendMsg(msg
, 0, (sptr_t
)NULL
);
3171 if (!len
) return wxEmptyString
;
3173 wxMemoryBuffer
mbuf(len
+1);
3174 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3175 SendMsg(msg
, 0, (sptr_t
)buf
);
3176 mbuf
.UngetWriteBuf(len
);
3181 // Set the set of characters making up punctuation characters
3182 // Should be called after SetWordChars.
3183 void wxStyledTextCtrl::SetPunctuationChars(const wxString
& characters
)
3185 SendMsg(2648, 0, (sptr_t
)(const char*)wx2stc(characters
));
3188 // Get the set of characters making up punctuation characters
3189 wxString
wxStyledTextCtrl::GetPunctuationChars() const {
3191 int len
= SendMsg(msg
, 0, (sptr_t
)NULL
);
3192 if (!len
) return wxEmptyString
;
3194 wxMemoryBuffer
mbuf(len
+1);
3195 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3196 SendMsg(msg
, 0, (sptr_t
)buf
);
3197 mbuf
.UngetWriteBuf(len
);
3202 // Reset the set of characters for whitespace and word characters to the defaults.
3203 void wxStyledTextCtrl::SetCharsDefault()
3205 SendMsg(2444, 0, 0);
3208 // Get currently selected item position in the auto-completion list
3209 int wxStyledTextCtrl::AutoCompGetCurrent() const
3211 return SendMsg(2445, 0, 0);
3214 // Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference.
3215 void wxStyledTextCtrl::AutoCompSetCaseInsensitiveBehaviour(int behaviour
)
3217 SendMsg(2634, behaviour
, 0);
3220 // Get auto-completion case insensitive behaviour.
3221 int wxStyledTextCtrl::AutoCompGetCaseInsensitiveBehaviour() const
3223 return SendMsg(2635, 0, 0);
3226 // Enlarge the document to a particular size of text bytes.
3227 void wxStyledTextCtrl::Allocate(int bytes
)
3229 SendMsg(2446, bytes
, 0);
3232 // Find the position of a column on a line taking into account tabs and
3233 // multi-byte characters. If beyond end of line, return line end position.
3234 int wxStyledTextCtrl::FindColumn(int line
, int column
)
3236 return SendMsg(2456, line
, column
);
3239 // Can the caret preferred x position only be changed by explicit movement commands?
3240 int wxStyledTextCtrl::GetCaretSticky() const
3242 return SendMsg(2457, 0, 0);
3245 // Stop the caret preferred x position changing when the user types.
3246 void wxStyledTextCtrl::SetCaretSticky(int useCaretStickyBehaviour
)
3248 SendMsg(2458, useCaretStickyBehaviour
, 0);
3251 // Switch between sticky and non-sticky: meant to be bound to a key.
3252 void wxStyledTextCtrl::ToggleCaretSticky()
3254 SendMsg(2459, 0, 0);
3257 // Enable/Disable convert-on-paste for line endings
3258 void wxStyledTextCtrl::SetPasteConvertEndings(bool convert
)
3260 SendMsg(2467, convert
, 0);
3263 // Get convert-on-paste setting
3264 bool wxStyledTextCtrl::GetPasteConvertEndings() const
3266 return SendMsg(2468, 0, 0) != 0;
3269 // Duplicate the selection. If selection empty duplicate the line containing the caret.
3270 void wxStyledTextCtrl::SelectionDuplicate()
3272 SendMsg(2469, 0, 0);
3275 // Set background alpha of the caret line.
3276 void wxStyledTextCtrl::SetCaretLineBackAlpha(int alpha
)
3278 SendMsg(2470, alpha
, 0);
3281 // Get the background alpha of the caret line.
3282 int wxStyledTextCtrl::GetCaretLineBackAlpha() const
3284 return SendMsg(2471, 0, 0);
3287 // Set the style of the caret to be drawn.
3288 void wxStyledTextCtrl::SetCaretStyle(int caretStyle
)
3290 SendMsg(2512, caretStyle
, 0);
3293 // Returns the current style of the caret.
3294 int wxStyledTextCtrl::GetCaretStyle() const
3296 return SendMsg(2513, 0, 0);
3299 // Set the indicator used for IndicatorFillRange and IndicatorClearRange
3300 void wxStyledTextCtrl::SetIndicatorCurrent(int indicator
)
3302 SendMsg(2500, indicator
, 0);
3305 // Get the current indicator
3306 int wxStyledTextCtrl::GetIndicatorCurrent() const
3308 return SendMsg(2501, 0, 0);
3311 // Set the value used for IndicatorFillRange
3312 void wxStyledTextCtrl::SetIndicatorValue(int value
)
3314 SendMsg(2502, value
, 0);
3317 // Get the current indicator value
3318 int wxStyledTextCtrl::GetIndicatorValue() const
3320 return SendMsg(2503, 0, 0);
3323 // Turn a indicator on over a range.
3324 void wxStyledTextCtrl::IndicatorFillRange(int position
, int fillLength
)
3326 SendMsg(2504, position
, fillLength
);
3329 // Turn a indicator off over a range.
3330 void wxStyledTextCtrl::IndicatorClearRange(int position
, int clearLength
)
3332 SendMsg(2505, position
, clearLength
);
3335 // Are any indicators present at position?
3336 int wxStyledTextCtrl::IndicatorAllOnFor(int position
)
3338 return SendMsg(2506, position
, 0);
3341 // What value does a particular indicator have at at a position?
3342 int wxStyledTextCtrl::IndicatorValueAt(int indicator
, int position
)
3344 return SendMsg(2507, indicator
, position
);
3347 // Where does a particular indicator start?
3348 int wxStyledTextCtrl::IndicatorStart(int indicator
, int position
)
3350 return SendMsg(2508, indicator
, position
);
3353 // Where does a particular indicator end?
3354 int wxStyledTextCtrl::IndicatorEnd(int indicator
, int position
)
3356 return SendMsg(2509, indicator
, position
);
3359 // Set number of entries in position cache
3360 void wxStyledTextCtrl::SetPositionCacheSize(int size
)
3362 SendMsg(2514, size
, 0);
3365 // How many entries are allocated to the position cache?
3366 int wxStyledTextCtrl::GetPositionCacheSize() const
3368 return SendMsg(2515, 0, 0);
3371 // Copy the selection, if selection empty copy the line with the caret
3372 void wxStyledTextCtrl::CopyAllowLine()
3374 SendMsg(2519, 0, 0);
3377 // Compact the document buffer and return a read-only pointer to the
3378 // characters in the document.
3379 const char* wxStyledTextCtrl::GetCharacterPointer() const {
3380 return (const char*)SendMsg(2520, 0, 0);
3383 // Return a read-only pointer to a range of characters in the document.
3384 // May move the gap so that the range is contiguous, but will only move up
3385 // to rangeLength bytes.
3386 const char* wxStyledTextCtrl::GetRangePointer(int position
, int rangeLength
) const {
3387 return (const char*)SendMsg(2643, position
, rangeLength
);
3390 // Return a position which, to avoid performance costs, should not be within
3391 // the range of a call to GetRangePointer.
3392 int wxStyledTextCtrl::GetGapPosition() const
3394 return SendMsg(2644, 0, 0);
3397 // Always interpret keyboard input as Unicode
3398 void wxStyledTextCtrl::SetKeysUnicode(bool keysUnicode
)
3400 SendMsg(2521, keysUnicode
, 0);
3403 // Are keys always interpreted as Unicode?
3404 bool wxStyledTextCtrl::GetKeysUnicode() const
3406 return SendMsg(2522, 0, 0) != 0;
3409 // Set the alpha fill colour of the given indicator.
3410 void wxStyledTextCtrl::IndicatorSetAlpha(int indicator
, int alpha
)
3412 SendMsg(2523, indicator
, alpha
);
3415 // Get the alpha fill colour of the given indicator.
3416 int wxStyledTextCtrl::IndicatorGetAlpha(int indicator
) const
3418 return SendMsg(2524, indicator
, 0);
3421 // Set the alpha outline colour of the given indicator.
3422 void wxStyledTextCtrl::IndicatorSetOutlineAlpha(int indicator
, int alpha
)
3424 SendMsg(2558, indicator
, alpha
);
3427 // Get the alpha outline colour of the given indicator.
3428 int wxStyledTextCtrl::IndicatorGetOutlineAlpha(int indicator
) const
3430 return SendMsg(2559, indicator
, 0);
3433 // Set extra ascent for each line
3434 void wxStyledTextCtrl::SetExtraAscent(int extraAscent
)
3436 SendMsg(2525, extraAscent
, 0);
3439 // Get extra ascent for each line
3440 int wxStyledTextCtrl::GetExtraAscent() const
3442 return SendMsg(2526, 0, 0);
3445 // Set extra descent for each line
3446 void wxStyledTextCtrl::SetExtraDescent(int extraDescent
)
3448 SendMsg(2527, extraDescent
, 0);
3451 // Get extra descent for each line
3452 int wxStyledTextCtrl::GetExtraDescent() const
3454 return SendMsg(2528, 0, 0);
3457 // Which symbol was defined for markerNumber with MarkerDefine
3458 int wxStyledTextCtrl::GetMarkerSymbolDefined(int markerNumber
)
3460 return SendMsg(2529, markerNumber
, 0);
3463 // Set the text in the text margin for a line
3464 void wxStyledTextCtrl::MarginSetText(int line
, const wxString
& text
)
3466 SendMsg(2530, line
, (sptr_t
)(const char*)wx2stc(text
));
3469 // Get the text in the text margin for a line
3470 wxString
wxStyledTextCtrl::MarginGetText(int line
) const {
3472 long len
= SendMsg(msg
, line
, 0);
3474 wxMemoryBuffer
mbuf(len
+1);
3475 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3476 SendMsg(msg
, line
, (sptr_t
)buf
);
3477 mbuf
.UngetWriteBuf(len
);
3482 // Set the style number for the text margin for a line
3483 void wxStyledTextCtrl::MarginSetStyle(int line
, int style
)
3485 SendMsg(2532, line
, style
);
3488 // Get the style number for the text margin for a line
3489 int wxStyledTextCtrl::MarginGetStyle(int line
) const
3491 return SendMsg(2533, line
, 0);
3494 // Set the style in the text margin for a line
3495 void wxStyledTextCtrl::MarginSetStyles(int line
, const wxString
& styles
)
3497 SendMsg(2534, line
, (sptr_t
)(const char*)wx2stc(styles
));
3500 // Get the styles in the text margin for a line
3501 wxString
wxStyledTextCtrl::MarginGetStyles(int line
) const {
3503 long len
= SendMsg(msg
, line
, 0);
3505 wxMemoryBuffer
mbuf(len
+1);
3506 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3507 SendMsg(msg
, line
, (sptr_t
)buf
);
3508 mbuf
.UngetWriteBuf(len
);
3513 // Clear the margin text on all lines
3514 void wxStyledTextCtrl::MarginTextClearAll()
3516 SendMsg(2536, 0, 0);
3519 // Get the start of the range of style numbers used for margin text
3520 void wxStyledTextCtrl::MarginSetStyleOffset(int style
)
3522 SendMsg(2537, style
, 0);
3525 // Get the start of the range of style numbers used for margin text
3526 int wxStyledTextCtrl::MarginGetStyleOffset() const
3528 return SendMsg(2538, 0, 0);
3531 // Set the margin options.
3532 void wxStyledTextCtrl::SetMarginOptions(int marginOptions
)
3534 SendMsg(2539, marginOptions
, 0);
3537 // Get the margin options.
3538 int wxStyledTextCtrl::GetMarginOptions() const
3540 return SendMsg(2557, 0, 0);
3543 // Set the annotation text for a line
3544 void wxStyledTextCtrl::AnnotationSetText(int line
, const wxString
& text
)
3546 SendMsg(2540, line
, (sptr_t
)(const char*)wx2stc(text
));
3549 // Get the annotation text for a line
3550 wxString
wxStyledTextCtrl::AnnotationGetText(int line
) const {
3552 long len
= SendMsg(msg
, line
, 0);
3554 wxMemoryBuffer
mbuf(len
+1);
3555 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3556 SendMsg(msg
, line
, (sptr_t
)buf
);
3557 mbuf
.UngetWriteBuf(len
);
3562 // Set the style number for the annotations for a line
3563 void wxStyledTextCtrl::AnnotationSetStyle(int line
, int style
)
3565 SendMsg(2542, line
, style
);
3568 // Get the style number for the annotations for a line
3569 int wxStyledTextCtrl::AnnotationGetStyle(int line
) const
3571 return SendMsg(2543, line
, 0);
3574 // Set the annotation styles for a line
3575 void wxStyledTextCtrl::AnnotationSetStyles(int line
, const wxString
& styles
)
3577 SendMsg(2544, line
, (sptr_t
)(const char*)wx2stc(styles
));
3580 // Get the annotation styles for a line
3581 wxString
wxStyledTextCtrl::AnnotationGetStyles(int line
) const {
3583 long len
= SendMsg(msg
, line
, 0);
3585 wxMemoryBuffer
mbuf(len
+1);
3586 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3587 SendMsg(msg
, line
, (sptr_t
)buf
);
3588 mbuf
.UngetWriteBuf(len
);
3593 // Get the number of annotation lines for a line
3594 int wxStyledTextCtrl::AnnotationGetLines(int line
) const
3596 return SendMsg(2546, line
, 0);
3599 // Clear the annotations from all lines
3600 void wxStyledTextCtrl::AnnotationClearAll()
3602 SendMsg(2547, 0, 0);
3605 // Set the visibility for the annotations for a view
3606 void wxStyledTextCtrl::AnnotationSetVisible(int visible
)
3608 SendMsg(2548, visible
, 0);
3611 // Get the visibility for the annotations for a view
3612 int wxStyledTextCtrl::AnnotationGetVisible() const
3614 return SendMsg(2549, 0, 0);
3617 // Get the start of the range of style numbers used for annotations
3618 void wxStyledTextCtrl::AnnotationSetStyleOffset(int style
)
3620 SendMsg(2550, style
, 0);
3623 // Get the start of the range of style numbers used for annotations
3624 int wxStyledTextCtrl::AnnotationGetStyleOffset() const
3626 return SendMsg(2551, 0, 0);
3629 // Add a container action to the undo stack
3630 void wxStyledTextCtrl::AddUndoAction(int token
, int flags
)
3632 SendMsg(2560, token
, flags
);
3635 // Find the position of a character from a point within the window.
3636 int wxStyledTextCtrl::CharPositionFromPoint(int x
, int y
)
3638 return SendMsg(2561, x
, y
);
3641 // Find the position of a character from a point within the window.
3642 // Return INVALID_POSITION if not close to text.
3643 int wxStyledTextCtrl::CharPositionFromPointClose(int x
, int y
)
3645 return SendMsg(2562, x
, y
);
3648 // Set whether multiple selections can be made
3649 void wxStyledTextCtrl::SetMultipleSelection(bool multipleSelection
)
3651 SendMsg(2563, multipleSelection
, 0);
3654 // Whether multiple selections can be made
3655 bool wxStyledTextCtrl::GetMultipleSelection() const
3657 return SendMsg(2564, 0, 0) != 0;
3660 // Set whether typing can be performed into multiple selections
3661 void wxStyledTextCtrl::SetAdditionalSelectionTyping(bool additionalSelectionTyping
)
3663 SendMsg(2565, additionalSelectionTyping
, 0);
3666 // Whether typing can be performed into multiple selections
3667 bool wxStyledTextCtrl::GetAdditionalSelectionTyping() const
3669 return SendMsg(2566, 0, 0) != 0;
3672 // Set whether additional carets will blink
3673 void wxStyledTextCtrl::SetAdditionalCaretsBlink(bool additionalCaretsBlink
)
3675 SendMsg(2567, additionalCaretsBlink
, 0);
3678 // Whether additional carets will blink
3679 bool wxStyledTextCtrl::GetAdditionalCaretsBlink() const
3681 return SendMsg(2568, 0, 0) != 0;
3684 // Set whether additional carets are visible
3685 void wxStyledTextCtrl::SetAdditionalCaretsVisible(bool additionalCaretsBlink
)
3687 SendMsg(2608, additionalCaretsBlink
, 0);
3690 // Whether additional carets are visible
3691 bool wxStyledTextCtrl::GetAdditionalCaretsVisible() const
3693 return SendMsg(2609, 0, 0) != 0;
3696 // How many selections are there?
3697 int wxStyledTextCtrl::GetSelections() const
3699 return SendMsg(2570, 0, 0);
3702 // Clear selections to a single empty stream selection
3703 void wxStyledTextCtrl::ClearSelections()
3705 SendMsg(2571, 0, 0);
3709 int wxStyledTextCtrl::AddSelection(int caret
, int anchor
)
3711 return SendMsg(2573, caret
, anchor
);
3714 // Set the main selection
3715 void wxStyledTextCtrl::SetMainSelection(int selection
)
3717 SendMsg(2574, selection
, 0);
3720 // Which selection is the main selection
3721 int wxStyledTextCtrl::GetMainSelection() const
3723 return SendMsg(2575, 0, 0);
3725 void wxStyledTextCtrl::SetSelectionNCaret(int selection
, int pos
)
3727 SendMsg(2576, selection
, pos
);
3729 int wxStyledTextCtrl::GetSelectionNCaret(int selection
) const
3731 return SendMsg(2577, selection
, 0);
3733 void wxStyledTextCtrl::SetSelectionNAnchor(int selection
, int posAnchor
)
3735 SendMsg(2578, selection
, posAnchor
);
3737 int wxStyledTextCtrl::GetSelectionNAnchor(int selection
) const
3739 return SendMsg(2579, selection
, 0);
3741 void wxStyledTextCtrl::SetSelectionNCaretVirtualSpace(int selection
, int space
)
3743 SendMsg(2580, selection
, space
);
3745 int wxStyledTextCtrl::GetSelectionNCaretVirtualSpace(int selection
) const
3747 return SendMsg(2581, selection
, 0);
3749 void wxStyledTextCtrl::SetSelectionNAnchorVirtualSpace(int selection
, int space
)
3751 SendMsg(2582, selection
, space
);
3753 int wxStyledTextCtrl::GetSelectionNAnchorVirtualSpace(int selection
) const
3755 return SendMsg(2583, selection
, 0);
3758 // Sets the position that starts the selection - this becomes the anchor.
3759 void wxStyledTextCtrl::SetSelectionNStart(int selection
, int pos
)
3761 SendMsg(2584, selection
, pos
);
3764 // Returns the position at the start of the selection.
3765 int wxStyledTextCtrl::GetSelectionNStart(int selection
) const
3767 return SendMsg(2585, selection
, 0);
3770 // Sets the position that ends the selection - this becomes the currentPosition.
3771 void wxStyledTextCtrl::SetSelectionNEnd(int selection
, int pos
)
3773 SendMsg(2586, selection
, pos
);
3776 // Returns the position at the end of the selection.
3777 int wxStyledTextCtrl::GetSelectionNEnd(int selection
) const
3779 return SendMsg(2587, selection
, 0);
3781 void wxStyledTextCtrl::SetRectangularSelectionCaret(int pos
)
3783 SendMsg(2588, pos
, 0);
3785 int wxStyledTextCtrl::GetRectangularSelectionCaret() const
3787 return SendMsg(2589, 0, 0);
3789 void wxStyledTextCtrl::SetRectangularSelectionAnchor(int posAnchor
)
3791 SendMsg(2590, posAnchor
, 0);
3793 int wxStyledTextCtrl::GetRectangularSelectionAnchor() const
3795 return SendMsg(2591, 0, 0);
3797 void wxStyledTextCtrl::SetRectangularSelectionCaretVirtualSpace(int space
)
3799 SendMsg(2592, space
, 0);
3801 int wxStyledTextCtrl::GetRectangularSelectionCaretVirtualSpace() const
3803 return SendMsg(2593, 0, 0);
3805 void wxStyledTextCtrl::SetRectangularSelectionAnchorVirtualSpace(int space
)
3807 SendMsg(2594, space
, 0);
3809 int wxStyledTextCtrl::GetRectangularSelectionAnchorVirtualSpace() const
3811 return SendMsg(2595, 0, 0);
3813 void wxStyledTextCtrl::SetVirtualSpaceOptions(int virtualSpaceOptions
)
3815 SendMsg(2596, virtualSpaceOptions
, 0);
3817 int wxStyledTextCtrl::GetVirtualSpaceOptions() const
3819 return SendMsg(2597, 0, 0);
3822 // On GTK+, allow selecting the modifier key to use for mouse-based
3823 // rectangular selection. Often the window manager requires Alt+Mouse Drag
3824 // for moving windows.
3825 // Valid values are SCMOD_CTRL(default), SCMOD_ALT, or SCMOD_SUPER.
3826 void wxStyledTextCtrl::SetRectangularSelectionModifier(int modifier
)
3828 SendMsg(2598, modifier
, 0);
3831 // Get the modifier key used for rectangular selection.
3832 int wxStyledTextCtrl::GetRectangularSelectionModifier() const
3834 return SendMsg(2599, 0, 0);
3837 // Set the foreground colour of additional selections.
3838 // Must have previously called SetSelFore with non-zero first argument for this to have an effect.
3839 void wxStyledTextCtrl::SetAdditionalSelForeground(const wxColour
& fore
)
3841 SendMsg(2600, wxColourAsLong(fore
), 0);
3844 // Set the background colour of additional selections.
3845 // Must have previously called SetSelBack with non-zero first argument for this to have an effect.
3846 void wxStyledTextCtrl::SetAdditionalSelBackground(const wxColour
& back
)
3848 SendMsg(2601, wxColourAsLong(back
), 0);
3851 // Set the alpha of the selection.
3852 void wxStyledTextCtrl::SetAdditionalSelAlpha(int alpha
)
3854 SendMsg(2602, alpha
, 0);
3857 // Get the alpha of the selection.
3858 int wxStyledTextCtrl::GetAdditionalSelAlpha() const
3860 return SendMsg(2603, 0, 0);
3863 // Set the foreground colour of additional carets.
3864 void wxStyledTextCtrl::SetAdditionalCaretForeground(const wxColour
& fore
)
3866 SendMsg(2604, wxColourAsLong(fore
), 0);
3869 // Get the foreground colour of additional carets.
3870 wxColour
wxStyledTextCtrl::GetAdditionalCaretForeground() const
3872 long c
= SendMsg(2605, 0, 0);
3873 return wxColourFromLong(c
);
3876 // Set the main selection to the next selection.
3877 void wxStyledTextCtrl::RotateSelection()
3879 SendMsg(2606, 0, 0);
3882 // Swap that caret and anchor of the main selection.
3883 void wxStyledTextCtrl::SwapMainAnchorCaret()
3885 SendMsg(2607, 0, 0);
3888 // Indicate that the internal state of a lexer has changed over a range and therefore
3889 // there may be a need to redraw.
3890 int wxStyledTextCtrl::ChangeLexerState(int start
, int end
)
3892 return SendMsg(2617, start
, end
);
3895 // Find the next line at or after lineStart that is a contracted fold header line.
3896 // Return -1 when no more lines.
3897 int wxStyledTextCtrl::ContractedFoldNext(int lineStart
)
3899 return SendMsg(2618, lineStart
, 0);
3902 // Centre current line in window.
3903 void wxStyledTextCtrl::VerticalCentreCaret()
3905 SendMsg(2619, 0, 0);
3908 // Move the selected lines up one line, shifting the line above after the selection
3909 void wxStyledTextCtrl::MoveSelectedLinesUp()
3911 SendMsg(2620, 0, 0);
3914 // Move the selected lines down one line, shifting the line below before the selection
3915 void wxStyledTextCtrl::MoveSelectedLinesDown()
3917 SendMsg(2621, 0, 0);
3920 // Set the identifier reported as idFrom in notification messages.
3921 void wxStyledTextCtrl::SetIdentifier(int identifier
)
3923 SendMsg(2622, identifier
, 0);
3926 // Get the identifier.
3927 int wxStyledTextCtrl::GetIdentifier() const
3929 return SendMsg(2623, 0, 0);
3932 // Set the width for future RGBA image data.
3933 void wxStyledTextCtrl::RGBAImageSetWidth(int width
)
3935 SendMsg(2624, width
, 0);
3938 // Set the height for future RGBA image data.
3939 void wxStyledTextCtrl::RGBAImageSetHeight(int height
)
3941 SendMsg(2625, height
, 0);
3944 // Define a marker from RGBA data.
3945 // It has the width and height from RGBAImageSetWidth/Height
3946 void wxStyledTextCtrl::MarkerDefineRGBAImage(int markerNumber
, const unsigned char* pixels
) {
3947 SendMsg(2626, markerNumber
, (sptr_t
)pixels
);
3950 // Register an RGBA image for use in autocompletion lists.
3951 // It has the width and height from RGBAImageSetWidth/Height
3952 void wxStyledTextCtrl::RegisterRGBAImage(int type
, const unsigned char* pixels
) {
3953 SendMsg(2627, type
, (sptr_t
)pixels
);
3956 // Scroll to start of document.
3957 void wxStyledTextCtrl::ScrollToStart()
3959 SendMsg(2628, 0, 0);
3962 // Scroll to end of document.
3963 void wxStyledTextCtrl::ScrollToEnd()
3965 SendMsg(2629, 0, 0);
3968 // Set the technology used.
3969 void wxStyledTextCtrl::SetTechnology(int technology
)
3971 SendMsg(2630, technology
, 0);
3975 int wxStyledTextCtrl::GetTechnology() const
3977 return SendMsg(2631, 0, 0);
3980 // Create an ILoader*.
3981 void* wxStyledTextCtrl::CreateLoader(int bytes
) const {
3982 return (void*)(sptr_t
)SendMsg(2632, bytes
);
3985 // Start notifying the container of all key presses and commands.
3986 void wxStyledTextCtrl::StartRecord()
3988 SendMsg(3001, 0, 0);
3991 // Stop notifying the container of all key presses and commands.
3992 void wxStyledTextCtrl::StopRecord()
3994 SendMsg(3002, 0, 0);
3997 // Set the lexing language of the document.
3998 void wxStyledTextCtrl::SetLexer(int lexer
)
4000 SendMsg(4001, lexer
, 0);
4003 // Retrieve the lexing language of the document.
4004 int wxStyledTextCtrl::GetLexer() const
4006 return SendMsg(4002, 0, 0);
4009 // Colourise a segment of the document using the current lexing language.
4010 void wxStyledTextCtrl::Colourise(int start
, int end
)
4012 SendMsg(4003, start
, end
);
4015 // Set up a value that may be used by a lexer for some optional feature.
4016 void wxStyledTextCtrl::SetProperty(const wxString
& key
, const wxString
& value
)
4018 SendMsg(4004, (sptr_t
)(const char*)wx2stc(key
), (sptr_t
)(const char*)wx2stc(value
));
4021 // Set up the key words used by the lexer.
4022 void wxStyledTextCtrl::SetKeyWords(int keywordSet
, const wxString
& keyWords
)
4024 SendMsg(4005, keywordSet
, (sptr_t
)(const char*)wx2stc(keyWords
));
4027 // Set the lexing language of the document based on string name.
4028 void wxStyledTextCtrl::SetLexerLanguage(const wxString
& language
)
4030 SendMsg(4006, 0, (sptr_t
)(const char*)wx2stc(language
));
4033 // Retrieve a 'property' value previously set with SetProperty.
4034 wxString
wxStyledTextCtrl::GetProperty(const wxString
& key
) {
4035 int len
= SendMsg(SCI_GETPROPERTY
, (sptr_t
)(const char*)wx2stc(key
), 0);
4036 if (!len
) return wxEmptyString
;
4038 wxMemoryBuffer
mbuf(len
+1);
4039 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
4040 SendMsg(4008, (uptr_t
)(const char*)wx2stc(key
), (sptr_t
)buf
);
4041 mbuf
.UngetWriteBuf(len
);
4046 // Retrieve a 'property' value previously set with SetProperty,
4047 // with '$()' variable replacement on returned buffer.
4048 wxString
wxStyledTextCtrl::GetPropertyExpanded(const wxString
& key
) {
4049 int len
= SendMsg(SCI_GETPROPERTYEXPANDED
, (uptr_t
)(const char*)wx2stc(key
), 0);
4050 if (!len
) return wxEmptyString
;
4052 wxMemoryBuffer
mbuf(len
+1);
4053 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
4054 SendMsg(4009, (uptr_t
)(const char*)wx2stc(key
), (sptr_t
)buf
);
4055 mbuf
.UngetWriteBuf(len
);
4060 // Retrieve a 'property' value previously set with SetProperty,
4061 // interpreted as an int AFTER any '$()' variable replacement.
4062 int wxStyledTextCtrl::GetPropertyInt(const wxString
& key
) const
4064 return SendMsg(4010, (sptr_t
)(const char*)wx2stc(key
), 0);
4067 // Retrieve the number of bits the current lexer needs for styling.
4068 int wxStyledTextCtrl::GetStyleBitsNeeded() const
4070 return SendMsg(4011, 0, 0);
4073 // For private communication between an application and a known lexer.
4074 void* wxStyledTextCtrl::PrivateLexerCall(int operation
, void* pointer
) {
4075 return (void*)(sptr_t
)SendMsg(4013, operation
, (sptr_t
)pointer
);
4078 // Retrieve a '\n' separated list of properties understood by the current lexer.
4079 wxString
wxStyledTextCtrl::PropertyNames() const {
4081 int len
= SendMsg(msg
, 0, (sptr_t
)NULL
);
4082 if (!len
) return wxEmptyString
;
4084 wxMemoryBuffer
mbuf(len
+1);
4085 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
4086 SendMsg(msg
, 0, (sptr_t
)buf
);
4087 mbuf
.UngetWriteBuf(len
);
4092 // Retrieve the type of a property.
4093 int wxStyledTextCtrl::PropertyType(const wxString
& name
)
4095 return SendMsg(4015, (sptr_t
)(const char*)wx2stc(name
), 0);
4098 // Describe a property.
4099 wxString
wxStyledTextCtrl::DescribeProperty(const wxString
& name
) const {
4101 int len
= SendMsg(msg
, (sptr_t
)(const char*)wx2stc(name
), (sptr_t
)NULL
);
4102 if (!len
) return wxEmptyString
;
4104 wxMemoryBuffer
mbuf(len
+1);
4105 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
4106 SendMsg(msg
, (sptr_t
)(const char*)wx2stc(name
), (sptr_t
)buf
);
4107 mbuf
.UngetWriteBuf(len
);
4112 // Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer.
4113 wxString
wxStyledTextCtrl::DescribeKeyWordSets() const {
4115 int len
= SendMsg(msg
, 0, (sptr_t
)NULL
);
4116 if (!len
) return wxEmptyString
;
4118 wxMemoryBuffer
mbuf(len
+1);
4119 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
4120 SendMsg(msg
, 0, (sptr_t
)buf
);
4121 mbuf
.UngetWriteBuf(len
);
4127 //----------------------------------------------------------------------
4130 // Returns the line number of the line with the caret.
4131 int wxStyledTextCtrl::GetCurrentLine() {
4132 int line
= LineFromPosition(GetCurrentPos());
4137 // Extract style settings from a spec-string which is composed of one or
4138 // more of the following comma separated elements:
4140 // bold turns on bold
4141 // italic turns on italics
4142 // fore:[name or #RRGGBB] sets the foreground colour
4143 // back:[name or #RRGGBB] sets the background colour
4144 // face:[facename] sets the font face name to use
4145 // size:[num] sets the font size in points
4146 // eol turns on eol filling
4147 // underline turns on underlining
4149 void wxStyledTextCtrl::StyleSetSpec(int styleNum
, const wxString
& spec
) {
4151 wxStringTokenizer
tkz(spec
, wxT(","));
4152 while (tkz
.HasMoreTokens()) {
4153 wxString token
= tkz
.GetNextToken();
4155 wxString option
= token
.BeforeFirst(':');
4156 wxString val
= token
.AfterFirst(':');
4158 if (option
== wxT("bold"))
4159 StyleSetBold(styleNum
, true);
4161 else if (option
== wxT("italic"))
4162 StyleSetItalic(styleNum
, true);
4164 else if (option
== wxT("underline"))
4165 StyleSetUnderline(styleNum
, true);
4167 else if (option
== wxT("eol"))
4168 StyleSetEOLFilled(styleNum
, true);
4170 else if (option
== wxT("size")) {
4172 if (val
.ToLong(&points
))
4173 StyleSetSize(styleNum
, points
);
4176 else if (option
== wxT("face"))
4177 StyleSetFaceName(styleNum
, val
);
4179 else if (option
== wxT("fore"))
4180 StyleSetForeground(styleNum
, wxColourFromSpec(val
));
4182 else if (option
== wxT("back"))
4183 StyleSetBackground(styleNum
, wxColourFromSpec(val
));
4188 // Get the font of a style
4189 wxFont
wxStyledTextCtrl::StyleGetFont(int style
) {
4191 font
.SetPointSize(StyleGetSize(style
));
4192 font
.SetFaceName(StyleGetFaceName(style
));
4193 if( StyleGetBold(style
) )
4194 font
.SetWeight(wxFONTWEIGHT_BOLD
);
4196 font
.SetWeight(wxFONTWEIGHT_NORMAL
);
4198 if( StyleGetItalic(style
) )
4199 font
.SetStyle(wxFONTSTYLE_ITALIC
);
4201 font
.SetStyle(wxFONTSTYLE_NORMAL
);
4207 // Set style size, face, bold, italic, and underline attributes from
4208 // a wxFont's attributes.
4209 void wxStyledTextCtrl::StyleSetFont(int styleNum
, wxFont
& font
) {
4211 // Ensure that the native font is initialized
4213 GetTextExtent(wxT("X"), &x
, &y
, NULL
, NULL
, &font
);
4215 int size
= font
.GetPointSize();
4216 wxString faceName
= font
.GetFaceName();
4217 bool bold
= font
.GetWeight() == wxBOLD
;
4218 bool italic
= font
.GetStyle() != wxNORMAL
;
4219 bool under
= font
.GetUnderlined();
4220 wxFontEncoding encoding
= font
.GetEncoding();
4222 StyleSetFontAttr(styleNum
, size
, faceName
, bold
, italic
, under
, encoding
);
4225 // Set all font style attributes at once.
4226 void wxStyledTextCtrl::StyleSetFontAttr(int styleNum
, int size
,
4227 const wxString
& faceName
,
4228 bool bold
, bool italic
,
4230 wxFontEncoding encoding
) {
4231 StyleSetSize(styleNum
, size
);
4232 StyleSetFaceName(styleNum
, faceName
);
4233 StyleSetBold(styleNum
, bold
);
4234 StyleSetItalic(styleNum
, italic
);
4235 StyleSetUnderline(styleNum
, underline
);
4236 StyleSetFontEncoding(styleNum
, encoding
);
4240 // Set the character set of the font in a style. Converts the Scintilla
4241 // character set values to a wxFontEncoding.
4242 void wxStyledTextCtrl::StyleSetCharacterSet(int style
, int characterSet
)
4244 wxFontEncoding encoding
;
4246 // Translate the Scintilla characterSet to a wxFontEncoding
4247 switch (characterSet
) {
4249 case wxSTC_CHARSET_ANSI
:
4250 case wxSTC_CHARSET_DEFAULT
:
4251 encoding
= wxFONTENCODING_DEFAULT
;
4254 case wxSTC_CHARSET_BALTIC
:
4255 encoding
= wxFONTENCODING_ISO8859_13
;
4258 case wxSTC_CHARSET_CHINESEBIG5
:
4259 encoding
= wxFONTENCODING_CP950
;
4262 case wxSTC_CHARSET_EASTEUROPE
:
4263 encoding
= wxFONTENCODING_ISO8859_2
;
4266 case wxSTC_CHARSET_GB2312
:
4267 encoding
= wxFONTENCODING_CP936
;
4270 case wxSTC_CHARSET_GREEK
:
4271 encoding
= wxFONTENCODING_ISO8859_7
;
4274 case wxSTC_CHARSET_HANGUL
:
4275 encoding
= wxFONTENCODING_CP949
;
4278 case wxSTC_CHARSET_MAC
:
4279 encoding
= wxFONTENCODING_DEFAULT
;
4282 case wxSTC_CHARSET_OEM
:
4283 encoding
= wxFONTENCODING_DEFAULT
;
4286 case wxSTC_CHARSET_RUSSIAN
:
4287 encoding
= wxFONTENCODING_KOI8
;
4290 case wxSTC_CHARSET_SHIFTJIS
:
4291 encoding
= wxFONTENCODING_CP932
;
4294 case wxSTC_CHARSET_SYMBOL
:
4295 encoding
= wxFONTENCODING_DEFAULT
;
4298 case wxSTC_CHARSET_TURKISH
:
4299 encoding
= wxFONTENCODING_ISO8859_9
;
4302 case wxSTC_CHARSET_JOHAB
:
4303 encoding
= wxFONTENCODING_DEFAULT
;
4306 case wxSTC_CHARSET_HEBREW
:
4307 encoding
= wxFONTENCODING_ISO8859_8
;
4310 case wxSTC_CHARSET_ARABIC
:
4311 encoding
= wxFONTENCODING_ISO8859_6
;
4314 case wxSTC_CHARSET_VIETNAMESE
:
4315 encoding
= wxFONTENCODING_DEFAULT
;
4318 case wxSTC_CHARSET_THAI
:
4319 encoding
= wxFONTENCODING_ISO8859_11
;
4322 case wxSTC_CHARSET_CYRILLIC
:
4323 encoding
= wxFONTENCODING_ISO8859_5
;
4326 case wxSTC_CHARSET_8859_15
:
4327 encoding
= wxFONTENCODING_ISO8859_15
;;
4331 // We just have Scintilla track the wxFontEncoding for us. It gets used
4332 // in Font::Create in PlatWX.cpp. We add one to the value so that the
4333 // effective wxFONENCODING_DEFAULT == SC_SHARSET_DEFAULT and so when
4334 // Scintilla internally uses SC_CHARSET_DEFAULT we will translate it back
4335 // to wxFONENCODING_DEFAULT in Font::Create.
4336 SendMsg(SCI_STYLESETCHARACTERSET
, style
, encoding
+1);
4340 // Set the font encoding to be used by a style.
4341 void wxStyledTextCtrl::StyleSetFontEncoding(int style
, wxFontEncoding encoding
)
4343 SendMsg(SCI_STYLESETCHARACTERSET
, style
, encoding
+1);
4347 // Perform one of the operations defined by the wxSTC_CMD_* constants.
4348 void wxStyledTextCtrl::CmdKeyExecute(int cmd
) {
4353 // Set the left and right margin in the edit area, measured in pixels.
4354 void wxStyledTextCtrl::SetMargins(int left
, int right
) {
4355 SetMarginLeft(left
);
4356 SetMarginRight(right
);
4360 // Retrieve the point in the window where a position is displayed.
4361 wxPoint
wxStyledTextCtrl::PointFromPosition(int pos
) {
4362 int x
= SendMsg(SCI_POINTXFROMPOSITION
, 0, pos
);
4363 int y
= SendMsg(SCI_POINTYFROMPOSITION
, 0, pos
);
4364 return wxPoint(x
, y
);
4367 // Scroll enough to make the given line visible
4368 void wxStyledTextCtrl::ScrollToLine(int line
) {
4369 m_swx
->DoScrollToLine(line
);
4373 // Scroll enough to make the given column visible
4374 void wxStyledTextCtrl::ScrollToColumn(int column
) {
4375 m_swx
->DoScrollToColumn(column
);
4379 void wxStyledTextCtrl::DoSetValue(const wxString
& value
, int flags
)
4381 if ( flags
& SetValue_SelectionOnly
)
4382 ReplaceSelection(value
);
4386 // We don't send wxEVT_COMMAND_TEXT_UPDATED anyhow, so ignore the
4387 // SetValue_SendEvent bit of the flags
4391 wxStyledTextCtrl::DoSaveFile(const wxString
& filename
, int WXUNUSED(fileType
))
4393 #if wxUSE_FFILE || wxUSE_FILE
4396 // Take care to use "b" to ensure that possibly non-native EOLs in the file
4397 // contents are not mangled when saving it.
4398 wxFFile
file(filename
, wxS("wb"));
4400 wxFile
file(filename
, wxFile::write
);
4403 if ( file
.IsOpened() && file
.Write(GetValue(), *wxConvCurrent
) )
4410 #endif // !wxUSE_FFILE && !wxUSE_FILE
4416 wxStyledTextCtrl::DoLoadFile(const wxString
& filename
, int WXUNUSED(fileType
))
4418 #if wxUSE_FFILE || wxUSE_FILE
4421 // As above, we want to read the real EOLs from the file, e.g. without
4422 // translating them to just LFs under Windows, so that the original CR LF
4423 // are preserved when it's written back.
4424 wxFFile
file(filename
, wxS("rb"));
4426 wxFile
file(filename
);
4429 if ( file
.IsOpened() )
4432 if ( file
.ReadAll(&text
, *wxConvCurrent
) )
4434 // Detect the EOL: we use just the first line because there is not
4435 // much we can do if the file uses inconsistent EOLs anyhow, we'd
4436 // need to ask the user about the one we should really use and we
4437 // don't currently provide a way to do it.
4439 // We also only check for Unix and DOS EOLs but not classic Mac
4440 // CR-only one as it's obsolete by now.
4441 const wxString::size_type posLF
= text
.find('\n');
4442 if ( posLF
!= wxString::npos
)
4444 // Set EOL mode to ensure that the new lines inserted into the
4445 // text use the same EOLs as the existing ones.
4446 if ( posLF
> 0 && text
[posLF
- 1] == '\r' )
4447 SetEOLMode(wxSTC_EOL_CRLF
);
4449 SetEOLMode(wxSTC_EOL_LF
);
4451 //else: Use the default EOL for the current platform.
4460 #endif // !wxUSE_FFILE && !wxUSE_FILE
4465 // If we don't derive from wxTextAreaBase, we need to implement these methods
4466 // ourselves, otherwise we already inherit them.
4469 bool wxStyledTextCtrl::SaveFile(const wxString
& filename
)
4471 if ( filename
.empty() )
4474 return DoSaveFile(filename
, wxTEXT_TYPE_ANY
);
4477 bool wxStyledTextCtrl::LoadFile(const wxString
& filename
)
4479 if ( filename
.empty() )
4482 return DoLoadFile(filename
, wxTEXT_TYPE_ANY
);
4485 #endif // !wxUSE_TEXTCTRL
4487 #if wxUSE_DRAG_AND_DROP
4488 wxDragResult
wxStyledTextCtrl::DoDragOver(wxCoord x
, wxCoord y
, wxDragResult def
) {
4489 return m_swx
->DoDragOver(x
, y
, def
);
4493 bool wxStyledTextCtrl::DoDropText(long x
, long y
, const wxString
& data
) {
4494 return m_swx
->DoDropText(x
, y
, data
);
4499 void wxStyledTextCtrl::SetUseAntiAliasing(bool useAA
) {
4500 m_swx
->SetUseAntiAliasing(useAA
);
4503 bool wxStyledTextCtrl::GetUseAntiAliasing() {
4504 return m_swx
->GetUseAntiAliasing();
4507 void wxStyledTextCtrl::AnnotationClearLine(int line
) {
4508 SendMsg(SCI_ANNOTATIONSETTEXT
, line
, NULL
);
4514 void wxStyledTextCtrl::AddTextRaw(const char* text
, int length
)
4517 length
= strlen(text
);
4518 SendMsg(SCI_ADDTEXT
, length
, (sptr_t
)text
);
4521 void wxStyledTextCtrl::InsertTextRaw(int pos
, const char* text
)
4523 SendMsg(SCI_INSERTTEXT
, pos
, (sptr_t
)text
);
4526 wxCharBuffer
wxStyledTextCtrl::GetCurLineRaw(int* linePos
)
4528 int len
= LineLength(GetCurrentLine());
4530 if (linePos
) *linePos
= 0;
4535 wxCharBuffer
buf(len
);
4536 int pos
= SendMsg(SCI_GETCURLINE
, len
, (sptr_t
)buf
.data());
4537 if (linePos
) *linePos
= pos
;
4541 wxCharBuffer
wxStyledTextCtrl::GetLineRaw(int line
)
4543 int len
= LineLength(line
);
4549 wxCharBuffer
buf(len
);
4550 SendMsg(SCI_GETLINE
, line
, (sptr_t
)buf
.data());
4554 wxCharBuffer
wxStyledTextCtrl::GetSelectedTextRaw()
4556 // Calculate the length needed first.
4557 const int len
= SendMsg(SCI_GETSELTEXT
, 0, (sptr_t
)0);
4559 // And then really get the data.
4560 wxCharBuffer
buf(len
);
4561 SendMsg(SCI_GETSELTEXT
, 0, (sptr_t
)buf
.data());
4565 wxCharBuffer
wxStyledTextCtrl::GetTextRangeRaw(int startPos
, int endPos
)
4567 if (endPos
< startPos
) {
4568 int temp
= startPos
;
4572 int len
= endPos
- startPos
;
4578 wxCharBuffer
buf(len
);
4580 tr
.lpstrText
= buf
.data();
4581 tr
.chrg
.cpMin
= startPos
;
4582 tr
.chrg
.cpMax
= endPos
;
4583 SendMsg(SCI_GETTEXTRANGE
, 0, (sptr_t
)&tr
);
4587 void wxStyledTextCtrl::SetTextRaw(const char* text
)
4589 SendMsg(SCI_SETTEXT
, 0, (sptr_t
)text
);
4592 wxCharBuffer
wxStyledTextCtrl::GetTextRaw()
4594 int len
= GetTextLength();
4595 wxCharBuffer
buf(len
); // adds 1 for NUL automatically
4596 SendMsg(SCI_GETTEXT
, len
+ 1, (sptr_t
)buf
.data());
4600 void wxStyledTextCtrl::AppendTextRaw(const char* text
, int length
)
4603 length
= strlen(text
);
4604 SendMsg(SCI_APPENDTEXT
, length
, (sptr_t
)text
);
4611 //----------------------------------------------------------------------
4614 void wxStyledTextCtrl::OnPaint(wxPaintEvent
& WXUNUSED(evt
)) {
4616 m_swx
->DoPaint(&dc
, GetUpdateRegion().GetBox());
4619 void wxStyledTextCtrl::OnScrollWin(wxScrollWinEvent
& evt
) {
4620 if (evt
.GetOrientation() == wxHORIZONTAL
)
4621 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
4623 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
4626 void wxStyledTextCtrl::OnScroll(wxScrollEvent
& evt
) {
4627 wxScrollBar
* sb
= wxDynamicCast(evt
.GetEventObject(), wxScrollBar
);
4629 if (sb
->IsVertical())
4630 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
4632 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
4636 void wxStyledTextCtrl::OnSize(wxSizeEvent
& WXUNUSED(evt
)) {
4638 wxSize sz
= GetClientSize();
4639 m_swx
->DoSize(sz
.x
, sz
.y
);
4643 void wxStyledTextCtrl::OnMouseLeftDown(wxMouseEvent
& evt
) {
4645 wxPoint pt
= evt
.GetPosition();
4646 m_swx
->DoLeftButtonDown(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
4647 evt
.ShiftDown(), evt
.ControlDown(), evt
.AltDown());
4650 void wxStyledTextCtrl::OnMouseMove(wxMouseEvent
& evt
) {
4651 wxPoint pt
= evt
.GetPosition();
4652 m_swx
->DoLeftButtonMove(Point(pt
.x
, pt
.y
));
4655 void wxStyledTextCtrl::OnMouseLeftUp(wxMouseEvent
& evt
) {
4656 wxPoint pt
= evt
.GetPosition();
4657 m_swx
->DoLeftButtonUp(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
4662 void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent
& evt
) {
4663 wxPoint pt
= evt
.GetPosition();
4664 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
4668 void wxStyledTextCtrl::OnMouseMiddleUp(wxMouseEvent
& evt
) {
4669 wxPoint pt
= evt
.GetPosition();
4670 m_swx
->DoMiddleButtonUp(Point(pt
.x
, pt
.y
));
4673 void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent
& evt
) {
4674 wxPoint pt
= evt
.GetPosition();
4675 ScreenToClient(&pt
.x
, &pt
.y
);
4677 Show context menu at event point if it's within the window,
4678 or at caret location if not
4680 wxHitTest ht
= this->HitTest(pt
);
4681 if (ht
!= wxHT_WINDOW_INSIDE
) {
4682 pt
= this->PointFromPosition(this->GetCurrentPos());
4684 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
4688 void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent
& evt
)
4690 m_swx
->DoMouseWheel(evt
.GetWheelRotation(),
4691 evt
.GetWheelDelta(),
4692 evt
.GetLinesPerAction(),
4694 evt
.IsPageScroll());
4698 void wxStyledTextCtrl::OnChar(wxKeyEvent
& evt
) {
4699 // On (some?) non-US PC keyboards the AltGr key is required to enter some
4700 // common characters. It comes to us as both Alt and Ctrl down so we need
4701 // to let the char through in that case, otherwise if only ctrl or only
4702 // alt let's skip it.
4703 bool ctrl
= evt
.ControlDown();
4705 // On the Mac the Alt key is just a modifier key (like Shift) so we need
4706 // to allow the char events to be processed when Alt is pressed.
4707 // TODO: Should we check MetaDown instead in this case?
4710 bool alt
= evt
.AltDown();
4712 bool skip
= ((ctrl
|| alt
) && ! (ctrl
&& alt
));
4715 // apparently if we don't do this, Unicode keys pressed after non-char
4716 // ASCII ones (e.g. Enter, Tab) are not taken into account (patch 1615989)
4717 if (m_lastKeyDownConsumed
&& evt
.GetUnicodeKey() > 255)
4718 m_lastKeyDownConsumed
= false;
4721 if (!m_lastKeyDownConsumed
&& !skip
) {
4723 int key
= evt
.GetUnicodeKey();
4726 // if the unicode key code is not really a unicode character (it may
4727 // be a function key or etc., the platforms appear to always give us a
4728 // small value in this case) then fallback to the ascii key code but
4729 // don't do anything for function keys or etc.
4731 key
= evt
.GetKeyCode();
4732 keyOk
= (key
<= 127);
4735 m_swx
->DoAddChar(key
);
4739 int key
= evt
.GetKeyCode();
4740 if (key
<= WXK_START
|| key
> WXK_COMMAND
) {
4741 m_swx
->DoAddChar(key
);
4751 void wxStyledTextCtrl::OnKeyDown(wxKeyEvent
& evt
) {
4752 int processed
= m_swx
->DoKeyDown(evt
, &m_lastKeyDownConsumed
);
4753 if (!processed
&& !m_lastKeyDownConsumed
)
4758 void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent
& evt
) {
4759 m_swx
->DoLoseFocus();
4764 void wxStyledTextCtrl::OnGainFocus(wxFocusEvent
& evt
) {
4765 m_swx
->DoGainFocus();
4770 void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent
& WXUNUSED(evt
)) {
4771 m_swx
->DoSysColourChange();
4775 void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent
& WXUNUSED(evt
)) {
4776 // do nothing to help avoid flashing
4781 void wxStyledTextCtrl::OnMenu(wxCommandEvent
& evt
) {
4782 m_swx
->DoCommand(evt
.GetId());
4786 void wxStyledTextCtrl::OnListBox(wxCommandEvent
& WXUNUSED(evt
)) {
4787 m_swx
->DoOnListBox();
4791 void wxStyledTextCtrl::OnIdle(wxIdleEvent
& evt
) {
4792 m_swx
->DoOnIdle(evt
);
4796 wxSize
wxStyledTextCtrl::DoGetBestSize() const
4798 // What would be the best size for a wxSTC?
4799 // Just give a reasonable minimum until something else can be figured out.
4800 return wxSize(200,100);
4804 //----------------------------------------------------------------------
4805 // Turn notifications from Scintilla into events
4808 void wxStyledTextCtrl::NotifyChange() {
4809 wxStyledTextEvent
evt(wxEVT_STC_CHANGE
, GetId());
4810 evt
.SetEventObject(this);
4811 GetEventHandler()->ProcessEvent(evt
);
4815 static void SetEventText(wxStyledTextEvent
& evt
, const char* text
,
4819 evt
.SetText(stc2wx(text
, length
));
4823 void wxStyledTextCtrl::NotifyParent(SCNotification
* _scn
) {
4824 SCNotification
& scn
= *_scn
;
4825 wxStyledTextEvent
evt(0, GetId());
4827 evt
.SetEventObject(this);
4828 evt
.SetPosition(scn
.position
);
4830 evt
.SetModifiers(scn
.modifiers
);
4832 switch (scn
.nmhdr
.code
) {
4833 case SCN_STYLENEEDED
:
4834 evt
.SetEventType(wxEVT_STC_STYLENEEDED
);
4838 evt
.SetEventType(wxEVT_STC_CHARADDED
);
4841 case SCN_SAVEPOINTREACHED
:
4842 evt
.SetEventType(wxEVT_STC_SAVEPOINTREACHED
);
4845 case SCN_SAVEPOINTLEFT
:
4846 evt
.SetEventType(wxEVT_STC_SAVEPOINTLEFT
);
4849 case SCN_MODIFYATTEMPTRO
:
4850 evt
.SetEventType(wxEVT_STC_ROMODIFYATTEMPT
);
4854 evt
.SetEventType(wxEVT_STC_KEY
);
4857 case SCN_DOUBLECLICK
:
4858 evt
.SetEventType(wxEVT_STC_DOUBLECLICK
);
4859 evt
.SetLine(scn
.line
);
4863 evt
.SetEventType(wxEVT_STC_UPDATEUI
);
4864 evt
.SetUpdated(scn
.updated
);
4868 evt
.SetEventType(wxEVT_STC_MODIFIED
);
4869 evt
.SetModificationType(scn
.modificationType
);
4870 SetEventText(evt
, scn
.text
, scn
.length
);
4871 evt
.SetLength(scn
.length
);
4872 evt
.SetLinesAdded(scn
.linesAdded
);
4873 evt
.SetLine(scn
.line
);
4874 evt
.SetFoldLevelNow(scn
.foldLevelNow
);
4875 evt
.SetFoldLevelPrev(scn
.foldLevelPrev
);
4876 evt
.SetToken(scn
.token
);
4877 evt
.SetAnnotationLinesAdded(scn
.annotationLinesAdded
);
4880 case SCN_MACRORECORD
:
4881 evt
.SetEventType(wxEVT_STC_MACRORECORD
);
4882 evt
.SetMessage(scn
.message
);
4883 evt
.SetWParam(scn
.wParam
);
4884 evt
.SetLParam(scn
.lParam
);
4887 case SCN_MARGINCLICK
:
4888 evt
.SetEventType(wxEVT_STC_MARGINCLICK
);
4889 evt
.SetMargin(scn
.margin
);
4893 evt
.SetEventType(wxEVT_STC_NEEDSHOWN
);
4894 evt
.SetLength(scn
.length
);
4898 evt
.SetEventType(wxEVT_STC_PAINTED
);
4901 case SCN_AUTOCSELECTION
:
4902 evt
.SetEventType(wxEVT_STC_AUTOCOMP_SELECTION
);
4903 evt
.SetListType(scn
.listType
);
4904 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
4905 evt
.SetPosition(scn
.lParam
);
4908 case SCN_USERLISTSELECTION
:
4909 evt
.SetEventType(wxEVT_STC_USERLISTSELECTION
);
4910 evt
.SetListType(scn
.listType
);
4911 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
4912 evt
.SetPosition(scn
.lParam
);
4915 case SCN_URIDROPPED
:
4916 evt
.SetEventType(wxEVT_STC_URIDROPPED
);
4917 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
4920 case SCN_DWELLSTART
:
4921 evt
.SetEventType(wxEVT_STC_DWELLSTART
);
4927 evt
.SetEventType(wxEVT_STC_DWELLEND
);
4933 evt
.SetEventType(wxEVT_STC_ZOOM
);
4936 case SCN_HOTSPOTCLICK
:
4937 evt
.SetEventType(wxEVT_STC_HOTSPOT_CLICK
);
4940 case SCN_HOTSPOTDOUBLECLICK
:
4941 evt
.SetEventType(wxEVT_STC_HOTSPOT_DCLICK
);
4944 case SCN_CALLTIPCLICK
:
4945 evt
.SetEventType(wxEVT_STC_CALLTIP_CLICK
);
4948 case SCN_INDICATORCLICK
:
4949 evt
.SetEventType(wxEVT_STC_INDICATOR_CLICK
);
4952 case SCN_INDICATORRELEASE
:
4953 evt
.SetEventType(wxEVT_STC_INDICATOR_RELEASE
);
4956 case SCN_AUTOCCANCELLED
:
4957 evt
.SetEventType(wxEVT_STC_AUTOCOMP_CANCELLED
);
4960 case SCN_AUTOCCHARDELETED
:
4961 evt
.SetEventType(wxEVT_STC_AUTOCOMP_CHAR_DELETED
);
4964 case SCN_HOTSPOTRELEASECLICK
:
4965 evt
.SetEventType(wxEVT_STC_HOTSPOT_RELEASE_CLICK
);
4972 GetEventHandler()->ProcessEvent(evt
);
4976 //----------------------------------------------------------------------
4977 //----------------------------------------------------------------------
4978 //----------------------------------------------------------------------
4980 wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType
, int id
)
4981 : wxCommandEvent(commandType
, id
)
4986 m_modificationType
= 0;
4991 m_foldLevelPrev
= 0;
5000 m_annotationLinesAdded
= 0;
5003 #if wxUSE_DRAG_AND_DROP
5004 m_dragFlags
= wxDrag_CopyOnly
;
5005 m_dragResult
= wxDragNone
;
5009 bool wxStyledTextEvent::GetShift() const { return (m_modifiers
& SCI_SHIFT
) != 0; }
5010 bool wxStyledTextEvent::GetControl() const { return (m_modifiers
& SCI_CTRL
) != 0; }
5011 bool wxStyledTextEvent::GetAlt() const { return (m_modifiers
& SCI_ALT
) != 0; }
5014 wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent
& event
):
5015 wxCommandEvent(event
)
5017 m_position
= event
.m_position
;
5018 m_key
= event
.m_key
;
5019 m_modifiers
= event
.m_modifiers
;
5020 m_modificationType
= event
.m_modificationType
;
5021 m_text
= event
.m_text
;
5022 m_length
= event
.m_length
;
5023 m_linesAdded
= event
.m_linesAdded
;
5024 m_line
= event
.m_line
;
5025 m_foldLevelNow
= event
.m_foldLevelNow
;
5026 m_foldLevelPrev
= event
.m_foldLevelPrev
;
5028 m_margin
= event
.m_margin
;
5030 m_message
= event
.m_message
;
5031 m_wParam
= event
.m_wParam
;
5032 m_lParam
= event
.m_lParam
;
5034 m_listType
= event
.m_listType
;
5038 m_token
= event
.m_token
;
5039 m_annotationLinesAdded
= event
.m_annotationLinesAdded
;
5040 m_updated
= event
.m_updated
;
5042 #if wxUSE_DRAG_AND_DROP
5043 m_dragText
= event
.m_dragText
;
5044 m_dragFlags
= event
.m_dragFlags
;
5045 m_dragResult
= event
.m_dragResult
;
5049 //----------------------------------------------------------------------
5050 //----------------------------------------------------------------------
5052 /*static*/ wxVersionInfo
wxStyledTextCtrl::GetLibraryVersionInfo()
5054 return wxVersionInfo("Scintilla", 3, 21, 0, "Scintilla 3.21");