1 ////////////////////////////////////////////////////////////////////////////
3 // Purpose: A wxWidgets implementation of Scintilla. This class is the
4 // one meant to be used directly by wx applications. It does not
5 // derive directly from the Scintilla classes, but instead
6 // delegates most things to the real Scintilla class.
7 // This allows the use of Scintilla without polluting the
8 // namespace with all the classes and identifiers from Scintilla.
12 // Created: 13-Jan-2000
14 // Copyright: (c) 2000 by Total Control Software
15 // Licence: wxWindows licence
16 /////////////////////////////////////////////////////////////////////////////
19 IMPORTANT: src/stc/stc.cpp is generated by src/stc/gen_iface.py from
20 src/stc/stc.cpp.in, don't edit stc.cpp file as your changes will be
21 lost after the next regeneration, edit stc.cpp.in and rerun the
22 gen_iface.py script instead!
24 Parts of this file generated by the script are found in between
25 the special "{{{" and "}}}" markers, the rest of it is copied
26 verbatim from src.h.in.
29 // For compilers that support precompilation, includes "wx.h".
30 #include "wx/wxprec.h"
38 #include "wx/stc/stc.h"
39 #include "wx/stc/private.h"
47 #include "wx/tokenzr.h"
48 #include "wx/mstream.h"
52 #include "ScintillaWX.h"
54 //----------------------------------------------------------------------
56 const char wxSTCNameStr
[] = "stcwindow";
62 #define MAKELONG(a, b) ((a) | ((b) << 16))
65 static long wxColourAsLong(const wxColour
& co
) {
66 return (((long)co
.Blue() << 16) |
67 ((long)co
.Green() << 8) |
71 static wxColour
wxColourFromLong(long c
) {
73 clr
.Set((unsigned char)(c
& 0xff),
74 (unsigned char)((c
>> 8) & 0xff),
75 (unsigned char)((c
>> 16) & 0xff));
80 static wxColour
wxColourFromSpec(const wxString
& spec
) {
81 // spec should be a colour name or "#RRGGBB"
82 if (spec
.GetChar(0) == wxT('#')) {
84 long red
, green
, blue
;
85 red
= green
= blue
= 0;
86 spec
.Mid(1,2).ToLong(&red
, 16);
87 spec
.Mid(3,2).ToLong(&green
, 16);
88 spec
.Mid(5,2).ToLong(&blue
, 16);
89 return wxColour((unsigned char)red
,
94 return wxColour(spec
);
97 //----------------------------------------------------------------------
99 wxDEFINE_EVENT( wxEVT_STC_CHANGE
, wxStyledTextEvent
);
100 wxDEFINE_EVENT( wxEVT_STC_STYLENEEDED
, wxStyledTextEvent
);
101 wxDEFINE_EVENT( wxEVT_STC_CHARADDED
, wxStyledTextEvent
);
102 wxDEFINE_EVENT( wxEVT_STC_SAVEPOINTREACHED
, wxStyledTextEvent
);
103 wxDEFINE_EVENT( wxEVT_STC_SAVEPOINTLEFT
, wxStyledTextEvent
);
104 wxDEFINE_EVENT( wxEVT_STC_ROMODIFYATTEMPT
, wxStyledTextEvent
);
105 wxDEFINE_EVENT( wxEVT_STC_KEY
, wxStyledTextEvent
);
106 wxDEFINE_EVENT( wxEVT_STC_DOUBLECLICK
, wxStyledTextEvent
);
107 wxDEFINE_EVENT( wxEVT_STC_UPDATEUI
, wxStyledTextEvent
);
108 wxDEFINE_EVENT( wxEVT_STC_MODIFIED
, wxStyledTextEvent
);
109 wxDEFINE_EVENT( wxEVT_STC_MACRORECORD
, wxStyledTextEvent
);
110 wxDEFINE_EVENT( wxEVT_STC_MARGINCLICK
, wxStyledTextEvent
);
111 wxDEFINE_EVENT( wxEVT_STC_NEEDSHOWN
, wxStyledTextEvent
);
112 wxDEFINE_EVENT( wxEVT_STC_PAINTED
, wxStyledTextEvent
);
113 wxDEFINE_EVENT( wxEVT_STC_USERLISTSELECTION
, wxStyledTextEvent
);
114 wxDEFINE_EVENT( wxEVT_STC_URIDROPPED
, wxStyledTextEvent
);
115 wxDEFINE_EVENT( wxEVT_STC_DWELLSTART
, wxStyledTextEvent
);
116 wxDEFINE_EVENT( wxEVT_STC_DWELLEND
, wxStyledTextEvent
);
117 wxDEFINE_EVENT( wxEVT_STC_START_DRAG
, wxStyledTextEvent
);
118 wxDEFINE_EVENT( wxEVT_STC_DRAG_OVER
, wxStyledTextEvent
);
119 wxDEFINE_EVENT( wxEVT_STC_DO_DROP
, wxStyledTextEvent
);
120 wxDEFINE_EVENT( wxEVT_STC_ZOOM
, wxStyledTextEvent
);
121 wxDEFINE_EVENT( wxEVT_STC_HOTSPOT_CLICK
, wxStyledTextEvent
);
122 wxDEFINE_EVENT( wxEVT_STC_HOTSPOT_DCLICK
, wxStyledTextEvent
);
123 wxDEFINE_EVENT( wxEVT_STC_CALLTIP_CLICK
, wxStyledTextEvent
);
124 wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_SELECTION
, wxStyledTextEvent
);
125 wxDEFINE_EVENT( wxEVT_STC_INDICATOR_CLICK
, wxStyledTextEvent
);
126 wxDEFINE_EVENT( wxEVT_STC_INDICATOR_RELEASE
, wxStyledTextEvent
);
127 wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_CANCELLED
, wxStyledTextEvent
);
128 wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_CHAR_DELETED
, wxStyledTextEvent
);
129 wxDEFINE_EVENT( wxEVT_STC_HOTSPOT_RELEASE_CLICK
, wxStyledTextEvent
);
133 BEGIN_EVENT_TABLE(wxStyledTextCtrl
, wxControl
)
134 EVT_PAINT (wxStyledTextCtrl::OnPaint
)
135 EVT_SCROLLWIN (wxStyledTextCtrl::OnScrollWin
)
136 EVT_SCROLL (wxStyledTextCtrl::OnScroll
)
137 EVT_SIZE (wxStyledTextCtrl::OnSize
)
138 EVT_LEFT_DOWN (wxStyledTextCtrl::OnMouseLeftDown
)
139 // Let Scintilla see the double click as a second click
140 EVT_LEFT_DCLICK (wxStyledTextCtrl::OnMouseLeftDown
)
141 EVT_MOTION (wxStyledTextCtrl::OnMouseMove
)
142 EVT_LEFT_UP (wxStyledTextCtrl::OnMouseLeftUp
)
143 #if defined(__WXGTK__) || defined(__WXMAC__)
144 EVT_RIGHT_UP (wxStyledTextCtrl::OnMouseRightUp
)
146 EVT_CONTEXT_MENU (wxStyledTextCtrl::OnContextMenu
)
148 EVT_MOUSEWHEEL (wxStyledTextCtrl::OnMouseWheel
)
149 EVT_MIDDLE_UP (wxStyledTextCtrl::OnMouseMiddleUp
)
150 EVT_CHAR (wxStyledTextCtrl::OnChar
)
151 EVT_KEY_DOWN (wxStyledTextCtrl::OnKeyDown
)
152 EVT_KILL_FOCUS (wxStyledTextCtrl::OnLoseFocus
)
153 EVT_SET_FOCUS (wxStyledTextCtrl::OnGainFocus
)
154 EVT_SYS_COLOUR_CHANGED (wxStyledTextCtrl::OnSysColourChanged
)
155 EVT_ERASE_BACKGROUND (wxStyledTextCtrl::OnEraseBackground
)
156 EVT_MENU_RANGE (10, 16, wxStyledTextCtrl::OnMenu
)
157 EVT_LISTBOX_DCLICK (wxID_ANY
, wxStyledTextCtrl::OnListBox
)
161 IMPLEMENT_CLASS(wxStyledTextCtrl
, wxControl
)
162 IMPLEMENT_DYNAMIC_CLASS(wxStyledTextEvent
, wxCommandEvent
)
165 // forces the linking of the lexer modules
166 int Scintilla_LinkLexers();
169 //----------------------------------------------------------------------
170 // Constructor and Destructor
172 wxStyledTextCtrl::wxStyledTextCtrl(wxWindow
*parent
,
177 const wxString
& name
)
180 Create(parent
, id
, pos
, size
, style
, name
);
184 bool wxStyledTextCtrl::Create(wxWindow
*parent
,
189 const wxString
& name
)
191 style
|= wxVSCROLL
| wxHSCROLL
;
192 if (!wxControl::Create(parent
, id
, pos
, size
,
193 style
| wxWANTS_CHARS
| wxCLIP_CHILDREN
,
194 wxDefaultValidator
, name
))
198 Scintilla_LinkLexers();
200 m_swx
= new ScintillaWX(this);
202 m_lastKeyDownConsumed
= false;
206 // Put Scintilla into unicode (UTF-8) mode
207 SetCodePage(wxSTC_CP_UTF8
);
210 SetInitialSize(size
);
212 // Reduces flicker on GTK+/X11
213 SetBackgroundStyle(wxBG_STYLE_PAINT
);
215 // Make sure it can take the focus
222 wxStyledTextCtrl::~wxStyledTextCtrl() {
227 //----------------------------------------------------------------------
229 wxIntPtr
wxStyledTextCtrl::SendMsg(int msg
, wxUIntPtr wp
, wxIntPtr lp
) const
231 return m_swx
->WndProc(msg
, wp
, lp
);
234 //----------------------------------------------------------------------
236 // Set the vertical scrollbar to use instead of the ont that's built-in.
237 void wxStyledTextCtrl::SetVScrollBar(wxScrollBar
* bar
) {
240 // ensure that the built-in scrollbar is not visible
241 SetScrollbar(wxVERTICAL
, 0, 0, 0);
246 // Set the horizontal scrollbar to use instead of the ont that's built-in.
247 void wxStyledTextCtrl::SetHScrollBar(wxScrollBar
* bar
) {
250 // ensure that the built-in scrollbar is not visible
251 SetScrollbar(wxHORIZONTAL
, 0, 0, 0);
255 //----------------------------------------------------------------------
256 // Generated methods implementation section {{{
259 // Add text to the document at current position.
260 void wxStyledTextCtrl::AddText(const wxString
& text
) {
261 const wxWX2MBbuf buf
= wx2stc(text
);
262 SendMsg(2001, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
265 // Add array of cells to document.
266 void wxStyledTextCtrl::AddStyledText(const wxMemoryBuffer
& data
) {
267 SendMsg(2002, data
.GetDataLen(), (sptr_t
)data
.GetData());
270 // Insert string at a position.
271 void wxStyledTextCtrl::InsertText(int pos
, const wxString
& text
)
273 SendMsg(2003, pos
, (sptr_t
)(const char*)wx2stc(text
));
276 // Delete all text in the document.
277 void wxStyledTextCtrl::ClearAll()
282 // Delete a range of text in the document.
283 void wxStyledTextCtrl::DeleteRange(int pos
, int deleteLength
)
285 SendMsg(2645, pos
, deleteLength
);
288 // Set all style bytes to 0, remove all folding information.
289 void wxStyledTextCtrl::ClearDocumentStyle()
294 // Returns the number of bytes in the document.
295 int wxStyledTextCtrl::GetLength() const
297 return SendMsg(2006, 0, 0);
300 // Returns the character byte at the position.
301 int wxStyledTextCtrl::GetCharAt(int pos
) const {
302 return (unsigned char)SendMsg(2007, pos
, 0);
305 // Returns the position of the caret.
306 int wxStyledTextCtrl::GetCurrentPos() const
308 return SendMsg(2008, 0, 0);
311 // Returns the position of the opposite end of the selection to the caret.
312 int wxStyledTextCtrl::GetAnchor() const
314 return SendMsg(2009, 0, 0);
317 // Returns the style byte at the position.
318 int wxStyledTextCtrl::GetStyleAt(int pos
) const {
319 return (unsigned char)SendMsg(2010, pos
, 0);
322 // Redoes the next action on the undo history.
323 void wxStyledTextCtrl::Redo()
328 // Choose between collecting actions into the undo
329 // history and discarding them.
330 void wxStyledTextCtrl::SetUndoCollection(bool collectUndo
)
332 SendMsg(2012, collectUndo
, 0);
335 // Select all the text in the document.
336 void wxStyledTextCtrl::SelectAll()
341 // Remember the current position in the undo history as the position
342 // at which the document was saved.
343 void wxStyledTextCtrl::SetSavePoint()
348 // Retrieve a buffer of cells.
349 wxMemoryBuffer
wxStyledTextCtrl::GetStyledText(int startPos
, int endPos
) {
351 if (endPos
< startPos
) {
356 int len
= endPos
- startPos
;
357 if (!len
) return buf
;
359 tr
.lpstrText
= (char*)buf
.GetWriteBuf(len
*2+1);
360 tr
.chrg
.cpMin
= startPos
;
361 tr
.chrg
.cpMax
= endPos
;
362 len
= SendMsg(2015, 0, (sptr_t
)&tr
);
363 buf
.UngetWriteBuf(len
);
367 // Are there any redoable actions in the undo history?
368 bool wxStyledTextCtrl::CanRedo() const
370 return SendMsg(2016, 0, 0) != 0;
373 // Retrieve the line number at which a particular marker is located.
374 int wxStyledTextCtrl::MarkerLineFromHandle(int handle
)
376 return SendMsg(2017, handle
, 0);
380 void wxStyledTextCtrl::MarkerDeleteHandle(int handle
)
382 SendMsg(2018, handle
, 0);
385 // Is undo history being collected?
386 bool wxStyledTextCtrl::GetUndoCollection() const
388 return SendMsg(2019, 0, 0) != 0;
391 // Are white space characters currently visible?
392 // Returns one of SCWS_* constants.
393 int wxStyledTextCtrl::GetViewWhiteSpace() const
395 return SendMsg(2020, 0, 0);
398 // Make white space characters invisible, always visible or visible outside indentation.
399 void wxStyledTextCtrl::SetViewWhiteSpace(int viewWS
)
401 SendMsg(2021, viewWS
, 0);
404 // Find the position from a point within the window.
405 int wxStyledTextCtrl::PositionFromPoint(wxPoint pt
) const {
406 return SendMsg(2022, pt
.x
, pt
.y
);
409 // Find the position from a point within the window but return
410 // INVALID_POSITION if not close to text.
411 int wxStyledTextCtrl::PositionFromPointClose(int x
, int y
)
413 return SendMsg(2023, x
, y
);
416 // Set caret to start of a line and ensure it is visible.
417 void wxStyledTextCtrl::GotoLine(int line
)
419 SendMsg(2024, line
, 0);
422 // Set caret to a position and ensure it is visible.
423 void wxStyledTextCtrl::GotoPos(int pos
)
425 SendMsg(2025, pos
, 0);
428 // Set the selection anchor to a position. The anchor is the opposite
429 // end of the selection from the caret.
430 void wxStyledTextCtrl::SetAnchor(int posAnchor
)
432 SendMsg(2026, posAnchor
, 0);
435 // Retrieve the text of the line containing the caret.
436 // Returns the index of the caret on the line.
437 wxString
wxStyledTextCtrl::GetCurLine(int* linePos
) {
438 int len
= LineLength(GetCurrentLine());
440 if (linePos
) *linePos
= 0;
441 return wxEmptyString
;
444 wxMemoryBuffer
mbuf(len
+1);
445 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
447 int pos
= SendMsg(2027, len
+1, (sptr_t
)buf
);
448 mbuf
.UngetWriteBuf(len
);
450 if (linePos
) *linePos
= pos
;
454 // Retrieve the position of the last correctly styled character.
455 int wxStyledTextCtrl::GetEndStyled() const
457 return SendMsg(2028, 0, 0);
460 // Convert all line endings in the document to one mode.
461 void wxStyledTextCtrl::ConvertEOLs(int eolMode
)
463 SendMsg(2029, eolMode
, 0);
466 // Retrieve the current end of line mode - one of CRLF, CR, or LF.
467 int wxStyledTextCtrl::GetEOLMode() const
469 return SendMsg(2030, 0, 0);
472 // Set the current end of line mode.
473 void wxStyledTextCtrl::SetEOLMode(int eolMode
)
475 SendMsg(2031, eolMode
, 0);
478 // Set the current styling position to pos and the styling mask to mask.
479 // The styling mask can be used to protect some bits in each styling byte from modification.
480 void wxStyledTextCtrl::StartStyling(int pos
, int mask
)
482 SendMsg(2032, pos
, mask
);
485 // Change style from current styling position for length characters to a style
486 // and move the current styling position to after this newly styled segment.
487 void wxStyledTextCtrl::SetStyling(int length
, int style
)
489 SendMsg(2033, length
, style
);
492 // Is drawing done first into a buffer or direct to the screen?
493 bool wxStyledTextCtrl::GetBufferedDraw() const
495 return SendMsg(2034, 0, 0) != 0;
498 // If drawing is buffered then each line of text is drawn into a bitmap buffer
499 // before drawing it to the screen to avoid flicker.
500 void wxStyledTextCtrl::SetBufferedDraw(bool buffered
)
502 SendMsg(2035, buffered
, 0);
505 // Change the visible size of a tab to be a multiple of the width of a space character.
506 void wxStyledTextCtrl::SetTabWidth(int tabWidth
)
508 SendMsg(2036, tabWidth
, 0);
511 // Retrieve the visible size of a tab.
512 int wxStyledTextCtrl::GetTabWidth() const
514 return SendMsg(2121, 0, 0);
517 // Set the code page used to interpret the bytes of the document as characters.
518 void wxStyledTextCtrl::SetCodePage(int codePage
) {
520 wxASSERT_MSG(codePage
== wxSTC_CP_UTF8
,
521 wxT("Only wxSTC_CP_UTF8 may be used when wxUSE_UNICODE is on."));
523 wxASSERT_MSG(codePage
!= wxSTC_CP_UTF8
,
524 wxT("wxSTC_CP_UTF8 may not be used when wxUSE_UNICODE is off."));
526 SendMsg(2037, codePage
);
529 // Set the symbol used for a particular marker number,
530 // and optionally the fore and background colours.
531 void wxStyledTextCtrl::MarkerDefine(int markerNumber
, int markerSymbol
,
532 const wxColour
& foreground
,
533 const wxColour
& background
) {
535 SendMsg(2040, markerNumber
, markerSymbol
);
536 if (foreground
.IsOk())
537 MarkerSetForeground(markerNumber
, foreground
);
538 if (background
.IsOk())
539 MarkerSetBackground(markerNumber
, background
);
542 // Set the foreground colour used for a particular marker number.
543 void wxStyledTextCtrl::MarkerSetForeground(int markerNumber
, const wxColour
& fore
)
545 SendMsg(2041, markerNumber
, wxColourAsLong(fore
));
548 // Set the background colour used for a particular marker number.
549 void wxStyledTextCtrl::MarkerSetBackground(int markerNumber
, const wxColour
& back
)
551 SendMsg(2042, markerNumber
, wxColourAsLong(back
));
554 // Set the background colour used for a particular marker number when its folding block is selected.
555 void wxStyledTextCtrl::MarkerSetBackgroundSelected(int markerNumber
, const wxColour
& back
)
557 SendMsg(2292, markerNumber
, wxColourAsLong(back
));
560 // Enable/disable highlight for current folding bloc (smallest one that contains the caret)
561 void wxStyledTextCtrl::MarkerEnableHighlight(bool enabled
)
563 SendMsg(2293, enabled
, 0);
566 // Add a marker to a line, returning an ID which can be used to find or delete the marker.
567 int wxStyledTextCtrl::MarkerAdd(int line
, int markerNumber
)
569 return SendMsg(2043, line
, markerNumber
);
572 // Delete a marker from a line.
573 void wxStyledTextCtrl::MarkerDelete(int line
, int markerNumber
)
575 SendMsg(2044, line
, markerNumber
);
578 // Delete all markers with a particular number from all lines.
579 void wxStyledTextCtrl::MarkerDeleteAll(int markerNumber
)
581 SendMsg(2045, markerNumber
, 0);
584 // Get a bit mask of all the markers set on a line.
585 int wxStyledTextCtrl::MarkerGet(int line
)
587 return SendMsg(2046, line
, 0);
590 // Find the next line at or after lineStart that includes a marker in mask.
591 // Return -1 when no more lines.
592 int wxStyledTextCtrl::MarkerNext(int lineStart
, int markerMask
)
594 return SendMsg(2047, lineStart
, markerMask
);
597 // Find the previous line before lineStart that includes a marker in mask.
598 int wxStyledTextCtrl::MarkerPrevious(int lineStart
, int markerMask
)
600 return SendMsg(2048, lineStart
, markerMask
);
603 // Define a marker from a bitmap
604 void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber
, const wxBitmap
& bmp
) {
605 // convert bmp to a xpm in a string
606 wxMemoryOutputStream strm
;
607 wxImage img
= bmp
.ConvertToImage();
609 img
.ConvertAlphaToMask();
610 img
.SaveFile(strm
, wxBITMAP_TYPE_XPM
);
611 size_t len
= strm
.GetSize();
612 char* buff
= new char[len
+1];
613 strm
.CopyTo(buff
, len
);
615 SendMsg(2049, markerNumber
, (sptr_t
)buff
);
620 // Add a set of markers to a line.
621 void wxStyledTextCtrl::MarkerAddSet(int line
, int set
)
623 SendMsg(2466, line
, set
);
626 // Set the alpha used for a marker that is drawn in the text area, not the margin.
627 void wxStyledTextCtrl::MarkerSetAlpha(int markerNumber
, int alpha
)
629 SendMsg(2476, markerNumber
, alpha
);
632 // Set a margin to be either numeric or symbolic.
633 void wxStyledTextCtrl::SetMarginType(int margin
, int marginType
)
635 SendMsg(2240, margin
, marginType
);
638 // Retrieve the type of a margin.
639 int wxStyledTextCtrl::GetMarginType(int margin
) const
641 return SendMsg(2241, margin
, 0);
644 // Set the width of a margin to a width expressed in pixels.
645 void wxStyledTextCtrl::SetMarginWidth(int margin
, int pixelWidth
)
647 SendMsg(2242, margin
, pixelWidth
);
650 // Retrieve the width of a margin in pixels.
651 int wxStyledTextCtrl::GetMarginWidth(int margin
) const
653 return SendMsg(2243, margin
, 0);
656 // Set a mask that determines which markers are displayed in a margin.
657 void wxStyledTextCtrl::SetMarginMask(int margin
, int mask
)
659 SendMsg(2244, margin
, mask
);
662 // Retrieve the marker mask of a margin.
663 int wxStyledTextCtrl::GetMarginMask(int margin
) const
665 return SendMsg(2245, margin
, 0);
668 // Make a margin sensitive or insensitive to mouse clicks.
669 void wxStyledTextCtrl::SetMarginSensitive(int margin
, bool sensitive
)
671 SendMsg(2246, margin
, sensitive
);
674 // Retrieve the mouse click sensitivity of a margin.
675 bool wxStyledTextCtrl::GetMarginSensitive(int margin
) const
677 return SendMsg(2247, margin
, 0) != 0;
680 // Set the cursor shown when the mouse is inside a margin.
681 void wxStyledTextCtrl::SetMarginCursor(int margin
, int cursor
)
683 SendMsg(2248, margin
, cursor
);
686 // Retrieve the cursor shown in a margin.
687 int wxStyledTextCtrl::GetMarginCursor(int margin
) const
689 return SendMsg(2249, margin
, 0);
692 // Clear all the styles and make equivalent to the global default style.
693 void wxStyledTextCtrl::StyleClearAll()
698 // Set the foreground colour of a style.
699 void wxStyledTextCtrl::StyleSetForeground(int style
, const wxColour
& fore
)
701 SendMsg(2051, style
, wxColourAsLong(fore
));
704 // Set the background colour of a style.
705 void wxStyledTextCtrl::StyleSetBackground(int style
, const wxColour
& back
)
707 SendMsg(2052, style
, wxColourAsLong(back
));
710 // Set a style to be bold or not.
711 void wxStyledTextCtrl::StyleSetBold(int style
, bool bold
)
713 SendMsg(2053, style
, bold
);
716 // Set a style to be italic or not.
717 void wxStyledTextCtrl::StyleSetItalic(int style
, bool italic
)
719 SendMsg(2054, style
, italic
);
722 // Set the size of characters of a style.
723 void wxStyledTextCtrl::StyleSetSize(int style
, int sizePoints
)
725 SendMsg(2055, style
, sizePoints
);
728 // Set the font of a style.
729 void wxStyledTextCtrl::StyleSetFaceName(int style
, const wxString
& fontName
)
731 SendMsg(2056, style
, (sptr_t
)(const char*)wx2stc(fontName
));
734 // Set a style to have its end of line filled or not.
735 void wxStyledTextCtrl::StyleSetEOLFilled(int style
, bool filled
)
737 SendMsg(2057, style
, filled
);
740 // Reset the default style to its state at startup
741 void wxStyledTextCtrl::StyleResetDefault()
746 // Set a style to be underlined or not.
747 void wxStyledTextCtrl::StyleSetUnderline(int style
, bool underline
)
749 SendMsg(2059, style
, underline
);
752 // Get the foreground colour of a style.
753 wxColour
wxStyledTextCtrl::StyleGetForeground(int style
) const
755 long c
= SendMsg(2481, style
, 0);
756 return wxColourFromLong(c
);
759 // Get the background colour of a style.
760 wxColour
wxStyledTextCtrl::StyleGetBackground(int style
) const
762 long c
= SendMsg(2482, style
, 0);
763 return wxColourFromLong(c
);
766 // Get is a style bold or not.
767 bool wxStyledTextCtrl::StyleGetBold(int style
) const
769 return SendMsg(2483, style
, 0) != 0;
772 // Get is a style italic or not.
773 bool wxStyledTextCtrl::StyleGetItalic(int style
) const
775 return SendMsg(2484, style
, 0) != 0;
778 // Get the size of characters of a style.
779 int wxStyledTextCtrl::StyleGetSize(int style
) const
781 return SendMsg(2485, style
, 0);
784 // Get the font facename of a style
785 wxString
wxStyledTextCtrl::StyleGetFaceName(int style
) {
787 long len
= SendMsg(msg
, style
, 0);
788 wxMemoryBuffer
mbuf(len
+1);
789 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
790 SendMsg(msg
, style
, (sptr_t
)buf
);
791 mbuf
.UngetWriteBuf(len
);
796 // Get is a style to have its end of line filled or not.
797 bool wxStyledTextCtrl::StyleGetEOLFilled(int style
) const
799 return SendMsg(2487, style
, 0) != 0;
802 // Get is a style underlined or not.
803 bool wxStyledTextCtrl::StyleGetUnderline(int style
) const
805 return SendMsg(2488, style
, 0) != 0;
808 // Get is a style mixed case, or to force upper or lower case.
809 int wxStyledTextCtrl::StyleGetCase(int style
) const
811 return SendMsg(2489, style
, 0);
814 // Get the character set of the font in a style.
815 int wxStyledTextCtrl::StyleGetCharacterSet(int style
) const
817 return SendMsg(2490, style
, 0);
820 // Get is a style visible or not.
821 bool wxStyledTextCtrl::StyleGetVisible(int style
) const
823 return SendMsg(2491, style
, 0) != 0;
826 // Get is a style changeable or not (read only).
827 // Experimental feature, currently buggy.
828 bool wxStyledTextCtrl::StyleGetChangeable(int style
) const
830 return SendMsg(2492, style
, 0) != 0;
833 // Get is a style a hotspot or not.
834 bool wxStyledTextCtrl::StyleGetHotSpot(int style
) const
836 return SendMsg(2493, style
, 0) != 0;
839 // Set a style to be mixed case, or to force upper or lower case.
840 void wxStyledTextCtrl::StyleSetCase(int style
, int caseForce
)
842 SendMsg(2060, style
, caseForce
);
845 // Set the size of characters of a style. Size is in points multiplied by 100.
846 void wxStyledTextCtrl::StyleSetSizeFractional(int style
, int caseForce
)
848 SendMsg(2061, style
, caseForce
);
851 // Get the size of characters of a style in points multiplied by 100
852 int wxStyledTextCtrl::StyleGetSizeFractional(int style
) const
854 return SendMsg(2062, style
, 0);
857 // Set the weight of characters of a style.
858 void wxStyledTextCtrl::StyleSetWeight(int style
, int weight
)
860 SendMsg(2063, style
, weight
);
863 // Get the weight of characters of a style.
864 int wxStyledTextCtrl::StyleGetWeight(int style
) const
866 return SendMsg(2064, style
, 0);
869 // Set a style to be a hotspot or not.
870 void wxStyledTextCtrl::StyleSetHotSpot(int style
, bool hotspot
)
872 SendMsg(2409, style
, hotspot
);
875 // Set the foreground colour of the main and additional selections and whether to use this setting.
876 void wxStyledTextCtrl::SetSelForeground(bool useSetting
, const wxColour
& fore
)
878 SendMsg(2067, useSetting
, wxColourAsLong(fore
));
881 // Set the background colour of the main and additional selections and whether to use this setting.
882 void wxStyledTextCtrl::SetSelBackground(bool useSetting
, const wxColour
& back
)
884 SendMsg(2068, useSetting
, wxColourAsLong(back
));
887 // Get the alpha of the selection.
888 int wxStyledTextCtrl::GetSelAlpha() const
890 return SendMsg(2477, 0, 0);
893 // Set the alpha of the selection.
894 void wxStyledTextCtrl::SetSelAlpha(int alpha
)
896 SendMsg(2478, alpha
, 0);
899 // Is the selection end of line filled?
900 bool wxStyledTextCtrl::GetSelEOLFilled() const
902 return SendMsg(2479, 0, 0) != 0;
905 // Set the selection to have its end of line filled or not.
906 void wxStyledTextCtrl::SetSelEOLFilled(bool filled
)
908 SendMsg(2480, filled
, 0);
911 // Set the foreground colour of the caret.
912 void wxStyledTextCtrl::SetCaretForeground(const wxColour
& fore
)
914 SendMsg(2069, wxColourAsLong(fore
), 0);
917 // When key+modifier combination km is pressed perform msg.
918 void wxStyledTextCtrl::CmdKeyAssign(int key
, int modifiers
, int cmd
) {
919 SendMsg(2070, MAKELONG(key
, modifiers
), cmd
);
922 // When key+modifier combination km is pressed do nothing.
923 void wxStyledTextCtrl::CmdKeyClear(int key
, int modifiers
) {
924 SendMsg(2071, MAKELONG(key
, modifiers
));
927 // Drop all key mappings.
928 void wxStyledTextCtrl::CmdKeyClearAll()
933 // Set the styles for a segment of the document.
934 void wxStyledTextCtrl::SetStyleBytes(int length
, char* styleBytes
) {
935 SendMsg(2073, length
, (sptr_t
)styleBytes
);
938 // Set a style to be visible or not.
939 void wxStyledTextCtrl::StyleSetVisible(int style
, bool visible
)
941 SendMsg(2074, style
, visible
);
944 // Get the time in milliseconds that the caret is on and off.
945 int wxStyledTextCtrl::GetCaretPeriod() const
947 return SendMsg(2075, 0, 0);
950 // Get the time in milliseconds that the caret is on and off. 0 = steady on.
951 void wxStyledTextCtrl::SetCaretPeriod(int periodMilliseconds
)
953 SendMsg(2076, periodMilliseconds
, 0);
956 // Set the set of characters making up words for when moving or selecting by word.
957 // First sets defaults like SetCharsDefault.
958 void wxStyledTextCtrl::SetWordChars(const wxString
& characters
)
960 SendMsg(2077, 0, (sptr_t
)(const char*)wx2stc(characters
));
963 // Get the set of characters making up words for when moving or selecting by word.
964 wxString
wxStyledTextCtrl::GetWordChars() const {
966 int len
= SendMsg(msg
, 0, (sptr_t
)NULL
);
967 if (!len
) return wxEmptyString
;
969 wxMemoryBuffer
mbuf(len
+1);
970 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
971 SendMsg(msg
, 0, (sptr_t
)buf
);
972 mbuf
.UngetWriteBuf(len
);
977 // Start a sequence of actions that is undone and redone as a unit.
979 void wxStyledTextCtrl::BeginUndoAction()
984 // End a sequence of actions that is undone and redone as a unit.
985 void wxStyledTextCtrl::EndUndoAction()
990 // Set an indicator to plain, squiggle or TT.
991 void wxStyledTextCtrl::IndicatorSetStyle(int indic
, int style
)
993 SendMsg(2080, indic
, style
);
996 // Retrieve the style of an indicator.
997 int wxStyledTextCtrl::IndicatorGetStyle(int indic
) const
999 return SendMsg(2081, indic
, 0);
1002 // Set the foreground colour of an indicator.
1003 void wxStyledTextCtrl::IndicatorSetForeground(int indic
, const wxColour
& fore
)
1005 SendMsg(2082, indic
, wxColourAsLong(fore
));
1008 // Retrieve the foreground colour of an indicator.
1009 wxColour
wxStyledTextCtrl::IndicatorGetForeground(int indic
) const
1011 long c
= SendMsg(2083, indic
, 0);
1012 return wxColourFromLong(c
);
1015 // Set an indicator to draw under text or over(default).
1016 void wxStyledTextCtrl::IndicatorSetUnder(int indic
, bool under
)
1018 SendMsg(2510, indic
, under
);
1021 // Retrieve whether indicator drawn under or over text.
1022 bool wxStyledTextCtrl::IndicatorGetUnder(int indic
) const
1024 return SendMsg(2511, indic
, 0) != 0;
1027 // Set the foreground colour of all whitespace and whether to use this setting.
1028 void wxStyledTextCtrl::SetWhitespaceForeground(bool useSetting
, const wxColour
& fore
)
1030 SendMsg(2084, useSetting
, wxColourAsLong(fore
));
1033 // Set the background colour of all whitespace and whether to use this setting.
1034 void wxStyledTextCtrl::SetWhitespaceBackground(bool useSetting
, const wxColour
& back
)
1036 SendMsg(2085, useSetting
, wxColourAsLong(back
));
1039 // Set the size of the dots used to mark space characters.
1040 void wxStyledTextCtrl::SetWhitespaceSize(int size
)
1042 SendMsg(2086, size
, 0);
1045 // Get the size of the dots used to mark space characters.
1046 int wxStyledTextCtrl::GetWhitespaceSize() const
1048 return SendMsg(2087, 0, 0);
1051 // Divide each styling byte into lexical class bits (default: 5) and indicator
1052 // bits (default: 3). If a lexer requires more than 32 lexical states, then this
1053 // is used to expand the possible states.
1054 void wxStyledTextCtrl::SetStyleBits(int bits
)
1056 SendMsg(2090, bits
, 0);
1059 // Retrieve number of bits in style bytes used to hold the lexical state.
1060 int wxStyledTextCtrl::GetStyleBits() const
1062 return SendMsg(2091, 0, 0);
1065 // Used to hold extra styling information for each line.
1066 void wxStyledTextCtrl::SetLineState(int line
, int state
)
1068 SendMsg(2092, line
, state
);
1071 // Retrieve the extra styling information for a line.
1072 int wxStyledTextCtrl::GetLineState(int line
) const
1074 return SendMsg(2093, line
, 0);
1077 // Retrieve the last line number that has line state.
1078 int wxStyledTextCtrl::GetMaxLineState() const
1080 return SendMsg(2094, 0, 0);
1083 // Is the background of the line containing the caret in a different colour?
1084 bool wxStyledTextCtrl::GetCaretLineVisible() const
1086 return SendMsg(2095, 0, 0) != 0;
1089 // Display the background of the line containing the caret in a different colour.
1090 void wxStyledTextCtrl::SetCaretLineVisible(bool show
)
1092 SendMsg(2096, show
, 0);
1095 // Get the colour of the background of the line containing the caret.
1096 wxColour
wxStyledTextCtrl::GetCaretLineBackground() const
1098 long c
= SendMsg(2097, 0, 0);
1099 return wxColourFromLong(c
);
1102 // Set the colour of the background of the line containing the caret.
1103 void wxStyledTextCtrl::SetCaretLineBackground(const wxColour
& back
)
1105 SendMsg(2098, wxColourAsLong(back
), 0);
1108 // Set a style to be changeable or not (read only).
1109 // Experimental feature, currently buggy.
1110 void wxStyledTextCtrl::StyleSetChangeable(int style
, bool changeable
)
1112 SendMsg(2099, style
, changeable
);
1115 // Display a auto-completion list.
1116 // The lenEntered parameter indicates how many characters before
1117 // the caret should be used to provide context.
1118 void wxStyledTextCtrl::AutoCompShow(int lenEntered
, const wxString
& itemList
)
1120 SendMsg(2100, lenEntered
, (sptr_t
)(const char*)wx2stc(itemList
));
1123 // Remove the auto-completion list from the screen.
1124 void wxStyledTextCtrl::AutoCompCancel()
1126 SendMsg(2101, 0, 0);
1129 // Is there an auto-completion list visible?
1130 bool wxStyledTextCtrl::AutoCompActive()
1132 return SendMsg(2102, 0, 0) != 0;
1135 // Retrieve the position of the caret when the auto-completion list was displayed.
1136 int wxStyledTextCtrl::AutoCompPosStart()
1138 return SendMsg(2103, 0, 0);
1141 // User has selected an item so remove the list and insert the selection.
1142 void wxStyledTextCtrl::AutoCompComplete()
1144 SendMsg(2104, 0, 0);
1147 // Define a set of character that when typed cancel the auto-completion list.
1148 void wxStyledTextCtrl::AutoCompStops(const wxString
& characterSet
)
1150 SendMsg(2105, 0, (sptr_t
)(const char*)wx2stc(characterSet
));
1153 // Change the separator character in the string setting up an auto-completion list.
1154 // Default is space but can be changed if items contain space.
1155 void wxStyledTextCtrl::AutoCompSetSeparator(int separatorCharacter
)
1157 SendMsg(2106, separatorCharacter
, 0);
1160 // Retrieve the auto-completion list separator character.
1161 int wxStyledTextCtrl::AutoCompGetSeparator() const
1163 return SendMsg(2107, 0, 0);
1166 // Select the item in the auto-completion list that starts with a string.
1167 void wxStyledTextCtrl::AutoCompSelect(const wxString
& text
)
1169 SendMsg(2108, 0, (sptr_t
)(const char*)wx2stc(text
));
1172 // Should the auto-completion list be cancelled if the user backspaces to a
1173 // position before where the box was created.
1174 void wxStyledTextCtrl::AutoCompSetCancelAtStart(bool cancel
)
1176 SendMsg(2110, cancel
, 0);
1179 // Retrieve whether auto-completion cancelled by backspacing before start.
1180 bool wxStyledTextCtrl::AutoCompGetCancelAtStart() const
1182 return SendMsg(2111, 0, 0) != 0;
1185 // Define a set of characters that when typed will cause the autocompletion to
1186 // choose the selected item.
1187 void wxStyledTextCtrl::AutoCompSetFillUps(const wxString
& characterSet
)
1189 SendMsg(2112, 0, (sptr_t
)(const char*)wx2stc(characterSet
));
1192 // Should a single item auto-completion list automatically choose the item.
1193 void wxStyledTextCtrl::AutoCompSetChooseSingle(bool chooseSingle
)
1195 SendMsg(2113, chooseSingle
, 0);
1198 // Retrieve whether a single item auto-completion list automatically choose the item.
1199 bool wxStyledTextCtrl::AutoCompGetChooseSingle() const
1201 return SendMsg(2114, 0, 0) != 0;
1204 // Set whether case is significant when performing auto-completion searches.
1205 void wxStyledTextCtrl::AutoCompSetIgnoreCase(bool ignoreCase
)
1207 SendMsg(2115, ignoreCase
, 0);
1210 // Retrieve state of ignore case flag.
1211 bool wxStyledTextCtrl::AutoCompGetIgnoreCase() const
1213 return SendMsg(2116, 0, 0) != 0;
1216 // Display a list of strings and send notification when user chooses one.
1217 void wxStyledTextCtrl::UserListShow(int listType
, const wxString
& itemList
)
1219 SendMsg(2117, listType
, (sptr_t
)(const char*)wx2stc(itemList
));
1222 // Set whether or not autocompletion is hidden automatically when nothing matches.
1223 void wxStyledTextCtrl::AutoCompSetAutoHide(bool autoHide
)
1225 SendMsg(2118, autoHide
, 0);
1228 // Retrieve whether or not autocompletion is hidden automatically when nothing matches.
1229 bool wxStyledTextCtrl::AutoCompGetAutoHide() const
1231 return SendMsg(2119, 0, 0) != 0;
1234 // Set whether or not autocompletion deletes any word characters
1235 // after the inserted text upon completion.
1236 void wxStyledTextCtrl::AutoCompSetDropRestOfWord(bool dropRestOfWord
)
1238 SendMsg(2270, dropRestOfWord
, 0);
1241 // Retrieve whether or not autocompletion deletes any word characters
1242 // after the inserted text upon completion.
1243 bool wxStyledTextCtrl::AutoCompGetDropRestOfWord() const
1245 return SendMsg(2271, 0, 0) != 0;
1248 // Register an image for use in autocompletion lists.
1249 void wxStyledTextCtrl::RegisterImage(int type
, const wxBitmap
& bmp
) {
1250 // convert bmp to a xpm in a string
1251 wxMemoryOutputStream strm
;
1252 wxImage img
= bmp
.ConvertToImage();
1254 img
.ConvertAlphaToMask();
1255 img
.SaveFile(strm
, wxBITMAP_TYPE_XPM
);
1256 size_t len
= strm
.GetSize();
1257 char* buff
= new char[len
+1];
1258 strm
.CopyTo(buff
, len
);
1260 SendMsg(2405, type
, (sptr_t
)buff
);
1265 // Clear all the registered images.
1266 void wxStyledTextCtrl::ClearRegisteredImages()
1268 SendMsg(2408, 0, 0);
1271 // Retrieve the auto-completion list type-separator character.
1272 int wxStyledTextCtrl::AutoCompGetTypeSeparator() const
1274 return SendMsg(2285, 0, 0);
1277 // Change the type-separator character in the string setting up an auto-completion list.
1278 // Default is '?' but can be changed if items contain '?'.
1279 void wxStyledTextCtrl::AutoCompSetTypeSeparator(int separatorCharacter
)
1281 SendMsg(2286, separatorCharacter
, 0);
1284 // Set the maximum width, in characters, of auto-completion and user lists.
1285 // Set to 0 to autosize to fit longest item, which is the default.
1286 void wxStyledTextCtrl::AutoCompSetMaxWidth(int characterCount
)
1288 SendMsg(2208, characterCount
, 0);
1291 // Get the maximum width, in characters, of auto-completion and user lists.
1292 int wxStyledTextCtrl::AutoCompGetMaxWidth() const
1294 return SendMsg(2209, 0, 0);
1297 // Set the maximum height, in rows, of auto-completion and user lists.
1298 // The default is 5 rows.
1299 void wxStyledTextCtrl::AutoCompSetMaxHeight(int rowCount
)
1301 SendMsg(2210, rowCount
, 0);
1304 // Set the maximum height, in rows, of auto-completion and user lists.
1305 int wxStyledTextCtrl::AutoCompGetMaxHeight() const
1307 return SendMsg(2211, 0, 0);
1310 // Set the number of spaces used for one level of indentation.
1311 void wxStyledTextCtrl::SetIndent(int indentSize
)
1313 SendMsg(2122, indentSize
, 0);
1316 // Retrieve indentation size.
1317 int wxStyledTextCtrl::GetIndent() const
1319 return SendMsg(2123, 0, 0);
1322 // Indentation will only use space characters if useTabs is false, otherwise
1323 // it will use a combination of tabs and spaces.
1324 void wxStyledTextCtrl::SetUseTabs(bool useTabs
)
1326 SendMsg(2124, useTabs
, 0);
1329 // Retrieve whether tabs will be used in indentation.
1330 bool wxStyledTextCtrl::GetUseTabs() const
1332 return SendMsg(2125, 0, 0) != 0;
1335 // Change the indentation of a line to a number of columns.
1336 void wxStyledTextCtrl::SetLineIndentation(int line
, int indentSize
)
1338 SendMsg(2126, line
, indentSize
);
1341 // Retrieve the number of columns that a line is indented.
1342 int wxStyledTextCtrl::GetLineIndentation(int line
) const
1344 return SendMsg(2127, line
, 0);
1347 // Retrieve the position before the first non indentation character on a line.
1348 int wxStyledTextCtrl::GetLineIndentPosition(int line
) const
1350 return SendMsg(2128, line
, 0);
1353 // Retrieve the column number of a position, taking tab width into account.
1354 int wxStyledTextCtrl::GetColumn(int pos
) const
1356 return SendMsg(2129, pos
, 0);
1359 // Count characters between two positions.
1360 int wxStyledTextCtrl::CountCharacters(int startPos
, int endPos
)
1362 return SendMsg(2633, startPos
, endPos
);
1365 // Show or hide the horizontal scroll bar.
1366 void wxStyledTextCtrl::SetUseHorizontalScrollBar(bool show
)
1368 SendMsg(2130, show
, 0);
1371 // Is the horizontal scroll bar visible?
1372 bool wxStyledTextCtrl::GetUseHorizontalScrollBar() const
1374 return SendMsg(2131, 0, 0) != 0;
1377 // Show or hide indentation guides.
1378 void wxStyledTextCtrl::SetIndentationGuides(int indentView
)
1380 SendMsg(2132, indentView
, 0);
1383 // Are the indentation guides visible?
1384 int wxStyledTextCtrl::GetIndentationGuides() const
1386 return SendMsg(2133, 0, 0);
1389 // Set the highlighted indentation guide column.
1390 // 0 = no highlighted guide.
1391 void wxStyledTextCtrl::SetHighlightGuide(int column
)
1393 SendMsg(2134, column
, 0);
1396 // Get the highlighted indentation guide column.
1397 int wxStyledTextCtrl::GetHighlightGuide() const
1399 return SendMsg(2135, 0, 0);
1402 // Get the position after the last visible characters on a line.
1403 int wxStyledTextCtrl::GetLineEndPosition(int line
) const
1405 return SendMsg(2136, line
, 0);
1408 // Get the code page used to interpret the bytes of the document as characters.
1409 int wxStyledTextCtrl::GetCodePage() const
1411 return SendMsg(2137, 0, 0);
1414 // Get the foreground colour of the caret.
1415 wxColour
wxStyledTextCtrl::GetCaretForeground() const
1417 long c
= SendMsg(2138, 0, 0);
1418 return wxColourFromLong(c
);
1421 // In read-only mode?
1422 bool wxStyledTextCtrl::GetReadOnly() const
1424 return SendMsg(2140, 0, 0) != 0;
1427 // Sets the position of the caret.
1428 void wxStyledTextCtrl::SetCurrentPos(int pos
)
1430 SendMsg(2141, pos
, 0);
1433 // Sets the position that starts the selection - this becomes the anchor.
1434 void wxStyledTextCtrl::SetSelectionStart(int pos
)
1436 SendMsg(2142, pos
, 0);
1439 // Returns the position at the start of the selection.
1440 int wxStyledTextCtrl::GetSelectionStart() const
1442 return SendMsg(2143, 0, 0);
1445 // Sets the position that ends the selection - this becomes the currentPosition.
1446 void wxStyledTextCtrl::SetSelectionEnd(int pos
)
1448 SendMsg(2144, pos
, 0);
1451 // Returns the position at the end of the selection.
1452 int wxStyledTextCtrl::GetSelectionEnd() const
1454 return SendMsg(2145, 0, 0);
1457 // Set caret to a position, while removing any existing selection.
1458 void wxStyledTextCtrl::SetEmptySelection(int pos
)
1460 SendMsg(2556, pos
, 0);
1463 // Sets the print magnification added to the point size of each style for printing.
1464 void wxStyledTextCtrl::SetPrintMagnification(int magnification
)
1466 SendMsg(2146, magnification
, 0);
1469 // Returns the print magnification.
1470 int wxStyledTextCtrl::GetPrintMagnification() const
1472 return SendMsg(2147, 0, 0);
1475 // Modify colours when printing for clearer printed text.
1476 void wxStyledTextCtrl::SetPrintColourMode(int mode
)
1478 SendMsg(2148, mode
, 0);
1481 // Returns the print colour mode.
1482 int wxStyledTextCtrl::GetPrintColourMode() const
1484 return SendMsg(2149, 0, 0);
1487 // Find some text in the document.
1488 int wxStyledTextCtrl::FindText(int minPos
, int maxPos
,
1489 const wxString
& text
,
1492 ft
.chrg
.cpMin
= minPos
;
1493 ft
.chrg
.cpMax
= maxPos
;
1494 const wxWX2MBbuf buf
= wx2stc(text
);
1495 ft
.lpstrText
= (char*)(const char*)buf
;
1497 return SendMsg(2150, flags
, (sptr_t
)&ft
);
1500 // On Windows, will draw the document into a display context such as a printer.
1501 int wxStyledTextCtrl::FormatRange(bool doDraw
,
1510 if (endPos
< startPos
) {
1511 int temp
= startPos
;
1516 fr
.hdcTarget
= target
;
1517 fr
.rc
.top
= renderRect
.GetTop();
1518 fr
.rc
.left
= renderRect
.GetLeft();
1519 fr
.rc
.right
= renderRect
.GetRight();
1520 fr
.rc
.bottom
= renderRect
.GetBottom();
1521 fr
.rcPage
.top
= pageRect
.GetTop();
1522 fr
.rcPage
.left
= pageRect
.GetLeft();
1523 fr
.rcPage
.right
= pageRect
.GetRight();
1524 fr
.rcPage
.bottom
= pageRect
.GetBottom();
1525 fr
.chrg
.cpMin
= startPos
;
1526 fr
.chrg
.cpMax
= endPos
;
1528 return SendMsg(2151, doDraw
, (sptr_t
)&fr
);
1531 // Retrieve the display line at the top of the display.
1532 int wxStyledTextCtrl::GetFirstVisibleLine() const
1534 return SendMsg(2152, 0, 0);
1537 // Retrieve the contents of a line.
1538 wxString
wxStyledTextCtrl::GetLine(int line
) const {
1539 int len
= LineLength(line
);
1540 if (!len
) return wxEmptyString
;
1542 wxMemoryBuffer
mbuf(len
+1);
1543 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1544 SendMsg(2153, line
, (sptr_t
)buf
);
1545 mbuf
.UngetWriteBuf(len
);
1550 // Returns the number of lines in the document. There is always at least one.
1551 int wxStyledTextCtrl::GetLineCount() const
1553 return SendMsg(2154, 0, 0);
1556 // Sets the size in pixels of the left margin.
1557 void wxStyledTextCtrl::SetMarginLeft(int pixelWidth
)
1559 SendMsg(2155, 0, pixelWidth
);
1562 // Returns the size in pixels of the left margin.
1563 int wxStyledTextCtrl::GetMarginLeft() const
1565 return SendMsg(2156, 0, 0);
1568 // Sets the size in pixels of the right margin.
1569 void wxStyledTextCtrl::SetMarginRight(int pixelWidth
)
1571 SendMsg(2157, 0, pixelWidth
);
1574 // Returns the size in pixels of the right margin.
1575 int wxStyledTextCtrl::GetMarginRight() const
1577 return SendMsg(2158, 0, 0);
1580 // Is the document different from when it was last saved?
1581 bool wxStyledTextCtrl::GetModify() const
1583 return SendMsg(2159, 0, 0) != 0;
1586 // Retrieve the selected text.
1587 wxString
wxStyledTextCtrl::GetSelectedText() {
1588 const int len
= SendMsg(SCI_GETSELTEXT
, 0, (sptr_t
)0);
1589 if (!len
) return wxEmptyString
;
1591 wxMemoryBuffer
mbuf(len
+2);
1592 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1593 SendMsg(2161, 0, (sptr_t
)buf
);
1594 mbuf
.UngetWriteBuf(len
);
1599 // Retrieve a range of text.
1600 wxString
wxStyledTextCtrl::GetTextRange(int startPos
, int endPos
) {
1601 if (endPos
< startPos
) {
1602 int temp
= startPos
;
1606 int len
= endPos
- startPos
;
1607 if (!len
) return wxEmptyString
;
1608 wxMemoryBuffer
mbuf(len
+1);
1609 char* buf
= (char*)mbuf
.GetWriteBuf(len
);
1612 tr
.chrg
.cpMin
= startPos
;
1613 tr
.chrg
.cpMax
= endPos
;
1614 SendMsg(2162, 0, (sptr_t
)&tr
);
1615 mbuf
.UngetWriteBuf(len
);
1620 // Draw the selection in normal style or with selection highlighted.
1621 void wxStyledTextCtrl::HideSelection(bool normal
)
1623 SendMsg(2163, normal
, 0);
1626 // Retrieve the line containing a position.
1627 int wxStyledTextCtrl::LineFromPosition(int pos
) const
1629 return SendMsg(2166, pos
, 0);
1632 // Retrieve the position at the start of a line.
1633 int wxStyledTextCtrl::PositionFromLine(int line
) const
1635 return SendMsg(2167, line
, 0);
1638 // Scroll horizontally and vertically.
1639 void wxStyledTextCtrl::LineScroll(int columns
, int lines
)
1641 SendMsg(2168, columns
, lines
);
1644 // Ensure the caret is visible.
1645 void wxStyledTextCtrl::EnsureCaretVisible()
1647 SendMsg(2169, 0, 0);
1650 // Replace the selected text with the argument text.
1651 void wxStyledTextCtrl::ReplaceSelection(const wxString
& text
)
1653 SendMsg(2170, 0, (sptr_t
)(const char*)wx2stc(text
));
1656 // Set to read only or read write.
1657 void wxStyledTextCtrl::SetReadOnly(bool readOnly
)
1659 SendMsg(2171, readOnly
, 0);
1662 // Will a paste succeed?
1663 bool wxStyledTextCtrl::CanPaste() const
1665 return SendMsg(2173, 0, 0) != 0;
1668 // Are there any undoable actions in the undo history?
1669 bool wxStyledTextCtrl::CanUndo() const
1671 return SendMsg(2174, 0, 0) != 0;
1674 // Delete the undo history.
1675 void wxStyledTextCtrl::EmptyUndoBuffer()
1677 SendMsg(2175, 0, 0);
1680 // Undo one action in the undo history.
1681 void wxStyledTextCtrl::Undo()
1683 SendMsg(2176, 0, 0);
1686 // Cut the selection to the clipboard.
1687 void wxStyledTextCtrl::Cut()
1689 SendMsg(2177, 0, 0);
1692 // Copy the selection to the clipboard.
1693 void wxStyledTextCtrl::Copy()
1695 SendMsg(2178, 0, 0);
1698 // Paste the contents of the clipboard into the document replacing the selection.
1699 void wxStyledTextCtrl::Paste()
1701 SendMsg(2179, 0, 0);
1704 // Clear the selection.
1705 void wxStyledTextCtrl::Clear()
1707 SendMsg(2180, 0, 0);
1710 // Replace the contents of the document with the argument text.
1711 void wxStyledTextCtrl::SetText(const wxString
& text
)
1713 SendMsg(2181, 0, (sptr_t
)(const char*)wx2stc(text
));
1716 // Retrieve all the text in the document.
1717 wxString
wxStyledTextCtrl::GetText() const {
1718 int len
= GetTextLength();
1719 wxMemoryBuffer
mbuf(len
+1); // leave room for the null...
1720 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1721 SendMsg(2182, len
+1, (sptr_t
)buf
);
1722 mbuf
.UngetWriteBuf(len
);
1727 // Retrieve the number of characters in the document.
1728 int wxStyledTextCtrl::GetTextLength() const
1730 return SendMsg(2183, 0, 0);
1733 // Set to overtype (true) or insert mode.
1734 void wxStyledTextCtrl::SetOvertype(bool overtype
)
1736 SendMsg(2186, overtype
, 0);
1739 // Returns true if overtype mode is active otherwise false is returned.
1740 bool wxStyledTextCtrl::GetOvertype() const
1742 return SendMsg(2187, 0, 0) != 0;
1745 // Set the width of the insert mode caret.
1746 void wxStyledTextCtrl::SetCaretWidth(int pixelWidth
)
1748 SendMsg(2188, pixelWidth
, 0);
1751 // Returns the width of the insert mode caret.
1752 int wxStyledTextCtrl::GetCaretWidth() const
1754 return SendMsg(2189, 0, 0);
1757 // Sets the position that starts the target which is used for updating the
1758 // document without affecting the scroll position.
1759 void wxStyledTextCtrl::SetTargetStart(int pos
)
1761 SendMsg(2190, pos
, 0);
1764 // Get the position that starts the target.
1765 int wxStyledTextCtrl::GetTargetStart() const
1767 return SendMsg(2191, 0, 0);
1770 // Sets the position that ends the target which is used for updating the
1771 // document without affecting the scroll position.
1772 void wxStyledTextCtrl::SetTargetEnd(int pos
)
1774 SendMsg(2192, pos
, 0);
1777 // Get the position that ends the target.
1778 int wxStyledTextCtrl::GetTargetEnd() const
1780 return SendMsg(2193, 0, 0);
1783 // Replace the target text with the argument text.
1784 // Text is counted so it can contain NULs.
1785 // Returns the length of the replacement text.
1787 int wxStyledTextCtrl::ReplaceTarget(const wxString
& text
) {
1788 const wxWX2MBbuf buf
= wx2stc(text
);
1789 return SendMsg(2194, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
1792 // Replace the target text with the argument text after \d processing.
1793 // Text is counted so it can contain NULs.
1794 // Looks for \d where d is between 1 and 9 and replaces these with the strings
1795 // matched in the last search operation which were surrounded by \( and \).
1796 // Returns the length of the replacement text including any change
1797 // caused by processing the \d patterns.
1799 int wxStyledTextCtrl::ReplaceTargetRE(const wxString
& text
) {
1800 const wxWX2MBbuf buf
= wx2stc(text
);
1801 return SendMsg(2195, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
1804 // Search for a counted string in the target and set the target to the found
1805 // range. Text is counted so it can contain NULs.
1806 // Returns length of range or -1 for failure in which case target is not moved.
1808 int wxStyledTextCtrl::SearchInTarget(const wxString
& text
) {
1809 const wxWX2MBbuf buf
= wx2stc(text
);
1810 return SendMsg(2197, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
1813 // Set the search flags used by SearchInTarget.
1814 void wxStyledTextCtrl::SetSearchFlags(int flags
)
1816 SendMsg(2198, flags
, 0);
1819 // Get the search flags used by SearchInTarget.
1820 int wxStyledTextCtrl::GetSearchFlags() const
1822 return SendMsg(2199, 0, 0);
1825 // Show a call tip containing a definition near position pos.
1826 void wxStyledTextCtrl::CallTipShow(int pos
, const wxString
& definition
)
1828 SendMsg(2200, pos
, (sptr_t
)(const char*)wx2stc(definition
));
1831 // Remove the call tip from the screen.
1832 void wxStyledTextCtrl::CallTipCancel()
1834 SendMsg(2201, 0, 0);
1837 // Is there an active call tip?
1838 bool wxStyledTextCtrl::CallTipActive()
1840 return SendMsg(2202, 0, 0) != 0;
1843 // Retrieve the position where the caret was before displaying the call tip.
1844 int wxStyledTextCtrl::CallTipPosAtStart()
1846 return SendMsg(2203, 0, 0);
1849 // Highlight a segment of the definition.
1850 void wxStyledTextCtrl::CallTipSetHighlight(int start
, int end
)
1852 SendMsg(2204, start
, end
);
1855 // Set the background colour for the call tip.
1856 void wxStyledTextCtrl::CallTipSetBackground(const wxColour
& back
)
1858 SendMsg(2205, wxColourAsLong(back
), 0);
1861 // Set the foreground colour for the call tip.
1862 void wxStyledTextCtrl::CallTipSetForeground(const wxColour
& fore
)
1864 SendMsg(2206, wxColourAsLong(fore
), 0);
1867 // Set the foreground colour for the highlighted part of the call tip.
1868 void wxStyledTextCtrl::CallTipSetForegroundHighlight(const wxColour
& fore
)
1870 SendMsg(2207, wxColourAsLong(fore
), 0);
1873 // Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
1874 void wxStyledTextCtrl::CallTipUseStyle(int tabSize
)
1876 SendMsg(2212, tabSize
, 0);
1879 // Set position of calltip, above or below text.
1880 void wxStyledTextCtrl::CallTipSetPosition(bool above
)
1882 SendMsg(2213, above
, 0);
1885 // Find the display line of a document line taking hidden lines into account.
1886 int wxStyledTextCtrl::VisibleFromDocLine(int line
)
1888 return SendMsg(2220, line
, 0);
1891 // Find the document line of a display line taking hidden lines into account.
1892 int wxStyledTextCtrl::DocLineFromVisible(int lineDisplay
)
1894 return SendMsg(2221, lineDisplay
, 0);
1897 // The number of display lines needed to wrap a document line
1898 int wxStyledTextCtrl::WrapCount(int line
)
1900 return SendMsg(2235, line
, 0);
1903 // Set the fold level of a line.
1904 // This encodes an integer level along with flags indicating whether the
1905 // line is a header and whether it is effectively white space.
1906 void wxStyledTextCtrl::SetFoldLevel(int line
, int level
)
1908 SendMsg(2222, line
, level
);
1911 // Retrieve the fold level of a line.
1912 int wxStyledTextCtrl::GetFoldLevel(int line
) const
1914 return SendMsg(2223, line
, 0);
1917 // Find the last child line of a header line.
1918 int wxStyledTextCtrl::GetLastChild(int line
, int level
) const
1920 return SendMsg(2224, line
, level
);
1923 // Find the parent line of a child line.
1924 int wxStyledTextCtrl::GetFoldParent(int line
) const
1926 return SendMsg(2225, line
, 0);
1929 // Make a range of lines visible.
1930 void wxStyledTextCtrl::ShowLines(int lineStart
, int lineEnd
)
1932 SendMsg(2226, lineStart
, lineEnd
);
1935 // Make a range of lines invisible.
1936 void wxStyledTextCtrl::HideLines(int lineStart
, int lineEnd
)
1938 SendMsg(2227, lineStart
, lineEnd
);
1941 // Is a line visible?
1942 bool wxStyledTextCtrl::GetLineVisible(int line
) const
1944 return SendMsg(2228, line
, 0) != 0;
1947 // Are all lines visible?
1948 bool wxStyledTextCtrl::GetAllLinesVisible() const
1950 return SendMsg(2236, 0, 0) != 0;
1953 // Show the children of a header line.
1954 void wxStyledTextCtrl::SetFoldExpanded(int line
, bool expanded
)
1956 SendMsg(2229, line
, expanded
);
1959 // Is a header line expanded?
1960 bool wxStyledTextCtrl::GetFoldExpanded(int line
) const
1962 return SendMsg(2230, line
, 0) != 0;
1965 // Switch a header line between expanded and contracted.
1966 void wxStyledTextCtrl::ToggleFold(int line
)
1968 SendMsg(2231, line
, 0);
1971 // Ensure a particular line is visible by expanding any header line hiding it.
1972 void wxStyledTextCtrl::EnsureVisible(int line
)
1974 SendMsg(2232, line
, 0);
1977 // Set some style options for folding.
1978 void wxStyledTextCtrl::SetFoldFlags(int flags
)
1980 SendMsg(2233, flags
, 0);
1983 // Ensure a particular line is visible by expanding any header line hiding it.
1984 // Use the currently set visibility policy to determine which range to display.
1985 void wxStyledTextCtrl::EnsureVisibleEnforcePolicy(int line
)
1987 SendMsg(2234, line
, 0);
1990 // Sets whether a tab pressed when caret is within indentation indents.
1991 void wxStyledTextCtrl::SetTabIndents(bool tabIndents
)
1993 SendMsg(2260, tabIndents
, 0);
1996 // Does a tab pressed when caret is within indentation indent?
1997 bool wxStyledTextCtrl::GetTabIndents() const
1999 return SendMsg(2261, 0, 0) != 0;
2002 // Sets whether a backspace pressed when caret is within indentation unindents.
2003 void wxStyledTextCtrl::SetBackSpaceUnIndents(bool bsUnIndents
)
2005 SendMsg(2262, bsUnIndents
, 0);
2008 // Does a backspace pressed when caret is within indentation unindent?
2009 bool wxStyledTextCtrl::GetBackSpaceUnIndents() const
2011 return SendMsg(2263, 0, 0) != 0;
2014 // Sets the time the mouse must sit still to generate a mouse dwell event.
2015 void wxStyledTextCtrl::SetMouseDwellTime(int periodMilliseconds
)
2017 SendMsg(2264, periodMilliseconds
, 0);
2020 // Retrieve the time the mouse must sit still to generate a mouse dwell event.
2021 int wxStyledTextCtrl::GetMouseDwellTime() const
2023 return SendMsg(2265, 0, 0);
2026 // Get position of start of word.
2027 int wxStyledTextCtrl::WordStartPosition(int pos
, bool onlyWordCharacters
)
2029 return SendMsg(2266, pos
, onlyWordCharacters
);
2032 // Get position of end of word.
2033 int wxStyledTextCtrl::WordEndPosition(int pos
, bool onlyWordCharacters
)
2035 return SendMsg(2267, pos
, onlyWordCharacters
);
2038 // Sets whether text is word wrapped.
2039 void wxStyledTextCtrl::SetWrapMode(int mode
)
2041 SendMsg(2268, mode
, 0);
2044 // Retrieve whether text is word wrapped.
2045 int wxStyledTextCtrl::GetWrapMode() const
2047 return SendMsg(2269, 0, 0);
2050 // Set the display mode of visual flags for wrapped lines.
2051 void wxStyledTextCtrl::SetWrapVisualFlags(int wrapVisualFlags
)
2053 SendMsg(2460, wrapVisualFlags
, 0);
2056 // Retrive the display mode of visual flags for wrapped lines.
2057 int wxStyledTextCtrl::GetWrapVisualFlags() const
2059 return SendMsg(2461, 0, 0);
2062 // Set the location of visual flags for wrapped lines.
2063 void wxStyledTextCtrl::SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation
)
2065 SendMsg(2462, wrapVisualFlagsLocation
, 0);
2068 // Retrive the location of visual flags for wrapped lines.
2069 int wxStyledTextCtrl::GetWrapVisualFlagsLocation() const
2071 return SendMsg(2463, 0, 0);
2074 // Set the start indent for wrapped lines.
2075 void wxStyledTextCtrl::SetWrapStartIndent(int indent
)
2077 SendMsg(2464, indent
, 0);
2080 // Retrive the start indent for wrapped lines.
2081 int wxStyledTextCtrl::GetWrapStartIndent() const
2083 return SendMsg(2465, 0, 0);
2086 // Sets how wrapped sublines are placed. Default is fixed.
2087 void wxStyledTextCtrl::SetWrapIndentMode(int mode
)
2089 SendMsg(2472, mode
, 0);
2092 // Retrieve how wrapped sublines are placed. Default is fixed.
2093 int wxStyledTextCtrl::GetWrapIndentMode() const
2095 return SendMsg(2473, 0, 0);
2098 // Sets the degree of caching of layout information.
2099 void wxStyledTextCtrl::SetLayoutCache(int mode
)
2101 SendMsg(2272, mode
, 0);
2104 // Retrieve the degree of caching of layout information.
2105 int wxStyledTextCtrl::GetLayoutCache() const
2107 return SendMsg(2273, 0, 0);
2110 // Sets the document width assumed for scrolling.
2111 void wxStyledTextCtrl::SetScrollWidth(int pixelWidth
)
2113 SendMsg(2274, pixelWidth
, 0);
2116 // Retrieve the document width assumed for scrolling.
2117 int wxStyledTextCtrl::GetScrollWidth() const
2119 return SendMsg(2275, 0, 0);
2122 // Sets whether the maximum width line displayed is used to set scroll width.
2123 void wxStyledTextCtrl::SetScrollWidthTracking(bool tracking
)
2125 SendMsg(2516, tracking
, 0);
2128 // Retrieve whether the scroll width tracks wide lines.
2129 bool wxStyledTextCtrl::GetScrollWidthTracking() const
2131 return SendMsg(2517, 0, 0) != 0;
2134 // Measure the pixel width of some text in a particular style.
2135 // NUL terminated text argument.
2136 // Does not handle tab or control characters.
2137 int wxStyledTextCtrl::TextWidth(int style
, const wxString
& text
)
2139 return SendMsg(2276, style
, (sptr_t
)(const char*)wx2stc(text
));
2142 // Sets the scroll range so that maximum scroll position has
2143 // the last line at the bottom of the view (default).
2144 // Setting this to false allows scrolling one page below the last line.
2145 void wxStyledTextCtrl::SetEndAtLastLine(bool endAtLastLine
)
2147 SendMsg(2277, endAtLastLine
, 0);
2150 // Retrieve whether the maximum scroll position has the last
2151 // line at the bottom of the view.
2152 bool wxStyledTextCtrl::GetEndAtLastLine() const
2154 return SendMsg(2278, 0, 0) != 0;
2157 // Retrieve the height of a particular line of text in pixels.
2158 int wxStyledTextCtrl::TextHeight(int line
)
2160 return SendMsg(2279, line
, 0);
2163 // Show or hide the vertical scroll bar.
2164 void wxStyledTextCtrl::SetUseVerticalScrollBar(bool show
)
2166 SendMsg(2280, show
, 0);
2169 // Is the vertical scroll bar visible?
2170 bool wxStyledTextCtrl::GetUseVerticalScrollBar() const
2172 return SendMsg(2281, 0, 0) != 0;
2175 // Append a string to the end of the document without changing the selection.
2176 void wxStyledTextCtrl::AppendText(const wxString
& text
) {
2177 const wxWX2MBbuf buf
= wx2stc(text
);
2178 SendMsg(2282, wx2stclen(text
, buf
), (sptr_t
)(const char*)buf
);
2181 // Is drawing done in two phases with backgrounds drawn before foregrounds?
2182 bool wxStyledTextCtrl::GetTwoPhaseDraw() const
2184 return SendMsg(2283, 0, 0) != 0;
2187 // In twoPhaseDraw mode, drawing is performed in two phases, first the background
2188 // and then the foreground. This avoids chopping off characters that overlap the next run.
2189 void wxStyledTextCtrl::SetTwoPhaseDraw(bool twoPhase
)
2191 SendMsg(2284, twoPhase
, 0);
2194 // Scroll so that a display line is at the top of the display.
2195 void wxStyledTextCtrl::SetFirstVisibleLine(int lineDisplay
)
2197 SendMsg(2613, lineDisplay
, 0);
2200 // Change the effect of pasting when there are multiple selections.
2201 void wxStyledTextCtrl::SetMultiPaste(int multiPaste
)
2203 SendMsg(2614, multiPaste
, 0);
2206 // Retrieve the effect of pasting when there are multiple selections..
2207 int wxStyledTextCtrl::GetMultiPaste() const
2209 return SendMsg(2615, 0, 0);
2212 // Retrieve the value of a tag from a regular expression search.
2213 wxString
wxStyledTextCtrl::GetTag(int tagNumber
) const {
2215 int len
= SendMsg(msg
, tagNumber
, (sptr_t
)NULL
);
2216 if (!len
) return wxEmptyString
;
2218 wxMemoryBuffer
mbuf(len
+1);
2219 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
2220 SendMsg(msg
, tagNumber
, (sptr_t
)buf
);
2221 mbuf
.UngetWriteBuf(len
);
2226 // Make the target range start and end be the same as the selection range start and end.
2227 void wxStyledTextCtrl::TargetFromSelection()
2229 SendMsg(2287, 0, 0);
2232 // Join the lines in the target.
2233 void wxStyledTextCtrl::LinesJoin()
2235 SendMsg(2288, 0, 0);
2238 // Split the lines in the target into lines that are less wide than pixelWidth
2240 void wxStyledTextCtrl::LinesSplit(int pixelWidth
)
2242 SendMsg(2289, pixelWidth
, 0);
2245 // Set the colours used as a chequerboard pattern in the fold margin
2246 void wxStyledTextCtrl::SetFoldMarginColour(bool useSetting
, const wxColour
& back
)
2248 SendMsg(2290, useSetting
, wxColourAsLong(back
));
2250 void wxStyledTextCtrl::SetFoldMarginHiColour(bool useSetting
, const wxColour
& fore
)
2252 SendMsg(2291, useSetting
, wxColourAsLong(fore
));
2255 // Move caret down one line.
2256 void wxStyledTextCtrl::LineDown()
2258 SendMsg(2300, 0, 0);
2261 // Move caret down one line extending selection to new caret position.
2262 void wxStyledTextCtrl::LineDownExtend()
2264 SendMsg(2301, 0, 0);
2267 // Move caret up one line.
2268 void wxStyledTextCtrl::LineUp()
2270 SendMsg(2302, 0, 0);
2273 // Move caret up one line extending selection to new caret position.
2274 void wxStyledTextCtrl::LineUpExtend()
2276 SendMsg(2303, 0, 0);
2279 // Move caret left one character.
2280 void wxStyledTextCtrl::CharLeft()
2282 SendMsg(2304, 0, 0);
2285 // Move caret left one character extending selection to new caret position.
2286 void wxStyledTextCtrl::CharLeftExtend()
2288 SendMsg(2305, 0, 0);
2291 // Move caret right one character.
2292 void wxStyledTextCtrl::CharRight()
2294 SendMsg(2306, 0, 0);
2297 // Move caret right one character extending selection to new caret position.
2298 void wxStyledTextCtrl::CharRightExtend()
2300 SendMsg(2307, 0, 0);
2303 // Move caret left one word.
2304 void wxStyledTextCtrl::WordLeft()
2306 SendMsg(2308, 0, 0);
2309 // Move caret left one word extending selection to new caret position.
2310 void wxStyledTextCtrl::WordLeftExtend()
2312 SendMsg(2309, 0, 0);
2315 // Move caret right one word.
2316 void wxStyledTextCtrl::WordRight()
2318 SendMsg(2310, 0, 0);
2321 // Move caret right one word extending selection to new caret position.
2322 void wxStyledTextCtrl::WordRightExtend()
2324 SendMsg(2311, 0, 0);
2327 // Move caret to first position on line.
2328 void wxStyledTextCtrl::Home()
2330 SendMsg(2312, 0, 0);
2333 // Move caret to first position on line extending selection to new caret position.
2334 void wxStyledTextCtrl::HomeExtend()
2336 SendMsg(2313, 0, 0);
2339 // Move caret to last position on line.
2340 void wxStyledTextCtrl::LineEnd()
2342 SendMsg(2314, 0, 0);
2345 // Move caret to last position on line extending selection to new caret position.
2346 void wxStyledTextCtrl::LineEndExtend()
2348 SendMsg(2315, 0, 0);
2351 // Move caret to first position in document.
2352 void wxStyledTextCtrl::DocumentStart()
2354 SendMsg(2316, 0, 0);
2357 // Move caret to first position in document extending selection to new caret position.
2358 void wxStyledTextCtrl::DocumentStartExtend()
2360 SendMsg(2317, 0, 0);
2363 // Move caret to last position in document.
2364 void wxStyledTextCtrl::DocumentEnd()
2366 SendMsg(2318, 0, 0);
2369 // Move caret to last position in document extending selection to new caret position.
2370 void wxStyledTextCtrl::DocumentEndExtend()
2372 SendMsg(2319, 0, 0);
2375 // Move caret one page up.
2376 void wxStyledTextCtrl::PageUp()
2378 SendMsg(2320, 0, 0);
2381 // Move caret one page up extending selection to new caret position.
2382 void wxStyledTextCtrl::PageUpExtend()
2384 SendMsg(2321, 0, 0);
2387 // Move caret one page down.
2388 void wxStyledTextCtrl::PageDown()
2390 SendMsg(2322, 0, 0);
2393 // Move caret one page down extending selection to new caret position.
2394 void wxStyledTextCtrl::PageDownExtend()
2396 SendMsg(2323, 0, 0);
2399 // Switch from insert to overtype mode or the reverse.
2400 void wxStyledTextCtrl::EditToggleOvertype()
2402 SendMsg(2324, 0, 0);
2405 // Cancel any modes such as call tip or auto-completion list display.
2406 void wxStyledTextCtrl::Cancel()
2408 SendMsg(2325, 0, 0);
2411 // Delete the selection or if no selection, the character before the caret.
2412 void wxStyledTextCtrl::DeleteBack()
2414 SendMsg(2326, 0, 0);
2417 // If selection is empty or all on one line replace the selection with a tab character.
2418 // If more than one line selected, indent the lines.
2419 void wxStyledTextCtrl::Tab()
2421 SendMsg(2327, 0, 0);
2424 // Dedent the selected lines.
2425 void wxStyledTextCtrl::BackTab()
2427 SendMsg(2328, 0, 0);
2430 // Insert a new line, may use a CRLF, CR or LF depending on EOL mode.
2431 void wxStyledTextCtrl::NewLine()
2433 SendMsg(2329, 0, 0);
2436 // Insert a Form Feed character.
2437 void wxStyledTextCtrl::FormFeed()
2439 SendMsg(2330, 0, 0);
2442 // Move caret to before first visible character on line.
2443 // If already there move to first character on line.
2444 void wxStyledTextCtrl::VCHome()
2446 SendMsg(2331, 0, 0);
2449 // Like VCHome but extending selection to new caret position.
2450 void wxStyledTextCtrl::VCHomeExtend()
2452 SendMsg(2332, 0, 0);
2455 // Magnify the displayed text by increasing the sizes by 1 point.
2456 void wxStyledTextCtrl::ZoomIn()
2458 SendMsg(2333, 0, 0);
2461 // Make the displayed text smaller by decreasing the sizes by 1 point.
2462 void wxStyledTextCtrl::ZoomOut()
2464 SendMsg(2334, 0, 0);
2467 // Delete the word to the left of the caret.
2468 void wxStyledTextCtrl::DelWordLeft()
2470 SendMsg(2335, 0, 0);
2473 // Delete the word to the right of the caret.
2474 void wxStyledTextCtrl::DelWordRight()
2476 SendMsg(2336, 0, 0);
2479 // Delete the word to the right of the caret, but not the trailing non-word characters.
2480 void wxStyledTextCtrl::DelWordRightEnd()
2482 SendMsg(2518, 0, 0);
2485 // Cut the line containing the caret.
2486 void wxStyledTextCtrl::LineCut()
2488 SendMsg(2337, 0, 0);
2491 // Delete the line containing the caret.
2492 void wxStyledTextCtrl::LineDelete()
2494 SendMsg(2338, 0, 0);
2497 // Switch the current line with the previous.
2498 void wxStyledTextCtrl::LineTranspose()
2500 SendMsg(2339, 0, 0);
2503 // Duplicate the current line.
2504 void wxStyledTextCtrl::LineDuplicate()
2506 SendMsg(2404, 0, 0);
2509 // Transform the selection to lower case.
2510 void wxStyledTextCtrl::LowerCase()
2512 SendMsg(2340, 0, 0);
2515 // Transform the selection to upper case.
2516 void wxStyledTextCtrl::UpperCase()
2518 SendMsg(2341, 0, 0);
2521 // Scroll the document down, keeping the caret visible.
2522 void wxStyledTextCtrl::LineScrollDown()
2524 SendMsg(2342, 0, 0);
2527 // Scroll the document up, keeping the caret visible.
2528 void wxStyledTextCtrl::LineScrollUp()
2530 SendMsg(2343, 0, 0);
2533 // Delete the selection or if no selection, the character before the caret.
2534 // Will not delete the character before at the start of a line.
2535 void wxStyledTextCtrl::DeleteBackNotLine()
2537 SendMsg(2344, 0, 0);
2540 // Move caret to first position on display line.
2541 void wxStyledTextCtrl::HomeDisplay()
2543 SendMsg(2345, 0, 0);
2546 // Move caret to first position on display line extending selection to
2547 // new caret position.
2548 void wxStyledTextCtrl::HomeDisplayExtend()
2550 SendMsg(2346, 0, 0);
2553 // Move caret to last position on display line.
2554 void wxStyledTextCtrl::LineEndDisplay()
2556 SendMsg(2347, 0, 0);
2559 // Move caret to last position on display line extending selection to new
2561 void wxStyledTextCtrl::LineEndDisplayExtend()
2563 SendMsg(2348, 0, 0);
2566 // These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)?
2567 // except they behave differently when word-wrap is enabled:
2568 // They go first to the start / end of the display line, like (Home|LineEnd)Display
2569 // The difference is that, the cursor is already at the point, it goes on to the start
2570 // or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
2571 void wxStyledTextCtrl::HomeWrap()
2573 SendMsg(2349, 0, 0);
2575 void wxStyledTextCtrl::HomeWrapExtend()
2577 SendMsg(2450, 0, 0);
2579 void wxStyledTextCtrl::LineEndWrap()
2581 SendMsg(2451, 0, 0);
2583 void wxStyledTextCtrl::LineEndWrapExtend()
2585 SendMsg(2452, 0, 0);
2587 void wxStyledTextCtrl::VCHomeWrap()
2589 SendMsg(2453, 0, 0);
2591 void wxStyledTextCtrl::VCHomeWrapExtend()
2593 SendMsg(2454, 0, 0);
2596 // Copy the line containing the caret.
2597 void wxStyledTextCtrl::LineCopy()
2599 SendMsg(2455, 0, 0);
2602 // Move the caret inside current view if it's not there already.
2603 void wxStyledTextCtrl::MoveCaretInsideView()
2605 SendMsg(2401, 0, 0);
2608 // How many characters are on a line, including end of line characters?
2609 int wxStyledTextCtrl::LineLength(int line
) const
2611 return SendMsg(2350, line
, 0);
2614 // Highlight the characters at two positions.
2615 void wxStyledTextCtrl::BraceHighlight(int pos1
, int pos2
)
2617 SendMsg(2351, pos1
, pos2
);
2620 // Use specified indicator to highlight matching braces instead of changing their style.
2621 void wxStyledTextCtrl::BraceHighlightIndicator(bool useBraceHighlightIndicator
, int indicator
)
2623 SendMsg(2498, useBraceHighlightIndicator
, indicator
);
2626 // Highlight the character at a position indicating there is no matching brace.
2627 void wxStyledTextCtrl::BraceBadLight(int pos
)
2629 SendMsg(2352, pos
, 0);
2632 // Use specified indicator to highlight non matching brace instead of changing its style.
2633 void wxStyledTextCtrl::BraceBadLightIndicator(bool useBraceBadLightIndicator
, int indicator
)
2635 SendMsg(2499, useBraceBadLightIndicator
, indicator
);
2638 // Find the position of a matching brace or INVALID_POSITION if no match.
2639 int wxStyledTextCtrl::BraceMatch(int pos
)
2641 return SendMsg(2353, pos
, 0);
2644 // Are the end of line characters visible?
2645 bool wxStyledTextCtrl::GetViewEOL() const
2647 return SendMsg(2355, 0, 0) != 0;
2650 // Make the end of line characters visible or invisible.
2651 void wxStyledTextCtrl::SetViewEOL(bool visible
)
2653 SendMsg(2356, visible
, 0);
2656 // Retrieve a pointer to the document object.
2657 void* wxStyledTextCtrl::GetDocPointer() {
2658 return (void*)SendMsg(2357);
2661 // Change the document object used.
2662 void wxStyledTextCtrl::SetDocPointer(void* docPointer
) {
2663 SendMsg(2358, 0, (sptr_t
)docPointer
);
2666 // Set which document modification events are sent to the container.
2667 void wxStyledTextCtrl::SetModEventMask(int mask
)
2669 SendMsg(2359, mask
, 0);
2672 // Retrieve the column number which text should be kept within.
2673 int wxStyledTextCtrl::GetEdgeColumn() const
2675 return SendMsg(2360, 0, 0);
2678 // Set the column number of the edge.
2679 // If text goes past the edge then it is highlighted.
2680 void wxStyledTextCtrl::SetEdgeColumn(int column
)
2682 SendMsg(2361, column
, 0);
2685 // Retrieve the edge highlight mode.
2686 int wxStyledTextCtrl::GetEdgeMode() const
2688 return SendMsg(2362, 0, 0);
2691 // The edge may be displayed by a line (EDGE_LINE) or by highlighting text that
2692 // goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).
2693 void wxStyledTextCtrl::SetEdgeMode(int mode
)
2695 SendMsg(2363, mode
, 0);
2698 // Retrieve the colour used in edge indication.
2699 wxColour
wxStyledTextCtrl::GetEdgeColour() const
2701 long c
= SendMsg(2364, 0, 0);
2702 return wxColourFromLong(c
);
2705 // Change the colour used in edge indication.
2706 void wxStyledTextCtrl::SetEdgeColour(const wxColour
& edgeColour
)
2708 SendMsg(2365, wxColourAsLong(edgeColour
), 0);
2711 // Sets the current caret position to be the search anchor.
2712 void wxStyledTextCtrl::SearchAnchor()
2714 SendMsg(2366, 0, 0);
2717 // Find some text starting at the search anchor.
2718 // Does not ensure the selection is visible.
2719 int wxStyledTextCtrl::SearchNext(int flags
, const wxString
& text
)
2721 return SendMsg(2367, flags
, (sptr_t
)(const char*)wx2stc(text
));
2724 // Find some text starting at the search anchor and moving backwards.
2725 // Does not ensure the selection is visible.
2726 int wxStyledTextCtrl::SearchPrev(int flags
, const wxString
& text
)
2728 return SendMsg(2368, flags
, (sptr_t
)(const char*)wx2stc(text
));
2731 // Retrieves the number of lines completely visible.
2732 int wxStyledTextCtrl::LinesOnScreen() const
2734 return SendMsg(2370, 0, 0);
2737 // Set whether a pop up menu is displayed automatically when the user presses
2738 // the wrong mouse button.
2739 void wxStyledTextCtrl::UsePopUp(bool allowPopUp
)
2741 SendMsg(2371, allowPopUp
, 0);
2744 // Is the selection rectangular? The alternative is the more common stream selection.
2745 bool wxStyledTextCtrl::SelectionIsRectangle() const
2747 return SendMsg(2372, 0, 0) != 0;
2750 // Set the zoom level. This number of points is added to the size of all fonts.
2751 // It may be positive to magnify or negative to reduce.
2752 void wxStyledTextCtrl::SetZoom(int zoom
)
2754 SendMsg(2373, zoom
, 0);
2757 // Retrieve the zoom level.
2758 int wxStyledTextCtrl::GetZoom() const
2760 return SendMsg(2374, 0, 0);
2763 // Create a new document object.
2764 // Starts with reference count of 1 and not selected into editor.
2765 void* wxStyledTextCtrl::CreateDocument() {
2766 return (void*)SendMsg(2375);
2769 // Extend life of document.
2770 void wxStyledTextCtrl::AddRefDocument(void* docPointer
) {
2771 SendMsg(2376, 0, (sptr_t
)docPointer
);
2774 // Release a reference to the document, deleting document if it fades to black.
2775 void wxStyledTextCtrl::ReleaseDocument(void* docPointer
) {
2776 SendMsg(2377, 0, (sptr_t
)docPointer
);
2779 // Get which document modification events are sent to the container.
2780 int wxStyledTextCtrl::GetModEventMask() const
2782 return SendMsg(2378, 0, 0);
2785 // Change internal focus flag.
2786 void wxStyledTextCtrl::SetSTCFocus(bool focus
)
2788 SendMsg(2380, focus
, 0);
2791 // Get internal focus flag.
2792 bool wxStyledTextCtrl::GetSTCFocus() const
2794 return SendMsg(2381, 0, 0) != 0;
2797 // Change error status - 0 = OK.
2798 void wxStyledTextCtrl::SetStatus(int statusCode
)
2800 SendMsg(2382, statusCode
, 0);
2803 // Get error status.
2804 int wxStyledTextCtrl::GetStatus() const
2806 return SendMsg(2383, 0, 0);
2809 // Set whether the mouse is captured when its button is pressed.
2810 void wxStyledTextCtrl::SetMouseDownCaptures(bool captures
)
2812 SendMsg(2384, captures
, 0);
2815 // Get whether mouse gets captured.
2816 bool wxStyledTextCtrl::GetMouseDownCaptures() const
2818 return SendMsg(2385, 0, 0) != 0;
2821 // Sets the cursor to one of the SC_CURSOR* values.
2822 void wxStyledTextCtrl::SetSTCCursor(int cursorType
)
2824 SendMsg(2386, cursorType
, 0);
2828 int wxStyledTextCtrl::GetSTCCursor() const
2830 return SendMsg(2387, 0, 0);
2833 // Change the way control characters are displayed:
2834 // If symbol is < 32, keep the drawn way, else, use the given character.
2835 void wxStyledTextCtrl::SetControlCharSymbol(int symbol
)
2837 SendMsg(2388, symbol
, 0);
2840 // Get the way control characters are displayed.
2841 int wxStyledTextCtrl::GetControlCharSymbol() const
2843 return SendMsg(2389, 0, 0);
2846 // Move to the previous change in capitalisation.
2847 void wxStyledTextCtrl::WordPartLeft()
2849 SendMsg(2390, 0, 0);
2852 // Move to the previous change in capitalisation extending selection
2853 // to new caret position.
2854 void wxStyledTextCtrl::WordPartLeftExtend()
2856 SendMsg(2391, 0, 0);
2859 // Move to the change next in capitalisation.
2860 void wxStyledTextCtrl::WordPartRight()
2862 SendMsg(2392, 0, 0);
2865 // Move to the next change in capitalisation extending selection
2866 // to new caret position.
2867 void wxStyledTextCtrl::WordPartRightExtend()
2869 SendMsg(2393, 0, 0);
2872 // Set the way the display area is determined when a particular line
2873 // is to be moved to by Find, FindNext, GotoLine, etc.
2874 void wxStyledTextCtrl::SetVisiblePolicy(int visiblePolicy
, int visibleSlop
)
2876 SendMsg(2394, visiblePolicy
, visibleSlop
);
2879 // Delete back from the current position to the start of the line.
2880 void wxStyledTextCtrl::DelLineLeft()
2882 SendMsg(2395, 0, 0);
2885 // Delete forwards from the current position to the end of the line.
2886 void wxStyledTextCtrl::DelLineRight()
2888 SendMsg(2396, 0, 0);
2891 // Get and Set the xOffset (ie, horizontal scroll position).
2892 void wxStyledTextCtrl::SetXOffset(int newOffset
)
2894 SendMsg(2397, newOffset
, 0);
2896 int wxStyledTextCtrl::GetXOffset() const
2898 return SendMsg(2398, 0, 0);
2901 // Set the last x chosen value to be the caret x position.
2902 void wxStyledTextCtrl::ChooseCaretX()
2904 SendMsg(2399, 0, 0);
2907 // Set the way the caret is kept visible when going sideways.
2908 // The exclusion zone is given in pixels.
2909 void wxStyledTextCtrl::SetXCaretPolicy(int caretPolicy
, int caretSlop
)
2911 SendMsg(2402, caretPolicy
, caretSlop
);
2914 // Set the way the line the caret is on is kept visible.
2915 // The exclusion zone is given in lines.
2916 void wxStyledTextCtrl::SetYCaretPolicy(int caretPolicy
, int caretSlop
)
2918 SendMsg(2403, caretPolicy
, caretSlop
);
2921 // Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE).
2922 void wxStyledTextCtrl::SetPrintWrapMode(int mode
)
2924 SendMsg(2406, mode
, 0);
2927 // Is printing line wrapped?
2928 int wxStyledTextCtrl::GetPrintWrapMode() const
2930 return SendMsg(2407, 0, 0);
2933 // Set a fore colour for active hotspots.
2934 void wxStyledTextCtrl::SetHotspotActiveForeground(bool useSetting
, const wxColour
& fore
)
2936 SendMsg(2410, useSetting
, wxColourAsLong(fore
));
2939 // Get the fore colour for active hotspots.
2940 wxColour
wxStyledTextCtrl::GetHotspotActiveForeground() const
2942 long c
= SendMsg(2494, 0, 0);
2943 return wxColourFromLong(c
);
2946 // Set a back colour for active hotspots.
2947 void wxStyledTextCtrl::SetHotspotActiveBackground(bool useSetting
, const wxColour
& back
)
2949 SendMsg(2411, useSetting
, wxColourAsLong(back
));
2952 // Get the back colour for active hotspots.
2953 wxColour
wxStyledTextCtrl::GetHotspotActiveBackground() const
2955 long c
= SendMsg(2495, 0, 0);
2956 return wxColourFromLong(c
);
2959 // Enable / Disable underlining active hotspots.
2960 void wxStyledTextCtrl::SetHotspotActiveUnderline(bool underline
)
2962 SendMsg(2412, underline
, 0);
2965 // Get whether underlining for active hotspots.
2966 bool wxStyledTextCtrl::GetHotspotActiveUnderline() const
2968 return SendMsg(2496, 0, 0) != 0;
2971 // Limit hotspots to single line so hotspots on two lines don't merge.
2972 void wxStyledTextCtrl::SetHotspotSingleLine(bool singleLine
)
2974 SendMsg(2421, singleLine
, 0);
2977 // Get the HotspotSingleLine property
2978 bool wxStyledTextCtrl::GetHotspotSingleLine() const
2980 return SendMsg(2497, 0, 0) != 0;
2983 // Move caret between paragraphs (delimited by empty lines).
2984 void wxStyledTextCtrl::ParaDown()
2986 SendMsg(2413, 0, 0);
2988 void wxStyledTextCtrl::ParaDownExtend()
2990 SendMsg(2414, 0, 0);
2992 void wxStyledTextCtrl::ParaUp()
2994 SendMsg(2415, 0, 0);
2996 void wxStyledTextCtrl::ParaUpExtend()
2998 SendMsg(2416, 0, 0);
3001 // Given a valid document position, return the previous position taking code
3002 // page into account. Returns 0 if passed 0.
3003 int wxStyledTextCtrl::PositionBefore(int pos
)
3005 return SendMsg(2417, pos
, 0);
3008 // Given a valid document position, return the next position taking code
3009 // page into account. Maximum value returned is the last position in the document.
3010 int wxStyledTextCtrl::PositionAfter(int pos
)
3012 return SendMsg(2418, pos
, 0);
3015 // Copy a range of text to the clipboard. Positions are clipped into the document.
3016 void wxStyledTextCtrl::CopyRange(int start
, int end
)
3018 SendMsg(2419, start
, end
);
3021 // Copy argument text to the clipboard.
3022 void wxStyledTextCtrl::CopyText(int length
, const wxString
& text
)
3024 SendMsg(2420, length
, (sptr_t
)(const char*)wx2stc(text
));
3027 // Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE/SC_SEL_THIN) or
3028 // by lines (SC_SEL_LINES).
3029 void wxStyledTextCtrl::SetSelectionMode(int mode
)
3031 SendMsg(2422, mode
, 0);
3034 // Get the mode of the current selection.
3035 int wxStyledTextCtrl::GetSelectionMode() const
3037 return SendMsg(2423, 0, 0);
3040 // Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line).
3041 int wxStyledTextCtrl::GetLineSelStartPosition(int line
)
3043 return SendMsg(2424, line
, 0);
3046 // Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line).
3047 int wxStyledTextCtrl::GetLineSelEndPosition(int line
)
3049 return SendMsg(2425, line
, 0);
3052 // Move caret down one line, extending rectangular selection to new caret position.
3053 void wxStyledTextCtrl::LineDownRectExtend()
3055 SendMsg(2426, 0, 0);
3058 // Move caret up one line, extending rectangular selection to new caret position.
3059 void wxStyledTextCtrl::LineUpRectExtend()
3061 SendMsg(2427, 0, 0);
3064 // Move caret left one character, extending rectangular selection to new caret position.
3065 void wxStyledTextCtrl::CharLeftRectExtend()
3067 SendMsg(2428, 0, 0);
3070 // Move caret right one character, extending rectangular selection to new caret position.
3071 void wxStyledTextCtrl::CharRightRectExtend()
3073 SendMsg(2429, 0, 0);
3076 // Move caret to first position on line, extending rectangular selection to new caret position.
3077 void wxStyledTextCtrl::HomeRectExtend()
3079 SendMsg(2430, 0, 0);
3082 // Move caret to before first visible character on line.
3083 // If already there move to first character on line.
3084 // In either case, extend rectangular selection to new caret position.
3085 void wxStyledTextCtrl::VCHomeRectExtend()
3087 SendMsg(2431, 0, 0);
3090 // Move caret to last position on line, extending rectangular selection to new caret position.
3091 void wxStyledTextCtrl::LineEndRectExtend()
3093 SendMsg(2432, 0, 0);
3096 // Move caret one page up, extending rectangular selection to new caret position.
3097 void wxStyledTextCtrl::PageUpRectExtend()
3099 SendMsg(2433, 0, 0);
3102 // Move caret one page down, extending rectangular selection to new caret position.
3103 void wxStyledTextCtrl::PageDownRectExtend()
3105 SendMsg(2434, 0, 0);
3108 // Move caret to top of page, or one page up if already at top of page.
3109 void wxStyledTextCtrl::StutteredPageUp()
3111 SendMsg(2435, 0, 0);
3114 // Move caret to top of page, or one page up if already at top of page, extending selection to new caret position.
3115 void wxStyledTextCtrl::StutteredPageUpExtend()
3117 SendMsg(2436, 0, 0);
3120 // Move caret to bottom of page, or one page down if already at bottom of page.
3121 void wxStyledTextCtrl::StutteredPageDown()
3123 SendMsg(2437, 0, 0);
3126 // Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position.
3127 void wxStyledTextCtrl::StutteredPageDownExtend()
3129 SendMsg(2438, 0, 0);
3132 // Move caret left one word, position cursor at end of word.
3133 void wxStyledTextCtrl::WordLeftEnd()
3135 SendMsg(2439, 0, 0);
3138 // Move caret left one word, position cursor at end of word, extending selection to new caret position.
3139 void wxStyledTextCtrl::WordLeftEndExtend()
3141 SendMsg(2440, 0, 0);
3144 // Move caret right one word, position cursor at end of word.
3145 void wxStyledTextCtrl::WordRightEnd()
3147 SendMsg(2441, 0, 0);
3150 // Move caret right one word, position cursor at end of word, extending selection to new caret position.
3151 void wxStyledTextCtrl::WordRightEndExtend()
3153 SendMsg(2442, 0, 0);
3156 // Set the set of characters making up whitespace for when moving or selecting by word.
3157 // Should be called after SetWordChars.
3158 void wxStyledTextCtrl::SetWhitespaceChars(const wxString
& characters
)
3160 SendMsg(2443, 0, (sptr_t
)(const char*)wx2stc(characters
));
3163 // Get the set of characters making up whitespace for when moving or selecting by word.
3164 wxString
wxStyledTextCtrl::GetWhitespaceChars() const {
3166 int len
= SendMsg(msg
, 0, (sptr_t
)NULL
);
3167 if (!len
) return wxEmptyString
;
3169 wxMemoryBuffer
mbuf(len
+1);
3170 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3171 SendMsg(msg
, 0, (sptr_t
)buf
);
3172 mbuf
.UngetWriteBuf(len
);
3177 // Set the set of characters making up punctuation characters
3178 // Should be called after SetWordChars.
3179 void wxStyledTextCtrl::SetPunctuationChars(const wxString
& characters
)
3181 SendMsg(2648, 0, (sptr_t
)(const char*)wx2stc(characters
));
3184 // Get the set of characters making up punctuation characters
3185 wxString
wxStyledTextCtrl::GetPunctuationChars() const {
3187 int len
= SendMsg(msg
, 0, (sptr_t
)NULL
);
3188 if (!len
) return wxEmptyString
;
3190 wxMemoryBuffer
mbuf(len
+1);
3191 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3192 SendMsg(msg
, 0, (sptr_t
)buf
);
3193 mbuf
.UngetWriteBuf(len
);
3198 // Reset the set of characters for whitespace and word characters to the defaults.
3199 void wxStyledTextCtrl::SetCharsDefault()
3201 SendMsg(2444, 0, 0);
3204 // Get currently selected item position in the auto-completion list
3205 int wxStyledTextCtrl::AutoCompGetCurrent() const
3207 return SendMsg(2445, 0, 0);
3210 // Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference.
3211 void wxStyledTextCtrl::AutoCompSetCaseInsensitiveBehaviour(int behaviour
)
3213 SendMsg(2634, behaviour
, 0);
3216 // Get auto-completion case insensitive behaviour.
3217 int wxStyledTextCtrl::AutoCompGetCaseInsensitiveBehaviour() const
3219 return SendMsg(2635, 0, 0);
3222 // Enlarge the document to a particular size of text bytes.
3223 void wxStyledTextCtrl::Allocate(int bytes
)
3225 SendMsg(2446, bytes
, 0);
3228 // Find the position of a column on a line taking into account tabs and
3229 // multi-byte characters. If beyond end of line, return line end position.
3230 int wxStyledTextCtrl::FindColumn(int line
, int column
)
3232 return SendMsg(2456, line
, column
);
3235 // Can the caret preferred x position only be changed by explicit movement commands?
3236 int wxStyledTextCtrl::GetCaretSticky() const
3238 return SendMsg(2457, 0, 0);
3241 // Stop the caret preferred x position changing when the user types.
3242 void wxStyledTextCtrl::SetCaretSticky(int useCaretStickyBehaviour
)
3244 SendMsg(2458, useCaretStickyBehaviour
, 0);
3247 // Switch between sticky and non-sticky: meant to be bound to a key.
3248 void wxStyledTextCtrl::ToggleCaretSticky()
3250 SendMsg(2459, 0, 0);
3253 // Enable/Disable convert-on-paste for line endings
3254 void wxStyledTextCtrl::SetPasteConvertEndings(bool convert
)
3256 SendMsg(2467, convert
, 0);
3259 // Get convert-on-paste setting
3260 bool wxStyledTextCtrl::GetPasteConvertEndings() const
3262 return SendMsg(2468, 0, 0) != 0;
3265 // Duplicate the selection. If selection empty duplicate the line containing the caret.
3266 void wxStyledTextCtrl::SelectionDuplicate()
3268 SendMsg(2469, 0, 0);
3271 // Set background alpha of the caret line.
3272 void wxStyledTextCtrl::SetCaretLineBackAlpha(int alpha
)
3274 SendMsg(2470, alpha
, 0);
3277 // Get the background alpha of the caret line.
3278 int wxStyledTextCtrl::GetCaretLineBackAlpha() const
3280 return SendMsg(2471, 0, 0);
3283 // Set the style of the caret to be drawn.
3284 void wxStyledTextCtrl::SetCaretStyle(int caretStyle
)
3286 SendMsg(2512, caretStyle
, 0);
3289 // Returns the current style of the caret.
3290 int wxStyledTextCtrl::GetCaretStyle() const
3292 return SendMsg(2513, 0, 0);
3295 // Set the indicator used for IndicatorFillRange and IndicatorClearRange
3296 void wxStyledTextCtrl::SetIndicatorCurrent(int indicator
)
3298 SendMsg(2500, indicator
, 0);
3301 // Get the current indicator
3302 int wxStyledTextCtrl::GetIndicatorCurrent() const
3304 return SendMsg(2501, 0, 0);
3307 // Set the value used for IndicatorFillRange
3308 void wxStyledTextCtrl::SetIndicatorValue(int value
)
3310 SendMsg(2502, value
, 0);
3313 // Get the current indicator value
3314 int wxStyledTextCtrl::GetIndicatorValue() const
3316 return SendMsg(2503, 0, 0);
3319 // Turn a indicator on over a range.
3320 void wxStyledTextCtrl::IndicatorFillRange(int position
, int fillLength
)
3322 SendMsg(2504, position
, fillLength
);
3325 // Turn a indicator off over a range.
3326 void wxStyledTextCtrl::IndicatorClearRange(int position
, int clearLength
)
3328 SendMsg(2505, position
, clearLength
);
3331 // Are any indicators present at position?
3332 int wxStyledTextCtrl::IndicatorAllOnFor(int position
)
3334 return SendMsg(2506, position
, 0);
3337 // What value does a particular indicator have at at a position?
3338 int wxStyledTextCtrl::IndicatorValueAt(int indicator
, int position
)
3340 return SendMsg(2507, indicator
, position
);
3343 // Where does a particular indicator start?
3344 int wxStyledTextCtrl::IndicatorStart(int indicator
, int position
)
3346 return SendMsg(2508, indicator
, position
);
3349 // Where does a particular indicator end?
3350 int wxStyledTextCtrl::IndicatorEnd(int indicator
, int position
)
3352 return SendMsg(2509, indicator
, position
);
3355 // Set number of entries in position cache
3356 void wxStyledTextCtrl::SetPositionCacheSize(int size
)
3358 SendMsg(2514, size
, 0);
3361 // How many entries are allocated to the position cache?
3362 int wxStyledTextCtrl::GetPositionCacheSize() const
3364 return SendMsg(2515, 0, 0);
3367 // Copy the selection, if selection empty copy the line with the caret
3368 void wxStyledTextCtrl::CopyAllowLine()
3370 SendMsg(2519, 0, 0);
3373 // Compact the document buffer and return a read-only pointer to the
3374 // characters in the document.
3375 const char* wxStyledTextCtrl::GetCharacterPointer() const {
3376 return (const char*)SendMsg(2520, 0, 0);
3379 // Return a read-only pointer to a range of characters in the document.
3380 // May move the gap so that the range is contiguous, but will only move up
3381 // to rangeLength bytes.
3382 const char* wxStyledTextCtrl::GetRangePointer(int position
, int rangeLength
) const {
3383 return (const char*)SendMsg(2643, position
, rangeLength
);
3386 // Return a position which, to avoid performance costs, should not be within
3387 // the range of a call to GetRangePointer.
3388 int wxStyledTextCtrl::GetGapPosition() const
3390 return SendMsg(2644, 0, 0);
3393 // Always interpret keyboard input as Unicode
3394 void wxStyledTextCtrl::SetKeysUnicode(bool keysUnicode
)
3396 SendMsg(2521, keysUnicode
, 0);
3399 // Are keys always interpreted as Unicode?
3400 bool wxStyledTextCtrl::GetKeysUnicode() const
3402 return SendMsg(2522, 0, 0) != 0;
3405 // Set the alpha fill colour of the given indicator.
3406 void wxStyledTextCtrl::IndicatorSetAlpha(int indicator
, int alpha
)
3408 SendMsg(2523, indicator
, alpha
);
3411 // Get the alpha fill colour of the given indicator.
3412 int wxStyledTextCtrl::IndicatorGetAlpha(int indicator
) const
3414 return SendMsg(2524, indicator
, 0);
3417 // Set the alpha outline colour of the given indicator.
3418 void wxStyledTextCtrl::IndicatorSetOutlineAlpha(int indicator
, int alpha
)
3420 SendMsg(2558, indicator
, alpha
);
3423 // Get the alpha outline colour of the given indicator.
3424 int wxStyledTextCtrl::IndicatorGetOutlineAlpha(int indicator
) const
3426 return SendMsg(2559, indicator
, 0);
3429 // Set extra ascent for each line
3430 void wxStyledTextCtrl::SetExtraAscent(int extraAscent
)
3432 SendMsg(2525, extraAscent
, 0);
3435 // Get extra ascent for each line
3436 int wxStyledTextCtrl::GetExtraAscent() const
3438 return SendMsg(2526, 0, 0);
3441 // Set extra descent for each line
3442 void wxStyledTextCtrl::SetExtraDescent(int extraDescent
)
3444 SendMsg(2527, extraDescent
, 0);
3447 // Get extra descent for each line
3448 int wxStyledTextCtrl::GetExtraDescent() const
3450 return SendMsg(2528, 0, 0);
3453 // Which symbol was defined for markerNumber with MarkerDefine
3454 int wxStyledTextCtrl::GetMarkerSymbolDefined(int markerNumber
)
3456 return SendMsg(2529, markerNumber
, 0);
3459 // Set the text in the text margin for a line
3460 void wxStyledTextCtrl::MarginSetText(int line
, const wxString
& text
)
3462 SendMsg(2530, line
, (sptr_t
)(const char*)wx2stc(text
));
3465 // Get the text in the text margin for a line
3466 wxString
wxStyledTextCtrl::MarginGetText(int line
) const {
3468 long len
= SendMsg(msg
, line
, 0);
3470 wxMemoryBuffer
mbuf(len
+1);
3471 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3472 SendMsg(msg
, line
, (sptr_t
)buf
);
3473 mbuf
.UngetWriteBuf(len
);
3478 // Set the style number for the text margin for a line
3479 void wxStyledTextCtrl::MarginSetStyle(int line
, int style
)
3481 SendMsg(2532, line
, style
);
3484 // Get the style number for the text margin for a line
3485 int wxStyledTextCtrl::MarginGetStyle(int line
) const
3487 return SendMsg(2533, line
, 0);
3490 // Set the style in the text margin for a line
3491 void wxStyledTextCtrl::MarginSetStyles(int line
, const wxString
& styles
)
3493 SendMsg(2534, line
, (sptr_t
)(const char*)wx2stc(styles
));
3496 // Get the styles in the text margin for a line
3497 wxString
wxStyledTextCtrl::MarginGetStyles(int line
) const {
3499 long len
= SendMsg(msg
, line
, 0);
3501 wxMemoryBuffer
mbuf(len
+1);
3502 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3503 SendMsg(msg
, line
, (sptr_t
)buf
);
3504 mbuf
.UngetWriteBuf(len
);
3509 // Clear the margin text on all lines
3510 void wxStyledTextCtrl::MarginTextClearAll()
3512 SendMsg(2536, 0, 0);
3515 // Get the start of the range of style numbers used for margin text
3516 void wxStyledTextCtrl::MarginSetStyleOffset(int style
)
3518 SendMsg(2537, style
, 0);
3521 // Get the start of the range of style numbers used for margin text
3522 int wxStyledTextCtrl::MarginGetStyleOffset() const
3524 return SendMsg(2538, 0, 0);
3527 // Set the margin options.
3528 void wxStyledTextCtrl::SetMarginOptions(int marginOptions
)
3530 SendMsg(2539, marginOptions
, 0);
3533 // Get the margin options.
3534 int wxStyledTextCtrl::GetMarginOptions() const
3536 return SendMsg(2557, 0, 0);
3539 // Set the annotation text for a line
3540 void wxStyledTextCtrl::AnnotationSetText(int line
, const wxString
& text
)
3542 SendMsg(2540, line
, (sptr_t
)(const char*)wx2stc(text
));
3545 // Get the annotation text for a line
3546 wxString
wxStyledTextCtrl::AnnotationGetText(int line
) const {
3548 long len
= SendMsg(msg
, line
, 0);
3550 wxMemoryBuffer
mbuf(len
+1);
3551 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3552 SendMsg(msg
, line
, (sptr_t
)buf
);
3553 mbuf
.UngetWriteBuf(len
);
3558 // Set the style number for the annotations for a line
3559 void wxStyledTextCtrl::AnnotationSetStyle(int line
, int style
)
3561 SendMsg(2542, line
, style
);
3564 // Get the style number for the annotations for a line
3565 int wxStyledTextCtrl::AnnotationGetStyle(int line
) const
3567 return SendMsg(2543, line
, 0);
3570 // Set the annotation styles for a line
3571 void wxStyledTextCtrl::AnnotationSetStyles(int line
, const wxString
& styles
)
3573 SendMsg(2544, line
, (sptr_t
)(const char*)wx2stc(styles
));
3576 // Get the annotation styles for a line
3577 wxString
wxStyledTextCtrl::AnnotationGetStyles(int line
) const {
3579 long len
= SendMsg(msg
, line
, 0);
3581 wxMemoryBuffer
mbuf(len
+1);
3582 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3583 SendMsg(msg
, line
, (sptr_t
)buf
);
3584 mbuf
.UngetWriteBuf(len
);
3589 // Get the number of annotation lines for a line
3590 int wxStyledTextCtrl::AnnotationGetLines(int line
) const
3592 return SendMsg(2546, line
, 0);
3595 // Clear the annotations from all lines
3596 void wxStyledTextCtrl::AnnotationClearAll()
3598 SendMsg(2547, 0, 0);
3601 // Set the visibility for the annotations for a view
3602 void wxStyledTextCtrl::AnnotationSetVisible(int visible
)
3604 SendMsg(2548, visible
, 0);
3607 // Get the visibility for the annotations for a view
3608 int wxStyledTextCtrl::AnnotationGetVisible() const
3610 return SendMsg(2549, 0, 0);
3613 // Get the start of the range of style numbers used for annotations
3614 void wxStyledTextCtrl::AnnotationSetStyleOffset(int style
)
3616 SendMsg(2550, style
, 0);
3619 // Get the start of the range of style numbers used for annotations
3620 int wxStyledTextCtrl::AnnotationGetStyleOffset() const
3622 return SendMsg(2551, 0, 0);
3625 // Add a container action to the undo stack
3626 void wxStyledTextCtrl::AddUndoAction(int token
, int flags
)
3628 SendMsg(2560, token
, flags
);
3631 // Find the position of a character from a point within the window.
3632 int wxStyledTextCtrl::CharPositionFromPoint(int x
, int y
)
3634 return SendMsg(2561, x
, y
);
3637 // Find the position of a character from a point within the window.
3638 // Return INVALID_POSITION if not close to text.
3639 int wxStyledTextCtrl::CharPositionFromPointClose(int x
, int y
)
3641 return SendMsg(2562, x
, y
);
3644 // Set whether multiple selections can be made
3645 void wxStyledTextCtrl::SetMultipleSelection(bool multipleSelection
)
3647 SendMsg(2563, multipleSelection
, 0);
3650 // Whether multiple selections can be made
3651 bool wxStyledTextCtrl::GetMultipleSelection() const
3653 return SendMsg(2564, 0, 0) != 0;
3656 // Set whether typing can be performed into multiple selections
3657 void wxStyledTextCtrl::SetAdditionalSelectionTyping(bool additionalSelectionTyping
)
3659 SendMsg(2565, additionalSelectionTyping
, 0);
3662 // Whether typing can be performed into multiple selections
3663 bool wxStyledTextCtrl::GetAdditionalSelectionTyping() const
3665 return SendMsg(2566, 0, 0) != 0;
3668 // Set whether additional carets will blink
3669 void wxStyledTextCtrl::SetAdditionalCaretsBlink(bool additionalCaretsBlink
)
3671 SendMsg(2567, additionalCaretsBlink
, 0);
3674 // Whether additional carets will blink
3675 bool wxStyledTextCtrl::GetAdditionalCaretsBlink() const
3677 return SendMsg(2568, 0, 0) != 0;
3680 // Set whether additional carets are visible
3681 void wxStyledTextCtrl::SetAdditionalCaretsVisible(bool additionalCaretsBlink
)
3683 SendMsg(2608, additionalCaretsBlink
, 0);
3686 // Whether additional carets are visible
3687 bool wxStyledTextCtrl::GetAdditionalCaretsVisible() const
3689 return SendMsg(2609, 0, 0) != 0;
3692 // How many selections are there?
3693 int wxStyledTextCtrl::GetSelections() const
3695 return SendMsg(2570, 0, 0);
3698 // Clear selections to a single empty stream selection
3699 void wxStyledTextCtrl::ClearSelections()
3701 SendMsg(2571, 0, 0);
3705 int wxStyledTextCtrl::AddSelection(int caret
, int anchor
)
3707 return SendMsg(2573, caret
, anchor
);
3710 // Set the main selection
3711 void wxStyledTextCtrl::SetMainSelection(int selection
)
3713 SendMsg(2574, selection
, 0);
3716 // Which selection is the main selection
3717 int wxStyledTextCtrl::GetMainSelection() const
3719 return SendMsg(2575, 0, 0);
3721 void wxStyledTextCtrl::SetSelectionNCaret(int selection
, int pos
)
3723 SendMsg(2576, selection
, pos
);
3725 int wxStyledTextCtrl::GetSelectionNCaret(int selection
) const
3727 return SendMsg(2577, selection
, 0);
3729 void wxStyledTextCtrl::SetSelectionNAnchor(int selection
, int posAnchor
)
3731 SendMsg(2578, selection
, posAnchor
);
3733 int wxStyledTextCtrl::GetSelectionNAnchor(int selection
) const
3735 return SendMsg(2579, selection
, 0);
3737 void wxStyledTextCtrl::SetSelectionNCaretVirtualSpace(int selection
, int space
)
3739 SendMsg(2580, selection
, space
);
3741 int wxStyledTextCtrl::GetSelectionNCaretVirtualSpace(int selection
) const
3743 return SendMsg(2581, selection
, 0);
3745 void wxStyledTextCtrl::SetSelectionNAnchorVirtualSpace(int selection
, int space
)
3747 SendMsg(2582, selection
, space
);
3749 int wxStyledTextCtrl::GetSelectionNAnchorVirtualSpace(int selection
) const
3751 return SendMsg(2583, selection
, 0);
3754 // Sets the position that starts the selection - this becomes the anchor.
3755 void wxStyledTextCtrl::SetSelectionNStart(int selection
, int pos
)
3757 SendMsg(2584, selection
, pos
);
3760 // Returns the position at the start of the selection.
3761 int wxStyledTextCtrl::GetSelectionNStart(int selection
) const
3763 return SendMsg(2585, selection
, 0);
3766 // Sets the position that ends the selection - this becomes the currentPosition.
3767 void wxStyledTextCtrl::SetSelectionNEnd(int selection
, int pos
)
3769 SendMsg(2586, selection
, pos
);
3772 // Returns the position at the end of the selection.
3773 int wxStyledTextCtrl::GetSelectionNEnd(int selection
) const
3775 return SendMsg(2587, selection
, 0);
3777 void wxStyledTextCtrl::SetRectangularSelectionCaret(int pos
)
3779 SendMsg(2588, pos
, 0);
3781 int wxStyledTextCtrl::GetRectangularSelectionCaret() const
3783 return SendMsg(2589, 0, 0);
3785 void wxStyledTextCtrl::SetRectangularSelectionAnchor(int posAnchor
)
3787 SendMsg(2590, posAnchor
, 0);
3789 int wxStyledTextCtrl::GetRectangularSelectionAnchor() const
3791 return SendMsg(2591, 0, 0);
3793 void wxStyledTextCtrl::SetRectangularSelectionCaretVirtualSpace(int space
)
3795 SendMsg(2592, space
, 0);
3797 int wxStyledTextCtrl::GetRectangularSelectionCaretVirtualSpace() const
3799 return SendMsg(2593, 0, 0);
3801 void wxStyledTextCtrl::SetRectangularSelectionAnchorVirtualSpace(int space
)
3803 SendMsg(2594, space
, 0);
3805 int wxStyledTextCtrl::GetRectangularSelectionAnchorVirtualSpace() const
3807 return SendMsg(2595, 0, 0);
3809 void wxStyledTextCtrl::SetVirtualSpaceOptions(int virtualSpaceOptions
)
3811 SendMsg(2596, virtualSpaceOptions
, 0);
3813 int wxStyledTextCtrl::GetVirtualSpaceOptions() const
3815 return SendMsg(2597, 0, 0);
3818 // On GTK+, allow selecting the modifier key to use for mouse-based
3819 // rectangular selection. Often the window manager requires Alt+Mouse Drag
3820 // for moving windows.
3821 // Valid values are SCMOD_CTRL(default), SCMOD_ALT, or SCMOD_SUPER.
3822 void wxStyledTextCtrl::SetRectangularSelectionModifier(int modifier
)
3824 SendMsg(2598, modifier
, 0);
3827 // Get the modifier key used for rectangular selection.
3828 int wxStyledTextCtrl::GetRectangularSelectionModifier() const
3830 return SendMsg(2599, 0, 0);
3833 // Set the foreground colour of additional selections.
3834 // Must have previously called SetSelFore with non-zero first argument for this to have an effect.
3835 void wxStyledTextCtrl::SetAdditionalSelForeground(const wxColour
& fore
)
3837 SendMsg(2600, wxColourAsLong(fore
), 0);
3840 // Set the background colour of additional selections.
3841 // Must have previously called SetSelBack with non-zero first argument for this to have an effect.
3842 void wxStyledTextCtrl::SetAdditionalSelBackground(const wxColour
& back
)
3844 SendMsg(2601, wxColourAsLong(back
), 0);
3847 // Set the alpha of the selection.
3848 void wxStyledTextCtrl::SetAdditionalSelAlpha(int alpha
)
3850 SendMsg(2602, alpha
, 0);
3853 // Get the alpha of the selection.
3854 int wxStyledTextCtrl::GetAdditionalSelAlpha() const
3856 return SendMsg(2603, 0, 0);
3859 // Set the foreground colour of additional carets.
3860 void wxStyledTextCtrl::SetAdditionalCaretForeground(const wxColour
& fore
)
3862 SendMsg(2604, wxColourAsLong(fore
), 0);
3865 // Get the foreground colour of additional carets.
3866 wxColour
wxStyledTextCtrl::GetAdditionalCaretForeground() const
3868 long c
= SendMsg(2605, 0, 0);
3869 return wxColourFromLong(c
);
3872 // Set the main selection to the next selection.
3873 void wxStyledTextCtrl::RotateSelection()
3875 SendMsg(2606, 0, 0);
3878 // Swap that caret and anchor of the main selection.
3879 void wxStyledTextCtrl::SwapMainAnchorCaret()
3881 SendMsg(2607, 0, 0);
3884 // Indicate that the internal state of a lexer has changed over a range and therefore
3885 // there may be a need to redraw.
3886 int wxStyledTextCtrl::ChangeLexerState(int start
, int end
)
3888 return SendMsg(2617, start
, end
);
3891 // Find the next line at or after lineStart that is a contracted fold header line.
3892 // Return -1 when no more lines.
3893 int wxStyledTextCtrl::ContractedFoldNext(int lineStart
)
3895 return SendMsg(2618, lineStart
, 0);
3898 // Centre current line in window.
3899 void wxStyledTextCtrl::VerticalCentreCaret()
3901 SendMsg(2619, 0, 0);
3904 // Move the selected lines up one line, shifting the line above after the selection
3905 void wxStyledTextCtrl::MoveSelectedLinesUp()
3907 SendMsg(2620, 0, 0);
3910 // Move the selected lines down one line, shifting the line below before the selection
3911 void wxStyledTextCtrl::MoveSelectedLinesDown()
3913 SendMsg(2621, 0, 0);
3916 // Set the identifier reported as idFrom in notification messages.
3917 void wxStyledTextCtrl::SetIdentifier(int identifier
)
3919 SendMsg(2622, identifier
, 0);
3922 // Get the identifier.
3923 int wxStyledTextCtrl::GetIdentifier() const
3925 return SendMsg(2623, 0, 0);
3928 // Set the width for future RGBA image data.
3929 void wxStyledTextCtrl::RGBAImageSetWidth(int width
)
3931 SendMsg(2624, width
, 0);
3934 // Set the height for future RGBA image data.
3935 void wxStyledTextCtrl::RGBAImageSetHeight(int height
)
3937 SendMsg(2625, height
, 0);
3940 // Define a marker from RGBA data.
3941 // It has the width and height from RGBAImageSetWidth/Height
3942 void wxStyledTextCtrl::MarkerDefineRGBAImage(int markerNumber
, const unsigned char* pixels
) {
3943 SendMsg(2626, markerNumber
, (sptr_t
)pixels
);
3946 // Register an RGBA image for use in autocompletion lists.
3947 // It has the width and height from RGBAImageSetWidth/Height
3948 void wxStyledTextCtrl::RegisterRGBAImage(int type
, const unsigned char* pixels
) {
3949 SendMsg(2627, type
, (sptr_t
)pixels
);
3952 // Scroll to start of document.
3953 void wxStyledTextCtrl::ScrollToStart()
3955 SendMsg(2628, 0, 0);
3958 // Scroll to end of document.
3959 void wxStyledTextCtrl::ScrollToEnd()
3961 SendMsg(2629, 0, 0);
3964 // Set the technology used.
3965 void wxStyledTextCtrl::SetTechnology(int technology
)
3967 SendMsg(2630, technology
, 0);
3971 int wxStyledTextCtrl::GetTechnology() const
3973 return SendMsg(2631, 0, 0);
3976 // Create an ILoader*.
3977 void* wxStyledTextCtrl::CreateLoader(int bytes
) const {
3978 return (void*)(sptr_t
)SendMsg(2632, bytes
);
3981 // Start notifying the container of all key presses and commands.
3982 void wxStyledTextCtrl::StartRecord()
3984 SendMsg(3001, 0, 0);
3987 // Stop notifying the container of all key presses and commands.
3988 void wxStyledTextCtrl::StopRecord()
3990 SendMsg(3002, 0, 0);
3993 // Set the lexing language of the document.
3994 void wxStyledTextCtrl::SetLexer(int lexer
)
3996 SendMsg(4001, lexer
, 0);
3999 // Retrieve the lexing language of the document.
4000 int wxStyledTextCtrl::GetLexer() const
4002 return SendMsg(4002, 0, 0);
4005 // Colourise a segment of the document using the current lexing language.
4006 void wxStyledTextCtrl::Colourise(int start
, int end
)
4008 SendMsg(4003, start
, end
);
4011 // Set up a value that may be used by a lexer for some optional feature.
4012 void wxStyledTextCtrl::SetProperty(const wxString
& key
, const wxString
& value
)
4014 SendMsg(4004, (sptr_t
)(const char*)wx2stc(key
), (sptr_t
)(const char*)wx2stc(value
));
4017 // Set up the key words used by the lexer.
4018 void wxStyledTextCtrl::SetKeyWords(int keywordSet
, const wxString
& keyWords
)
4020 SendMsg(4005, keywordSet
, (sptr_t
)(const char*)wx2stc(keyWords
));
4023 // Set the lexing language of the document based on string name.
4024 void wxStyledTextCtrl::SetLexerLanguage(const wxString
& language
)
4026 SendMsg(4006, 0, (sptr_t
)(const char*)wx2stc(language
));
4029 // Retrieve a 'property' value previously set with SetProperty.
4030 wxString
wxStyledTextCtrl::GetProperty(const wxString
& key
) {
4031 int len
= SendMsg(SCI_GETPROPERTY
, (sptr_t
)(const char*)wx2stc(key
), 0);
4032 if (!len
) return wxEmptyString
;
4034 wxMemoryBuffer
mbuf(len
+1);
4035 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
4036 SendMsg(4008, (uptr_t
)(const char*)wx2stc(key
), (sptr_t
)buf
);
4037 mbuf
.UngetWriteBuf(len
);
4042 // Retrieve a 'property' value previously set with SetProperty,
4043 // with '$()' variable replacement on returned buffer.
4044 wxString
wxStyledTextCtrl::GetPropertyExpanded(const wxString
& key
) {
4045 int len
= SendMsg(SCI_GETPROPERTYEXPANDED
, (uptr_t
)(const char*)wx2stc(key
), 0);
4046 if (!len
) return wxEmptyString
;
4048 wxMemoryBuffer
mbuf(len
+1);
4049 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
4050 SendMsg(4009, (uptr_t
)(const char*)wx2stc(key
), (sptr_t
)buf
);
4051 mbuf
.UngetWriteBuf(len
);
4056 // Retrieve a 'property' value previously set with SetProperty,
4057 // interpreted as an int AFTER any '$()' variable replacement.
4058 int wxStyledTextCtrl::GetPropertyInt(const wxString
& key
) const
4060 return SendMsg(4010, (sptr_t
)(const char*)wx2stc(key
), 0);
4063 // Retrieve the number of bits the current lexer needs for styling.
4064 int wxStyledTextCtrl::GetStyleBitsNeeded() const
4066 return SendMsg(4011, 0, 0);
4069 // For private communication between an application and a known lexer.
4070 void* wxStyledTextCtrl::PrivateLexerCall(int operation
, void* pointer
) {
4071 return (void*)(sptr_t
)SendMsg(4013, operation
, (sptr_t
)pointer
);
4074 // Retrieve a '\n' separated list of properties understood by the current lexer.
4075 wxString
wxStyledTextCtrl::PropertyNames() const {
4077 int len
= SendMsg(msg
, 0, (sptr_t
)NULL
);
4078 if (!len
) return wxEmptyString
;
4080 wxMemoryBuffer
mbuf(len
+1);
4081 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
4082 SendMsg(msg
, 0, (sptr_t
)buf
);
4083 mbuf
.UngetWriteBuf(len
);
4088 // Retrieve the type of a property.
4089 int wxStyledTextCtrl::PropertyType(const wxString
& name
)
4091 return SendMsg(4015, (sptr_t
)(const char*)wx2stc(name
), 0);
4094 // Describe a property.
4095 wxString
wxStyledTextCtrl::DescribeProperty(const wxString
& name
) const {
4097 int len
= SendMsg(msg
, (sptr_t
)(const char*)wx2stc(name
), (sptr_t
)NULL
);
4098 if (!len
) return wxEmptyString
;
4100 wxMemoryBuffer
mbuf(len
+1);
4101 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
4102 SendMsg(msg
, (sptr_t
)(const char*)wx2stc(name
), (sptr_t
)buf
);
4103 mbuf
.UngetWriteBuf(len
);
4108 // Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer.
4109 wxString
wxStyledTextCtrl::DescribeKeyWordSets() const {
4111 int len
= SendMsg(msg
, 0, (sptr_t
)NULL
);
4112 if (!len
) return wxEmptyString
;
4114 wxMemoryBuffer
mbuf(len
+1);
4115 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
4116 SendMsg(msg
, 0, (sptr_t
)buf
);
4117 mbuf
.UngetWriteBuf(len
);
4123 //----------------------------------------------------------------------
4126 // Returns the line number of the line with the caret.
4127 int wxStyledTextCtrl::GetCurrentLine() {
4128 int line
= LineFromPosition(GetCurrentPos());
4133 // Extract style settings from a spec-string which is composed of one or
4134 // more of the following comma separated elements:
4136 // bold turns on bold
4137 // italic turns on italics
4138 // fore:[name or #RRGGBB] sets the foreground colour
4139 // back:[name or #RRGGBB] sets the background colour
4140 // face:[facename] sets the font face name to use
4141 // size:[num] sets the font size in points
4142 // eol turns on eol filling
4143 // underline turns on underlining
4145 void wxStyledTextCtrl::StyleSetSpec(int styleNum
, const wxString
& spec
) {
4147 wxStringTokenizer
tkz(spec
, wxT(","));
4148 while (tkz
.HasMoreTokens()) {
4149 wxString token
= tkz
.GetNextToken();
4151 wxString option
= token
.BeforeFirst(':');
4152 wxString val
= token
.AfterFirst(':');
4154 if (option
== wxT("bold"))
4155 StyleSetBold(styleNum
, true);
4157 else if (option
== wxT("italic"))
4158 StyleSetItalic(styleNum
, true);
4160 else if (option
== wxT("underline"))
4161 StyleSetUnderline(styleNum
, true);
4163 else if (option
== wxT("eol"))
4164 StyleSetEOLFilled(styleNum
, true);
4166 else if (option
== wxT("size")) {
4168 if (val
.ToLong(&points
))
4169 StyleSetSize(styleNum
, points
);
4172 else if (option
== wxT("face"))
4173 StyleSetFaceName(styleNum
, val
);
4175 else if (option
== wxT("fore"))
4176 StyleSetForeground(styleNum
, wxColourFromSpec(val
));
4178 else if (option
== wxT("back"))
4179 StyleSetBackground(styleNum
, wxColourFromSpec(val
));
4184 // Get the font of a style
4185 wxFont
wxStyledTextCtrl::StyleGetFont(int style
) {
4187 font
.SetPointSize(StyleGetSize(style
));
4188 font
.SetFaceName(StyleGetFaceName(style
));
4189 if( StyleGetBold(style
) )
4190 font
.SetWeight(wxFONTWEIGHT_BOLD
);
4192 font
.SetWeight(wxFONTWEIGHT_NORMAL
);
4194 if( StyleGetItalic(style
) )
4195 font
.SetStyle(wxFONTSTYLE_ITALIC
);
4197 font
.SetStyle(wxFONTSTYLE_NORMAL
);
4203 // Set style size, face, bold, italic, and underline attributes from
4204 // a wxFont's attributes.
4205 void wxStyledTextCtrl::StyleSetFont(int styleNum
, wxFont
& font
) {
4207 // Ensure that the native font is initialized
4209 GetTextExtent(wxT("X"), &x
, &y
, NULL
, NULL
, &font
);
4211 int size
= font
.GetPointSize();
4212 wxString faceName
= font
.GetFaceName();
4213 bool bold
= font
.GetWeight() == wxBOLD
;
4214 bool italic
= font
.GetStyle() != wxNORMAL
;
4215 bool under
= font
.GetUnderlined();
4216 wxFontEncoding encoding
= font
.GetEncoding();
4218 StyleSetFontAttr(styleNum
, size
, faceName
, bold
, italic
, under
, encoding
);
4221 // Set all font style attributes at once.
4222 void wxStyledTextCtrl::StyleSetFontAttr(int styleNum
, int size
,
4223 const wxString
& faceName
,
4224 bool bold
, bool italic
,
4226 wxFontEncoding encoding
) {
4227 StyleSetSize(styleNum
, size
);
4228 StyleSetFaceName(styleNum
, faceName
);
4229 StyleSetBold(styleNum
, bold
);
4230 StyleSetItalic(styleNum
, italic
);
4231 StyleSetUnderline(styleNum
, underline
);
4232 StyleSetFontEncoding(styleNum
, encoding
);
4236 // Set the character set of the font in a style. Converts the Scintilla
4237 // character set values to a wxFontEncoding.
4238 void wxStyledTextCtrl::StyleSetCharacterSet(int style
, int characterSet
)
4240 wxFontEncoding encoding
;
4242 // Translate the Scintilla characterSet to a wxFontEncoding
4243 switch (characterSet
) {
4245 case wxSTC_CHARSET_ANSI
:
4246 case wxSTC_CHARSET_DEFAULT
:
4247 encoding
= wxFONTENCODING_DEFAULT
;
4250 case wxSTC_CHARSET_BALTIC
:
4251 encoding
= wxFONTENCODING_ISO8859_13
;
4254 case wxSTC_CHARSET_CHINESEBIG5
:
4255 encoding
= wxFONTENCODING_CP950
;
4258 case wxSTC_CHARSET_EASTEUROPE
:
4259 encoding
= wxFONTENCODING_ISO8859_2
;
4262 case wxSTC_CHARSET_GB2312
:
4263 encoding
= wxFONTENCODING_CP936
;
4266 case wxSTC_CHARSET_GREEK
:
4267 encoding
= wxFONTENCODING_ISO8859_7
;
4270 case wxSTC_CHARSET_HANGUL
:
4271 encoding
= wxFONTENCODING_CP949
;
4274 case wxSTC_CHARSET_MAC
:
4275 encoding
= wxFONTENCODING_DEFAULT
;
4278 case wxSTC_CHARSET_OEM
:
4279 encoding
= wxFONTENCODING_DEFAULT
;
4282 case wxSTC_CHARSET_RUSSIAN
:
4283 encoding
= wxFONTENCODING_KOI8
;
4286 case wxSTC_CHARSET_SHIFTJIS
:
4287 encoding
= wxFONTENCODING_CP932
;
4290 case wxSTC_CHARSET_SYMBOL
:
4291 encoding
= wxFONTENCODING_DEFAULT
;
4294 case wxSTC_CHARSET_TURKISH
:
4295 encoding
= wxFONTENCODING_ISO8859_9
;
4298 case wxSTC_CHARSET_JOHAB
:
4299 encoding
= wxFONTENCODING_DEFAULT
;
4302 case wxSTC_CHARSET_HEBREW
:
4303 encoding
= wxFONTENCODING_ISO8859_8
;
4306 case wxSTC_CHARSET_ARABIC
:
4307 encoding
= wxFONTENCODING_ISO8859_6
;
4310 case wxSTC_CHARSET_VIETNAMESE
:
4311 encoding
= wxFONTENCODING_DEFAULT
;
4314 case wxSTC_CHARSET_THAI
:
4315 encoding
= wxFONTENCODING_ISO8859_11
;
4318 case wxSTC_CHARSET_CYRILLIC
:
4319 encoding
= wxFONTENCODING_ISO8859_5
;
4322 case wxSTC_CHARSET_8859_15
:
4323 encoding
= wxFONTENCODING_ISO8859_15
;;
4327 // We just have Scintilla track the wxFontEncoding for us. It gets used
4328 // in Font::Create in PlatWX.cpp. We add one to the value so that the
4329 // effective wxFONENCODING_DEFAULT == SC_SHARSET_DEFAULT and so when
4330 // Scintilla internally uses SC_CHARSET_DEFAULT we will translate it back
4331 // to wxFONENCODING_DEFAULT in Font::Create.
4332 SendMsg(SCI_STYLESETCHARACTERSET
, style
, encoding
+1);
4336 // Set the font encoding to be used by a style.
4337 void wxStyledTextCtrl::StyleSetFontEncoding(int style
, wxFontEncoding encoding
)
4339 SendMsg(SCI_STYLESETCHARACTERSET
, style
, encoding
+1);
4343 // Perform one of the operations defined by the wxSTC_CMD_* constants.
4344 void wxStyledTextCtrl::CmdKeyExecute(int cmd
) {
4349 // Set the left and right margin in the edit area, measured in pixels.
4350 void wxStyledTextCtrl::SetMargins(int left
, int right
) {
4351 SetMarginLeft(left
);
4352 SetMarginRight(right
);
4356 // Retrieve the point in the window where a position is displayed.
4357 wxPoint
wxStyledTextCtrl::PointFromPosition(int pos
) {
4358 int x
= SendMsg(SCI_POINTXFROMPOSITION
, 0, pos
);
4359 int y
= SendMsg(SCI_POINTYFROMPOSITION
, 0, pos
);
4360 return wxPoint(x
, y
);
4363 // Scroll enough to make the given line visible
4364 void wxStyledTextCtrl::ScrollToLine(int line
) {
4365 m_swx
->DoScrollToLine(line
);
4369 // Scroll enough to make the given column visible
4370 void wxStyledTextCtrl::ScrollToColumn(int column
) {
4371 m_swx
->DoScrollToColumn(column
);
4376 bool wxStyledTextCtrl::DoSaveFile(const wxString
& filename
, int fileType
)
4378 bool ok
= wxTextAreaBase::DoSaveFile(filename
, fileType
);
4380 bool wxStyledTextCtrl::SaveFile(const wxString
& filename
)
4383 wxFFile
file(filename
, wxT("w"));
4384 bool ok
= file
.IsOpened() && file
.Write(GetValue(), *wxConvCurrent
);
4387 #endif // wxUSE_FFILE
4397 bool wxStyledTextCtrl::DoLoadFile(const wxString
& filename
, int fileType
)
4399 bool ok
= wxTextAreaBase::DoLoadFile(filename
, fileType
);
4401 bool wxStyledTextCtrl::LoadFile(const wxString
& filename
)
4404 wxFFile
file(filename
);
4405 bool ok
= file
.IsOpened();
4409 ok
= file
.ReadAll(&text
, *wxConvCurrent
);
4417 #endif // wxUSE_FFILE
4427 #if wxUSE_DRAG_AND_DROP
4428 wxDragResult
wxStyledTextCtrl::DoDragOver(wxCoord x
, wxCoord y
, wxDragResult def
) {
4429 return m_swx
->DoDragOver(x
, y
, def
);
4433 bool wxStyledTextCtrl::DoDropText(long x
, long y
, const wxString
& data
) {
4434 return m_swx
->DoDropText(x
, y
, data
);
4439 void wxStyledTextCtrl::SetUseAntiAliasing(bool useAA
) {
4440 m_swx
->SetUseAntiAliasing(useAA
);
4443 bool wxStyledTextCtrl::GetUseAntiAliasing() {
4444 return m_swx
->GetUseAntiAliasing();
4447 void wxStyledTextCtrl::AnnotationClearLine(int line
) {
4448 SendMsg(SCI_ANNOTATIONSETTEXT
, line
, NULL
);
4454 void wxStyledTextCtrl::AddTextRaw(const char* text
, int length
)
4457 length
= strlen(text
);
4458 SendMsg(SCI_ADDTEXT
, length
, (sptr_t
)text
);
4461 void wxStyledTextCtrl::InsertTextRaw(int pos
, const char* text
)
4463 SendMsg(SCI_INSERTTEXT
, pos
, (sptr_t
)text
);
4466 wxCharBuffer
wxStyledTextCtrl::GetCurLineRaw(int* linePos
)
4468 int len
= LineLength(GetCurrentLine());
4470 if (linePos
) *linePos
= 0;
4475 wxCharBuffer
buf(len
);
4476 int pos
= SendMsg(SCI_GETCURLINE
, len
, (sptr_t
)buf
.data());
4477 if (linePos
) *linePos
= pos
;
4481 wxCharBuffer
wxStyledTextCtrl::GetLineRaw(int line
)
4483 int len
= LineLength(line
);
4489 wxCharBuffer
buf(len
);
4490 SendMsg(SCI_GETLINE
, line
, (sptr_t
)buf
.data());
4494 wxCharBuffer
wxStyledTextCtrl::GetSelectedTextRaw()
4496 // Calculate the length needed first.
4497 const int len
= SendMsg(SCI_GETSELTEXT
, 0, (sptr_t
)0);
4499 // And then really get the data.
4500 wxCharBuffer
buf(len
);
4501 SendMsg(SCI_GETSELTEXT
, 0, (sptr_t
)buf
.data());
4505 wxCharBuffer
wxStyledTextCtrl::GetTextRangeRaw(int startPos
, int endPos
)
4507 if (endPos
< startPos
) {
4508 int temp
= startPos
;
4512 int len
= endPos
- startPos
;
4518 wxCharBuffer
buf(len
);
4520 tr
.lpstrText
= buf
.data();
4521 tr
.chrg
.cpMin
= startPos
;
4522 tr
.chrg
.cpMax
= endPos
;
4523 SendMsg(SCI_GETTEXTRANGE
, 0, (sptr_t
)&tr
);
4527 void wxStyledTextCtrl::SetTextRaw(const char* text
)
4529 SendMsg(SCI_SETTEXT
, 0, (sptr_t
)text
);
4532 wxCharBuffer
wxStyledTextCtrl::GetTextRaw()
4534 int len
= GetTextLength();
4535 wxCharBuffer
buf(len
); // adds 1 for NUL automatically
4536 SendMsg(SCI_GETTEXT
, len
+ 1, (sptr_t
)buf
.data());
4540 void wxStyledTextCtrl::AppendTextRaw(const char* text
, int length
)
4543 length
= strlen(text
);
4544 SendMsg(SCI_APPENDTEXT
, length
, (sptr_t
)text
);
4551 //----------------------------------------------------------------------
4554 void wxStyledTextCtrl::OnPaint(wxPaintEvent
& WXUNUSED(evt
)) {
4556 m_swx
->DoPaint(&dc
, GetUpdateRegion().GetBox());
4559 void wxStyledTextCtrl::OnScrollWin(wxScrollWinEvent
& evt
) {
4560 if (evt
.GetOrientation() == wxHORIZONTAL
)
4561 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
4563 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
4566 void wxStyledTextCtrl::OnScroll(wxScrollEvent
& evt
) {
4567 wxScrollBar
* sb
= wxDynamicCast(evt
.GetEventObject(), wxScrollBar
);
4569 if (sb
->IsVertical())
4570 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
4572 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
4576 void wxStyledTextCtrl::OnSize(wxSizeEvent
& WXUNUSED(evt
)) {
4578 wxSize sz
= GetClientSize();
4579 m_swx
->DoSize(sz
.x
, sz
.y
);
4583 void wxStyledTextCtrl::OnMouseLeftDown(wxMouseEvent
& evt
) {
4585 wxPoint pt
= evt
.GetPosition();
4586 m_swx
->DoLeftButtonDown(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
4587 evt
.ShiftDown(), evt
.ControlDown(), evt
.AltDown());
4590 void wxStyledTextCtrl::OnMouseMove(wxMouseEvent
& evt
) {
4591 wxPoint pt
= evt
.GetPosition();
4592 m_swx
->DoLeftButtonMove(Point(pt
.x
, pt
.y
));
4595 void wxStyledTextCtrl::OnMouseLeftUp(wxMouseEvent
& evt
) {
4596 wxPoint pt
= evt
.GetPosition();
4597 m_swx
->DoLeftButtonUp(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
4602 void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent
& evt
) {
4603 wxPoint pt
= evt
.GetPosition();
4604 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
4608 void wxStyledTextCtrl::OnMouseMiddleUp(wxMouseEvent
& evt
) {
4609 wxPoint pt
= evt
.GetPosition();
4610 m_swx
->DoMiddleButtonUp(Point(pt
.x
, pt
.y
));
4613 void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent
& evt
) {
4614 wxPoint pt
= evt
.GetPosition();
4615 ScreenToClient(&pt
.x
, &pt
.y
);
4617 Show context menu at event point if it's within the window,
4618 or at caret location if not
4620 wxHitTest ht
= this->HitTest(pt
);
4621 if (ht
!= wxHT_WINDOW_INSIDE
) {
4622 pt
= this->PointFromPosition(this->GetCurrentPos());
4624 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
4628 void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent
& evt
)
4630 m_swx
->DoMouseWheel(evt
.GetWheelRotation(),
4631 evt
.GetWheelDelta(),
4632 evt
.GetLinesPerAction(),
4634 evt
.IsPageScroll());
4638 void wxStyledTextCtrl::OnChar(wxKeyEvent
& evt
) {
4639 // On (some?) non-US PC keyboards the AltGr key is required to enter some
4640 // common characters. It comes to us as both Alt and Ctrl down so we need
4641 // to let the char through in that case, otherwise if only ctrl or only
4642 // alt let's skip it.
4643 bool ctrl
= evt
.ControlDown();
4645 // On the Mac the Alt key is just a modifier key (like Shift) so we need
4646 // to allow the char events to be processed when Alt is pressed.
4647 // TODO: Should we check MetaDown instead in this case?
4650 bool alt
= evt
.AltDown();
4652 bool skip
= ((ctrl
|| alt
) && ! (ctrl
&& alt
));
4655 // apparently if we don't do this, Unicode keys pressed after non-char
4656 // ASCII ones (e.g. Enter, Tab) are not taken into account (patch 1615989)
4657 if (m_lastKeyDownConsumed
&& evt
.GetUnicodeKey() > 255)
4658 m_lastKeyDownConsumed
= false;
4661 if (!m_lastKeyDownConsumed
&& !skip
) {
4663 int key
= evt
.GetUnicodeKey();
4666 // if the unicode key code is not really a unicode character (it may
4667 // be a function key or etc., the platforms appear to always give us a
4668 // small value in this case) then fallback to the ascii key code but
4669 // don't do anything for function keys or etc.
4671 key
= evt
.GetKeyCode();
4672 keyOk
= (key
<= 127);
4675 m_swx
->DoAddChar(key
);
4679 int key
= evt
.GetKeyCode();
4680 if (key
<= WXK_START
|| key
> WXK_COMMAND
) {
4681 m_swx
->DoAddChar(key
);
4691 void wxStyledTextCtrl::OnKeyDown(wxKeyEvent
& evt
) {
4692 int processed
= m_swx
->DoKeyDown(evt
, &m_lastKeyDownConsumed
);
4693 if (!processed
&& !m_lastKeyDownConsumed
)
4698 void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent
& evt
) {
4699 m_swx
->DoLoseFocus();
4704 void wxStyledTextCtrl::OnGainFocus(wxFocusEvent
& evt
) {
4705 m_swx
->DoGainFocus();
4710 void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent
& WXUNUSED(evt
)) {
4711 m_swx
->DoSysColourChange();
4715 void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent
& WXUNUSED(evt
)) {
4716 // do nothing to help avoid flashing
4721 void wxStyledTextCtrl::OnMenu(wxCommandEvent
& evt
) {
4722 m_swx
->DoCommand(evt
.GetId());
4726 void wxStyledTextCtrl::OnListBox(wxCommandEvent
& WXUNUSED(evt
)) {
4727 m_swx
->DoOnListBox();
4731 void wxStyledTextCtrl::OnIdle(wxIdleEvent
& evt
) {
4732 m_swx
->DoOnIdle(evt
);
4736 wxSize
wxStyledTextCtrl::DoGetBestSize() const
4738 // What would be the best size for a wxSTC?
4739 // Just give a reasonable minimum until something else can be figured out.
4740 return wxSize(200,100);
4744 //----------------------------------------------------------------------
4745 // Turn notifications from Scintilla into events
4748 void wxStyledTextCtrl::NotifyChange() {
4749 wxStyledTextEvent
evt(wxEVT_STC_CHANGE
, GetId());
4750 evt
.SetEventObject(this);
4751 GetEventHandler()->ProcessEvent(evt
);
4755 static void SetEventText(wxStyledTextEvent
& evt
, const char* text
,
4759 evt
.SetText(stc2wx(text
, length
));
4763 void wxStyledTextCtrl::NotifyParent(SCNotification
* _scn
) {
4764 SCNotification
& scn
= *_scn
;
4765 wxStyledTextEvent
evt(0, GetId());
4767 evt
.SetEventObject(this);
4768 evt
.SetPosition(scn
.position
);
4770 evt
.SetModifiers(scn
.modifiers
);
4772 switch (scn
.nmhdr
.code
) {
4773 case SCN_STYLENEEDED
:
4774 evt
.SetEventType(wxEVT_STC_STYLENEEDED
);
4778 evt
.SetEventType(wxEVT_STC_CHARADDED
);
4781 case SCN_SAVEPOINTREACHED
:
4782 evt
.SetEventType(wxEVT_STC_SAVEPOINTREACHED
);
4785 case SCN_SAVEPOINTLEFT
:
4786 evt
.SetEventType(wxEVT_STC_SAVEPOINTLEFT
);
4789 case SCN_MODIFYATTEMPTRO
:
4790 evt
.SetEventType(wxEVT_STC_ROMODIFYATTEMPT
);
4794 evt
.SetEventType(wxEVT_STC_KEY
);
4797 case SCN_DOUBLECLICK
:
4798 evt
.SetEventType(wxEVT_STC_DOUBLECLICK
);
4799 evt
.SetLine(scn
.line
);
4803 evt
.SetEventType(wxEVT_STC_UPDATEUI
);
4804 evt
.SetUpdated(scn
.updated
);
4808 evt
.SetEventType(wxEVT_STC_MODIFIED
);
4809 evt
.SetModificationType(scn
.modificationType
);
4810 SetEventText(evt
, scn
.text
, scn
.length
);
4811 evt
.SetLength(scn
.length
);
4812 evt
.SetLinesAdded(scn
.linesAdded
);
4813 evt
.SetLine(scn
.line
);
4814 evt
.SetFoldLevelNow(scn
.foldLevelNow
);
4815 evt
.SetFoldLevelPrev(scn
.foldLevelPrev
);
4816 evt
.SetToken(scn
.token
);
4817 evt
.SetAnnotationLinesAdded(scn
.annotationLinesAdded
);
4820 case SCN_MACRORECORD
:
4821 evt
.SetEventType(wxEVT_STC_MACRORECORD
);
4822 evt
.SetMessage(scn
.message
);
4823 evt
.SetWParam(scn
.wParam
);
4824 evt
.SetLParam(scn
.lParam
);
4827 case SCN_MARGINCLICK
:
4828 evt
.SetEventType(wxEVT_STC_MARGINCLICK
);
4829 evt
.SetMargin(scn
.margin
);
4833 evt
.SetEventType(wxEVT_STC_NEEDSHOWN
);
4834 evt
.SetLength(scn
.length
);
4838 evt
.SetEventType(wxEVT_STC_PAINTED
);
4841 case SCN_AUTOCSELECTION
:
4842 evt
.SetEventType(wxEVT_STC_AUTOCOMP_SELECTION
);
4843 evt
.SetListType(scn
.listType
);
4844 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
4845 evt
.SetPosition(scn
.lParam
);
4848 case SCN_USERLISTSELECTION
:
4849 evt
.SetEventType(wxEVT_STC_USERLISTSELECTION
);
4850 evt
.SetListType(scn
.listType
);
4851 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
4852 evt
.SetPosition(scn
.lParam
);
4855 case SCN_URIDROPPED
:
4856 evt
.SetEventType(wxEVT_STC_URIDROPPED
);
4857 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
4860 case SCN_DWELLSTART
:
4861 evt
.SetEventType(wxEVT_STC_DWELLSTART
);
4867 evt
.SetEventType(wxEVT_STC_DWELLEND
);
4873 evt
.SetEventType(wxEVT_STC_ZOOM
);
4876 case SCN_HOTSPOTCLICK
:
4877 evt
.SetEventType(wxEVT_STC_HOTSPOT_CLICK
);
4880 case SCN_HOTSPOTDOUBLECLICK
:
4881 evt
.SetEventType(wxEVT_STC_HOTSPOT_DCLICK
);
4884 case SCN_CALLTIPCLICK
:
4885 evt
.SetEventType(wxEVT_STC_CALLTIP_CLICK
);
4888 case SCN_INDICATORCLICK
:
4889 evt
.SetEventType(wxEVT_STC_INDICATOR_CLICK
);
4892 case SCN_INDICATORRELEASE
:
4893 evt
.SetEventType(wxEVT_STC_INDICATOR_RELEASE
);
4896 case SCN_AUTOCCANCELLED
:
4897 evt
.SetEventType(wxEVT_STC_AUTOCOMP_CANCELLED
);
4900 case SCN_AUTOCCHARDELETED
:
4901 evt
.SetEventType(wxEVT_STC_AUTOCOMP_CHAR_DELETED
);
4904 case SCN_HOTSPOTRELEASECLICK
:
4905 evt
.SetEventType(wxEVT_STC_HOTSPOT_RELEASE_CLICK
);
4912 GetEventHandler()->ProcessEvent(evt
);
4916 //----------------------------------------------------------------------
4917 //----------------------------------------------------------------------
4918 //----------------------------------------------------------------------
4920 wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType
, int id
)
4921 : wxCommandEvent(commandType
, id
)
4926 m_modificationType
= 0;
4931 m_foldLevelPrev
= 0;
4940 m_annotationLinesAdded
= 0;
4943 #if wxUSE_DRAG_AND_DROP
4944 m_dragFlags
= wxDrag_CopyOnly
;
4945 m_dragResult
= wxDragNone
;
4949 bool wxStyledTextEvent::GetShift() const { return (m_modifiers
& SCI_SHIFT
) != 0; }
4950 bool wxStyledTextEvent::GetControl() const { return (m_modifiers
& SCI_CTRL
) != 0; }
4951 bool wxStyledTextEvent::GetAlt() const { return (m_modifiers
& SCI_ALT
) != 0; }
4954 wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent
& event
):
4955 wxCommandEvent(event
)
4957 m_position
= event
.m_position
;
4958 m_key
= event
.m_key
;
4959 m_modifiers
= event
.m_modifiers
;
4960 m_modificationType
= event
.m_modificationType
;
4961 m_text
= event
.m_text
;
4962 m_length
= event
.m_length
;
4963 m_linesAdded
= event
.m_linesAdded
;
4964 m_line
= event
.m_line
;
4965 m_foldLevelNow
= event
.m_foldLevelNow
;
4966 m_foldLevelPrev
= event
.m_foldLevelPrev
;
4968 m_margin
= event
.m_margin
;
4970 m_message
= event
.m_message
;
4971 m_wParam
= event
.m_wParam
;
4972 m_lParam
= event
.m_lParam
;
4974 m_listType
= event
.m_listType
;
4978 m_token
= event
.m_token
;
4979 m_annotationLinesAdded
= event
.m_annotationLinesAdded
;
4980 m_updated
= event
.m_updated
;
4982 #if wxUSE_DRAG_AND_DROP
4983 m_dragText
= event
.m_dragText
;
4984 m_dragFlags
= event
.m_dragFlags
;
4985 m_dragResult
= event
.m_dragResult
;
4989 //----------------------------------------------------------------------
4990 //----------------------------------------------------------------------
4992 /*static*/ wxVersionInfo
wxStyledTextCtrl::GetLibraryVersionInfo()
4994 return wxVersionInfo("Scintilla", 3, 21, 0, "Scintilla 3.21");