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 wxChar
* wxSTCNameStr
= wxT("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;
203 // Put Scintilla into unicode (UTF-8) mode
204 SetCodePage(wxSTC_CP_UTF8
);
207 SetInitialSize(size
);
209 // Reduces flicker on GTK+/X11
210 SetBackgroundStyle(wxBG_STYLE_CUSTOM
);
212 // Make sure it can take the focus
219 wxStyledTextCtrl::~wxStyledTextCtrl() {
224 //----------------------------------------------------------------------
226 long wxStyledTextCtrl::SendMsg(int msg
, long wp
, long lp
) const
228 return m_swx
->WndProc(msg
, wp
, lp
);
231 //----------------------------------------------------------------------
233 // Set the vertical scrollbar to use instead of the ont that's built-in.
234 void wxStyledTextCtrl::SetVScrollBar(wxScrollBar
* bar
) {
237 // ensure that the built-in scrollbar is not visible
238 SetScrollbar(wxVERTICAL
, 0, 0, 0);
243 // Set the horizontal scrollbar to use instead of the ont that's built-in.
244 void wxStyledTextCtrl::SetHScrollBar(wxScrollBar
* bar
) {
247 // ensure that the built-in scrollbar is not visible
248 SetScrollbar(wxHORIZONTAL
, 0, 0, 0);
252 //----------------------------------------------------------------------
253 // Generated methods implementation section {{{
256 // Add text to the document at current position.
257 void wxStyledTextCtrl::AddText(const wxString
& text
) {
258 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
259 SendMsg(2001, strlen(buf
), (long)(const char*)buf
);
262 // Add array of cells to document.
263 void wxStyledTextCtrl::AddStyledText(const wxMemoryBuffer
& data
) {
264 SendMsg(2002, data
.GetDataLen(), (long)data
.GetData());
267 // Insert string at a position.
268 void wxStyledTextCtrl::InsertText(int pos
, const wxString
& text
)
270 SendMsg(2003, pos
, (long)(const char*)wx2stc(text
));
273 // Delete all text in the document.
274 void wxStyledTextCtrl::ClearAll()
279 // Set all style bytes to 0, remove all folding information.
280 void wxStyledTextCtrl::ClearDocumentStyle()
285 // Returns the number of characters in the document.
286 int wxStyledTextCtrl::GetLength() const
288 return SendMsg(2006, 0, 0);
291 // Returns the character byte at the position.
292 int wxStyledTextCtrl::GetCharAt(int pos
) const {
293 return (unsigned char)SendMsg(2007, pos
, 0);
296 // Returns the position of the caret.
297 int wxStyledTextCtrl::GetCurrentPos() const
299 return SendMsg(2008, 0, 0);
302 // Returns the position of the opposite end of the selection to the caret.
303 int wxStyledTextCtrl::GetAnchor() const
305 return SendMsg(2009, 0, 0);
308 // Returns the style byte at the position.
309 int wxStyledTextCtrl::GetStyleAt(int pos
) const {
310 return (unsigned char)SendMsg(2010, pos
, 0);
313 // Redoes the next action on the undo history.
314 void wxStyledTextCtrl::Redo()
319 // Choose between collecting actions into the undo
320 // history and discarding them.
321 void wxStyledTextCtrl::SetUndoCollection(bool collectUndo
)
323 SendMsg(2012, collectUndo
, 0);
326 // Select all the text in the document.
327 void wxStyledTextCtrl::SelectAll()
332 // Remember the current position in the undo history as the position
333 // at which the document was saved.
334 void wxStyledTextCtrl::SetSavePoint()
339 // Retrieve a buffer of cells.
340 wxMemoryBuffer
wxStyledTextCtrl::GetStyledText(int startPos
, int endPos
) {
342 if (endPos
< startPos
) {
347 int len
= endPos
- startPos
;
348 if (!len
) return buf
;
350 tr
.lpstrText
= (char*)buf
.GetWriteBuf(len
*2+1);
351 tr
.chrg
.cpMin
= startPos
;
352 tr
.chrg
.cpMax
= endPos
;
353 len
= SendMsg(2015, 0, (long)&tr
);
354 buf
.UngetWriteBuf(len
);
358 // Are there any redoable actions in the undo history?
359 bool wxStyledTextCtrl::CanRedo()
361 return SendMsg(2016, 0, 0) != 0;
364 // Retrieve the line number at which a particular marker is located.
365 int wxStyledTextCtrl::MarkerLineFromHandle(int handle
)
367 return SendMsg(2017, handle
, 0);
371 void wxStyledTextCtrl::MarkerDeleteHandle(int handle
)
373 SendMsg(2018, handle
, 0);
376 // Is undo history being collected?
377 bool wxStyledTextCtrl::GetUndoCollection() const
379 return SendMsg(2019, 0, 0) != 0;
382 // Are white space characters currently visible?
383 // Returns one of SCWS_* constants.
384 int wxStyledTextCtrl::GetViewWhiteSpace() const
386 return SendMsg(2020, 0, 0);
389 // Make white space characters invisible, always visible or visible outside indentation.
390 void wxStyledTextCtrl::SetViewWhiteSpace(int viewWS
)
392 SendMsg(2021, viewWS
, 0);
395 // Find the position from a point within the window.
396 int wxStyledTextCtrl::PositionFromPoint(wxPoint pt
) {
397 return SendMsg(2022, pt
.x
, pt
.y
);
400 // Find the position from a point within the window but return
401 // INVALID_POSITION if not close to text.
402 int wxStyledTextCtrl::PositionFromPointClose(int x
, int y
)
404 return SendMsg(2023, x
, y
);
407 // Set caret to start of a line and ensure it is visible.
408 void wxStyledTextCtrl::GotoLine(int line
)
410 SendMsg(2024, line
, 0);
413 // Set caret to a position and ensure it is visible.
414 void wxStyledTextCtrl::GotoPos(int pos
)
416 SendMsg(2025, pos
, 0);
419 // Set the selection anchor to a position. The anchor is the opposite
420 // end of the selection from the caret.
421 void wxStyledTextCtrl::SetAnchor(int posAnchor
)
423 SendMsg(2026, posAnchor
, 0);
426 // Retrieve the text of the line containing the caret.
427 // Returns the index of the caret on the line.
428 wxString
wxStyledTextCtrl::GetCurLine(int* linePos
) {
429 int len
= LineLength(GetCurrentLine());
431 if (linePos
) *linePos
= 0;
432 return wxEmptyString
;
435 wxMemoryBuffer
mbuf(len
+1);
436 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
438 int pos
= SendMsg(2027, len
+1, (long)buf
);
439 mbuf
.UngetWriteBuf(len
);
441 if (linePos
) *linePos
= pos
;
445 // Retrieve the position of the last correctly styled character.
446 int wxStyledTextCtrl::GetEndStyled() const
448 return SendMsg(2028, 0, 0);
451 // Convert all line endings in the document to one mode.
452 void wxStyledTextCtrl::ConvertEOLs(int eolMode
)
454 SendMsg(2029, eolMode
, 0);
457 // Retrieve the current end of line mode - one of CRLF, CR, or LF.
458 int wxStyledTextCtrl::GetEOLMode() const
460 return SendMsg(2030, 0, 0);
463 // Set the current end of line mode.
464 void wxStyledTextCtrl::SetEOLMode(int eolMode
)
466 SendMsg(2031, eolMode
, 0);
469 // Set the current styling position to pos and the styling mask to mask.
470 // The styling mask can be used to protect some bits in each styling byte from modification.
471 void wxStyledTextCtrl::StartStyling(int pos
, int mask
)
473 SendMsg(2032, pos
, mask
);
476 // Change style from current styling position for length characters to a style
477 // and move the current styling position to after this newly styled segment.
478 void wxStyledTextCtrl::SetStyling(int length
, int style
)
480 SendMsg(2033, length
, style
);
483 // Is drawing done first into a buffer or direct to the screen?
484 bool wxStyledTextCtrl::GetBufferedDraw() const
486 return SendMsg(2034, 0, 0) != 0;
489 // If drawing is buffered then each line of text is drawn into a bitmap buffer
490 // before drawing it to the screen to avoid flicker.
491 void wxStyledTextCtrl::SetBufferedDraw(bool buffered
)
493 SendMsg(2035, buffered
, 0);
496 // Change the visible size of a tab to be a multiple of the width of a space character.
497 void wxStyledTextCtrl::SetTabWidth(int tabWidth
)
499 SendMsg(2036, tabWidth
, 0);
502 // Retrieve the visible size of a tab.
503 int wxStyledTextCtrl::GetTabWidth() const
505 return SendMsg(2121, 0, 0);
508 // Set the code page used to interpret the bytes of the document as characters.
509 void wxStyledTextCtrl::SetCodePage(int codePage
) {
511 wxASSERT_MSG(codePage
== wxSTC_CP_UTF8
,
512 wxT("Only wxSTC_CP_UTF8 may be used when wxUSE_UNICODE is on."));
514 wxASSERT_MSG(codePage
!= wxSTC_CP_UTF8
,
515 wxT("wxSTC_CP_UTF8 may not be used when wxUSE_UNICODE is off."));
517 SendMsg(2037, codePage
);
520 // Set the symbol used for a particular marker number,
521 // and optionally the fore and background colours.
522 void wxStyledTextCtrl::MarkerDefine(int markerNumber
, int markerSymbol
,
523 const wxColour
& foreground
,
524 const wxColour
& background
) {
526 SendMsg(2040, markerNumber
, markerSymbol
);
528 MarkerSetForeground(markerNumber
, foreground
);
530 MarkerSetBackground(markerNumber
, background
);
533 // Set the foreground colour used for a particular marker number.
534 void wxStyledTextCtrl::MarkerSetForeground(int markerNumber
, const wxColour
& fore
)
536 SendMsg(2041, markerNumber
, wxColourAsLong(fore
));
539 // Set the background colour used for a particular marker number.
540 void wxStyledTextCtrl::MarkerSetBackground(int markerNumber
, const wxColour
& back
)
542 SendMsg(2042, markerNumber
, wxColourAsLong(back
));
545 // Add a marker to a line, returning an ID which can be used to find or delete the marker.
546 int wxStyledTextCtrl::MarkerAdd(int line
, int markerNumber
)
548 return SendMsg(2043, line
, markerNumber
);
551 // Delete a marker from a line.
552 void wxStyledTextCtrl::MarkerDelete(int line
, int markerNumber
)
554 SendMsg(2044, line
, markerNumber
);
557 // Delete all markers with a particular number from all lines.
558 void wxStyledTextCtrl::MarkerDeleteAll(int markerNumber
)
560 SendMsg(2045, markerNumber
, 0);
563 // Get a bit mask of all the markers set on a line.
564 int wxStyledTextCtrl::MarkerGet(int line
)
566 return SendMsg(2046, line
, 0);
569 // Find the next line after lineStart that includes a marker in mask.
570 int wxStyledTextCtrl::MarkerNext(int lineStart
, int markerMask
)
572 return SendMsg(2047, lineStart
, markerMask
);
575 // Find the previous line before lineStart that includes a marker in mask.
576 int wxStyledTextCtrl::MarkerPrevious(int lineStart
, int markerMask
)
578 return SendMsg(2048, lineStart
, markerMask
);
581 // Define a marker from a bitmap
582 void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber
, const wxBitmap
& bmp
) {
583 // convert bmp to a xpm in a string
584 wxMemoryOutputStream strm
;
585 wxImage img
= bmp
.ConvertToImage();
587 img
.ConvertAlphaToMask();
588 img
.SaveFile(strm
, wxBITMAP_TYPE_XPM
);
589 size_t len
= strm
.GetSize();
590 char* buff
= new char[len
+1];
591 strm
.CopyTo(buff
, len
);
593 SendMsg(2049, markerNumber
, (long)buff
);
598 // Add a set of markers to a line.
599 void wxStyledTextCtrl::MarkerAddSet(int line
, int set
)
601 SendMsg(2466, line
, set
);
604 // Set the alpha used for a marker that is drawn in the text area, not the margin.
605 void wxStyledTextCtrl::MarkerSetAlpha(int markerNumber
, int alpha
)
607 SendMsg(2476, markerNumber
, alpha
);
610 // Set a margin to be either numeric or symbolic.
611 void wxStyledTextCtrl::SetMarginType(int margin
, int marginType
)
613 SendMsg(2240, margin
, marginType
);
616 // Retrieve the type of a margin.
617 int wxStyledTextCtrl::GetMarginType(int margin
) const
619 return SendMsg(2241, margin
, 0);
622 // Set the width of a margin to a width expressed in pixels.
623 void wxStyledTextCtrl::SetMarginWidth(int margin
, int pixelWidth
)
625 SendMsg(2242, margin
, pixelWidth
);
628 // Retrieve the width of a margin in pixels.
629 int wxStyledTextCtrl::GetMarginWidth(int margin
) const
631 return SendMsg(2243, margin
, 0);
634 // Set a mask that determines which markers are displayed in a margin.
635 void wxStyledTextCtrl::SetMarginMask(int margin
, int mask
)
637 SendMsg(2244, margin
, mask
);
640 // Retrieve the marker mask of a margin.
641 int wxStyledTextCtrl::GetMarginMask(int margin
) const
643 return SendMsg(2245, margin
, 0);
646 // Make a margin sensitive or insensitive to mouse clicks.
647 void wxStyledTextCtrl::SetMarginSensitive(int margin
, bool sensitive
)
649 SendMsg(2246, margin
, sensitive
);
652 // Retrieve the mouse click sensitivity of a margin.
653 bool wxStyledTextCtrl::GetMarginSensitive(int margin
) const
655 return SendMsg(2247, margin
, 0) != 0;
658 // Clear all the styles and make equivalent to the global default style.
659 void wxStyledTextCtrl::StyleClearAll()
664 // Set the foreground colour of a style.
665 void wxStyledTextCtrl::StyleSetForeground(int style
, const wxColour
& fore
)
667 SendMsg(2051, style
, wxColourAsLong(fore
));
670 // Set the background colour of a style.
671 void wxStyledTextCtrl::StyleSetBackground(int style
, const wxColour
& back
)
673 SendMsg(2052, style
, wxColourAsLong(back
));
676 // Set a style to be bold or not.
677 void wxStyledTextCtrl::StyleSetBold(int style
, bool bold
)
679 SendMsg(2053, style
, bold
);
682 // Set a style to be italic or not.
683 void wxStyledTextCtrl::StyleSetItalic(int style
, bool italic
)
685 SendMsg(2054, style
, italic
);
688 // Set the size of characters of a style.
689 void wxStyledTextCtrl::StyleSetSize(int style
, int sizePoints
)
691 SendMsg(2055, style
, sizePoints
);
694 // Set the font of a style.
695 void wxStyledTextCtrl::StyleSetFaceName(int style
, const wxString
& fontName
)
697 SendMsg(2056, style
, (long)(const char*)wx2stc(fontName
));
700 // Set a style to have its end of line filled or not.
701 void wxStyledTextCtrl::StyleSetEOLFilled(int style
, bool filled
)
703 SendMsg(2057, style
, filled
);
706 // Reset the default style to its state at startup
707 void wxStyledTextCtrl::StyleResetDefault()
712 // Set a style to be underlined or not.
713 void wxStyledTextCtrl::StyleSetUnderline(int style
, bool underline
)
715 SendMsg(2059, style
, underline
);
718 // Get the foreground colour of a style.
719 wxColour
wxStyledTextCtrl::StyleGetForeground(int style
) const
721 long c
= SendMsg(2481, style
, 0);
722 return wxColourFromLong(c
);
725 // Get the background colour of a style.
726 wxColour
wxStyledTextCtrl::StyleGetBackground(int style
) const
728 long c
= SendMsg(2482, style
, 0);
729 return wxColourFromLong(c
);
732 // Get is a style bold or not.
733 bool wxStyledTextCtrl::StyleGetBold(int style
) const
735 return SendMsg(2483, style
, 0) != 0;
738 // Get is a style italic or not.
739 bool wxStyledTextCtrl::StyleGetItalic(int style
) const
741 return SendMsg(2484, style
, 0) != 0;
744 // Get the size of characters of a style.
745 int wxStyledTextCtrl::StyleGetSize(int style
) const
747 return SendMsg(2485, style
, 0);
750 // Get the font facename of a style
751 wxString
wxStyledTextCtrl::StyleGetFaceName(int style
) {
753 long len
= SendMsg(msg
, style
, 0);
754 wxMemoryBuffer
mbuf(len
+1);
755 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
756 SendMsg(msg
, style
, (long)buf
);
757 mbuf
.UngetWriteBuf(len
);
762 // Get is a style to have its end of line filled or not.
763 bool wxStyledTextCtrl::StyleGetEOLFilled(int style
) const
765 return SendMsg(2487, style
, 0) != 0;
768 // Get is a style underlined or not.
769 bool wxStyledTextCtrl::StyleGetUnderline(int style
) const
771 return SendMsg(2488, style
, 0) != 0;
774 // Get is a style mixed case, or to force upper or lower case.
775 int wxStyledTextCtrl::StyleGetCase(int style
) const
777 return SendMsg(2489, style
, 0);
780 // Get the character set of the font in a style.
781 int wxStyledTextCtrl::StyleGetCharacterSet(int style
) const
783 return SendMsg(2490, style
, 0);
786 // Get is a style visible or not.
787 bool wxStyledTextCtrl::StyleGetVisible(int style
) const
789 return SendMsg(2491, style
, 0) != 0;
792 // Get is a style changeable or not (read only).
793 // Experimental feature, currently buggy.
794 bool wxStyledTextCtrl::StyleGetChangeable(int style
) const
796 return SendMsg(2492, style
, 0) != 0;
799 // Get is a style a hotspot or not.
800 bool wxStyledTextCtrl::StyleGetHotSpot(int style
) const
802 return SendMsg(2493, style
, 0) != 0;
805 // Set a style to be mixed case, or to force upper or lower case.
806 void wxStyledTextCtrl::StyleSetCase(int style
, int caseForce
)
808 SendMsg(2060, style
, caseForce
);
811 // Set a style to be a hotspot or not.
812 void wxStyledTextCtrl::StyleSetHotSpot(int style
, bool hotspot
)
814 SendMsg(2409, style
, hotspot
);
817 // Set the foreground colour of the selection and whether to use this setting.
818 void wxStyledTextCtrl::SetSelForeground(bool useSetting
, const wxColour
& fore
)
820 SendMsg(2067, useSetting
, wxColourAsLong(fore
));
823 // Set the background colour of the selection and whether to use this setting.
824 void wxStyledTextCtrl::SetSelBackground(bool useSetting
, const wxColour
& back
)
826 SendMsg(2068, useSetting
, wxColourAsLong(back
));
829 // Get the alpha of the selection.
830 int wxStyledTextCtrl::GetSelAlpha() const
832 return SendMsg(2477, 0, 0);
835 // Set the alpha of the selection.
836 void wxStyledTextCtrl::SetSelAlpha(int alpha
)
838 SendMsg(2478, alpha
, 0);
841 // Is the selection end of line filled?
842 bool wxStyledTextCtrl::GetSelEOLFilled() const
844 return SendMsg(2479, 0, 0) != 0;
847 // Set the selection to have its end of line filled or not.
848 void wxStyledTextCtrl::SetSelEOLFilled(bool filled
)
850 SendMsg(2480, filled
, 0);
853 // Set the foreground colour of the caret.
854 void wxStyledTextCtrl::SetCaretForeground(const wxColour
& fore
)
856 SendMsg(2069, wxColourAsLong(fore
), 0);
859 // When key+modifier combination km is pressed perform msg.
860 void wxStyledTextCtrl::CmdKeyAssign(int key
, int modifiers
, int cmd
) {
861 SendMsg(2070, MAKELONG(key
, modifiers
), cmd
);
864 // When key+modifier combination km is pressed do nothing.
865 void wxStyledTextCtrl::CmdKeyClear(int key
, int modifiers
) {
866 SendMsg(2071, MAKELONG(key
, modifiers
));
869 // Drop all key mappings.
870 void wxStyledTextCtrl::CmdKeyClearAll()
875 // Set the styles for a segment of the document.
876 void wxStyledTextCtrl::SetStyleBytes(int length
, char* styleBytes
) {
877 SendMsg(2073, length
, (long)styleBytes
);
880 // Set a style to be visible or not.
881 void wxStyledTextCtrl::StyleSetVisible(int style
, bool visible
)
883 SendMsg(2074, style
, visible
);
886 // Get the time in milliseconds that the caret is on and off.
887 int wxStyledTextCtrl::GetCaretPeriod() const
889 return SendMsg(2075, 0, 0);
892 // Get the time in milliseconds that the caret is on and off. 0 = steady on.
893 void wxStyledTextCtrl::SetCaretPeriod(int periodMilliseconds
)
895 SendMsg(2076, periodMilliseconds
, 0);
898 // Set the set of characters making up words for when moving or selecting by word.
899 // First sets deaults like SetCharsDefault.
900 void wxStyledTextCtrl::SetWordChars(const wxString
& characters
)
902 SendMsg(2077, 0, (long)(const char*)wx2stc(characters
));
905 // Start a sequence of actions that is undone and redone as a unit.
907 void wxStyledTextCtrl::BeginUndoAction()
912 // End a sequence of actions that is undone and redone as a unit.
913 void wxStyledTextCtrl::EndUndoAction()
918 // Set an indicator to plain, squiggle or TT.
919 void wxStyledTextCtrl::IndicatorSetStyle(int indic
, int style
)
921 SendMsg(2080, indic
, style
);
924 // Retrieve the style of an indicator.
925 int wxStyledTextCtrl::IndicatorGetStyle(int indic
) const
927 return SendMsg(2081, indic
, 0);
930 // Set the foreground colour of an indicator.
931 void wxStyledTextCtrl::IndicatorSetForeground(int indic
, const wxColour
& fore
)
933 SendMsg(2082, indic
, wxColourAsLong(fore
));
936 // Retrieve the foreground colour of an indicator.
937 wxColour
wxStyledTextCtrl::IndicatorGetForeground(int indic
) const
939 long c
= SendMsg(2083, indic
, 0);
940 return wxColourFromLong(c
);
943 // Set an indicator to draw under text or over(default).
944 void wxStyledTextCtrl::IndicatorSetUnder(int indic
, bool under
)
946 SendMsg(2510, indic
, under
);
949 // Retrieve whether indicator drawn under or over text.
950 bool wxStyledTextCtrl::IndicatorGetUnder(int indic
) const
952 return SendMsg(2511, indic
, 0) != 0;
955 // Set the foreground colour of all whitespace and whether to use this setting.
956 void wxStyledTextCtrl::SetWhitespaceForeground(bool useSetting
, const wxColour
& fore
)
958 SendMsg(2084, useSetting
, wxColourAsLong(fore
));
961 // Set the background colour of all whitespace and whether to use this setting.
962 void wxStyledTextCtrl::SetWhitespaceBackground(bool useSetting
, const wxColour
& back
)
964 SendMsg(2085, useSetting
, wxColourAsLong(back
));
967 // Divide each styling byte into lexical class bits (default: 5) and indicator
968 // bits (default: 3). If a lexer requires more than 32 lexical states, then this
969 // is used to expand the possible states.
970 void wxStyledTextCtrl::SetStyleBits(int bits
)
972 SendMsg(2090, bits
, 0);
975 // Retrieve number of bits in style bytes used to hold the lexical state.
976 int wxStyledTextCtrl::GetStyleBits() const
978 return SendMsg(2091, 0, 0);
981 // Used to hold extra styling information for each line.
982 void wxStyledTextCtrl::SetLineState(int line
, int state
)
984 SendMsg(2092, line
, state
);
987 // Retrieve the extra styling information for a line.
988 int wxStyledTextCtrl::GetLineState(int line
) const
990 return SendMsg(2093, line
, 0);
993 // Retrieve the last line number that has line state.
994 int wxStyledTextCtrl::GetMaxLineState() const
996 return SendMsg(2094, 0, 0);
999 // Is the background of the line containing the caret in a different colour?
1000 bool wxStyledTextCtrl::GetCaretLineVisible() const
1002 return SendMsg(2095, 0, 0) != 0;
1005 // Display the background of the line containing the caret in a different colour.
1006 void wxStyledTextCtrl::SetCaretLineVisible(bool show
)
1008 SendMsg(2096, show
, 0);
1011 // Get the colour of the background of the line containing the caret.
1012 wxColour
wxStyledTextCtrl::GetCaretLineBackground() const
1014 long c
= SendMsg(2097, 0, 0);
1015 return wxColourFromLong(c
);
1018 // Set the colour of the background of the line containing the caret.
1019 void wxStyledTextCtrl::SetCaretLineBackground(const wxColour
& back
)
1021 SendMsg(2098, wxColourAsLong(back
), 0);
1024 // Set a style to be changeable or not (read only).
1025 // Experimental feature, currently buggy.
1026 void wxStyledTextCtrl::StyleSetChangeable(int style
, bool changeable
)
1028 SendMsg(2099, style
, changeable
);
1031 // Display a auto-completion list.
1032 // The lenEntered parameter indicates how many characters before
1033 // the caret should be used to provide context.
1034 void wxStyledTextCtrl::AutoCompShow(int lenEntered
, const wxString
& itemList
)
1036 SendMsg(2100, lenEntered
, (long)(const char*)wx2stc(itemList
));
1039 // Remove the auto-completion list from the screen.
1040 void wxStyledTextCtrl::AutoCompCancel()
1042 SendMsg(2101, 0, 0);
1045 // Is there an auto-completion list visible?
1046 bool wxStyledTextCtrl::AutoCompActive()
1048 return SendMsg(2102, 0, 0) != 0;
1051 // Retrieve the position of the caret when the auto-completion list was displayed.
1052 int wxStyledTextCtrl::AutoCompPosStart()
1054 return SendMsg(2103, 0, 0);
1057 // User has selected an item so remove the list and insert the selection.
1058 void wxStyledTextCtrl::AutoCompComplete()
1060 SendMsg(2104, 0, 0);
1063 // Define a set of character that when typed cancel the auto-completion list.
1064 void wxStyledTextCtrl::AutoCompStops(const wxString
& characterSet
)
1066 SendMsg(2105, 0, (long)(const char*)wx2stc(characterSet
));
1069 // Change the separator character in the string setting up an auto-completion list.
1070 // Default is space but can be changed if items contain space.
1071 void wxStyledTextCtrl::AutoCompSetSeparator(int separatorCharacter
)
1073 SendMsg(2106, separatorCharacter
, 0);
1076 // Retrieve the auto-completion list separator character.
1077 int wxStyledTextCtrl::AutoCompGetSeparator() const
1079 return SendMsg(2107, 0, 0);
1082 // Select the item in the auto-completion list that starts with a string.
1083 void wxStyledTextCtrl::AutoCompSelect(const wxString
& text
)
1085 SendMsg(2108, 0, (long)(const char*)wx2stc(text
));
1088 // Should the auto-completion list be cancelled if the user backspaces to a
1089 // position before where the box was created.
1090 void wxStyledTextCtrl::AutoCompSetCancelAtStart(bool cancel
)
1092 SendMsg(2110, cancel
, 0);
1095 // Retrieve whether auto-completion cancelled by backspacing before start.
1096 bool wxStyledTextCtrl::AutoCompGetCancelAtStart() const
1098 return SendMsg(2111, 0, 0) != 0;
1101 // Define a set of characters that when typed will cause the autocompletion to
1102 // choose the selected item.
1103 void wxStyledTextCtrl::AutoCompSetFillUps(const wxString
& characterSet
)
1105 SendMsg(2112, 0, (long)(const char*)wx2stc(characterSet
));
1108 // Should a single item auto-completion list automatically choose the item.
1109 void wxStyledTextCtrl::AutoCompSetChooseSingle(bool chooseSingle
)
1111 SendMsg(2113, chooseSingle
, 0);
1114 // Retrieve whether a single item auto-completion list automatically choose the item.
1115 bool wxStyledTextCtrl::AutoCompGetChooseSingle() const
1117 return SendMsg(2114, 0, 0) != 0;
1120 // Set whether case is significant when performing auto-completion searches.
1121 void wxStyledTextCtrl::AutoCompSetIgnoreCase(bool ignoreCase
)
1123 SendMsg(2115, ignoreCase
, 0);
1126 // Retrieve state of ignore case flag.
1127 bool wxStyledTextCtrl::AutoCompGetIgnoreCase() const
1129 return SendMsg(2116, 0, 0) != 0;
1132 // Display a list of strings and send notification when user chooses one.
1133 void wxStyledTextCtrl::UserListShow(int listType
, const wxString
& itemList
)
1135 SendMsg(2117, listType
, (long)(const char*)wx2stc(itemList
));
1138 // Set whether or not autocompletion is hidden automatically when nothing matches.
1139 void wxStyledTextCtrl::AutoCompSetAutoHide(bool autoHide
)
1141 SendMsg(2118, autoHide
, 0);
1144 // Retrieve whether or not autocompletion is hidden automatically when nothing matches.
1145 bool wxStyledTextCtrl::AutoCompGetAutoHide() const
1147 return SendMsg(2119, 0, 0) != 0;
1150 // Set whether or not autocompletion deletes any word characters
1151 // after the inserted text upon completion.
1152 void wxStyledTextCtrl::AutoCompSetDropRestOfWord(bool dropRestOfWord
)
1154 SendMsg(2270, dropRestOfWord
, 0);
1157 // Retrieve whether or not autocompletion deletes any word characters
1158 // after the inserted text upon completion.
1159 bool wxStyledTextCtrl::AutoCompGetDropRestOfWord() const
1161 return SendMsg(2271, 0, 0) != 0;
1164 // Register an image for use in autocompletion lists.
1165 void wxStyledTextCtrl::RegisterImage(int type
, const wxBitmap
& bmp
) {
1166 // convert bmp to a xpm in a string
1167 wxMemoryOutputStream strm
;
1168 wxImage img
= bmp
.ConvertToImage();
1170 img
.ConvertAlphaToMask();
1171 img
.SaveFile(strm
, wxBITMAP_TYPE_XPM
);
1172 size_t len
= strm
.GetSize();
1173 char* buff
= new char[len
+1];
1174 strm
.CopyTo(buff
, len
);
1176 SendMsg(2405, type
, (long)buff
);
1181 // Clear all the registered images.
1182 void wxStyledTextCtrl::ClearRegisteredImages()
1184 SendMsg(2408, 0, 0);
1187 // Retrieve the auto-completion list type-separator character.
1188 int wxStyledTextCtrl::AutoCompGetTypeSeparator() const
1190 return SendMsg(2285, 0, 0);
1193 // Change the type-separator character in the string setting up an auto-completion list.
1194 // Default is '?' but can be changed if items contain '?'.
1195 void wxStyledTextCtrl::AutoCompSetTypeSeparator(int separatorCharacter
)
1197 SendMsg(2286, separatorCharacter
, 0);
1200 // Set the maximum width, in characters, of auto-completion and user lists.
1201 // Set to 0 to autosize to fit longest item, which is the default.
1202 void wxStyledTextCtrl::AutoCompSetMaxWidth(int characterCount
)
1204 SendMsg(2208, characterCount
, 0);
1207 // Get the maximum width, in characters, of auto-completion and user lists.
1208 int wxStyledTextCtrl::AutoCompGetMaxWidth() const
1210 return SendMsg(2209, 0, 0);
1213 // Set the maximum height, in rows, of auto-completion and user lists.
1214 // The default is 5 rows.
1215 void wxStyledTextCtrl::AutoCompSetMaxHeight(int rowCount
)
1217 SendMsg(2210, rowCount
, 0);
1220 // Set the maximum height, in rows, of auto-completion and user lists.
1221 int wxStyledTextCtrl::AutoCompGetMaxHeight() const
1223 return SendMsg(2211, 0, 0);
1226 // Set the number of spaces used for one level of indentation.
1227 void wxStyledTextCtrl::SetIndent(int indentSize
)
1229 SendMsg(2122, indentSize
, 0);
1232 // Retrieve indentation size.
1233 int wxStyledTextCtrl::GetIndent() const
1235 return SendMsg(2123, 0, 0);
1238 // Indentation will only use space characters if useTabs is false, otherwise
1239 // it will use a combination of tabs and spaces.
1240 void wxStyledTextCtrl::SetUseTabs(bool useTabs
)
1242 SendMsg(2124, useTabs
, 0);
1245 // Retrieve whether tabs will be used in indentation.
1246 bool wxStyledTextCtrl::GetUseTabs() const
1248 return SendMsg(2125, 0, 0) != 0;
1251 // Change the indentation of a line to a number of columns.
1252 void wxStyledTextCtrl::SetLineIndentation(int line
, int indentSize
)
1254 SendMsg(2126, line
, indentSize
);
1257 // Retrieve the number of columns that a line is indented.
1258 int wxStyledTextCtrl::GetLineIndentation(int line
) const
1260 return SendMsg(2127, line
, 0);
1263 // Retrieve the position before the first non indentation character on a line.
1264 int wxStyledTextCtrl::GetLineIndentPosition(int line
) const
1266 return SendMsg(2128, line
, 0);
1269 // Retrieve the column number of a position, taking tab width into account.
1270 int wxStyledTextCtrl::GetColumn(int pos
) const
1272 return SendMsg(2129, pos
, 0);
1275 // Show or hide the horizontal scroll bar.
1276 void wxStyledTextCtrl::SetUseHorizontalScrollBar(bool show
)
1278 SendMsg(2130, show
, 0);
1281 // Is the horizontal scroll bar visible?
1282 bool wxStyledTextCtrl::GetUseHorizontalScrollBar() const
1284 return SendMsg(2131, 0, 0) != 0;
1287 // Show or hide indentation guides.
1288 void wxStyledTextCtrl::SetIndentationGuides(int indentView
)
1290 SendMsg(2132, indentView
, 0);
1293 // Are the indentation guides visible?
1294 int wxStyledTextCtrl::GetIndentationGuides() const
1296 return SendMsg(2133, 0, 0);
1299 // Set the highlighted indentation guide column.
1300 // 0 = no highlighted guide.
1301 void wxStyledTextCtrl::SetHighlightGuide(int column
)
1303 SendMsg(2134, column
, 0);
1306 // Get the highlighted indentation guide column.
1307 int wxStyledTextCtrl::GetHighlightGuide() const
1309 return SendMsg(2135, 0, 0);
1312 // Get the position after the last visible characters on a line.
1313 int wxStyledTextCtrl::GetLineEndPosition(int line
) const
1315 return SendMsg(2136, line
, 0);
1318 // Get the code page used to interpret the bytes of the document as characters.
1319 int wxStyledTextCtrl::GetCodePage() const
1321 return SendMsg(2137, 0, 0);
1324 // Get the foreground colour of the caret.
1325 wxColour
wxStyledTextCtrl::GetCaretForeground() const
1327 long c
= SendMsg(2138, 0, 0);
1328 return wxColourFromLong(c
);
1331 // In read-only mode?
1332 bool wxStyledTextCtrl::GetReadOnly() const
1334 return SendMsg(2140, 0, 0) != 0;
1337 // Sets the position of the caret.
1338 void wxStyledTextCtrl::SetCurrentPos(int pos
)
1340 SendMsg(2141, pos
, 0);
1343 // Sets the position that starts the selection - this becomes the anchor.
1344 void wxStyledTextCtrl::SetSelectionStart(int pos
)
1346 SendMsg(2142, pos
, 0);
1349 // Returns the position at the start of the selection.
1350 int wxStyledTextCtrl::GetSelectionStart() const
1352 return SendMsg(2143, 0, 0);
1355 // Sets the position that ends the selection - this becomes the currentPosition.
1356 void wxStyledTextCtrl::SetSelectionEnd(int pos
)
1358 SendMsg(2144, pos
, 0);
1361 // Returns the position at the end of the selection.
1362 int wxStyledTextCtrl::GetSelectionEnd() const
1364 return SendMsg(2145, 0, 0);
1367 // Sets the print magnification added to the point size of each style for printing.
1368 void wxStyledTextCtrl::SetPrintMagnification(int magnification
)
1370 SendMsg(2146, magnification
, 0);
1373 // Returns the print magnification.
1374 int wxStyledTextCtrl::GetPrintMagnification() const
1376 return SendMsg(2147, 0, 0);
1379 // Modify colours when printing for clearer printed text.
1380 void wxStyledTextCtrl::SetPrintColourMode(int mode
)
1382 SendMsg(2148, mode
, 0);
1385 // Returns the print colour mode.
1386 int wxStyledTextCtrl::GetPrintColourMode() const
1388 return SendMsg(2149, 0, 0);
1391 // Find some text in the document.
1392 int wxStyledTextCtrl::FindText(int minPos
, int maxPos
,
1393 const wxString
& text
,
1396 ft
.chrg
.cpMin
= minPos
;
1397 ft
.chrg
.cpMax
= maxPos
;
1398 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
1399 ft
.lpstrText
= (char*)(const char*)buf
;
1401 return SendMsg(2150, flags
, (long)&ft
);
1404 // On Windows, will draw the document into a display context such as a printer.
1405 int wxStyledTextCtrl::FormatRange(bool doDraw
,
1414 if (endPos
< startPos
) {
1415 int temp
= startPos
;
1420 fr
.hdcTarget
= target
;
1421 fr
.rc
.top
= renderRect
.GetTop();
1422 fr
.rc
.left
= renderRect
.GetLeft();
1423 fr
.rc
.right
= renderRect
.GetRight();
1424 fr
.rc
.bottom
= renderRect
.GetBottom();
1425 fr
.rcPage
.top
= pageRect
.GetTop();
1426 fr
.rcPage
.left
= pageRect
.GetLeft();
1427 fr
.rcPage
.right
= pageRect
.GetRight();
1428 fr
.rcPage
.bottom
= pageRect
.GetBottom();
1429 fr
.chrg
.cpMin
= startPos
;
1430 fr
.chrg
.cpMax
= endPos
;
1432 return SendMsg(2151, doDraw
, (long)&fr
);
1435 // Retrieve the display line at the top of the display.
1436 int wxStyledTextCtrl::GetFirstVisibleLine() const
1438 return SendMsg(2152, 0, 0);
1441 // Retrieve the contents of a line.
1442 wxString
wxStyledTextCtrl::GetLine(int line
) {
1443 int len
= LineLength(line
);
1444 if (!len
) return wxEmptyString
;
1446 wxMemoryBuffer
mbuf(len
+1);
1447 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1448 SendMsg(2153, line
, (long)buf
);
1449 mbuf
.UngetWriteBuf(len
);
1454 // Returns the number of lines in the document. There is always at least one.
1455 int wxStyledTextCtrl::GetLineCount() const
1457 return SendMsg(2154, 0, 0);
1460 // Sets the size in pixels of the left margin.
1461 void wxStyledTextCtrl::SetMarginLeft(int pixelWidth
)
1463 SendMsg(2155, 0, pixelWidth
);
1466 // Returns the size in pixels of the left margin.
1467 int wxStyledTextCtrl::GetMarginLeft() const
1469 return SendMsg(2156, 0, 0);
1472 // Sets the size in pixels of the right margin.
1473 void wxStyledTextCtrl::SetMarginRight(int pixelWidth
)
1475 SendMsg(2157, 0, pixelWidth
);
1478 // Returns the size in pixels of the right margin.
1479 int wxStyledTextCtrl::GetMarginRight() const
1481 return SendMsg(2158, 0, 0);
1484 // Is the document different from when it was last saved?
1485 bool wxStyledTextCtrl::GetModify() const
1487 return SendMsg(2159, 0, 0) != 0;
1490 // Select a range of text.
1491 void wxStyledTextCtrl::SetSelection(int start
, int end
)
1493 SendMsg(2160, start
, end
);
1496 // Retrieve the selected text.
1497 wxString
wxStyledTextCtrl::GetSelectedText() {
1501 GetSelection(&start
, &end
);
1502 int len
= end
- start
;
1503 if (!len
) return wxEmptyString
;
1505 wxMemoryBuffer
mbuf(len
+2);
1506 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1507 SendMsg(2161, 0, (long)buf
);
1508 mbuf
.UngetWriteBuf(len
);
1513 // Retrieve a range of text.
1514 wxString
wxStyledTextCtrl::GetTextRange(int startPos
, int endPos
) {
1515 if (endPos
< startPos
) {
1516 int temp
= startPos
;
1520 int len
= endPos
- startPos
;
1521 if (!len
) return wxEmptyString
;
1522 wxMemoryBuffer
mbuf(len
+1);
1523 char* buf
= (char*)mbuf
.GetWriteBuf(len
);
1526 tr
.chrg
.cpMin
= startPos
;
1527 tr
.chrg
.cpMax
= endPos
;
1528 SendMsg(2162, 0, (long)&tr
);
1529 mbuf
.UngetWriteBuf(len
);
1534 // Draw the selection in normal style or with selection highlighted.
1535 void wxStyledTextCtrl::HideSelection(bool normal
)
1537 SendMsg(2163, normal
, 0);
1540 // Retrieve the line containing a position.
1541 int wxStyledTextCtrl::LineFromPosition(int pos
)
1543 return SendMsg(2166, pos
, 0);
1546 // Retrieve the position at the start of a line.
1547 int wxStyledTextCtrl::PositionFromLine(int line
)
1549 return SendMsg(2167, line
, 0);
1552 // Scroll horizontally and vertically.
1553 void wxStyledTextCtrl::LineScroll(int columns
, int lines
)
1555 SendMsg(2168, columns
, lines
);
1558 // Ensure the caret is visible.
1559 void wxStyledTextCtrl::EnsureCaretVisible()
1561 SendMsg(2169, 0, 0);
1564 // Replace the selected text with the argument text.
1565 void wxStyledTextCtrl::ReplaceSelection(const wxString
& text
)
1567 SendMsg(2170, 0, (long)(const char*)wx2stc(text
));
1570 // Set to read only or read write.
1571 void wxStyledTextCtrl::SetReadOnly(bool readOnly
)
1573 SendMsg(2171, readOnly
, 0);
1576 // Will a paste succeed?
1577 bool wxStyledTextCtrl::CanPaste()
1579 return SendMsg(2173, 0, 0) != 0;
1582 // Are there any undoable actions in the undo history?
1583 bool wxStyledTextCtrl::CanUndo()
1585 return SendMsg(2174, 0, 0) != 0;
1588 // Delete the undo history.
1589 void wxStyledTextCtrl::EmptyUndoBuffer()
1591 SendMsg(2175, 0, 0);
1594 // Undo one action in the undo history.
1595 void wxStyledTextCtrl::Undo()
1597 SendMsg(2176, 0, 0);
1600 // Cut the selection to the clipboard.
1601 void wxStyledTextCtrl::Cut()
1603 SendMsg(2177, 0, 0);
1606 // Copy the selection to the clipboard.
1607 void wxStyledTextCtrl::Copy()
1609 SendMsg(2178, 0, 0);
1612 // Paste the contents of the clipboard into the document replacing the selection.
1613 void wxStyledTextCtrl::Paste()
1615 SendMsg(2179, 0, 0);
1618 // Clear the selection.
1619 void wxStyledTextCtrl::Clear()
1621 SendMsg(2180, 0, 0);
1624 // Replace the contents of the document with the argument text.
1625 void wxStyledTextCtrl::SetText(const wxString
& text
)
1627 SendMsg(2181, 0, (long)(const char*)wx2stc(text
));
1630 // Retrieve all the text in the document.
1631 wxString
wxStyledTextCtrl::GetText() {
1632 int len
= GetTextLength();
1633 wxMemoryBuffer
mbuf(len
+1); // leave room for the null...
1634 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1635 SendMsg(2182, len
+1, (long)buf
);
1636 mbuf
.UngetWriteBuf(len
);
1641 // Retrieve the number of characters in the document.
1642 int wxStyledTextCtrl::GetTextLength() const
1644 return SendMsg(2183, 0, 0);
1647 // Set to overtype (true) or insert mode.
1648 void wxStyledTextCtrl::SetOvertype(bool overtype
)
1650 SendMsg(2186, overtype
, 0);
1653 // Returns true if overtype mode is active otherwise false is returned.
1654 bool wxStyledTextCtrl::GetOvertype() const
1656 return SendMsg(2187, 0, 0) != 0;
1659 // Set the width of the insert mode caret.
1660 void wxStyledTextCtrl::SetCaretWidth(int pixelWidth
)
1662 SendMsg(2188, pixelWidth
, 0);
1665 // Returns the width of the insert mode caret.
1666 int wxStyledTextCtrl::GetCaretWidth() const
1668 return SendMsg(2189, 0, 0);
1671 // Sets the position that starts the target which is used for updating the
1672 // document without affecting the scroll position.
1673 void wxStyledTextCtrl::SetTargetStart(int pos
)
1675 SendMsg(2190, pos
, 0);
1678 // Get the position that starts the target.
1679 int wxStyledTextCtrl::GetTargetStart() const
1681 return SendMsg(2191, 0, 0);
1684 // Sets the position that ends the target which is used for updating the
1685 // document without affecting the scroll position.
1686 void wxStyledTextCtrl::SetTargetEnd(int pos
)
1688 SendMsg(2192, pos
, 0);
1691 // Get the position that ends the target.
1692 int wxStyledTextCtrl::GetTargetEnd() const
1694 return SendMsg(2193, 0, 0);
1697 // Replace the target text with the argument text.
1698 // Text is counted so it can contain NULs.
1699 // Returns the length of the replacement text.
1701 int wxStyledTextCtrl::ReplaceTarget(const wxString
& text
) {
1702 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
1703 return SendMsg(2194, strlen(buf
), (long)(const char*)buf
);
1706 // Replace the target text with the argument text after \d processing.
1707 // Text is counted so it can contain NULs.
1708 // Looks for \d where d is between 1 and 9 and replaces these with the strings
1709 // matched in the last search operation which were surrounded by \( and \).
1710 // Returns the length of the replacement text including any change
1711 // caused by processing the \d patterns.
1713 int wxStyledTextCtrl::ReplaceTargetRE(const wxString
& text
) {
1714 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
1715 return SendMsg(2195, strlen(buf
), (long)(const char*)buf
);
1718 // Search for a counted string in the target and set the target to the found
1719 // range. Text is counted so it can contain NULs.
1720 // Returns length of range or -1 for failure in which case target is not moved.
1722 int wxStyledTextCtrl::SearchInTarget(const wxString
& text
) {
1723 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
1724 return SendMsg(2197, strlen(buf
), (long)(const char*)buf
);
1727 // Set the search flags used by SearchInTarget.
1728 void wxStyledTextCtrl::SetSearchFlags(int flags
)
1730 SendMsg(2198, flags
, 0);
1733 // Get the search flags used by SearchInTarget.
1734 int wxStyledTextCtrl::GetSearchFlags() const
1736 return SendMsg(2199, 0, 0);
1739 // Show a call tip containing a definition near position pos.
1740 void wxStyledTextCtrl::CallTipShow(int pos
, const wxString
& definition
)
1742 SendMsg(2200, pos
, (long)(const char*)wx2stc(definition
));
1745 // Remove the call tip from the screen.
1746 void wxStyledTextCtrl::CallTipCancel()
1748 SendMsg(2201, 0, 0);
1751 // Is there an active call tip?
1752 bool wxStyledTextCtrl::CallTipActive()
1754 return SendMsg(2202, 0, 0) != 0;
1757 // Retrieve the position where the caret was before displaying the call tip.
1758 int wxStyledTextCtrl::CallTipPosAtStart()
1760 return SendMsg(2203, 0, 0);
1763 // Highlight a segment of the definition.
1764 void wxStyledTextCtrl::CallTipSetHighlight(int start
, int end
)
1766 SendMsg(2204, start
, end
);
1769 // Set the background colour for the call tip.
1770 void wxStyledTextCtrl::CallTipSetBackground(const wxColour
& back
)
1772 SendMsg(2205, wxColourAsLong(back
), 0);
1775 // Set the foreground colour for the call tip.
1776 void wxStyledTextCtrl::CallTipSetForeground(const wxColour
& fore
)
1778 SendMsg(2206, wxColourAsLong(fore
), 0);
1781 // Set the foreground colour for the highlighted part of the call tip.
1782 void wxStyledTextCtrl::CallTipSetForegroundHighlight(const wxColour
& fore
)
1784 SendMsg(2207, wxColourAsLong(fore
), 0);
1787 // Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
1788 void wxStyledTextCtrl::CallTipUseStyle(int tabSize
)
1790 SendMsg(2212, tabSize
, 0);
1793 // Find the display line of a document line taking hidden lines into account.
1794 int wxStyledTextCtrl::VisibleFromDocLine(int line
)
1796 return SendMsg(2220, line
, 0);
1799 // Find the document line of a display line taking hidden lines into account.
1800 int wxStyledTextCtrl::DocLineFromVisible(int lineDisplay
)
1802 return SendMsg(2221, lineDisplay
, 0);
1805 // The number of display lines needed to wrap a document line
1806 int wxStyledTextCtrl::WrapCount(int line
)
1808 return SendMsg(2235, line
, 0);
1811 // Set the fold level of a line.
1812 // This encodes an integer level along with flags indicating whether the
1813 // line is a header and whether it is effectively white space.
1814 void wxStyledTextCtrl::SetFoldLevel(int line
, int level
)
1816 SendMsg(2222, line
, level
);
1819 // Retrieve the fold level of a line.
1820 int wxStyledTextCtrl::GetFoldLevel(int line
) const
1822 return SendMsg(2223, line
, 0);
1825 // Find the last child line of a header line.
1826 int wxStyledTextCtrl::GetLastChild(int line
, int level
) const
1828 return SendMsg(2224, line
, level
);
1831 // Find the parent line of a child line.
1832 int wxStyledTextCtrl::GetFoldParent(int line
) const
1834 return SendMsg(2225, line
, 0);
1837 // Make a range of lines visible.
1838 void wxStyledTextCtrl::ShowLines(int lineStart
, int lineEnd
)
1840 SendMsg(2226, lineStart
, lineEnd
);
1843 // Make a range of lines invisible.
1844 void wxStyledTextCtrl::HideLines(int lineStart
, int lineEnd
)
1846 SendMsg(2227, lineStart
, lineEnd
);
1849 // Is a line visible?
1850 bool wxStyledTextCtrl::GetLineVisible(int line
) const
1852 return SendMsg(2228, line
, 0) != 0;
1855 // Show the children of a header line.
1856 void wxStyledTextCtrl::SetFoldExpanded(int line
, bool expanded
)
1858 SendMsg(2229, line
, expanded
);
1861 // Is a header line expanded?
1862 bool wxStyledTextCtrl::GetFoldExpanded(int line
) const
1864 return SendMsg(2230, line
, 0) != 0;
1867 // Switch a header line between expanded and contracted.
1868 void wxStyledTextCtrl::ToggleFold(int line
)
1870 SendMsg(2231, line
, 0);
1873 // Ensure a particular line is visible by expanding any header line hiding it.
1874 void wxStyledTextCtrl::EnsureVisible(int line
)
1876 SendMsg(2232, line
, 0);
1879 // Set some style options for folding.
1880 void wxStyledTextCtrl::SetFoldFlags(int flags
)
1882 SendMsg(2233, flags
, 0);
1885 // Ensure a particular line is visible by expanding any header line hiding it.
1886 // Use the currently set visibility policy to determine which range to display.
1887 void wxStyledTextCtrl::EnsureVisibleEnforcePolicy(int line
)
1889 SendMsg(2234, line
, 0);
1892 // Sets whether a tab pressed when caret is within indentation indents.
1893 void wxStyledTextCtrl::SetTabIndents(bool tabIndents
)
1895 SendMsg(2260, tabIndents
, 0);
1898 // Does a tab pressed when caret is within indentation indent?
1899 bool wxStyledTextCtrl::GetTabIndents() const
1901 return SendMsg(2261, 0, 0) != 0;
1904 // Sets whether a backspace pressed when caret is within indentation unindents.
1905 void wxStyledTextCtrl::SetBackSpaceUnIndents(bool bsUnIndents
)
1907 SendMsg(2262, bsUnIndents
, 0);
1910 // Does a backspace pressed when caret is within indentation unindent?
1911 bool wxStyledTextCtrl::GetBackSpaceUnIndents() const
1913 return SendMsg(2263, 0, 0) != 0;
1916 // Sets the time the mouse must sit still to generate a mouse dwell event.
1917 void wxStyledTextCtrl::SetMouseDwellTime(int periodMilliseconds
)
1919 SendMsg(2264, periodMilliseconds
, 0);
1922 // Retrieve the time the mouse must sit still to generate a mouse dwell event.
1923 int wxStyledTextCtrl::GetMouseDwellTime() const
1925 return SendMsg(2265, 0, 0);
1928 // Get position of start of word.
1929 int wxStyledTextCtrl::WordStartPosition(int pos
, bool onlyWordCharacters
)
1931 return SendMsg(2266, pos
, onlyWordCharacters
);
1934 // Get position of end of word.
1935 int wxStyledTextCtrl::WordEndPosition(int pos
, bool onlyWordCharacters
)
1937 return SendMsg(2267, pos
, onlyWordCharacters
);
1940 // Sets whether text is word wrapped.
1941 void wxStyledTextCtrl::SetWrapMode(int mode
)
1943 SendMsg(2268, mode
, 0);
1946 // Retrieve whether text is word wrapped.
1947 int wxStyledTextCtrl::GetWrapMode() const
1949 return SendMsg(2269, 0, 0);
1952 // Set the display mode of visual flags for wrapped lines.
1953 void wxStyledTextCtrl::SetWrapVisualFlags(int wrapVisualFlags
)
1955 SendMsg(2460, wrapVisualFlags
, 0);
1958 // Retrive the display mode of visual flags for wrapped lines.
1959 int wxStyledTextCtrl::GetWrapVisualFlags() const
1961 return SendMsg(2461, 0, 0);
1964 // Set the location of visual flags for wrapped lines.
1965 void wxStyledTextCtrl::SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation
)
1967 SendMsg(2462, wrapVisualFlagsLocation
, 0);
1970 // Retrive the location of visual flags for wrapped lines.
1971 int wxStyledTextCtrl::GetWrapVisualFlagsLocation() const
1973 return SendMsg(2463, 0, 0);
1976 // Set the start indent for wrapped lines.
1977 void wxStyledTextCtrl::SetWrapStartIndent(int indent
)
1979 SendMsg(2464, indent
, 0);
1982 // Retrive the start indent for wrapped lines.
1983 int wxStyledTextCtrl::GetWrapStartIndent() const
1985 return SendMsg(2465, 0, 0);
1988 // Sets the degree of caching of layout information.
1989 void wxStyledTextCtrl::SetLayoutCache(int mode
)
1991 SendMsg(2272, mode
, 0);
1994 // Retrieve the degree of caching of layout information.
1995 int wxStyledTextCtrl::GetLayoutCache() const
1997 return SendMsg(2273, 0, 0);
2000 // Sets the document width assumed for scrolling.
2001 void wxStyledTextCtrl::SetScrollWidth(int pixelWidth
)
2003 SendMsg(2274, pixelWidth
, 0);
2006 // Retrieve the document width assumed for scrolling.
2007 int wxStyledTextCtrl::GetScrollWidth() const
2009 return SendMsg(2275, 0, 0);
2012 // Sets whether the maximum width line displayed is used to set scroll width.
2013 void wxStyledTextCtrl::SetScrollWidthTracking(bool tracking
)
2015 SendMsg(2516, tracking
, 0);
2018 // Retrieve whether the scroll width tracks wide lines.
2019 bool wxStyledTextCtrl::GetScrollWidthTracking() const
2021 return SendMsg(2517, 0, 0) != 0;
2024 // Measure the pixel width of some text in a particular style.
2025 // NUL terminated text argument.
2026 // Does not handle tab or control characters.
2027 int wxStyledTextCtrl::TextWidth(int style
, const wxString
& text
)
2029 return SendMsg(2276, style
, (long)(const char*)wx2stc(text
));
2032 // Sets the scroll range so that maximum scroll position has
2033 // the last line at the bottom of the view (default).
2034 // Setting this to false allows scrolling one page below the last line.
2035 void wxStyledTextCtrl::SetEndAtLastLine(bool endAtLastLine
)
2037 SendMsg(2277, endAtLastLine
, 0);
2040 // Retrieve whether the maximum scroll position has the last
2041 // line at the bottom of the view.
2042 bool wxStyledTextCtrl::GetEndAtLastLine() const
2044 return SendMsg(2278, 0, 0) != 0;
2047 // Retrieve the height of a particular line of text in pixels.
2048 int wxStyledTextCtrl::TextHeight(int line
)
2050 return SendMsg(2279, line
, 0);
2053 // Show or hide the vertical scroll bar.
2054 void wxStyledTextCtrl::SetUseVerticalScrollBar(bool show
)
2056 SendMsg(2280, show
, 0);
2059 // Is the vertical scroll bar visible?
2060 bool wxStyledTextCtrl::GetUseVerticalScrollBar() const
2062 return SendMsg(2281, 0, 0) != 0;
2065 // Append a string to the end of the document without changing the selection.
2066 void wxStyledTextCtrl::AppendText(const wxString
& text
) {
2067 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
2068 SendMsg(2282, strlen(buf
), (long)(const char*)buf
);
2071 // Is drawing done in two phases with backgrounds drawn before foregrounds?
2072 bool wxStyledTextCtrl::GetTwoPhaseDraw() const
2074 return SendMsg(2283, 0, 0) != 0;
2077 // In twoPhaseDraw mode, drawing is performed in two phases, first the background
2078 // and then the foreground. This avoids chopping off characters that overlap the next run.
2079 void wxStyledTextCtrl::SetTwoPhaseDraw(bool twoPhase
)
2081 SendMsg(2284, twoPhase
, 0);
2084 // Make the target range start and end be the same as the selection range start and end.
2085 void wxStyledTextCtrl::TargetFromSelection()
2087 SendMsg(2287, 0, 0);
2090 // Join the lines in the target.
2091 void wxStyledTextCtrl::LinesJoin()
2093 SendMsg(2288, 0, 0);
2096 // Split the lines in the target into lines that are less wide than pixelWidth
2098 void wxStyledTextCtrl::LinesSplit(int pixelWidth
)
2100 SendMsg(2289, pixelWidth
, 0);
2103 // Set the colours used as a chequerboard pattern in the fold margin
2104 void wxStyledTextCtrl::SetFoldMarginColour(bool useSetting
, const wxColour
& back
)
2106 SendMsg(2290, useSetting
, wxColourAsLong(back
));
2108 void wxStyledTextCtrl::SetFoldMarginHiColour(bool useSetting
, const wxColour
& fore
)
2110 SendMsg(2291, useSetting
, wxColourAsLong(fore
));
2113 // Move caret down one line.
2114 void wxStyledTextCtrl::LineDown()
2116 SendMsg(2300, 0, 0);
2119 // Move caret down one line extending selection to new caret position.
2120 void wxStyledTextCtrl::LineDownExtend()
2122 SendMsg(2301, 0, 0);
2125 // Move caret up one line.
2126 void wxStyledTextCtrl::LineUp()
2128 SendMsg(2302, 0, 0);
2131 // Move caret up one line extending selection to new caret position.
2132 void wxStyledTextCtrl::LineUpExtend()
2134 SendMsg(2303, 0, 0);
2137 // Move caret left one character.
2138 void wxStyledTextCtrl::CharLeft()
2140 SendMsg(2304, 0, 0);
2143 // Move caret left one character extending selection to new caret position.
2144 void wxStyledTextCtrl::CharLeftExtend()
2146 SendMsg(2305, 0, 0);
2149 // Move caret right one character.
2150 void wxStyledTextCtrl::CharRight()
2152 SendMsg(2306, 0, 0);
2155 // Move caret right one character extending selection to new caret position.
2156 void wxStyledTextCtrl::CharRightExtend()
2158 SendMsg(2307, 0, 0);
2161 // Move caret left one word.
2162 void wxStyledTextCtrl::WordLeft()
2164 SendMsg(2308, 0, 0);
2167 // Move caret left one word extending selection to new caret position.
2168 void wxStyledTextCtrl::WordLeftExtend()
2170 SendMsg(2309, 0, 0);
2173 // Move caret right one word.
2174 void wxStyledTextCtrl::WordRight()
2176 SendMsg(2310, 0, 0);
2179 // Move caret right one word extending selection to new caret position.
2180 void wxStyledTextCtrl::WordRightExtend()
2182 SendMsg(2311, 0, 0);
2185 // Move caret to first position on line.
2186 void wxStyledTextCtrl::Home()
2188 SendMsg(2312, 0, 0);
2191 // Move caret to first position on line extending selection to new caret position.
2192 void wxStyledTextCtrl::HomeExtend()
2194 SendMsg(2313, 0, 0);
2197 // Move caret to last position on line.
2198 void wxStyledTextCtrl::LineEnd()
2200 SendMsg(2314, 0, 0);
2203 // Move caret to last position on line extending selection to new caret position.
2204 void wxStyledTextCtrl::LineEndExtend()
2206 SendMsg(2315, 0, 0);
2209 // Move caret to first position in document.
2210 void wxStyledTextCtrl::DocumentStart()
2212 SendMsg(2316, 0, 0);
2215 // Move caret to first position in document extending selection to new caret position.
2216 void wxStyledTextCtrl::DocumentStartExtend()
2218 SendMsg(2317, 0, 0);
2221 // Move caret to last position in document.
2222 void wxStyledTextCtrl::DocumentEnd()
2224 SendMsg(2318, 0, 0);
2227 // Move caret to last position in document extending selection to new caret position.
2228 void wxStyledTextCtrl::DocumentEndExtend()
2230 SendMsg(2319, 0, 0);
2233 // Move caret one page up.
2234 void wxStyledTextCtrl::PageUp()
2236 SendMsg(2320, 0, 0);
2239 // Move caret one page up extending selection to new caret position.
2240 void wxStyledTextCtrl::PageUpExtend()
2242 SendMsg(2321, 0, 0);
2245 // Move caret one page down.
2246 void wxStyledTextCtrl::PageDown()
2248 SendMsg(2322, 0, 0);
2251 // Move caret one page down extending selection to new caret position.
2252 void wxStyledTextCtrl::PageDownExtend()
2254 SendMsg(2323, 0, 0);
2257 // Switch from insert to overtype mode or the reverse.
2258 void wxStyledTextCtrl::EditToggleOvertype()
2260 SendMsg(2324, 0, 0);
2263 // Cancel any modes such as call tip or auto-completion list display.
2264 void wxStyledTextCtrl::Cancel()
2266 SendMsg(2325, 0, 0);
2269 // Delete the selection or if no selection, the character before the caret.
2270 void wxStyledTextCtrl::DeleteBack()
2272 SendMsg(2326, 0, 0);
2275 // If selection is empty or all on one line replace the selection with a tab character.
2276 // If more than one line selected, indent the lines.
2277 void wxStyledTextCtrl::Tab()
2279 SendMsg(2327, 0, 0);
2282 // Dedent the selected lines.
2283 void wxStyledTextCtrl::BackTab()
2285 SendMsg(2328, 0, 0);
2288 // Insert a new line, may use a CRLF, CR or LF depending on EOL mode.
2289 void wxStyledTextCtrl::NewLine()
2291 SendMsg(2329, 0, 0);
2294 // Insert a Form Feed character.
2295 void wxStyledTextCtrl::FormFeed()
2297 SendMsg(2330, 0, 0);
2300 // Move caret to before first visible character on line.
2301 // If already there move to first character on line.
2302 void wxStyledTextCtrl::VCHome()
2304 SendMsg(2331, 0, 0);
2307 // Like VCHome but extending selection to new caret position.
2308 void wxStyledTextCtrl::VCHomeExtend()
2310 SendMsg(2332, 0, 0);
2313 // Magnify the displayed text by increasing the sizes by 1 point.
2314 void wxStyledTextCtrl::ZoomIn()
2316 SendMsg(2333, 0, 0);
2319 // Make the displayed text smaller by decreasing the sizes by 1 point.
2320 void wxStyledTextCtrl::ZoomOut()
2322 SendMsg(2334, 0, 0);
2325 // Delete the word to the left of the caret.
2326 void wxStyledTextCtrl::DelWordLeft()
2328 SendMsg(2335, 0, 0);
2331 // Delete the word to the right of the caret.
2332 void wxStyledTextCtrl::DelWordRight()
2334 SendMsg(2336, 0, 0);
2337 // Delete the word to the right of the caret, but not the trailing non-word characters.
2338 void wxStyledTextCtrl::DelWordRightEnd()
2340 SendMsg(2518, 0, 0);
2343 // Cut the line containing the caret.
2344 void wxStyledTextCtrl::LineCut()
2346 SendMsg(2337, 0, 0);
2349 // Delete the line containing the caret.
2350 void wxStyledTextCtrl::LineDelete()
2352 SendMsg(2338, 0, 0);
2355 // Switch the current line with the previous.
2356 void wxStyledTextCtrl::LineTranspose()
2358 SendMsg(2339, 0, 0);
2361 // Duplicate the current line.
2362 void wxStyledTextCtrl::LineDuplicate()
2364 SendMsg(2404, 0, 0);
2367 // Transform the selection to lower case.
2368 void wxStyledTextCtrl::LowerCase()
2370 SendMsg(2340, 0, 0);
2373 // Transform the selection to upper case.
2374 void wxStyledTextCtrl::UpperCase()
2376 SendMsg(2341, 0, 0);
2379 // Scroll the document down, keeping the caret visible.
2380 void wxStyledTextCtrl::LineScrollDown()
2382 SendMsg(2342, 0, 0);
2385 // Scroll the document up, keeping the caret visible.
2386 void wxStyledTextCtrl::LineScrollUp()
2388 SendMsg(2343, 0, 0);
2391 // Delete the selection or if no selection, the character before the caret.
2392 // Will not delete the character before at the start of a line.
2393 void wxStyledTextCtrl::DeleteBackNotLine()
2395 SendMsg(2344, 0, 0);
2398 // Move caret to first position on display line.
2399 void wxStyledTextCtrl::HomeDisplay()
2401 SendMsg(2345, 0, 0);
2404 // Move caret to first position on display line extending selection to
2405 // new caret position.
2406 void wxStyledTextCtrl::HomeDisplayExtend()
2408 SendMsg(2346, 0, 0);
2411 // Move caret to last position on display line.
2412 void wxStyledTextCtrl::LineEndDisplay()
2414 SendMsg(2347, 0, 0);
2417 // Move caret to last position on display line extending selection to new
2419 void wxStyledTextCtrl::LineEndDisplayExtend()
2421 SendMsg(2348, 0, 0);
2424 // These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)?
2425 // except they behave differently when word-wrap is enabled:
2426 // They go first to the start / end of the display line, like (Home|LineEnd)Display
2427 // The difference is that, the cursor is already at the point, it goes on to the start
2428 // or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
2429 void wxStyledTextCtrl::HomeWrap()
2431 SendMsg(2349, 0, 0);
2433 void wxStyledTextCtrl::HomeWrapExtend()
2435 SendMsg(2450, 0, 0);
2437 void wxStyledTextCtrl::LineEndWrap()
2439 SendMsg(2451, 0, 0);
2441 void wxStyledTextCtrl::LineEndWrapExtend()
2443 SendMsg(2452, 0, 0);
2445 void wxStyledTextCtrl::VCHomeWrap()
2447 SendMsg(2453, 0, 0);
2449 void wxStyledTextCtrl::VCHomeWrapExtend()
2451 SendMsg(2454, 0, 0);
2454 // Copy the line containing the caret.
2455 void wxStyledTextCtrl::LineCopy()
2457 SendMsg(2455, 0, 0);
2460 // Move the caret inside current view if it's not there already.
2461 void wxStyledTextCtrl::MoveCaretInsideView()
2463 SendMsg(2401, 0, 0);
2466 // How many characters are on a line, not including end of line characters?
2467 int wxStyledTextCtrl::LineLength(int line
)
2469 return SendMsg(2350, line
, 0);
2472 // Highlight the characters at two positions.
2473 void wxStyledTextCtrl::BraceHighlight(int pos1
, int pos2
)
2475 SendMsg(2351, pos1
, pos2
);
2478 // Highlight the character at a position indicating there is no matching brace.
2479 void wxStyledTextCtrl::BraceBadLight(int pos
)
2481 SendMsg(2352, pos
, 0);
2484 // Find the position of a matching brace or INVALID_POSITION if no match.
2485 int wxStyledTextCtrl::BraceMatch(int pos
)
2487 return SendMsg(2353, pos
, 0);
2490 // Are the end of line characters visible?
2491 bool wxStyledTextCtrl::GetViewEOL() const
2493 return SendMsg(2355, 0, 0) != 0;
2496 // Make the end of line characters visible or invisible.
2497 void wxStyledTextCtrl::SetViewEOL(bool visible
)
2499 SendMsg(2356, visible
, 0);
2502 // Retrieve a pointer to the document object.
2503 void* wxStyledTextCtrl::GetDocPointer() {
2504 return (void*)SendMsg(2357);
2507 // Change the document object used.
2508 void wxStyledTextCtrl::SetDocPointer(void* docPointer
) {
2509 SendMsg(2358, 0, (long)docPointer
);
2512 // Set which document modification events are sent to the container.
2513 void wxStyledTextCtrl::SetModEventMask(int mask
)
2515 SendMsg(2359, mask
, 0);
2518 // Retrieve the column number which text should be kept within.
2519 int wxStyledTextCtrl::GetEdgeColumn() const
2521 return SendMsg(2360, 0, 0);
2524 // Set the column number of the edge.
2525 // If text goes past the edge then it is highlighted.
2526 void wxStyledTextCtrl::SetEdgeColumn(int column
)
2528 SendMsg(2361, column
, 0);
2531 // Retrieve the edge highlight mode.
2532 int wxStyledTextCtrl::GetEdgeMode() const
2534 return SendMsg(2362, 0, 0);
2537 // The edge may be displayed by a line (EDGE_LINE) or by highlighting text that
2538 // goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).
2539 void wxStyledTextCtrl::SetEdgeMode(int mode
)
2541 SendMsg(2363, mode
, 0);
2544 // Retrieve the colour used in edge indication.
2545 wxColour
wxStyledTextCtrl::GetEdgeColour() const
2547 long c
= SendMsg(2364, 0, 0);
2548 return wxColourFromLong(c
);
2551 // Change the colour used in edge indication.
2552 void wxStyledTextCtrl::SetEdgeColour(const wxColour
& edgeColour
)
2554 SendMsg(2365, wxColourAsLong(edgeColour
), 0);
2557 // Sets the current caret position to be the search anchor.
2558 void wxStyledTextCtrl::SearchAnchor()
2560 SendMsg(2366, 0, 0);
2563 // Find some text starting at the search anchor.
2564 // Does not ensure the selection is visible.
2565 int wxStyledTextCtrl::SearchNext(int flags
, const wxString
& text
)
2567 return SendMsg(2367, flags
, (long)(const char*)wx2stc(text
));
2570 // Find some text starting at the search anchor and moving backwards.
2571 // Does not ensure the selection is visible.
2572 int wxStyledTextCtrl::SearchPrev(int flags
, const wxString
& text
)
2574 return SendMsg(2368, flags
, (long)(const char*)wx2stc(text
));
2577 // Retrieves the number of lines completely visible.
2578 int wxStyledTextCtrl::LinesOnScreen() const
2580 return SendMsg(2370, 0, 0);
2583 // Set whether a pop up menu is displayed automatically when the user presses
2584 // the wrong mouse button.
2585 void wxStyledTextCtrl::UsePopUp(bool allowPopUp
)
2587 SendMsg(2371, allowPopUp
, 0);
2590 // Is the selection rectangular? The alternative is the more common stream selection.
2591 bool wxStyledTextCtrl::SelectionIsRectangle() const
2593 return SendMsg(2372, 0, 0) != 0;
2596 // Set the zoom level. This number of points is added to the size of all fonts.
2597 // It may be positive to magnify or negative to reduce.
2598 void wxStyledTextCtrl::SetZoom(int zoom
)
2600 SendMsg(2373, zoom
, 0);
2603 // Retrieve the zoom level.
2604 int wxStyledTextCtrl::GetZoom() const
2606 return SendMsg(2374, 0, 0);
2609 // Create a new document object.
2610 // Starts with reference count of 1 and not selected into editor.
2611 void* wxStyledTextCtrl::CreateDocument() {
2612 return (void*)SendMsg(2375);
2615 // Extend life of document.
2616 void wxStyledTextCtrl::AddRefDocument(void* docPointer
) {
2617 SendMsg(2376, 0, (long)docPointer
);
2620 // Release a reference to the document, deleting document if it fades to black.
2621 void wxStyledTextCtrl::ReleaseDocument(void* docPointer
) {
2622 SendMsg(2377, 0, (long)docPointer
);
2625 // Get which document modification events are sent to the container.
2626 int wxStyledTextCtrl::GetModEventMask() const
2628 return SendMsg(2378, 0, 0);
2631 // Change internal focus flag.
2632 void wxStyledTextCtrl::SetSTCFocus(bool focus
)
2634 SendMsg(2380, focus
, 0);
2637 // Get internal focus flag.
2638 bool wxStyledTextCtrl::GetSTCFocus() const
2640 return SendMsg(2381, 0, 0) != 0;
2643 // Change error status - 0 = OK.
2644 void wxStyledTextCtrl::SetStatus(int statusCode
)
2646 SendMsg(2382, statusCode
, 0);
2649 // Get error status.
2650 int wxStyledTextCtrl::GetStatus() const
2652 return SendMsg(2383, 0, 0);
2655 // Set whether the mouse is captured when its button is pressed.
2656 void wxStyledTextCtrl::SetMouseDownCaptures(bool captures
)
2658 SendMsg(2384, captures
, 0);
2661 // Get whether mouse gets captured.
2662 bool wxStyledTextCtrl::GetMouseDownCaptures() const
2664 return SendMsg(2385, 0, 0) != 0;
2667 // Sets the cursor to one of the SC_CURSOR* values.
2668 void wxStyledTextCtrl::SetSTCCursor(int cursorType
)
2670 SendMsg(2386, cursorType
, 0);
2674 int wxStyledTextCtrl::GetSTCCursor() const
2676 return SendMsg(2387, 0, 0);
2679 // Change the way control characters are displayed:
2680 // If symbol is < 32, keep the drawn way, else, use the given character.
2681 void wxStyledTextCtrl::SetControlCharSymbol(int symbol
)
2683 SendMsg(2388, symbol
, 0);
2686 // Get the way control characters are displayed.
2687 int wxStyledTextCtrl::GetControlCharSymbol() const
2689 return SendMsg(2389, 0, 0);
2692 // Move to the previous change in capitalisation.
2693 void wxStyledTextCtrl::WordPartLeft()
2695 SendMsg(2390, 0, 0);
2698 // Move to the previous change in capitalisation extending selection
2699 // to new caret position.
2700 void wxStyledTextCtrl::WordPartLeftExtend()
2702 SendMsg(2391, 0, 0);
2705 // Move to the change next in capitalisation.
2706 void wxStyledTextCtrl::WordPartRight()
2708 SendMsg(2392, 0, 0);
2711 // Move to the next change in capitalisation extending selection
2712 // to new caret position.
2713 void wxStyledTextCtrl::WordPartRightExtend()
2715 SendMsg(2393, 0, 0);
2718 // Set the way the display area is determined when a particular line
2719 // is to be moved to by Find, FindNext, GotoLine, etc.
2720 void wxStyledTextCtrl::SetVisiblePolicy(int visiblePolicy
, int visibleSlop
)
2722 SendMsg(2394, visiblePolicy
, visibleSlop
);
2725 // Delete back from the current position to the start of the line.
2726 void wxStyledTextCtrl::DelLineLeft()
2728 SendMsg(2395, 0, 0);
2731 // Delete forwards from the current position to the end of the line.
2732 void wxStyledTextCtrl::DelLineRight()
2734 SendMsg(2396, 0, 0);
2737 // Get and Set the xOffset (ie, horizonal scroll position).
2738 void wxStyledTextCtrl::SetXOffset(int newOffset
)
2740 SendMsg(2397, newOffset
, 0);
2742 int wxStyledTextCtrl::GetXOffset() const
2744 return SendMsg(2398, 0, 0);
2747 // Set the last x chosen value to be the caret x position.
2748 void wxStyledTextCtrl::ChooseCaretX()
2750 SendMsg(2399, 0, 0);
2753 // Set the way the caret is kept visible when going sideway.
2754 // The exclusion zone is given in pixels.
2755 void wxStyledTextCtrl::SetXCaretPolicy(int caretPolicy
, int caretSlop
)
2757 SendMsg(2402, caretPolicy
, caretSlop
);
2760 // Set the way the line the caret is on is kept visible.
2761 // The exclusion zone is given in lines.
2762 void wxStyledTextCtrl::SetYCaretPolicy(int caretPolicy
, int caretSlop
)
2764 SendMsg(2403, caretPolicy
, caretSlop
);
2767 // Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE).
2768 void wxStyledTextCtrl::SetPrintWrapMode(int mode
)
2770 SendMsg(2406, mode
, 0);
2773 // Is printing line wrapped?
2774 int wxStyledTextCtrl::GetPrintWrapMode() const
2776 return SendMsg(2407, 0, 0);
2779 // Set a fore colour for active hotspots.
2780 void wxStyledTextCtrl::SetHotspotActiveForeground(bool useSetting
, const wxColour
& fore
)
2782 SendMsg(2410, useSetting
, wxColourAsLong(fore
));
2785 // Get the fore colour for active hotspots.
2786 wxColour
wxStyledTextCtrl::GetHotspotActiveForeground() const
2788 long c
= SendMsg(2494, 0, 0);
2789 return wxColourFromLong(c
);
2792 // Set a back colour for active hotspots.
2793 void wxStyledTextCtrl::SetHotspotActiveBackground(bool useSetting
, const wxColour
& back
)
2795 SendMsg(2411, useSetting
, wxColourAsLong(back
));
2798 // Get the back colour for active hotspots.
2799 wxColour
wxStyledTextCtrl::GetHotspotActiveBackground() const
2801 long c
= SendMsg(2495, 0, 0);
2802 return wxColourFromLong(c
);
2805 // Enable / Disable underlining active hotspots.
2806 void wxStyledTextCtrl::SetHotspotActiveUnderline(bool underline
)
2808 SendMsg(2412, underline
, 0);
2811 // Get whether underlining for active hotspots.
2812 bool wxStyledTextCtrl::GetHotspotActiveUnderline() const
2814 return SendMsg(2496, 0, 0) != 0;
2817 // Limit hotspots to single line so hotspots on two lines don't merge.
2818 void wxStyledTextCtrl::SetHotspotSingleLine(bool singleLine
)
2820 SendMsg(2421, singleLine
, 0);
2823 // Get the HotspotSingleLine property
2824 bool wxStyledTextCtrl::GetHotspotSingleLine() const
2826 return SendMsg(2497, 0, 0) != 0;
2829 // Move caret between paragraphs (delimited by empty lines).
2830 void wxStyledTextCtrl::ParaDown()
2832 SendMsg(2413, 0, 0);
2834 void wxStyledTextCtrl::ParaDownExtend()
2836 SendMsg(2414, 0, 0);
2838 void wxStyledTextCtrl::ParaUp()
2840 SendMsg(2415, 0, 0);
2842 void wxStyledTextCtrl::ParaUpExtend()
2844 SendMsg(2416, 0, 0);
2847 // Given a valid document position, return the previous position taking code
2848 // page into account. Returns 0 if passed 0.
2849 int wxStyledTextCtrl::PositionBefore(int pos
)
2851 return SendMsg(2417, pos
, 0);
2854 // Given a valid document position, return the next position taking code
2855 // page into account. Maximum value returned is the last position in the document.
2856 int wxStyledTextCtrl::PositionAfter(int pos
)
2858 return SendMsg(2418, pos
, 0);
2861 // Copy a range of text to the clipboard. Positions are clipped into the document.
2862 void wxStyledTextCtrl::CopyRange(int start
, int end
)
2864 SendMsg(2419, start
, end
);
2867 // Copy argument text to the clipboard.
2868 void wxStyledTextCtrl::CopyText(int length
, const wxString
& text
)
2870 SendMsg(2420, length
, (long)(const char*)wx2stc(text
));
2873 // Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE) or
2874 // by lines (SC_SEL_LINES).
2875 void wxStyledTextCtrl::SetSelectionMode(int mode
)
2877 SendMsg(2422, mode
, 0);
2880 // Get the mode of the current selection.
2881 int wxStyledTextCtrl::GetSelectionMode() const
2883 return SendMsg(2423, 0, 0);
2886 // Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line).
2887 int wxStyledTextCtrl::GetLineSelStartPosition(int line
)
2889 return SendMsg(2424, line
, 0);
2892 // Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line).
2893 int wxStyledTextCtrl::GetLineSelEndPosition(int line
)
2895 return SendMsg(2425, line
, 0);
2898 // Move caret down one line, extending rectangular selection to new caret position.
2899 void wxStyledTextCtrl::LineDownRectExtend()
2901 SendMsg(2426, 0, 0);
2904 // Move caret up one line, extending rectangular selection to new caret position.
2905 void wxStyledTextCtrl::LineUpRectExtend()
2907 SendMsg(2427, 0, 0);
2910 // Move caret left one character, extending rectangular selection to new caret position.
2911 void wxStyledTextCtrl::CharLeftRectExtend()
2913 SendMsg(2428, 0, 0);
2916 // Move caret right one character, extending rectangular selection to new caret position.
2917 void wxStyledTextCtrl::CharRightRectExtend()
2919 SendMsg(2429, 0, 0);
2922 // Move caret to first position on line, extending rectangular selection to new caret position.
2923 void wxStyledTextCtrl::HomeRectExtend()
2925 SendMsg(2430, 0, 0);
2928 // Move caret to before first visible character on line.
2929 // If already there move to first character on line.
2930 // In either case, extend rectangular selection to new caret position.
2931 void wxStyledTextCtrl::VCHomeRectExtend()
2933 SendMsg(2431, 0, 0);
2936 // Move caret to last position on line, extending rectangular selection to new caret position.
2937 void wxStyledTextCtrl::LineEndRectExtend()
2939 SendMsg(2432, 0, 0);
2942 // Move caret one page up, extending rectangular selection to new caret position.
2943 void wxStyledTextCtrl::PageUpRectExtend()
2945 SendMsg(2433, 0, 0);
2948 // Move caret one page down, extending rectangular selection to new caret position.
2949 void wxStyledTextCtrl::PageDownRectExtend()
2951 SendMsg(2434, 0, 0);
2954 // Move caret to top of page, or one page up if already at top of page.
2955 void wxStyledTextCtrl::StutteredPageUp()
2957 SendMsg(2435, 0, 0);
2960 // Move caret to top of page, or one page up if already at top of page, extending selection to new caret position.
2961 void wxStyledTextCtrl::StutteredPageUpExtend()
2963 SendMsg(2436, 0, 0);
2966 // Move caret to bottom of page, or one page down if already at bottom of page.
2967 void wxStyledTextCtrl::StutteredPageDown()
2969 SendMsg(2437, 0, 0);
2972 // Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position.
2973 void wxStyledTextCtrl::StutteredPageDownExtend()
2975 SendMsg(2438, 0, 0);
2978 // Move caret left one word, position cursor at end of word.
2979 void wxStyledTextCtrl::WordLeftEnd()
2981 SendMsg(2439, 0, 0);
2984 // Move caret left one word, position cursor at end of word, extending selection to new caret position.
2985 void wxStyledTextCtrl::WordLeftEndExtend()
2987 SendMsg(2440, 0, 0);
2990 // Move caret right one word, position cursor at end of word.
2991 void wxStyledTextCtrl::WordRightEnd()
2993 SendMsg(2441, 0, 0);
2996 // Move caret right one word, position cursor at end of word, extending selection to new caret position.
2997 void wxStyledTextCtrl::WordRightEndExtend()
2999 SendMsg(2442, 0, 0);
3002 // Set the set of characters making up whitespace for when moving or selecting by word.
3003 // Should be called after SetWordChars.
3004 void wxStyledTextCtrl::SetWhitespaceChars(const wxString
& characters
)
3006 SendMsg(2443, 0, (long)(const char*)wx2stc(characters
));
3009 // Reset the set of characters for whitespace and word characters to the defaults.
3010 void wxStyledTextCtrl::SetCharsDefault()
3012 SendMsg(2444, 0, 0);
3015 // Get currently selected item position in the auto-completion list
3016 int wxStyledTextCtrl::AutoCompGetCurrent()
3018 return SendMsg(2445, 0, 0);
3021 // Enlarge the document to a particular size of text bytes.
3022 void wxStyledTextCtrl::Allocate(int bytes
)
3024 SendMsg(2446, bytes
, 0);
3027 // Find the position of a column on a line taking into account tabs and
3028 // multi-byte characters. If beyond end of line, return line end position.
3029 int wxStyledTextCtrl::FindColumn(int line
, int column
)
3031 return SendMsg(2456, line
, column
);
3034 // Can the caret preferred x position only be changed by explicit movement commands?
3035 bool wxStyledTextCtrl::GetCaretSticky() const
3037 return SendMsg(2457, 0, 0) != 0;
3040 // Stop the caret preferred x position changing when the user types.
3041 void wxStyledTextCtrl::SetCaretSticky(bool useCaretStickyBehaviour
)
3043 SendMsg(2458, useCaretStickyBehaviour
, 0);
3046 // Switch between sticky and non-sticky: meant to be bound to a key.
3047 void wxStyledTextCtrl::ToggleCaretSticky()
3049 SendMsg(2459, 0, 0);
3052 // Enable/Disable convert-on-paste for line endings
3053 void wxStyledTextCtrl::SetPasteConvertEndings(bool convert
)
3055 SendMsg(2467, convert
, 0);
3058 // Get convert-on-paste setting
3059 bool wxStyledTextCtrl::GetPasteConvertEndings() const
3061 return SendMsg(2468, 0, 0) != 0;
3064 // Duplicate the selection. If selection empty duplicate the line containing the caret.
3065 void wxStyledTextCtrl::SelectionDuplicate()
3067 SendMsg(2469, 0, 0);
3070 // Set background alpha of the caret line.
3071 void wxStyledTextCtrl::SetCaretLineBackAlpha(int alpha
)
3073 SendMsg(2470, alpha
, 0);
3076 // Get the background alpha of the caret line.
3077 int wxStyledTextCtrl::GetCaretLineBackAlpha() const
3079 return SendMsg(2471, 0, 0);
3082 // Set the style of the caret to be drawn.
3083 void wxStyledTextCtrl::SetCaretStyle(int caretStyle
)
3085 SendMsg(2512, caretStyle
, 0);
3088 // Returns the current style of the caret.
3089 int wxStyledTextCtrl::GetCaretStyle() const
3091 return SendMsg(2513, 0, 0);
3094 // Set the indicator used for IndicatorFillRange and IndicatorClearRange
3095 void wxStyledTextCtrl::SetIndicatorCurrent(int indicator
)
3097 SendMsg(2500, indicator
, 0);
3100 // Get the current indicator
3101 int wxStyledTextCtrl::GetIndicatorCurrent() const
3103 return SendMsg(2501, 0, 0);
3106 // Set the value used for IndicatorFillRange
3107 void wxStyledTextCtrl::SetIndicatorValue(int value
)
3109 SendMsg(2502, value
, 0);
3112 // Get the current indicator vaue
3113 int wxStyledTextCtrl::GetIndicatorValue() const
3115 return SendMsg(2503, 0, 0);
3118 // Turn a indicator on over a range.
3119 void wxStyledTextCtrl::IndicatorFillRange(int position
, int fillLength
)
3121 SendMsg(2504, position
, fillLength
);
3124 // Turn a indicator off over a range.
3125 void wxStyledTextCtrl::IndicatorClearRange(int position
, int clearLength
)
3127 SendMsg(2505, position
, clearLength
);
3130 // Are any indicators present at position?
3131 int wxStyledTextCtrl::IndicatorAllOnFor(int position
)
3133 return SendMsg(2506, position
, 0);
3136 // What value does a particular indicator have at at a position?
3137 int wxStyledTextCtrl::IndicatorValueAt(int indicator
, int position
)
3139 return SendMsg(2507, indicator
, position
);
3142 // Where does a particular indicator start?
3143 int wxStyledTextCtrl::IndicatorStart(int indicator
, int position
)
3145 return SendMsg(2508, indicator
, position
);
3148 // Where does a particular indicator end?
3149 int wxStyledTextCtrl::IndicatorEnd(int indicator
, int position
)
3151 return SendMsg(2509, indicator
, position
);
3154 // Set number of entries in position cache
3155 void wxStyledTextCtrl::SetPositionCacheSize(int size
)
3157 SendMsg(2514, size
, 0);
3160 // How many entries are allocated to the position cache?
3161 int wxStyledTextCtrl::GetPositionCacheSize() const
3163 return SendMsg(2515, 0, 0);
3166 // Start notifying the container of all key presses and commands.
3167 void wxStyledTextCtrl::StartRecord()
3169 SendMsg(3001, 0, 0);
3172 // Stop notifying the container of all key presses and commands.
3173 void wxStyledTextCtrl::StopRecord()
3175 SendMsg(3002, 0, 0);
3178 // Set the lexing language of the document.
3179 void wxStyledTextCtrl::SetLexer(int lexer
)
3181 SendMsg(4001, lexer
, 0);
3184 // Retrieve the lexing language of the document.
3185 int wxStyledTextCtrl::GetLexer() const
3187 return SendMsg(4002, 0, 0);
3190 // Colourise a segment of the document using the current lexing language.
3191 void wxStyledTextCtrl::Colourise(int start
, int end
)
3193 SendMsg(4003, start
, end
);
3196 // Set up a value that may be used by a lexer for some optional feature.
3197 void wxStyledTextCtrl::SetProperty(const wxString
& key
, const wxString
& value
)
3199 SendMsg(4004, (long)(const char*)wx2stc(key
), (long)(const char*)wx2stc(value
));
3202 // Set up the key words used by the lexer.
3203 void wxStyledTextCtrl::SetKeyWords(int keywordSet
, const wxString
& keyWords
)
3205 SendMsg(4005, keywordSet
, (long)(const char*)wx2stc(keyWords
));
3208 // Set the lexing language of the document based on string name.
3209 void wxStyledTextCtrl::SetLexerLanguage(const wxString
& language
)
3211 SendMsg(4006, 0, (long)(const char*)wx2stc(language
));
3214 // Retrieve a 'property' value previously set with SetProperty.
3215 wxString
wxStyledTextCtrl::GetProperty(const wxString
& key
) {
3216 int len
= SendMsg(SCI_GETPROPERTY
, (long)(const char*)wx2stc(key
), 0);
3217 if (!len
) return wxEmptyString
;
3219 wxMemoryBuffer
mbuf(len
+1);
3220 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3221 SendMsg(4008, (long)(const char*)wx2stc(key
), (long)buf
);
3222 mbuf
.UngetWriteBuf(len
);
3227 // Retrieve a 'property' value previously set with SetProperty,
3228 // with '$()' variable replacement on returned buffer.
3229 wxString
wxStyledTextCtrl::GetPropertyExpanded(const wxString
& key
) {
3230 int len
= SendMsg(SCI_GETPROPERTYEXPANDED
, (long)(const char*)wx2stc(key
), 0);
3231 if (!len
) return wxEmptyString
;
3233 wxMemoryBuffer
mbuf(len
+1);
3234 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3235 SendMsg(4009, (long)(const char*)wx2stc(key
), (long)buf
);
3236 mbuf
.UngetWriteBuf(len
);
3241 // Retrieve a 'property' value previously set with SetProperty,
3242 // interpreted as an int AFTER any '$()' variable replacement.
3243 int wxStyledTextCtrl::GetPropertyInt(const wxString
& key
) const
3245 return SendMsg(4010, (long)(const char*)wx2stc(key
), 0);
3248 // Retrieve the number of bits the current lexer needs for styling.
3249 int wxStyledTextCtrl::GetStyleBitsNeeded() const
3251 return SendMsg(4011, 0, 0);
3255 //----------------------------------------------------------------------
3258 // Returns the line number of the line with the caret.
3259 int wxStyledTextCtrl::GetCurrentLine() {
3260 int line
= LineFromPosition(GetCurrentPos());
3265 // Extract style settings from a spec-string which is composed of one or
3266 // more of the following comma separated elements:
3268 // bold turns on bold
3269 // italic turns on italics
3270 // fore:[name or #RRGGBB] sets the foreground colour
3271 // back:[name or #RRGGBB] sets the background colour
3272 // face:[facename] sets the font face name to use
3273 // size:[num] sets the font size in points
3274 // eol turns on eol filling
3275 // underline turns on underlining
3277 void wxStyledTextCtrl::StyleSetSpec(int styleNum
, const wxString
& spec
) {
3279 wxStringTokenizer
tkz(spec
, wxT(","));
3280 while (tkz
.HasMoreTokens()) {
3281 wxString token
= tkz
.GetNextToken();
3283 wxString option
= token
.BeforeFirst(':');
3284 wxString val
= token
.AfterFirst(':');
3286 if (option
== wxT("bold"))
3287 StyleSetBold(styleNum
, true);
3289 else if (option
== wxT("italic"))
3290 StyleSetItalic(styleNum
, true);
3292 else if (option
== wxT("underline"))
3293 StyleSetUnderline(styleNum
, true);
3295 else if (option
== wxT("eol"))
3296 StyleSetEOLFilled(styleNum
, true);
3298 else if (option
== wxT("size")) {
3300 if (val
.ToLong(&points
))
3301 StyleSetSize(styleNum
, points
);
3304 else if (option
== wxT("face"))
3305 StyleSetFaceName(styleNum
, val
);
3307 else if (option
== wxT("fore"))
3308 StyleSetForeground(styleNum
, wxColourFromSpec(val
));
3310 else if (option
== wxT("back"))
3311 StyleSetBackground(styleNum
, wxColourFromSpec(val
));
3316 // Get the font of a style
3317 wxFont
wxStyledTextCtrl::StyleGetFont(int style
) {
3319 font
.SetPointSize(StyleGetSize(style
));
3320 font
.SetFaceName(StyleGetFaceName(style
));
3321 if( StyleGetBold(style
) )
3322 font
.SetWeight(wxFONTWEIGHT_BOLD
);
3324 font
.SetWeight(wxFONTWEIGHT_NORMAL
);
3326 if( StyleGetItalic(style
) )
3327 font
.SetStyle(wxFONTSTYLE_ITALIC
);
3329 font
.SetStyle(wxFONTSTYLE_NORMAL
);
3335 // Set style size, face, bold, italic, and underline attributes from
3336 // a wxFont's attributes.
3337 void wxStyledTextCtrl::StyleSetFont(int styleNum
, wxFont
& font
) {
3339 // Ensure that the native font is initialized
3341 GetTextExtent(wxT("X"), &x
, &y
, NULL
, NULL
, &font
);
3343 int size
= font
.GetPointSize();
3344 wxString faceName
= font
.GetFaceName();
3345 bool bold
= font
.GetWeight() == wxBOLD
;
3346 bool italic
= font
.GetStyle() != wxNORMAL
;
3347 bool under
= font
.GetUnderlined();
3348 wxFontEncoding encoding
= font
.GetEncoding();
3350 StyleSetFontAttr(styleNum
, size
, faceName
, bold
, italic
, under
, encoding
);
3353 // Set all font style attributes at once.
3354 void wxStyledTextCtrl::StyleSetFontAttr(int styleNum
, int size
,
3355 const wxString
& faceName
,
3356 bool bold
, bool italic
,
3358 wxFontEncoding encoding
) {
3359 StyleSetSize(styleNum
, size
);
3360 StyleSetFaceName(styleNum
, faceName
);
3361 StyleSetBold(styleNum
, bold
);
3362 StyleSetItalic(styleNum
, italic
);
3363 StyleSetUnderline(styleNum
, underline
);
3364 StyleSetFontEncoding(styleNum
, encoding
);
3368 // Set the character set of the font in a style. Converts the Scintilla
3369 // character set values to a wxFontEncoding.
3370 void wxStyledTextCtrl::StyleSetCharacterSet(int style
, int characterSet
)
3372 wxFontEncoding encoding
;
3374 // Translate the Scintilla characterSet to a wxFontEncoding
3375 switch (characterSet
) {
3377 case wxSTC_CHARSET_ANSI
:
3378 case wxSTC_CHARSET_DEFAULT
:
3379 encoding
= wxFONTENCODING_DEFAULT
;
3382 case wxSTC_CHARSET_BALTIC
:
3383 encoding
= wxFONTENCODING_ISO8859_13
;
3386 case wxSTC_CHARSET_CHINESEBIG5
:
3387 encoding
= wxFONTENCODING_CP950
;
3390 case wxSTC_CHARSET_EASTEUROPE
:
3391 encoding
= wxFONTENCODING_ISO8859_2
;
3394 case wxSTC_CHARSET_GB2312
:
3395 encoding
= wxFONTENCODING_CP936
;
3398 case wxSTC_CHARSET_GREEK
:
3399 encoding
= wxFONTENCODING_ISO8859_7
;
3402 case wxSTC_CHARSET_HANGUL
:
3403 encoding
= wxFONTENCODING_CP949
;
3406 case wxSTC_CHARSET_MAC
:
3407 encoding
= wxFONTENCODING_DEFAULT
;
3410 case wxSTC_CHARSET_OEM
:
3411 encoding
= wxFONTENCODING_DEFAULT
;
3414 case wxSTC_CHARSET_RUSSIAN
:
3415 encoding
= wxFONTENCODING_KOI8
;
3418 case wxSTC_CHARSET_SHIFTJIS
:
3419 encoding
= wxFONTENCODING_CP932
;
3422 case wxSTC_CHARSET_SYMBOL
:
3423 encoding
= wxFONTENCODING_DEFAULT
;
3426 case wxSTC_CHARSET_TURKISH
:
3427 encoding
= wxFONTENCODING_ISO8859_9
;
3430 case wxSTC_CHARSET_JOHAB
:
3431 encoding
= wxFONTENCODING_DEFAULT
;
3434 case wxSTC_CHARSET_HEBREW
:
3435 encoding
= wxFONTENCODING_ISO8859_8
;
3438 case wxSTC_CHARSET_ARABIC
:
3439 encoding
= wxFONTENCODING_ISO8859_6
;
3442 case wxSTC_CHARSET_VIETNAMESE
:
3443 encoding
= wxFONTENCODING_DEFAULT
;
3446 case wxSTC_CHARSET_THAI
:
3447 encoding
= wxFONTENCODING_ISO8859_11
;
3450 case wxSTC_CHARSET_CYRILLIC
:
3451 encoding
= wxFONTENCODING_ISO8859_5
;
3454 case wxSTC_CHARSET_8859_15
:
3455 encoding
= wxFONTENCODING_ISO8859_15
;;
3459 // We just have Scintilla track the wxFontEncoding for us. It gets used
3460 // in Font::Create in PlatWX.cpp. We add one to the value so that the
3461 // effective wxFONENCODING_DEFAULT == SC_SHARSET_DEFAULT and so when
3462 // Scintilla internally uses SC_CHARSET_DEFAULT we will translate it back
3463 // to wxFONENCODING_DEFAULT in Font::Create.
3464 SendMsg(SCI_STYLESETCHARACTERSET
, style
, encoding
+1);
3468 // Set the font encoding to be used by a style.
3469 void wxStyledTextCtrl::StyleSetFontEncoding(int style
, wxFontEncoding encoding
)
3471 SendMsg(SCI_STYLESETCHARACTERSET
, style
, encoding
+1);
3475 // Perform one of the operations defined by the wxSTC_CMD_* constants.
3476 void wxStyledTextCtrl::CmdKeyExecute(int cmd
) {
3481 // Set the left and right margin in the edit area, measured in pixels.
3482 void wxStyledTextCtrl::SetMargins(int left
, int right
) {
3483 SetMarginLeft(left
);
3484 SetMarginRight(right
);
3488 // Retrieve the start and end positions of the current selection.
3489 void wxStyledTextCtrl::GetSelection(int* startPos
, int* endPos
) {
3490 if (startPos
!= NULL
)
3491 *startPos
= SendMsg(SCI_GETSELECTIONSTART
);
3493 *endPos
= SendMsg(SCI_GETSELECTIONEND
);
3497 // Retrieve the point in the window where a position is displayed.
3498 wxPoint
wxStyledTextCtrl::PointFromPosition(int pos
) {
3499 int x
= SendMsg(SCI_POINTXFROMPOSITION
, 0, pos
);
3500 int y
= SendMsg(SCI_POINTYFROMPOSITION
, 0, pos
);
3501 return wxPoint(x
, y
);
3504 // Scroll enough to make the given line visible
3505 void wxStyledTextCtrl::ScrollToLine(int line
) {
3506 m_swx
->DoScrollToLine(line
);
3510 // Scroll enough to make the given column visible
3511 void wxStyledTextCtrl::ScrollToColumn(int column
) {
3512 m_swx
->DoScrollToColumn(column
);
3516 bool wxStyledTextCtrl::SaveFile(const wxString
& filename
)
3518 wxFile
file(filename
, wxFile::write
);
3520 if (!file
.IsOpened())
3523 bool success
= file
.Write(GetText(), *wxConvCurrent
);
3531 bool wxStyledTextCtrl::LoadFile(const wxString
& filename
)
3533 bool success
= false;
3534 wxFile
file(filename
, wxFile::read
);
3536 if (file
.IsOpened())
3539 // get the file size (assume it is not huge file...)
3540 ssize_t len
= (ssize_t
)file
.Length();
3545 wxMemoryBuffer
buffer(len
+1);
3546 success
= (file
.Read(buffer
.GetData(), len
) == len
);
3548 ((char*)buffer
.GetData())[len
] = 0;
3549 contents
= wxString(buffer
, *wxConvCurrent
, len
);
3553 success
= (file
.Read(wxStringBuffer(buffer
, len
), len
) == len
);
3560 success
= true; // empty file is ok
3562 success
= false; // len == wxInvalidOffset
3577 #if wxUSE_DRAG_AND_DROP
3578 wxDragResult
wxStyledTextCtrl::DoDragOver(wxCoord x
, wxCoord y
, wxDragResult def
) {
3579 return m_swx
->DoDragOver(x
, y
, def
);
3583 bool wxStyledTextCtrl::DoDropText(long x
, long y
, const wxString
& data
) {
3584 return m_swx
->DoDropText(x
, y
, data
);
3589 void wxStyledTextCtrl::SetUseAntiAliasing(bool useAA
) {
3590 m_swx
->SetUseAntiAliasing(useAA
);
3593 bool wxStyledTextCtrl::GetUseAntiAliasing() {
3594 return m_swx
->GetUseAntiAliasing();
3601 void wxStyledTextCtrl::AddTextRaw(const char* text
)
3603 SendMsg(SCI_ADDTEXT
, strlen(text
), (long)text
);
3606 void wxStyledTextCtrl::InsertTextRaw(int pos
, const char* text
)
3608 SendMsg(SCI_INSERTTEXT
, pos
, (long)text
);
3611 wxCharBuffer
wxStyledTextCtrl::GetCurLineRaw(int* linePos
)
3613 int len
= LineLength(GetCurrentLine());
3615 if (linePos
) *linePos
= 0;
3620 wxCharBuffer
buf(len
);
3621 int pos
= SendMsg(SCI_GETCURLINE
, len
, (long)buf
.data());
3622 if (linePos
) *linePos
= pos
;
3626 wxCharBuffer
wxStyledTextCtrl::GetLineRaw(int line
)
3628 int len
= LineLength(line
);
3634 wxCharBuffer
buf(len
);
3635 SendMsg(SCI_GETLINE
, line
, (long)buf
.data());
3639 wxCharBuffer
wxStyledTextCtrl::GetSelectedTextRaw()
3644 GetSelection(&start
, &end
);
3645 int len
= end
- start
;
3651 wxCharBuffer
buf(len
);
3652 SendMsg(SCI_GETSELTEXT
, 0, (long)buf
.data());
3656 wxCharBuffer
wxStyledTextCtrl::GetTextRangeRaw(int startPos
, int endPos
)
3658 if (endPos
< startPos
) {
3659 int temp
= startPos
;
3663 int len
= endPos
- startPos
;
3669 wxCharBuffer
buf(len
);
3671 tr
.lpstrText
= buf
.data();
3672 tr
.chrg
.cpMin
= startPos
;
3673 tr
.chrg
.cpMax
= endPos
;
3674 SendMsg(SCI_GETTEXTRANGE
, 0, (long)&tr
);
3678 void wxStyledTextCtrl::SetTextRaw(const char* text
)
3680 SendMsg(SCI_SETTEXT
, 0, (long)text
);
3683 wxCharBuffer
wxStyledTextCtrl::GetTextRaw()
3685 int len
= GetTextLength();
3686 wxCharBuffer
buf(len
);
3687 SendMsg(SCI_GETTEXT
, len
, (long)buf
.data());
3691 void wxStyledTextCtrl::AppendTextRaw(const char* text
)
3693 SendMsg(SCI_APPENDTEXT
, strlen(text
), (long)text
);
3700 //----------------------------------------------------------------------
3703 void wxStyledTextCtrl::OnPaint(wxPaintEvent
& WXUNUSED(evt
)) {
3705 m_swx
->DoPaint(&dc
, GetUpdateRegion().GetBox());
3708 void wxStyledTextCtrl::OnScrollWin(wxScrollWinEvent
& evt
) {
3709 if (evt
.GetOrientation() == wxHORIZONTAL
)
3710 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
3712 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
3715 void wxStyledTextCtrl::OnScroll(wxScrollEvent
& evt
) {
3716 wxScrollBar
* sb
= wxDynamicCast(evt
.GetEventObject(), wxScrollBar
);
3718 if (sb
->IsVertical())
3719 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
3721 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
3725 void wxStyledTextCtrl::OnSize(wxSizeEvent
& WXUNUSED(evt
)) {
3727 wxSize sz
= GetClientSize();
3728 m_swx
->DoSize(sz
.x
, sz
.y
);
3732 void wxStyledTextCtrl::OnMouseLeftDown(wxMouseEvent
& evt
) {
3734 wxPoint pt
= evt
.GetPosition();
3735 m_swx
->DoLeftButtonDown(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
3736 evt
.ShiftDown(), evt
.ControlDown(), evt
.AltDown());
3739 void wxStyledTextCtrl::OnMouseMove(wxMouseEvent
& evt
) {
3740 wxPoint pt
= evt
.GetPosition();
3741 m_swx
->DoLeftButtonMove(Point(pt
.x
, pt
.y
));
3744 void wxStyledTextCtrl::OnMouseLeftUp(wxMouseEvent
& evt
) {
3745 wxPoint pt
= evt
.GetPosition();
3746 m_swx
->DoLeftButtonUp(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
3751 void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent
& evt
) {
3752 wxPoint pt
= evt
.GetPosition();
3753 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
3757 void wxStyledTextCtrl::OnMouseMiddleUp(wxMouseEvent
& evt
) {
3758 wxPoint pt
= evt
.GetPosition();
3759 m_swx
->DoMiddleButtonUp(Point(pt
.x
, pt
.y
));
3762 void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent
& evt
) {
3763 wxPoint pt
= evt
.GetPosition();
3764 ScreenToClient(&pt
.x
, &pt
.y
);
3766 Show context menu at event point if it's within the window,
3767 or at caret location if not
3769 wxHitTest ht
= this->HitTest(pt
);
3770 if (ht
!= wxHT_WINDOW_INSIDE
) {
3771 pt
= this->PointFromPosition(this->GetCurrentPos());
3773 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
3777 void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent
& evt
) {
3778 m_swx
->DoMouseWheel(evt
.GetWheelRotation(),
3779 evt
.GetWheelDelta(),
3780 evt
.GetLinesPerAction(),
3782 evt
.IsPageScroll());
3786 void wxStyledTextCtrl::OnChar(wxKeyEvent
& evt
) {
3787 // On (some?) non-US PC keyboards the AltGr key is required to enter some
3788 // common characters. It comes to us as both Alt and Ctrl down so we need
3789 // to let the char through in that case, otherwise if only ctrl or only
3790 // alt let's skip it.
3791 bool ctrl
= evt
.ControlDown();
3793 // On the Mac the Alt key is just a modifier key (like Shift) so we need
3794 // to allow the char events to be processed when Alt is pressed.
3795 // TODO: Should we check MetaDown instead in this case?
3798 bool alt
= evt
.AltDown();
3800 bool skip
= ((ctrl
|| alt
) && ! (ctrl
&& alt
));
3803 // apparently if we don't do this, Unicode keys pressed after non-char
3804 // ASCII ones (e.g. Enter, Tab) are not taken into account (patch 1615989)
3805 if (m_lastKeyDownConsumed
&& evt
.GetUnicodeKey() > 255)
3806 m_lastKeyDownConsumed
= false;
3809 if (!m_lastKeyDownConsumed
&& !skip
) {
3811 int key
= evt
.GetUnicodeKey();
3814 // if the unicode key code is not really a unicode character (it may
3815 // be a function key or etc., the platforms appear to always give us a
3816 // small value in this case) then fallback to the ascii key code but
3817 // don't do anything for function keys or etc.
3819 key
= evt
.GetKeyCode();
3820 keyOk
= (key
<= 127);
3823 m_swx
->DoAddChar(key
);
3827 int key
= evt
.GetKeyCode();
3828 if (key
<= WXK_START
|| key
> WXK_COMMAND
) {
3829 m_swx
->DoAddChar(key
);
3839 void wxStyledTextCtrl::OnKeyDown(wxKeyEvent
& evt
) {
3840 int processed
= m_swx
->DoKeyDown(evt
, &m_lastKeyDownConsumed
);
3841 if (!processed
&& !m_lastKeyDownConsumed
)
3846 void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent
& evt
) {
3847 m_swx
->DoLoseFocus();
3852 void wxStyledTextCtrl::OnGainFocus(wxFocusEvent
& evt
) {
3853 m_swx
->DoGainFocus();
3858 void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent
& WXUNUSED(evt
)) {
3859 m_swx
->DoSysColourChange();
3863 void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent
& WXUNUSED(evt
)) {
3864 // do nothing to help avoid flashing
3869 void wxStyledTextCtrl::OnMenu(wxCommandEvent
& evt
) {
3870 m_swx
->DoCommand(evt
.GetId());
3874 void wxStyledTextCtrl::OnListBox(wxCommandEvent
& WXUNUSED(evt
)) {
3875 m_swx
->DoOnListBox();
3879 void wxStyledTextCtrl::OnIdle(wxIdleEvent
& evt
) {
3880 m_swx
->DoOnIdle(evt
);
3884 wxSize
wxStyledTextCtrl::DoGetBestSize() const
3886 // What would be the best size for a wxSTC?
3887 // Just give a reasonable minimum until something else can be figured out.
3888 return wxSize(200,100);
3892 //----------------------------------------------------------------------
3893 // Turn notifications from Scintilla into events
3896 void wxStyledTextCtrl::NotifyChange() {
3897 wxStyledTextEvent
evt(wxEVT_STC_CHANGE
, GetId());
3898 evt
.SetEventObject(this);
3899 GetEventHandler()->ProcessEvent(evt
);
3903 static void SetEventText(wxStyledTextEvent
& evt
, const char* text
,
3907 evt
.SetText(stc2wx(text
, length
));
3911 void wxStyledTextCtrl::NotifyParent(SCNotification
* _scn
) {
3912 SCNotification
& scn
= *_scn
;
3913 wxStyledTextEvent
evt(0, GetId());
3915 evt
.SetEventObject(this);
3916 evt
.SetPosition(scn
.position
);
3918 evt
.SetModifiers(scn
.modifiers
);
3920 switch (scn
.nmhdr
.code
) {
3921 case SCN_STYLENEEDED
:
3922 evt
.SetEventType(wxEVT_STC_STYLENEEDED
);
3926 evt
.SetEventType(wxEVT_STC_CHARADDED
);
3929 case SCN_SAVEPOINTREACHED
:
3930 evt
.SetEventType(wxEVT_STC_SAVEPOINTREACHED
);
3933 case SCN_SAVEPOINTLEFT
:
3934 evt
.SetEventType(wxEVT_STC_SAVEPOINTLEFT
);
3937 case SCN_MODIFYATTEMPTRO
:
3938 evt
.SetEventType(wxEVT_STC_ROMODIFYATTEMPT
);
3942 evt
.SetEventType(wxEVT_STC_KEY
);
3945 case SCN_DOUBLECLICK
:
3946 evt
.SetEventType(wxEVT_STC_DOUBLECLICK
);
3950 evt
.SetEventType(wxEVT_STC_UPDATEUI
);
3954 evt
.SetEventType(wxEVT_STC_MODIFIED
);
3955 evt
.SetModificationType(scn
.modificationType
);
3956 SetEventText(evt
, scn
.text
, scn
.length
);
3957 evt
.SetLength(scn
.length
);
3958 evt
.SetLinesAdded(scn
.linesAdded
);
3959 evt
.SetLine(scn
.line
);
3960 evt
.SetFoldLevelNow(scn
.foldLevelNow
);
3961 evt
.SetFoldLevelPrev(scn
.foldLevelPrev
);
3964 case SCN_MACRORECORD
:
3965 evt
.SetEventType(wxEVT_STC_MACRORECORD
);
3966 evt
.SetMessage(scn
.message
);
3967 evt
.SetWParam(scn
.wParam
);
3968 evt
.SetLParam(scn
.lParam
);
3971 case SCN_MARGINCLICK
:
3972 evt
.SetEventType(wxEVT_STC_MARGINCLICK
);
3973 evt
.SetMargin(scn
.margin
);
3977 evt
.SetEventType(wxEVT_STC_NEEDSHOWN
);
3978 evt
.SetLength(scn
.length
);
3982 evt
.SetEventType(wxEVT_STC_PAINTED
);
3985 case SCN_AUTOCSELECTION
:
3986 evt
.SetEventType(wxEVT_STC_AUTOCOMP_SELECTION
);
3987 evt
.SetListType(scn
.listType
);
3988 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
3989 evt
.SetPosition(scn
.lParam
);
3992 case SCN_USERLISTSELECTION
:
3993 evt
.SetEventType(wxEVT_STC_USERLISTSELECTION
);
3994 evt
.SetListType(scn
.listType
);
3995 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
3996 evt
.SetPosition(scn
.lParam
);
3999 case SCN_URIDROPPED
:
4000 evt
.SetEventType(wxEVT_STC_URIDROPPED
);
4001 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
4004 case SCN_DWELLSTART
:
4005 evt
.SetEventType(wxEVT_STC_DWELLSTART
);
4011 evt
.SetEventType(wxEVT_STC_DWELLEND
);
4017 evt
.SetEventType(wxEVT_STC_ZOOM
);
4020 case SCN_HOTSPOTCLICK
:
4021 evt
.SetEventType(wxEVT_STC_HOTSPOT_CLICK
);
4024 case SCN_HOTSPOTDOUBLECLICK
:
4025 evt
.SetEventType(wxEVT_STC_HOTSPOT_DCLICK
);
4028 case SCN_CALLTIPCLICK
:
4029 evt
.SetEventType(wxEVT_STC_CALLTIP_CLICK
);
4032 case SCN_INDICATORCLICK
:
4033 evt
.SetEventType(wxEVT_STC_INDICATOR_CLICK
);
4036 case SCN_INDICATORRELEASE
:
4037 evt
.SetEventType(wxEVT_STC_INDICATOR_RELEASE
);
4044 GetEventHandler()->ProcessEvent(evt
);
4048 //----------------------------------------------------------------------
4049 //----------------------------------------------------------------------
4050 //----------------------------------------------------------------------
4052 wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType
, int id
)
4053 : wxCommandEvent(commandType
, id
)
4058 m_modificationType
= 0;
4063 m_foldLevelPrev
= 0;
4071 m_dragAllowMove
= false;
4072 #if wxUSE_DRAG_AND_DROP
4073 m_dragResult
= wxDragNone
;
4077 bool wxStyledTextEvent::GetShift() const { return (m_modifiers
& SCI_SHIFT
) != 0; }
4078 bool wxStyledTextEvent::GetControl() const { return (m_modifiers
& SCI_CTRL
) != 0; }
4079 bool wxStyledTextEvent::GetAlt() const { return (m_modifiers
& SCI_ALT
) != 0; }
4082 wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent
& event
):
4083 wxCommandEvent(event
)
4085 m_position
= event
.m_position
;
4086 m_key
= event
.m_key
;
4087 m_modifiers
= event
.m_modifiers
;
4088 m_modificationType
= event
.m_modificationType
;
4089 m_text
= event
.m_text
;
4090 m_length
= event
.m_length
;
4091 m_linesAdded
= event
.m_linesAdded
;
4092 m_line
= event
.m_line
;
4093 m_foldLevelNow
= event
.m_foldLevelNow
;
4094 m_foldLevelPrev
= event
.m_foldLevelPrev
;
4096 m_margin
= event
.m_margin
;
4098 m_message
= event
.m_message
;
4099 m_wParam
= event
.m_wParam
;
4100 m_lParam
= event
.m_lParam
;
4102 m_listType
= event
.m_listType
;
4106 m_dragText
= event
.m_dragText
;
4107 m_dragAllowMove
=event
.m_dragAllowMove
;
4108 #if wxUSE_DRAG_AND_DROP
4109 m_dragResult
= event
.m_dragResult
;
4113 //----------------------------------------------------------------------
4114 //----------------------------------------------------------------------