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 license
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 DEFINE_EVENT_TYPE( wxEVT_STC_CHANGE
)
100 DEFINE_EVENT_TYPE( wxEVT_STC_STYLENEEDED
)
101 DEFINE_EVENT_TYPE( wxEVT_STC_CHARADDED
)
102 DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTREACHED
)
103 DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTLEFT
)
104 DEFINE_EVENT_TYPE( wxEVT_STC_ROMODIFYATTEMPT
)
105 DEFINE_EVENT_TYPE( wxEVT_STC_KEY
)
106 DEFINE_EVENT_TYPE( wxEVT_STC_DOUBLECLICK
)
107 DEFINE_EVENT_TYPE( wxEVT_STC_UPDATEUI
)
108 DEFINE_EVENT_TYPE( wxEVT_STC_MODIFIED
)
109 DEFINE_EVENT_TYPE( wxEVT_STC_MACRORECORD
)
110 DEFINE_EVENT_TYPE( wxEVT_STC_MARGINCLICK
)
111 DEFINE_EVENT_TYPE( wxEVT_STC_NEEDSHOWN
)
112 DEFINE_EVENT_TYPE( wxEVT_STC_PAINTED
)
113 DEFINE_EVENT_TYPE( wxEVT_STC_USERLISTSELECTION
)
114 DEFINE_EVENT_TYPE( wxEVT_STC_URIDROPPED
)
115 DEFINE_EVENT_TYPE( wxEVT_STC_DWELLSTART
)
116 DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND
)
117 DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG
)
118 DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER
)
119 DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP
)
120 DEFINE_EVENT_TYPE( wxEVT_STC_ZOOM
)
121 DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_CLICK
)
122 DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_DCLICK
)
123 DEFINE_EVENT_TYPE( wxEVT_STC_CALLTIP_CLICK
)
124 DEFINE_EVENT_TYPE( wxEVT_STC_AUTOCOMP_SELECTION
)
125 DEFINE_EVENT_TYPE( wxEVT_STC_INDICATOR_CLICK
)
126 DEFINE_EVENT_TYPE( wxEVT_STC_INDICATOR_RELEASE
)
130 BEGIN_EVENT_TABLE(wxStyledTextCtrl
, wxControl
)
131 EVT_PAINT (wxStyledTextCtrl::OnPaint
)
132 EVT_SCROLLWIN (wxStyledTextCtrl::OnScrollWin
)
133 EVT_SCROLL (wxStyledTextCtrl::OnScroll
)
134 EVT_SIZE (wxStyledTextCtrl::OnSize
)
135 EVT_LEFT_DOWN (wxStyledTextCtrl::OnMouseLeftDown
)
136 // Let Scintilla see the double click as a second click
137 EVT_LEFT_DCLICK (wxStyledTextCtrl::OnMouseLeftDown
)
138 EVT_MOTION (wxStyledTextCtrl::OnMouseMove
)
139 EVT_LEFT_UP (wxStyledTextCtrl::OnMouseLeftUp
)
140 #if defined(__WXGTK__) || defined(__WXMAC__)
141 EVT_RIGHT_UP (wxStyledTextCtrl::OnMouseRightUp
)
143 EVT_CONTEXT_MENU (wxStyledTextCtrl::OnContextMenu
)
145 EVT_MOUSEWHEEL (wxStyledTextCtrl::OnMouseWheel
)
146 EVT_MIDDLE_UP (wxStyledTextCtrl::OnMouseMiddleUp
)
147 EVT_CHAR (wxStyledTextCtrl::OnChar
)
148 EVT_KEY_DOWN (wxStyledTextCtrl::OnKeyDown
)
149 EVT_KILL_FOCUS (wxStyledTextCtrl::OnLoseFocus
)
150 EVT_SET_FOCUS (wxStyledTextCtrl::OnGainFocus
)
151 EVT_SYS_COLOUR_CHANGED (wxStyledTextCtrl::OnSysColourChanged
)
152 EVT_ERASE_BACKGROUND (wxStyledTextCtrl::OnEraseBackground
)
153 EVT_MENU_RANGE (10, 16, wxStyledTextCtrl::OnMenu
)
154 EVT_LISTBOX_DCLICK (wxID_ANY
, wxStyledTextCtrl::OnListBox
)
158 IMPLEMENT_CLASS(wxStyledTextCtrl
, wxControl
)
159 IMPLEMENT_DYNAMIC_CLASS(wxStyledTextEvent
, wxCommandEvent
)
162 // forces the linking of the lexer modules
163 int Scintilla_LinkLexers();
166 //----------------------------------------------------------------------
167 // Constructor and Destructor
169 wxStyledTextCtrl::wxStyledTextCtrl(wxWindow
*parent
,
174 const wxString
& name
)
177 Create(parent
, id
, pos
, size
, style
, name
);
181 bool wxStyledTextCtrl::Create(wxWindow
*parent
,
186 const wxString
& name
)
188 style
|= wxVSCROLL
| wxHSCROLL
;
189 if (!wxControl::Create(parent
, id
, pos
, size
,
190 style
| wxWANTS_CHARS
| wxCLIP_CHILDREN
,
191 wxDefaultValidator
, name
))
195 Scintilla_LinkLexers();
197 m_swx
= new ScintillaWX(this);
199 m_lastKeyDownConsumed
= false;
200 m_lastWheelTimestamp
= 0;
204 // Put Scintilla into unicode (UTF-8) mode
205 SetCodePage(wxSTC_CP_UTF8
);
208 SetInitialSize(size
);
210 // Reduces flicker on GTK+/X11
211 SetBackgroundStyle(wxBG_STYLE_CUSTOM
);
213 // Make sure it can take the focus
220 wxStyledTextCtrl::~wxStyledTextCtrl() {
225 //----------------------------------------------------------------------
227 wxIntPtr
wxStyledTextCtrl::SendMsg(int msg
, wxUIntPtr wp
, wxIntPtr lp
) const
229 return m_swx
->WndProc(msg
, wp
, lp
);
232 //----------------------------------------------------------------------
234 // Set the vertical scrollbar to use instead of the ont that's built-in.
235 void wxStyledTextCtrl::SetVScrollBar(wxScrollBar
* bar
) {
238 // ensure that the built-in scrollbar is not visible
239 SetScrollbar(wxVERTICAL
, 0, 0, 0);
244 // Set the horizontal scrollbar to use instead of the ont that's built-in.
245 void wxStyledTextCtrl::SetHScrollBar(wxScrollBar
* bar
) {
248 // ensure that the built-in scrollbar is not visible
249 SetScrollbar(wxHORIZONTAL
, 0, 0, 0);
253 //----------------------------------------------------------------------
254 // Generated methods implementation section {{{
257 // Add text to the document at current position.
258 void wxStyledTextCtrl::AddText(const wxString
& text
) {
259 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
260 SendMsg(2001, strlen(buf
), (sptr_t
)(const char*)buf
);
263 // Add array of cells to document.
264 void wxStyledTextCtrl::AddStyledText(const wxMemoryBuffer
& data
) {
265 SendMsg(2002, data
.GetDataLen(), (sptr_t
)data
.GetData());
268 // Insert string at a position.
269 void wxStyledTextCtrl::InsertText(int pos
, const wxString
& text
)
271 SendMsg(2003, pos
, (sptr_t
)(const char*)wx2stc(text
));
274 // Delete all text in the document.
275 void wxStyledTextCtrl::ClearAll()
280 // Set all style bytes to 0, remove all folding information.
281 void wxStyledTextCtrl::ClearDocumentStyle()
286 // Returns the number of characters in the document.
287 int wxStyledTextCtrl::GetLength() const
289 return SendMsg(2006, 0, 0);
292 // Returns the character byte at the position.
293 int wxStyledTextCtrl::GetCharAt(int pos
) const {
294 return (unsigned char)SendMsg(2007, pos
, 0);
297 // Returns the position of the caret.
298 int wxStyledTextCtrl::GetCurrentPos() const
300 return SendMsg(2008, 0, 0);
303 // Returns the position of the opposite end of the selection to the caret.
304 int wxStyledTextCtrl::GetAnchor() const
306 return SendMsg(2009, 0, 0);
309 // Returns the style byte at the position.
310 int wxStyledTextCtrl::GetStyleAt(int pos
) const {
311 return (unsigned char)SendMsg(2010, pos
, 0);
314 // Redoes the next action on the undo history.
315 void wxStyledTextCtrl::Redo()
320 // Choose between collecting actions into the undo
321 // history and discarding them.
322 void wxStyledTextCtrl::SetUndoCollection(bool collectUndo
)
324 SendMsg(2012, collectUndo
, 0);
327 // Select all the text in the document.
328 void wxStyledTextCtrl::SelectAll()
333 // Remember the current position in the undo history as the position
334 // at which the document was saved.
335 void wxStyledTextCtrl::SetSavePoint()
340 // Retrieve a buffer of cells.
341 wxMemoryBuffer
wxStyledTextCtrl::GetStyledText(int startPos
, int endPos
) {
343 if (endPos
< startPos
) {
348 int len
= endPos
- startPos
;
349 if (!len
) return buf
;
351 tr
.lpstrText
= (char*)buf
.GetWriteBuf(len
*2+1);
352 tr
.chrg
.cpMin
= startPos
;
353 tr
.chrg
.cpMax
= endPos
;
354 len
= SendMsg(2015, 0, (sptr_t
)&tr
);
355 buf
.UngetWriteBuf(len
);
359 // Are there any redoable actions in the undo history?
360 bool wxStyledTextCtrl::CanRedo() const
362 return SendMsg(2016, 0, 0) != 0;
365 // Retrieve the line number at which a particular marker is located.
366 int wxStyledTextCtrl::MarkerLineFromHandle(int handle
)
368 return SendMsg(2017, handle
, 0);
372 void wxStyledTextCtrl::MarkerDeleteHandle(int handle
)
374 SendMsg(2018, handle
, 0);
377 // Is undo history being collected?
378 bool wxStyledTextCtrl::GetUndoCollection() const
380 return SendMsg(2019, 0, 0) != 0;
383 // Are white space characters currently visible?
384 // Returns one of SCWS_* constants.
385 int wxStyledTextCtrl::GetViewWhiteSpace() const
387 return SendMsg(2020, 0, 0);
390 // Make white space characters invisible, always visible or visible outside indentation.
391 void wxStyledTextCtrl::SetViewWhiteSpace(int viewWS
)
393 SendMsg(2021, viewWS
, 0);
396 // Find the position from a point within the window.
397 int wxStyledTextCtrl::PositionFromPoint(wxPoint pt
) const {
398 return SendMsg(2022, pt
.x
, pt
.y
);
401 // Find the position from a point within the window but return
402 // INVALID_POSITION if not close to text.
403 int wxStyledTextCtrl::PositionFromPointClose(int x
, int y
)
405 return SendMsg(2023, x
, y
);
408 // Set caret to start of a line and ensure it is visible.
409 void wxStyledTextCtrl::GotoLine(int line
)
411 SendMsg(2024, line
, 0);
414 // Set caret to a position and ensure it is visible.
415 void wxStyledTextCtrl::GotoPos(int pos
)
417 SendMsg(2025, pos
, 0);
420 // Set the selection anchor to a position. The anchor is the opposite
421 // end of the selection from the caret.
422 void wxStyledTextCtrl::SetAnchor(int posAnchor
)
424 SendMsg(2026, posAnchor
, 0);
427 // Retrieve the text of the line containing the caret.
428 // Returns the index of the caret on the line.
429 wxString
wxStyledTextCtrl::GetCurLine(int* linePos
) {
430 int len
= LineLength(GetCurrentLine());
432 if (linePos
) *linePos
= 0;
433 return wxEmptyString
;
436 wxMemoryBuffer
mbuf(len
+1);
437 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
439 int pos
= SendMsg(2027, len
+1, (sptr_t
)buf
);
440 mbuf
.UngetWriteBuf(len
);
442 if (linePos
) *linePos
= pos
;
446 // Retrieve the position of the last correctly styled character.
447 int wxStyledTextCtrl::GetEndStyled() const
449 return SendMsg(2028, 0, 0);
452 // Convert all line endings in the document to one mode.
453 void wxStyledTextCtrl::ConvertEOLs(int eolMode
)
455 SendMsg(2029, eolMode
, 0);
458 // Retrieve the current end of line mode - one of CRLF, CR, or LF.
459 int wxStyledTextCtrl::GetEOLMode() const
461 return SendMsg(2030, 0, 0);
464 // Set the current end of line mode.
465 void wxStyledTextCtrl::SetEOLMode(int eolMode
)
467 SendMsg(2031, eolMode
, 0);
470 // Set the current styling position to pos and the styling mask to mask.
471 // The styling mask can be used to protect some bits in each styling byte from modification.
472 void wxStyledTextCtrl::StartStyling(int pos
, int mask
)
474 SendMsg(2032, pos
, mask
);
477 // Change style from current styling position for length characters to a style
478 // and move the current styling position to after this newly styled segment.
479 void wxStyledTextCtrl::SetStyling(int length
, int style
)
481 SendMsg(2033, length
, style
);
484 // Is drawing done first into a buffer or direct to the screen?
485 bool wxStyledTextCtrl::GetBufferedDraw() const
487 return SendMsg(2034, 0, 0) != 0;
490 // If drawing is buffered then each line of text is drawn into a bitmap buffer
491 // before drawing it to the screen to avoid flicker.
492 void wxStyledTextCtrl::SetBufferedDraw(bool buffered
)
494 SendMsg(2035, buffered
, 0);
497 // Change the visible size of a tab to be a multiple of the width of a space character.
498 void wxStyledTextCtrl::SetTabWidth(int tabWidth
)
500 SendMsg(2036, tabWidth
, 0);
503 // Retrieve the visible size of a tab.
504 int wxStyledTextCtrl::GetTabWidth() const
506 return SendMsg(2121, 0, 0);
509 // Set the code page used to interpret the bytes of the document as characters.
510 void wxStyledTextCtrl::SetCodePage(int codePage
) {
512 wxASSERT_MSG(codePage
== wxSTC_CP_UTF8
,
513 wxT("Only wxSTC_CP_UTF8 may be used when wxUSE_UNICODE is on."));
515 wxASSERT_MSG(codePage
!= wxSTC_CP_UTF8
,
516 wxT("wxSTC_CP_UTF8 may not be used when wxUSE_UNICODE is off."));
518 SendMsg(2037, codePage
);
521 // Set the symbol used for a particular marker number,
522 // and optionally the fore and background colours.
523 void wxStyledTextCtrl::MarkerDefine(int markerNumber
, int markerSymbol
,
524 const wxColour
& foreground
,
525 const wxColour
& background
) {
527 SendMsg(2040, markerNumber
, markerSymbol
);
529 MarkerSetForeground(markerNumber
, foreground
);
531 MarkerSetBackground(markerNumber
, background
);
534 // Set the foreground colour used for a particular marker number.
535 void wxStyledTextCtrl::MarkerSetForeground(int markerNumber
, const wxColour
& fore
)
537 SendMsg(2041, markerNumber
, wxColourAsLong(fore
));
540 // Set the background colour used for a particular marker number.
541 void wxStyledTextCtrl::MarkerSetBackground(int markerNumber
, const wxColour
& back
)
543 SendMsg(2042, markerNumber
, wxColourAsLong(back
));
546 // Add a marker to a line, returning an ID which can be used to find or delete the marker.
547 int wxStyledTextCtrl::MarkerAdd(int line
, int markerNumber
)
549 return SendMsg(2043, line
, markerNumber
);
552 // Delete a marker from a line.
553 void wxStyledTextCtrl::MarkerDelete(int line
, int markerNumber
)
555 SendMsg(2044, line
, markerNumber
);
558 // Delete all markers with a particular number from all lines.
559 void wxStyledTextCtrl::MarkerDeleteAll(int markerNumber
)
561 SendMsg(2045, markerNumber
, 0);
564 // Get a bit mask of all the markers set on a line.
565 int wxStyledTextCtrl::MarkerGet(int line
)
567 return SendMsg(2046, line
, 0);
570 // Find the next line after lineStart that includes a marker in mask.
571 int wxStyledTextCtrl::MarkerNext(int lineStart
, int markerMask
)
573 return SendMsg(2047, lineStart
, markerMask
);
576 // Find the previous line before lineStart that includes a marker in mask.
577 int wxStyledTextCtrl::MarkerPrevious(int lineStart
, int markerMask
)
579 return SendMsg(2048, lineStart
, markerMask
);
582 // Define a marker from a bitmap
583 void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber
, const wxBitmap
& bmp
) {
584 // convert bmp to a xpm in a string
585 wxMemoryOutputStream strm
;
586 wxImage img
= bmp
.ConvertToImage();
588 img
.ConvertAlphaToMask();
589 img
.SaveFile(strm
, wxBITMAP_TYPE_XPM
);
590 size_t len
= strm
.GetSize();
591 char* buff
= new char[len
+1];
592 strm
.CopyTo(buff
, len
);
594 SendMsg(2049, markerNumber
, (sptr_t
)buff
);
599 // Add a set of markers to a line.
600 void wxStyledTextCtrl::MarkerAddSet(int line
, int set
)
602 SendMsg(2466, line
, set
);
605 // Set the alpha used for a marker that is drawn in the text area, not the margin.
606 void wxStyledTextCtrl::MarkerSetAlpha(int markerNumber
, int alpha
)
608 SendMsg(2476, markerNumber
, alpha
);
611 // Set a margin to be either numeric or symbolic.
612 void wxStyledTextCtrl::SetMarginType(int margin
, int marginType
)
614 SendMsg(2240, margin
, marginType
);
617 // Retrieve the type of a margin.
618 int wxStyledTextCtrl::GetMarginType(int margin
) const
620 return SendMsg(2241, margin
, 0);
623 // Set the width of a margin to a width expressed in pixels.
624 void wxStyledTextCtrl::SetMarginWidth(int margin
, int pixelWidth
)
626 SendMsg(2242, margin
, pixelWidth
);
629 // Retrieve the width of a margin in pixels.
630 int wxStyledTextCtrl::GetMarginWidth(int margin
) const
632 return SendMsg(2243, margin
, 0);
635 // Set a mask that determines which markers are displayed in a margin.
636 void wxStyledTextCtrl::SetMarginMask(int margin
, int mask
)
638 SendMsg(2244, margin
, mask
);
641 // Retrieve the marker mask of a margin.
642 int wxStyledTextCtrl::GetMarginMask(int margin
) const
644 return SendMsg(2245, margin
, 0);
647 // Make a margin sensitive or insensitive to mouse clicks.
648 void wxStyledTextCtrl::SetMarginSensitive(int margin
, bool sensitive
)
650 SendMsg(2246, margin
, sensitive
);
653 // Retrieve the mouse click sensitivity of a margin.
654 bool wxStyledTextCtrl::GetMarginSensitive(int margin
) const
656 return SendMsg(2247, margin
, 0) != 0;
659 // Clear all the styles and make equivalent to the global default style.
660 void wxStyledTextCtrl::StyleClearAll()
665 // Set the foreground colour of a style.
666 void wxStyledTextCtrl::StyleSetForeground(int style
, const wxColour
& fore
)
668 SendMsg(2051, style
, wxColourAsLong(fore
));
671 // Set the background colour of a style.
672 void wxStyledTextCtrl::StyleSetBackground(int style
, const wxColour
& back
)
674 SendMsg(2052, style
, wxColourAsLong(back
));
677 // Set a style to be bold or not.
678 void wxStyledTextCtrl::StyleSetBold(int style
, bool bold
)
680 SendMsg(2053, style
, bold
);
683 // Set a style to be italic or not.
684 void wxStyledTextCtrl::StyleSetItalic(int style
, bool italic
)
686 SendMsg(2054, style
, italic
);
689 // Set the size of characters of a style.
690 void wxStyledTextCtrl::StyleSetSize(int style
, int sizePoints
)
692 SendMsg(2055, style
, sizePoints
);
695 // Set the font of a style.
696 void wxStyledTextCtrl::StyleSetFaceName(int style
, const wxString
& fontName
)
698 SendMsg(2056, style
, (sptr_t
)(const char*)wx2stc(fontName
));
701 // Set a style to have its end of line filled or not.
702 void wxStyledTextCtrl::StyleSetEOLFilled(int style
, bool filled
)
704 SendMsg(2057, style
, filled
);
707 // Reset the default style to its state at startup
708 void wxStyledTextCtrl::StyleResetDefault()
713 // Set a style to be underlined or not.
714 void wxStyledTextCtrl::StyleSetUnderline(int style
, bool underline
)
716 SendMsg(2059, style
, underline
);
719 // Get the foreground colour of a style.
720 wxColour
wxStyledTextCtrl::StyleGetForeground(int style
) const
722 long c
= SendMsg(2481, style
, 0);
723 return wxColourFromLong(c
);
726 // Get the background colour of a style.
727 wxColour
wxStyledTextCtrl::StyleGetBackground(int style
) const
729 long c
= SendMsg(2482, style
, 0);
730 return wxColourFromLong(c
);
733 // Get is a style bold or not.
734 bool wxStyledTextCtrl::StyleGetBold(int style
) const
736 return SendMsg(2483, style
, 0) != 0;
739 // Get is a style italic or not.
740 bool wxStyledTextCtrl::StyleGetItalic(int style
) const
742 return SendMsg(2484, style
, 0) != 0;
745 // Get the size of characters of a style.
746 int wxStyledTextCtrl::StyleGetSize(int style
) const
748 return SendMsg(2485, style
, 0);
751 // Get the font facename of a style
752 wxString
wxStyledTextCtrl::StyleGetFaceName(int style
) {
754 long len
= SendMsg(msg
, style
, 0);
755 wxMemoryBuffer
mbuf(len
+1);
756 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
757 SendMsg(msg
, style
, (sptr_t
)buf
);
758 mbuf
.UngetWriteBuf(len
);
763 // Get is a style to have its end of line filled or not.
764 bool wxStyledTextCtrl::StyleGetEOLFilled(int style
) const
766 return SendMsg(2487, style
, 0) != 0;
769 // Get is a style underlined or not.
770 bool wxStyledTextCtrl::StyleGetUnderline(int style
) const
772 return SendMsg(2488, style
, 0) != 0;
775 // Get is a style mixed case, or to force upper or lower case.
776 int wxStyledTextCtrl::StyleGetCase(int style
) const
778 return SendMsg(2489, style
, 0);
781 // Get the character set of the font in a style.
782 int wxStyledTextCtrl::StyleGetCharacterSet(int style
) const
784 return SendMsg(2490, style
, 0);
787 // Get is a style visible or not.
788 bool wxStyledTextCtrl::StyleGetVisible(int style
) const
790 return SendMsg(2491, style
, 0) != 0;
793 // Get is a style changeable or not (read only).
794 // Experimental feature, currently buggy.
795 bool wxStyledTextCtrl::StyleGetChangeable(int style
) const
797 return SendMsg(2492, style
, 0) != 0;
800 // Get is a style a hotspot or not.
801 bool wxStyledTextCtrl::StyleGetHotSpot(int style
) const
803 return SendMsg(2493, style
, 0) != 0;
806 // Set a style to be mixed case, or to force upper or lower case.
807 void wxStyledTextCtrl::StyleSetCase(int style
, int caseForce
)
809 SendMsg(2060, style
, caseForce
);
812 // Set a style to be a hotspot or not.
813 void wxStyledTextCtrl::StyleSetHotSpot(int style
, bool hotspot
)
815 SendMsg(2409, style
, hotspot
);
818 // Set the foreground colour of the selection and whether to use this setting.
819 void wxStyledTextCtrl::SetSelForeground(bool useSetting
, const wxColour
& fore
)
821 SendMsg(2067, useSetting
, wxColourAsLong(fore
));
824 // Set the background colour of the selection and whether to use this setting.
825 void wxStyledTextCtrl::SetSelBackground(bool useSetting
, const wxColour
& back
)
827 SendMsg(2068, useSetting
, wxColourAsLong(back
));
830 // Get the alpha of the selection.
831 int wxStyledTextCtrl::GetSelAlpha() const
833 return SendMsg(2477, 0, 0);
836 // Set the alpha of the selection.
837 void wxStyledTextCtrl::SetSelAlpha(int alpha
)
839 SendMsg(2478, alpha
, 0);
842 // Is the selection end of line filled?
843 bool wxStyledTextCtrl::GetSelEOLFilled() const
845 return SendMsg(2479, 0, 0) != 0;
848 // Set the selection to have its end of line filled or not.
849 void wxStyledTextCtrl::SetSelEOLFilled(bool filled
)
851 SendMsg(2480, filled
, 0);
854 // Set the foreground colour of the caret.
855 void wxStyledTextCtrl::SetCaretForeground(const wxColour
& fore
)
857 SendMsg(2069, wxColourAsLong(fore
), 0);
860 // When key+modifier combination km is pressed perform msg.
861 void wxStyledTextCtrl::CmdKeyAssign(int key
, int modifiers
, int cmd
) {
862 SendMsg(2070, MAKELONG(key
, modifiers
), cmd
);
865 // When key+modifier combination km is pressed do nothing.
866 void wxStyledTextCtrl::CmdKeyClear(int key
, int modifiers
) {
867 SendMsg(2071, MAKELONG(key
, modifiers
));
870 // Drop all key mappings.
871 void wxStyledTextCtrl::CmdKeyClearAll()
876 // Set the styles for a segment of the document.
877 void wxStyledTextCtrl::SetStyleBytes(int length
, char* styleBytes
) {
878 SendMsg(2073, length
, (sptr_t
)styleBytes
);
881 // Set a style to be visible or not.
882 void wxStyledTextCtrl::StyleSetVisible(int style
, bool visible
)
884 SendMsg(2074, style
, visible
);
887 // Get the time in milliseconds that the caret is on and off.
888 int wxStyledTextCtrl::GetCaretPeriod() const
890 return SendMsg(2075, 0, 0);
893 // Get the time in milliseconds that the caret is on and off. 0 = steady on.
894 void wxStyledTextCtrl::SetCaretPeriod(int periodMilliseconds
)
896 SendMsg(2076, periodMilliseconds
, 0);
899 // Set the set of characters making up words for when moving or selecting by word.
900 // First sets deaults like SetCharsDefault.
901 void wxStyledTextCtrl::SetWordChars(const wxString
& characters
)
903 SendMsg(2077, 0, (sptr_t
)(const char*)wx2stc(characters
));
906 // Start a sequence of actions that is undone and redone as a unit.
908 void wxStyledTextCtrl::BeginUndoAction()
913 // End a sequence of actions that is undone and redone as a unit.
914 void wxStyledTextCtrl::EndUndoAction()
919 // Set an indicator to plain, squiggle or TT.
920 void wxStyledTextCtrl::IndicatorSetStyle(int indic
, int style
)
922 SendMsg(2080, indic
, style
);
925 // Retrieve the style of an indicator.
926 int wxStyledTextCtrl::IndicatorGetStyle(int indic
) const
928 return SendMsg(2081, indic
, 0);
931 // Set the foreground colour of an indicator.
932 void wxStyledTextCtrl::IndicatorSetForeground(int indic
, const wxColour
& fore
)
934 SendMsg(2082, indic
, wxColourAsLong(fore
));
937 // Retrieve the foreground colour of an indicator.
938 wxColour
wxStyledTextCtrl::IndicatorGetForeground(int indic
) const
940 long c
= SendMsg(2083, indic
, 0);
941 return wxColourFromLong(c
);
944 // Set an indicator to draw under text or over(default).
945 void wxStyledTextCtrl::IndicatorSetUnder(int indic
, bool under
)
947 SendMsg(2510, indic
, under
);
950 // Retrieve whether indicator drawn under or over text.
951 bool wxStyledTextCtrl::IndicatorGetUnder(int indic
) const
953 return SendMsg(2511, indic
, 0) != 0;
956 // Set the foreground colour of all whitespace and whether to use this setting.
957 void wxStyledTextCtrl::SetWhitespaceForeground(bool useSetting
, const wxColour
& fore
)
959 SendMsg(2084, useSetting
, wxColourAsLong(fore
));
962 // Set the background colour of all whitespace and whether to use this setting.
963 void wxStyledTextCtrl::SetWhitespaceBackground(bool useSetting
, const wxColour
& back
)
965 SendMsg(2085, useSetting
, wxColourAsLong(back
));
968 // Divide each styling byte into lexical class bits (default: 5) and indicator
969 // bits (default: 3). If a lexer requires more than 32 lexical states, then this
970 // is used to expand the possible states.
971 void wxStyledTextCtrl::SetStyleBits(int bits
)
973 SendMsg(2090, bits
, 0);
976 // Retrieve number of bits in style bytes used to hold the lexical state.
977 int wxStyledTextCtrl::GetStyleBits() const
979 return SendMsg(2091, 0, 0);
982 // Used to hold extra styling information for each line.
983 void wxStyledTextCtrl::SetLineState(int line
, int state
)
985 SendMsg(2092, line
, state
);
988 // Retrieve the extra styling information for a line.
989 int wxStyledTextCtrl::GetLineState(int line
) const
991 return SendMsg(2093, line
, 0);
994 // Retrieve the last line number that has line state.
995 int wxStyledTextCtrl::GetMaxLineState() const
997 return SendMsg(2094, 0, 0);
1000 // Is the background of the line containing the caret in a different colour?
1001 bool wxStyledTextCtrl::GetCaretLineVisible() const
1003 return SendMsg(2095, 0, 0) != 0;
1006 // Display the background of the line containing the caret in a different colour.
1007 void wxStyledTextCtrl::SetCaretLineVisible(bool show
)
1009 SendMsg(2096, show
, 0);
1012 // Get the colour of the background of the line containing the caret.
1013 wxColour
wxStyledTextCtrl::GetCaretLineBackground() const
1015 long c
= SendMsg(2097, 0, 0);
1016 return wxColourFromLong(c
);
1019 // Set the colour of the background of the line containing the caret.
1020 void wxStyledTextCtrl::SetCaretLineBackground(const wxColour
& back
)
1022 SendMsg(2098, wxColourAsLong(back
), 0);
1025 // Set a style to be changeable or not (read only).
1026 // Experimental feature, currently buggy.
1027 void wxStyledTextCtrl::StyleSetChangeable(int style
, bool changeable
)
1029 SendMsg(2099, style
, changeable
);
1032 // Display a auto-completion list.
1033 // The lenEntered parameter indicates how many characters before
1034 // the caret should be used to provide context.
1035 void wxStyledTextCtrl::AutoCompShow(int lenEntered
, const wxString
& itemList
)
1037 SendMsg(2100, lenEntered
, (sptr_t
)(const char*)wx2stc(itemList
));
1040 // Remove the auto-completion list from the screen.
1041 void wxStyledTextCtrl::AutoCompCancel()
1043 SendMsg(2101, 0, 0);
1046 // Is there an auto-completion list visible?
1047 bool wxStyledTextCtrl::AutoCompActive()
1049 return SendMsg(2102, 0, 0) != 0;
1052 // Retrieve the position of the caret when the auto-completion list was displayed.
1053 int wxStyledTextCtrl::AutoCompPosStart()
1055 return SendMsg(2103, 0, 0);
1058 // User has selected an item so remove the list and insert the selection.
1059 void wxStyledTextCtrl::AutoCompComplete()
1061 SendMsg(2104, 0, 0);
1064 // Define a set of character that when typed cancel the auto-completion list.
1065 void wxStyledTextCtrl::AutoCompStops(const wxString
& characterSet
)
1067 SendMsg(2105, 0, (sptr_t
)(const char*)wx2stc(characterSet
));
1070 // Change the separator character in the string setting up an auto-completion list.
1071 // Default is space but can be changed if items contain space.
1072 void wxStyledTextCtrl::AutoCompSetSeparator(int separatorCharacter
)
1074 SendMsg(2106, separatorCharacter
, 0);
1077 // Retrieve the auto-completion list separator character.
1078 int wxStyledTextCtrl::AutoCompGetSeparator() const
1080 return SendMsg(2107, 0, 0);
1083 // Select the item in the auto-completion list that starts with a string.
1084 void wxStyledTextCtrl::AutoCompSelect(const wxString
& text
)
1086 SendMsg(2108, 0, (sptr_t
)(const char*)wx2stc(text
));
1089 // Should the auto-completion list be cancelled if the user backspaces to a
1090 // position before where the box was created.
1091 void wxStyledTextCtrl::AutoCompSetCancelAtStart(bool cancel
)
1093 SendMsg(2110, cancel
, 0);
1096 // Retrieve whether auto-completion cancelled by backspacing before start.
1097 bool wxStyledTextCtrl::AutoCompGetCancelAtStart() const
1099 return SendMsg(2111, 0, 0) != 0;
1102 // Define a set of characters that when typed will cause the autocompletion to
1103 // choose the selected item.
1104 void wxStyledTextCtrl::AutoCompSetFillUps(const wxString
& characterSet
)
1106 SendMsg(2112, 0, (sptr_t
)(const char*)wx2stc(characterSet
));
1109 // Should a single item auto-completion list automatically choose the item.
1110 void wxStyledTextCtrl::AutoCompSetChooseSingle(bool chooseSingle
)
1112 SendMsg(2113, chooseSingle
, 0);
1115 // Retrieve whether a single item auto-completion list automatically choose the item.
1116 bool wxStyledTextCtrl::AutoCompGetChooseSingle() const
1118 return SendMsg(2114, 0, 0) != 0;
1121 // Set whether case is significant when performing auto-completion searches.
1122 void wxStyledTextCtrl::AutoCompSetIgnoreCase(bool ignoreCase
)
1124 SendMsg(2115, ignoreCase
, 0);
1127 // Retrieve state of ignore case flag.
1128 bool wxStyledTextCtrl::AutoCompGetIgnoreCase() const
1130 return SendMsg(2116, 0, 0) != 0;
1133 // Display a list of strings and send notification when user chooses one.
1134 void wxStyledTextCtrl::UserListShow(int listType
, const wxString
& itemList
)
1136 SendMsg(2117, listType
, (sptr_t
)(const char*)wx2stc(itemList
));
1139 // Set whether or not autocompletion is hidden automatically when nothing matches.
1140 void wxStyledTextCtrl::AutoCompSetAutoHide(bool autoHide
)
1142 SendMsg(2118, autoHide
, 0);
1145 // Retrieve whether or not autocompletion is hidden automatically when nothing matches.
1146 bool wxStyledTextCtrl::AutoCompGetAutoHide() const
1148 return SendMsg(2119, 0, 0) != 0;
1151 // Set whether or not autocompletion deletes any word characters
1152 // after the inserted text upon completion.
1153 void wxStyledTextCtrl::AutoCompSetDropRestOfWord(bool dropRestOfWord
)
1155 SendMsg(2270, dropRestOfWord
, 0);
1158 // Retrieve whether or not autocompletion deletes any word characters
1159 // after the inserted text upon completion.
1160 bool wxStyledTextCtrl::AutoCompGetDropRestOfWord() const
1162 return SendMsg(2271, 0, 0) != 0;
1165 // Register an image for use in autocompletion lists.
1166 void wxStyledTextCtrl::RegisterImage(int type
, const wxBitmap
& bmp
) {
1167 // convert bmp to a xpm in a string
1168 wxMemoryOutputStream strm
;
1169 wxImage img
= bmp
.ConvertToImage();
1171 img
.ConvertAlphaToMask();
1172 img
.SaveFile(strm
, wxBITMAP_TYPE_XPM
);
1173 size_t len
= strm
.GetSize();
1174 char* buff
= new char[len
+1];
1175 strm
.CopyTo(buff
, len
);
1177 SendMsg(2405, type
, (sptr_t
)buff
);
1182 // Clear all the registered images.
1183 void wxStyledTextCtrl::ClearRegisteredImages()
1185 SendMsg(2408, 0, 0);
1188 // Retrieve the auto-completion list type-separator character.
1189 int wxStyledTextCtrl::AutoCompGetTypeSeparator() const
1191 return SendMsg(2285, 0, 0);
1194 // Change the type-separator character in the string setting up an auto-completion list.
1195 // Default is '?' but can be changed if items contain '?'.
1196 void wxStyledTextCtrl::AutoCompSetTypeSeparator(int separatorCharacter
)
1198 SendMsg(2286, separatorCharacter
, 0);
1201 // Set the maximum width, in characters, of auto-completion and user lists.
1202 // Set to 0 to autosize to fit longest item, which is the default.
1203 void wxStyledTextCtrl::AutoCompSetMaxWidth(int characterCount
)
1205 SendMsg(2208, characterCount
, 0);
1208 // Get the maximum width, in characters, of auto-completion and user lists.
1209 int wxStyledTextCtrl::AutoCompGetMaxWidth() const
1211 return SendMsg(2209, 0, 0);
1214 // Set the maximum height, in rows, of auto-completion and user lists.
1215 // The default is 5 rows.
1216 void wxStyledTextCtrl::AutoCompSetMaxHeight(int rowCount
)
1218 SendMsg(2210, rowCount
, 0);
1221 // Set the maximum height, in rows, of auto-completion and user lists.
1222 int wxStyledTextCtrl::AutoCompGetMaxHeight() const
1224 return SendMsg(2211, 0, 0);
1227 // Set the number of spaces used for one level of indentation.
1228 void wxStyledTextCtrl::SetIndent(int indentSize
)
1230 SendMsg(2122, indentSize
, 0);
1233 // Retrieve indentation size.
1234 int wxStyledTextCtrl::GetIndent() const
1236 return SendMsg(2123, 0, 0);
1239 // Indentation will only use space characters if useTabs is false, otherwise
1240 // it will use a combination of tabs and spaces.
1241 void wxStyledTextCtrl::SetUseTabs(bool useTabs
)
1243 SendMsg(2124, useTabs
, 0);
1246 // Retrieve whether tabs will be used in indentation.
1247 bool wxStyledTextCtrl::GetUseTabs() const
1249 return SendMsg(2125, 0, 0) != 0;
1252 // Change the indentation of a line to a number of columns.
1253 void wxStyledTextCtrl::SetLineIndentation(int line
, int indentSize
)
1255 SendMsg(2126, line
, indentSize
);
1258 // Retrieve the number of columns that a line is indented.
1259 int wxStyledTextCtrl::GetLineIndentation(int line
) const
1261 return SendMsg(2127, line
, 0);
1264 // Retrieve the position before the first non indentation character on a line.
1265 int wxStyledTextCtrl::GetLineIndentPosition(int line
) const
1267 return SendMsg(2128, line
, 0);
1270 // Retrieve the column number of a position, taking tab width into account.
1271 int wxStyledTextCtrl::GetColumn(int pos
) const
1273 return SendMsg(2129, pos
, 0);
1276 // Show or hide the horizontal scroll bar.
1277 void wxStyledTextCtrl::SetUseHorizontalScrollBar(bool show
)
1279 SendMsg(2130, show
, 0);
1282 // Is the horizontal scroll bar visible?
1283 bool wxStyledTextCtrl::GetUseHorizontalScrollBar() const
1285 return SendMsg(2131, 0, 0) != 0;
1288 // Show or hide indentation guides.
1289 void wxStyledTextCtrl::SetIndentationGuides(int indentView
)
1291 SendMsg(2132, indentView
, 0);
1294 // Are the indentation guides visible?
1295 int wxStyledTextCtrl::GetIndentationGuides() const
1297 return SendMsg(2133, 0, 0);
1300 // Set the highlighted indentation guide column.
1301 // 0 = no highlighted guide.
1302 void wxStyledTextCtrl::SetHighlightGuide(int column
)
1304 SendMsg(2134, column
, 0);
1307 // Get the highlighted indentation guide column.
1308 int wxStyledTextCtrl::GetHighlightGuide() const
1310 return SendMsg(2135, 0, 0);
1313 // Get the position after the last visible characters on a line.
1314 int wxStyledTextCtrl::GetLineEndPosition(int line
) const
1316 return SendMsg(2136, line
, 0);
1319 // Get the code page used to interpret the bytes of the document as characters.
1320 int wxStyledTextCtrl::GetCodePage() const
1322 return SendMsg(2137, 0, 0);
1325 // Get the foreground colour of the caret.
1326 wxColour
wxStyledTextCtrl::GetCaretForeground() const
1328 long c
= SendMsg(2138, 0, 0);
1329 return wxColourFromLong(c
);
1332 // In read-only mode?
1333 bool wxStyledTextCtrl::GetReadOnly() const
1335 return SendMsg(2140, 0, 0) != 0;
1338 // Sets the position of the caret.
1339 void wxStyledTextCtrl::SetCurrentPos(int pos
)
1341 SendMsg(2141, pos
, 0);
1344 // Sets the position that starts the selection - this becomes the anchor.
1345 void wxStyledTextCtrl::SetSelectionStart(int pos
)
1347 SendMsg(2142, pos
, 0);
1350 // Returns the position at the start of the selection.
1351 int wxStyledTextCtrl::GetSelectionStart() const
1353 return SendMsg(2143, 0, 0);
1356 // Sets the position that ends the selection - this becomes the currentPosition.
1357 void wxStyledTextCtrl::SetSelectionEnd(int pos
)
1359 SendMsg(2144, pos
, 0);
1362 // Returns the position at the end of the selection.
1363 int wxStyledTextCtrl::GetSelectionEnd() const
1365 return SendMsg(2145, 0, 0);
1368 // Sets the print magnification added to the point size of each style for printing.
1369 void wxStyledTextCtrl::SetPrintMagnification(int magnification
)
1371 SendMsg(2146, magnification
, 0);
1374 // Returns the print magnification.
1375 int wxStyledTextCtrl::GetPrintMagnification() const
1377 return SendMsg(2147, 0, 0);
1380 // Modify colours when printing for clearer printed text.
1381 void wxStyledTextCtrl::SetPrintColourMode(int mode
)
1383 SendMsg(2148, mode
, 0);
1386 // Returns the print colour mode.
1387 int wxStyledTextCtrl::GetPrintColourMode() const
1389 return SendMsg(2149, 0, 0);
1392 // Find some text in the document.
1393 int wxStyledTextCtrl::FindText(int minPos
, int maxPos
,
1394 const wxString
& text
,
1397 ft
.chrg
.cpMin
= minPos
;
1398 ft
.chrg
.cpMax
= maxPos
;
1399 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
1400 ft
.lpstrText
= (char*)(const char*)buf
;
1402 return SendMsg(2150, flags
, (sptr_t
)&ft
);
1405 // On Windows, will draw the document into a display context such as a printer.
1406 int wxStyledTextCtrl::FormatRange(bool doDraw
,
1415 if (endPos
< startPos
) {
1416 int temp
= startPos
;
1421 fr
.hdcTarget
= target
;
1422 fr
.rc
.top
= renderRect
.GetTop();
1423 fr
.rc
.left
= renderRect
.GetLeft();
1424 fr
.rc
.right
= renderRect
.GetRight();
1425 fr
.rc
.bottom
= renderRect
.GetBottom();
1426 fr
.rcPage
.top
= pageRect
.GetTop();
1427 fr
.rcPage
.left
= pageRect
.GetLeft();
1428 fr
.rcPage
.right
= pageRect
.GetRight();
1429 fr
.rcPage
.bottom
= pageRect
.GetBottom();
1430 fr
.chrg
.cpMin
= startPos
;
1431 fr
.chrg
.cpMax
= endPos
;
1433 return SendMsg(2151, doDraw
, (sptr_t
)&fr
);
1436 // Retrieve the display line at the top of the display.
1437 int wxStyledTextCtrl::GetFirstVisibleLine() const
1439 return SendMsg(2152, 0, 0);
1442 // Retrieve the contents of a line.
1443 wxString
wxStyledTextCtrl::GetLine(int line
) const {
1444 int len
= LineLength(line
);
1445 if (!len
) return wxEmptyString
;
1447 wxMemoryBuffer
mbuf(len
+1);
1448 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1449 SendMsg(2153, line
, (sptr_t
)buf
);
1450 mbuf
.UngetWriteBuf(len
);
1455 // Returns the number of lines in the document. There is always at least one.
1456 int wxStyledTextCtrl::GetLineCount() const
1458 return SendMsg(2154, 0, 0);
1461 // Sets the size in pixels of the left margin.
1462 void wxStyledTextCtrl::SetMarginLeft(int pixelWidth
)
1464 SendMsg(2155, 0, pixelWidth
);
1467 // Returns the size in pixels of the left margin.
1468 int wxStyledTextCtrl::GetMarginLeft() const
1470 return SendMsg(2156, 0, 0);
1473 // Sets the size in pixels of the right margin.
1474 void wxStyledTextCtrl::SetMarginRight(int pixelWidth
)
1476 SendMsg(2157, 0, pixelWidth
);
1479 // Returns the size in pixels of the right margin.
1480 int wxStyledTextCtrl::GetMarginRight() const
1482 return SendMsg(2158, 0, 0);
1485 // Is the document different from when it was last saved?
1486 bool wxStyledTextCtrl::GetModify() const
1488 return SendMsg(2159, 0, 0) != 0;
1491 // Retrieve the selected text.
1492 wxString
wxStyledTextCtrl::GetSelectedText() {
1496 GetSelection(&start
, &end
);
1497 int len
= end
- start
;
1498 if (!len
) return wxEmptyString
;
1500 wxMemoryBuffer
mbuf(len
+2);
1501 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1502 SendMsg(2161, 0, (sptr_t
)buf
);
1503 mbuf
.UngetWriteBuf(len
);
1508 // Retrieve a range of text.
1509 wxString
wxStyledTextCtrl::GetTextRange(int startPos
, int endPos
) {
1510 if (endPos
< startPos
) {
1511 int temp
= startPos
;
1515 int len
= endPos
- startPos
;
1516 if (!len
) return wxEmptyString
;
1517 wxMemoryBuffer
mbuf(len
+1);
1518 char* buf
= (char*)mbuf
.GetWriteBuf(len
);
1521 tr
.chrg
.cpMin
= startPos
;
1522 tr
.chrg
.cpMax
= endPos
;
1523 SendMsg(2162, 0, (sptr_t
)&tr
);
1524 mbuf
.UngetWriteBuf(len
);
1529 // Draw the selection in normal style or with selection highlighted.
1530 void wxStyledTextCtrl::HideSelection(bool normal
)
1532 SendMsg(2163, normal
, 0);
1535 // Retrieve the line containing a position.
1536 int wxStyledTextCtrl::LineFromPosition(int pos
) const
1538 return SendMsg(2166, pos
, 0);
1541 // Retrieve the position at the start of a line.
1542 int wxStyledTextCtrl::PositionFromLine(int line
) const
1544 return SendMsg(2167, line
, 0);
1547 // Scroll horizontally and vertically.
1548 void wxStyledTextCtrl::LineScroll(int columns
, int lines
)
1550 SendMsg(2168, columns
, lines
);
1553 // Ensure the caret is visible.
1554 void wxStyledTextCtrl::EnsureCaretVisible()
1556 SendMsg(2169, 0, 0);
1559 // Replace the selected text with the argument text.
1560 void wxStyledTextCtrl::ReplaceSelection(const wxString
& text
)
1562 SendMsg(2170, 0, (sptr_t
)(const char*)wx2stc(text
));
1565 // Set to read only or read write.
1566 void wxStyledTextCtrl::SetReadOnly(bool readOnly
)
1568 SendMsg(2171, readOnly
, 0);
1571 // Will a paste succeed?
1572 bool wxStyledTextCtrl::CanPaste() const
1574 return SendMsg(2173, 0, 0) != 0;
1577 // Are there any undoable actions in the undo history?
1578 bool wxStyledTextCtrl::CanUndo() const
1580 return SendMsg(2174, 0, 0) != 0;
1583 // Delete the undo history.
1584 void wxStyledTextCtrl::EmptyUndoBuffer()
1586 SendMsg(2175, 0, 0);
1589 // Undo one action in the undo history.
1590 void wxStyledTextCtrl::Undo()
1592 SendMsg(2176, 0, 0);
1595 // Cut the selection to the clipboard.
1596 void wxStyledTextCtrl::Cut()
1598 SendMsg(2177, 0, 0);
1601 // Copy the selection to the clipboard.
1602 void wxStyledTextCtrl::Copy()
1604 SendMsg(2178, 0, 0);
1607 // Paste the contents of the clipboard into the document replacing the selection.
1608 void wxStyledTextCtrl::Paste()
1610 SendMsg(2179, 0, 0);
1613 // Clear the selection.
1614 void wxStyledTextCtrl::Clear()
1616 SendMsg(2180, 0, 0);
1619 // Replace the contents of the document with the argument text.
1620 void wxStyledTextCtrl::SetText(const wxString
& text
)
1622 SendMsg(2181, 0, (sptr_t
)(const char*)wx2stc(text
));
1625 // Retrieve all the text in the document.
1626 wxString
wxStyledTextCtrl::GetText() const {
1627 int len
= GetTextLength();
1628 wxMemoryBuffer
mbuf(len
+1); // leave room for the null...
1629 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1630 SendMsg(2182, len
+1, (sptr_t
)buf
);
1631 mbuf
.UngetWriteBuf(len
);
1636 // Retrieve the number of characters in the document.
1637 int wxStyledTextCtrl::GetTextLength() const
1639 return SendMsg(2183, 0, 0);
1642 // Set to overtype (true) or insert mode.
1643 void wxStyledTextCtrl::SetOvertype(bool overtype
)
1645 SendMsg(2186, overtype
, 0);
1648 // Returns true if overtype mode is active otherwise false is returned.
1649 bool wxStyledTextCtrl::GetOvertype() const
1651 return SendMsg(2187, 0, 0) != 0;
1654 // Set the width of the insert mode caret.
1655 void wxStyledTextCtrl::SetCaretWidth(int pixelWidth
)
1657 SendMsg(2188, pixelWidth
, 0);
1660 // Returns the width of the insert mode caret.
1661 int wxStyledTextCtrl::GetCaretWidth() const
1663 return SendMsg(2189, 0, 0);
1666 // Sets the position that starts the target which is used for updating the
1667 // document without affecting the scroll position.
1668 void wxStyledTextCtrl::SetTargetStart(int pos
)
1670 SendMsg(2190, pos
, 0);
1673 // Get the position that starts the target.
1674 int wxStyledTextCtrl::GetTargetStart() const
1676 return SendMsg(2191, 0, 0);
1679 // Sets the position that ends the target which is used for updating the
1680 // document without affecting the scroll position.
1681 void wxStyledTextCtrl::SetTargetEnd(int pos
)
1683 SendMsg(2192, pos
, 0);
1686 // Get the position that ends the target.
1687 int wxStyledTextCtrl::GetTargetEnd() const
1689 return SendMsg(2193, 0, 0);
1692 // Replace the target text with the argument text.
1693 // Text is counted so it can contain NULs.
1694 // Returns the length of the replacement text.
1696 int wxStyledTextCtrl::ReplaceTarget(const wxString
& text
) {
1697 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
1698 return SendMsg(2194, strlen(buf
), (sptr_t
)(const char*)buf
);
1701 // Replace the target text with the argument text after \d processing.
1702 // Text is counted so it can contain NULs.
1703 // Looks for \d where d is between 1 and 9 and replaces these with the strings
1704 // matched in the last search operation which were surrounded by \( and \).
1705 // Returns the length of the replacement text including any change
1706 // caused by processing the \d patterns.
1708 int wxStyledTextCtrl::ReplaceTargetRE(const wxString
& text
) {
1709 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
1710 return SendMsg(2195, strlen(buf
), (sptr_t
)(const char*)buf
);
1713 // Search for a counted string in the target and set the target to the found
1714 // range. Text is counted so it can contain NULs.
1715 // Returns length of range or -1 for failure in which case target is not moved.
1717 int wxStyledTextCtrl::SearchInTarget(const wxString
& text
) {
1718 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
1719 return SendMsg(2197, strlen(buf
), (sptr_t
)(const char*)buf
);
1722 // Set the search flags used by SearchInTarget.
1723 void wxStyledTextCtrl::SetSearchFlags(int flags
)
1725 SendMsg(2198, flags
, 0);
1728 // Get the search flags used by SearchInTarget.
1729 int wxStyledTextCtrl::GetSearchFlags() const
1731 return SendMsg(2199, 0, 0);
1734 // Show a call tip containing a definition near position pos.
1735 void wxStyledTextCtrl::CallTipShow(int pos
, const wxString
& definition
)
1737 SendMsg(2200, pos
, (sptr_t
)(const char*)wx2stc(definition
));
1740 // Remove the call tip from the screen.
1741 void wxStyledTextCtrl::CallTipCancel()
1743 SendMsg(2201, 0, 0);
1746 // Is there an active call tip?
1747 bool wxStyledTextCtrl::CallTipActive()
1749 return SendMsg(2202, 0, 0) != 0;
1752 // Retrieve the position where the caret was before displaying the call tip.
1753 int wxStyledTextCtrl::CallTipPosAtStart()
1755 return SendMsg(2203, 0, 0);
1758 // Highlight a segment of the definition.
1759 void wxStyledTextCtrl::CallTipSetHighlight(int start
, int end
)
1761 SendMsg(2204, start
, end
);
1764 // Set the background colour for the call tip.
1765 void wxStyledTextCtrl::CallTipSetBackground(const wxColour
& back
)
1767 SendMsg(2205, wxColourAsLong(back
), 0);
1770 // Set the foreground colour for the call tip.
1771 void wxStyledTextCtrl::CallTipSetForeground(const wxColour
& fore
)
1773 SendMsg(2206, wxColourAsLong(fore
), 0);
1776 // Set the foreground colour for the highlighted part of the call tip.
1777 void wxStyledTextCtrl::CallTipSetForegroundHighlight(const wxColour
& fore
)
1779 SendMsg(2207, wxColourAsLong(fore
), 0);
1782 // Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
1783 void wxStyledTextCtrl::CallTipUseStyle(int tabSize
)
1785 SendMsg(2212, tabSize
, 0);
1788 // Find the display line of a document line taking hidden lines into account.
1789 int wxStyledTextCtrl::VisibleFromDocLine(int line
)
1791 return SendMsg(2220, line
, 0);
1794 // Find the document line of a display line taking hidden lines into account.
1795 int wxStyledTextCtrl::DocLineFromVisible(int lineDisplay
)
1797 return SendMsg(2221, lineDisplay
, 0);
1800 // The number of display lines needed to wrap a document line
1801 int wxStyledTextCtrl::WrapCount(int line
)
1803 return SendMsg(2235, line
, 0);
1806 // Set the fold level of a line.
1807 // This encodes an integer level along with flags indicating whether the
1808 // line is a header and whether it is effectively white space.
1809 void wxStyledTextCtrl::SetFoldLevel(int line
, int level
)
1811 SendMsg(2222, line
, level
);
1814 // Retrieve the fold level of a line.
1815 int wxStyledTextCtrl::GetFoldLevel(int line
) const
1817 return SendMsg(2223, line
, 0);
1820 // Find the last child line of a header line.
1821 int wxStyledTextCtrl::GetLastChild(int line
, int level
) const
1823 return SendMsg(2224, line
, level
);
1826 // Find the parent line of a child line.
1827 int wxStyledTextCtrl::GetFoldParent(int line
) const
1829 return SendMsg(2225, line
, 0);
1832 // Make a range of lines visible.
1833 void wxStyledTextCtrl::ShowLines(int lineStart
, int lineEnd
)
1835 SendMsg(2226, lineStart
, lineEnd
);
1838 // Make a range of lines invisible.
1839 void wxStyledTextCtrl::HideLines(int lineStart
, int lineEnd
)
1841 SendMsg(2227, lineStart
, lineEnd
);
1844 // Is a line visible?
1845 bool wxStyledTextCtrl::GetLineVisible(int line
) const
1847 return SendMsg(2228, line
, 0) != 0;
1850 // Show the children of a header line.
1851 void wxStyledTextCtrl::SetFoldExpanded(int line
, bool expanded
)
1853 SendMsg(2229, line
, expanded
);
1856 // Is a header line expanded?
1857 bool wxStyledTextCtrl::GetFoldExpanded(int line
) const
1859 return SendMsg(2230, line
, 0) != 0;
1862 // Switch a header line between expanded and contracted.
1863 void wxStyledTextCtrl::ToggleFold(int line
)
1865 SendMsg(2231, line
, 0);
1868 // Ensure a particular line is visible by expanding any header line hiding it.
1869 void wxStyledTextCtrl::EnsureVisible(int line
)
1871 SendMsg(2232, line
, 0);
1874 // Set some style options for folding.
1875 void wxStyledTextCtrl::SetFoldFlags(int flags
)
1877 SendMsg(2233, flags
, 0);
1880 // Ensure a particular line is visible by expanding any header line hiding it.
1881 // Use the currently set visibility policy to determine which range to display.
1882 void wxStyledTextCtrl::EnsureVisibleEnforcePolicy(int line
)
1884 SendMsg(2234, line
, 0);
1887 // Sets whether a tab pressed when caret is within indentation indents.
1888 void wxStyledTextCtrl::SetTabIndents(bool tabIndents
)
1890 SendMsg(2260, tabIndents
, 0);
1893 // Does a tab pressed when caret is within indentation indent?
1894 bool wxStyledTextCtrl::GetTabIndents() const
1896 return SendMsg(2261, 0, 0) != 0;
1899 // Sets whether a backspace pressed when caret is within indentation unindents.
1900 void wxStyledTextCtrl::SetBackSpaceUnIndents(bool bsUnIndents
)
1902 SendMsg(2262, bsUnIndents
, 0);
1905 // Does a backspace pressed when caret is within indentation unindent?
1906 bool wxStyledTextCtrl::GetBackSpaceUnIndents() const
1908 return SendMsg(2263, 0, 0) != 0;
1911 // Sets the time the mouse must sit still to generate a mouse dwell event.
1912 void wxStyledTextCtrl::SetMouseDwellTime(int periodMilliseconds
)
1914 SendMsg(2264, periodMilliseconds
, 0);
1917 // Retrieve the time the mouse must sit still to generate a mouse dwell event.
1918 int wxStyledTextCtrl::GetMouseDwellTime() const
1920 return SendMsg(2265, 0, 0);
1923 // Get position of start of word.
1924 int wxStyledTextCtrl::WordStartPosition(int pos
, bool onlyWordCharacters
)
1926 return SendMsg(2266, pos
, onlyWordCharacters
);
1929 // Get position of end of word.
1930 int wxStyledTextCtrl::WordEndPosition(int pos
, bool onlyWordCharacters
)
1932 return SendMsg(2267, pos
, onlyWordCharacters
);
1935 // Sets whether text is word wrapped.
1936 void wxStyledTextCtrl::SetWrapMode(int mode
)
1938 SendMsg(2268, mode
, 0);
1941 // Retrieve whether text is word wrapped.
1942 int wxStyledTextCtrl::GetWrapMode() const
1944 return SendMsg(2269, 0, 0);
1947 // Set the display mode of visual flags for wrapped lines.
1948 void wxStyledTextCtrl::SetWrapVisualFlags(int wrapVisualFlags
)
1950 SendMsg(2460, wrapVisualFlags
, 0);
1953 // Retrive the display mode of visual flags for wrapped lines.
1954 int wxStyledTextCtrl::GetWrapVisualFlags() const
1956 return SendMsg(2461, 0, 0);
1959 // Set the location of visual flags for wrapped lines.
1960 void wxStyledTextCtrl::SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation
)
1962 SendMsg(2462, wrapVisualFlagsLocation
, 0);
1965 // Retrive the location of visual flags for wrapped lines.
1966 int wxStyledTextCtrl::GetWrapVisualFlagsLocation() const
1968 return SendMsg(2463, 0, 0);
1971 // Set the start indent for wrapped lines.
1972 void wxStyledTextCtrl::SetWrapStartIndent(int indent
)
1974 SendMsg(2464, indent
, 0);
1977 // Retrive the start indent for wrapped lines.
1978 int wxStyledTextCtrl::GetWrapStartIndent() const
1980 return SendMsg(2465, 0, 0);
1983 // Sets the degree of caching of layout information.
1984 void wxStyledTextCtrl::SetLayoutCache(int mode
)
1986 SendMsg(2272, mode
, 0);
1989 // Retrieve the degree of caching of layout information.
1990 int wxStyledTextCtrl::GetLayoutCache() const
1992 return SendMsg(2273, 0, 0);
1995 // Sets the document width assumed for scrolling.
1996 void wxStyledTextCtrl::SetScrollWidth(int pixelWidth
)
1998 SendMsg(2274, pixelWidth
, 0);
2001 // Retrieve the document width assumed for scrolling.
2002 int wxStyledTextCtrl::GetScrollWidth() const
2004 return SendMsg(2275, 0, 0);
2007 // Sets whether the maximum width line displayed is used to set scroll width.
2008 void wxStyledTextCtrl::SetScrollWidthTracking(bool tracking
)
2010 SendMsg(2516, tracking
, 0);
2013 // Retrieve whether the scroll width tracks wide lines.
2014 bool wxStyledTextCtrl::GetScrollWidthTracking() const
2016 return SendMsg(2517, 0, 0) != 0;
2019 // Measure the pixel width of some text in a particular style.
2020 // NUL terminated text argument.
2021 // Does not handle tab or control characters.
2022 int wxStyledTextCtrl::TextWidth(int style
, const wxString
& text
)
2024 return SendMsg(2276, style
, (sptr_t
)(const char*)wx2stc(text
));
2027 // Sets the scroll range so that maximum scroll position has
2028 // the last line at the bottom of the view (default).
2029 // Setting this to false allows scrolling one page below the last line.
2030 void wxStyledTextCtrl::SetEndAtLastLine(bool endAtLastLine
)
2032 SendMsg(2277, endAtLastLine
, 0);
2035 // Retrieve whether the maximum scroll position has the last
2036 // line at the bottom of the view.
2037 bool wxStyledTextCtrl::GetEndAtLastLine() const
2039 return SendMsg(2278, 0, 0) != 0;
2042 // Retrieve the height of a particular line of text in pixels.
2043 int wxStyledTextCtrl::TextHeight(int line
)
2045 return SendMsg(2279, line
, 0);
2048 // Show or hide the vertical scroll bar.
2049 void wxStyledTextCtrl::SetUseVerticalScrollBar(bool show
)
2051 SendMsg(2280, show
, 0);
2054 // Is the vertical scroll bar visible?
2055 bool wxStyledTextCtrl::GetUseVerticalScrollBar() const
2057 return SendMsg(2281, 0, 0) != 0;
2060 // Append a string to the end of the document without changing the selection.
2061 void wxStyledTextCtrl::AppendText(const wxString
& text
) {
2062 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
2063 SendMsg(2282, strlen(buf
), (sptr_t
)(const char*)buf
);
2066 // Is drawing done in two phases with backgrounds drawn before foregrounds?
2067 bool wxStyledTextCtrl::GetTwoPhaseDraw() const
2069 return SendMsg(2283, 0, 0) != 0;
2072 // In twoPhaseDraw mode, drawing is performed in two phases, first the background
2073 // and then the foreground. This avoids chopping off characters that overlap the next run.
2074 void wxStyledTextCtrl::SetTwoPhaseDraw(bool twoPhase
)
2076 SendMsg(2284, twoPhase
, 0);
2079 // Make the target range start and end be the same as the selection range start and end.
2080 void wxStyledTextCtrl::TargetFromSelection()
2082 SendMsg(2287, 0, 0);
2085 // Join the lines in the target.
2086 void wxStyledTextCtrl::LinesJoin()
2088 SendMsg(2288, 0, 0);
2091 // Split the lines in the target into lines that are less wide than pixelWidth
2093 void wxStyledTextCtrl::LinesSplit(int pixelWidth
)
2095 SendMsg(2289, pixelWidth
, 0);
2098 // Set the colours used as a chequerboard pattern in the fold margin
2099 void wxStyledTextCtrl::SetFoldMarginColour(bool useSetting
, const wxColour
& back
)
2101 SendMsg(2290, useSetting
, wxColourAsLong(back
));
2103 void wxStyledTextCtrl::SetFoldMarginHiColour(bool useSetting
, const wxColour
& fore
)
2105 SendMsg(2291, useSetting
, wxColourAsLong(fore
));
2108 // Move caret down one line.
2109 void wxStyledTextCtrl::LineDown()
2111 SendMsg(2300, 0, 0);
2114 // Move caret down one line extending selection to new caret position.
2115 void wxStyledTextCtrl::LineDownExtend()
2117 SendMsg(2301, 0, 0);
2120 // Move caret up one line.
2121 void wxStyledTextCtrl::LineUp()
2123 SendMsg(2302, 0, 0);
2126 // Move caret up one line extending selection to new caret position.
2127 void wxStyledTextCtrl::LineUpExtend()
2129 SendMsg(2303, 0, 0);
2132 // Move caret left one character.
2133 void wxStyledTextCtrl::CharLeft()
2135 SendMsg(2304, 0, 0);
2138 // Move caret left one character extending selection to new caret position.
2139 void wxStyledTextCtrl::CharLeftExtend()
2141 SendMsg(2305, 0, 0);
2144 // Move caret right one character.
2145 void wxStyledTextCtrl::CharRight()
2147 SendMsg(2306, 0, 0);
2150 // Move caret right one character extending selection to new caret position.
2151 void wxStyledTextCtrl::CharRightExtend()
2153 SendMsg(2307, 0, 0);
2156 // Move caret left one word.
2157 void wxStyledTextCtrl::WordLeft()
2159 SendMsg(2308, 0, 0);
2162 // Move caret left one word extending selection to new caret position.
2163 void wxStyledTextCtrl::WordLeftExtend()
2165 SendMsg(2309, 0, 0);
2168 // Move caret right one word.
2169 void wxStyledTextCtrl::WordRight()
2171 SendMsg(2310, 0, 0);
2174 // Move caret right one word extending selection to new caret position.
2175 void wxStyledTextCtrl::WordRightExtend()
2177 SendMsg(2311, 0, 0);
2180 // Move caret to first position on line.
2181 void wxStyledTextCtrl::Home()
2183 SendMsg(2312, 0, 0);
2186 // Move caret to first position on line extending selection to new caret position.
2187 void wxStyledTextCtrl::HomeExtend()
2189 SendMsg(2313, 0, 0);
2192 // Move caret to last position on line.
2193 void wxStyledTextCtrl::LineEnd()
2195 SendMsg(2314, 0, 0);
2198 // Move caret to last position on line extending selection to new caret position.
2199 void wxStyledTextCtrl::LineEndExtend()
2201 SendMsg(2315, 0, 0);
2204 // Move caret to first position in document.
2205 void wxStyledTextCtrl::DocumentStart()
2207 SendMsg(2316, 0, 0);
2210 // Move caret to first position in document extending selection to new caret position.
2211 void wxStyledTextCtrl::DocumentStartExtend()
2213 SendMsg(2317, 0, 0);
2216 // Move caret to last position in document.
2217 void wxStyledTextCtrl::DocumentEnd()
2219 SendMsg(2318, 0, 0);
2222 // Move caret to last position in document extending selection to new caret position.
2223 void wxStyledTextCtrl::DocumentEndExtend()
2225 SendMsg(2319, 0, 0);
2228 // Move caret one page up.
2229 void wxStyledTextCtrl::PageUp()
2231 SendMsg(2320, 0, 0);
2234 // Move caret one page up extending selection to new caret position.
2235 void wxStyledTextCtrl::PageUpExtend()
2237 SendMsg(2321, 0, 0);
2240 // Move caret one page down.
2241 void wxStyledTextCtrl::PageDown()
2243 SendMsg(2322, 0, 0);
2246 // Move caret one page down extending selection to new caret position.
2247 void wxStyledTextCtrl::PageDownExtend()
2249 SendMsg(2323, 0, 0);
2252 // Switch from insert to overtype mode or the reverse.
2253 void wxStyledTextCtrl::EditToggleOvertype()
2255 SendMsg(2324, 0, 0);
2258 // Cancel any modes such as call tip or auto-completion list display.
2259 void wxStyledTextCtrl::Cancel()
2261 SendMsg(2325, 0, 0);
2264 // Delete the selection or if no selection, the character before the caret.
2265 void wxStyledTextCtrl::DeleteBack()
2267 SendMsg(2326, 0, 0);
2270 // If selection is empty or all on one line replace the selection with a tab character.
2271 // If more than one line selected, indent the lines.
2272 void wxStyledTextCtrl::Tab()
2274 SendMsg(2327, 0, 0);
2277 // Dedent the selected lines.
2278 void wxStyledTextCtrl::BackTab()
2280 SendMsg(2328, 0, 0);
2283 // Insert a new line, may use a CRLF, CR or LF depending on EOL mode.
2284 void wxStyledTextCtrl::NewLine()
2286 SendMsg(2329, 0, 0);
2289 // Insert a Form Feed character.
2290 void wxStyledTextCtrl::FormFeed()
2292 SendMsg(2330, 0, 0);
2295 // Move caret to before first visible character on line.
2296 // If already there move to first character on line.
2297 void wxStyledTextCtrl::VCHome()
2299 SendMsg(2331, 0, 0);
2302 // Like VCHome but extending selection to new caret position.
2303 void wxStyledTextCtrl::VCHomeExtend()
2305 SendMsg(2332, 0, 0);
2308 // Magnify the displayed text by increasing the sizes by 1 point.
2309 void wxStyledTextCtrl::ZoomIn()
2311 SendMsg(2333, 0, 0);
2314 // Make the displayed text smaller by decreasing the sizes by 1 point.
2315 void wxStyledTextCtrl::ZoomOut()
2317 SendMsg(2334, 0, 0);
2320 // Delete the word to the left of the caret.
2321 void wxStyledTextCtrl::DelWordLeft()
2323 SendMsg(2335, 0, 0);
2326 // Delete the word to the right of the caret.
2327 void wxStyledTextCtrl::DelWordRight()
2329 SendMsg(2336, 0, 0);
2332 // Delete the word to the right of the caret, but not the trailing non-word characters.
2333 void wxStyledTextCtrl::DelWordRightEnd()
2335 SendMsg(2518, 0, 0);
2338 // Cut the line containing the caret.
2339 void wxStyledTextCtrl::LineCut()
2341 SendMsg(2337, 0, 0);
2344 // Delete the line containing the caret.
2345 void wxStyledTextCtrl::LineDelete()
2347 SendMsg(2338, 0, 0);
2350 // Switch the current line with the previous.
2351 void wxStyledTextCtrl::LineTranspose()
2353 SendMsg(2339, 0, 0);
2356 // Duplicate the current line.
2357 void wxStyledTextCtrl::LineDuplicate()
2359 SendMsg(2404, 0, 0);
2362 // Transform the selection to lower case.
2363 void wxStyledTextCtrl::LowerCase()
2365 SendMsg(2340, 0, 0);
2368 // Transform the selection to upper case.
2369 void wxStyledTextCtrl::UpperCase()
2371 SendMsg(2341, 0, 0);
2374 // Scroll the document down, keeping the caret visible.
2375 void wxStyledTextCtrl::LineScrollDown()
2377 SendMsg(2342, 0, 0);
2380 // Scroll the document up, keeping the caret visible.
2381 void wxStyledTextCtrl::LineScrollUp()
2383 SendMsg(2343, 0, 0);
2386 // Delete the selection or if no selection, the character before the caret.
2387 // Will not delete the character before at the start of a line.
2388 void wxStyledTextCtrl::DeleteBackNotLine()
2390 SendMsg(2344, 0, 0);
2393 // Move caret to first position on display line.
2394 void wxStyledTextCtrl::HomeDisplay()
2396 SendMsg(2345, 0, 0);
2399 // Move caret to first position on display line extending selection to
2400 // new caret position.
2401 void wxStyledTextCtrl::HomeDisplayExtend()
2403 SendMsg(2346, 0, 0);
2406 // Move caret to last position on display line.
2407 void wxStyledTextCtrl::LineEndDisplay()
2409 SendMsg(2347, 0, 0);
2412 // Move caret to last position on display line extending selection to new
2414 void wxStyledTextCtrl::LineEndDisplayExtend()
2416 SendMsg(2348, 0, 0);
2419 // These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)?
2420 // except they behave differently when word-wrap is enabled:
2421 // They go first to the start / end of the display line, like (Home|LineEnd)Display
2422 // The difference is that, the cursor is already at the point, it goes on to the start
2423 // or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
2424 void wxStyledTextCtrl::HomeWrap()
2426 SendMsg(2349, 0, 0);
2428 void wxStyledTextCtrl::HomeWrapExtend()
2430 SendMsg(2450, 0, 0);
2432 void wxStyledTextCtrl::LineEndWrap()
2434 SendMsg(2451, 0, 0);
2436 void wxStyledTextCtrl::LineEndWrapExtend()
2438 SendMsg(2452, 0, 0);
2440 void wxStyledTextCtrl::VCHomeWrap()
2442 SendMsg(2453, 0, 0);
2444 void wxStyledTextCtrl::VCHomeWrapExtend()
2446 SendMsg(2454, 0, 0);
2449 // Copy the line containing the caret.
2450 void wxStyledTextCtrl::LineCopy()
2452 SendMsg(2455, 0, 0);
2455 // Move the caret inside current view if it's not there already.
2456 void wxStyledTextCtrl::MoveCaretInsideView()
2458 SendMsg(2401, 0, 0);
2461 // How many characters are on a line, not including end of line characters?
2462 int wxStyledTextCtrl::LineLength(int line
) const
2464 return SendMsg(2350, line
, 0);
2467 // Highlight the characters at two positions.
2468 void wxStyledTextCtrl::BraceHighlight(int pos1
, int pos2
)
2470 SendMsg(2351, pos1
, pos2
);
2473 // Highlight the character at a position indicating there is no matching brace.
2474 void wxStyledTextCtrl::BraceBadLight(int pos
)
2476 SendMsg(2352, pos
, 0);
2479 // Find the position of a matching brace or INVALID_POSITION if no match.
2480 int wxStyledTextCtrl::BraceMatch(int pos
)
2482 return SendMsg(2353, pos
, 0);
2485 // Are the end of line characters visible?
2486 bool wxStyledTextCtrl::GetViewEOL() const
2488 return SendMsg(2355, 0, 0) != 0;
2491 // Make the end of line characters visible or invisible.
2492 void wxStyledTextCtrl::SetViewEOL(bool visible
)
2494 SendMsg(2356, visible
, 0);
2497 // Retrieve a pointer to the document object.
2498 void* wxStyledTextCtrl::GetDocPointer() {
2499 return (void*)SendMsg(2357);
2502 // Change the document object used.
2503 void wxStyledTextCtrl::SetDocPointer(void* docPointer
) {
2504 SendMsg(2358, 0, (sptr_t
)docPointer
);
2507 // Set which document modification events are sent to the container.
2508 void wxStyledTextCtrl::SetModEventMask(int mask
)
2510 SendMsg(2359, mask
, 0);
2513 // Retrieve the column number which text should be kept within.
2514 int wxStyledTextCtrl::GetEdgeColumn() const
2516 return SendMsg(2360, 0, 0);
2519 // Set the column number of the edge.
2520 // If text goes past the edge then it is highlighted.
2521 void wxStyledTextCtrl::SetEdgeColumn(int column
)
2523 SendMsg(2361, column
, 0);
2526 // Retrieve the edge highlight mode.
2527 int wxStyledTextCtrl::GetEdgeMode() const
2529 return SendMsg(2362, 0, 0);
2532 // The edge may be displayed by a line (EDGE_LINE) or by highlighting text that
2533 // goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).
2534 void wxStyledTextCtrl::SetEdgeMode(int mode
)
2536 SendMsg(2363, mode
, 0);
2539 // Retrieve the colour used in edge indication.
2540 wxColour
wxStyledTextCtrl::GetEdgeColour() const
2542 long c
= SendMsg(2364, 0, 0);
2543 return wxColourFromLong(c
);
2546 // Change the colour used in edge indication.
2547 void wxStyledTextCtrl::SetEdgeColour(const wxColour
& edgeColour
)
2549 SendMsg(2365, wxColourAsLong(edgeColour
), 0);
2552 // Sets the current caret position to be the search anchor.
2553 void wxStyledTextCtrl::SearchAnchor()
2555 SendMsg(2366, 0, 0);
2558 // Find some text starting at the search anchor.
2559 // Does not ensure the selection is visible.
2560 int wxStyledTextCtrl::SearchNext(int flags
, const wxString
& text
)
2562 return SendMsg(2367, flags
, (sptr_t
)(const char*)wx2stc(text
));
2565 // Find some text starting at the search anchor and moving backwards.
2566 // Does not ensure the selection is visible.
2567 int wxStyledTextCtrl::SearchPrev(int flags
, const wxString
& text
)
2569 return SendMsg(2368, flags
, (sptr_t
)(const char*)wx2stc(text
));
2572 // Retrieves the number of lines completely visible.
2573 int wxStyledTextCtrl::LinesOnScreen() const
2575 return SendMsg(2370, 0, 0);
2578 // Set whether a pop up menu is displayed automatically when the user presses
2579 // the wrong mouse button.
2580 void wxStyledTextCtrl::UsePopUp(bool allowPopUp
)
2582 SendMsg(2371, allowPopUp
, 0);
2585 // Is the selection rectangular? The alternative is the more common stream selection.
2586 bool wxStyledTextCtrl::SelectionIsRectangle() const
2588 return SendMsg(2372, 0, 0) != 0;
2591 // Set the zoom level. This number of points is added to the size of all fonts.
2592 // It may be positive to magnify or negative to reduce.
2593 void wxStyledTextCtrl::SetZoom(int zoom
)
2595 SendMsg(2373, zoom
, 0);
2598 // Retrieve the zoom level.
2599 int wxStyledTextCtrl::GetZoom() const
2601 return SendMsg(2374, 0, 0);
2604 // Create a new document object.
2605 // Starts with reference count of 1 and not selected into editor.
2606 void* wxStyledTextCtrl::CreateDocument() {
2607 return (void*)SendMsg(2375);
2610 // Extend life of document.
2611 void wxStyledTextCtrl::AddRefDocument(void* docPointer
) {
2612 SendMsg(2376, 0, (sptr_t
)docPointer
);
2615 // Release a reference to the document, deleting document if it fades to black.
2616 void wxStyledTextCtrl::ReleaseDocument(void* docPointer
) {
2617 SendMsg(2377, 0, (sptr_t
)docPointer
);
2620 // Get which document modification events are sent to the container.
2621 int wxStyledTextCtrl::GetModEventMask() const
2623 return SendMsg(2378, 0, 0);
2626 // Change internal focus flag.
2627 void wxStyledTextCtrl::SetSTCFocus(bool focus
)
2629 SendMsg(2380, focus
, 0);
2632 // Get internal focus flag.
2633 bool wxStyledTextCtrl::GetSTCFocus() const
2635 return SendMsg(2381, 0, 0) != 0;
2638 // Change error status - 0 = OK.
2639 void wxStyledTextCtrl::SetStatus(int statusCode
)
2641 SendMsg(2382, statusCode
, 0);
2644 // Get error status.
2645 int wxStyledTextCtrl::GetStatus() const
2647 return SendMsg(2383, 0, 0);
2650 // Set whether the mouse is captured when its button is pressed.
2651 void wxStyledTextCtrl::SetMouseDownCaptures(bool captures
)
2653 SendMsg(2384, captures
, 0);
2656 // Get whether mouse gets captured.
2657 bool wxStyledTextCtrl::GetMouseDownCaptures() const
2659 return SendMsg(2385, 0, 0) != 0;
2662 // Sets the cursor to one of the SC_CURSOR* values.
2663 void wxStyledTextCtrl::SetSTCCursor(int cursorType
)
2665 SendMsg(2386, cursorType
, 0);
2669 int wxStyledTextCtrl::GetSTCCursor() const
2671 return SendMsg(2387, 0, 0);
2674 // Change the way control characters are displayed:
2675 // If symbol is < 32, keep the drawn way, else, use the given character.
2676 void wxStyledTextCtrl::SetControlCharSymbol(int symbol
)
2678 SendMsg(2388, symbol
, 0);
2681 // Get the way control characters are displayed.
2682 int wxStyledTextCtrl::GetControlCharSymbol() const
2684 return SendMsg(2389, 0, 0);
2687 // Move to the previous change in capitalisation.
2688 void wxStyledTextCtrl::WordPartLeft()
2690 SendMsg(2390, 0, 0);
2693 // Move to the previous change in capitalisation extending selection
2694 // to new caret position.
2695 void wxStyledTextCtrl::WordPartLeftExtend()
2697 SendMsg(2391, 0, 0);
2700 // Move to the change next in capitalisation.
2701 void wxStyledTextCtrl::WordPartRight()
2703 SendMsg(2392, 0, 0);
2706 // Move to the next change in capitalisation extending selection
2707 // to new caret position.
2708 void wxStyledTextCtrl::WordPartRightExtend()
2710 SendMsg(2393, 0, 0);
2713 // Set the way the display area is determined when a particular line
2714 // is to be moved to by Find, FindNext, GotoLine, etc.
2715 void wxStyledTextCtrl::SetVisiblePolicy(int visiblePolicy
, int visibleSlop
)
2717 SendMsg(2394, visiblePolicy
, visibleSlop
);
2720 // Delete back from the current position to the start of the line.
2721 void wxStyledTextCtrl::DelLineLeft()
2723 SendMsg(2395, 0, 0);
2726 // Delete forwards from the current position to the end of the line.
2727 void wxStyledTextCtrl::DelLineRight()
2729 SendMsg(2396, 0, 0);
2732 // Get and Set the xOffset (ie, horizonal scroll position).
2733 void wxStyledTextCtrl::SetXOffset(int newOffset
)
2735 SendMsg(2397, newOffset
, 0);
2737 int wxStyledTextCtrl::GetXOffset() const
2739 return SendMsg(2398, 0, 0);
2742 // Set the last x chosen value to be the caret x position.
2743 void wxStyledTextCtrl::ChooseCaretX()
2745 SendMsg(2399, 0, 0);
2748 // Set the way the caret is kept visible when going sideway.
2749 // The exclusion zone is given in pixels.
2750 void wxStyledTextCtrl::SetXCaretPolicy(int caretPolicy
, int caretSlop
)
2752 SendMsg(2402, caretPolicy
, caretSlop
);
2755 // Set the way the line the caret is on is kept visible.
2756 // The exclusion zone is given in lines.
2757 void wxStyledTextCtrl::SetYCaretPolicy(int caretPolicy
, int caretSlop
)
2759 SendMsg(2403, caretPolicy
, caretSlop
);
2762 // Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE).
2763 void wxStyledTextCtrl::SetPrintWrapMode(int mode
)
2765 SendMsg(2406, mode
, 0);
2768 // Is printing line wrapped?
2769 int wxStyledTextCtrl::GetPrintWrapMode() const
2771 return SendMsg(2407, 0, 0);
2774 // Set a fore colour for active hotspots.
2775 void wxStyledTextCtrl::SetHotspotActiveForeground(bool useSetting
, const wxColour
& fore
)
2777 SendMsg(2410, useSetting
, wxColourAsLong(fore
));
2780 // Get the fore colour for active hotspots.
2781 wxColour
wxStyledTextCtrl::GetHotspotActiveForeground() const
2783 long c
= SendMsg(2494, 0, 0);
2784 return wxColourFromLong(c
);
2787 // Set a back colour for active hotspots.
2788 void wxStyledTextCtrl::SetHotspotActiveBackground(bool useSetting
, const wxColour
& back
)
2790 SendMsg(2411, useSetting
, wxColourAsLong(back
));
2793 // Get the back colour for active hotspots.
2794 wxColour
wxStyledTextCtrl::GetHotspotActiveBackground() const
2796 long c
= SendMsg(2495, 0, 0);
2797 return wxColourFromLong(c
);
2800 // Enable / Disable underlining active hotspots.
2801 void wxStyledTextCtrl::SetHotspotActiveUnderline(bool underline
)
2803 SendMsg(2412, underline
, 0);
2806 // Get whether underlining for active hotspots.
2807 bool wxStyledTextCtrl::GetHotspotActiveUnderline() const
2809 return SendMsg(2496, 0, 0) != 0;
2812 // Limit hotspots to single line so hotspots on two lines don't merge.
2813 void wxStyledTextCtrl::SetHotspotSingleLine(bool singleLine
)
2815 SendMsg(2421, singleLine
, 0);
2818 // Get the HotspotSingleLine property
2819 bool wxStyledTextCtrl::GetHotspotSingleLine() const
2821 return SendMsg(2497, 0, 0) != 0;
2824 // Move caret between paragraphs (delimited by empty lines).
2825 void wxStyledTextCtrl::ParaDown()
2827 SendMsg(2413, 0, 0);
2829 void wxStyledTextCtrl::ParaDownExtend()
2831 SendMsg(2414, 0, 0);
2833 void wxStyledTextCtrl::ParaUp()
2835 SendMsg(2415, 0, 0);
2837 void wxStyledTextCtrl::ParaUpExtend()
2839 SendMsg(2416, 0, 0);
2842 // Given a valid document position, return the previous position taking code
2843 // page into account. Returns 0 if passed 0.
2844 int wxStyledTextCtrl::PositionBefore(int pos
)
2846 return SendMsg(2417, pos
, 0);
2849 // Given a valid document position, return the next position taking code
2850 // page into account. Maximum value returned is the last position in the document.
2851 int wxStyledTextCtrl::PositionAfter(int pos
)
2853 return SendMsg(2418, pos
, 0);
2856 // Copy a range of text to the clipboard. Positions are clipped into the document.
2857 void wxStyledTextCtrl::CopyRange(int start
, int end
)
2859 SendMsg(2419, start
, end
);
2862 // Copy argument text to the clipboard.
2863 void wxStyledTextCtrl::CopyText(int length
, const wxString
& text
)
2865 SendMsg(2420, length
, (sptr_t
)(const char*)wx2stc(text
));
2868 // Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE) or
2869 // by lines (SC_SEL_LINES).
2870 void wxStyledTextCtrl::SetSelectionMode(int mode
)
2872 SendMsg(2422, mode
, 0);
2875 // Get the mode of the current selection.
2876 int wxStyledTextCtrl::GetSelectionMode() const
2878 return SendMsg(2423, 0, 0);
2881 // Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line).
2882 int wxStyledTextCtrl::GetLineSelStartPosition(int line
)
2884 return SendMsg(2424, line
, 0);
2887 // Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line).
2888 int wxStyledTextCtrl::GetLineSelEndPosition(int line
)
2890 return SendMsg(2425, line
, 0);
2893 // Move caret down one line, extending rectangular selection to new caret position.
2894 void wxStyledTextCtrl::LineDownRectExtend()
2896 SendMsg(2426, 0, 0);
2899 // Move caret up one line, extending rectangular selection to new caret position.
2900 void wxStyledTextCtrl::LineUpRectExtend()
2902 SendMsg(2427, 0, 0);
2905 // Move caret left one character, extending rectangular selection to new caret position.
2906 void wxStyledTextCtrl::CharLeftRectExtend()
2908 SendMsg(2428, 0, 0);
2911 // Move caret right one character, extending rectangular selection to new caret position.
2912 void wxStyledTextCtrl::CharRightRectExtend()
2914 SendMsg(2429, 0, 0);
2917 // Move caret to first position on line, extending rectangular selection to new caret position.
2918 void wxStyledTextCtrl::HomeRectExtend()
2920 SendMsg(2430, 0, 0);
2923 // Move caret to before first visible character on line.
2924 // If already there move to first character on line.
2925 // In either case, extend rectangular selection to new caret position.
2926 void wxStyledTextCtrl::VCHomeRectExtend()
2928 SendMsg(2431, 0, 0);
2931 // Move caret to last position on line, extending rectangular selection to new caret position.
2932 void wxStyledTextCtrl::LineEndRectExtend()
2934 SendMsg(2432, 0, 0);
2937 // Move caret one page up, extending rectangular selection to new caret position.
2938 void wxStyledTextCtrl::PageUpRectExtend()
2940 SendMsg(2433, 0, 0);
2943 // Move caret one page down, extending rectangular selection to new caret position.
2944 void wxStyledTextCtrl::PageDownRectExtend()
2946 SendMsg(2434, 0, 0);
2949 // Move caret to top of page, or one page up if already at top of page.
2950 void wxStyledTextCtrl::StutteredPageUp()
2952 SendMsg(2435, 0, 0);
2955 // Move caret to top of page, or one page up if already at top of page, extending selection to new caret position.
2956 void wxStyledTextCtrl::StutteredPageUpExtend()
2958 SendMsg(2436, 0, 0);
2961 // Move caret to bottom of page, or one page down if already at bottom of page.
2962 void wxStyledTextCtrl::StutteredPageDown()
2964 SendMsg(2437, 0, 0);
2967 // Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position.
2968 void wxStyledTextCtrl::StutteredPageDownExtend()
2970 SendMsg(2438, 0, 0);
2973 // Move caret left one word, position cursor at end of word.
2974 void wxStyledTextCtrl::WordLeftEnd()
2976 SendMsg(2439, 0, 0);
2979 // Move caret left one word, position cursor at end of word, extending selection to new caret position.
2980 void wxStyledTextCtrl::WordLeftEndExtend()
2982 SendMsg(2440, 0, 0);
2985 // Move caret right one word, position cursor at end of word.
2986 void wxStyledTextCtrl::WordRightEnd()
2988 SendMsg(2441, 0, 0);
2991 // Move caret right one word, position cursor at end of word, extending selection to new caret position.
2992 void wxStyledTextCtrl::WordRightEndExtend()
2994 SendMsg(2442, 0, 0);
2997 // Set the set of characters making up whitespace for when moving or selecting by word.
2998 // Should be called after SetWordChars.
2999 void wxStyledTextCtrl::SetWhitespaceChars(const wxString
& characters
)
3001 SendMsg(2443, 0, (sptr_t
)(const char*)wx2stc(characters
));
3004 // Reset the set of characters for whitespace and word characters to the defaults.
3005 void wxStyledTextCtrl::SetCharsDefault()
3007 SendMsg(2444, 0, 0);
3010 // Get currently selected item position in the auto-completion list
3011 int wxStyledTextCtrl::AutoCompGetCurrent()
3013 return SendMsg(2445, 0, 0);
3016 // Enlarge the document to a particular size of text bytes.
3017 void wxStyledTextCtrl::Allocate(int bytes
)
3019 SendMsg(2446, bytes
, 0);
3022 // Find the position of a column on a line taking into account tabs and
3023 // multi-byte characters. If beyond end of line, return line end position.
3024 int wxStyledTextCtrl::FindColumn(int line
, int column
)
3026 return SendMsg(2456, line
, column
);
3029 // Can the caret preferred x position only be changed by explicit movement commands?
3030 bool wxStyledTextCtrl::GetCaretSticky() const
3032 return SendMsg(2457, 0, 0) != 0;
3035 // Stop the caret preferred x position changing when the user types.
3036 void wxStyledTextCtrl::SetCaretSticky(bool useCaretStickyBehaviour
)
3038 SendMsg(2458, useCaretStickyBehaviour
, 0);
3041 // Switch between sticky and non-sticky: meant to be bound to a key.
3042 void wxStyledTextCtrl::ToggleCaretSticky()
3044 SendMsg(2459, 0, 0);
3047 // Enable/Disable convert-on-paste for line endings
3048 void wxStyledTextCtrl::SetPasteConvertEndings(bool convert
)
3050 SendMsg(2467, convert
, 0);
3053 // Get convert-on-paste setting
3054 bool wxStyledTextCtrl::GetPasteConvertEndings() const
3056 return SendMsg(2468, 0, 0) != 0;
3059 // Duplicate the selection. If selection empty duplicate the line containing the caret.
3060 void wxStyledTextCtrl::SelectionDuplicate()
3062 SendMsg(2469, 0, 0);
3065 // Set background alpha of the caret line.
3066 void wxStyledTextCtrl::SetCaretLineBackAlpha(int alpha
)
3068 SendMsg(2470, alpha
, 0);
3071 // Get the background alpha of the caret line.
3072 int wxStyledTextCtrl::GetCaretLineBackAlpha() const
3074 return SendMsg(2471, 0, 0);
3077 // Set the style of the caret to be drawn.
3078 void wxStyledTextCtrl::SetCaretStyle(int caretStyle
)
3080 SendMsg(2512, caretStyle
, 0);
3083 // Returns the current style of the caret.
3084 int wxStyledTextCtrl::GetCaretStyle() const
3086 return SendMsg(2513, 0, 0);
3089 // Set the indicator used for IndicatorFillRange and IndicatorClearRange
3090 void wxStyledTextCtrl::SetIndicatorCurrent(int indicator
)
3092 SendMsg(2500, indicator
, 0);
3095 // Get the current indicator
3096 int wxStyledTextCtrl::GetIndicatorCurrent() const
3098 return SendMsg(2501, 0, 0);
3101 // Set the value used for IndicatorFillRange
3102 void wxStyledTextCtrl::SetIndicatorValue(int value
)
3104 SendMsg(2502, value
, 0);
3107 // Get the current indicator vaue
3108 int wxStyledTextCtrl::GetIndicatorValue() const
3110 return SendMsg(2503, 0, 0);
3113 // Turn a indicator on over a range.
3114 void wxStyledTextCtrl::IndicatorFillRange(int position
, int fillLength
)
3116 SendMsg(2504, position
, fillLength
);
3119 // Turn a indicator off over a range.
3120 void wxStyledTextCtrl::IndicatorClearRange(int position
, int clearLength
)
3122 SendMsg(2505, position
, clearLength
);
3125 // Are any indicators present at position?
3126 int wxStyledTextCtrl::IndicatorAllOnFor(int position
)
3128 return SendMsg(2506, position
, 0);
3131 // What value does a particular indicator have at at a position?
3132 int wxStyledTextCtrl::IndicatorValueAt(int indicator
, int position
)
3134 return SendMsg(2507, indicator
, position
);
3137 // Where does a particular indicator start?
3138 int wxStyledTextCtrl::IndicatorStart(int indicator
, int position
)
3140 return SendMsg(2508, indicator
, position
);
3143 // Where does a particular indicator end?
3144 int wxStyledTextCtrl::IndicatorEnd(int indicator
, int position
)
3146 return SendMsg(2509, indicator
, position
);
3149 // Set number of entries in position cache
3150 void wxStyledTextCtrl::SetPositionCacheSize(int size
)
3152 SendMsg(2514, size
, 0);
3155 // How many entries are allocated to the position cache?
3156 int wxStyledTextCtrl::GetPositionCacheSize() const
3158 return SendMsg(2515, 0, 0);
3161 // Start notifying the container of all key presses and commands.
3162 void wxStyledTextCtrl::StartRecord()
3164 SendMsg(3001, 0, 0);
3167 // Stop notifying the container of all key presses and commands.
3168 void wxStyledTextCtrl::StopRecord()
3170 SendMsg(3002, 0, 0);
3173 // Set the lexing language of the document.
3174 void wxStyledTextCtrl::SetLexer(int lexer
)
3176 SendMsg(4001, lexer
, 0);
3179 // Retrieve the lexing language of the document.
3180 int wxStyledTextCtrl::GetLexer() const
3182 return SendMsg(4002, 0, 0);
3185 // Colourise a segment of the document using the current lexing language.
3186 void wxStyledTextCtrl::Colourise(int start
, int end
)
3188 SendMsg(4003, start
, end
);
3191 // Set up a value that may be used by a lexer for some optional feature.
3192 void wxStyledTextCtrl::SetProperty(const wxString
& key
, const wxString
& value
)
3194 SendMsg(4004, (sptr_t
)(const char*)wx2stc(key
), (sptr_t
)(const char*)wx2stc(value
));
3197 // Set up the key words used by the lexer.
3198 void wxStyledTextCtrl::SetKeyWords(int keywordSet
, const wxString
& keyWords
)
3200 SendMsg(4005, keywordSet
, (sptr_t
)(const char*)wx2stc(keyWords
));
3203 // Set the lexing language of the document based on string name.
3204 void wxStyledTextCtrl::SetLexerLanguage(const wxString
& language
)
3206 SendMsg(4006, 0, (sptr_t
)(const char*)wx2stc(language
));
3209 // Retrieve a 'property' value previously set with SetProperty.
3210 wxString
wxStyledTextCtrl::GetProperty(const wxString
& key
) {
3211 int len
= SendMsg(SCI_GETPROPERTY
, (sptr_t
)(const char*)wx2stc(key
), 0);
3212 if (!len
) return wxEmptyString
;
3214 wxMemoryBuffer
mbuf(len
+1);
3215 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3216 SendMsg(4008, (uptr_t
)(const char*)wx2stc(key
), (sptr_t
)buf
);
3217 mbuf
.UngetWriteBuf(len
);
3222 // Retrieve a 'property' value previously set with SetProperty,
3223 // with '$()' variable replacement on returned buffer.
3224 wxString
wxStyledTextCtrl::GetPropertyExpanded(const wxString
& key
) {
3225 int len
= SendMsg(SCI_GETPROPERTYEXPANDED
, (uptr_t
)(const char*)wx2stc(key
), 0);
3226 if (!len
) return wxEmptyString
;
3228 wxMemoryBuffer
mbuf(len
+1);
3229 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3230 SendMsg(4009, (uptr_t
)(const char*)wx2stc(key
), (sptr_t
)buf
);
3231 mbuf
.UngetWriteBuf(len
);
3236 // Retrieve a 'property' value previously set with SetProperty,
3237 // interpreted as an int AFTER any '$()' variable replacement.
3238 int wxStyledTextCtrl::GetPropertyInt(const wxString
& key
) const
3240 return SendMsg(4010, (sptr_t
)(const char*)wx2stc(key
), 0);
3243 // Retrieve the number of bits the current lexer needs for styling.
3244 int wxStyledTextCtrl::GetStyleBitsNeeded() const
3246 return SendMsg(4011, 0, 0);
3250 //----------------------------------------------------------------------
3253 // Returns the line number of the line with the caret.
3254 int wxStyledTextCtrl::GetCurrentLine() {
3255 int line
= LineFromPosition(GetCurrentPos());
3260 // Extract style settings from a spec-string which is composed of one or
3261 // more of the following comma separated elements:
3263 // bold turns on bold
3264 // italic turns on italics
3265 // fore:[name or #RRGGBB] sets the foreground colour
3266 // back:[name or #RRGGBB] sets the background colour
3267 // face:[facename] sets the font face name to use
3268 // size:[num] sets the font size in points
3269 // eol turns on eol filling
3270 // underline turns on underlining
3272 void wxStyledTextCtrl::StyleSetSpec(int styleNum
, const wxString
& spec
) {
3274 wxStringTokenizer
tkz(spec
, wxT(","));
3275 while (tkz
.HasMoreTokens()) {
3276 wxString token
= tkz
.GetNextToken();
3278 wxString option
= token
.BeforeFirst(':');
3279 wxString val
= token
.AfterFirst(':');
3281 if (option
== wxT("bold"))
3282 StyleSetBold(styleNum
, true);
3284 else if (option
== wxT("italic"))
3285 StyleSetItalic(styleNum
, true);
3287 else if (option
== wxT("underline"))
3288 StyleSetUnderline(styleNum
, true);
3290 else if (option
== wxT("eol"))
3291 StyleSetEOLFilled(styleNum
, true);
3293 else if (option
== wxT("size")) {
3295 if (val
.ToLong(&points
))
3296 StyleSetSize(styleNum
, points
);
3299 else if (option
== wxT("face"))
3300 StyleSetFaceName(styleNum
, val
);
3302 else if (option
== wxT("fore"))
3303 StyleSetForeground(styleNum
, wxColourFromSpec(val
));
3305 else if (option
== wxT("back"))
3306 StyleSetBackground(styleNum
, wxColourFromSpec(val
));
3311 // Get the font of a style
3312 wxFont
wxStyledTextCtrl::StyleGetFont(int style
) {
3314 font
.SetPointSize(StyleGetSize(style
));
3315 font
.SetFaceName(StyleGetFaceName(style
));
3316 if( StyleGetBold(style
) )
3317 font
.SetWeight(wxFONTWEIGHT_BOLD
);
3319 font
.SetWeight(wxFONTWEIGHT_NORMAL
);
3321 if( StyleGetItalic(style
) )
3322 font
.SetStyle(wxFONTSTYLE_ITALIC
);
3324 font
.SetStyle(wxFONTSTYLE_NORMAL
);
3330 // Set style size, face, bold, italic, and underline attributes from
3331 // a wxFont's attributes.
3332 void wxStyledTextCtrl::StyleSetFont(int styleNum
, wxFont
& font
) {
3334 // Ensure that the native font is initialized
3336 GetTextExtent(wxT("X"), &x
, &y
, NULL
, NULL
, &font
);
3338 int size
= font
.GetPointSize();
3339 wxString faceName
= font
.GetFaceName();
3340 bool bold
= font
.GetWeight() == wxBOLD
;
3341 bool italic
= font
.GetStyle() != wxNORMAL
;
3342 bool under
= font
.GetUnderlined();
3343 wxFontEncoding encoding
= font
.GetEncoding();
3345 StyleSetFontAttr(styleNum
, size
, faceName
, bold
, italic
, under
, encoding
);
3348 // Set all font style attributes at once.
3349 void wxStyledTextCtrl::StyleSetFontAttr(int styleNum
, int size
,
3350 const wxString
& faceName
,
3351 bool bold
, bool italic
,
3353 wxFontEncoding encoding
) {
3354 StyleSetSize(styleNum
, size
);
3355 StyleSetFaceName(styleNum
, faceName
);
3356 StyleSetBold(styleNum
, bold
);
3357 StyleSetItalic(styleNum
, italic
);
3358 StyleSetUnderline(styleNum
, underline
);
3359 StyleSetFontEncoding(styleNum
, encoding
);
3363 // Set the character set of the font in a style. Converts the Scintilla
3364 // character set values to a wxFontEncoding.
3365 void wxStyledTextCtrl::StyleSetCharacterSet(int style
, int characterSet
)
3367 wxFontEncoding encoding
;
3369 // Translate the Scintilla characterSet to a wxFontEncoding
3370 switch (characterSet
) {
3372 case wxSTC_CHARSET_ANSI
:
3373 case wxSTC_CHARSET_DEFAULT
:
3374 encoding
= wxFONTENCODING_DEFAULT
;
3377 case wxSTC_CHARSET_BALTIC
:
3378 encoding
= wxFONTENCODING_ISO8859_13
;
3381 case wxSTC_CHARSET_CHINESEBIG5
:
3382 encoding
= wxFONTENCODING_CP950
;
3385 case wxSTC_CHARSET_EASTEUROPE
:
3386 encoding
= wxFONTENCODING_ISO8859_2
;
3389 case wxSTC_CHARSET_GB2312
:
3390 encoding
= wxFONTENCODING_CP936
;
3393 case wxSTC_CHARSET_GREEK
:
3394 encoding
= wxFONTENCODING_ISO8859_7
;
3397 case wxSTC_CHARSET_HANGUL
:
3398 encoding
= wxFONTENCODING_CP949
;
3401 case wxSTC_CHARSET_MAC
:
3402 encoding
= wxFONTENCODING_DEFAULT
;
3405 case wxSTC_CHARSET_OEM
:
3406 encoding
= wxFONTENCODING_DEFAULT
;
3409 case wxSTC_CHARSET_RUSSIAN
:
3410 encoding
= wxFONTENCODING_KOI8
;
3413 case wxSTC_CHARSET_SHIFTJIS
:
3414 encoding
= wxFONTENCODING_CP932
;
3417 case wxSTC_CHARSET_SYMBOL
:
3418 encoding
= wxFONTENCODING_DEFAULT
;
3421 case wxSTC_CHARSET_TURKISH
:
3422 encoding
= wxFONTENCODING_ISO8859_9
;
3425 case wxSTC_CHARSET_JOHAB
:
3426 encoding
= wxFONTENCODING_DEFAULT
;
3429 case wxSTC_CHARSET_HEBREW
:
3430 encoding
= wxFONTENCODING_ISO8859_8
;
3433 case wxSTC_CHARSET_ARABIC
:
3434 encoding
= wxFONTENCODING_ISO8859_6
;
3437 case wxSTC_CHARSET_VIETNAMESE
:
3438 encoding
= wxFONTENCODING_DEFAULT
;
3441 case wxSTC_CHARSET_THAI
:
3442 encoding
= wxFONTENCODING_ISO8859_11
;
3445 case wxSTC_CHARSET_CYRILLIC
:
3446 encoding
= wxFONTENCODING_ISO8859_5
;
3449 case wxSTC_CHARSET_8859_15
:
3450 encoding
= wxFONTENCODING_ISO8859_15
;;
3454 // We just have Scintilla track the wxFontEncoding for us. It gets used
3455 // in Font::Create in PlatWX.cpp. We add one to the value so that the
3456 // effective wxFONENCODING_DEFAULT == SC_SHARSET_DEFAULT and so when
3457 // Scintilla internally uses SC_CHARSET_DEFAULT we will translate it back
3458 // to wxFONENCODING_DEFAULT in Font::Create.
3459 SendMsg(SCI_STYLESETCHARACTERSET
, style
, encoding
+1);
3463 // Set the font encoding to be used by a style.
3464 void wxStyledTextCtrl::StyleSetFontEncoding(int style
, wxFontEncoding encoding
)
3466 SendMsg(SCI_STYLESETCHARACTERSET
, style
, encoding
+1);
3470 // Perform one of the operations defined by the wxSTC_CMD_* constants.
3471 void wxStyledTextCtrl::CmdKeyExecute(int cmd
) {
3476 // Set the left and right margin in the edit area, measured in pixels.
3477 void wxStyledTextCtrl::SetMargins(int left
, int right
) {
3478 SetMarginLeft(left
);
3479 SetMarginRight(right
);
3483 // Retrieve the point in the window where a position is displayed.
3484 wxPoint
wxStyledTextCtrl::PointFromPosition(int pos
) {
3485 int x
= SendMsg(SCI_POINTXFROMPOSITION
, 0, pos
);
3486 int y
= SendMsg(SCI_POINTYFROMPOSITION
, 0, pos
);
3487 return wxPoint(x
, y
);
3490 // Scroll enough to make the given line visible
3491 void wxStyledTextCtrl::ScrollToLine(int line
) {
3492 m_swx
->DoScrollToLine(line
);
3496 // Scroll enough to make the given column visible
3497 void wxStyledTextCtrl::ScrollToColumn(int column
) {
3498 m_swx
->DoScrollToColumn(column
);
3503 bool wxStyledTextCtrl::DoSaveFile(const wxString
& filename
, int WXUNUSED(fileType
))
3505 bool wxStyledTextCtrl::SaveFile(const wxString
& filename
)
3508 wxFile
file(filename
, wxFile::write
);
3510 if (!file
.IsOpened())
3513 bool success
= file
.Write(GetText(), *wxConvCurrent
);
3522 bool wxStyledTextCtrl::DoLoadFile(const wxString
& filename
, int WXUNUSED(fileType
))
3524 bool wxStyledTextCtrl::LoadFile(const wxString
& filename
)
3527 bool success
= false;
3528 wxFile
file(filename
, wxFile::read
);
3530 if (file
.IsOpened())
3533 // get the file size (assume it is not huge file...)
3534 ssize_t len
= (ssize_t
)file
.Length();
3539 wxMemoryBuffer
buffer(len
+1);
3540 success
= (file
.Read(buffer
.GetData(), len
) == len
);
3542 ((char*)buffer
.GetData())[len
] = 0;
3543 contents
= wxString(buffer
, *wxConvCurrent
, len
);
3547 success
= (file
.Read(wxStringBuffer(buffer
, len
), len
) == len
);
3554 success
= true; // empty file is ok
3556 success
= false; // len == wxInvalidOffset
3571 #if wxUSE_DRAG_AND_DROP
3572 wxDragResult
wxStyledTextCtrl::DoDragOver(wxCoord x
, wxCoord y
, wxDragResult def
) {
3573 return m_swx
->DoDragOver(x
, y
, def
);
3577 bool wxStyledTextCtrl::DoDropText(long x
, long y
, const wxString
& data
) {
3578 return m_swx
->DoDropText(x
, y
, data
);
3583 void wxStyledTextCtrl::SetUseAntiAliasing(bool useAA
) {
3584 m_swx
->SetUseAntiAliasing(useAA
);
3587 bool wxStyledTextCtrl::GetUseAntiAliasing() {
3588 return m_swx
->GetUseAntiAliasing();
3595 void wxStyledTextCtrl::AddTextRaw(const char* text
)
3597 SendMsg(SCI_ADDTEXT
, strlen(text
), (sptr_t
)text
);
3600 void wxStyledTextCtrl::InsertTextRaw(int pos
, const char* text
)
3602 SendMsg(SCI_INSERTTEXT
, pos
, (sptr_t
)text
);
3605 wxCharBuffer
wxStyledTextCtrl::GetCurLineRaw(int* linePos
)
3607 int len
= LineLength(GetCurrentLine());
3609 if (linePos
) *linePos
= 0;
3614 wxCharBuffer
buf(len
);
3615 int pos
= SendMsg(SCI_GETCURLINE
, len
, (sptr_t
)buf
.data());
3616 if (linePos
) *linePos
= pos
;
3620 wxCharBuffer
wxStyledTextCtrl::GetLineRaw(int line
)
3622 int len
= LineLength(line
);
3628 wxCharBuffer
buf(len
);
3629 SendMsg(SCI_GETLINE
, line
, (sptr_t
)buf
.data());
3633 wxCharBuffer
wxStyledTextCtrl::GetSelectedTextRaw()
3638 GetSelection(&start
, &end
);
3639 int len
= end
- start
;
3645 wxCharBuffer
buf(len
);
3646 SendMsg(SCI_GETSELTEXT
, 0, (sptr_t
)buf
.data());
3650 wxCharBuffer
wxStyledTextCtrl::GetTextRangeRaw(int startPos
, int endPos
)
3652 if (endPos
< startPos
) {
3653 int temp
= startPos
;
3657 int len
= endPos
- startPos
;
3663 wxCharBuffer
buf(len
);
3665 tr
.lpstrText
= buf
.data();
3666 tr
.chrg
.cpMin
= startPos
;
3667 tr
.chrg
.cpMax
= endPos
;
3668 SendMsg(SCI_GETTEXTRANGE
, 0, (sptr_t
)&tr
);
3672 void wxStyledTextCtrl::SetTextRaw(const char* text
)
3674 SendMsg(SCI_SETTEXT
, 0, (sptr_t
)text
);
3677 wxCharBuffer
wxStyledTextCtrl::GetTextRaw()
3679 int len
= GetTextLength();
3680 wxCharBuffer
buf(len
); // adds 1 for NUL automatically
3681 SendMsg(SCI_GETTEXT
, len
+ 1, (sptr_t
)buf
.data());
3685 void wxStyledTextCtrl::AppendTextRaw(const char* text
)
3687 SendMsg(SCI_APPENDTEXT
, strlen(text
), (sptr_t
)text
);
3694 //----------------------------------------------------------------------
3697 void wxStyledTextCtrl::OnPaint(wxPaintEvent
& WXUNUSED(evt
)) {
3699 m_swx
->DoPaint(&dc
, GetUpdateRegion().GetBox());
3702 void wxStyledTextCtrl::OnScrollWin(wxScrollWinEvent
& evt
) {
3703 if (evt
.GetOrientation() == wxHORIZONTAL
)
3704 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
3706 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
3709 void wxStyledTextCtrl::OnScroll(wxScrollEvent
& evt
) {
3710 wxScrollBar
* sb
= wxDynamicCast(evt
.GetEventObject(), wxScrollBar
);
3712 if (sb
->IsVertical())
3713 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
3715 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
3719 void wxStyledTextCtrl::OnSize(wxSizeEvent
& WXUNUSED(evt
)) {
3721 wxSize sz
= GetClientSize();
3722 m_swx
->DoSize(sz
.x
, sz
.y
);
3726 void wxStyledTextCtrl::OnMouseLeftDown(wxMouseEvent
& evt
) {
3728 wxPoint pt
= evt
.GetPosition();
3729 m_swx
->DoLeftButtonDown(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
3730 evt
.ShiftDown(), evt
.ControlDown(), evt
.AltDown());
3733 void wxStyledTextCtrl::OnMouseMove(wxMouseEvent
& evt
) {
3734 wxPoint pt
= evt
.GetPosition();
3735 m_swx
->DoLeftButtonMove(Point(pt
.x
, pt
.y
));
3738 void wxStyledTextCtrl::OnMouseLeftUp(wxMouseEvent
& evt
) {
3739 wxPoint pt
= evt
.GetPosition();
3740 m_swx
->DoLeftButtonUp(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
3745 void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent
& evt
) {
3746 wxPoint pt
= evt
.GetPosition();
3747 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
3751 void wxStyledTextCtrl::OnMouseMiddleUp(wxMouseEvent
& evt
) {
3752 wxPoint pt
= evt
.GetPosition();
3753 m_swx
->DoMiddleButtonUp(Point(pt
.x
, pt
.y
));
3756 void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent
& evt
) {
3757 wxPoint pt
= evt
.GetPosition();
3758 ScreenToClient(&pt
.x
, &pt
.y
);
3760 Show context menu at event point if it's within the window,
3761 or at caret location if not
3763 wxHitTest ht
= this->HitTest(pt
);
3764 if (ht
!= wxHT_WINDOW_INSIDE
) {
3765 pt
= this->PointFromPosition(this->GetCurrentPos());
3767 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
3771 void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent
& evt
)
3773 // prevent having an event queue with wheel events that cannot be processed
3774 // reasonably fast (see ticket #9057)
3775 if ( m_lastWheelTimestamp
<= evt
.GetTimestamp() )
3777 m_lastWheelTimestamp
= m_stopWatch
.Time();
3778 m_swx
->DoMouseWheel(evt
.GetWheelRotation(),
3779 evt
.GetWheelDelta(),
3780 evt
.GetLinesPerAction(),
3782 evt
.IsPageScroll());
3783 m_lastWheelTimestamp
= m_stopWatch
.Time() - m_lastWheelTimestamp
;
3784 m_lastWheelTimestamp
+= evt
.GetTimestamp();
3789 void wxStyledTextCtrl::OnChar(wxKeyEvent
& evt
) {
3790 // On (some?) non-US PC keyboards the AltGr key is required to enter some
3791 // common characters. It comes to us as both Alt and Ctrl down so we need
3792 // to let the char through in that case, otherwise if only ctrl or only
3793 // alt let's skip it.
3794 bool ctrl
= evt
.ControlDown();
3796 // On the Mac the Alt key is just a modifier key (like Shift) so we need
3797 // to allow the char events to be processed when Alt is pressed.
3798 // TODO: Should we check MetaDown instead in this case?
3801 bool alt
= evt
.AltDown();
3803 bool skip
= ((ctrl
|| alt
) && ! (ctrl
&& alt
));
3806 // apparently if we don't do this, Unicode keys pressed after non-char
3807 // ASCII ones (e.g. Enter, Tab) are not taken into account (patch 1615989)
3808 if (m_lastKeyDownConsumed
&& evt
.GetUnicodeKey() > 255)
3809 m_lastKeyDownConsumed
= false;
3812 if (!m_lastKeyDownConsumed
&& !skip
) {
3814 int key
= evt
.GetUnicodeKey();
3817 // if the unicode key code is not really a unicode character (it may
3818 // be a function key or etc., the platforms appear to always give us a
3819 // small value in this case) then fallback to the ascii key code but
3820 // don't do anything for function keys or etc.
3822 key
= evt
.GetKeyCode();
3823 keyOk
= (key
<= 127);
3826 m_swx
->DoAddChar(key
);
3830 int key
= evt
.GetKeyCode();
3831 if (key
<= WXK_START
|| key
> WXK_COMMAND
) {
3832 m_swx
->DoAddChar(key
);
3842 void wxStyledTextCtrl::OnKeyDown(wxKeyEvent
& evt
) {
3843 int processed
= m_swx
->DoKeyDown(evt
, &m_lastKeyDownConsumed
);
3844 if (!processed
&& !m_lastKeyDownConsumed
)
3849 void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent
& evt
) {
3850 m_swx
->DoLoseFocus();
3855 void wxStyledTextCtrl::OnGainFocus(wxFocusEvent
& evt
) {
3856 m_swx
->DoGainFocus();
3861 void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent
& WXUNUSED(evt
)) {
3862 m_swx
->DoSysColourChange();
3866 void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent
& WXUNUSED(evt
)) {
3867 // do nothing to help avoid flashing
3872 void wxStyledTextCtrl::OnMenu(wxCommandEvent
& evt
) {
3873 m_swx
->DoCommand(evt
.GetId());
3877 void wxStyledTextCtrl::OnListBox(wxCommandEvent
& WXUNUSED(evt
)) {
3878 m_swx
->DoOnListBox();
3882 void wxStyledTextCtrl::OnIdle(wxIdleEvent
& evt
) {
3883 m_swx
->DoOnIdle(evt
);
3887 wxSize
wxStyledTextCtrl::DoGetBestSize() const
3889 // What would be the best size for a wxSTC?
3890 // Just give a reasonable minimum until something else can be figured out.
3891 return wxSize(200,100);
3895 //----------------------------------------------------------------------
3896 // Turn notifications from Scintilla into events
3899 void wxStyledTextCtrl::NotifyChange() {
3900 wxStyledTextEvent
evt(wxEVT_STC_CHANGE
, GetId());
3901 evt
.SetEventObject(this);
3902 GetEventHandler()->ProcessEvent(evt
);
3906 static void SetEventText(wxStyledTextEvent
& evt
, const char* text
,
3910 evt
.SetText(stc2wx(text
, length
));
3914 void wxStyledTextCtrl::NotifyParent(SCNotification
* _scn
) {
3915 SCNotification
& scn
= *_scn
;
3916 wxStyledTextEvent
evt(0, GetId());
3918 evt
.SetEventObject(this);
3919 evt
.SetPosition(scn
.position
);
3921 evt
.SetModifiers(scn
.modifiers
);
3923 switch (scn
.nmhdr
.code
) {
3924 case SCN_STYLENEEDED
:
3925 evt
.SetEventType(wxEVT_STC_STYLENEEDED
);
3929 evt
.SetEventType(wxEVT_STC_CHARADDED
);
3932 case SCN_SAVEPOINTREACHED
:
3933 evt
.SetEventType(wxEVT_STC_SAVEPOINTREACHED
);
3936 case SCN_SAVEPOINTLEFT
:
3937 evt
.SetEventType(wxEVT_STC_SAVEPOINTLEFT
);
3940 case SCN_MODIFYATTEMPTRO
:
3941 evt
.SetEventType(wxEVT_STC_ROMODIFYATTEMPT
);
3945 evt
.SetEventType(wxEVT_STC_KEY
);
3948 case SCN_DOUBLECLICK
:
3949 evt
.SetEventType(wxEVT_STC_DOUBLECLICK
);
3953 evt
.SetEventType(wxEVT_STC_UPDATEUI
);
3957 evt
.SetEventType(wxEVT_STC_MODIFIED
);
3958 evt
.SetModificationType(scn
.modificationType
);
3959 SetEventText(evt
, scn
.text
, scn
.length
);
3960 evt
.SetLength(scn
.length
);
3961 evt
.SetLinesAdded(scn
.linesAdded
);
3962 evt
.SetLine(scn
.line
);
3963 evt
.SetFoldLevelNow(scn
.foldLevelNow
);
3964 evt
.SetFoldLevelPrev(scn
.foldLevelPrev
);
3967 case SCN_MACRORECORD
:
3968 evt
.SetEventType(wxEVT_STC_MACRORECORD
);
3969 evt
.SetMessage(scn
.message
);
3970 evt
.SetWParam(scn
.wParam
);
3971 evt
.SetLParam(scn
.lParam
);
3974 case SCN_MARGINCLICK
:
3975 evt
.SetEventType(wxEVT_STC_MARGINCLICK
);
3976 evt
.SetMargin(scn
.margin
);
3980 evt
.SetEventType(wxEVT_STC_NEEDSHOWN
);
3981 evt
.SetLength(scn
.length
);
3985 evt
.SetEventType(wxEVT_STC_PAINTED
);
3988 case SCN_AUTOCSELECTION
:
3989 evt
.SetEventType(wxEVT_STC_AUTOCOMP_SELECTION
);
3990 evt
.SetListType(scn
.listType
);
3991 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
3992 evt
.SetPosition(scn
.lParam
);
3995 case SCN_USERLISTSELECTION
:
3996 evt
.SetEventType(wxEVT_STC_USERLISTSELECTION
);
3997 evt
.SetListType(scn
.listType
);
3998 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
3999 evt
.SetPosition(scn
.lParam
);
4002 case SCN_URIDROPPED
:
4003 evt
.SetEventType(wxEVT_STC_URIDROPPED
);
4004 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
4007 case SCN_DWELLSTART
:
4008 evt
.SetEventType(wxEVT_STC_DWELLSTART
);
4014 evt
.SetEventType(wxEVT_STC_DWELLEND
);
4020 evt
.SetEventType(wxEVT_STC_ZOOM
);
4023 case SCN_HOTSPOTCLICK
:
4024 evt
.SetEventType(wxEVT_STC_HOTSPOT_CLICK
);
4027 case SCN_HOTSPOTDOUBLECLICK
:
4028 evt
.SetEventType(wxEVT_STC_HOTSPOT_DCLICK
);
4031 case SCN_CALLTIPCLICK
:
4032 evt
.SetEventType(wxEVT_STC_CALLTIP_CLICK
);
4035 case SCN_INDICATORCLICK
:
4036 evt
.SetEventType(wxEVT_STC_INDICATOR_CLICK
);
4039 case SCN_INDICATORRELEASE
:
4040 evt
.SetEventType(wxEVT_STC_INDICATOR_RELEASE
);
4047 GetEventHandler()->ProcessEvent(evt
);
4051 //----------------------------------------------------------------------
4052 //----------------------------------------------------------------------
4053 //----------------------------------------------------------------------
4055 wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType
, int id
)
4056 : wxCommandEvent(commandType
, id
)
4061 m_modificationType
= 0;
4066 m_foldLevelPrev
= 0;
4074 m_dragAllowMove
= false;
4075 #if wxUSE_DRAG_AND_DROP
4076 m_dragResult
= wxDragNone
;
4080 bool wxStyledTextEvent::GetShift() const { return (m_modifiers
& SCI_SHIFT
) != 0; }
4081 bool wxStyledTextEvent::GetControl() const { return (m_modifiers
& SCI_CTRL
) != 0; }
4082 bool wxStyledTextEvent::GetAlt() const { return (m_modifiers
& SCI_ALT
) != 0; }
4085 wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent
& event
):
4086 wxCommandEvent(event
)
4088 m_position
= event
.m_position
;
4089 m_key
= event
.m_key
;
4090 m_modifiers
= event
.m_modifiers
;
4091 m_modificationType
= event
.m_modificationType
;
4092 m_text
= event
.m_text
;
4093 m_length
= event
.m_length
;
4094 m_linesAdded
= event
.m_linesAdded
;
4095 m_line
= event
.m_line
;
4096 m_foldLevelNow
= event
.m_foldLevelNow
;
4097 m_foldLevelPrev
= event
.m_foldLevelPrev
;
4099 m_margin
= event
.m_margin
;
4101 m_message
= event
.m_message
;
4102 m_wParam
= event
.m_wParam
;
4103 m_lParam
= event
.m_lParam
;
4105 m_listType
= event
.m_listType
;
4109 m_dragText
= event
.m_dragText
;
4110 m_dragAllowMove
=event
.m_dragAllowMove
;
4111 #if wxUSE_DRAG_AND_DROP
4112 m_dragResult
= event
.m_dragResult
;
4116 //----------------------------------------------------------------------
4117 //----------------------------------------------------------------------