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
13 // Copyright: (c) 2000 by Total Control Software
14 // Licence: wxWindows licence
15 /////////////////////////////////////////////////////////////////////////////
18 IMPORTANT: src/stc/stc.cpp is generated by src/stc/gen_iface.py from
19 src/stc/stc.cpp.in, don't edit stc.cpp file as your changes will be
20 lost after the next regeneration, edit stc.cpp.in and rerun the
21 gen_iface.py script instead!
23 Parts of this file generated by the script are found in between
24 the special "{{{" and "}}}" markers, the rest of it is copied
25 verbatim from src.h.in.
28 // For compilers that support precompilation, includes "wx.h".
29 #include "wx/wxprec.h"
37 #include "wx/stc/stc.h"
38 #include "wx/stc/private.h"
46 #include "wx/tokenzr.h"
47 #include "wx/mstream.h"
56 #include "wx/dcbuffer.h"
59 #include "ScintillaWX.h"
61 //----------------------------------------------------------------------
63 const char wxSTCNameStr
[] = "stcwindow";
69 #define MAKELONG(a, b) ((a) | ((b) << 16))
72 static long wxColourAsLong(const wxColour
& co
) {
73 return (((long)co
.Blue() << 16) |
74 ((long)co
.Green() << 8) |
78 static wxColour
wxColourFromLong(long c
) {
80 clr
.Set((unsigned char)(c
& 0xff),
81 (unsigned char)((c
>> 8) & 0xff),
82 (unsigned char)((c
>> 16) & 0xff));
87 static wxColour
wxColourFromSpec(const wxString
& spec
) {
88 // spec should be a colour name or "#RRGGBB"
89 if (spec
.GetChar(0) == wxT('#')) {
91 long red
, green
, blue
;
92 red
= green
= blue
= 0;
93 spec
.Mid(1,2).ToLong(&red
, 16);
94 spec
.Mid(3,2).ToLong(&green
, 16);
95 spec
.Mid(5,2).ToLong(&blue
, 16);
96 return wxColour((unsigned char)red
,
101 return wxColour(spec
);
104 //----------------------------------------------------------------------
106 wxDEFINE_EVENT( wxEVT_STC_CHANGE
, wxStyledTextEvent
);
107 wxDEFINE_EVENT( wxEVT_STC_STYLENEEDED
, wxStyledTextEvent
);
108 wxDEFINE_EVENT( wxEVT_STC_CHARADDED
, wxStyledTextEvent
);
109 wxDEFINE_EVENT( wxEVT_STC_SAVEPOINTREACHED
, wxStyledTextEvent
);
110 wxDEFINE_EVENT( wxEVT_STC_SAVEPOINTLEFT
, wxStyledTextEvent
);
111 wxDEFINE_EVENT( wxEVT_STC_ROMODIFYATTEMPT
, wxStyledTextEvent
);
112 wxDEFINE_EVENT( wxEVT_STC_KEY
, wxStyledTextEvent
);
113 wxDEFINE_EVENT( wxEVT_STC_DOUBLECLICK
, wxStyledTextEvent
);
114 wxDEFINE_EVENT( wxEVT_STC_UPDATEUI
, wxStyledTextEvent
);
115 wxDEFINE_EVENT( wxEVT_STC_MODIFIED
, wxStyledTextEvent
);
116 wxDEFINE_EVENT( wxEVT_STC_MACRORECORD
, wxStyledTextEvent
);
117 wxDEFINE_EVENT( wxEVT_STC_MARGINCLICK
, wxStyledTextEvent
);
118 wxDEFINE_EVENT( wxEVT_STC_NEEDSHOWN
, wxStyledTextEvent
);
119 wxDEFINE_EVENT( wxEVT_STC_PAINTED
, wxStyledTextEvent
);
120 wxDEFINE_EVENT( wxEVT_STC_USERLISTSELECTION
, wxStyledTextEvent
);
121 wxDEFINE_EVENT( wxEVT_STC_URIDROPPED
, wxStyledTextEvent
);
122 wxDEFINE_EVENT( wxEVT_STC_DWELLSTART
, wxStyledTextEvent
);
123 wxDEFINE_EVENT( wxEVT_STC_DWELLEND
, wxStyledTextEvent
);
124 wxDEFINE_EVENT( wxEVT_STC_START_DRAG
, wxStyledTextEvent
);
125 wxDEFINE_EVENT( wxEVT_STC_DRAG_OVER
, wxStyledTextEvent
);
126 wxDEFINE_EVENT( wxEVT_STC_DO_DROP
, wxStyledTextEvent
);
127 wxDEFINE_EVENT( wxEVT_STC_ZOOM
, wxStyledTextEvent
);
128 wxDEFINE_EVENT( wxEVT_STC_HOTSPOT_CLICK
, wxStyledTextEvent
);
129 wxDEFINE_EVENT( wxEVT_STC_HOTSPOT_DCLICK
, wxStyledTextEvent
);
130 wxDEFINE_EVENT( wxEVT_STC_CALLTIP_CLICK
, wxStyledTextEvent
);
131 wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_SELECTION
, wxStyledTextEvent
);
132 wxDEFINE_EVENT( wxEVT_STC_INDICATOR_CLICK
, wxStyledTextEvent
);
133 wxDEFINE_EVENT( wxEVT_STC_INDICATOR_RELEASE
, wxStyledTextEvent
);
134 wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_CANCELLED
, wxStyledTextEvent
);
135 wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_CHAR_DELETED
, wxStyledTextEvent
);
136 wxDEFINE_EVENT( wxEVT_STC_HOTSPOT_RELEASE_CLICK
, wxStyledTextEvent
);
140 BEGIN_EVENT_TABLE(wxStyledTextCtrl
, wxControl
)
141 EVT_PAINT (wxStyledTextCtrl::OnPaint
)
142 EVT_SCROLLWIN (wxStyledTextCtrl::OnScrollWin
)
143 EVT_SCROLL (wxStyledTextCtrl::OnScroll
)
144 EVT_SIZE (wxStyledTextCtrl::OnSize
)
145 EVT_LEFT_DOWN (wxStyledTextCtrl::OnMouseLeftDown
)
146 // Let Scintilla see the double click as a second click
147 EVT_LEFT_DCLICK (wxStyledTextCtrl::OnMouseLeftDown
)
148 EVT_MOTION (wxStyledTextCtrl::OnMouseMove
)
149 EVT_LEFT_UP (wxStyledTextCtrl::OnMouseLeftUp
)
150 #if defined(__WXGTK__) || defined(__WXMAC__)
151 EVT_RIGHT_UP (wxStyledTextCtrl::OnMouseRightUp
)
153 EVT_CONTEXT_MENU (wxStyledTextCtrl::OnContextMenu
)
155 EVT_MOUSEWHEEL (wxStyledTextCtrl::OnMouseWheel
)
156 EVT_MIDDLE_UP (wxStyledTextCtrl::OnMouseMiddleUp
)
157 EVT_CHAR (wxStyledTextCtrl::OnChar
)
158 EVT_KEY_DOWN (wxStyledTextCtrl::OnKeyDown
)
159 EVT_KILL_FOCUS (wxStyledTextCtrl::OnLoseFocus
)
160 EVT_SET_FOCUS (wxStyledTextCtrl::OnGainFocus
)
161 EVT_SYS_COLOUR_CHANGED (wxStyledTextCtrl::OnSysColourChanged
)
162 EVT_ERASE_BACKGROUND (wxStyledTextCtrl::OnEraseBackground
)
163 EVT_MENU_RANGE (10, 16, wxStyledTextCtrl::OnMenu
)
164 EVT_LISTBOX_DCLICK (wxID_ANY
, wxStyledTextCtrl::OnListBox
)
168 IMPLEMENT_CLASS(wxStyledTextCtrl
, wxControl
)
169 IMPLEMENT_DYNAMIC_CLASS(wxStyledTextEvent
, wxCommandEvent
)
172 // forces the linking of the lexer modules
173 int Scintilla_LinkLexers();
176 //----------------------------------------------------------------------
177 // Constructor and Destructor
179 wxStyledTextCtrl::wxStyledTextCtrl(wxWindow
*parent
,
184 const wxString
& name
)
187 Create(parent
, id
, pos
, size
, style
, name
);
191 bool wxStyledTextCtrl::Create(wxWindow
*parent
,
196 const wxString
& name
)
198 style
|= wxVSCROLL
| wxHSCROLL
;
199 if (!wxControl::Create(parent
, id
, pos
, size
,
200 style
| wxWANTS_CHARS
| wxCLIP_CHILDREN
,
201 wxDefaultValidator
, name
))
205 Scintilla_LinkLexers();
207 m_swx
= new ScintillaWX(this);
209 m_lastKeyDownConsumed
= false;
213 // Put Scintilla into unicode (UTF-8) mode
214 SetCodePage(wxSTC_CP_UTF8
);
217 SetInitialSize(size
);
219 // Reduces flicker on GTK+/X11
220 SetBackgroundStyle(wxBG_STYLE_PAINT
);
222 // Make sure it can take the focus
229 wxStyledTextCtrl::~wxStyledTextCtrl() {
234 //----------------------------------------------------------------------
236 wxIntPtr
wxStyledTextCtrl::SendMsg(int msg
, wxUIntPtr wp
, wxIntPtr lp
) const
238 return m_swx
->WndProc(msg
, wp
, lp
);
241 //----------------------------------------------------------------------
243 // Set the vertical scrollbar to use instead of the ont that's built-in.
244 void wxStyledTextCtrl::SetVScrollBar(wxScrollBar
* bar
) {
247 // ensure that the built-in scrollbar is not visible
248 SetScrollbar(wxVERTICAL
, 0, 0, 0);
253 // Set the horizontal scrollbar to use instead of the ont that's built-in.
254 void wxStyledTextCtrl::SetHScrollBar(wxScrollBar
* bar
) {
257 // ensure that the built-in scrollbar is not visible
258 SetScrollbar(wxHORIZONTAL
, 0, 0, 0);
262 //----------------------------------------------------------------------
263 // Generated methods implementation section {{{
266 // Add text to the document at current position.
267 void wxStyledTextCtrl::AddText(const wxString
& text
) {
268 const wxWX2MBbuf buf
= wx2stc(text
);
269 SendMsg(2001, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
272 // Add array of cells to document.
273 void wxStyledTextCtrl::AddStyledText(const wxMemoryBuffer
& data
) {
274 SendMsg(2002, data
.GetDataLen(), (sptr_t
)data
.GetData());
277 // Insert string at a position.
278 void wxStyledTextCtrl::InsertText(int pos
, const wxString
& text
)
280 SendMsg(2003, pos
, (sptr_t
)(const char*)wx2stc(text
));
283 // Delete all text in the document.
284 void wxStyledTextCtrl::ClearAll()
289 // Delete a range of text in the document.
290 void wxStyledTextCtrl::DeleteRange(int pos
, int deleteLength
)
292 SendMsg(2645, pos
, deleteLength
);
295 // Set all style bytes to 0, remove all folding information.
296 void wxStyledTextCtrl::ClearDocumentStyle()
301 // Returns the number of bytes in the document.
302 int wxStyledTextCtrl::GetLength() const
304 return SendMsg(2006, 0, 0);
307 // Returns the character byte at the position.
308 int wxStyledTextCtrl::GetCharAt(int pos
) const {
309 return (unsigned char)SendMsg(2007, pos
, 0);
312 // Returns the position of the caret.
313 int wxStyledTextCtrl::GetCurrentPos() const
315 return SendMsg(2008, 0, 0);
318 // Returns the position of the opposite end of the selection to the caret.
319 int wxStyledTextCtrl::GetAnchor() const
321 return SendMsg(2009, 0, 0);
324 // Returns the style byte at the position.
325 int wxStyledTextCtrl::GetStyleAt(int pos
) const {
326 return (unsigned char)SendMsg(2010, pos
, 0);
329 // Redoes the next action on the undo history.
330 void wxStyledTextCtrl::Redo()
335 // Choose between collecting actions into the undo
336 // history and discarding them.
337 void wxStyledTextCtrl::SetUndoCollection(bool collectUndo
)
339 SendMsg(2012, collectUndo
, 0);
342 // Select all the text in the document.
343 void wxStyledTextCtrl::SelectAll()
348 // Remember the current position in the undo history as the position
349 // at which the document was saved.
350 void wxStyledTextCtrl::SetSavePoint()
355 // Retrieve a buffer of cells.
356 wxMemoryBuffer
wxStyledTextCtrl::GetStyledText(int startPos
, int endPos
) {
358 if (endPos
< startPos
) {
363 int len
= endPos
- startPos
;
364 if (!len
) return buf
;
366 tr
.lpstrText
= (char*)buf
.GetWriteBuf(len
*2+1);
367 tr
.chrg
.cpMin
= startPos
;
368 tr
.chrg
.cpMax
= endPos
;
369 len
= SendMsg(2015, 0, (sptr_t
)&tr
);
370 buf
.UngetWriteBuf(len
);
374 // Are there any redoable actions in the undo history?
375 bool wxStyledTextCtrl::CanRedo() const
377 return SendMsg(2016, 0, 0) != 0;
380 // Retrieve the line number at which a particular marker is located.
381 int wxStyledTextCtrl::MarkerLineFromHandle(int handle
)
383 return SendMsg(2017, handle
, 0);
387 void wxStyledTextCtrl::MarkerDeleteHandle(int handle
)
389 SendMsg(2018, handle
, 0);
392 // Is undo history being collected?
393 bool wxStyledTextCtrl::GetUndoCollection() const
395 return SendMsg(2019, 0, 0) != 0;
398 // Are white space characters currently visible?
399 // Returns one of SCWS_* constants.
400 int wxStyledTextCtrl::GetViewWhiteSpace() const
402 return SendMsg(2020, 0, 0);
405 // Make white space characters invisible, always visible or visible outside indentation.
406 void wxStyledTextCtrl::SetViewWhiteSpace(int viewWS
)
408 SendMsg(2021, viewWS
, 0);
411 // Find the position from a point within the window.
412 int wxStyledTextCtrl::PositionFromPoint(wxPoint pt
) const {
413 return SendMsg(2022, pt
.x
, pt
.y
);
416 // Find the position from a point within the window but return
417 // INVALID_POSITION if not close to text.
418 int wxStyledTextCtrl::PositionFromPointClose(int x
, int y
)
420 return SendMsg(2023, x
, y
);
423 // Set caret to start of a line and ensure it is visible.
424 void wxStyledTextCtrl::GotoLine(int line
)
426 SendMsg(2024, line
, 0);
429 // Set caret to a position and ensure it is visible.
430 void wxStyledTextCtrl::GotoPos(int pos
)
432 SendMsg(2025, pos
, 0);
435 // Set the selection anchor to a position. The anchor is the opposite
436 // end of the selection from the caret.
437 void wxStyledTextCtrl::SetAnchor(int posAnchor
)
439 SendMsg(2026, posAnchor
, 0);
442 // Retrieve the text of the line containing the caret.
443 // Returns the index of the caret on the line.
444 wxString
wxStyledTextCtrl::GetCurLine(int* linePos
) {
445 int len
= LineLength(GetCurrentLine());
447 if (linePos
) *linePos
= 0;
448 return wxEmptyString
;
451 wxMemoryBuffer
mbuf(len
+1);
452 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
454 int pos
= SendMsg(2027, len
+1, (sptr_t
)buf
);
455 mbuf
.UngetWriteBuf(len
);
457 if (linePos
) *linePos
= pos
;
461 // Retrieve the position of the last correctly styled character.
462 int wxStyledTextCtrl::GetEndStyled() const
464 return SendMsg(2028, 0, 0);
467 // Convert all line endings in the document to one mode.
468 void wxStyledTextCtrl::ConvertEOLs(int eolMode
)
470 SendMsg(2029, eolMode
, 0);
473 // Retrieve the current end of line mode - one of CRLF, CR, or LF.
474 int wxStyledTextCtrl::GetEOLMode() const
476 return SendMsg(2030, 0, 0);
479 // Set the current end of line mode.
480 void wxStyledTextCtrl::SetEOLMode(int eolMode
)
482 SendMsg(2031, eolMode
, 0);
485 // Set the current styling position to pos and the styling mask to mask.
486 // The styling mask can be used to protect some bits in each styling byte from modification.
487 void wxStyledTextCtrl::StartStyling(int pos
, int mask
)
489 SendMsg(2032, pos
, mask
);
492 // Change style from current styling position for length characters to a style
493 // and move the current styling position to after this newly styled segment.
494 void wxStyledTextCtrl::SetStyling(int length
, int style
)
496 SendMsg(2033, length
, style
);
499 // Is drawing done first into a buffer or direct to the screen?
500 bool wxStyledTextCtrl::GetBufferedDraw() const
502 return SendMsg(2034, 0, 0) != 0;
505 // If drawing is buffered then each line of text is drawn into a bitmap buffer
506 // before drawing it to the screen to avoid flicker.
507 void wxStyledTextCtrl::SetBufferedDraw(bool buffered
)
509 SendMsg(2035, buffered
, 0);
512 // Change the visible size of a tab to be a multiple of the width of a space character.
513 void wxStyledTextCtrl::SetTabWidth(int tabWidth
)
515 SendMsg(2036, tabWidth
, 0);
518 // Retrieve the visible size of a tab.
519 int wxStyledTextCtrl::GetTabWidth() const
521 return SendMsg(2121, 0, 0);
524 // Set the code page used to interpret the bytes of the document as characters.
525 void wxStyledTextCtrl::SetCodePage(int codePage
) {
527 wxASSERT_MSG(codePage
== wxSTC_CP_UTF8
,
528 wxT("Only wxSTC_CP_UTF8 may be used when wxUSE_UNICODE is on."));
530 wxASSERT_MSG(codePage
!= wxSTC_CP_UTF8
,
531 wxT("wxSTC_CP_UTF8 may not be used when wxUSE_UNICODE is off."));
533 SendMsg(2037, codePage
);
536 // Set the symbol used for a particular marker number,
537 // and optionally the fore and background colours.
538 void wxStyledTextCtrl::MarkerDefine(int markerNumber
, int markerSymbol
,
539 const wxColour
& foreground
,
540 const wxColour
& background
) {
542 SendMsg(2040, markerNumber
, markerSymbol
);
543 if (foreground
.IsOk())
544 MarkerSetForeground(markerNumber
, foreground
);
545 if (background
.IsOk())
546 MarkerSetBackground(markerNumber
, background
);
549 // Set the foreground colour used for a particular marker number.
550 void wxStyledTextCtrl::MarkerSetForeground(int markerNumber
, const wxColour
& fore
)
552 SendMsg(2041, markerNumber
, wxColourAsLong(fore
));
555 // Set the background colour used for a particular marker number.
556 void wxStyledTextCtrl::MarkerSetBackground(int markerNumber
, const wxColour
& back
)
558 SendMsg(2042, markerNumber
, wxColourAsLong(back
));
561 // Set the background colour used for a particular marker number when its folding block is selected.
562 void wxStyledTextCtrl::MarkerSetBackgroundSelected(int markerNumber
, const wxColour
& back
)
564 SendMsg(2292, markerNumber
, wxColourAsLong(back
));
567 // Enable/disable highlight for current folding bloc (smallest one that contains the caret)
568 void wxStyledTextCtrl::MarkerEnableHighlight(bool enabled
)
570 SendMsg(2293, enabled
, 0);
573 // Add a marker to a line, returning an ID which can be used to find or delete the marker.
574 int wxStyledTextCtrl::MarkerAdd(int line
, int markerNumber
)
576 return SendMsg(2043, line
, markerNumber
);
579 // Delete a marker from a line.
580 void wxStyledTextCtrl::MarkerDelete(int line
, int markerNumber
)
582 SendMsg(2044, line
, markerNumber
);
585 // Delete all markers with a particular number from all lines.
586 void wxStyledTextCtrl::MarkerDeleteAll(int markerNumber
)
588 SendMsg(2045, markerNumber
, 0);
591 // Get a bit mask of all the markers set on a line.
592 int wxStyledTextCtrl::MarkerGet(int line
)
594 return SendMsg(2046, line
, 0);
597 // Find the next line at or after lineStart that includes a marker in mask.
598 // Return -1 when no more lines.
599 int wxStyledTextCtrl::MarkerNext(int lineStart
, int markerMask
)
601 return SendMsg(2047, lineStart
, markerMask
);
604 // Find the previous line before lineStart that includes a marker in mask.
605 int wxStyledTextCtrl::MarkerPrevious(int lineStart
, int markerMask
)
607 return SendMsg(2048, lineStart
, markerMask
);
610 // Define a marker from a bitmap
611 void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber
, const wxBitmap
& bmp
) {
612 // convert bmp to a xpm in a string
613 wxMemoryOutputStream strm
;
614 wxImage img
= bmp
.ConvertToImage();
616 img
.ConvertAlphaToMask();
617 img
.SaveFile(strm
, wxBITMAP_TYPE_XPM
);
618 size_t len
= strm
.GetSize();
619 char* buff
= new char[len
+1];
620 strm
.CopyTo(buff
, len
);
622 SendMsg(2049, markerNumber
, (sptr_t
)buff
);
627 // Add a set of markers to a line.
628 void wxStyledTextCtrl::MarkerAddSet(int line
, int set
)
630 SendMsg(2466, line
, set
);
633 // Set the alpha used for a marker that is drawn in the text area, not the margin.
634 void wxStyledTextCtrl::MarkerSetAlpha(int markerNumber
, int alpha
)
636 SendMsg(2476, markerNumber
, alpha
);
639 // Set a margin to be either numeric or symbolic.
640 void wxStyledTextCtrl::SetMarginType(int margin
, int marginType
)
642 SendMsg(2240, margin
, marginType
);
645 // Retrieve the type of a margin.
646 int wxStyledTextCtrl::GetMarginType(int margin
) const
648 return SendMsg(2241, margin
, 0);
651 // Set the width of a margin to a width expressed in pixels.
652 void wxStyledTextCtrl::SetMarginWidth(int margin
, int pixelWidth
)
654 SendMsg(2242, margin
, pixelWidth
);
657 // Retrieve the width of a margin in pixels.
658 int wxStyledTextCtrl::GetMarginWidth(int margin
) const
660 return SendMsg(2243, margin
, 0);
663 // Set a mask that determines which markers are displayed in a margin.
664 void wxStyledTextCtrl::SetMarginMask(int margin
, int mask
)
666 SendMsg(2244, margin
, mask
);
669 // Retrieve the marker mask of a margin.
670 int wxStyledTextCtrl::GetMarginMask(int margin
) const
672 return SendMsg(2245, margin
, 0);
675 // Make a margin sensitive or insensitive to mouse clicks.
676 void wxStyledTextCtrl::SetMarginSensitive(int margin
, bool sensitive
)
678 SendMsg(2246, margin
, sensitive
);
681 // Retrieve the mouse click sensitivity of a margin.
682 bool wxStyledTextCtrl::GetMarginSensitive(int margin
) const
684 return SendMsg(2247, margin
, 0) != 0;
687 // Set the cursor shown when the mouse is inside a margin.
688 void wxStyledTextCtrl::SetMarginCursor(int margin
, int cursor
)
690 SendMsg(2248, margin
, cursor
);
693 // Retrieve the cursor shown in a margin.
694 int wxStyledTextCtrl::GetMarginCursor(int margin
) const
696 return SendMsg(2249, margin
, 0);
699 // Clear all the styles and make equivalent to the global default style.
700 void wxStyledTextCtrl::StyleClearAll()
705 // Set the foreground colour of a style.
706 void wxStyledTextCtrl::StyleSetForeground(int style
, const wxColour
& fore
)
708 SendMsg(2051, style
, wxColourAsLong(fore
));
711 // Set the background colour of a style.
712 void wxStyledTextCtrl::StyleSetBackground(int style
, const wxColour
& back
)
714 SendMsg(2052, style
, wxColourAsLong(back
));
717 // Set a style to be bold or not.
718 void wxStyledTextCtrl::StyleSetBold(int style
, bool bold
)
720 SendMsg(2053, style
, bold
);
723 // Set a style to be italic or not.
724 void wxStyledTextCtrl::StyleSetItalic(int style
, bool italic
)
726 SendMsg(2054, style
, italic
);
729 // Set the size of characters of a style.
730 void wxStyledTextCtrl::StyleSetSize(int style
, int sizePoints
)
732 SendMsg(2055, style
, sizePoints
);
735 // Set the font of a style.
736 void wxStyledTextCtrl::StyleSetFaceName(int style
, const wxString
& fontName
)
738 SendMsg(2056, style
, (sptr_t
)(const char*)wx2stc(fontName
));
741 // Set a style to have its end of line filled or not.
742 void wxStyledTextCtrl::StyleSetEOLFilled(int style
, bool filled
)
744 SendMsg(2057, style
, filled
);
747 // Reset the default style to its state at startup
748 void wxStyledTextCtrl::StyleResetDefault()
753 // Set a style to be underlined or not.
754 void wxStyledTextCtrl::StyleSetUnderline(int style
, bool underline
)
756 SendMsg(2059, style
, underline
);
759 // Get the foreground colour of a style.
760 wxColour
wxStyledTextCtrl::StyleGetForeground(int style
) const
762 long c
= SendMsg(2481, style
, 0);
763 return wxColourFromLong(c
);
766 // Get the background colour of a style.
767 wxColour
wxStyledTextCtrl::StyleGetBackground(int style
) const
769 long c
= SendMsg(2482, style
, 0);
770 return wxColourFromLong(c
);
773 // Get is a style bold or not.
774 bool wxStyledTextCtrl::StyleGetBold(int style
) const
776 return SendMsg(2483, style
, 0) != 0;
779 // Get is a style italic or not.
780 bool wxStyledTextCtrl::StyleGetItalic(int style
) const
782 return SendMsg(2484, style
, 0) != 0;
785 // Get the size of characters of a style.
786 int wxStyledTextCtrl::StyleGetSize(int style
) const
788 return SendMsg(2485, style
, 0);
791 // Get the font facename of a style
792 wxString
wxStyledTextCtrl::StyleGetFaceName(int style
) {
794 long len
= SendMsg(msg
, style
, 0);
795 wxMemoryBuffer
mbuf(len
+1);
796 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
797 SendMsg(msg
, style
, (sptr_t
)buf
);
798 mbuf
.UngetWriteBuf(len
);
803 // Get is a style to have its end of line filled or not.
804 bool wxStyledTextCtrl::StyleGetEOLFilled(int style
) const
806 return SendMsg(2487, style
, 0) != 0;
809 // Get is a style underlined or not.
810 bool wxStyledTextCtrl::StyleGetUnderline(int style
) const
812 return SendMsg(2488, style
, 0) != 0;
815 // Get is a style mixed case, or to force upper or lower case.
816 int wxStyledTextCtrl::StyleGetCase(int style
) const
818 return SendMsg(2489, style
, 0);
821 // Get the character set of the font in a style.
822 int wxStyledTextCtrl::StyleGetCharacterSet(int style
) const
824 return SendMsg(2490, style
, 0);
827 // Get is a style visible or not.
828 bool wxStyledTextCtrl::StyleGetVisible(int style
) const
830 return SendMsg(2491, style
, 0) != 0;
833 // Get is a style changeable or not (read only).
834 // Experimental feature, currently buggy.
835 bool wxStyledTextCtrl::StyleGetChangeable(int style
) const
837 return SendMsg(2492, style
, 0) != 0;
840 // Get is a style a hotspot or not.
841 bool wxStyledTextCtrl::StyleGetHotSpot(int style
) const
843 return SendMsg(2493, style
, 0) != 0;
846 // Set a style to be mixed case, or to force upper or lower case.
847 void wxStyledTextCtrl::StyleSetCase(int style
, int caseForce
)
849 SendMsg(2060, style
, caseForce
);
852 // Set the size of characters of a style. Size is in points multiplied by 100.
853 void wxStyledTextCtrl::StyleSetSizeFractional(int style
, int caseForce
)
855 SendMsg(2061, style
, caseForce
);
858 // Get the size of characters of a style in points multiplied by 100
859 int wxStyledTextCtrl::StyleGetSizeFractional(int style
) const
861 return SendMsg(2062, style
, 0);
864 // Set the weight of characters of a style.
865 void wxStyledTextCtrl::StyleSetWeight(int style
, int weight
)
867 SendMsg(2063, style
, weight
);
870 // Get the weight of characters of a style.
871 int wxStyledTextCtrl::StyleGetWeight(int style
) const
873 return SendMsg(2064, style
, 0);
876 // Set a style to be a hotspot or not.
877 void wxStyledTextCtrl::StyleSetHotSpot(int style
, bool hotspot
)
879 SendMsg(2409, style
, hotspot
);
882 // Set the foreground colour of the main and additional selections and whether to use this setting.
883 void wxStyledTextCtrl::SetSelForeground(bool useSetting
, const wxColour
& fore
)
885 SendMsg(2067, useSetting
, wxColourAsLong(fore
));
888 // Set the background colour of the main and additional selections and whether to use this setting.
889 void wxStyledTextCtrl::SetSelBackground(bool useSetting
, const wxColour
& back
)
891 SendMsg(2068, useSetting
, wxColourAsLong(back
));
894 // Get the alpha of the selection.
895 int wxStyledTextCtrl::GetSelAlpha() const
897 return SendMsg(2477, 0, 0);
900 // Set the alpha of the selection.
901 void wxStyledTextCtrl::SetSelAlpha(int alpha
)
903 SendMsg(2478, alpha
, 0);
906 // Is the selection end of line filled?
907 bool wxStyledTextCtrl::GetSelEOLFilled() const
909 return SendMsg(2479, 0, 0) != 0;
912 // Set the selection to have its end of line filled or not.
913 void wxStyledTextCtrl::SetSelEOLFilled(bool filled
)
915 SendMsg(2480, filled
, 0);
918 // Set the foreground colour of the caret.
919 void wxStyledTextCtrl::SetCaretForeground(const wxColour
& fore
)
921 SendMsg(2069, wxColourAsLong(fore
), 0);
924 // When key+modifier combination km is pressed perform msg.
925 void wxStyledTextCtrl::CmdKeyAssign(int key
, int modifiers
, int cmd
) {
926 SendMsg(2070, MAKELONG(key
, modifiers
), cmd
);
929 // When key+modifier combination km is pressed do nothing.
930 void wxStyledTextCtrl::CmdKeyClear(int key
, int modifiers
) {
931 SendMsg(2071, MAKELONG(key
, modifiers
));
934 // Drop all key mappings.
935 void wxStyledTextCtrl::CmdKeyClearAll()
940 // Set the styles for a segment of the document.
941 void wxStyledTextCtrl::SetStyleBytes(int length
, char* styleBytes
) {
942 SendMsg(2073, length
, (sptr_t
)styleBytes
);
945 // Set a style to be visible or not.
946 void wxStyledTextCtrl::StyleSetVisible(int style
, bool visible
)
948 SendMsg(2074, style
, visible
);
951 // Get the time in milliseconds that the caret is on and off.
952 int wxStyledTextCtrl::GetCaretPeriod() const
954 return SendMsg(2075, 0, 0);
957 // Get the time in milliseconds that the caret is on and off. 0 = steady on.
958 void wxStyledTextCtrl::SetCaretPeriod(int periodMilliseconds
)
960 SendMsg(2076, periodMilliseconds
, 0);
963 // Set the set of characters making up words for when moving or selecting by word.
964 // First sets defaults like SetCharsDefault.
965 void wxStyledTextCtrl::SetWordChars(const wxString
& characters
)
967 SendMsg(2077, 0, (sptr_t
)(const char*)wx2stc(characters
));
970 // Get the set of characters making up words for when moving or selecting by word.
971 wxString
wxStyledTextCtrl::GetWordChars() const {
973 int len
= SendMsg(msg
, 0, (sptr_t
)NULL
);
974 if (!len
) return wxEmptyString
;
976 wxMemoryBuffer
mbuf(len
+1);
977 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
978 SendMsg(msg
, 0, (sptr_t
)buf
);
979 mbuf
.UngetWriteBuf(len
);
984 // Start a sequence of actions that is undone and redone as a unit.
986 void wxStyledTextCtrl::BeginUndoAction()
991 // End a sequence of actions that is undone and redone as a unit.
992 void wxStyledTextCtrl::EndUndoAction()
997 // Set an indicator to plain, squiggle or TT.
998 void wxStyledTextCtrl::IndicatorSetStyle(int indic
, int style
)
1000 SendMsg(2080, indic
, style
);
1003 // Retrieve the style of an indicator.
1004 int wxStyledTextCtrl::IndicatorGetStyle(int indic
) const
1006 return SendMsg(2081, indic
, 0);
1009 // Set the foreground colour of an indicator.
1010 void wxStyledTextCtrl::IndicatorSetForeground(int indic
, const wxColour
& fore
)
1012 SendMsg(2082, indic
, wxColourAsLong(fore
));
1015 // Retrieve the foreground colour of an indicator.
1016 wxColour
wxStyledTextCtrl::IndicatorGetForeground(int indic
) const
1018 long c
= SendMsg(2083, indic
, 0);
1019 return wxColourFromLong(c
);
1022 // Set an indicator to draw under text or over(default).
1023 void wxStyledTextCtrl::IndicatorSetUnder(int indic
, bool under
)
1025 SendMsg(2510, indic
, under
);
1028 // Retrieve whether indicator drawn under or over text.
1029 bool wxStyledTextCtrl::IndicatorGetUnder(int indic
) const
1031 return SendMsg(2511, indic
, 0) != 0;
1034 // Set the foreground colour of all whitespace and whether to use this setting.
1035 void wxStyledTextCtrl::SetWhitespaceForeground(bool useSetting
, const wxColour
& fore
)
1037 SendMsg(2084, useSetting
, wxColourAsLong(fore
));
1040 // Set the background colour of all whitespace and whether to use this setting.
1041 void wxStyledTextCtrl::SetWhitespaceBackground(bool useSetting
, const wxColour
& back
)
1043 SendMsg(2085, useSetting
, wxColourAsLong(back
));
1046 // Set the size of the dots used to mark space characters.
1047 void wxStyledTextCtrl::SetWhitespaceSize(int size
)
1049 SendMsg(2086, size
, 0);
1052 // Get the size of the dots used to mark space characters.
1053 int wxStyledTextCtrl::GetWhitespaceSize() const
1055 return SendMsg(2087, 0, 0);
1058 // Divide each styling byte into lexical class bits (default: 5) and indicator
1059 // bits (default: 3). If a lexer requires more than 32 lexical states, then this
1060 // is used to expand the possible states.
1061 void wxStyledTextCtrl::SetStyleBits(int bits
)
1063 SendMsg(2090, bits
, 0);
1066 // Retrieve number of bits in style bytes used to hold the lexical state.
1067 int wxStyledTextCtrl::GetStyleBits() const
1069 return SendMsg(2091, 0, 0);
1072 // Used to hold extra styling information for each line.
1073 void wxStyledTextCtrl::SetLineState(int line
, int state
)
1075 SendMsg(2092, line
, state
);
1078 // Retrieve the extra styling information for a line.
1079 int wxStyledTextCtrl::GetLineState(int line
) const
1081 return SendMsg(2093, line
, 0);
1084 // Retrieve the last line number that has line state.
1085 int wxStyledTextCtrl::GetMaxLineState() const
1087 return SendMsg(2094, 0, 0);
1090 // Is the background of the line containing the caret in a different colour?
1091 bool wxStyledTextCtrl::GetCaretLineVisible() const
1093 return SendMsg(2095, 0, 0) != 0;
1096 // Display the background of the line containing the caret in a different colour.
1097 void wxStyledTextCtrl::SetCaretLineVisible(bool show
)
1099 SendMsg(2096, show
, 0);
1102 // Get the colour of the background of the line containing the caret.
1103 wxColour
wxStyledTextCtrl::GetCaretLineBackground() const
1105 long c
= SendMsg(2097, 0, 0);
1106 return wxColourFromLong(c
);
1109 // Set the colour of the background of the line containing the caret.
1110 void wxStyledTextCtrl::SetCaretLineBackground(const wxColour
& back
)
1112 SendMsg(2098, wxColourAsLong(back
), 0);
1115 // Set a style to be changeable or not (read only).
1116 // Experimental feature, currently buggy.
1117 void wxStyledTextCtrl::StyleSetChangeable(int style
, bool changeable
)
1119 SendMsg(2099, style
, changeable
);
1122 // Display a auto-completion list.
1123 // The lenEntered parameter indicates how many characters before
1124 // the caret should be used to provide context.
1125 void wxStyledTextCtrl::AutoCompShow(int lenEntered
, const wxString
& itemList
)
1127 SendMsg(2100, lenEntered
, (sptr_t
)(const char*)wx2stc(itemList
));
1130 // Remove the auto-completion list from the screen.
1131 void wxStyledTextCtrl::AutoCompCancel()
1133 SendMsg(2101, 0, 0);
1136 // Is there an auto-completion list visible?
1137 bool wxStyledTextCtrl::AutoCompActive()
1139 return SendMsg(2102, 0, 0) != 0;
1142 // Retrieve the position of the caret when the auto-completion list was displayed.
1143 int wxStyledTextCtrl::AutoCompPosStart()
1145 return SendMsg(2103, 0, 0);
1148 // User has selected an item so remove the list and insert the selection.
1149 void wxStyledTextCtrl::AutoCompComplete()
1151 SendMsg(2104, 0, 0);
1154 // Define a set of character that when typed cancel the auto-completion list.
1155 void wxStyledTextCtrl::AutoCompStops(const wxString
& characterSet
)
1157 SendMsg(2105, 0, (sptr_t
)(const char*)wx2stc(characterSet
));
1160 // Change the separator character in the string setting up an auto-completion list.
1161 // Default is space but can be changed if items contain space.
1162 void wxStyledTextCtrl::AutoCompSetSeparator(int separatorCharacter
)
1164 SendMsg(2106, separatorCharacter
, 0);
1167 // Retrieve the auto-completion list separator character.
1168 int wxStyledTextCtrl::AutoCompGetSeparator() const
1170 return SendMsg(2107, 0, 0);
1173 // Select the item in the auto-completion list that starts with a string.
1174 void wxStyledTextCtrl::AutoCompSelect(const wxString
& text
)
1176 SendMsg(2108, 0, (sptr_t
)(const char*)wx2stc(text
));
1179 // Should the auto-completion list be cancelled if the user backspaces to a
1180 // position before where the box was created.
1181 void wxStyledTextCtrl::AutoCompSetCancelAtStart(bool cancel
)
1183 SendMsg(2110, cancel
, 0);
1186 // Retrieve whether auto-completion cancelled by backspacing before start.
1187 bool wxStyledTextCtrl::AutoCompGetCancelAtStart() const
1189 return SendMsg(2111, 0, 0) != 0;
1192 // Define a set of characters that when typed will cause the autocompletion to
1193 // choose the selected item.
1194 void wxStyledTextCtrl::AutoCompSetFillUps(const wxString
& characterSet
)
1196 SendMsg(2112, 0, (sptr_t
)(const char*)wx2stc(characterSet
));
1199 // Should a single item auto-completion list automatically choose the item.
1200 void wxStyledTextCtrl::AutoCompSetChooseSingle(bool chooseSingle
)
1202 SendMsg(2113, chooseSingle
, 0);
1205 // Retrieve whether a single item auto-completion list automatically choose the item.
1206 bool wxStyledTextCtrl::AutoCompGetChooseSingle() const
1208 return SendMsg(2114, 0, 0) != 0;
1211 // Set whether case is significant when performing auto-completion searches.
1212 void wxStyledTextCtrl::AutoCompSetIgnoreCase(bool ignoreCase
)
1214 SendMsg(2115, ignoreCase
, 0);
1217 // Retrieve state of ignore case flag.
1218 bool wxStyledTextCtrl::AutoCompGetIgnoreCase() const
1220 return SendMsg(2116, 0, 0) != 0;
1223 // Display a list of strings and send notification when user chooses one.
1224 void wxStyledTextCtrl::UserListShow(int listType
, const wxString
& itemList
)
1226 SendMsg(2117, listType
, (sptr_t
)(const char*)wx2stc(itemList
));
1229 // Set whether or not autocompletion is hidden automatically when nothing matches.
1230 void wxStyledTextCtrl::AutoCompSetAutoHide(bool autoHide
)
1232 SendMsg(2118, autoHide
, 0);
1235 // Retrieve whether or not autocompletion is hidden automatically when nothing matches.
1236 bool wxStyledTextCtrl::AutoCompGetAutoHide() const
1238 return SendMsg(2119, 0, 0) != 0;
1241 // Set whether or not autocompletion deletes any word characters
1242 // after the inserted text upon completion.
1243 void wxStyledTextCtrl::AutoCompSetDropRestOfWord(bool dropRestOfWord
)
1245 SendMsg(2270, dropRestOfWord
, 0);
1248 // Retrieve whether or not autocompletion deletes any word characters
1249 // after the inserted text upon completion.
1250 bool wxStyledTextCtrl::AutoCompGetDropRestOfWord() const
1252 return SendMsg(2271, 0, 0) != 0;
1255 // Register an image for use in autocompletion lists.
1256 void wxStyledTextCtrl::RegisterImage(int type
, const wxBitmap
& bmp
) {
1257 // convert bmp to a xpm in a string
1258 wxMemoryOutputStream strm
;
1259 wxImage img
= bmp
.ConvertToImage();
1261 img
.ConvertAlphaToMask();
1262 img
.SaveFile(strm
, wxBITMAP_TYPE_XPM
);
1263 size_t len
= strm
.GetSize();
1264 char* buff
= new char[len
+1];
1265 strm
.CopyTo(buff
, len
);
1267 SendMsg(2405, type
, (sptr_t
)buff
);
1272 // Clear all the registered images.
1273 void wxStyledTextCtrl::ClearRegisteredImages()
1275 SendMsg(2408, 0, 0);
1278 // Retrieve the auto-completion list type-separator character.
1279 int wxStyledTextCtrl::AutoCompGetTypeSeparator() const
1281 return SendMsg(2285, 0, 0);
1284 // Change the type-separator character in the string setting up an auto-completion list.
1285 // Default is '?' but can be changed if items contain '?'.
1286 void wxStyledTextCtrl::AutoCompSetTypeSeparator(int separatorCharacter
)
1288 SendMsg(2286, separatorCharacter
, 0);
1291 // Set the maximum width, in characters, of auto-completion and user lists.
1292 // Set to 0 to autosize to fit longest item, which is the default.
1293 void wxStyledTextCtrl::AutoCompSetMaxWidth(int characterCount
)
1295 SendMsg(2208, characterCount
, 0);
1298 // Get the maximum width, in characters, of auto-completion and user lists.
1299 int wxStyledTextCtrl::AutoCompGetMaxWidth() const
1301 return SendMsg(2209, 0, 0);
1304 // Set the maximum height, in rows, of auto-completion and user lists.
1305 // The default is 5 rows.
1306 void wxStyledTextCtrl::AutoCompSetMaxHeight(int rowCount
)
1308 SendMsg(2210, rowCount
, 0);
1311 // Set the maximum height, in rows, of auto-completion and user lists.
1312 int wxStyledTextCtrl::AutoCompGetMaxHeight() const
1314 return SendMsg(2211, 0, 0);
1317 // Set the number of spaces used for one level of indentation.
1318 void wxStyledTextCtrl::SetIndent(int indentSize
)
1320 SendMsg(2122, indentSize
, 0);
1323 // Retrieve indentation size.
1324 int wxStyledTextCtrl::GetIndent() const
1326 return SendMsg(2123, 0, 0);
1329 // Indentation will only use space characters if useTabs is false, otherwise
1330 // it will use a combination of tabs and spaces.
1331 void wxStyledTextCtrl::SetUseTabs(bool useTabs
)
1333 SendMsg(2124, useTabs
, 0);
1336 // Retrieve whether tabs will be used in indentation.
1337 bool wxStyledTextCtrl::GetUseTabs() const
1339 return SendMsg(2125, 0, 0) != 0;
1342 // Change the indentation of a line to a number of columns.
1343 void wxStyledTextCtrl::SetLineIndentation(int line
, int indentSize
)
1345 SendMsg(2126, line
, indentSize
);
1348 // Retrieve the number of columns that a line is indented.
1349 int wxStyledTextCtrl::GetLineIndentation(int line
) const
1351 return SendMsg(2127, line
, 0);
1354 // Retrieve the position before the first non indentation character on a line.
1355 int wxStyledTextCtrl::GetLineIndentPosition(int line
) const
1357 return SendMsg(2128, line
, 0);
1360 // Retrieve the column number of a position, taking tab width into account.
1361 int wxStyledTextCtrl::GetColumn(int pos
) const
1363 return SendMsg(2129, pos
, 0);
1366 // Count characters between two positions.
1367 int wxStyledTextCtrl::CountCharacters(int startPos
, int endPos
)
1369 return SendMsg(2633, startPos
, endPos
);
1372 // Show or hide the horizontal scroll bar.
1373 void wxStyledTextCtrl::SetUseHorizontalScrollBar(bool show
)
1375 SendMsg(2130, show
, 0);
1378 // Is the horizontal scroll bar visible?
1379 bool wxStyledTextCtrl::GetUseHorizontalScrollBar() const
1381 return SendMsg(2131, 0, 0) != 0;
1384 // Show or hide indentation guides.
1385 void wxStyledTextCtrl::SetIndentationGuides(int indentView
)
1387 SendMsg(2132, indentView
, 0);
1390 // Are the indentation guides visible?
1391 int wxStyledTextCtrl::GetIndentationGuides() const
1393 return SendMsg(2133, 0, 0);
1396 // Set the highlighted indentation guide column.
1397 // 0 = no highlighted guide.
1398 void wxStyledTextCtrl::SetHighlightGuide(int column
)
1400 SendMsg(2134, column
, 0);
1403 // Get the highlighted indentation guide column.
1404 int wxStyledTextCtrl::GetHighlightGuide() const
1406 return SendMsg(2135, 0, 0);
1409 // Get the position after the last visible characters on a line.
1410 int wxStyledTextCtrl::GetLineEndPosition(int line
) const
1412 return SendMsg(2136, line
, 0);
1415 // Get the code page used to interpret the bytes of the document as characters.
1416 int wxStyledTextCtrl::GetCodePage() const
1418 return SendMsg(2137, 0, 0);
1421 // Get the foreground colour of the caret.
1422 wxColour
wxStyledTextCtrl::GetCaretForeground() const
1424 long c
= SendMsg(2138, 0, 0);
1425 return wxColourFromLong(c
);
1428 // In read-only mode?
1429 bool wxStyledTextCtrl::GetReadOnly() const
1431 return SendMsg(2140, 0, 0) != 0;
1434 // Sets the position of the caret.
1435 void wxStyledTextCtrl::SetCurrentPos(int pos
)
1437 SendMsg(2141, pos
, 0);
1440 // Sets the position that starts the selection - this becomes the anchor.
1441 void wxStyledTextCtrl::SetSelectionStart(int pos
)
1443 SendMsg(2142, pos
, 0);
1446 // Returns the position at the start of the selection.
1447 int wxStyledTextCtrl::GetSelectionStart() const
1449 return SendMsg(2143, 0, 0);
1452 // Sets the position that ends the selection - this becomes the currentPosition.
1453 void wxStyledTextCtrl::SetSelectionEnd(int pos
)
1455 SendMsg(2144, pos
, 0);
1458 // Returns the position at the end of the selection.
1459 int wxStyledTextCtrl::GetSelectionEnd() const
1461 return SendMsg(2145, 0, 0);
1464 // Set caret to a position, while removing any existing selection.
1465 void wxStyledTextCtrl::SetEmptySelection(int pos
)
1467 SendMsg(2556, pos
, 0);
1470 // Sets the print magnification added to the point size of each style for printing.
1471 void wxStyledTextCtrl::SetPrintMagnification(int magnification
)
1473 SendMsg(2146, magnification
, 0);
1476 // Returns the print magnification.
1477 int wxStyledTextCtrl::GetPrintMagnification() const
1479 return SendMsg(2147, 0, 0);
1482 // Modify colours when printing for clearer printed text.
1483 void wxStyledTextCtrl::SetPrintColourMode(int mode
)
1485 SendMsg(2148, mode
, 0);
1488 // Returns the print colour mode.
1489 int wxStyledTextCtrl::GetPrintColourMode() const
1491 return SendMsg(2149, 0, 0);
1494 // Find some text in the document.
1495 int wxStyledTextCtrl::FindText(int minPos
, int maxPos
,
1496 const wxString
& text
,
1499 ft
.chrg
.cpMin
= minPos
;
1500 ft
.chrg
.cpMax
= maxPos
;
1501 const wxWX2MBbuf buf
= wx2stc(text
);
1502 ft
.lpstrText
= (char*)(const char*)buf
;
1504 return SendMsg(2150, flags
, (sptr_t
)&ft
);
1507 // On Windows, will draw the document into a display context such as a printer.
1508 int wxStyledTextCtrl::FormatRange(bool doDraw
,
1517 if (endPos
< startPos
) {
1518 int temp
= startPos
;
1523 fr
.hdcTarget
= target
;
1524 fr
.rc
.top
= renderRect
.GetTop();
1525 fr
.rc
.left
= renderRect
.GetLeft();
1526 fr
.rc
.right
= renderRect
.GetRight();
1527 fr
.rc
.bottom
= renderRect
.GetBottom();
1528 fr
.rcPage
.top
= pageRect
.GetTop();
1529 fr
.rcPage
.left
= pageRect
.GetLeft();
1530 fr
.rcPage
.right
= pageRect
.GetRight();
1531 fr
.rcPage
.bottom
= pageRect
.GetBottom();
1532 fr
.chrg
.cpMin
= startPos
;
1533 fr
.chrg
.cpMax
= endPos
;
1535 return SendMsg(2151, doDraw
, (sptr_t
)&fr
);
1538 // Retrieve the display line at the top of the display.
1539 int wxStyledTextCtrl::GetFirstVisibleLine() const
1541 return SendMsg(2152, 0, 0);
1544 // Retrieve the contents of a line.
1545 wxString
wxStyledTextCtrl::GetLine(int line
) const {
1546 int len
= LineLength(line
);
1547 if (!len
) return wxEmptyString
;
1549 wxMemoryBuffer
mbuf(len
+1);
1550 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1551 SendMsg(2153, line
, (sptr_t
)buf
);
1552 mbuf
.UngetWriteBuf(len
);
1557 // Returns the number of lines in the document. There is always at least one.
1558 int wxStyledTextCtrl::GetLineCount() const
1560 return SendMsg(2154, 0, 0);
1563 // Sets the size in pixels of the left margin.
1564 void wxStyledTextCtrl::SetMarginLeft(int pixelWidth
)
1566 SendMsg(2155, 0, pixelWidth
);
1569 // Returns the size in pixels of the left margin.
1570 int wxStyledTextCtrl::GetMarginLeft() const
1572 return SendMsg(2156, 0, 0);
1575 // Sets the size in pixels of the right margin.
1576 void wxStyledTextCtrl::SetMarginRight(int pixelWidth
)
1578 SendMsg(2157, 0, pixelWidth
);
1581 // Returns the size in pixels of the right margin.
1582 int wxStyledTextCtrl::GetMarginRight() const
1584 return SendMsg(2158, 0, 0);
1587 // Is the document different from when it was last saved?
1588 bool wxStyledTextCtrl::GetModify() const
1590 return SendMsg(2159, 0, 0) != 0;
1593 // Retrieve the selected text.
1594 wxString
wxStyledTextCtrl::GetSelectedText() {
1595 const int len
= SendMsg(SCI_GETSELTEXT
, 0, (sptr_t
)0);
1596 if (!len
) return wxEmptyString
;
1598 wxMemoryBuffer
mbuf(len
+2);
1599 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1600 SendMsg(2161, 0, (sptr_t
)buf
);
1601 mbuf
.UngetWriteBuf(len
);
1606 // Retrieve a range of text.
1607 wxString
wxStyledTextCtrl::GetTextRange(int startPos
, int endPos
) {
1608 if (endPos
< startPos
) {
1609 int temp
= startPos
;
1613 int len
= endPos
- startPos
;
1614 if (!len
) return wxEmptyString
;
1615 wxMemoryBuffer
mbuf(len
+1);
1616 char* buf
= (char*)mbuf
.GetWriteBuf(len
);
1619 tr
.chrg
.cpMin
= startPos
;
1620 tr
.chrg
.cpMax
= endPos
;
1621 SendMsg(2162, 0, (sptr_t
)&tr
);
1622 mbuf
.UngetWriteBuf(len
);
1627 // Draw the selection in normal style or with selection highlighted.
1628 void wxStyledTextCtrl::HideSelection(bool normal
)
1630 SendMsg(2163, normal
, 0);
1633 // Retrieve the line containing a position.
1634 int wxStyledTextCtrl::LineFromPosition(int pos
) const
1636 return SendMsg(2166, pos
, 0);
1639 // Retrieve the position at the start of a line.
1640 int wxStyledTextCtrl::PositionFromLine(int line
) const
1642 return SendMsg(2167, line
, 0);
1645 // Scroll horizontally and vertically.
1646 void wxStyledTextCtrl::LineScroll(int columns
, int lines
)
1648 SendMsg(2168, columns
, lines
);
1651 // Ensure the caret is visible.
1652 void wxStyledTextCtrl::EnsureCaretVisible()
1654 SendMsg(2169, 0, 0);
1657 // Replace the selected text with the argument text.
1658 void wxStyledTextCtrl::ReplaceSelection(const wxString
& text
)
1660 SendMsg(2170, 0, (sptr_t
)(const char*)wx2stc(text
));
1663 // Set to read only or read write.
1664 void wxStyledTextCtrl::SetReadOnly(bool readOnly
)
1666 SendMsg(2171, readOnly
, 0);
1669 // Will a paste succeed?
1670 bool wxStyledTextCtrl::CanPaste() const
1672 return SendMsg(2173, 0, 0) != 0;
1675 // Are there any undoable actions in the undo history?
1676 bool wxStyledTextCtrl::CanUndo() const
1678 return SendMsg(2174, 0, 0) != 0;
1681 // Delete the undo history.
1682 void wxStyledTextCtrl::EmptyUndoBuffer()
1684 SendMsg(2175, 0, 0);
1687 // Undo one action in the undo history.
1688 void wxStyledTextCtrl::Undo()
1690 SendMsg(2176, 0, 0);
1693 // Cut the selection to the clipboard.
1694 void wxStyledTextCtrl::Cut()
1696 SendMsg(2177, 0, 0);
1699 // Copy the selection to the clipboard.
1700 void wxStyledTextCtrl::Copy()
1702 SendMsg(2178, 0, 0);
1705 // Paste the contents of the clipboard into the document replacing the selection.
1706 void wxStyledTextCtrl::Paste()
1708 SendMsg(2179, 0, 0);
1711 // Clear the selection.
1712 void wxStyledTextCtrl::Clear()
1714 SendMsg(2180, 0, 0);
1717 // Replace the contents of the document with the argument text.
1718 void wxStyledTextCtrl::SetText(const wxString
& text
)
1720 SendMsg(2181, 0, (sptr_t
)(const char*)wx2stc(text
));
1723 // Retrieve all the text in the document.
1724 wxString
wxStyledTextCtrl::GetText() const {
1725 int len
= GetTextLength();
1726 wxMemoryBuffer
mbuf(len
+1); // leave room for the null...
1727 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1728 SendMsg(2182, len
+1, (sptr_t
)buf
);
1729 mbuf
.UngetWriteBuf(len
);
1734 // Retrieve the number of characters in the document.
1735 int wxStyledTextCtrl::GetTextLength() const
1737 return SendMsg(2183, 0, 0);
1740 // Set to overtype (true) or insert mode.
1741 void wxStyledTextCtrl::SetOvertype(bool overtype
)
1743 SendMsg(2186, overtype
, 0);
1746 // Returns true if overtype mode is active otherwise false is returned.
1747 bool wxStyledTextCtrl::GetOvertype() const
1749 return SendMsg(2187, 0, 0) != 0;
1752 // Set the width of the insert mode caret.
1753 void wxStyledTextCtrl::SetCaretWidth(int pixelWidth
)
1755 SendMsg(2188, pixelWidth
, 0);
1758 // Returns the width of the insert mode caret.
1759 int wxStyledTextCtrl::GetCaretWidth() const
1761 return SendMsg(2189, 0, 0);
1764 // Sets the position that starts the target which is used for updating the
1765 // document without affecting the scroll position.
1766 void wxStyledTextCtrl::SetTargetStart(int pos
)
1768 SendMsg(2190, pos
, 0);
1771 // Get the position that starts the target.
1772 int wxStyledTextCtrl::GetTargetStart() const
1774 return SendMsg(2191, 0, 0);
1777 // Sets the position that ends the target which is used for updating the
1778 // document without affecting the scroll position.
1779 void wxStyledTextCtrl::SetTargetEnd(int pos
)
1781 SendMsg(2192, pos
, 0);
1784 // Get the position that ends the target.
1785 int wxStyledTextCtrl::GetTargetEnd() const
1787 return SendMsg(2193, 0, 0);
1790 // Replace the target text with the argument text.
1791 // Text is counted so it can contain NULs.
1792 // Returns the length of the replacement text.
1794 int wxStyledTextCtrl::ReplaceTarget(const wxString
& text
) {
1795 const wxWX2MBbuf buf
= wx2stc(text
);
1796 return SendMsg(2194, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
1799 // Replace the target text with the argument text after \\d processing.
1800 // Text is counted so it can contain NULs.
1801 // Looks for \\d where d is between 1 and 9 and replaces these with the strings
1802 // matched in the last search operation which were surrounded by \( and \).
1803 // Returns the length of the replacement text including any change
1804 // caused by processing the \\d patterns.
1806 int wxStyledTextCtrl::ReplaceTargetRE(const wxString
& text
) {
1807 const wxWX2MBbuf buf
= wx2stc(text
);
1808 return SendMsg(2195, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
1811 // Search for a counted string in the target and set the target to the found
1812 // range. Text is counted so it can contain NULs.
1813 // Returns length of range or -1 for failure in which case target is not moved.
1815 int wxStyledTextCtrl::SearchInTarget(const wxString
& text
) {
1816 const wxWX2MBbuf buf
= wx2stc(text
);
1817 return SendMsg(2197, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
1820 // Set the search flags used by SearchInTarget.
1821 void wxStyledTextCtrl::SetSearchFlags(int flags
)
1823 SendMsg(2198, flags
, 0);
1826 // Get the search flags used by SearchInTarget.
1827 int wxStyledTextCtrl::GetSearchFlags() const
1829 return SendMsg(2199, 0, 0);
1832 // Show a call tip containing a definition near position pos.
1833 void wxStyledTextCtrl::CallTipShow(int pos
, const wxString
& definition
)
1835 SendMsg(2200, pos
, (sptr_t
)(const char*)wx2stc(definition
));
1838 // Remove the call tip from the screen.
1839 void wxStyledTextCtrl::CallTipCancel()
1841 SendMsg(2201, 0, 0);
1844 // Is there an active call tip?
1845 bool wxStyledTextCtrl::CallTipActive()
1847 return SendMsg(2202, 0, 0) != 0;
1850 // Retrieve the position where the caret was before displaying the call tip.
1851 int wxStyledTextCtrl::CallTipPosAtStart()
1853 return SendMsg(2203, 0, 0);
1856 // Highlight a segment of the definition.
1857 void wxStyledTextCtrl::CallTipSetHighlight(int start
, int end
)
1859 SendMsg(2204, start
, end
);
1862 // Set the background colour for the call tip.
1863 void wxStyledTextCtrl::CallTipSetBackground(const wxColour
& back
)
1865 SendMsg(2205, wxColourAsLong(back
), 0);
1868 // Set the foreground colour for the call tip.
1869 void wxStyledTextCtrl::CallTipSetForeground(const wxColour
& fore
)
1871 SendMsg(2206, wxColourAsLong(fore
), 0);
1874 // Set the foreground colour for the highlighted part of the call tip.
1875 void wxStyledTextCtrl::CallTipSetForegroundHighlight(const wxColour
& fore
)
1877 SendMsg(2207, wxColourAsLong(fore
), 0);
1880 // Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
1881 void wxStyledTextCtrl::CallTipUseStyle(int tabSize
)
1883 SendMsg(2212, tabSize
, 0);
1886 // Set position of calltip, above or below text.
1887 void wxStyledTextCtrl::CallTipSetPosition(bool above
)
1889 SendMsg(2213, above
, 0);
1892 // Find the display line of a document line taking hidden lines into account.
1893 int wxStyledTextCtrl::VisibleFromDocLine(int line
)
1895 return SendMsg(2220, line
, 0);
1898 // Find the document line of a display line taking hidden lines into account.
1899 int wxStyledTextCtrl::DocLineFromVisible(int lineDisplay
)
1901 return SendMsg(2221, lineDisplay
, 0);
1904 // The number of display lines needed to wrap a document line
1905 int wxStyledTextCtrl::WrapCount(int line
)
1907 return SendMsg(2235, line
, 0);
1910 // Set the fold level of a line.
1911 // This encodes an integer level along with flags indicating whether the
1912 // line is a header and whether it is effectively white space.
1913 void wxStyledTextCtrl::SetFoldLevel(int line
, int level
)
1915 SendMsg(2222, line
, level
);
1918 // Retrieve the fold level of a line.
1919 int wxStyledTextCtrl::GetFoldLevel(int line
) const
1921 return SendMsg(2223, line
, 0);
1924 // Find the last child line of a header line.
1925 int wxStyledTextCtrl::GetLastChild(int line
, int level
) const
1927 return SendMsg(2224, line
, level
);
1930 // Find the parent line of a child line.
1931 int wxStyledTextCtrl::GetFoldParent(int line
) const
1933 return SendMsg(2225, line
, 0);
1936 // Make a range of lines visible.
1937 void wxStyledTextCtrl::ShowLines(int lineStart
, int lineEnd
)
1939 SendMsg(2226, lineStart
, lineEnd
);
1942 // Make a range of lines invisible.
1943 void wxStyledTextCtrl::HideLines(int lineStart
, int lineEnd
)
1945 SendMsg(2227, lineStart
, lineEnd
);
1948 // Is a line visible?
1949 bool wxStyledTextCtrl::GetLineVisible(int line
) const
1951 return SendMsg(2228, line
, 0) != 0;
1954 // Are all lines visible?
1955 bool wxStyledTextCtrl::GetAllLinesVisible() const
1957 return SendMsg(2236, 0, 0) != 0;
1960 // Show the children of a header line.
1961 void wxStyledTextCtrl::SetFoldExpanded(int line
, bool expanded
)
1963 SendMsg(2229, line
, expanded
);
1966 // Is a header line expanded?
1967 bool wxStyledTextCtrl::GetFoldExpanded(int line
) const
1969 return SendMsg(2230, line
, 0) != 0;
1972 // Switch a header line between expanded and contracted.
1973 void wxStyledTextCtrl::ToggleFold(int line
)
1975 SendMsg(2231, line
, 0);
1978 // Ensure a particular line is visible by expanding any header line hiding it.
1979 void wxStyledTextCtrl::EnsureVisible(int line
)
1981 SendMsg(2232, line
, 0);
1984 // Set some style options for folding.
1985 void wxStyledTextCtrl::SetFoldFlags(int flags
)
1987 SendMsg(2233, flags
, 0);
1990 // Ensure a particular line is visible by expanding any header line hiding it.
1991 // Use the currently set visibility policy to determine which range to display.
1992 void wxStyledTextCtrl::EnsureVisibleEnforcePolicy(int line
)
1994 SendMsg(2234, line
, 0);
1997 // Sets whether a tab pressed when caret is within indentation indents.
1998 void wxStyledTextCtrl::SetTabIndents(bool tabIndents
)
2000 SendMsg(2260, tabIndents
, 0);
2003 // Does a tab pressed when caret is within indentation indent?
2004 bool wxStyledTextCtrl::GetTabIndents() const
2006 return SendMsg(2261, 0, 0) != 0;
2009 // Sets whether a backspace pressed when caret is within indentation unindents.
2010 void wxStyledTextCtrl::SetBackSpaceUnIndents(bool bsUnIndents
)
2012 SendMsg(2262, bsUnIndents
, 0);
2015 // Does a backspace pressed when caret is within indentation unindent?
2016 bool wxStyledTextCtrl::GetBackSpaceUnIndents() const
2018 return SendMsg(2263, 0, 0) != 0;
2021 // Sets the time the mouse must sit still to generate a mouse dwell event.
2022 void wxStyledTextCtrl::SetMouseDwellTime(int periodMilliseconds
)
2024 SendMsg(2264, periodMilliseconds
, 0);
2027 // Retrieve the time the mouse must sit still to generate a mouse dwell event.
2028 int wxStyledTextCtrl::GetMouseDwellTime() const
2030 return SendMsg(2265, 0, 0);
2033 // Get position of start of word.
2034 int wxStyledTextCtrl::WordStartPosition(int pos
, bool onlyWordCharacters
)
2036 return SendMsg(2266, pos
, onlyWordCharacters
);
2039 // Get position of end of word.
2040 int wxStyledTextCtrl::WordEndPosition(int pos
, bool onlyWordCharacters
)
2042 return SendMsg(2267, pos
, onlyWordCharacters
);
2045 // Sets whether text is word wrapped.
2046 void wxStyledTextCtrl::SetWrapMode(int mode
)
2048 SendMsg(2268, mode
, 0);
2051 // Retrieve whether text is word wrapped.
2052 int wxStyledTextCtrl::GetWrapMode() const
2054 return SendMsg(2269, 0, 0);
2057 // Set the display mode of visual flags for wrapped lines.
2058 void wxStyledTextCtrl::SetWrapVisualFlags(int wrapVisualFlags
)
2060 SendMsg(2460, wrapVisualFlags
, 0);
2063 // Retrive the display mode of visual flags for wrapped lines.
2064 int wxStyledTextCtrl::GetWrapVisualFlags() const
2066 return SendMsg(2461, 0, 0);
2069 // Set the location of visual flags for wrapped lines.
2070 void wxStyledTextCtrl::SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation
)
2072 SendMsg(2462, wrapVisualFlagsLocation
, 0);
2075 // Retrive the location of visual flags for wrapped lines.
2076 int wxStyledTextCtrl::GetWrapVisualFlagsLocation() const
2078 return SendMsg(2463, 0, 0);
2081 // Set the start indent for wrapped lines.
2082 void wxStyledTextCtrl::SetWrapStartIndent(int indent
)
2084 SendMsg(2464, indent
, 0);
2087 // Retrive the start indent for wrapped lines.
2088 int wxStyledTextCtrl::GetWrapStartIndent() const
2090 return SendMsg(2465, 0, 0);
2093 // Sets how wrapped sublines are placed. Default is fixed.
2094 void wxStyledTextCtrl::SetWrapIndentMode(int mode
)
2096 SendMsg(2472, mode
, 0);
2099 // Retrieve how wrapped sublines are placed. Default is fixed.
2100 int wxStyledTextCtrl::GetWrapIndentMode() const
2102 return SendMsg(2473, 0, 0);
2105 // Sets the degree of caching of layout information.
2106 void wxStyledTextCtrl::SetLayoutCache(int mode
)
2108 SendMsg(2272, mode
, 0);
2111 // Retrieve the degree of caching of layout information.
2112 int wxStyledTextCtrl::GetLayoutCache() const
2114 return SendMsg(2273, 0, 0);
2117 // Sets the document width assumed for scrolling.
2118 void wxStyledTextCtrl::SetScrollWidth(int pixelWidth
)
2120 SendMsg(2274, pixelWidth
, 0);
2123 // Retrieve the document width assumed for scrolling.
2124 int wxStyledTextCtrl::GetScrollWidth() const
2126 return SendMsg(2275, 0, 0);
2129 // Sets whether the maximum width line displayed is used to set scroll width.
2130 void wxStyledTextCtrl::SetScrollWidthTracking(bool tracking
)
2132 SendMsg(2516, tracking
, 0);
2135 // Retrieve whether the scroll width tracks wide lines.
2136 bool wxStyledTextCtrl::GetScrollWidthTracking() const
2138 return SendMsg(2517, 0, 0) != 0;
2141 // Measure the pixel width of some text in a particular style.
2142 // NUL terminated text argument.
2143 // Does not handle tab or control characters.
2144 int wxStyledTextCtrl::TextWidth(int style
, const wxString
& text
)
2146 return SendMsg(2276, style
, (sptr_t
)(const char*)wx2stc(text
));
2149 // Sets the scroll range so that maximum scroll position has
2150 // the last line at the bottom of the view (default).
2151 // Setting this to false allows scrolling one page below the last line.
2152 void wxStyledTextCtrl::SetEndAtLastLine(bool endAtLastLine
)
2154 SendMsg(2277, endAtLastLine
, 0);
2157 // Retrieve whether the maximum scroll position has the last
2158 // line at the bottom of the view.
2159 bool wxStyledTextCtrl::GetEndAtLastLine() const
2161 return SendMsg(2278, 0, 0) != 0;
2164 // Retrieve the height of a particular line of text in pixels.
2165 int wxStyledTextCtrl::TextHeight(int line
)
2167 return SendMsg(2279, line
, 0);
2170 // Show or hide the vertical scroll bar.
2171 void wxStyledTextCtrl::SetUseVerticalScrollBar(bool show
)
2173 SendMsg(2280, show
, 0);
2176 // Is the vertical scroll bar visible?
2177 bool wxStyledTextCtrl::GetUseVerticalScrollBar() const
2179 return SendMsg(2281, 0, 0) != 0;
2182 // Append a string to the end of the document without changing the selection.
2183 void wxStyledTextCtrl::AppendText(const wxString
& text
) {
2184 const wxWX2MBbuf buf
= wx2stc(text
);
2185 SendMsg(2282, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
2188 // Is drawing done in two phases with backgrounds drawn before foregrounds?
2189 bool wxStyledTextCtrl::GetTwoPhaseDraw() const
2191 return SendMsg(2283, 0, 0) != 0;
2194 // In twoPhaseDraw mode, drawing is performed in two phases, first the background
2195 // and then the foreground. This avoids chopping off characters that overlap the next run.
2196 void wxStyledTextCtrl::SetTwoPhaseDraw(bool twoPhase
)
2198 SendMsg(2284, twoPhase
, 0);
2201 // Scroll so that a display line is at the top of the display.
2202 void wxStyledTextCtrl::SetFirstVisibleLine(int lineDisplay
)
2204 SendMsg(2613, lineDisplay
, 0);
2207 // Change the effect of pasting when there are multiple selections.
2208 void wxStyledTextCtrl::SetMultiPaste(int multiPaste
)
2210 SendMsg(2614, multiPaste
, 0);
2213 // Retrieve the effect of pasting when there are multiple selections.
2214 int wxStyledTextCtrl::GetMultiPaste() const
2216 return SendMsg(2615, 0, 0);
2219 // Retrieve the value of a tag from a regular expression search.
2220 wxString
wxStyledTextCtrl::GetTag(int tagNumber
) const {
2222 int len
= SendMsg(msg
, tagNumber
, (sptr_t
)NULL
);
2223 if (!len
) return wxEmptyString
;
2225 wxMemoryBuffer
mbuf(len
+1);
2226 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
2227 SendMsg(msg
, tagNumber
, (sptr_t
)buf
);
2228 mbuf
.UngetWriteBuf(len
);
2233 // Make the target range start and end be the same as the selection range start and end.
2234 void wxStyledTextCtrl::TargetFromSelection()
2236 SendMsg(2287, 0, 0);
2239 // Join the lines in the target.
2240 void wxStyledTextCtrl::LinesJoin()
2242 SendMsg(2288, 0, 0);
2245 // Split the lines in the target into lines that are less wide than pixelWidth
2247 void wxStyledTextCtrl::LinesSplit(int pixelWidth
)
2249 SendMsg(2289, pixelWidth
, 0);
2252 // Set the colours used as a chequerboard pattern in the fold margin
2253 void wxStyledTextCtrl::SetFoldMarginColour(bool useSetting
, const wxColour
& back
)
2255 SendMsg(2290, useSetting
, wxColourAsLong(back
));
2257 void wxStyledTextCtrl::SetFoldMarginHiColour(bool useSetting
, const wxColour
& fore
)
2259 SendMsg(2291, useSetting
, wxColourAsLong(fore
));
2262 // Move caret down one line.
2263 void wxStyledTextCtrl::LineDown()
2265 SendMsg(2300, 0, 0);
2268 // Move caret down one line extending selection to new caret position.
2269 void wxStyledTextCtrl::LineDownExtend()
2271 SendMsg(2301, 0, 0);
2274 // Move caret up one line.
2275 void wxStyledTextCtrl::LineUp()
2277 SendMsg(2302, 0, 0);
2280 // Move caret up one line extending selection to new caret position.
2281 void wxStyledTextCtrl::LineUpExtend()
2283 SendMsg(2303, 0, 0);
2286 // Move caret left one character.
2287 void wxStyledTextCtrl::CharLeft()
2289 SendMsg(2304, 0, 0);
2292 // Move caret left one character extending selection to new caret position.
2293 void wxStyledTextCtrl::CharLeftExtend()
2295 SendMsg(2305, 0, 0);
2298 // Move caret right one character.
2299 void wxStyledTextCtrl::CharRight()
2301 SendMsg(2306, 0, 0);
2304 // Move caret right one character extending selection to new caret position.
2305 void wxStyledTextCtrl::CharRightExtend()
2307 SendMsg(2307, 0, 0);
2310 // Move caret left one word.
2311 void wxStyledTextCtrl::WordLeft()
2313 SendMsg(2308, 0, 0);
2316 // Move caret left one word extending selection to new caret position.
2317 void wxStyledTextCtrl::WordLeftExtend()
2319 SendMsg(2309, 0, 0);
2322 // Move caret right one word.
2323 void wxStyledTextCtrl::WordRight()
2325 SendMsg(2310, 0, 0);
2328 // Move caret right one word extending selection to new caret position.
2329 void wxStyledTextCtrl::WordRightExtend()
2331 SendMsg(2311, 0, 0);
2334 // Move caret to first position on line.
2335 void wxStyledTextCtrl::Home()
2337 SendMsg(2312, 0, 0);
2340 // Move caret to first position on line extending selection to new caret position.
2341 void wxStyledTextCtrl::HomeExtend()
2343 SendMsg(2313, 0, 0);
2346 // Move caret to last position on line.
2347 void wxStyledTextCtrl::LineEnd()
2349 SendMsg(2314, 0, 0);
2352 // Move caret to last position on line extending selection to new caret position.
2353 void wxStyledTextCtrl::LineEndExtend()
2355 SendMsg(2315, 0, 0);
2358 // Move caret to first position in document.
2359 void wxStyledTextCtrl::DocumentStart()
2361 SendMsg(2316, 0, 0);
2364 // Move caret to first position in document extending selection to new caret position.
2365 void wxStyledTextCtrl::DocumentStartExtend()
2367 SendMsg(2317, 0, 0);
2370 // Move caret to last position in document.
2371 void wxStyledTextCtrl::DocumentEnd()
2373 SendMsg(2318, 0, 0);
2376 // Move caret to last position in document extending selection to new caret position.
2377 void wxStyledTextCtrl::DocumentEndExtend()
2379 SendMsg(2319, 0, 0);
2382 // Move caret one page up.
2383 void wxStyledTextCtrl::PageUp()
2385 SendMsg(2320, 0, 0);
2388 // Move caret one page up extending selection to new caret position.
2389 void wxStyledTextCtrl::PageUpExtend()
2391 SendMsg(2321, 0, 0);
2394 // Move caret one page down.
2395 void wxStyledTextCtrl::PageDown()
2397 SendMsg(2322, 0, 0);
2400 // Move caret one page down extending selection to new caret position.
2401 void wxStyledTextCtrl::PageDownExtend()
2403 SendMsg(2323, 0, 0);
2406 // Switch from insert to overtype mode or the reverse.
2407 void wxStyledTextCtrl::EditToggleOvertype()
2409 SendMsg(2324, 0, 0);
2412 // Cancel any modes such as call tip or auto-completion list display.
2413 void wxStyledTextCtrl::Cancel()
2415 SendMsg(2325, 0, 0);
2418 // Delete the selection or if no selection, the character before the caret.
2419 void wxStyledTextCtrl::DeleteBack()
2421 SendMsg(2326, 0, 0);
2424 // If selection is empty or all on one line replace the selection with a tab character.
2425 // If more than one line selected, indent the lines.
2426 void wxStyledTextCtrl::Tab()
2428 SendMsg(2327, 0, 0);
2431 // Dedent the selected lines.
2432 void wxStyledTextCtrl::BackTab()
2434 SendMsg(2328, 0, 0);
2437 // Insert a new line, may use a CRLF, CR or LF depending on EOL mode.
2438 void wxStyledTextCtrl::NewLine()
2440 SendMsg(2329, 0, 0);
2443 // Insert a Form Feed character.
2444 void wxStyledTextCtrl::FormFeed()
2446 SendMsg(2330, 0, 0);
2449 // Move caret to before first visible character on line.
2450 // If already there move to first character on line.
2451 void wxStyledTextCtrl::VCHome()
2453 SendMsg(2331, 0, 0);
2456 // Like VCHome but extending selection to new caret position.
2457 void wxStyledTextCtrl::VCHomeExtend()
2459 SendMsg(2332, 0, 0);
2462 // Magnify the displayed text by increasing the sizes by 1 point.
2463 void wxStyledTextCtrl::ZoomIn()
2465 SendMsg(2333, 0, 0);
2468 // Make the displayed text smaller by decreasing the sizes by 1 point.
2469 void wxStyledTextCtrl::ZoomOut()
2471 SendMsg(2334, 0, 0);
2474 // Delete the word to the left of the caret.
2475 void wxStyledTextCtrl::DelWordLeft()
2477 SendMsg(2335, 0, 0);
2480 // Delete the word to the right of the caret.
2481 void wxStyledTextCtrl::DelWordRight()
2483 SendMsg(2336, 0, 0);
2486 // Delete the word to the right of the caret, but not the trailing non-word characters.
2487 void wxStyledTextCtrl::DelWordRightEnd()
2489 SendMsg(2518, 0, 0);
2492 // Cut the line containing the caret.
2493 void wxStyledTextCtrl::LineCut()
2495 SendMsg(2337, 0, 0);
2498 // Delete the line containing the caret.
2499 void wxStyledTextCtrl::LineDelete()
2501 SendMsg(2338, 0, 0);
2504 // Switch the current line with the previous.
2505 void wxStyledTextCtrl::LineTranspose()
2507 SendMsg(2339, 0, 0);
2510 // Duplicate the current line.
2511 void wxStyledTextCtrl::LineDuplicate()
2513 SendMsg(2404, 0, 0);
2516 // Transform the selection to lower case.
2517 void wxStyledTextCtrl::LowerCase()
2519 SendMsg(2340, 0, 0);
2522 // Transform the selection to upper case.
2523 void wxStyledTextCtrl::UpperCase()
2525 SendMsg(2341, 0, 0);
2528 // Scroll the document down, keeping the caret visible.
2529 void wxStyledTextCtrl::LineScrollDown()
2531 SendMsg(2342, 0, 0);
2534 // Scroll the document up, keeping the caret visible.
2535 void wxStyledTextCtrl::LineScrollUp()
2537 SendMsg(2343, 0, 0);
2540 // Delete the selection or if no selection, the character before the caret.
2541 // Will not delete the character before at the start of a line.
2542 void wxStyledTextCtrl::DeleteBackNotLine()
2544 SendMsg(2344, 0, 0);
2547 // Move caret to first position on display line.
2548 void wxStyledTextCtrl::HomeDisplay()
2550 SendMsg(2345, 0, 0);
2553 // Move caret to first position on display line extending selection to
2554 // new caret position.
2555 void wxStyledTextCtrl::HomeDisplayExtend()
2557 SendMsg(2346, 0, 0);
2560 // Move caret to last position on display line.
2561 void wxStyledTextCtrl::LineEndDisplay()
2563 SendMsg(2347, 0, 0);
2566 // Move caret to last position on display line extending selection to new
2568 void wxStyledTextCtrl::LineEndDisplayExtend()
2570 SendMsg(2348, 0, 0);
2573 // These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)?
2574 // except they behave differently when word-wrap is enabled:
2575 // They go first to the start / end of the display line, like (Home|LineEnd)Display
2576 // The difference is that, the cursor is already at the point, it goes on to the start
2577 // or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
2578 void wxStyledTextCtrl::HomeWrap()
2580 SendMsg(2349, 0, 0);
2582 void wxStyledTextCtrl::HomeWrapExtend()
2584 SendMsg(2450, 0, 0);
2586 void wxStyledTextCtrl::LineEndWrap()
2588 SendMsg(2451, 0, 0);
2590 void wxStyledTextCtrl::LineEndWrapExtend()
2592 SendMsg(2452, 0, 0);
2594 void wxStyledTextCtrl::VCHomeWrap()
2596 SendMsg(2453, 0, 0);
2598 void wxStyledTextCtrl::VCHomeWrapExtend()
2600 SendMsg(2454, 0, 0);
2603 // Copy the line containing the caret.
2604 void wxStyledTextCtrl::LineCopy()
2606 SendMsg(2455, 0, 0);
2609 // Move the caret inside current view if it's not there already.
2610 void wxStyledTextCtrl::MoveCaretInsideView()
2612 SendMsg(2401, 0, 0);
2615 // How many characters are on a line, including end of line characters?
2616 int wxStyledTextCtrl::LineLength(int line
) const
2618 return SendMsg(2350, line
, 0);
2621 // Highlight the characters at two positions.
2622 void wxStyledTextCtrl::BraceHighlight(int pos1
, int pos2
)
2624 SendMsg(2351, pos1
, pos2
);
2627 // Use specified indicator to highlight matching braces instead of changing their style.
2628 void wxStyledTextCtrl::BraceHighlightIndicator(bool useBraceHighlightIndicator
, int indicator
)
2630 SendMsg(2498, useBraceHighlightIndicator
, indicator
);
2633 // Highlight the character at a position indicating there is no matching brace.
2634 void wxStyledTextCtrl::BraceBadLight(int pos
)
2636 SendMsg(2352, pos
, 0);
2639 // Use specified indicator to highlight non matching brace instead of changing its style.
2640 void wxStyledTextCtrl::BraceBadLightIndicator(bool useBraceBadLightIndicator
, int indicator
)
2642 SendMsg(2499, useBraceBadLightIndicator
, indicator
);
2645 // Find the position of a matching brace or INVALID_POSITION if no match.
2646 int wxStyledTextCtrl::BraceMatch(int pos
)
2648 return SendMsg(2353, pos
, 0);
2651 // Are the end of line characters visible?
2652 bool wxStyledTextCtrl::GetViewEOL() const
2654 return SendMsg(2355, 0, 0) != 0;
2657 // Make the end of line characters visible or invisible.
2658 void wxStyledTextCtrl::SetViewEOL(bool visible
)
2660 SendMsg(2356, visible
, 0);
2663 // Retrieve a pointer to the document object.
2664 void* wxStyledTextCtrl::GetDocPointer() {
2665 return (void*)SendMsg(2357);
2668 // Change the document object used.
2669 void wxStyledTextCtrl::SetDocPointer(void* docPointer
) {
2670 SendMsg(2358, 0, (sptr_t
)docPointer
);
2673 // Set which document modification events are sent to the container.
2674 void wxStyledTextCtrl::SetModEventMask(int mask
)
2676 SendMsg(2359, mask
, 0);
2679 // Retrieve the column number which text should be kept within.
2680 int wxStyledTextCtrl::GetEdgeColumn() const
2682 return SendMsg(2360, 0, 0);
2685 // Set the column number of the edge.
2686 // If text goes past the edge then it is highlighted.
2687 void wxStyledTextCtrl::SetEdgeColumn(int column
)
2689 SendMsg(2361, column
, 0);
2692 // Retrieve the edge highlight mode.
2693 int wxStyledTextCtrl::GetEdgeMode() const
2695 return SendMsg(2362, 0, 0);
2698 // The edge may be displayed by a line (EDGE_LINE) or by highlighting text that
2699 // goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).
2700 void wxStyledTextCtrl::SetEdgeMode(int mode
)
2702 SendMsg(2363, mode
, 0);
2705 // Retrieve the colour used in edge indication.
2706 wxColour
wxStyledTextCtrl::GetEdgeColour() const
2708 long c
= SendMsg(2364, 0, 0);
2709 return wxColourFromLong(c
);
2712 // Change the colour used in edge indication.
2713 void wxStyledTextCtrl::SetEdgeColour(const wxColour
& edgeColour
)
2715 SendMsg(2365, wxColourAsLong(edgeColour
), 0);
2718 // Sets the current caret position to be the search anchor.
2719 void wxStyledTextCtrl::SearchAnchor()
2721 SendMsg(2366, 0, 0);
2724 // Find some text starting at the search anchor.
2725 // Does not ensure the selection is visible.
2726 int wxStyledTextCtrl::SearchNext(int flags
, const wxString
& text
)
2728 return SendMsg(2367, flags
, (sptr_t
)(const char*)wx2stc(text
));
2731 // Find some text starting at the search anchor and moving backwards.
2732 // Does not ensure the selection is visible.
2733 int wxStyledTextCtrl::SearchPrev(int flags
, const wxString
& text
)
2735 return SendMsg(2368, flags
, (sptr_t
)(const char*)wx2stc(text
));
2738 // Retrieves the number of lines completely visible.
2739 int wxStyledTextCtrl::LinesOnScreen() const
2741 return SendMsg(2370, 0, 0);
2744 // Set whether a pop up menu is displayed automatically when the user presses
2745 // the wrong mouse button.
2746 void wxStyledTextCtrl::UsePopUp(bool allowPopUp
)
2748 SendMsg(2371, allowPopUp
, 0);
2751 // Is the selection rectangular? The alternative is the more common stream selection.
2752 bool wxStyledTextCtrl::SelectionIsRectangle() const
2754 return SendMsg(2372, 0, 0) != 0;
2757 // Set the zoom level. This number of points is added to the size of all fonts.
2758 // It may be positive to magnify or negative to reduce.
2759 void wxStyledTextCtrl::SetZoom(int zoom
)
2761 SendMsg(2373, zoom
, 0);
2764 // Retrieve the zoom level.
2765 int wxStyledTextCtrl::GetZoom() const
2767 return SendMsg(2374, 0, 0);
2770 // Create a new document object.
2771 // Starts with reference count of 1 and not selected into editor.
2772 void* wxStyledTextCtrl::CreateDocument() {
2773 return (void*)SendMsg(2375);
2776 // Extend life of document.
2777 void wxStyledTextCtrl::AddRefDocument(void* docPointer
) {
2778 SendMsg(2376, 0, (sptr_t
)docPointer
);
2781 // Release a reference to the document, deleting document if it fades to black.
2782 void wxStyledTextCtrl::ReleaseDocument(void* docPointer
) {
2783 SendMsg(2377, 0, (sptr_t
)docPointer
);
2786 // Get which document modification events are sent to the container.
2787 int wxStyledTextCtrl::GetModEventMask() const
2789 return SendMsg(2378, 0, 0);
2792 // Change internal focus flag.
2793 void wxStyledTextCtrl::SetSTCFocus(bool focus
)
2795 SendMsg(2380, focus
, 0);
2798 // Get internal focus flag.
2799 bool wxStyledTextCtrl::GetSTCFocus() const
2801 return SendMsg(2381, 0, 0) != 0;
2804 // Change error status - 0 = OK.
2805 void wxStyledTextCtrl::SetStatus(int statusCode
)
2807 SendMsg(2382, statusCode
, 0);
2810 // Get error status.
2811 int wxStyledTextCtrl::GetStatus() const
2813 return SendMsg(2383, 0, 0);
2816 // Set whether the mouse is captured when its button is pressed.
2817 void wxStyledTextCtrl::SetMouseDownCaptures(bool captures
)
2819 SendMsg(2384, captures
, 0);
2822 // Get whether mouse gets captured.
2823 bool wxStyledTextCtrl::GetMouseDownCaptures() const
2825 return SendMsg(2385, 0, 0) != 0;
2828 // Sets the cursor to one of the SC_CURSOR* values.
2829 void wxStyledTextCtrl::SetSTCCursor(int cursorType
)
2831 SendMsg(2386, cursorType
, 0);
2835 int wxStyledTextCtrl::GetSTCCursor() const
2837 return SendMsg(2387, 0, 0);
2840 // Change the way control characters are displayed:
2841 // If symbol is < 32, keep the drawn way, else, use the given character.
2842 void wxStyledTextCtrl::SetControlCharSymbol(int symbol
)
2844 SendMsg(2388, symbol
, 0);
2847 // Get the way control characters are displayed.
2848 int wxStyledTextCtrl::GetControlCharSymbol() const
2850 return SendMsg(2389, 0, 0);
2853 // Move to the previous change in capitalisation.
2854 void wxStyledTextCtrl::WordPartLeft()
2856 SendMsg(2390, 0, 0);
2859 // Move to the previous change in capitalisation extending selection
2860 // to new caret position.
2861 void wxStyledTextCtrl::WordPartLeftExtend()
2863 SendMsg(2391, 0, 0);
2866 // Move to the change next in capitalisation.
2867 void wxStyledTextCtrl::WordPartRight()
2869 SendMsg(2392, 0, 0);
2872 // Move to the next change in capitalisation extending selection
2873 // to new caret position.
2874 void wxStyledTextCtrl::WordPartRightExtend()
2876 SendMsg(2393, 0, 0);
2879 // Set the way the display area is determined when a particular line
2880 // is to be moved to by Find, FindNext, GotoLine, etc.
2881 void wxStyledTextCtrl::SetVisiblePolicy(int visiblePolicy
, int visibleSlop
)
2883 SendMsg(2394, visiblePolicy
, visibleSlop
);
2886 // Delete back from the current position to the start of the line.
2887 void wxStyledTextCtrl::DelLineLeft()
2889 SendMsg(2395, 0, 0);
2892 // Delete forwards from the current position to the end of the line.
2893 void wxStyledTextCtrl::DelLineRight()
2895 SendMsg(2396, 0, 0);
2898 // Get and Set the xOffset (ie, horizontal scroll position).
2899 void wxStyledTextCtrl::SetXOffset(int newOffset
)
2901 SendMsg(2397, newOffset
, 0);
2903 int wxStyledTextCtrl::GetXOffset() const
2905 return SendMsg(2398, 0, 0);
2908 // Set the last x chosen value to be the caret x position.
2909 void wxStyledTextCtrl::ChooseCaretX()
2911 SendMsg(2399, 0, 0);
2914 // Set the way the caret is kept visible when going sideways.
2915 // The exclusion zone is given in pixels.
2916 void wxStyledTextCtrl::SetXCaretPolicy(int caretPolicy
, int caretSlop
)
2918 SendMsg(2402, caretPolicy
, caretSlop
);
2921 // Set the way the line the caret is on is kept visible.
2922 // The exclusion zone is given in lines.
2923 void wxStyledTextCtrl::SetYCaretPolicy(int caretPolicy
, int caretSlop
)
2925 SendMsg(2403, caretPolicy
, caretSlop
);
2928 // Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE).
2929 void wxStyledTextCtrl::SetPrintWrapMode(int mode
)
2931 SendMsg(2406, mode
, 0);
2934 // Is printing line wrapped?
2935 int wxStyledTextCtrl::GetPrintWrapMode() const
2937 return SendMsg(2407, 0, 0);
2940 // Set a fore colour for active hotspots.
2941 void wxStyledTextCtrl::SetHotspotActiveForeground(bool useSetting
, const wxColour
& fore
)
2943 SendMsg(2410, useSetting
, wxColourAsLong(fore
));
2946 // Get the fore colour for active hotspots.
2947 wxColour
wxStyledTextCtrl::GetHotspotActiveForeground() const
2949 long c
= SendMsg(2494, 0, 0);
2950 return wxColourFromLong(c
);
2953 // Set a back colour for active hotspots.
2954 void wxStyledTextCtrl::SetHotspotActiveBackground(bool useSetting
, const wxColour
& back
)
2956 SendMsg(2411, useSetting
, wxColourAsLong(back
));
2959 // Get the back colour for active hotspots.
2960 wxColour
wxStyledTextCtrl::GetHotspotActiveBackground() const
2962 long c
= SendMsg(2495, 0, 0);
2963 return wxColourFromLong(c
);
2966 // Enable / Disable underlining active hotspots.
2967 void wxStyledTextCtrl::SetHotspotActiveUnderline(bool underline
)
2969 SendMsg(2412, underline
, 0);
2972 // Get whether underlining for active hotspots.
2973 bool wxStyledTextCtrl::GetHotspotActiveUnderline() const
2975 return SendMsg(2496, 0, 0) != 0;
2978 // Limit hotspots to single line so hotspots on two lines don't merge.
2979 void wxStyledTextCtrl::SetHotspotSingleLine(bool singleLine
)
2981 SendMsg(2421, singleLine
, 0);
2984 // Get the HotspotSingleLine property
2985 bool wxStyledTextCtrl::GetHotspotSingleLine() const
2987 return SendMsg(2497, 0, 0) != 0;
2990 // Move caret between paragraphs (delimited by empty lines).
2991 void wxStyledTextCtrl::ParaDown()
2993 SendMsg(2413, 0, 0);
2995 void wxStyledTextCtrl::ParaDownExtend()
2997 SendMsg(2414, 0, 0);
2999 void wxStyledTextCtrl::ParaUp()
3001 SendMsg(2415, 0, 0);
3003 void wxStyledTextCtrl::ParaUpExtend()
3005 SendMsg(2416, 0, 0);
3008 // Given a valid document position, return the previous position taking code
3009 // page into account. Returns 0 if passed 0.
3010 int wxStyledTextCtrl::PositionBefore(int pos
)
3012 return SendMsg(2417, pos
, 0);
3015 // Given a valid document position, return the next position taking code
3016 // page into account. Maximum value returned is the last position in the document.
3017 int wxStyledTextCtrl::PositionAfter(int pos
)
3019 return SendMsg(2418, pos
, 0);
3022 // Copy a range of text to the clipboard. Positions are clipped into the document.
3023 void wxStyledTextCtrl::CopyRange(int start
, int end
)
3025 SendMsg(2419, start
, end
);
3028 // Copy argument text to the clipboard.
3029 void wxStyledTextCtrl::CopyText(int length
, const wxString
& text
)
3031 SendMsg(2420, length
, (sptr_t
)(const char*)wx2stc(text
));
3034 // Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE/SC_SEL_THIN) or
3035 // by lines (SC_SEL_LINES).
3036 void wxStyledTextCtrl::SetSelectionMode(int mode
)
3038 SendMsg(2422, mode
, 0);
3041 // Get the mode of the current selection.
3042 int wxStyledTextCtrl::GetSelectionMode() const
3044 return SendMsg(2423, 0, 0);
3047 // Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line).
3048 int wxStyledTextCtrl::GetLineSelStartPosition(int line
)
3050 return SendMsg(2424, line
, 0);
3053 // Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line).
3054 int wxStyledTextCtrl::GetLineSelEndPosition(int line
)
3056 return SendMsg(2425, line
, 0);
3059 // Move caret down one line, extending rectangular selection to new caret position.
3060 void wxStyledTextCtrl::LineDownRectExtend()
3062 SendMsg(2426, 0, 0);
3065 // Move caret up one line, extending rectangular selection to new caret position.
3066 void wxStyledTextCtrl::LineUpRectExtend()
3068 SendMsg(2427, 0, 0);
3071 // Move caret left one character, extending rectangular selection to new caret position.
3072 void wxStyledTextCtrl::CharLeftRectExtend()
3074 SendMsg(2428, 0, 0);
3077 // Move caret right one character, extending rectangular selection to new caret position.
3078 void wxStyledTextCtrl::CharRightRectExtend()
3080 SendMsg(2429, 0, 0);
3083 // Move caret to first position on line, extending rectangular selection to new caret position.
3084 void wxStyledTextCtrl::HomeRectExtend()
3086 SendMsg(2430, 0, 0);
3089 // Move caret to before first visible character on line.
3090 // If already there move to first character on line.
3091 // In either case, extend rectangular selection to new caret position.
3092 void wxStyledTextCtrl::VCHomeRectExtend()
3094 SendMsg(2431, 0, 0);
3097 // Move caret to last position on line, extending rectangular selection to new caret position.
3098 void wxStyledTextCtrl::LineEndRectExtend()
3100 SendMsg(2432, 0, 0);
3103 // Move caret one page up, extending rectangular selection to new caret position.
3104 void wxStyledTextCtrl::PageUpRectExtend()
3106 SendMsg(2433, 0, 0);
3109 // Move caret one page down, extending rectangular selection to new caret position.
3110 void wxStyledTextCtrl::PageDownRectExtend()
3112 SendMsg(2434, 0, 0);
3115 // Move caret to top of page, or one page up if already at top of page.
3116 void wxStyledTextCtrl::StutteredPageUp()
3118 SendMsg(2435, 0, 0);
3121 // Move caret to top of page, or one page up if already at top of page, extending selection to new caret position.
3122 void wxStyledTextCtrl::StutteredPageUpExtend()
3124 SendMsg(2436, 0, 0);
3127 // Move caret to bottom of page, or one page down if already at bottom of page.
3128 void wxStyledTextCtrl::StutteredPageDown()
3130 SendMsg(2437, 0, 0);
3133 // Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position.
3134 void wxStyledTextCtrl::StutteredPageDownExtend()
3136 SendMsg(2438, 0, 0);
3139 // Move caret left one word, position cursor at end of word.
3140 void wxStyledTextCtrl::WordLeftEnd()
3142 SendMsg(2439, 0, 0);
3145 // Move caret left one word, position cursor at end of word, extending selection to new caret position.
3146 void wxStyledTextCtrl::WordLeftEndExtend()
3148 SendMsg(2440, 0, 0);
3151 // Move caret right one word, position cursor at end of word.
3152 void wxStyledTextCtrl::WordRightEnd()
3154 SendMsg(2441, 0, 0);
3157 // Move caret right one word, position cursor at end of word, extending selection to new caret position.
3158 void wxStyledTextCtrl::WordRightEndExtend()
3160 SendMsg(2442, 0, 0);
3163 // Set the set of characters making up whitespace for when moving or selecting by word.
3164 // Should be called after SetWordChars.
3165 void wxStyledTextCtrl::SetWhitespaceChars(const wxString
& characters
)
3167 SendMsg(2443, 0, (sptr_t
)(const char*)wx2stc(characters
));
3170 // Get the set of characters making up whitespace for when moving or selecting by word.
3171 wxString
wxStyledTextCtrl::GetWhitespaceChars() const {
3173 int len
= SendMsg(msg
, 0, (sptr_t
)NULL
);
3174 if (!len
) return wxEmptyString
;
3176 wxMemoryBuffer
mbuf(len
+1);
3177 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3178 SendMsg(msg
, 0, (sptr_t
)buf
);
3179 mbuf
.UngetWriteBuf(len
);
3184 // Set the set of characters making up punctuation characters
3185 // Should be called after SetWordChars.
3186 void wxStyledTextCtrl::SetPunctuationChars(const wxString
& characters
)
3188 SendMsg(2648, 0, (sptr_t
)(const char*)wx2stc(characters
));
3191 // Get the set of characters making up punctuation characters
3192 wxString
wxStyledTextCtrl::GetPunctuationChars() const {
3194 int len
= SendMsg(msg
, 0, (sptr_t
)NULL
);
3195 if (!len
) return wxEmptyString
;
3197 wxMemoryBuffer
mbuf(len
+1);
3198 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3199 SendMsg(msg
, 0, (sptr_t
)buf
);
3200 mbuf
.UngetWriteBuf(len
);
3205 // Reset the set of characters for whitespace and word characters to the defaults.
3206 void wxStyledTextCtrl::SetCharsDefault()
3208 SendMsg(2444, 0, 0);
3211 // Get currently selected item position in the auto-completion list
3212 int wxStyledTextCtrl::AutoCompGetCurrent() const
3214 return SendMsg(2445, 0, 0);
3217 // Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference.
3218 void wxStyledTextCtrl::AutoCompSetCaseInsensitiveBehaviour(int behaviour
)
3220 SendMsg(2634, behaviour
, 0);
3223 // Get auto-completion case insensitive behaviour.
3224 int wxStyledTextCtrl::AutoCompGetCaseInsensitiveBehaviour() const
3226 return SendMsg(2635, 0, 0);
3229 // Enlarge the document to a particular size of text bytes.
3230 void wxStyledTextCtrl::Allocate(int bytes
)
3232 SendMsg(2446, bytes
, 0);
3235 // Find the position of a column on a line taking into account tabs and
3236 // multi-byte characters. If beyond end of line, return line end position.
3237 int wxStyledTextCtrl::FindColumn(int line
, int column
)
3239 return SendMsg(2456, line
, column
);
3242 // Can the caret preferred x position only be changed by explicit movement commands?
3243 int wxStyledTextCtrl::GetCaretSticky() const
3245 return SendMsg(2457, 0, 0);
3248 // Stop the caret preferred x position changing when the user types.
3249 void wxStyledTextCtrl::SetCaretSticky(int useCaretStickyBehaviour
)
3251 SendMsg(2458, useCaretStickyBehaviour
, 0);
3254 // Switch between sticky and non-sticky: meant to be bound to a key.
3255 void wxStyledTextCtrl::ToggleCaretSticky()
3257 SendMsg(2459, 0, 0);
3260 // Enable/Disable convert-on-paste for line endings
3261 void wxStyledTextCtrl::SetPasteConvertEndings(bool convert
)
3263 SendMsg(2467, convert
, 0);
3266 // Get convert-on-paste setting
3267 bool wxStyledTextCtrl::GetPasteConvertEndings() const
3269 return SendMsg(2468, 0, 0) != 0;
3272 // Duplicate the selection. If selection empty duplicate the line containing the caret.
3273 void wxStyledTextCtrl::SelectionDuplicate()
3275 SendMsg(2469, 0, 0);
3278 // Set background alpha of the caret line.
3279 void wxStyledTextCtrl::SetCaretLineBackAlpha(int alpha
)
3281 SendMsg(2470, alpha
, 0);
3284 // Get the background alpha of the caret line.
3285 int wxStyledTextCtrl::GetCaretLineBackAlpha() const
3287 return SendMsg(2471, 0, 0);
3290 // Set the style of the caret to be drawn.
3291 void wxStyledTextCtrl::SetCaretStyle(int caretStyle
)
3293 SendMsg(2512, caretStyle
, 0);
3296 // Returns the current style of the caret.
3297 int wxStyledTextCtrl::GetCaretStyle() const
3299 return SendMsg(2513, 0, 0);
3302 // Set the indicator used for IndicatorFillRange and IndicatorClearRange
3303 void wxStyledTextCtrl::SetIndicatorCurrent(int indicator
)
3305 SendMsg(2500, indicator
, 0);
3308 // Get the current indicator
3309 int wxStyledTextCtrl::GetIndicatorCurrent() const
3311 return SendMsg(2501, 0, 0);
3314 // Set the value used for IndicatorFillRange
3315 void wxStyledTextCtrl::SetIndicatorValue(int value
)
3317 SendMsg(2502, value
, 0);
3320 // Get the current indicator value
3321 int wxStyledTextCtrl::GetIndicatorValue() const
3323 return SendMsg(2503, 0, 0);
3326 // Turn a indicator on over a range.
3327 void wxStyledTextCtrl::IndicatorFillRange(int position
, int fillLength
)
3329 SendMsg(2504, position
, fillLength
);
3332 // Turn a indicator off over a range.
3333 void wxStyledTextCtrl::IndicatorClearRange(int position
, int clearLength
)
3335 SendMsg(2505, position
, clearLength
);
3338 // Are any indicators present at position?
3339 int wxStyledTextCtrl::IndicatorAllOnFor(int position
)
3341 return SendMsg(2506, position
, 0);
3344 // What value does a particular indicator have at at a position?
3345 int wxStyledTextCtrl::IndicatorValueAt(int indicator
, int position
)
3347 return SendMsg(2507, indicator
, position
);
3350 // Where does a particular indicator start?
3351 int wxStyledTextCtrl::IndicatorStart(int indicator
, int position
)
3353 return SendMsg(2508, indicator
, position
);
3356 // Where does a particular indicator end?
3357 int wxStyledTextCtrl::IndicatorEnd(int indicator
, int position
)
3359 return SendMsg(2509, indicator
, position
);
3362 // Set number of entries in position cache
3363 void wxStyledTextCtrl::SetPositionCacheSize(int size
)
3365 SendMsg(2514, size
, 0);
3368 // How many entries are allocated to the position cache?
3369 int wxStyledTextCtrl::GetPositionCacheSize() const
3371 return SendMsg(2515, 0, 0);
3374 // Copy the selection, if selection empty copy the line with the caret
3375 void wxStyledTextCtrl::CopyAllowLine()
3377 SendMsg(2519, 0, 0);
3380 // Compact the document buffer and return a read-only pointer to the
3381 // characters in the document.
3382 const char* wxStyledTextCtrl::GetCharacterPointer() const {
3383 return (const char*)SendMsg(2520, 0, 0);
3386 // Return a read-only pointer to a range of characters in the document.
3387 // May move the gap so that the range is contiguous, but will only move up
3388 // to rangeLength bytes.
3389 const char* wxStyledTextCtrl::GetRangePointer(int position
, int rangeLength
) const {
3390 return (const char*)SendMsg(2643, position
, rangeLength
);
3393 // Return a position which, to avoid performance costs, should not be within
3394 // the range of a call to GetRangePointer.
3395 int wxStyledTextCtrl::GetGapPosition() const
3397 return SendMsg(2644, 0, 0);
3400 // Always interpret keyboard input as Unicode
3401 void wxStyledTextCtrl::SetKeysUnicode(bool keysUnicode
)
3403 SendMsg(2521, keysUnicode
, 0);
3406 // Are keys always interpreted as Unicode?
3407 bool wxStyledTextCtrl::GetKeysUnicode() const
3409 return SendMsg(2522, 0, 0) != 0;
3412 // Set the alpha fill colour of the given indicator.
3413 void wxStyledTextCtrl::IndicatorSetAlpha(int indicator
, int alpha
)
3415 SendMsg(2523, indicator
, alpha
);
3418 // Get the alpha fill colour of the given indicator.
3419 int wxStyledTextCtrl::IndicatorGetAlpha(int indicator
) const
3421 return SendMsg(2524, indicator
, 0);
3424 // Set the alpha outline colour of the given indicator.
3425 void wxStyledTextCtrl::IndicatorSetOutlineAlpha(int indicator
, int alpha
)
3427 SendMsg(2558, indicator
, alpha
);
3430 // Get the alpha outline colour of the given indicator.
3431 int wxStyledTextCtrl::IndicatorGetOutlineAlpha(int indicator
) const
3433 return SendMsg(2559, indicator
, 0);
3436 // Set extra ascent for each line
3437 void wxStyledTextCtrl::SetExtraAscent(int extraAscent
)
3439 SendMsg(2525, extraAscent
, 0);
3442 // Get extra ascent for each line
3443 int wxStyledTextCtrl::GetExtraAscent() const
3445 return SendMsg(2526, 0, 0);
3448 // Set extra descent for each line
3449 void wxStyledTextCtrl::SetExtraDescent(int extraDescent
)
3451 SendMsg(2527, extraDescent
, 0);
3454 // Get extra descent for each line
3455 int wxStyledTextCtrl::GetExtraDescent() const
3457 return SendMsg(2528, 0, 0);
3460 // Which symbol was defined for markerNumber with MarkerDefine
3461 int wxStyledTextCtrl::GetMarkerSymbolDefined(int markerNumber
)
3463 return SendMsg(2529, markerNumber
, 0);
3466 // Set the text in the text margin for a line
3467 void wxStyledTextCtrl::MarginSetText(int line
, const wxString
& text
)
3469 SendMsg(2530, line
, (sptr_t
)(const char*)wx2stc(text
));
3472 // Get the text in the text margin for a line
3473 wxString
wxStyledTextCtrl::MarginGetText(int line
) const {
3475 long len
= SendMsg(msg
, line
, 0);
3477 wxMemoryBuffer
mbuf(len
+1);
3478 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3479 SendMsg(msg
, line
, (sptr_t
)buf
);
3480 mbuf
.UngetWriteBuf(len
);
3485 // Set the style number for the text margin for a line
3486 void wxStyledTextCtrl::MarginSetStyle(int line
, int style
)
3488 SendMsg(2532, line
, style
);
3491 // Get the style number for the text margin for a line
3492 int wxStyledTextCtrl::MarginGetStyle(int line
) const
3494 return SendMsg(2533, line
, 0);
3497 // Set the style in the text margin for a line
3498 void wxStyledTextCtrl::MarginSetStyles(int line
, const wxString
& styles
)
3500 SendMsg(2534, line
, (sptr_t
)(const char*)wx2stc(styles
));
3503 // Get the styles in the text margin for a line
3504 wxString
wxStyledTextCtrl::MarginGetStyles(int line
) const {
3506 long len
= SendMsg(msg
, line
, 0);
3508 wxMemoryBuffer
mbuf(len
+1);
3509 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3510 SendMsg(msg
, line
, (sptr_t
)buf
);
3511 mbuf
.UngetWriteBuf(len
);
3516 // Clear the margin text on all lines
3517 void wxStyledTextCtrl::MarginTextClearAll()
3519 SendMsg(2536, 0, 0);
3522 // Get the start of the range of style numbers used for margin text
3523 void wxStyledTextCtrl::MarginSetStyleOffset(int style
)
3525 SendMsg(2537, style
, 0);
3528 // Get the start of the range of style numbers used for margin text
3529 int wxStyledTextCtrl::MarginGetStyleOffset() const
3531 return SendMsg(2538, 0, 0);
3534 // Set the margin options.
3535 void wxStyledTextCtrl::SetMarginOptions(int marginOptions
)
3537 SendMsg(2539, marginOptions
, 0);
3540 // Get the margin options.
3541 int wxStyledTextCtrl::GetMarginOptions() const
3543 return SendMsg(2557, 0, 0);
3546 // Set the annotation text for a line
3547 void wxStyledTextCtrl::AnnotationSetText(int line
, const wxString
& text
)
3549 SendMsg(2540, line
, (sptr_t
)(const char*)wx2stc(text
));
3552 // Get the annotation text for a line
3553 wxString
wxStyledTextCtrl::AnnotationGetText(int line
) const {
3555 long len
= SendMsg(msg
, line
, 0);
3557 wxMemoryBuffer
mbuf(len
+1);
3558 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3559 SendMsg(msg
, line
, (sptr_t
)buf
);
3560 mbuf
.UngetWriteBuf(len
);
3565 // Set the style number for the annotations for a line
3566 void wxStyledTextCtrl::AnnotationSetStyle(int line
, int style
)
3568 SendMsg(2542, line
, style
);
3571 // Get the style number for the annotations for a line
3572 int wxStyledTextCtrl::AnnotationGetStyle(int line
) const
3574 return SendMsg(2543, line
, 0);
3577 // Set the annotation styles for a line
3578 void wxStyledTextCtrl::AnnotationSetStyles(int line
, const wxString
& styles
)
3580 SendMsg(2544, line
, (sptr_t
)(const char*)wx2stc(styles
));
3583 // Get the annotation styles for a line
3584 wxString
wxStyledTextCtrl::AnnotationGetStyles(int line
) const {
3586 long len
= SendMsg(msg
, line
, 0);
3588 wxMemoryBuffer
mbuf(len
+1);
3589 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3590 SendMsg(msg
, line
, (sptr_t
)buf
);
3591 mbuf
.UngetWriteBuf(len
);
3596 // Get the number of annotation lines for a line
3597 int wxStyledTextCtrl::AnnotationGetLines(int line
) const
3599 return SendMsg(2546, line
, 0);
3602 // Clear the annotations from all lines
3603 void wxStyledTextCtrl::AnnotationClearAll()
3605 SendMsg(2547, 0, 0);
3608 // Set the visibility for the annotations for a view
3609 void wxStyledTextCtrl::AnnotationSetVisible(int visible
)
3611 SendMsg(2548, visible
, 0);
3614 // Get the visibility for the annotations for a view
3615 int wxStyledTextCtrl::AnnotationGetVisible() const
3617 return SendMsg(2549, 0, 0);
3620 // Get the start of the range of style numbers used for annotations
3621 void wxStyledTextCtrl::AnnotationSetStyleOffset(int style
)
3623 SendMsg(2550, style
, 0);
3626 // Get the start of the range of style numbers used for annotations
3627 int wxStyledTextCtrl::AnnotationGetStyleOffset() const
3629 return SendMsg(2551, 0, 0);
3632 // Add a container action to the undo stack
3633 void wxStyledTextCtrl::AddUndoAction(int token
, int flags
)
3635 SendMsg(2560, token
, flags
);
3638 // Find the position of a character from a point within the window.
3639 int wxStyledTextCtrl::CharPositionFromPoint(int x
, int y
)
3641 return SendMsg(2561, x
, y
);
3644 // Find the position of a character from a point within the window.
3645 // Return INVALID_POSITION if not close to text.
3646 int wxStyledTextCtrl::CharPositionFromPointClose(int x
, int y
)
3648 return SendMsg(2562, x
, y
);
3651 // Set whether multiple selections can be made
3652 void wxStyledTextCtrl::SetMultipleSelection(bool multipleSelection
)
3654 SendMsg(2563, multipleSelection
, 0);
3657 // Whether multiple selections can be made
3658 bool wxStyledTextCtrl::GetMultipleSelection() const
3660 return SendMsg(2564, 0, 0) != 0;
3663 // Set whether typing can be performed into multiple selections
3664 void wxStyledTextCtrl::SetAdditionalSelectionTyping(bool additionalSelectionTyping
)
3666 SendMsg(2565, additionalSelectionTyping
, 0);
3669 // Whether typing can be performed into multiple selections
3670 bool wxStyledTextCtrl::GetAdditionalSelectionTyping() const
3672 return SendMsg(2566, 0, 0) != 0;
3675 // Set whether additional carets will blink
3676 void wxStyledTextCtrl::SetAdditionalCaretsBlink(bool additionalCaretsBlink
)
3678 SendMsg(2567, additionalCaretsBlink
, 0);
3681 // Whether additional carets will blink
3682 bool wxStyledTextCtrl::GetAdditionalCaretsBlink() const
3684 return SendMsg(2568, 0, 0) != 0;
3687 // Set whether additional carets are visible
3688 void wxStyledTextCtrl::SetAdditionalCaretsVisible(bool additionalCaretsBlink
)
3690 SendMsg(2608, additionalCaretsBlink
, 0);
3693 // Whether additional carets are visible
3694 bool wxStyledTextCtrl::GetAdditionalCaretsVisible() const
3696 return SendMsg(2609, 0, 0) != 0;
3699 // How many selections are there?
3700 int wxStyledTextCtrl::GetSelections() const
3702 return SendMsg(2570, 0, 0);
3705 // Clear selections to a single empty stream selection
3706 void wxStyledTextCtrl::ClearSelections()
3708 SendMsg(2571, 0, 0);
3712 int wxStyledTextCtrl::AddSelection(int caret
, int anchor
)
3714 return SendMsg(2573, caret
, anchor
);
3717 // Set the main selection
3718 void wxStyledTextCtrl::SetMainSelection(int selection
)
3720 SendMsg(2574, selection
, 0);
3723 // Which selection is the main selection
3724 int wxStyledTextCtrl::GetMainSelection() const
3726 return SendMsg(2575, 0, 0);
3728 void wxStyledTextCtrl::SetSelectionNCaret(int selection
, int pos
)
3730 SendMsg(2576, selection
, pos
);
3732 int wxStyledTextCtrl::GetSelectionNCaret(int selection
) const
3734 return SendMsg(2577, selection
, 0);
3736 void wxStyledTextCtrl::SetSelectionNAnchor(int selection
, int posAnchor
)
3738 SendMsg(2578, selection
, posAnchor
);
3740 int wxStyledTextCtrl::GetSelectionNAnchor(int selection
) const
3742 return SendMsg(2579, selection
, 0);
3744 void wxStyledTextCtrl::SetSelectionNCaretVirtualSpace(int selection
, int space
)
3746 SendMsg(2580, selection
, space
);
3748 int wxStyledTextCtrl::GetSelectionNCaretVirtualSpace(int selection
) const
3750 return SendMsg(2581, selection
, 0);
3752 void wxStyledTextCtrl::SetSelectionNAnchorVirtualSpace(int selection
, int space
)
3754 SendMsg(2582, selection
, space
);
3756 int wxStyledTextCtrl::GetSelectionNAnchorVirtualSpace(int selection
) const
3758 return SendMsg(2583, selection
, 0);
3761 // Sets the position that starts the selection - this becomes the anchor.
3762 void wxStyledTextCtrl::SetSelectionNStart(int selection
, int pos
)
3764 SendMsg(2584, selection
, pos
);
3767 // Returns the position at the start of the selection.
3768 int wxStyledTextCtrl::GetSelectionNStart(int selection
) const
3770 return SendMsg(2585, selection
, 0);
3773 // Sets the position that ends the selection - this becomes the currentPosition.
3774 void wxStyledTextCtrl::SetSelectionNEnd(int selection
, int pos
)
3776 SendMsg(2586, selection
, pos
);
3779 // Returns the position at the end of the selection.
3780 int wxStyledTextCtrl::GetSelectionNEnd(int selection
) const
3782 return SendMsg(2587, selection
, 0);
3784 void wxStyledTextCtrl::SetRectangularSelectionCaret(int pos
)
3786 SendMsg(2588, pos
, 0);
3788 int wxStyledTextCtrl::GetRectangularSelectionCaret() const
3790 return SendMsg(2589, 0, 0);
3792 void wxStyledTextCtrl::SetRectangularSelectionAnchor(int posAnchor
)
3794 SendMsg(2590, posAnchor
, 0);
3796 int wxStyledTextCtrl::GetRectangularSelectionAnchor() const
3798 return SendMsg(2591, 0, 0);
3800 void wxStyledTextCtrl::SetRectangularSelectionCaretVirtualSpace(int space
)
3802 SendMsg(2592, space
, 0);
3804 int wxStyledTextCtrl::GetRectangularSelectionCaretVirtualSpace() const
3806 return SendMsg(2593, 0, 0);
3808 void wxStyledTextCtrl::SetRectangularSelectionAnchorVirtualSpace(int space
)
3810 SendMsg(2594, space
, 0);
3812 int wxStyledTextCtrl::GetRectangularSelectionAnchorVirtualSpace() const
3814 return SendMsg(2595, 0, 0);
3816 void wxStyledTextCtrl::SetVirtualSpaceOptions(int virtualSpaceOptions
)
3818 SendMsg(2596, virtualSpaceOptions
, 0);
3820 int wxStyledTextCtrl::GetVirtualSpaceOptions() const
3822 return SendMsg(2597, 0, 0);
3825 // On GTK+, allow selecting the modifier key to use for mouse-based
3826 // rectangular selection. Often the window manager requires Alt+Mouse Drag
3827 // for moving windows.
3828 // Valid values are SCMOD_CTRL(default), SCMOD_ALT, or SCMOD_SUPER.
3829 void wxStyledTextCtrl::SetRectangularSelectionModifier(int modifier
)
3831 SendMsg(2598, modifier
, 0);
3834 // Get the modifier key used for rectangular selection.
3835 int wxStyledTextCtrl::GetRectangularSelectionModifier() const
3837 return SendMsg(2599, 0, 0);
3840 // Set the foreground colour of additional selections.
3841 // Must have previously called SetSelFore with non-zero first argument for this to have an effect.
3842 void wxStyledTextCtrl::SetAdditionalSelForeground(const wxColour
& fore
)
3844 SendMsg(2600, wxColourAsLong(fore
), 0);
3847 // Set the background colour of additional selections.
3848 // Must have previously called SetSelBack with non-zero first argument for this to have an effect.
3849 void wxStyledTextCtrl::SetAdditionalSelBackground(const wxColour
& back
)
3851 SendMsg(2601, wxColourAsLong(back
), 0);
3854 // Set the alpha of the selection.
3855 void wxStyledTextCtrl::SetAdditionalSelAlpha(int alpha
)
3857 SendMsg(2602, alpha
, 0);
3860 // Get the alpha of the selection.
3861 int wxStyledTextCtrl::GetAdditionalSelAlpha() const
3863 return SendMsg(2603, 0, 0);
3866 // Set the foreground colour of additional carets.
3867 void wxStyledTextCtrl::SetAdditionalCaretForeground(const wxColour
& fore
)
3869 SendMsg(2604, wxColourAsLong(fore
), 0);
3872 // Get the foreground colour of additional carets.
3873 wxColour
wxStyledTextCtrl::GetAdditionalCaretForeground() const
3875 long c
= SendMsg(2605, 0, 0);
3876 return wxColourFromLong(c
);
3879 // Set the main selection to the next selection.
3880 void wxStyledTextCtrl::RotateSelection()
3882 SendMsg(2606, 0, 0);
3885 // Swap that caret and anchor of the main selection.
3886 void wxStyledTextCtrl::SwapMainAnchorCaret()
3888 SendMsg(2607, 0, 0);
3891 // Indicate that the internal state of a lexer has changed over a range and therefore
3892 // there may be a need to redraw.
3893 int wxStyledTextCtrl::ChangeLexerState(int start
, int end
)
3895 return SendMsg(2617, start
, end
);
3898 // Find the next line at or after lineStart that is a contracted fold header line.
3899 // Return -1 when no more lines.
3900 int wxStyledTextCtrl::ContractedFoldNext(int lineStart
)
3902 return SendMsg(2618, lineStart
, 0);
3905 // Centre current line in window.
3906 void wxStyledTextCtrl::VerticalCentreCaret()
3908 SendMsg(2619, 0, 0);
3911 // Move the selected lines up one line, shifting the line above after the selection
3912 void wxStyledTextCtrl::MoveSelectedLinesUp()
3914 SendMsg(2620, 0, 0);
3917 // Move the selected lines down one line, shifting the line below before the selection
3918 void wxStyledTextCtrl::MoveSelectedLinesDown()
3920 SendMsg(2621, 0, 0);
3923 // Set the identifier reported as idFrom in notification messages.
3924 void wxStyledTextCtrl::SetIdentifier(int identifier
)
3926 SendMsg(2622, identifier
, 0);
3929 // Get the identifier.
3930 int wxStyledTextCtrl::GetIdentifier() const
3932 return SendMsg(2623, 0, 0);
3935 // Set the width for future RGBA image data.
3936 void wxStyledTextCtrl::RGBAImageSetWidth(int width
)
3938 SendMsg(2624, width
, 0);
3941 // Set the height for future RGBA image data.
3942 void wxStyledTextCtrl::RGBAImageSetHeight(int height
)
3944 SendMsg(2625, height
, 0);
3947 // Define a marker from RGBA data.
3948 // It has the width and height from RGBAImageSetWidth/Height
3949 void wxStyledTextCtrl::MarkerDefineRGBAImage(int markerNumber
, const unsigned char* pixels
) {
3950 SendMsg(2626, markerNumber
, (sptr_t
)pixels
);
3953 // Register an RGBA image for use in autocompletion lists.
3954 // It has the width and height from RGBAImageSetWidth/Height
3955 void wxStyledTextCtrl::RegisterRGBAImage(int type
, const unsigned char* pixels
) {
3956 SendMsg(2627, type
, (sptr_t
)pixels
);
3959 // Scroll to start of document.
3960 void wxStyledTextCtrl::ScrollToStart()
3962 SendMsg(2628, 0, 0);
3965 // Scroll to end of document.
3966 void wxStyledTextCtrl::ScrollToEnd()
3968 SendMsg(2629, 0, 0);
3971 // Set the technology used.
3972 void wxStyledTextCtrl::SetTechnology(int technology
)
3974 SendMsg(2630, technology
, 0);
3978 int wxStyledTextCtrl::GetTechnology() const
3980 return SendMsg(2631, 0, 0);
3983 // Create an ILoader*.
3984 void* wxStyledTextCtrl::CreateLoader(int bytes
) const {
3985 return (void*)(sptr_t
)SendMsg(2632, bytes
);
3988 // Start notifying the container of all key presses and commands.
3989 void wxStyledTextCtrl::StartRecord()
3991 SendMsg(3001, 0, 0);
3994 // Stop notifying the container of all key presses and commands.
3995 void wxStyledTextCtrl::StopRecord()
3997 SendMsg(3002, 0, 0);
4000 // Set the lexing language of the document.
4001 void wxStyledTextCtrl::SetLexer(int lexer
)
4003 SendMsg(4001, lexer
, 0);
4006 // Retrieve the lexing language of the document.
4007 int wxStyledTextCtrl::GetLexer() const
4009 return SendMsg(4002, 0, 0);
4012 // Colourise a segment of the document using the current lexing language.
4013 void wxStyledTextCtrl::Colourise(int start
, int end
)
4015 SendMsg(4003, start
, end
);
4018 // Set up a value that may be used by a lexer for some optional feature.
4019 void wxStyledTextCtrl::SetProperty(const wxString
& key
, const wxString
& value
)
4021 SendMsg(4004, (sptr_t
)(const char*)wx2stc(key
), (sptr_t
)(const char*)wx2stc(value
));
4024 // Set up the key words used by the lexer.
4025 void wxStyledTextCtrl::SetKeyWords(int keywordSet
, const wxString
& keyWords
)
4027 SendMsg(4005, keywordSet
, (sptr_t
)(const char*)wx2stc(keyWords
));
4030 // Set the lexing language of the document based on string name.
4031 void wxStyledTextCtrl::SetLexerLanguage(const wxString
& language
)
4033 SendMsg(4006, 0, (sptr_t
)(const char*)wx2stc(language
));
4036 // Retrieve a 'property' value previously set with SetProperty.
4037 wxString
wxStyledTextCtrl::GetProperty(const wxString
& key
) {
4038 int len
= SendMsg(SCI_GETPROPERTY
, (sptr_t
)(const char*)wx2stc(key
), 0);
4039 if (!len
) return wxEmptyString
;
4041 wxMemoryBuffer
mbuf(len
+1);
4042 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
4043 SendMsg(4008, (uptr_t
)(const char*)wx2stc(key
), (sptr_t
)buf
);
4044 mbuf
.UngetWriteBuf(len
);
4049 // Retrieve a 'property' value previously set with SetProperty,
4050 // with '$()' variable replacement on returned buffer.
4051 wxString
wxStyledTextCtrl::GetPropertyExpanded(const wxString
& key
) {
4052 int len
= SendMsg(SCI_GETPROPERTYEXPANDED
, (uptr_t
)(const char*)wx2stc(key
), 0);
4053 if (!len
) return wxEmptyString
;
4055 wxMemoryBuffer
mbuf(len
+1);
4056 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
4057 SendMsg(4009, (uptr_t
)(const char*)wx2stc(key
), (sptr_t
)buf
);
4058 mbuf
.UngetWriteBuf(len
);
4063 // Retrieve a 'property' value previously set with SetProperty,
4064 // interpreted as an int AFTER any '$()' variable replacement.
4065 int wxStyledTextCtrl::GetPropertyInt(const wxString
& key
) const
4067 return SendMsg(4010, (sptr_t
)(const char*)wx2stc(key
), 0);
4070 // Retrieve the number of bits the current lexer needs for styling.
4071 int wxStyledTextCtrl::GetStyleBitsNeeded() const
4073 return SendMsg(4011, 0, 0);
4076 // For private communication between an application and a known lexer.
4077 void* wxStyledTextCtrl::PrivateLexerCall(int operation
, void* pointer
) {
4078 return (void*)(sptr_t
)SendMsg(4013, operation
, (sptr_t
)pointer
);
4081 // Retrieve a '\n' separated list of properties understood by the current lexer.
4082 wxString
wxStyledTextCtrl::PropertyNames() const {
4084 int len
= SendMsg(msg
, 0, (sptr_t
)NULL
);
4085 if (!len
) return wxEmptyString
;
4087 wxMemoryBuffer
mbuf(len
+1);
4088 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
4089 SendMsg(msg
, 0, (sptr_t
)buf
);
4090 mbuf
.UngetWriteBuf(len
);
4095 // Retrieve the type of a property.
4096 int wxStyledTextCtrl::PropertyType(const wxString
& name
)
4098 return SendMsg(4015, (sptr_t
)(const char*)wx2stc(name
), 0);
4101 // Describe a property.
4102 wxString
wxStyledTextCtrl::DescribeProperty(const wxString
& name
) const {
4104 int len
= SendMsg(msg
, (sptr_t
)(const char*)wx2stc(name
), (sptr_t
)NULL
);
4105 if (!len
) return wxEmptyString
;
4107 wxMemoryBuffer
mbuf(len
+1);
4108 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
4109 SendMsg(msg
, (sptr_t
)(const char*)wx2stc(name
), (sptr_t
)buf
);
4110 mbuf
.UngetWriteBuf(len
);
4115 // Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer.
4116 wxString
wxStyledTextCtrl::DescribeKeyWordSets() const {
4118 int len
= SendMsg(msg
, 0, (sptr_t
)NULL
);
4119 if (!len
) return wxEmptyString
;
4121 wxMemoryBuffer
mbuf(len
+1);
4122 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
4123 SendMsg(msg
, 0, (sptr_t
)buf
);
4124 mbuf
.UngetWriteBuf(len
);
4130 //----------------------------------------------------------------------
4133 // Returns the line number of the line with the caret.
4134 int wxStyledTextCtrl::GetCurrentLine() {
4135 int line
= LineFromPosition(GetCurrentPos());
4140 // Extract style settings from a spec-string which is composed of one or
4141 // more of the following comma separated elements:
4143 // bold turns on bold
4144 // italic turns on italics
4145 // fore:[name or #RRGGBB] sets the foreground colour
4146 // back:[name or #RRGGBB] sets the background colour
4147 // face:[facename] sets the font face name to use
4148 // size:[num] sets the font size in points
4149 // eol turns on eol filling
4150 // underline turns on underlining
4152 void wxStyledTextCtrl::StyleSetSpec(int styleNum
, const wxString
& spec
) {
4154 wxStringTokenizer
tkz(spec
, wxT(","));
4155 while (tkz
.HasMoreTokens()) {
4156 wxString token
= tkz
.GetNextToken();
4158 wxString option
= token
.BeforeFirst(':');
4159 wxString val
= token
.AfterFirst(':');
4161 if (option
== wxT("bold"))
4162 StyleSetBold(styleNum
, true);
4164 else if (option
== wxT("italic"))
4165 StyleSetItalic(styleNum
, true);
4167 else if (option
== wxT("underline"))
4168 StyleSetUnderline(styleNum
, true);
4170 else if (option
== wxT("eol"))
4171 StyleSetEOLFilled(styleNum
, true);
4173 else if (option
== wxT("size")) {
4175 if (val
.ToLong(&points
))
4176 StyleSetSize(styleNum
, points
);
4179 else if (option
== wxT("face"))
4180 StyleSetFaceName(styleNum
, val
);
4182 else if (option
== wxT("fore"))
4183 StyleSetForeground(styleNum
, wxColourFromSpec(val
));
4185 else if (option
== wxT("back"))
4186 StyleSetBackground(styleNum
, wxColourFromSpec(val
));
4191 // Get the font of a style
4192 wxFont
wxStyledTextCtrl::StyleGetFont(int style
) {
4194 font
.SetPointSize(StyleGetSize(style
));
4195 font
.SetFaceName(StyleGetFaceName(style
));
4196 if( StyleGetBold(style
) )
4197 font
.SetWeight(wxFONTWEIGHT_BOLD
);
4199 font
.SetWeight(wxFONTWEIGHT_NORMAL
);
4201 if( StyleGetItalic(style
) )
4202 font
.SetStyle(wxFONTSTYLE_ITALIC
);
4204 font
.SetStyle(wxFONTSTYLE_NORMAL
);
4210 // Set style size, face, bold, italic, and underline attributes from
4211 // a wxFont's attributes.
4212 void wxStyledTextCtrl::StyleSetFont(int styleNum
, wxFont
& font
) {
4214 // Ensure that the native font is initialized
4216 GetTextExtent(wxT("X"), &x
, &y
, NULL
, NULL
, &font
);
4218 int size
= font
.GetPointSize();
4219 wxString faceName
= font
.GetFaceName();
4220 bool bold
= font
.GetWeight() == wxBOLD
;
4221 bool italic
= font
.GetStyle() != wxNORMAL
;
4222 bool under
= font
.GetUnderlined();
4223 wxFontEncoding encoding
= font
.GetEncoding();
4225 StyleSetFontAttr(styleNum
, size
, faceName
, bold
, italic
, under
, encoding
);
4228 // Set all font style attributes at once.
4229 void wxStyledTextCtrl::StyleSetFontAttr(int styleNum
, int size
,
4230 const wxString
& faceName
,
4231 bool bold
, bool italic
,
4233 wxFontEncoding encoding
) {
4234 StyleSetSize(styleNum
, size
);
4235 StyleSetFaceName(styleNum
, faceName
);
4236 StyleSetBold(styleNum
, bold
);
4237 StyleSetItalic(styleNum
, italic
);
4238 StyleSetUnderline(styleNum
, underline
);
4239 StyleSetFontEncoding(styleNum
, encoding
);
4243 // Set the character set of the font in a style. Converts the Scintilla
4244 // character set values to a wxFontEncoding.
4245 void wxStyledTextCtrl::StyleSetCharacterSet(int style
, int characterSet
)
4247 wxFontEncoding encoding
;
4249 // Translate the Scintilla characterSet to a wxFontEncoding
4250 switch (characterSet
) {
4252 case wxSTC_CHARSET_ANSI
:
4253 case wxSTC_CHARSET_DEFAULT
:
4254 encoding
= wxFONTENCODING_DEFAULT
;
4257 case wxSTC_CHARSET_BALTIC
:
4258 encoding
= wxFONTENCODING_ISO8859_13
;
4261 case wxSTC_CHARSET_CHINESEBIG5
:
4262 encoding
= wxFONTENCODING_CP950
;
4265 case wxSTC_CHARSET_EASTEUROPE
:
4266 encoding
= wxFONTENCODING_ISO8859_2
;
4269 case wxSTC_CHARSET_GB2312
:
4270 encoding
= wxFONTENCODING_CP936
;
4273 case wxSTC_CHARSET_GREEK
:
4274 encoding
= wxFONTENCODING_ISO8859_7
;
4277 case wxSTC_CHARSET_HANGUL
:
4278 encoding
= wxFONTENCODING_CP949
;
4281 case wxSTC_CHARSET_MAC
:
4282 encoding
= wxFONTENCODING_DEFAULT
;
4285 case wxSTC_CHARSET_OEM
:
4286 encoding
= wxFONTENCODING_DEFAULT
;
4289 case wxSTC_CHARSET_RUSSIAN
:
4290 encoding
= wxFONTENCODING_KOI8
;
4293 case wxSTC_CHARSET_SHIFTJIS
:
4294 encoding
= wxFONTENCODING_CP932
;
4297 case wxSTC_CHARSET_SYMBOL
:
4298 encoding
= wxFONTENCODING_DEFAULT
;
4301 case wxSTC_CHARSET_TURKISH
:
4302 encoding
= wxFONTENCODING_ISO8859_9
;
4305 case wxSTC_CHARSET_JOHAB
:
4306 encoding
= wxFONTENCODING_DEFAULT
;
4309 case wxSTC_CHARSET_HEBREW
:
4310 encoding
= wxFONTENCODING_ISO8859_8
;
4313 case wxSTC_CHARSET_ARABIC
:
4314 encoding
= wxFONTENCODING_ISO8859_6
;
4317 case wxSTC_CHARSET_VIETNAMESE
:
4318 encoding
= wxFONTENCODING_DEFAULT
;
4321 case wxSTC_CHARSET_THAI
:
4322 encoding
= wxFONTENCODING_ISO8859_11
;
4325 case wxSTC_CHARSET_CYRILLIC
:
4326 encoding
= wxFONTENCODING_ISO8859_5
;
4329 case wxSTC_CHARSET_8859_15
:
4330 encoding
= wxFONTENCODING_ISO8859_15
;;
4334 // We just have Scintilla track the wxFontEncoding for us. It gets used
4335 // in Font::Create in PlatWX.cpp. We add one to the value so that the
4336 // effective wxFONENCODING_DEFAULT == SC_SHARSET_DEFAULT and so when
4337 // Scintilla internally uses SC_CHARSET_DEFAULT we will translate it back
4338 // to wxFONENCODING_DEFAULT in Font::Create.
4339 SendMsg(SCI_STYLESETCHARACTERSET
, style
, encoding
+1);
4343 // Set the font encoding to be used by a style.
4344 void wxStyledTextCtrl::StyleSetFontEncoding(int style
, wxFontEncoding encoding
)
4346 SendMsg(SCI_STYLESETCHARACTERSET
, style
, encoding
+1);
4350 // Perform one of the operations defined by the wxSTC_CMD_* constants.
4351 void wxStyledTextCtrl::CmdKeyExecute(int cmd
) {
4356 // Set the left and right margin in the edit area, measured in pixels.
4357 void wxStyledTextCtrl::SetMargins(int left
, int right
) {
4358 SetMarginLeft(left
);
4359 SetMarginRight(right
);
4363 // Retrieve the point in the window where a position is displayed.
4364 wxPoint
wxStyledTextCtrl::PointFromPosition(int pos
) {
4365 int x
= SendMsg(SCI_POINTXFROMPOSITION
, 0, pos
);
4366 int y
= SendMsg(SCI_POINTYFROMPOSITION
, 0, pos
);
4367 return wxPoint(x
, y
);
4370 // Scroll enough to make the given line visible
4371 void wxStyledTextCtrl::ScrollToLine(int line
) {
4372 m_swx
->DoScrollToLine(line
);
4376 // Scroll enough to make the given column visible
4377 void wxStyledTextCtrl::ScrollToColumn(int column
) {
4378 m_swx
->DoScrollToColumn(column
);
4382 void wxStyledTextCtrl::DoSetValue(const wxString
& value
, int flags
)
4384 if ( flags
& SetValue_SelectionOnly
)
4385 ReplaceSelection(value
);
4389 // We don't send wxEVT_TEXT anyhow, so ignore the
4390 // SetValue_SendEvent bit of the flags
4394 wxStyledTextCtrl::DoSaveFile(const wxString
& filename
, int WXUNUSED(fileType
))
4396 #if wxUSE_FFILE || wxUSE_FILE
4399 // Take care to use "b" to ensure that possibly non-native EOLs in the file
4400 // contents are not mangled when saving it.
4401 wxFFile
file(filename
, wxS("wb"));
4403 wxFile
file(filename
, wxFile::write
);
4406 if ( file
.IsOpened() && file
.Write(GetValue(), *wxConvCurrent
) )
4413 #endif // !wxUSE_FFILE && !wxUSE_FILE
4419 wxStyledTextCtrl::DoLoadFile(const wxString
& filename
, int WXUNUSED(fileType
))
4421 #if wxUSE_FFILE || wxUSE_FILE
4424 // As above, we want to read the real EOLs from the file, e.g. without
4425 // translating them to just LFs under Windows, so that the original CR LF
4426 // are preserved when it's written back.
4427 wxFFile
file(filename
, wxS("rb"));
4429 wxFile
file(filename
);
4432 if ( file
.IsOpened() )
4435 if ( file
.ReadAll(&text
, wxConvAuto()) )
4437 // Detect the EOL: we use just the first line because there is not
4438 // much we can do if the file uses inconsistent EOLs anyhow, we'd
4439 // need to ask the user about the one we should really use and we
4440 // don't currently provide a way to do it.
4442 // We also only check for Unix and DOS EOLs but not classic Mac
4443 // CR-only one as it's obsolete by now.
4444 const wxString::size_type posLF
= text
.find('\n');
4445 if ( posLF
!= wxString::npos
)
4447 // Set EOL mode to ensure that the new lines inserted into the
4448 // text use the same EOLs as the existing ones.
4449 if ( posLF
> 0 && text
[posLF
- 1] == '\r' )
4450 SetEOLMode(wxSTC_EOL_CRLF
);
4452 SetEOLMode(wxSTC_EOL_LF
);
4454 //else: Use the default EOL for the current platform.
4463 #endif // !wxUSE_FFILE && !wxUSE_FILE
4468 // If we don't derive from wxTextAreaBase, we need to implement these methods
4469 // ourselves, otherwise we already inherit them.
4472 bool wxStyledTextCtrl::SaveFile(const wxString
& filename
)
4474 if ( filename
.empty() )
4477 return DoSaveFile(filename
, wxTEXT_TYPE_ANY
);
4480 bool wxStyledTextCtrl::LoadFile(const wxString
& filename
)
4482 if ( filename
.empty() )
4485 return DoLoadFile(filename
, wxTEXT_TYPE_ANY
);
4488 #endif // !wxUSE_TEXTCTRL
4490 #if wxUSE_DRAG_AND_DROP
4491 wxDragResult
wxStyledTextCtrl::DoDragOver(wxCoord x
, wxCoord y
, wxDragResult def
) {
4492 return m_swx
->DoDragOver(x
, y
, def
);
4496 bool wxStyledTextCtrl::DoDropText(long x
, long y
, const wxString
& data
) {
4497 return m_swx
->DoDropText(x
, y
, data
);
4502 void wxStyledTextCtrl::SetUseAntiAliasing(bool useAA
) {
4503 m_swx
->SetUseAntiAliasing(useAA
);
4506 bool wxStyledTextCtrl::GetUseAntiAliasing() {
4507 return m_swx
->GetUseAntiAliasing();
4510 void wxStyledTextCtrl::AnnotationClearLine(int line
) {
4511 SendMsg(SCI_ANNOTATIONSETTEXT
, line
, (sptr_t
)NULL
);
4517 void wxStyledTextCtrl::AddTextRaw(const char* text
, int length
)
4520 length
= strlen(text
);
4521 SendMsg(SCI_ADDTEXT
, length
, (sptr_t
)text
);
4524 void wxStyledTextCtrl::InsertTextRaw(int pos
, const char* text
)
4526 SendMsg(SCI_INSERTTEXT
, pos
, (sptr_t
)text
);
4529 wxCharBuffer
wxStyledTextCtrl::GetCurLineRaw(int* linePos
)
4531 int len
= LineLength(GetCurrentLine());
4533 if (linePos
) *linePos
= 0;
4538 wxCharBuffer
buf(len
);
4539 int pos
= SendMsg(SCI_GETCURLINE
, len
, (sptr_t
)buf
.data());
4540 if (linePos
) *linePos
= pos
;
4544 wxCharBuffer
wxStyledTextCtrl::GetLineRaw(int line
)
4546 int len
= LineLength(line
);
4552 wxCharBuffer
buf(len
);
4553 SendMsg(SCI_GETLINE
, line
, (sptr_t
)buf
.data());
4557 wxCharBuffer
wxStyledTextCtrl::GetSelectedTextRaw()
4559 // Calculate the length needed first.
4560 const int len
= SendMsg(SCI_GETSELTEXT
, 0, (sptr_t
)0);
4562 // And then really get the data.
4563 wxCharBuffer
buf(len
);
4564 SendMsg(SCI_GETSELTEXT
, 0, (sptr_t
)buf
.data());
4568 wxCharBuffer
wxStyledTextCtrl::GetTextRangeRaw(int startPos
, int endPos
)
4570 if (endPos
< startPos
) {
4571 int temp
= startPos
;
4575 int len
= endPos
- startPos
;
4581 wxCharBuffer
buf(len
);
4583 tr
.lpstrText
= buf
.data();
4584 tr
.chrg
.cpMin
= startPos
;
4585 tr
.chrg
.cpMax
= endPos
;
4586 SendMsg(SCI_GETTEXTRANGE
, 0, (sptr_t
)&tr
);
4590 void wxStyledTextCtrl::SetTextRaw(const char* text
)
4592 SendMsg(SCI_SETTEXT
, 0, (sptr_t
)text
);
4595 wxCharBuffer
wxStyledTextCtrl::GetTextRaw()
4597 int len
= GetTextLength();
4598 wxCharBuffer
buf(len
); // adds 1 for NUL automatically
4599 SendMsg(SCI_GETTEXT
, len
+ 1, (sptr_t
)buf
.data());
4603 void wxStyledTextCtrl::AppendTextRaw(const char* text
, int length
)
4606 length
= strlen(text
);
4607 SendMsg(SCI_APPENDTEXT
, length
, (sptr_t
)text
);
4614 //----------------------------------------------------------------------
4617 void wxStyledTextCtrl::OnPaint(wxPaintEvent
& WXUNUSED(evt
)) {
4619 wxBufferedPaintDC
dc(this);
4623 m_swx
->DoPaint(&dc
, GetUpdateRegion().GetBox());
4626 void wxStyledTextCtrl::OnScrollWin(wxScrollWinEvent
& evt
) {
4627 if (evt
.GetOrientation() == wxHORIZONTAL
)
4628 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
4630 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
4633 void wxStyledTextCtrl::OnScroll(wxScrollEvent
& evt
) {
4634 wxScrollBar
* sb
= wxDynamicCast(evt
.GetEventObject(), wxScrollBar
);
4636 if (sb
->IsVertical())
4637 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
4639 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
4643 void wxStyledTextCtrl::OnSize(wxSizeEvent
& WXUNUSED(evt
)) {
4645 wxSize sz
= GetClientSize();
4646 m_swx
->DoSize(sz
.x
, sz
.y
);
4650 void wxStyledTextCtrl::OnMouseLeftDown(wxMouseEvent
& evt
) {
4652 wxPoint pt
= evt
.GetPosition();
4653 m_swx
->DoLeftButtonDown(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
4654 evt
.ShiftDown(), evt
.ControlDown(), evt
.AltDown());
4657 void wxStyledTextCtrl::OnMouseMove(wxMouseEvent
& evt
) {
4658 wxPoint pt
= evt
.GetPosition();
4659 m_swx
->DoLeftButtonMove(Point(pt
.x
, pt
.y
));
4662 void wxStyledTextCtrl::OnMouseLeftUp(wxMouseEvent
& evt
) {
4663 wxPoint pt
= evt
.GetPosition();
4664 m_swx
->DoLeftButtonUp(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
4669 void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent
& evt
) {
4670 wxPoint pt
= evt
.GetPosition();
4671 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
4675 void wxStyledTextCtrl::OnMouseMiddleUp(wxMouseEvent
& evt
) {
4676 wxPoint pt
= evt
.GetPosition();
4677 m_swx
->DoMiddleButtonUp(Point(pt
.x
, pt
.y
));
4680 void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent
& evt
) {
4681 wxPoint pt
= evt
.GetPosition();
4682 ScreenToClient(&pt
.x
, &pt
.y
);
4684 Show context menu at event point if it's within the window,
4685 or at caret location if not
4687 wxHitTest ht
= this->HitTest(pt
);
4688 if (ht
!= wxHT_WINDOW_INSIDE
) {
4689 pt
= this->PointFromPosition(this->GetCurrentPos());
4691 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
4695 void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent
& evt
)
4697 m_swx
->DoMouseWheel(evt
.GetWheelAxis(),
4698 evt
.GetWheelRotation(),
4699 evt
.GetWheelDelta(),
4700 evt
.GetLinesPerAction(),
4701 evt
.GetColumnsPerAction(),
4703 evt
.IsPageScroll());
4707 void wxStyledTextCtrl::OnChar(wxKeyEvent
& evt
) {
4708 // On (some?) non-US PC keyboards the AltGr key is required to enter some
4709 // common characters. It comes to us as both Alt and Ctrl down so we need
4710 // to let the char through in that case, otherwise if only ctrl or only
4711 // alt let's skip it.
4712 bool ctrl
= evt
.ControlDown();
4714 // On the Mac the Alt key is just a modifier key (like Shift) so we need
4715 // to allow the char events to be processed when Alt is pressed.
4716 // TODO: Should we check MetaDown instead in this case?
4719 bool alt
= evt
.AltDown();
4721 bool skip
= ((ctrl
|| alt
) && ! (ctrl
&& alt
));
4724 // apparently if we don't do this, Unicode keys pressed after non-char
4725 // ASCII ones (e.g. Enter, Tab) are not taken into account (patch 1615989)
4726 if (m_lastKeyDownConsumed
&& evt
.GetUnicodeKey() > 255)
4727 m_lastKeyDownConsumed
= false;
4730 if (!m_lastKeyDownConsumed
&& !skip
) {
4732 int key
= evt
.GetUnicodeKey();
4735 // if the unicode key code is not really a unicode character (it may
4736 // be a function key or etc., the platforms appear to always give us a
4737 // small value in this case) then fallback to the ascii key code but
4738 // don't do anything for function keys or etc.
4740 key
= evt
.GetKeyCode();
4741 keyOk
= (key
<= 127);
4744 m_swx
->DoAddChar(key
);
4748 int key
= evt
.GetKeyCode();
4749 if (key
<= WXK_START
|| key
> WXK_COMMAND
) {
4750 m_swx
->DoAddChar(key
);
4760 void wxStyledTextCtrl::OnKeyDown(wxKeyEvent
& evt
) {
4761 int processed
= m_swx
->DoKeyDown(evt
, &m_lastKeyDownConsumed
);
4762 if (!processed
&& !m_lastKeyDownConsumed
)
4767 void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent
& evt
) {
4768 m_swx
->DoLoseFocus();
4773 void wxStyledTextCtrl::OnGainFocus(wxFocusEvent
& evt
) {
4774 m_swx
->DoGainFocus();
4779 void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent
& WXUNUSED(evt
)) {
4780 m_swx
->DoSysColourChange();
4784 void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent
& WXUNUSED(evt
)) {
4785 // do nothing to help avoid flashing
4790 void wxStyledTextCtrl::OnMenu(wxCommandEvent
& evt
) {
4791 m_swx
->DoCommand(evt
.GetId());
4795 void wxStyledTextCtrl::OnListBox(wxCommandEvent
& WXUNUSED(evt
)) {
4796 m_swx
->DoOnListBox();
4800 void wxStyledTextCtrl::OnIdle(wxIdleEvent
& evt
) {
4801 m_swx
->DoOnIdle(evt
);
4805 wxSize
wxStyledTextCtrl::DoGetBestSize() const
4807 // What would be the best size for a wxSTC?
4808 // Just give a reasonable minimum until something else can be figured out.
4809 return wxSize(200,100);
4813 //----------------------------------------------------------------------
4814 // Turn notifications from Scintilla into events
4817 void wxStyledTextCtrl::NotifyChange() {
4818 wxStyledTextEvent
evt(wxEVT_STC_CHANGE
, GetId());
4819 evt
.SetEventObject(this);
4820 GetEventHandler()->ProcessEvent(evt
);
4824 static void SetEventText(wxStyledTextEvent
& evt
, const char* text
,
4828 evt
.SetText(stc2wx(text
, length
));
4832 void wxStyledTextCtrl::NotifyParent(SCNotification
* _scn
) {
4833 SCNotification
& scn
= *_scn
;
4834 wxStyledTextEvent
evt(0, GetId());
4836 evt
.SetEventObject(this);
4837 evt
.SetPosition(scn
.position
);
4839 evt
.SetModifiers(scn
.modifiers
);
4841 switch (scn
.nmhdr
.code
) {
4842 case SCN_STYLENEEDED
:
4843 evt
.SetEventType(wxEVT_STC_STYLENEEDED
);
4847 evt
.SetEventType(wxEVT_STC_CHARADDED
);
4850 case SCN_SAVEPOINTREACHED
:
4851 evt
.SetEventType(wxEVT_STC_SAVEPOINTREACHED
);
4854 case SCN_SAVEPOINTLEFT
:
4855 evt
.SetEventType(wxEVT_STC_SAVEPOINTLEFT
);
4858 case SCN_MODIFYATTEMPTRO
:
4859 evt
.SetEventType(wxEVT_STC_ROMODIFYATTEMPT
);
4863 evt
.SetEventType(wxEVT_STC_KEY
);
4866 case SCN_DOUBLECLICK
:
4867 evt
.SetEventType(wxEVT_STC_DOUBLECLICK
);
4868 evt
.SetLine(scn
.line
);
4872 evt
.SetEventType(wxEVT_STC_UPDATEUI
);
4873 evt
.SetUpdated(scn
.updated
);
4877 evt
.SetEventType(wxEVT_STC_MODIFIED
);
4878 evt
.SetModificationType(scn
.modificationType
);
4879 SetEventText(evt
, scn
.text
, scn
.length
);
4880 evt
.SetLength(scn
.length
);
4881 evt
.SetLinesAdded(scn
.linesAdded
);
4882 evt
.SetLine(scn
.line
);
4883 evt
.SetFoldLevelNow(scn
.foldLevelNow
);
4884 evt
.SetFoldLevelPrev(scn
.foldLevelPrev
);
4885 evt
.SetToken(scn
.token
);
4886 evt
.SetAnnotationLinesAdded(scn
.annotationLinesAdded
);
4889 case SCN_MACRORECORD
:
4890 evt
.SetEventType(wxEVT_STC_MACRORECORD
);
4891 evt
.SetMessage(scn
.message
);
4892 evt
.SetWParam(scn
.wParam
);
4893 evt
.SetLParam(scn
.lParam
);
4896 case SCN_MARGINCLICK
:
4897 evt
.SetEventType(wxEVT_STC_MARGINCLICK
);
4898 evt
.SetMargin(scn
.margin
);
4902 evt
.SetEventType(wxEVT_STC_NEEDSHOWN
);
4903 evt
.SetLength(scn
.length
);
4907 evt
.SetEventType(wxEVT_STC_PAINTED
);
4910 case SCN_AUTOCSELECTION
:
4911 evt
.SetEventType(wxEVT_STC_AUTOCOMP_SELECTION
);
4912 evt
.SetListType(scn
.listType
);
4913 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
4914 evt
.SetPosition(scn
.lParam
);
4917 case SCN_USERLISTSELECTION
:
4918 evt
.SetEventType(wxEVT_STC_USERLISTSELECTION
);
4919 evt
.SetListType(scn
.listType
);
4920 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
4921 evt
.SetPosition(scn
.lParam
);
4924 case SCN_URIDROPPED
:
4925 evt
.SetEventType(wxEVT_STC_URIDROPPED
);
4926 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
4929 case SCN_DWELLSTART
:
4930 evt
.SetEventType(wxEVT_STC_DWELLSTART
);
4936 evt
.SetEventType(wxEVT_STC_DWELLEND
);
4942 evt
.SetEventType(wxEVT_STC_ZOOM
);
4945 case SCN_HOTSPOTCLICK
:
4946 evt
.SetEventType(wxEVT_STC_HOTSPOT_CLICK
);
4949 case SCN_HOTSPOTDOUBLECLICK
:
4950 evt
.SetEventType(wxEVT_STC_HOTSPOT_DCLICK
);
4953 case SCN_CALLTIPCLICK
:
4954 evt
.SetEventType(wxEVT_STC_CALLTIP_CLICK
);
4957 case SCN_INDICATORCLICK
:
4958 evt
.SetEventType(wxEVT_STC_INDICATOR_CLICK
);
4961 case SCN_INDICATORRELEASE
:
4962 evt
.SetEventType(wxEVT_STC_INDICATOR_RELEASE
);
4965 case SCN_AUTOCCANCELLED
:
4966 evt
.SetEventType(wxEVT_STC_AUTOCOMP_CANCELLED
);
4969 case SCN_AUTOCCHARDELETED
:
4970 evt
.SetEventType(wxEVT_STC_AUTOCOMP_CHAR_DELETED
);
4973 case SCN_HOTSPOTRELEASECLICK
:
4974 evt
.SetEventType(wxEVT_STC_HOTSPOT_RELEASE_CLICK
);
4981 GetEventHandler()->ProcessEvent(evt
);
4985 //----------------------------------------------------------------------
4986 //----------------------------------------------------------------------
4987 //----------------------------------------------------------------------
4989 wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType
, int id
)
4990 : wxCommandEvent(commandType
, id
)
4995 m_modificationType
= 0;
5000 m_foldLevelPrev
= 0;
5009 m_annotationLinesAdded
= 0;
5012 #if wxUSE_DRAG_AND_DROP
5013 m_dragFlags
= wxDrag_CopyOnly
;
5014 m_dragResult
= wxDragNone
;
5018 bool wxStyledTextEvent::GetShift() const { return (m_modifiers
& SCI_SHIFT
) != 0; }
5019 bool wxStyledTextEvent::GetControl() const { return (m_modifiers
& SCI_CTRL
) != 0; }
5020 bool wxStyledTextEvent::GetAlt() const { return (m_modifiers
& SCI_ALT
) != 0; }
5023 wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent
& event
):
5024 wxCommandEvent(event
)
5026 m_position
= event
.m_position
;
5027 m_key
= event
.m_key
;
5028 m_modifiers
= event
.m_modifiers
;
5029 m_modificationType
= event
.m_modificationType
;
5030 m_text
= event
.m_text
;
5031 m_length
= event
.m_length
;
5032 m_linesAdded
= event
.m_linesAdded
;
5033 m_line
= event
.m_line
;
5034 m_foldLevelNow
= event
.m_foldLevelNow
;
5035 m_foldLevelPrev
= event
.m_foldLevelPrev
;
5037 m_margin
= event
.m_margin
;
5039 m_message
= event
.m_message
;
5040 m_wParam
= event
.m_wParam
;
5041 m_lParam
= event
.m_lParam
;
5043 m_listType
= event
.m_listType
;
5047 m_token
= event
.m_token
;
5048 m_annotationLinesAdded
= event
.m_annotationLinesAdded
;
5049 m_updated
= event
.m_updated
;
5051 #if wxUSE_DRAG_AND_DROP
5052 m_dragText
= event
.m_dragText
;
5053 m_dragFlags
= event
.m_dragFlags
;
5054 m_dragResult
= event
.m_dragResult
;
5058 //----------------------------------------------------------------------
5059 //----------------------------------------------------------------------
5061 /*static*/ wxVersionInfo
wxStyledTextCtrl::GetLibraryVersionInfo()
5063 return wxVersionInfo("Scintilla", 3, 21, 0, "Scintilla 3.21");