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 /////////////////////////////////////////////////////////////////////////////
18 // For compilers that support precompilation, includes "wx.h".
19 #include "wx/wxprec.h"
27 #include "wx/stc/stc.h"
28 #include "wx/stc/private.h"
36 #include "wx/tokenzr.h"
37 #include "wx/mstream.h"
41 #include "ScintillaWX.h"
43 //----------------------------------------------------------------------
45 const wxChar
* wxSTCNameStr
= wxT("stcwindow");
51 #define MAKELONG(a, b) ((a) | ((b) << 16))
54 static long wxColourAsLong(const wxColour
& co
) {
55 return (((long)co
.Blue() << 16) |
56 ((long)co
.Green() << 8) |
60 static wxColour
wxColourFromLong(long c
) {
62 clr
.Set((unsigned char)(c
& 0xff),
63 (unsigned char)((c
>> 8) & 0xff),
64 (unsigned char)((c
>> 16) & 0xff));
69 static wxColour
wxColourFromSpec(const wxString
& spec
) {
70 // spec should be a colour name or "#RRGGBB"
71 if (spec
.GetChar(0) == wxT('#')) {
73 long red
, green
, blue
;
74 red
= green
= blue
= 0;
75 spec
.Mid(1,2).ToLong(&red
, 16);
76 spec
.Mid(3,2).ToLong(&green
, 16);
77 spec
.Mid(5,2).ToLong(&blue
, 16);
78 return wxColour((unsigned char)red
,
83 return wxColour(spec
);
86 //----------------------------------------------------------------------
88 DEFINE_EVENT_TYPE( wxEVT_STC_CHANGE
)
89 DEFINE_EVENT_TYPE( wxEVT_STC_STYLENEEDED
)
90 DEFINE_EVENT_TYPE( wxEVT_STC_CHARADDED
)
91 DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTREACHED
)
92 DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTLEFT
)
93 DEFINE_EVENT_TYPE( wxEVT_STC_ROMODIFYATTEMPT
)
94 DEFINE_EVENT_TYPE( wxEVT_STC_KEY
)
95 DEFINE_EVENT_TYPE( wxEVT_STC_DOUBLECLICK
)
96 DEFINE_EVENT_TYPE( wxEVT_STC_UPDATEUI
)
97 DEFINE_EVENT_TYPE( wxEVT_STC_MODIFIED
)
98 DEFINE_EVENT_TYPE( wxEVT_STC_MACRORECORD
)
99 DEFINE_EVENT_TYPE( wxEVT_STC_MARGINCLICK
)
100 DEFINE_EVENT_TYPE( wxEVT_STC_NEEDSHOWN
)
101 DEFINE_EVENT_TYPE( wxEVT_STC_PAINTED
)
102 DEFINE_EVENT_TYPE( wxEVT_STC_USERLISTSELECTION
)
103 DEFINE_EVENT_TYPE( wxEVT_STC_URIDROPPED
)
104 DEFINE_EVENT_TYPE( wxEVT_STC_DWELLSTART
)
105 DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND
)
106 DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG
)
107 DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER
)
108 DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP
)
109 DEFINE_EVENT_TYPE( wxEVT_STC_ZOOM
)
110 DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_CLICK
)
111 DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_DCLICK
)
112 DEFINE_EVENT_TYPE( wxEVT_STC_CALLTIP_CLICK
)
113 DEFINE_EVENT_TYPE( wxEVT_STC_AUTOCOMP_SELECTION
)
114 DEFINE_EVENT_TYPE( wxEVT_STC_INDICATOR_CLICK
)
115 DEFINE_EVENT_TYPE( wxEVT_STC_INDICATOR_RELEASE
)
119 BEGIN_EVENT_TABLE(wxStyledTextCtrl
, wxControl
)
120 EVT_PAINT (wxStyledTextCtrl::OnPaint
)
121 EVT_SCROLLWIN (wxStyledTextCtrl::OnScrollWin
)
122 EVT_SCROLL (wxStyledTextCtrl::OnScroll
)
123 EVT_SIZE (wxStyledTextCtrl::OnSize
)
124 EVT_LEFT_DOWN (wxStyledTextCtrl::OnMouseLeftDown
)
125 // Let Scintilla see the double click as a second click
126 EVT_LEFT_DCLICK (wxStyledTextCtrl::OnMouseLeftDown
)
127 EVT_MOTION (wxStyledTextCtrl::OnMouseMove
)
128 EVT_LEFT_UP (wxStyledTextCtrl::OnMouseLeftUp
)
129 #if defined(__WXGTK__) || defined(__WXMAC__)
130 EVT_RIGHT_UP (wxStyledTextCtrl::OnMouseRightUp
)
132 EVT_CONTEXT_MENU (wxStyledTextCtrl::OnContextMenu
)
134 EVT_MOUSEWHEEL (wxStyledTextCtrl::OnMouseWheel
)
135 EVT_MIDDLE_UP (wxStyledTextCtrl::OnMouseMiddleUp
)
136 EVT_CHAR (wxStyledTextCtrl::OnChar
)
137 EVT_KEY_DOWN (wxStyledTextCtrl::OnKeyDown
)
138 EVT_KILL_FOCUS (wxStyledTextCtrl::OnLoseFocus
)
139 EVT_SET_FOCUS (wxStyledTextCtrl::OnGainFocus
)
140 EVT_SYS_COLOUR_CHANGED (wxStyledTextCtrl::OnSysColourChanged
)
141 EVT_ERASE_BACKGROUND (wxStyledTextCtrl::OnEraseBackground
)
142 EVT_MENU_RANGE (10, 16, wxStyledTextCtrl::OnMenu
)
143 EVT_LISTBOX_DCLICK (wxID_ANY
, wxStyledTextCtrl::OnListBox
)
147 IMPLEMENT_CLASS(wxStyledTextCtrl
, wxControl
)
148 IMPLEMENT_DYNAMIC_CLASS(wxStyledTextEvent
, wxCommandEvent
)
151 // forces the linking of the lexer modules
152 int Scintilla_LinkLexers();
155 //----------------------------------------------------------------------
156 // Constructor and Destructor
158 wxStyledTextCtrl::wxStyledTextCtrl(wxWindow
*parent
,
163 const wxString
& name
)
166 Create(parent
, id
, pos
, size
, style
, name
);
170 bool wxStyledTextCtrl::Create(wxWindow
*parent
,
175 const wxString
& name
)
177 style
|= wxVSCROLL
| wxHSCROLL
;
178 if (!wxControl::Create(parent
, id
, pos
, size
,
179 style
| wxWANTS_CHARS
| wxCLIP_CHILDREN
,
180 wxDefaultValidator
, name
))
184 Scintilla_LinkLexers();
186 m_swx
= new ScintillaWX(this);
188 m_lastKeyDownConsumed
= false;
192 // Put Scintilla into unicode (UTF-8) mode
193 SetCodePage(wxSTC_CP_UTF8
);
196 SetInitialSize(size
);
198 // Reduces flicker on GTK+/X11
199 SetBackgroundStyle(wxBG_STYLE_CUSTOM
);
201 // Make sure it can take the focus
208 wxStyledTextCtrl::~wxStyledTextCtrl() {
213 //----------------------------------------------------------------------
215 long wxStyledTextCtrl::SendMsg(int msg
, long wp
, long lp
) {
217 return m_swx
->WndProc(msg
, wp
, lp
);
220 //----------------------------------------------------------------------
222 // Set the vertical scrollbar to use instead of the ont that's built-in.
223 void wxStyledTextCtrl::SetVScrollBar(wxScrollBar
* bar
) {
226 // ensure that the built-in scrollbar is not visible
227 SetScrollbar(wxVERTICAL
, 0, 0, 0);
232 // Set the horizontal scrollbar to use instead of the ont that's built-in.
233 void wxStyledTextCtrl::SetHScrollBar(wxScrollBar
* bar
) {
236 // ensure that the built-in scrollbar is not visible
237 SetScrollbar(wxHORIZONTAL
, 0, 0, 0);
241 //----------------------------------------------------------------------
242 // BEGIN generated section. The following code is automatically generated
243 // by gen_iface.py from the contents of Scintilla.iface. Do not edit
244 // this file. Edit stc.cpp.in or gen_iface.py instead and regenerate.
247 // Add text to the document at current position.
248 void wxStyledTextCtrl::AddText(const wxString
& text
) {
249 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
250 SendMsg(2001, strlen(buf
), (long)(const char*)buf
);
253 // Add array of cells to document.
254 void wxStyledTextCtrl::AddStyledText(const wxMemoryBuffer
& data
) {
255 SendMsg(2002, data
.GetDataLen(), (long)data
.GetData());
258 // Insert string at a position.
259 void wxStyledTextCtrl::InsertText(int pos
, const wxString
& text
) {
260 SendMsg(2003, pos
, (long)(const char*)wx2stc(text
));
263 // Delete all text in the document.
264 void wxStyledTextCtrl::ClearAll() {
268 // Set all style bytes to 0, remove all folding information.
269 void wxStyledTextCtrl::ClearDocumentStyle() {
273 // Returns the number of characters in the document.
274 int wxStyledTextCtrl::GetLength() {
275 return SendMsg(2006, 0, 0);
278 // Returns the character byte at the position.
279 int wxStyledTextCtrl::GetCharAt(int pos
) {
280 return (unsigned char)SendMsg(2007, pos
, 0);
283 // Returns the position of the caret.
284 int wxStyledTextCtrl::GetCurrentPos() {
285 return SendMsg(2008, 0, 0);
288 // Returns the position of the opposite end of the selection to the caret.
289 int wxStyledTextCtrl::GetAnchor() {
290 return SendMsg(2009, 0, 0);
293 // Returns the style byte at the position.
294 int wxStyledTextCtrl::GetStyleAt(int pos
) {
295 return (unsigned char)SendMsg(2010, pos
, 0);
298 // Redoes the next action on the undo history.
299 void wxStyledTextCtrl::Redo() {
303 // Choose between collecting actions into the undo
304 // history and discarding them.
305 void wxStyledTextCtrl::SetUndoCollection(bool collectUndo
) {
306 SendMsg(2012, collectUndo
, 0);
309 // Select all the text in the document.
310 void wxStyledTextCtrl::SelectAll() {
314 // Remember the current position in the undo history as the position
315 // at which the document was saved.
316 void wxStyledTextCtrl::SetSavePoint() {
320 // Retrieve a buffer of cells.
321 wxMemoryBuffer
wxStyledTextCtrl::GetStyledText(int startPos
, int endPos
) {
323 if (endPos
< startPos
) {
328 int len
= endPos
- startPos
;
329 if (!len
) return buf
;
331 tr
.lpstrText
= (char*)buf
.GetWriteBuf(len
*2+1);
332 tr
.chrg
.cpMin
= startPos
;
333 tr
.chrg
.cpMax
= endPos
;
334 len
= SendMsg(2015, 0, (long)&tr
);
335 buf
.UngetWriteBuf(len
);
339 // Are there any redoable actions in the undo history?
340 bool wxStyledTextCtrl::CanRedo() {
341 return SendMsg(2016, 0, 0) != 0;
344 // Retrieve the line number at which a particular marker is located.
345 int wxStyledTextCtrl::MarkerLineFromHandle(int handle
) {
346 return SendMsg(2017, handle
, 0);
350 void wxStyledTextCtrl::MarkerDeleteHandle(int handle
) {
351 SendMsg(2018, handle
, 0);
354 // Is undo history being collected?
355 bool wxStyledTextCtrl::GetUndoCollection() {
356 return SendMsg(2019, 0, 0) != 0;
359 // Are white space characters currently visible?
360 // Returns one of SCWS_* constants.
361 int wxStyledTextCtrl::GetViewWhiteSpace() {
362 return SendMsg(2020, 0, 0);
365 // Make white space characters invisible, always visible or visible outside indentation.
366 void wxStyledTextCtrl::SetViewWhiteSpace(int viewWS
) {
367 SendMsg(2021, viewWS
, 0);
370 // Find the position from a point within the window.
371 int wxStyledTextCtrl::PositionFromPoint(wxPoint pt
) {
372 return SendMsg(2022, pt
.x
, pt
.y
);
375 // Find the position from a point within the window but return
376 // INVALID_POSITION if not close to text.
377 int wxStyledTextCtrl::PositionFromPointClose(int x
, int y
) {
378 return SendMsg(2023, x
, y
);
381 // Set caret to start of a line and ensure it is visible.
382 void wxStyledTextCtrl::GotoLine(int line
) {
383 SendMsg(2024, line
, 0);
386 // Set caret to a position and ensure it is visible.
387 void wxStyledTextCtrl::GotoPos(int pos
) {
388 SendMsg(2025, pos
, 0);
391 // Set the selection anchor to a position. The anchor is the opposite
392 // end of the selection from the caret.
393 void wxStyledTextCtrl::SetAnchor(int posAnchor
) {
394 SendMsg(2026, posAnchor
, 0);
397 // Retrieve the text of the line containing the caret.
398 // Returns the index of the caret on the line.
399 wxString
wxStyledTextCtrl::GetCurLine(int* linePos
) {
400 int len
= LineLength(GetCurrentLine());
402 if (linePos
) *linePos
= 0;
403 return wxEmptyString
;
406 wxMemoryBuffer
mbuf(len
+1);
407 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
409 int pos
= SendMsg(2027, len
+1, (long)buf
);
410 mbuf
.UngetWriteBuf(len
);
412 if (linePos
) *linePos
= pos
;
416 // Retrieve the position of the last correctly styled character.
417 int wxStyledTextCtrl::GetEndStyled() {
418 return SendMsg(2028, 0, 0);
421 // Convert all line endings in the document to one mode.
422 void wxStyledTextCtrl::ConvertEOLs(int eolMode
) {
423 SendMsg(2029, eolMode
, 0);
426 // Retrieve the current end of line mode - one of CRLF, CR, or LF.
427 int wxStyledTextCtrl::GetEOLMode() {
428 return SendMsg(2030, 0, 0);
431 // Set the current end of line mode.
432 void wxStyledTextCtrl::SetEOLMode(int eolMode
) {
433 SendMsg(2031, eolMode
, 0);
436 // Set the current styling position to pos and the styling mask to mask.
437 // The styling mask can be used to protect some bits in each styling byte from modification.
438 void wxStyledTextCtrl::StartStyling(int pos
, int mask
) {
439 SendMsg(2032, pos
, mask
);
442 // Change style from current styling position for length characters to a style
443 // and move the current styling position to after this newly styled segment.
444 void wxStyledTextCtrl::SetStyling(int length
, int style
) {
445 SendMsg(2033, length
, style
);
448 // Is drawing done first into a buffer or direct to the screen?
449 bool wxStyledTextCtrl::GetBufferedDraw() {
450 return SendMsg(2034, 0, 0) != 0;
453 // If drawing is buffered then each line of text is drawn into a bitmap buffer
454 // before drawing it to the screen to avoid flicker.
455 void wxStyledTextCtrl::SetBufferedDraw(bool buffered
) {
456 SendMsg(2035, buffered
, 0);
459 // Change the visible size of a tab to be a multiple of the width of a space character.
460 void wxStyledTextCtrl::SetTabWidth(int tabWidth
) {
461 SendMsg(2036, tabWidth
, 0);
464 // Retrieve the visible size of a tab.
465 int wxStyledTextCtrl::GetTabWidth() {
466 return SendMsg(2121, 0, 0);
469 // Set the code page used to interpret the bytes of the document as characters.
470 void wxStyledTextCtrl::SetCodePage(int codePage
) {
472 wxASSERT_MSG(codePage
== wxSTC_CP_UTF8
,
473 wxT("Only wxSTC_CP_UTF8 may be used when wxUSE_UNICODE is on."));
475 wxASSERT_MSG(codePage
!= wxSTC_CP_UTF8
,
476 wxT("wxSTC_CP_UTF8 may not be used when wxUSE_UNICODE is off."));
478 SendMsg(2037, codePage
);
481 // Set the symbol used for a particular marker number,
482 // and optionally the fore and background colours.
483 void wxStyledTextCtrl::MarkerDefine(int markerNumber
, int markerSymbol
,
484 const wxColour
& foreground
,
485 const wxColour
& background
) {
487 SendMsg(2040, markerNumber
, markerSymbol
);
489 MarkerSetForeground(markerNumber
, foreground
);
491 MarkerSetBackground(markerNumber
, background
);
494 // Set the foreground colour used for a particular marker number.
495 void wxStyledTextCtrl::MarkerSetForeground(int markerNumber
, const wxColour
& fore
) {
496 SendMsg(2041, markerNumber
, wxColourAsLong(fore
));
499 // Set the background colour used for a particular marker number.
500 void wxStyledTextCtrl::MarkerSetBackground(int markerNumber
, const wxColour
& back
) {
501 SendMsg(2042, markerNumber
, wxColourAsLong(back
));
504 // Add a marker to a line, returning an ID which can be used to find or delete the marker.
505 int wxStyledTextCtrl::MarkerAdd(int line
, int markerNumber
) {
506 return SendMsg(2043, line
, markerNumber
);
509 // Delete a marker from a line.
510 void wxStyledTextCtrl::MarkerDelete(int line
, int markerNumber
) {
511 SendMsg(2044, line
, markerNumber
);
514 // Delete all markers with a particular number from all lines.
515 void wxStyledTextCtrl::MarkerDeleteAll(int markerNumber
) {
516 SendMsg(2045, markerNumber
, 0);
519 // Get a bit mask of all the markers set on a line.
520 int wxStyledTextCtrl::MarkerGet(int line
) {
521 return SendMsg(2046, line
, 0);
524 // Find the next line after lineStart that includes a marker in mask.
525 int wxStyledTextCtrl::MarkerNext(int lineStart
, int markerMask
) {
526 return SendMsg(2047, lineStart
, markerMask
);
529 // Find the previous line before lineStart that includes a marker in mask.
530 int wxStyledTextCtrl::MarkerPrevious(int lineStart
, int markerMask
) {
531 return SendMsg(2048, lineStart
, markerMask
);
534 // Define a marker from a bitmap
535 void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber
, const wxBitmap
& bmp
) {
536 // convert bmp to a xpm in a string
537 wxMemoryOutputStream strm
;
538 wxImage img
= bmp
.ConvertToImage();
540 img
.ConvertAlphaToMask();
541 img
.SaveFile(strm
, wxBITMAP_TYPE_XPM
);
542 size_t len
= strm
.GetSize();
543 char* buff
= new char[len
+1];
544 strm
.CopyTo(buff
, len
);
546 SendMsg(2049, markerNumber
, (long)buff
);
551 // Add a set of markers to a line.
552 void wxStyledTextCtrl::MarkerAddSet(int line
, int set
) {
553 SendMsg(2466, line
, set
);
556 // Set the alpha used for a marker that is drawn in the text area, not the margin.
557 void wxStyledTextCtrl::MarkerSetAlpha(int markerNumber
, int alpha
) {
558 SendMsg(2476, markerNumber
, alpha
);
561 // Set a margin to be either numeric or symbolic.
562 void wxStyledTextCtrl::SetMarginType(int margin
, int marginType
) {
563 SendMsg(2240, margin
, marginType
);
566 // Retrieve the type of a margin.
567 int wxStyledTextCtrl::GetMarginType(int margin
) {
568 return SendMsg(2241, margin
, 0);
571 // Set the width of a margin to a width expressed in pixels.
572 void wxStyledTextCtrl::SetMarginWidth(int margin
, int pixelWidth
) {
573 SendMsg(2242, margin
, pixelWidth
);
576 // Retrieve the width of a margin in pixels.
577 int wxStyledTextCtrl::GetMarginWidth(int margin
) {
578 return SendMsg(2243, margin
, 0);
581 // Set a mask that determines which markers are displayed in a margin.
582 void wxStyledTextCtrl::SetMarginMask(int margin
, int mask
) {
583 SendMsg(2244, margin
, mask
);
586 // Retrieve the marker mask of a margin.
587 int wxStyledTextCtrl::GetMarginMask(int margin
) {
588 return SendMsg(2245, margin
, 0);
591 // Make a margin sensitive or insensitive to mouse clicks.
592 void wxStyledTextCtrl::SetMarginSensitive(int margin
, bool sensitive
) {
593 SendMsg(2246, margin
, sensitive
);
596 // Retrieve the mouse click sensitivity of a margin.
597 bool wxStyledTextCtrl::GetMarginSensitive(int margin
) {
598 return SendMsg(2247, margin
, 0) != 0;
601 // Clear all the styles and make equivalent to the global default style.
602 void wxStyledTextCtrl::StyleClearAll() {
606 // Set the foreground colour of a style.
607 void wxStyledTextCtrl::StyleSetForeground(int style
, const wxColour
& fore
) {
608 SendMsg(2051, style
, wxColourAsLong(fore
));
611 // Set the background colour of a style.
612 void wxStyledTextCtrl::StyleSetBackground(int style
, const wxColour
& back
) {
613 SendMsg(2052, style
, wxColourAsLong(back
));
616 // Set a style to be bold or not.
617 void wxStyledTextCtrl::StyleSetBold(int style
, bool bold
) {
618 SendMsg(2053, style
, bold
);
621 // Set a style to be italic or not.
622 void wxStyledTextCtrl::StyleSetItalic(int style
, bool italic
) {
623 SendMsg(2054, style
, italic
);
626 // Set the size of characters of a style.
627 void wxStyledTextCtrl::StyleSetSize(int style
, int sizePoints
) {
628 SendMsg(2055, style
, sizePoints
);
631 // Set the font of a style.
632 void wxStyledTextCtrl::StyleSetFaceName(int style
, const wxString
& fontName
) {
633 SendMsg(2056, style
, (long)(const char*)wx2stc(fontName
));
636 // Set a style to have its end of line filled or not.
637 void wxStyledTextCtrl::StyleSetEOLFilled(int style
, bool filled
) {
638 SendMsg(2057, style
, filled
);
641 // Reset the default style to its state at startup
642 void wxStyledTextCtrl::StyleResetDefault() {
646 // Set a style to be underlined or not.
647 void wxStyledTextCtrl::StyleSetUnderline(int style
, bool underline
) {
648 SendMsg(2059, style
, underline
);
651 // Get the foreground colour of a style.
652 wxColour
wxStyledTextCtrl::StyleGetForeground(int style
) {
653 long c
= SendMsg(2481, style
, 0);
654 return wxColourFromLong(c
);
657 // Get the background colour of a style.
658 wxColour
wxStyledTextCtrl::StyleGetBackground(int style
) {
659 long c
= SendMsg(2482, style
, 0);
660 return wxColourFromLong(c
);
663 // Get is a style bold or not.
664 bool wxStyledTextCtrl::StyleGetBold(int style
) {
665 return SendMsg(2483, style
, 0) != 0;
668 // Get is a style italic or not.
669 bool wxStyledTextCtrl::StyleGetItalic(int style
) {
670 return SendMsg(2484, style
, 0) != 0;
673 // Get the size of characters of a style.
674 int wxStyledTextCtrl::StyleGetSize(int style
) {
675 return SendMsg(2485, style
, 0);
678 // Get the font facename of a style
679 wxString
wxStyledTextCtrl::StyleGetFaceName(int style
) {
681 long len
= SendMsg(msg
, style
, 0);
682 wxMemoryBuffer
mbuf(len
+1);
683 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
684 SendMsg(msg
, style
, (long)buf
);
685 mbuf
.UngetWriteBuf(len
);
690 // Get is a style to have its end of line filled or not.
691 bool wxStyledTextCtrl::StyleGetEOLFilled(int style
) {
692 return SendMsg(2487, style
, 0) != 0;
695 // Get is a style underlined or not.
696 bool wxStyledTextCtrl::StyleGetUnderline(int style
) {
697 return SendMsg(2488, style
, 0) != 0;
700 // Get is a style mixed case, or to force upper or lower case.
701 int wxStyledTextCtrl::StyleGetCase(int style
) {
702 return SendMsg(2489, style
, 0);
705 // Get the character set of the font in a style.
706 int wxStyledTextCtrl::StyleGetCharacterSet(int style
) {
707 return SendMsg(2490, style
, 0);
710 // Get is a style visible or not.
711 bool wxStyledTextCtrl::StyleGetVisible(int style
) {
712 return SendMsg(2491, style
, 0) != 0;
715 // Get is a style changeable or not (read only).
716 // Experimental feature, currently buggy.
717 bool wxStyledTextCtrl::StyleGetChangeable(int style
) {
718 return SendMsg(2492, style
, 0) != 0;
721 // Get is a style a hotspot or not.
722 bool wxStyledTextCtrl::StyleGetHotSpot(int style
) {
723 return SendMsg(2493, style
, 0) != 0;
726 // Set a style to be mixed case, or to force upper or lower case.
727 void wxStyledTextCtrl::StyleSetCase(int style
, int caseForce
) {
728 SendMsg(2060, style
, caseForce
);
731 // Set a style to be a hotspot or not.
732 void wxStyledTextCtrl::StyleSetHotSpot(int style
, bool hotspot
) {
733 SendMsg(2409, style
, hotspot
);
736 // Set the foreground colour of the selection and whether to use this setting.
737 void wxStyledTextCtrl::SetSelForeground(bool useSetting
, const wxColour
& fore
) {
738 SendMsg(2067, useSetting
, wxColourAsLong(fore
));
741 // Set the background colour of the selection and whether to use this setting.
742 void wxStyledTextCtrl::SetSelBackground(bool useSetting
, const wxColour
& back
) {
743 SendMsg(2068, useSetting
, wxColourAsLong(back
));
746 // Get the alpha of the selection.
747 int wxStyledTextCtrl::GetSelAlpha() {
748 return SendMsg(2477, 0, 0);
751 // Set the alpha of the selection.
752 void wxStyledTextCtrl::SetSelAlpha(int alpha
) {
753 SendMsg(2478, alpha
, 0);
756 // Is the selection end of line filled?
757 bool wxStyledTextCtrl::GetSelEOLFilled() {
758 return SendMsg(2479, 0, 0) != 0;
761 // Set the selection to have its end of line filled or not.
762 void wxStyledTextCtrl::SetSelEOLFilled(bool filled
) {
763 SendMsg(2480, filled
, 0);
766 // Set the foreground colour of the caret.
767 void wxStyledTextCtrl::SetCaretForeground(const wxColour
& fore
) {
768 SendMsg(2069, wxColourAsLong(fore
), 0);
771 // When key+modifier combination km is pressed perform msg.
772 void wxStyledTextCtrl::CmdKeyAssign(int key
, int modifiers
, int cmd
) {
773 SendMsg(2070, MAKELONG(key
, modifiers
), cmd
);
776 // When key+modifier combination km is pressed do nothing.
777 void wxStyledTextCtrl::CmdKeyClear(int key
, int modifiers
) {
778 SendMsg(2071, MAKELONG(key
, modifiers
));
781 // Drop all key mappings.
782 void wxStyledTextCtrl::CmdKeyClearAll() {
786 // Set the styles for a segment of the document.
787 void wxStyledTextCtrl::SetStyleBytes(int length
, char* styleBytes
) {
788 SendMsg(2073, length
, (long)styleBytes
);
791 // Set a style to be visible or not.
792 void wxStyledTextCtrl::StyleSetVisible(int style
, bool visible
) {
793 SendMsg(2074, style
, visible
);
796 // Get the time in milliseconds that the caret is on and off.
797 int wxStyledTextCtrl::GetCaretPeriod() {
798 return SendMsg(2075, 0, 0);
801 // Get the time in milliseconds that the caret is on and off. 0 = steady on.
802 void wxStyledTextCtrl::SetCaretPeriod(int periodMilliseconds
) {
803 SendMsg(2076, periodMilliseconds
, 0);
806 // Set the set of characters making up words for when moving or selecting by word.
807 // First sets deaults like SetCharsDefault.
808 void wxStyledTextCtrl::SetWordChars(const wxString
& characters
) {
809 SendMsg(2077, 0, (long)(const char*)wx2stc(characters
));
812 // Start a sequence of actions that is undone and redone as a unit.
814 void wxStyledTextCtrl::BeginUndoAction() {
818 // End a sequence of actions that is undone and redone as a unit.
819 void wxStyledTextCtrl::EndUndoAction() {
823 // Set an indicator to plain, squiggle or TT.
824 void wxStyledTextCtrl::IndicatorSetStyle(int indic
, int style
) {
825 SendMsg(2080, indic
, style
);
828 // Retrieve the style of an indicator.
829 int wxStyledTextCtrl::IndicatorGetStyle(int indic
) {
830 return SendMsg(2081, indic
, 0);
833 // Set the foreground colour of an indicator.
834 void wxStyledTextCtrl::IndicatorSetForeground(int indic
, const wxColour
& fore
) {
835 SendMsg(2082, indic
, wxColourAsLong(fore
));
838 // Retrieve the foreground colour of an indicator.
839 wxColour
wxStyledTextCtrl::IndicatorGetForeground(int indic
) {
840 long c
= SendMsg(2083, indic
, 0);
841 return wxColourFromLong(c
);
844 // Set an indicator to draw under text or over(default).
845 void wxStyledTextCtrl::IndicatorSetUnder(int indic
, bool under
) {
846 SendMsg(2510, indic
, under
);
849 // Retrieve whether indicator drawn under or over text.
850 bool wxStyledTextCtrl::IndicatorGetUnder(int indic
) {
851 return SendMsg(2511, indic
, 0) != 0;
854 // Set the foreground colour of all whitespace and whether to use this setting.
855 void wxStyledTextCtrl::SetWhitespaceForeground(bool useSetting
, const wxColour
& fore
) {
856 SendMsg(2084, useSetting
, wxColourAsLong(fore
));
859 // Set the background colour of all whitespace and whether to use this setting.
860 void wxStyledTextCtrl::SetWhitespaceBackground(bool useSetting
, const wxColour
& back
) {
861 SendMsg(2085, useSetting
, wxColourAsLong(back
));
864 // Divide each styling byte into lexical class bits (default: 5) and indicator
865 // bits (default: 3). If a lexer requires more than 32 lexical states, then this
866 // is used to expand the possible states.
867 void wxStyledTextCtrl::SetStyleBits(int bits
) {
868 SendMsg(2090, bits
, 0);
871 // Retrieve number of bits in style bytes used to hold the lexical state.
872 int wxStyledTextCtrl::GetStyleBits() {
873 return SendMsg(2091, 0, 0);
876 // Used to hold extra styling information for each line.
877 void wxStyledTextCtrl::SetLineState(int line
, int state
) {
878 SendMsg(2092, line
, state
);
881 // Retrieve the extra styling information for a line.
882 int wxStyledTextCtrl::GetLineState(int line
) {
883 return SendMsg(2093, line
, 0);
886 // Retrieve the last line number that has line state.
887 int wxStyledTextCtrl::GetMaxLineState() {
888 return SendMsg(2094, 0, 0);
891 // Is the background of the line containing the caret in a different colour?
892 bool wxStyledTextCtrl::GetCaretLineVisible() {
893 return SendMsg(2095, 0, 0) != 0;
896 // Display the background of the line containing the caret in a different colour.
897 void wxStyledTextCtrl::SetCaretLineVisible(bool show
) {
898 SendMsg(2096, show
, 0);
901 // Get the colour of the background of the line containing the caret.
902 wxColour
wxStyledTextCtrl::GetCaretLineBackground() {
903 long c
= SendMsg(2097, 0, 0);
904 return wxColourFromLong(c
);
907 // Set the colour of the background of the line containing the caret.
908 void wxStyledTextCtrl::SetCaretLineBackground(const wxColour
& back
) {
909 SendMsg(2098, wxColourAsLong(back
), 0);
912 // Set a style to be changeable or not (read only).
913 // Experimental feature, currently buggy.
914 void wxStyledTextCtrl::StyleSetChangeable(int style
, bool changeable
) {
915 SendMsg(2099, style
, changeable
);
918 // Display a auto-completion list.
919 // The lenEntered parameter indicates how many characters before
920 // the caret should be used to provide context.
921 void wxStyledTextCtrl::AutoCompShow(int lenEntered
, const wxString
& itemList
) {
922 SendMsg(2100, lenEntered
, (long)(const char*)wx2stc(itemList
));
925 // Remove the auto-completion list from the screen.
926 void wxStyledTextCtrl::AutoCompCancel() {
930 // Is there an auto-completion list visible?
931 bool wxStyledTextCtrl::AutoCompActive() {
932 return SendMsg(2102, 0, 0) != 0;
935 // Retrieve the position of the caret when the auto-completion list was displayed.
936 int wxStyledTextCtrl::AutoCompPosStart() {
937 return SendMsg(2103, 0, 0);
940 // User has selected an item so remove the list and insert the selection.
941 void wxStyledTextCtrl::AutoCompComplete() {
945 // Define a set of character that when typed cancel the auto-completion list.
946 void wxStyledTextCtrl::AutoCompStops(const wxString
& characterSet
) {
947 SendMsg(2105, 0, (long)(const char*)wx2stc(characterSet
));
950 // Change the separator character in the string setting up an auto-completion list.
951 // Default is space but can be changed if items contain space.
952 void wxStyledTextCtrl::AutoCompSetSeparator(int separatorCharacter
) {
953 SendMsg(2106, separatorCharacter
, 0);
956 // Retrieve the auto-completion list separator character.
957 int wxStyledTextCtrl::AutoCompGetSeparator() {
958 return SendMsg(2107, 0, 0);
961 // Select the item in the auto-completion list that starts with a string.
962 void wxStyledTextCtrl::AutoCompSelect(const wxString
& text
) {
963 SendMsg(2108, 0, (long)(const char*)wx2stc(text
));
966 // Should the auto-completion list be cancelled if the user backspaces to a
967 // position before where the box was created.
968 void wxStyledTextCtrl::AutoCompSetCancelAtStart(bool cancel
) {
969 SendMsg(2110, cancel
, 0);
972 // Retrieve whether auto-completion cancelled by backspacing before start.
973 bool wxStyledTextCtrl::AutoCompGetCancelAtStart() {
974 return SendMsg(2111, 0, 0) != 0;
977 // Define a set of characters that when typed will cause the autocompletion to
978 // choose the selected item.
979 void wxStyledTextCtrl::AutoCompSetFillUps(const wxString
& characterSet
) {
980 SendMsg(2112, 0, (long)(const char*)wx2stc(characterSet
));
983 // Should a single item auto-completion list automatically choose the item.
984 void wxStyledTextCtrl::AutoCompSetChooseSingle(bool chooseSingle
) {
985 SendMsg(2113, chooseSingle
, 0);
988 // Retrieve whether a single item auto-completion list automatically choose the item.
989 bool wxStyledTextCtrl::AutoCompGetChooseSingle() {
990 return SendMsg(2114, 0, 0) != 0;
993 // Set whether case is significant when performing auto-completion searches.
994 void wxStyledTextCtrl::AutoCompSetIgnoreCase(bool ignoreCase
) {
995 SendMsg(2115, ignoreCase
, 0);
998 // Retrieve state of ignore case flag.
999 bool wxStyledTextCtrl::AutoCompGetIgnoreCase() {
1000 return SendMsg(2116, 0, 0) != 0;
1003 // Display a list of strings and send notification when user chooses one.
1004 void wxStyledTextCtrl::UserListShow(int listType
, const wxString
& itemList
) {
1005 SendMsg(2117, listType
, (long)(const char*)wx2stc(itemList
));
1008 // Set whether or not autocompletion is hidden automatically when nothing matches.
1009 void wxStyledTextCtrl::AutoCompSetAutoHide(bool autoHide
) {
1010 SendMsg(2118, autoHide
, 0);
1013 // Retrieve whether or not autocompletion is hidden automatically when nothing matches.
1014 bool wxStyledTextCtrl::AutoCompGetAutoHide() {
1015 return SendMsg(2119, 0, 0) != 0;
1018 // Set whether or not autocompletion deletes any word characters
1019 // after the inserted text upon completion.
1020 void wxStyledTextCtrl::AutoCompSetDropRestOfWord(bool dropRestOfWord
) {
1021 SendMsg(2270, dropRestOfWord
, 0);
1024 // Retrieve whether or not autocompletion deletes any word characters
1025 // after the inserted text upon completion.
1026 bool wxStyledTextCtrl::AutoCompGetDropRestOfWord() {
1027 return SendMsg(2271, 0, 0) != 0;
1030 // Register an image for use in autocompletion lists.
1031 void wxStyledTextCtrl::RegisterImage(int type
, const wxBitmap
& bmp
) {
1032 // convert bmp to a xpm in a string
1033 wxMemoryOutputStream strm
;
1034 wxImage img
= bmp
.ConvertToImage();
1036 img
.ConvertAlphaToMask();
1037 img
.SaveFile(strm
, wxBITMAP_TYPE_XPM
);
1038 size_t len
= strm
.GetSize();
1039 char* buff
= new char[len
+1];
1040 strm
.CopyTo(buff
, len
);
1042 SendMsg(2405, type
, (long)buff
);
1047 // Clear all the registered images.
1048 void wxStyledTextCtrl::ClearRegisteredImages() {
1049 SendMsg(2408, 0, 0);
1052 // Retrieve the auto-completion list type-separator character.
1053 int wxStyledTextCtrl::AutoCompGetTypeSeparator() {
1054 return SendMsg(2285, 0, 0);
1057 // Change the type-separator character in the string setting up an auto-completion list.
1058 // Default is '?' but can be changed if items contain '?'.
1059 void wxStyledTextCtrl::AutoCompSetTypeSeparator(int separatorCharacter
) {
1060 SendMsg(2286, separatorCharacter
, 0);
1063 // Set the maximum width, in characters, of auto-completion and user lists.
1064 // Set to 0 to autosize to fit longest item, which is the default.
1065 void wxStyledTextCtrl::AutoCompSetMaxWidth(int characterCount
) {
1066 SendMsg(2208, characterCount
, 0);
1069 // Get the maximum width, in characters, of auto-completion and user lists.
1070 int wxStyledTextCtrl::AutoCompGetMaxWidth() {
1071 return SendMsg(2209, 0, 0);
1074 // Set the maximum height, in rows, of auto-completion and user lists.
1075 // The default is 5 rows.
1076 void wxStyledTextCtrl::AutoCompSetMaxHeight(int rowCount
) {
1077 SendMsg(2210, rowCount
, 0);
1080 // Set the maximum height, in rows, of auto-completion and user lists.
1081 int wxStyledTextCtrl::AutoCompGetMaxHeight() {
1082 return SendMsg(2211, 0, 0);
1085 // Set the number of spaces used for one level of indentation.
1086 void wxStyledTextCtrl::SetIndent(int indentSize
) {
1087 SendMsg(2122, indentSize
, 0);
1090 // Retrieve indentation size.
1091 int wxStyledTextCtrl::GetIndent() {
1092 return SendMsg(2123, 0, 0);
1095 // Indentation will only use space characters if useTabs is false, otherwise
1096 // it will use a combination of tabs and spaces.
1097 void wxStyledTextCtrl::SetUseTabs(bool useTabs
) {
1098 SendMsg(2124, useTabs
, 0);
1101 // Retrieve whether tabs will be used in indentation.
1102 bool wxStyledTextCtrl::GetUseTabs() {
1103 return SendMsg(2125, 0, 0) != 0;
1106 // Change the indentation of a line to a number of columns.
1107 void wxStyledTextCtrl::SetLineIndentation(int line
, int indentSize
) {
1108 SendMsg(2126, line
, indentSize
);
1111 // Retrieve the number of columns that a line is indented.
1112 int wxStyledTextCtrl::GetLineIndentation(int line
) {
1113 return SendMsg(2127, line
, 0);
1116 // Retrieve the position before the first non indentation character on a line.
1117 int wxStyledTextCtrl::GetLineIndentPosition(int line
) {
1118 return SendMsg(2128, line
, 0);
1121 // Retrieve the column number of a position, taking tab width into account.
1122 int wxStyledTextCtrl::GetColumn(int pos
) {
1123 return SendMsg(2129, pos
, 0);
1126 // Show or hide the horizontal scroll bar.
1127 void wxStyledTextCtrl::SetUseHorizontalScrollBar(bool show
) {
1128 SendMsg(2130, show
, 0);
1131 // Is the horizontal scroll bar visible?
1132 bool wxStyledTextCtrl::GetUseHorizontalScrollBar() {
1133 return SendMsg(2131, 0, 0) != 0;
1136 // Show or hide indentation guides.
1137 void wxStyledTextCtrl::SetIndentationGuides(int indentView
) {
1138 SendMsg(2132, indentView
, 0);
1141 // Are the indentation guides visible?
1142 int wxStyledTextCtrl::GetIndentationGuides() {
1143 return SendMsg(2133, 0, 0);
1146 // Set the highlighted indentation guide column.
1147 // 0 = no highlighted guide.
1148 void wxStyledTextCtrl::SetHighlightGuide(int column
) {
1149 SendMsg(2134, column
, 0);
1152 // Get the highlighted indentation guide column.
1153 int wxStyledTextCtrl::GetHighlightGuide() {
1154 return SendMsg(2135, 0, 0);
1157 // Get the position after the last visible characters on a line.
1158 int wxStyledTextCtrl::GetLineEndPosition(int line
) {
1159 return SendMsg(2136, line
, 0);
1162 // Get the code page used to interpret the bytes of the document as characters.
1163 int wxStyledTextCtrl::GetCodePage() {
1164 return SendMsg(2137, 0, 0);
1167 // Get the foreground colour of the caret.
1168 wxColour
wxStyledTextCtrl::GetCaretForeground() {
1169 long c
= SendMsg(2138, 0, 0);
1170 return wxColourFromLong(c
);
1173 // In read-only mode?
1174 bool wxStyledTextCtrl::GetReadOnly() {
1175 return SendMsg(2140, 0, 0) != 0;
1178 // Sets the position of the caret.
1179 void wxStyledTextCtrl::SetCurrentPos(int pos
) {
1180 SendMsg(2141, pos
, 0);
1183 // Sets the position that starts the selection - this becomes the anchor.
1184 void wxStyledTextCtrl::SetSelectionStart(int pos
) {
1185 SendMsg(2142, pos
, 0);
1188 // Returns the position at the start of the selection.
1189 int wxStyledTextCtrl::GetSelectionStart() {
1190 return SendMsg(2143, 0, 0);
1193 // Sets the position that ends the selection - this becomes the currentPosition.
1194 void wxStyledTextCtrl::SetSelectionEnd(int pos
) {
1195 SendMsg(2144, pos
, 0);
1198 // Returns the position at the end of the selection.
1199 int wxStyledTextCtrl::GetSelectionEnd() {
1200 return SendMsg(2145, 0, 0);
1203 // Sets the print magnification added to the point size of each style for printing.
1204 void wxStyledTextCtrl::SetPrintMagnification(int magnification
) {
1205 SendMsg(2146, magnification
, 0);
1208 // Returns the print magnification.
1209 int wxStyledTextCtrl::GetPrintMagnification() {
1210 return SendMsg(2147, 0, 0);
1213 // Modify colours when printing for clearer printed text.
1214 void wxStyledTextCtrl::SetPrintColourMode(int mode
) {
1215 SendMsg(2148, mode
, 0);
1218 // Returns the print colour mode.
1219 int wxStyledTextCtrl::GetPrintColourMode() {
1220 return SendMsg(2149, 0, 0);
1223 // Find some text in the document.
1224 int wxStyledTextCtrl::FindText(int minPos
, int maxPos
,
1225 const wxString
& text
,
1228 ft
.chrg
.cpMin
= minPos
;
1229 ft
.chrg
.cpMax
= maxPos
;
1230 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
1231 ft
.lpstrText
= (char*)(const char*)buf
;
1233 return SendMsg(2150, flags
, (long)&ft
);
1236 // On Windows, will draw the document into a display context such as a printer.
1237 int wxStyledTextCtrl::FormatRange(bool doDraw
,
1246 if (endPos
< startPos
) {
1247 int temp
= startPos
;
1252 fr
.hdcTarget
= target
;
1253 fr
.rc
.top
= renderRect
.GetTop();
1254 fr
.rc
.left
= renderRect
.GetLeft();
1255 fr
.rc
.right
= renderRect
.GetRight();
1256 fr
.rc
.bottom
= renderRect
.GetBottom();
1257 fr
.rcPage
.top
= pageRect
.GetTop();
1258 fr
.rcPage
.left
= pageRect
.GetLeft();
1259 fr
.rcPage
.right
= pageRect
.GetRight();
1260 fr
.rcPage
.bottom
= pageRect
.GetBottom();
1261 fr
.chrg
.cpMin
= startPos
;
1262 fr
.chrg
.cpMax
= endPos
;
1264 return SendMsg(2151, doDraw
, (long)&fr
);
1267 // Retrieve the display line at the top of the display.
1268 int wxStyledTextCtrl::GetFirstVisibleLine() {
1269 return SendMsg(2152, 0, 0);
1272 // Retrieve the contents of a line.
1273 wxString
wxStyledTextCtrl::GetLine(int line
) {
1274 int len
= LineLength(line
);
1275 if (!len
) return wxEmptyString
;
1277 wxMemoryBuffer
mbuf(len
+1);
1278 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1279 SendMsg(2153, line
, (long)buf
);
1280 mbuf
.UngetWriteBuf(len
);
1285 // Returns the number of lines in the document. There is always at least one.
1286 int wxStyledTextCtrl::GetLineCount() {
1287 return SendMsg(2154, 0, 0);
1290 // Sets the size in pixels of the left margin.
1291 void wxStyledTextCtrl::SetMarginLeft(int pixelWidth
) {
1292 SendMsg(2155, 0, pixelWidth
);
1295 // Returns the size in pixels of the left margin.
1296 int wxStyledTextCtrl::GetMarginLeft() {
1297 return SendMsg(2156, 0, 0);
1300 // Sets the size in pixels of the right margin.
1301 void wxStyledTextCtrl::SetMarginRight(int pixelWidth
) {
1302 SendMsg(2157, 0, pixelWidth
);
1305 // Returns the size in pixels of the right margin.
1306 int wxStyledTextCtrl::GetMarginRight() {
1307 return SendMsg(2158, 0, 0);
1310 // Is the document different from when it was last saved?
1311 bool wxStyledTextCtrl::GetModify() {
1312 return SendMsg(2159, 0, 0) != 0;
1315 // Select a range of text.
1316 void wxStyledTextCtrl::SetSelection(int start
, int end
) {
1317 SendMsg(2160, start
, end
);
1320 // Retrieve the selected text.
1321 wxString
wxStyledTextCtrl::GetSelectedText() {
1325 GetSelection(&start
, &end
);
1326 int len
= end
- start
;
1327 if (!len
) return wxEmptyString
;
1329 wxMemoryBuffer
mbuf(len
+2);
1330 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1331 SendMsg(2161, 0, (long)buf
);
1332 mbuf
.UngetWriteBuf(len
);
1337 // Retrieve a range of text.
1338 wxString
wxStyledTextCtrl::GetTextRange(int startPos
, int endPos
) {
1339 if (endPos
< startPos
) {
1340 int temp
= startPos
;
1344 int len
= endPos
- startPos
;
1345 if (!len
) return wxEmptyString
;
1346 wxMemoryBuffer
mbuf(len
+1);
1347 char* buf
= (char*)mbuf
.GetWriteBuf(len
);
1350 tr
.chrg
.cpMin
= startPos
;
1351 tr
.chrg
.cpMax
= endPos
;
1352 SendMsg(2162, 0, (long)&tr
);
1353 mbuf
.UngetWriteBuf(len
);
1358 // Draw the selection in normal style or with selection highlighted.
1359 void wxStyledTextCtrl::HideSelection(bool normal
) {
1360 SendMsg(2163, normal
, 0);
1363 // Retrieve the line containing a position.
1364 int wxStyledTextCtrl::LineFromPosition(int pos
) {
1365 return SendMsg(2166, pos
, 0);
1368 // Retrieve the position at the start of a line.
1369 int wxStyledTextCtrl::PositionFromLine(int line
) {
1370 return SendMsg(2167, line
, 0);
1373 // Scroll horizontally and vertically.
1374 void wxStyledTextCtrl::LineScroll(int columns
, int lines
) {
1375 SendMsg(2168, columns
, lines
);
1378 // Ensure the caret is visible.
1379 void wxStyledTextCtrl::EnsureCaretVisible() {
1380 SendMsg(2169, 0, 0);
1383 // Replace the selected text with the argument text.
1384 void wxStyledTextCtrl::ReplaceSelection(const wxString
& text
) {
1385 SendMsg(2170, 0, (long)(const char*)wx2stc(text
));
1388 // Set to read only or read write.
1389 void wxStyledTextCtrl::SetReadOnly(bool readOnly
) {
1390 SendMsg(2171, readOnly
, 0);
1393 // Will a paste succeed?
1394 bool wxStyledTextCtrl::CanPaste() {
1395 return SendMsg(2173, 0, 0) != 0;
1398 // Are there any undoable actions in the undo history?
1399 bool wxStyledTextCtrl::CanUndo() {
1400 return SendMsg(2174, 0, 0) != 0;
1403 // Delete the undo history.
1404 void wxStyledTextCtrl::EmptyUndoBuffer() {
1405 SendMsg(2175, 0, 0);
1408 // Undo one action in the undo history.
1409 void wxStyledTextCtrl::Undo() {
1410 SendMsg(2176, 0, 0);
1413 // Cut the selection to the clipboard.
1414 void wxStyledTextCtrl::Cut() {
1415 SendMsg(2177, 0, 0);
1418 // Copy the selection to the clipboard.
1419 void wxStyledTextCtrl::Copy() {
1420 SendMsg(2178, 0, 0);
1423 // Paste the contents of the clipboard into the document replacing the selection.
1424 void wxStyledTextCtrl::Paste() {
1425 SendMsg(2179, 0, 0);
1428 // Clear the selection.
1429 void wxStyledTextCtrl::Clear() {
1430 SendMsg(2180, 0, 0);
1433 // Replace the contents of the document with the argument text.
1434 void wxStyledTextCtrl::SetText(const wxString
& text
) {
1435 SendMsg(2181, 0, (long)(const char*)wx2stc(text
));
1438 // Retrieve all the text in the document.
1439 wxString
wxStyledTextCtrl::GetText() {
1440 int len
= GetTextLength();
1441 wxMemoryBuffer
mbuf(len
+1); // leave room for the null...
1442 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1443 SendMsg(2182, len
+1, (long)buf
);
1444 mbuf
.UngetWriteBuf(len
);
1449 // Retrieve the number of characters in the document.
1450 int wxStyledTextCtrl::GetTextLength() {
1451 return SendMsg(2183, 0, 0);
1454 // Set to overtype (true) or insert mode.
1455 void wxStyledTextCtrl::SetOvertype(bool overtype
) {
1456 SendMsg(2186, overtype
, 0);
1459 // Returns true if overtype mode is active otherwise false is returned.
1460 bool wxStyledTextCtrl::GetOvertype() {
1461 return SendMsg(2187, 0, 0) != 0;
1464 // Set the width of the insert mode caret.
1465 void wxStyledTextCtrl::SetCaretWidth(int pixelWidth
) {
1466 SendMsg(2188, pixelWidth
, 0);
1469 // Returns the width of the insert mode caret.
1470 int wxStyledTextCtrl::GetCaretWidth() {
1471 return SendMsg(2189, 0, 0);
1474 // Sets the position that starts the target which is used for updating the
1475 // document without affecting the scroll position.
1476 void wxStyledTextCtrl::SetTargetStart(int pos
) {
1477 SendMsg(2190, pos
, 0);
1480 // Get the position that starts the target.
1481 int wxStyledTextCtrl::GetTargetStart() {
1482 return SendMsg(2191, 0, 0);
1485 // Sets the position that ends the target which is used for updating the
1486 // document without affecting the scroll position.
1487 void wxStyledTextCtrl::SetTargetEnd(int pos
) {
1488 SendMsg(2192, pos
, 0);
1491 // Get the position that ends the target.
1492 int wxStyledTextCtrl::GetTargetEnd() {
1493 return SendMsg(2193, 0, 0);
1496 // Replace the target text with the argument text.
1497 // Text is counted so it can contain NULs.
1498 // Returns the length of the replacement text.
1500 int wxStyledTextCtrl::ReplaceTarget(const wxString
& text
) {
1501 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
1502 return SendMsg(2194, strlen(buf
), (long)(const char*)buf
);
1505 // Replace the target text with the argument text after \d processing.
1506 // Text is counted so it can contain NULs.
1507 // Looks for \d where d is between 1 and 9 and replaces these with the strings
1508 // matched in the last search operation which were surrounded by \( and \).
1509 // Returns the length of the replacement text including any change
1510 // caused by processing the \d patterns.
1512 int wxStyledTextCtrl::ReplaceTargetRE(const wxString
& text
) {
1513 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
1514 return SendMsg(2195, strlen(buf
), (long)(const char*)buf
);
1517 // Search for a counted string in the target and set the target to the found
1518 // range. Text is counted so it can contain NULs.
1519 // Returns length of range or -1 for failure in which case target is not moved.
1521 int wxStyledTextCtrl::SearchInTarget(const wxString
& text
) {
1522 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
1523 return SendMsg(2197, strlen(buf
), (long)(const char*)buf
);
1526 // Set the search flags used by SearchInTarget.
1527 void wxStyledTextCtrl::SetSearchFlags(int flags
) {
1528 SendMsg(2198, flags
, 0);
1531 // Get the search flags used by SearchInTarget.
1532 int wxStyledTextCtrl::GetSearchFlags() {
1533 return SendMsg(2199, 0, 0);
1536 // Show a call tip containing a definition near position pos.
1537 void wxStyledTextCtrl::CallTipShow(int pos
, const wxString
& definition
) {
1538 SendMsg(2200, pos
, (long)(const char*)wx2stc(definition
));
1541 // Remove the call tip from the screen.
1542 void wxStyledTextCtrl::CallTipCancel() {
1543 SendMsg(2201, 0, 0);
1546 // Is there an active call tip?
1547 bool wxStyledTextCtrl::CallTipActive() {
1548 return SendMsg(2202, 0, 0) != 0;
1551 // Retrieve the position where the caret was before displaying the call tip.
1552 int wxStyledTextCtrl::CallTipPosAtStart() {
1553 return SendMsg(2203, 0, 0);
1556 // Highlight a segment of the definition.
1557 void wxStyledTextCtrl::CallTipSetHighlight(int start
, int end
) {
1558 SendMsg(2204, start
, end
);
1561 // Set the background colour for the call tip.
1562 void wxStyledTextCtrl::CallTipSetBackground(const wxColour
& back
) {
1563 SendMsg(2205, wxColourAsLong(back
), 0);
1566 // Set the foreground colour for the call tip.
1567 void wxStyledTextCtrl::CallTipSetForeground(const wxColour
& fore
) {
1568 SendMsg(2206, wxColourAsLong(fore
), 0);
1571 // Set the foreground colour for the highlighted part of the call tip.
1572 void wxStyledTextCtrl::CallTipSetForegroundHighlight(const wxColour
& fore
) {
1573 SendMsg(2207, wxColourAsLong(fore
), 0);
1576 // Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
1577 void wxStyledTextCtrl::CallTipUseStyle(int tabSize
) {
1578 SendMsg(2212, tabSize
, 0);
1581 // Find the display line of a document line taking hidden lines into account.
1582 int wxStyledTextCtrl::VisibleFromDocLine(int line
) {
1583 return SendMsg(2220, line
, 0);
1586 // Find the document line of a display line taking hidden lines into account.
1587 int wxStyledTextCtrl::DocLineFromVisible(int lineDisplay
) {
1588 return SendMsg(2221, lineDisplay
, 0);
1591 // The number of display lines needed to wrap a document line
1592 int wxStyledTextCtrl::WrapCount(int line
) {
1593 return SendMsg(2235, line
, 0);
1596 // Set the fold level of a line.
1597 // This encodes an integer level along with flags indicating whether the
1598 // line is a header and whether it is effectively white space.
1599 void wxStyledTextCtrl::SetFoldLevel(int line
, int level
) {
1600 SendMsg(2222, line
, level
);
1603 // Retrieve the fold level of a line.
1604 int wxStyledTextCtrl::GetFoldLevel(int line
) {
1605 return SendMsg(2223, line
, 0);
1608 // Find the last child line of a header line.
1609 int wxStyledTextCtrl::GetLastChild(int line
, int level
) {
1610 return SendMsg(2224, line
, level
);
1613 // Find the parent line of a child line.
1614 int wxStyledTextCtrl::GetFoldParent(int line
) {
1615 return SendMsg(2225, line
, 0);
1618 // Make a range of lines visible.
1619 void wxStyledTextCtrl::ShowLines(int lineStart
, int lineEnd
) {
1620 SendMsg(2226, lineStart
, lineEnd
);
1623 // Make a range of lines invisible.
1624 void wxStyledTextCtrl::HideLines(int lineStart
, int lineEnd
) {
1625 SendMsg(2227, lineStart
, lineEnd
);
1628 // Is a line visible?
1629 bool wxStyledTextCtrl::GetLineVisible(int line
) {
1630 return SendMsg(2228, line
, 0) != 0;
1633 // Show the children of a header line.
1634 void wxStyledTextCtrl::SetFoldExpanded(int line
, bool expanded
) {
1635 SendMsg(2229, line
, expanded
);
1638 // Is a header line expanded?
1639 bool wxStyledTextCtrl::GetFoldExpanded(int line
) {
1640 return SendMsg(2230, line
, 0) != 0;
1643 // Switch a header line between expanded and contracted.
1644 void wxStyledTextCtrl::ToggleFold(int line
) {
1645 SendMsg(2231, line
, 0);
1648 // Ensure a particular line is visible by expanding any header line hiding it.
1649 void wxStyledTextCtrl::EnsureVisible(int line
) {
1650 SendMsg(2232, line
, 0);
1653 // Set some style options for folding.
1654 void wxStyledTextCtrl::SetFoldFlags(int flags
) {
1655 SendMsg(2233, flags
, 0);
1658 // Ensure a particular line is visible by expanding any header line hiding it.
1659 // Use the currently set visibility policy to determine which range to display.
1660 void wxStyledTextCtrl::EnsureVisibleEnforcePolicy(int line
) {
1661 SendMsg(2234, line
, 0);
1664 // Sets whether a tab pressed when caret is within indentation indents.
1665 void wxStyledTextCtrl::SetTabIndents(bool tabIndents
) {
1666 SendMsg(2260, tabIndents
, 0);
1669 // Does a tab pressed when caret is within indentation indent?
1670 bool wxStyledTextCtrl::GetTabIndents() {
1671 return SendMsg(2261, 0, 0) != 0;
1674 // Sets whether a backspace pressed when caret is within indentation unindents.
1675 void wxStyledTextCtrl::SetBackSpaceUnIndents(bool bsUnIndents
) {
1676 SendMsg(2262, bsUnIndents
, 0);
1679 // Does a backspace pressed when caret is within indentation unindent?
1680 bool wxStyledTextCtrl::GetBackSpaceUnIndents() {
1681 return SendMsg(2263, 0, 0) != 0;
1684 // Sets the time the mouse must sit still to generate a mouse dwell event.
1685 void wxStyledTextCtrl::SetMouseDwellTime(int periodMilliseconds
) {
1686 SendMsg(2264, periodMilliseconds
, 0);
1689 // Retrieve the time the mouse must sit still to generate a mouse dwell event.
1690 int wxStyledTextCtrl::GetMouseDwellTime() {
1691 return SendMsg(2265, 0, 0);
1694 // Get position of start of word.
1695 int wxStyledTextCtrl::WordStartPosition(int pos
, bool onlyWordCharacters
) {
1696 return SendMsg(2266, pos
, onlyWordCharacters
);
1699 // Get position of end of word.
1700 int wxStyledTextCtrl::WordEndPosition(int pos
, bool onlyWordCharacters
) {
1701 return SendMsg(2267, pos
, onlyWordCharacters
);
1704 // Sets whether text is word wrapped.
1705 void wxStyledTextCtrl::SetWrapMode(int mode
) {
1706 SendMsg(2268, mode
, 0);
1709 // Retrieve whether text is word wrapped.
1710 int wxStyledTextCtrl::GetWrapMode() {
1711 return SendMsg(2269, 0, 0);
1714 // Set the display mode of visual flags for wrapped lines.
1715 void wxStyledTextCtrl::SetWrapVisualFlags(int wrapVisualFlags
) {
1716 SendMsg(2460, wrapVisualFlags
, 0);
1719 // Retrive the display mode of visual flags for wrapped lines.
1720 int wxStyledTextCtrl::GetWrapVisualFlags() {
1721 return SendMsg(2461, 0, 0);
1724 // Set the location of visual flags for wrapped lines.
1725 void wxStyledTextCtrl::SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation
) {
1726 SendMsg(2462, wrapVisualFlagsLocation
, 0);
1729 // Retrive the location of visual flags for wrapped lines.
1730 int wxStyledTextCtrl::GetWrapVisualFlagsLocation() {
1731 return SendMsg(2463, 0, 0);
1734 // Set the start indent for wrapped lines.
1735 void wxStyledTextCtrl::SetWrapStartIndent(int indent
) {
1736 SendMsg(2464, indent
, 0);
1739 // Retrive the start indent for wrapped lines.
1740 int wxStyledTextCtrl::GetWrapStartIndent() {
1741 return SendMsg(2465, 0, 0);
1744 // Sets the degree of caching of layout information.
1745 void wxStyledTextCtrl::SetLayoutCache(int mode
) {
1746 SendMsg(2272, mode
, 0);
1749 // Retrieve the degree of caching of layout information.
1750 int wxStyledTextCtrl::GetLayoutCache() {
1751 return SendMsg(2273, 0, 0);
1754 // Sets the document width assumed for scrolling.
1755 void wxStyledTextCtrl::SetScrollWidth(int pixelWidth
) {
1756 SendMsg(2274, pixelWidth
, 0);
1759 // Retrieve the document width assumed for scrolling.
1760 int wxStyledTextCtrl::GetScrollWidth() {
1761 return SendMsg(2275, 0, 0);
1764 // Sets whether the maximum width line displayed is used to set scroll width.
1765 void wxStyledTextCtrl::SetScrollWidthTracking(bool tracking
) {
1766 SendMsg(2516, tracking
, 0);
1769 // Retrieve whether the scroll width tracks wide lines.
1770 bool wxStyledTextCtrl::GetScrollWidthTracking() {
1771 return SendMsg(2517, 0, 0) != 0;
1774 // Measure the pixel width of some text in a particular style.
1775 // NUL terminated text argument.
1776 // Does not handle tab or control characters.
1777 int wxStyledTextCtrl::TextWidth(int style
, const wxString
& text
) {
1778 return SendMsg(2276, style
, (long)(const char*)wx2stc(text
));
1781 // Sets the scroll range so that maximum scroll position has
1782 // the last line at the bottom of the view (default).
1783 // Setting this to false allows scrolling one page below the last line.
1784 void wxStyledTextCtrl::SetEndAtLastLine(bool endAtLastLine
) {
1785 SendMsg(2277, endAtLastLine
, 0);
1788 // Retrieve whether the maximum scroll position has the last
1789 // line at the bottom of the view.
1790 bool wxStyledTextCtrl::GetEndAtLastLine() {
1791 return SendMsg(2278, 0, 0) != 0;
1794 // Retrieve the height of a particular line of text in pixels.
1795 int wxStyledTextCtrl::TextHeight(int line
) {
1796 return SendMsg(2279, line
, 0);
1799 // Show or hide the vertical scroll bar.
1800 void wxStyledTextCtrl::SetUseVerticalScrollBar(bool show
) {
1801 SendMsg(2280, show
, 0);
1804 // Is the vertical scroll bar visible?
1805 bool wxStyledTextCtrl::GetUseVerticalScrollBar() {
1806 return SendMsg(2281, 0, 0) != 0;
1809 // Append a string to the end of the document without changing the selection.
1810 void wxStyledTextCtrl::AppendText(const wxString
& text
) {
1811 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
1812 SendMsg(2282, strlen(buf
), (long)(const char*)buf
);
1815 // Is drawing done in two phases with backgrounds drawn before foregrounds?
1816 bool wxStyledTextCtrl::GetTwoPhaseDraw() {
1817 return SendMsg(2283, 0, 0) != 0;
1820 // In twoPhaseDraw mode, drawing is performed in two phases, first the background
1821 // and then the foreground. This avoids chopping off characters that overlap the next run.
1822 void wxStyledTextCtrl::SetTwoPhaseDraw(bool twoPhase
) {
1823 SendMsg(2284, twoPhase
, 0);
1826 // Make the target range start and end be the same as the selection range start and end.
1827 void wxStyledTextCtrl::TargetFromSelection() {
1828 SendMsg(2287, 0, 0);
1831 // Join the lines in the target.
1832 void wxStyledTextCtrl::LinesJoin() {
1833 SendMsg(2288, 0, 0);
1836 // Split the lines in the target into lines that are less wide than pixelWidth
1838 void wxStyledTextCtrl::LinesSplit(int pixelWidth
) {
1839 SendMsg(2289, pixelWidth
, 0);
1842 // Set the colours used as a chequerboard pattern in the fold margin
1843 void wxStyledTextCtrl::SetFoldMarginColour(bool useSetting
, const wxColour
& back
) {
1844 SendMsg(2290, useSetting
, wxColourAsLong(back
));
1846 void wxStyledTextCtrl::SetFoldMarginHiColour(bool useSetting
, const wxColour
& fore
) {
1847 SendMsg(2291, useSetting
, wxColourAsLong(fore
));
1850 // Move caret down one line.
1851 void wxStyledTextCtrl::LineDown() {
1852 SendMsg(2300, 0, 0);
1855 // Move caret down one line extending selection to new caret position.
1856 void wxStyledTextCtrl::LineDownExtend() {
1857 SendMsg(2301, 0, 0);
1860 // Move caret up one line.
1861 void wxStyledTextCtrl::LineUp() {
1862 SendMsg(2302, 0, 0);
1865 // Move caret up one line extending selection to new caret position.
1866 void wxStyledTextCtrl::LineUpExtend() {
1867 SendMsg(2303, 0, 0);
1870 // Move caret left one character.
1871 void wxStyledTextCtrl::CharLeft() {
1872 SendMsg(2304, 0, 0);
1875 // Move caret left one character extending selection to new caret position.
1876 void wxStyledTextCtrl::CharLeftExtend() {
1877 SendMsg(2305, 0, 0);
1880 // Move caret right one character.
1881 void wxStyledTextCtrl::CharRight() {
1882 SendMsg(2306, 0, 0);
1885 // Move caret right one character extending selection to new caret position.
1886 void wxStyledTextCtrl::CharRightExtend() {
1887 SendMsg(2307, 0, 0);
1890 // Move caret left one word.
1891 void wxStyledTextCtrl::WordLeft() {
1892 SendMsg(2308, 0, 0);
1895 // Move caret left one word extending selection to new caret position.
1896 void wxStyledTextCtrl::WordLeftExtend() {
1897 SendMsg(2309, 0, 0);
1900 // Move caret right one word.
1901 void wxStyledTextCtrl::WordRight() {
1902 SendMsg(2310, 0, 0);
1905 // Move caret right one word extending selection to new caret position.
1906 void wxStyledTextCtrl::WordRightExtend() {
1907 SendMsg(2311, 0, 0);
1910 // Move caret to first position on line.
1911 void wxStyledTextCtrl::Home() {
1912 SendMsg(2312, 0, 0);
1915 // Move caret to first position on line extending selection to new caret position.
1916 void wxStyledTextCtrl::HomeExtend() {
1917 SendMsg(2313, 0, 0);
1920 // Move caret to last position on line.
1921 void wxStyledTextCtrl::LineEnd() {
1922 SendMsg(2314, 0, 0);
1925 // Move caret to last position on line extending selection to new caret position.
1926 void wxStyledTextCtrl::LineEndExtend() {
1927 SendMsg(2315, 0, 0);
1930 // Move caret to first position in document.
1931 void wxStyledTextCtrl::DocumentStart() {
1932 SendMsg(2316, 0, 0);
1935 // Move caret to first position in document extending selection to new caret position.
1936 void wxStyledTextCtrl::DocumentStartExtend() {
1937 SendMsg(2317, 0, 0);
1940 // Move caret to last position in document.
1941 void wxStyledTextCtrl::DocumentEnd() {
1942 SendMsg(2318, 0, 0);
1945 // Move caret to last position in document extending selection to new caret position.
1946 void wxStyledTextCtrl::DocumentEndExtend() {
1947 SendMsg(2319, 0, 0);
1950 // Move caret one page up.
1951 void wxStyledTextCtrl::PageUp() {
1952 SendMsg(2320, 0, 0);
1955 // Move caret one page up extending selection to new caret position.
1956 void wxStyledTextCtrl::PageUpExtend() {
1957 SendMsg(2321, 0, 0);
1960 // Move caret one page down.
1961 void wxStyledTextCtrl::PageDown() {
1962 SendMsg(2322, 0, 0);
1965 // Move caret one page down extending selection to new caret position.
1966 void wxStyledTextCtrl::PageDownExtend() {
1967 SendMsg(2323, 0, 0);
1970 // Switch from insert to overtype mode or the reverse.
1971 void wxStyledTextCtrl::EditToggleOvertype() {
1972 SendMsg(2324, 0, 0);
1975 // Cancel any modes such as call tip or auto-completion list display.
1976 void wxStyledTextCtrl::Cancel() {
1977 SendMsg(2325, 0, 0);
1980 // Delete the selection or if no selection, the character before the caret.
1981 void wxStyledTextCtrl::DeleteBack() {
1982 SendMsg(2326, 0, 0);
1985 // If selection is empty or all on one line replace the selection with a tab character.
1986 // If more than one line selected, indent the lines.
1987 void wxStyledTextCtrl::Tab() {
1988 SendMsg(2327, 0, 0);
1991 // Dedent the selected lines.
1992 void wxStyledTextCtrl::BackTab() {
1993 SendMsg(2328, 0, 0);
1996 // Insert a new line, may use a CRLF, CR or LF depending on EOL mode.
1997 void wxStyledTextCtrl::NewLine() {
1998 SendMsg(2329, 0, 0);
2001 // Insert a Form Feed character.
2002 void wxStyledTextCtrl::FormFeed() {
2003 SendMsg(2330, 0, 0);
2006 // Move caret to before first visible character on line.
2007 // If already there move to first character on line.
2008 void wxStyledTextCtrl::VCHome() {
2009 SendMsg(2331, 0, 0);
2012 // Like VCHome but extending selection to new caret position.
2013 void wxStyledTextCtrl::VCHomeExtend() {
2014 SendMsg(2332, 0, 0);
2017 // Magnify the displayed text by increasing the sizes by 1 point.
2018 void wxStyledTextCtrl::ZoomIn() {
2019 SendMsg(2333, 0, 0);
2022 // Make the displayed text smaller by decreasing the sizes by 1 point.
2023 void wxStyledTextCtrl::ZoomOut() {
2024 SendMsg(2334, 0, 0);
2027 // Delete the word to the left of the caret.
2028 void wxStyledTextCtrl::DelWordLeft() {
2029 SendMsg(2335, 0, 0);
2032 // Delete the word to the right of the caret.
2033 void wxStyledTextCtrl::DelWordRight() {
2034 SendMsg(2336, 0, 0);
2037 // Delete the word to the right of the caret, but not the trailing non-word characters.
2038 void wxStyledTextCtrl::DelWordRightEnd() {
2039 SendMsg(2518, 0, 0);
2042 // Cut the line containing the caret.
2043 void wxStyledTextCtrl::LineCut() {
2044 SendMsg(2337, 0, 0);
2047 // Delete the line containing the caret.
2048 void wxStyledTextCtrl::LineDelete() {
2049 SendMsg(2338, 0, 0);
2052 // Switch the current line with the previous.
2053 void wxStyledTextCtrl::LineTranspose() {
2054 SendMsg(2339, 0, 0);
2057 // Duplicate the current line.
2058 void wxStyledTextCtrl::LineDuplicate() {
2059 SendMsg(2404, 0, 0);
2062 // Transform the selection to lower case.
2063 void wxStyledTextCtrl::LowerCase() {
2064 SendMsg(2340, 0, 0);
2067 // Transform the selection to upper case.
2068 void wxStyledTextCtrl::UpperCase() {
2069 SendMsg(2341, 0, 0);
2072 // Scroll the document down, keeping the caret visible.
2073 void wxStyledTextCtrl::LineScrollDown() {
2074 SendMsg(2342, 0, 0);
2077 // Scroll the document up, keeping the caret visible.
2078 void wxStyledTextCtrl::LineScrollUp() {
2079 SendMsg(2343, 0, 0);
2082 // Delete the selection or if no selection, the character before the caret.
2083 // Will not delete the character before at the start of a line.
2084 void wxStyledTextCtrl::DeleteBackNotLine() {
2085 SendMsg(2344, 0, 0);
2088 // Move caret to first position on display line.
2089 void wxStyledTextCtrl::HomeDisplay() {
2090 SendMsg(2345, 0, 0);
2093 // Move caret to first position on display line extending selection to
2094 // new caret position.
2095 void wxStyledTextCtrl::HomeDisplayExtend() {
2096 SendMsg(2346, 0, 0);
2099 // Move caret to last position on display line.
2100 void wxStyledTextCtrl::LineEndDisplay() {
2101 SendMsg(2347, 0, 0);
2104 // Move caret to last position on display line extending selection to new
2106 void wxStyledTextCtrl::LineEndDisplayExtend() {
2107 SendMsg(2348, 0, 0);
2110 // These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)?
2111 // except they behave differently when word-wrap is enabled:
2112 // They go first to the start / end of the display line, like (Home|LineEnd)Display
2113 // The difference is that, the cursor is already at the point, it goes on to the start
2114 // or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
2115 void wxStyledTextCtrl::HomeWrap() {
2116 SendMsg(2349, 0, 0);
2118 void wxStyledTextCtrl::HomeWrapExtend() {
2119 SendMsg(2450, 0, 0);
2121 void wxStyledTextCtrl::LineEndWrap() {
2122 SendMsg(2451, 0, 0);
2124 void wxStyledTextCtrl::LineEndWrapExtend() {
2125 SendMsg(2452, 0, 0);
2127 void wxStyledTextCtrl::VCHomeWrap() {
2128 SendMsg(2453, 0, 0);
2130 void wxStyledTextCtrl::VCHomeWrapExtend() {
2131 SendMsg(2454, 0, 0);
2134 // Copy the line containing the caret.
2135 void wxStyledTextCtrl::LineCopy() {
2136 SendMsg(2455, 0, 0);
2139 // Move the caret inside current view if it's not there already.
2140 void wxStyledTextCtrl::MoveCaretInsideView() {
2141 SendMsg(2401, 0, 0);
2144 // How many characters are on a line, not including end of line characters?
2145 int wxStyledTextCtrl::LineLength(int line
) {
2146 return SendMsg(2350, line
, 0);
2149 // Highlight the characters at two positions.
2150 void wxStyledTextCtrl::BraceHighlight(int pos1
, int pos2
) {
2151 SendMsg(2351, pos1
, pos2
);
2154 // Highlight the character at a position indicating there is no matching brace.
2155 void wxStyledTextCtrl::BraceBadLight(int pos
) {
2156 SendMsg(2352, pos
, 0);
2159 // Find the position of a matching brace or INVALID_POSITION if no match.
2160 int wxStyledTextCtrl::BraceMatch(int pos
) {
2161 return SendMsg(2353, pos
, 0);
2164 // Are the end of line characters visible?
2165 bool wxStyledTextCtrl::GetViewEOL() {
2166 return SendMsg(2355, 0, 0) != 0;
2169 // Make the end of line characters visible or invisible.
2170 void wxStyledTextCtrl::SetViewEOL(bool visible
) {
2171 SendMsg(2356, visible
, 0);
2174 // Retrieve a pointer to the document object.
2175 void* wxStyledTextCtrl::GetDocPointer() {
2176 return (void*)SendMsg(2357);
2179 // Change the document object used.
2180 void wxStyledTextCtrl::SetDocPointer(void* docPointer
) {
2181 SendMsg(2358, 0, (long)docPointer
);
2184 // Set which document modification events are sent to the container.
2185 void wxStyledTextCtrl::SetModEventMask(int mask
) {
2186 SendMsg(2359, mask
, 0);
2189 // Retrieve the column number which text should be kept within.
2190 int wxStyledTextCtrl::GetEdgeColumn() {
2191 return SendMsg(2360, 0, 0);
2194 // Set the column number of the edge.
2195 // If text goes past the edge then it is highlighted.
2196 void wxStyledTextCtrl::SetEdgeColumn(int column
) {
2197 SendMsg(2361, column
, 0);
2200 // Retrieve the edge highlight mode.
2201 int wxStyledTextCtrl::GetEdgeMode() {
2202 return SendMsg(2362, 0, 0);
2205 // The edge may be displayed by a line (EDGE_LINE) or by highlighting text that
2206 // goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).
2207 void wxStyledTextCtrl::SetEdgeMode(int mode
) {
2208 SendMsg(2363, mode
, 0);
2211 // Retrieve the colour used in edge indication.
2212 wxColour
wxStyledTextCtrl::GetEdgeColour() {
2213 long c
= SendMsg(2364, 0, 0);
2214 return wxColourFromLong(c
);
2217 // Change the colour used in edge indication.
2218 void wxStyledTextCtrl::SetEdgeColour(const wxColour
& edgeColour
) {
2219 SendMsg(2365, wxColourAsLong(edgeColour
), 0);
2222 // Sets the current caret position to be the search anchor.
2223 void wxStyledTextCtrl::SearchAnchor() {
2224 SendMsg(2366, 0, 0);
2227 // Find some text starting at the search anchor.
2228 // Does not ensure the selection is visible.
2229 int wxStyledTextCtrl::SearchNext(int flags
, const wxString
& text
) {
2230 return SendMsg(2367, flags
, (long)(const char*)wx2stc(text
));
2233 // Find some text starting at the search anchor and moving backwards.
2234 // Does not ensure the selection is visible.
2235 int wxStyledTextCtrl::SearchPrev(int flags
, const wxString
& text
) {
2236 return SendMsg(2368, flags
, (long)(const char*)wx2stc(text
));
2239 // Retrieves the number of lines completely visible.
2240 int wxStyledTextCtrl::LinesOnScreen() {
2241 return SendMsg(2370, 0, 0);
2244 // Set whether a pop up menu is displayed automatically when the user presses
2245 // the wrong mouse button.
2246 void wxStyledTextCtrl::UsePopUp(bool allowPopUp
) {
2247 SendMsg(2371, allowPopUp
, 0);
2250 // Is the selection rectangular? The alternative is the more common stream selection.
2251 bool wxStyledTextCtrl::SelectionIsRectangle() {
2252 return SendMsg(2372, 0, 0) != 0;
2255 // Set the zoom level. This number of points is added to the size of all fonts.
2256 // It may be positive to magnify or negative to reduce.
2257 void wxStyledTextCtrl::SetZoom(int zoom
) {
2258 SendMsg(2373, zoom
, 0);
2261 // Retrieve the zoom level.
2262 int wxStyledTextCtrl::GetZoom() {
2263 return SendMsg(2374, 0, 0);
2266 // Create a new document object.
2267 // Starts with reference count of 1 and not selected into editor.
2268 void* wxStyledTextCtrl::CreateDocument() {
2269 return (void*)SendMsg(2375);
2272 // Extend life of document.
2273 void wxStyledTextCtrl::AddRefDocument(void* docPointer
) {
2274 SendMsg(2376, 0, (long)docPointer
);
2277 // Release a reference to the document, deleting document if it fades to black.
2278 void wxStyledTextCtrl::ReleaseDocument(void* docPointer
) {
2279 SendMsg(2377, 0, (long)docPointer
);
2282 // Get which document modification events are sent to the container.
2283 int wxStyledTextCtrl::GetModEventMask() {
2284 return SendMsg(2378, 0, 0);
2287 // Change internal focus flag.
2288 void wxStyledTextCtrl::SetSTCFocus(bool focus
) {
2289 SendMsg(2380, focus
, 0);
2292 // Get internal focus flag.
2293 bool wxStyledTextCtrl::GetSTCFocus() {
2294 return SendMsg(2381, 0, 0) != 0;
2297 // Change error status - 0 = OK.
2298 void wxStyledTextCtrl::SetStatus(int statusCode
) {
2299 SendMsg(2382, statusCode
, 0);
2302 // Get error status.
2303 int wxStyledTextCtrl::GetStatus() {
2304 return SendMsg(2383, 0, 0);
2307 // Set whether the mouse is captured when its button is pressed.
2308 void wxStyledTextCtrl::SetMouseDownCaptures(bool captures
) {
2309 SendMsg(2384, captures
, 0);
2312 // Get whether mouse gets captured.
2313 bool wxStyledTextCtrl::GetMouseDownCaptures() {
2314 return SendMsg(2385, 0, 0) != 0;
2317 // Sets the cursor to one of the SC_CURSOR* values.
2318 void wxStyledTextCtrl::SetSTCCursor(int cursorType
) {
2319 SendMsg(2386, cursorType
, 0);
2323 int wxStyledTextCtrl::GetSTCCursor() {
2324 return SendMsg(2387, 0, 0);
2327 // Change the way control characters are displayed:
2328 // If symbol is < 32, keep the drawn way, else, use the given character.
2329 void wxStyledTextCtrl::SetControlCharSymbol(int symbol
) {
2330 SendMsg(2388, symbol
, 0);
2333 // Get the way control characters are displayed.
2334 int wxStyledTextCtrl::GetControlCharSymbol() {
2335 return SendMsg(2389, 0, 0);
2338 // Move to the previous change in capitalisation.
2339 void wxStyledTextCtrl::WordPartLeft() {
2340 SendMsg(2390, 0, 0);
2343 // Move to the previous change in capitalisation extending selection
2344 // to new caret position.
2345 void wxStyledTextCtrl::WordPartLeftExtend() {
2346 SendMsg(2391, 0, 0);
2349 // Move to the change next in capitalisation.
2350 void wxStyledTextCtrl::WordPartRight() {
2351 SendMsg(2392, 0, 0);
2354 // Move to the next change in capitalisation extending selection
2355 // to new caret position.
2356 void wxStyledTextCtrl::WordPartRightExtend() {
2357 SendMsg(2393, 0, 0);
2360 // Set the way the display area is determined when a particular line
2361 // is to be moved to by Find, FindNext, GotoLine, etc.
2362 void wxStyledTextCtrl::SetVisiblePolicy(int visiblePolicy
, int visibleSlop
) {
2363 SendMsg(2394, visiblePolicy
, visibleSlop
);
2366 // Delete back from the current position to the start of the line.
2367 void wxStyledTextCtrl::DelLineLeft() {
2368 SendMsg(2395, 0, 0);
2371 // Delete forwards from the current position to the end of the line.
2372 void wxStyledTextCtrl::DelLineRight() {
2373 SendMsg(2396, 0, 0);
2376 // Get and Set the xOffset (ie, horizonal scroll position).
2377 void wxStyledTextCtrl::SetXOffset(int newOffset
) {
2378 SendMsg(2397, newOffset
, 0);
2380 int wxStyledTextCtrl::GetXOffset() {
2381 return SendMsg(2398, 0, 0);
2384 // Set the last x chosen value to be the caret x position.
2385 void wxStyledTextCtrl::ChooseCaretX() {
2386 SendMsg(2399, 0, 0);
2389 // Set the way the caret is kept visible when going sideway.
2390 // The exclusion zone is given in pixels.
2391 void wxStyledTextCtrl::SetXCaretPolicy(int caretPolicy
, int caretSlop
) {
2392 SendMsg(2402, caretPolicy
, caretSlop
);
2395 // Set the way the line the caret is on is kept visible.
2396 // The exclusion zone is given in lines.
2397 void wxStyledTextCtrl::SetYCaretPolicy(int caretPolicy
, int caretSlop
) {
2398 SendMsg(2403, caretPolicy
, caretSlop
);
2401 // Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE).
2402 void wxStyledTextCtrl::SetPrintWrapMode(int mode
) {
2403 SendMsg(2406, mode
, 0);
2406 // Is printing line wrapped?
2407 int wxStyledTextCtrl::GetPrintWrapMode() {
2408 return SendMsg(2407, 0, 0);
2411 // Set a fore colour for active hotspots.
2412 void wxStyledTextCtrl::SetHotspotActiveForeground(bool useSetting
, const wxColour
& fore
) {
2413 SendMsg(2410, useSetting
, wxColourAsLong(fore
));
2416 // Get the fore colour for active hotspots.
2417 wxColour
wxStyledTextCtrl::GetHotspotActiveForeground() {
2418 long c
= SendMsg(2494, 0, 0);
2419 return wxColourFromLong(c
);
2422 // Set a back colour for active hotspots.
2423 void wxStyledTextCtrl::SetHotspotActiveBackground(bool useSetting
, const wxColour
& back
) {
2424 SendMsg(2411, useSetting
, wxColourAsLong(back
));
2427 // Get the back colour for active hotspots.
2428 wxColour
wxStyledTextCtrl::GetHotspotActiveBackground() {
2429 long c
= SendMsg(2495, 0, 0);
2430 return wxColourFromLong(c
);
2433 // Enable / Disable underlining active hotspots.
2434 void wxStyledTextCtrl::SetHotspotActiveUnderline(bool underline
) {
2435 SendMsg(2412, underline
, 0);
2438 // Get whether underlining for active hotspots.
2439 bool wxStyledTextCtrl::GetHotspotActiveUnderline() {
2440 return SendMsg(2496, 0, 0) != 0;
2443 // Limit hotspots to single line so hotspots on two lines don't merge.
2444 void wxStyledTextCtrl::SetHotspotSingleLine(bool singleLine
) {
2445 SendMsg(2421, singleLine
, 0);
2448 // Get the HotspotSingleLine property
2449 bool wxStyledTextCtrl::GetHotspotSingleLine() {
2450 return SendMsg(2497, 0, 0) != 0;
2453 // Move caret between paragraphs (delimited by empty lines).
2454 void wxStyledTextCtrl::ParaDown() {
2455 SendMsg(2413, 0, 0);
2457 void wxStyledTextCtrl::ParaDownExtend() {
2458 SendMsg(2414, 0, 0);
2460 void wxStyledTextCtrl::ParaUp() {
2461 SendMsg(2415, 0, 0);
2463 void wxStyledTextCtrl::ParaUpExtend() {
2464 SendMsg(2416, 0, 0);
2467 // Given a valid document position, return the previous position taking code
2468 // page into account. Returns 0 if passed 0.
2469 int wxStyledTextCtrl::PositionBefore(int pos
) {
2470 return SendMsg(2417, pos
, 0);
2473 // Given a valid document position, return the next position taking code
2474 // page into account. Maximum value returned is the last position in the document.
2475 int wxStyledTextCtrl::PositionAfter(int pos
) {
2476 return SendMsg(2418, pos
, 0);
2479 // Copy a range of text to the clipboard. Positions are clipped into the document.
2480 void wxStyledTextCtrl::CopyRange(int start
, int end
) {
2481 SendMsg(2419, start
, end
);
2484 // Copy argument text to the clipboard.
2485 void wxStyledTextCtrl::CopyText(int length
, const wxString
& text
) {
2486 SendMsg(2420, length
, (long)(const char*)wx2stc(text
));
2489 // Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE) or
2490 // by lines (SC_SEL_LINES).
2491 void wxStyledTextCtrl::SetSelectionMode(int mode
) {
2492 SendMsg(2422, mode
, 0);
2495 // Get the mode of the current selection.
2496 int wxStyledTextCtrl::GetSelectionMode() {
2497 return SendMsg(2423, 0, 0);
2500 // Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line).
2501 int wxStyledTextCtrl::GetLineSelStartPosition(int line
) {
2502 return SendMsg(2424, line
, 0);
2505 // Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line).
2506 int wxStyledTextCtrl::GetLineSelEndPosition(int line
) {
2507 return SendMsg(2425, line
, 0);
2510 // Move caret down one line, extending rectangular selection to new caret position.
2511 void wxStyledTextCtrl::LineDownRectExtend() {
2512 SendMsg(2426, 0, 0);
2515 // Move caret up one line, extending rectangular selection to new caret position.
2516 void wxStyledTextCtrl::LineUpRectExtend() {
2517 SendMsg(2427, 0, 0);
2520 // Move caret left one character, extending rectangular selection to new caret position.
2521 void wxStyledTextCtrl::CharLeftRectExtend() {
2522 SendMsg(2428, 0, 0);
2525 // Move caret right one character, extending rectangular selection to new caret position.
2526 void wxStyledTextCtrl::CharRightRectExtend() {
2527 SendMsg(2429, 0, 0);
2530 // Move caret to first position on line, extending rectangular selection to new caret position.
2531 void wxStyledTextCtrl::HomeRectExtend() {
2532 SendMsg(2430, 0, 0);
2535 // Move caret to before first visible character on line.
2536 // If already there move to first character on line.
2537 // In either case, extend rectangular selection to new caret position.
2538 void wxStyledTextCtrl::VCHomeRectExtend() {
2539 SendMsg(2431, 0, 0);
2542 // Move caret to last position on line, extending rectangular selection to new caret position.
2543 void wxStyledTextCtrl::LineEndRectExtend() {
2544 SendMsg(2432, 0, 0);
2547 // Move caret one page up, extending rectangular selection to new caret position.
2548 void wxStyledTextCtrl::PageUpRectExtend() {
2549 SendMsg(2433, 0, 0);
2552 // Move caret one page down, extending rectangular selection to new caret position.
2553 void wxStyledTextCtrl::PageDownRectExtend() {
2554 SendMsg(2434, 0, 0);
2557 // Move caret to top of page, or one page up if already at top of page.
2558 void wxStyledTextCtrl::StutteredPageUp() {
2559 SendMsg(2435, 0, 0);
2562 // Move caret to top of page, or one page up if already at top of page, extending selection to new caret position.
2563 void wxStyledTextCtrl::StutteredPageUpExtend() {
2564 SendMsg(2436, 0, 0);
2567 // Move caret to bottom of page, or one page down if already at bottom of page.
2568 void wxStyledTextCtrl::StutteredPageDown() {
2569 SendMsg(2437, 0, 0);
2572 // Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position.
2573 void wxStyledTextCtrl::StutteredPageDownExtend() {
2574 SendMsg(2438, 0, 0);
2577 // Move caret left one word, position cursor at end of word.
2578 void wxStyledTextCtrl::WordLeftEnd() {
2579 SendMsg(2439, 0, 0);
2582 // Move caret left one word, position cursor at end of word, extending selection to new caret position.
2583 void wxStyledTextCtrl::WordLeftEndExtend() {
2584 SendMsg(2440, 0, 0);
2587 // Move caret right one word, position cursor at end of word.
2588 void wxStyledTextCtrl::WordRightEnd() {
2589 SendMsg(2441, 0, 0);
2592 // Move caret right one word, position cursor at end of word, extending selection to new caret position.
2593 void wxStyledTextCtrl::WordRightEndExtend() {
2594 SendMsg(2442, 0, 0);
2597 // Set the set of characters making up whitespace for when moving or selecting by word.
2598 // Should be called after SetWordChars.
2599 void wxStyledTextCtrl::SetWhitespaceChars(const wxString
& characters
) {
2600 SendMsg(2443, 0, (long)(const char*)wx2stc(characters
));
2603 // Reset the set of characters for whitespace and word characters to the defaults.
2604 void wxStyledTextCtrl::SetCharsDefault() {
2605 SendMsg(2444, 0, 0);
2608 // Get currently selected item position in the auto-completion list
2609 int wxStyledTextCtrl::AutoCompGetCurrent() {
2610 return SendMsg(2445, 0, 0);
2613 // Enlarge the document to a particular size of text bytes.
2614 void wxStyledTextCtrl::Allocate(int bytes
) {
2615 SendMsg(2446, bytes
, 0);
2618 // Find the position of a column on a line taking into account tabs and
2619 // multi-byte characters. If beyond end of line, return line end position.
2620 int wxStyledTextCtrl::FindColumn(int line
, int column
) {
2621 return SendMsg(2456, line
, column
);
2624 // Can the caret preferred x position only be changed by explicit movement commands?
2625 bool wxStyledTextCtrl::GetCaretSticky() {
2626 return SendMsg(2457, 0, 0) != 0;
2629 // Stop the caret preferred x position changing when the user types.
2630 void wxStyledTextCtrl::SetCaretSticky(bool useCaretStickyBehaviour
) {
2631 SendMsg(2458, useCaretStickyBehaviour
, 0);
2634 // Switch between sticky and non-sticky: meant to be bound to a key.
2635 void wxStyledTextCtrl::ToggleCaretSticky() {
2636 SendMsg(2459, 0, 0);
2639 // Enable/Disable convert-on-paste for line endings
2640 void wxStyledTextCtrl::SetPasteConvertEndings(bool convert
) {
2641 SendMsg(2467, convert
, 0);
2644 // Get convert-on-paste setting
2645 bool wxStyledTextCtrl::GetPasteConvertEndings() {
2646 return SendMsg(2468, 0, 0) != 0;
2649 // Duplicate the selection. If selection empty duplicate the line containing the caret.
2650 void wxStyledTextCtrl::SelectionDuplicate() {
2651 SendMsg(2469, 0, 0);
2654 // Set background alpha of the caret line.
2655 void wxStyledTextCtrl::SetCaretLineBackAlpha(int alpha
) {
2656 SendMsg(2470, alpha
, 0);
2659 // Get the background alpha of the caret line.
2660 int wxStyledTextCtrl::GetCaretLineBackAlpha() {
2661 return SendMsg(2471, 0, 0);
2664 // Set the style of the caret to be drawn.
2665 void wxStyledTextCtrl::SetCaretStyle(int caretStyle
) {
2666 SendMsg(2512, caretStyle
, 0);
2669 // Returns the current style of the caret.
2670 int wxStyledTextCtrl::GetCaretStyle() {
2671 return SendMsg(2513, 0, 0);
2674 // Set the indicator used for IndicatorFillRange and IndicatorClearRange
2675 void wxStyledTextCtrl::SetIndicatorCurrent(int indicator
) {
2676 SendMsg(2500, indicator
, 0);
2679 // Get the current indicator
2680 int wxStyledTextCtrl::GetIndicatorCurrent() {
2681 return SendMsg(2501, 0, 0);
2684 // Set the value used for IndicatorFillRange
2685 void wxStyledTextCtrl::SetIndicatorValue(int value
) {
2686 SendMsg(2502, value
, 0);
2689 // Get the current indicator vaue
2690 int wxStyledTextCtrl::GetIndicatorValue() {
2691 return SendMsg(2503, 0, 0);
2694 // Turn a indicator on over a range.
2695 void wxStyledTextCtrl::IndicatorFillRange(int position
, int fillLength
) {
2696 SendMsg(2504, position
, fillLength
);
2699 // Turn a indicator off over a range.
2700 void wxStyledTextCtrl::IndicatorClearRange(int position
, int clearLength
) {
2701 SendMsg(2505, position
, clearLength
);
2704 // Are any indicators present at position?
2705 int wxStyledTextCtrl::IndicatorAllOnFor(int position
) {
2706 return SendMsg(2506, position
, 0);
2709 // What value does a particular indicator have at at a position?
2710 int wxStyledTextCtrl::IndicatorValueAt(int indicator
, int position
) {
2711 return SendMsg(2507, indicator
, position
);
2714 // Where does a particular indicator start?
2715 int wxStyledTextCtrl::IndicatorStart(int indicator
, int position
) {
2716 return SendMsg(2508, indicator
, position
);
2719 // Where does a particular indicator end?
2720 int wxStyledTextCtrl::IndicatorEnd(int indicator
, int position
) {
2721 return SendMsg(2509, indicator
, position
);
2724 // Set number of entries in position cache
2725 void wxStyledTextCtrl::SetPositionCacheSize(int size
) {
2726 SendMsg(2514, size
, 0);
2729 // How many entries are allocated to the position cache?
2730 int wxStyledTextCtrl::GetPositionCacheSize() {
2731 return SendMsg(2515, 0, 0);
2734 // Start notifying the container of all key presses and commands.
2735 void wxStyledTextCtrl::StartRecord() {
2736 SendMsg(3001, 0, 0);
2739 // Stop notifying the container of all key presses and commands.
2740 void wxStyledTextCtrl::StopRecord() {
2741 SendMsg(3002, 0, 0);
2744 // Set the lexing language of the document.
2745 void wxStyledTextCtrl::SetLexer(int lexer
) {
2746 SendMsg(4001, lexer
, 0);
2749 // Retrieve the lexing language of the document.
2750 int wxStyledTextCtrl::GetLexer() {
2751 return SendMsg(4002, 0, 0);
2754 // Colourise a segment of the document using the current lexing language.
2755 void wxStyledTextCtrl::Colourise(int start
, int end
) {
2756 SendMsg(4003, start
, end
);
2759 // Set up a value that may be used by a lexer for some optional feature.
2760 void wxStyledTextCtrl::SetProperty(const wxString
& key
, const wxString
& value
) {
2761 SendMsg(4004, (long)(const char*)wx2stc(key
), (long)(const char*)wx2stc(value
));
2764 // Set up the key words used by the lexer.
2765 void wxStyledTextCtrl::SetKeyWords(int keywordSet
, const wxString
& keyWords
) {
2766 SendMsg(4005, keywordSet
, (long)(const char*)wx2stc(keyWords
));
2769 // Set the lexing language of the document based on string name.
2770 void wxStyledTextCtrl::SetLexerLanguage(const wxString
& language
) {
2771 SendMsg(4006, 0, (long)(const char*)wx2stc(language
));
2774 // Retrieve a 'property' value previously set with SetProperty.
2775 wxString
wxStyledTextCtrl::GetProperty(const wxString
& key
) {
2776 int len
= SendMsg(SCI_GETPROPERTY
, (long)(const char*)wx2stc(key
), 0);
2777 if (!len
) return wxEmptyString
;
2779 wxMemoryBuffer
mbuf(len
+1);
2780 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
2781 SendMsg(4008, (long)(const char*)wx2stc(key
), (long)buf
);
2782 mbuf
.UngetWriteBuf(len
);
2787 // Retrieve a 'property' value previously set with SetProperty,
2788 // with '$()' variable replacement on returned buffer.
2789 wxString
wxStyledTextCtrl::GetPropertyExpanded(const wxString
& key
) {
2790 int len
= SendMsg(SCI_GETPROPERTYEXPANDED
, (long)(const char*)wx2stc(key
), 0);
2791 if (!len
) return wxEmptyString
;
2793 wxMemoryBuffer
mbuf(len
+1);
2794 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
2795 SendMsg(4009, (long)(const char*)wx2stc(key
), (long)buf
);
2796 mbuf
.UngetWriteBuf(len
);
2801 // Retrieve a 'property' value previously set with SetProperty,
2802 // interpreted as an int AFTER any '$()' variable replacement.
2803 int wxStyledTextCtrl::GetPropertyInt(const wxString
& key
) {
2804 return SendMsg(4010, (long)(const char*)wx2stc(key
), 0);
2807 // Retrieve the number of bits the current lexer needs for styling.
2808 int wxStyledTextCtrl::GetStyleBitsNeeded() {
2809 return SendMsg(4011, 0, 0);
2812 // END of generated section
2813 //----------------------------------------------------------------------
2816 // Returns the line number of the line with the caret.
2817 int wxStyledTextCtrl::GetCurrentLine() {
2818 int line
= LineFromPosition(GetCurrentPos());
2823 // Extract style settings from a spec-string which is composed of one or
2824 // more of the following comma separated elements:
2826 // bold turns on bold
2827 // italic turns on italics
2828 // fore:[name or #RRGGBB] sets the foreground colour
2829 // back:[name or #RRGGBB] sets the background colour
2830 // face:[facename] sets the font face name to use
2831 // size:[num] sets the font size in points
2832 // eol turns on eol filling
2833 // underline turns on underlining
2835 void wxStyledTextCtrl::StyleSetSpec(int styleNum
, const wxString
& spec
) {
2837 wxStringTokenizer
tkz(spec
, wxT(","));
2838 while (tkz
.HasMoreTokens()) {
2839 wxString token
= tkz
.GetNextToken();
2841 wxString option
= token
.BeforeFirst(':');
2842 wxString val
= token
.AfterFirst(':');
2844 if (option
== wxT("bold"))
2845 StyleSetBold(styleNum
, true);
2847 else if (option
== wxT("italic"))
2848 StyleSetItalic(styleNum
, true);
2850 else if (option
== wxT("underline"))
2851 StyleSetUnderline(styleNum
, true);
2853 else if (option
== wxT("eol"))
2854 StyleSetEOLFilled(styleNum
, true);
2856 else if (option
== wxT("size")) {
2858 if (val
.ToLong(&points
))
2859 StyleSetSize(styleNum
, points
);
2862 else if (option
== wxT("face"))
2863 StyleSetFaceName(styleNum
, val
);
2865 else if (option
== wxT("fore"))
2866 StyleSetForeground(styleNum
, wxColourFromSpec(val
));
2868 else if (option
== wxT("back"))
2869 StyleSetBackground(styleNum
, wxColourFromSpec(val
));
2874 // Get the font of a style
2875 wxFont
wxStyledTextCtrl::StyleGetFont(int style
) {
2877 font
.SetPointSize(StyleGetSize(style
));
2878 font
.SetFaceName(StyleGetFaceName(style
));
2879 if( StyleGetBold(style
) )
2880 font
.SetWeight(wxFONTWEIGHT_BOLD
);
2882 font
.SetWeight(wxFONTWEIGHT_NORMAL
);
2884 if( StyleGetItalic(style
) )
2885 font
.SetStyle(wxFONTSTYLE_ITALIC
);
2887 font
.SetStyle(wxFONTSTYLE_NORMAL
);
2893 // Set style size, face, bold, italic, and underline attributes from
2894 // a wxFont's attributes.
2895 void wxStyledTextCtrl::StyleSetFont(int styleNum
, wxFont
& font
) {
2897 // Ensure that the native font is initialized
2899 GetTextExtent(wxT("X"), &x
, &y
, NULL
, NULL
, &font
);
2901 int size
= font
.GetPointSize();
2902 wxString faceName
= font
.GetFaceName();
2903 bool bold
= font
.GetWeight() == wxBOLD
;
2904 bool italic
= font
.GetStyle() != wxNORMAL
;
2905 bool under
= font
.GetUnderlined();
2906 wxFontEncoding encoding
= font
.GetEncoding();
2908 StyleSetFontAttr(styleNum
, size
, faceName
, bold
, italic
, under
, encoding
);
2911 // Set all font style attributes at once.
2912 void wxStyledTextCtrl::StyleSetFontAttr(int styleNum
, int size
,
2913 const wxString
& faceName
,
2914 bool bold
, bool italic
,
2916 wxFontEncoding encoding
) {
2917 StyleSetSize(styleNum
, size
);
2918 StyleSetFaceName(styleNum
, faceName
);
2919 StyleSetBold(styleNum
, bold
);
2920 StyleSetItalic(styleNum
, italic
);
2921 StyleSetUnderline(styleNum
, underline
);
2922 StyleSetFontEncoding(styleNum
, encoding
);
2926 // Set the character set of the font in a style. Converts the Scintilla
2927 // character set values to a wxFontEncoding.
2928 void wxStyledTextCtrl::StyleSetCharacterSet(int style
, int characterSet
)
2930 wxFontEncoding encoding
;
2932 // Translate the Scintilla characterSet to a wxFontEncoding
2933 switch (characterSet
) {
2935 case wxSTC_CHARSET_ANSI
:
2936 case wxSTC_CHARSET_DEFAULT
:
2937 encoding
= wxFONTENCODING_DEFAULT
;
2940 case wxSTC_CHARSET_BALTIC
:
2941 encoding
= wxFONTENCODING_ISO8859_13
;
2944 case wxSTC_CHARSET_CHINESEBIG5
:
2945 encoding
= wxFONTENCODING_CP950
;
2948 case wxSTC_CHARSET_EASTEUROPE
:
2949 encoding
= wxFONTENCODING_ISO8859_2
;
2952 case wxSTC_CHARSET_GB2312
:
2953 encoding
= wxFONTENCODING_CP936
;
2956 case wxSTC_CHARSET_GREEK
:
2957 encoding
= wxFONTENCODING_ISO8859_7
;
2960 case wxSTC_CHARSET_HANGUL
:
2961 encoding
= wxFONTENCODING_CP949
;
2964 case wxSTC_CHARSET_MAC
:
2965 encoding
= wxFONTENCODING_DEFAULT
;
2968 case wxSTC_CHARSET_OEM
:
2969 encoding
= wxFONTENCODING_DEFAULT
;
2972 case wxSTC_CHARSET_RUSSIAN
:
2973 encoding
= wxFONTENCODING_KOI8
;
2976 case wxSTC_CHARSET_SHIFTJIS
:
2977 encoding
= wxFONTENCODING_CP932
;
2980 case wxSTC_CHARSET_SYMBOL
:
2981 encoding
= wxFONTENCODING_DEFAULT
;
2984 case wxSTC_CHARSET_TURKISH
:
2985 encoding
= wxFONTENCODING_ISO8859_9
;
2988 case wxSTC_CHARSET_JOHAB
:
2989 encoding
= wxFONTENCODING_DEFAULT
;
2992 case wxSTC_CHARSET_HEBREW
:
2993 encoding
= wxFONTENCODING_ISO8859_8
;
2996 case wxSTC_CHARSET_ARABIC
:
2997 encoding
= wxFONTENCODING_ISO8859_6
;
3000 case wxSTC_CHARSET_VIETNAMESE
:
3001 encoding
= wxFONTENCODING_DEFAULT
;
3004 case wxSTC_CHARSET_THAI
:
3005 encoding
= wxFONTENCODING_ISO8859_11
;
3008 case wxSTC_CHARSET_CYRILLIC
:
3009 encoding
= wxFONTENCODING_ISO8859_5
;
3012 case wxSTC_CHARSET_8859_15
:
3013 encoding
= wxFONTENCODING_ISO8859_15
;;
3017 // We just have Scintilla track the wxFontEncoding for us. It gets used
3018 // in Font::Create in PlatWX.cpp. We add one to the value so that the
3019 // effective wxFONENCODING_DEFAULT == SC_SHARSET_DEFAULT and so when
3020 // Scintilla internally uses SC_CHARSET_DEFAULT we will translate it back
3021 // to wxFONENCODING_DEFAULT in Font::Create.
3022 SendMsg(SCI_STYLESETCHARACTERSET
, style
, encoding
+1);
3026 // Set the font encoding to be used by a style.
3027 void wxStyledTextCtrl::StyleSetFontEncoding(int style
, wxFontEncoding encoding
)
3029 SendMsg(SCI_STYLESETCHARACTERSET
, style
, encoding
+1);
3033 // Perform one of the operations defined by the wxSTC_CMD_* constants.
3034 void wxStyledTextCtrl::CmdKeyExecute(int cmd
) {
3039 // Set the left and right margin in the edit area, measured in pixels.
3040 void wxStyledTextCtrl::SetMargins(int left
, int right
) {
3041 SetMarginLeft(left
);
3042 SetMarginRight(right
);
3046 // Retrieve the start and end positions of the current selection.
3047 void wxStyledTextCtrl::GetSelection(int* startPos
, int* endPos
) {
3048 if (startPos
!= NULL
)
3049 *startPos
= SendMsg(SCI_GETSELECTIONSTART
);
3051 *endPos
= SendMsg(SCI_GETSELECTIONEND
);
3055 // Retrieve the point in the window where a position is displayed.
3056 wxPoint
wxStyledTextCtrl::PointFromPosition(int pos
) {
3057 int x
= SendMsg(SCI_POINTXFROMPOSITION
, 0, pos
);
3058 int y
= SendMsg(SCI_POINTYFROMPOSITION
, 0, pos
);
3059 return wxPoint(x
, y
);
3062 // Scroll enough to make the given line visible
3063 void wxStyledTextCtrl::ScrollToLine(int line
) {
3064 m_swx
->DoScrollToLine(line
);
3068 // Scroll enough to make the given column visible
3069 void wxStyledTextCtrl::ScrollToColumn(int column
) {
3070 m_swx
->DoScrollToColumn(column
);
3074 bool wxStyledTextCtrl::SaveFile(const wxString
& filename
)
3076 wxFile
file(filename
, wxFile::write
);
3078 if (!file
.IsOpened())
3081 bool success
= file
.Write(GetText(), *wxConvCurrent
);
3089 bool wxStyledTextCtrl::LoadFile(const wxString
& filename
)
3091 bool success
= false;
3092 wxFile
file(filename
, wxFile::read
);
3094 if (file
.IsOpened())
3097 // get the file size (assume it is not huge file...)
3098 ssize_t len
= (ssize_t
)file
.Length();
3103 wxMemoryBuffer
buffer(len
+1);
3104 success
= (file
.Read(buffer
.GetData(), len
) == len
);
3106 ((char*)buffer
.GetData())[len
] = 0;
3107 contents
= wxString(buffer
, *wxConvCurrent
, len
);
3111 success
= (file
.Read(wxStringBuffer(buffer
, len
), len
) == len
);
3118 success
= true; // empty file is ok
3120 success
= false; // len == wxInvalidOffset
3135 #if wxUSE_DRAG_AND_DROP
3136 wxDragResult
wxStyledTextCtrl::DoDragOver(wxCoord x
, wxCoord y
, wxDragResult def
) {
3137 return m_swx
->DoDragOver(x
, y
, def
);
3141 bool wxStyledTextCtrl::DoDropText(long x
, long y
, const wxString
& data
) {
3142 return m_swx
->DoDropText(x
, y
, data
);
3147 void wxStyledTextCtrl::SetUseAntiAliasing(bool useAA
) {
3148 m_swx
->SetUseAntiAliasing(useAA
);
3151 bool wxStyledTextCtrl::GetUseAntiAliasing() {
3152 return m_swx
->GetUseAntiAliasing();
3159 void wxStyledTextCtrl::AddTextRaw(const char* text
)
3161 SendMsg(SCI_ADDTEXT
, strlen(text
), (long)text
);
3164 void wxStyledTextCtrl::InsertTextRaw(int pos
, const char* text
)
3166 SendMsg(SCI_INSERTTEXT
, pos
, (long)text
);
3169 wxCharBuffer
wxStyledTextCtrl::GetCurLineRaw(int* linePos
)
3171 int len
= LineLength(GetCurrentLine());
3173 if (linePos
) *linePos
= 0;
3178 wxCharBuffer
buf(len
);
3179 int pos
= SendMsg(SCI_GETCURLINE
, len
, (long)buf
.data());
3180 if (linePos
) *linePos
= pos
;
3184 wxCharBuffer
wxStyledTextCtrl::GetLineRaw(int line
)
3186 int len
= LineLength(line
);
3192 wxCharBuffer
buf(len
);
3193 SendMsg(SCI_GETLINE
, line
, (long)buf
.data());
3197 wxCharBuffer
wxStyledTextCtrl::GetSelectedTextRaw()
3202 GetSelection(&start
, &end
);
3203 int len
= end
- start
;
3209 wxCharBuffer
buf(len
);
3210 SendMsg(SCI_GETSELTEXT
, 0, (long)buf
.data());
3214 wxCharBuffer
wxStyledTextCtrl::GetTextRangeRaw(int startPos
, int endPos
)
3216 if (endPos
< startPos
) {
3217 int temp
= startPos
;
3221 int len
= endPos
- startPos
;
3227 wxCharBuffer
buf(len
);
3229 tr
.lpstrText
= buf
.data();
3230 tr
.chrg
.cpMin
= startPos
;
3231 tr
.chrg
.cpMax
= endPos
;
3232 SendMsg(SCI_GETTEXTRANGE
, 0, (long)&tr
);
3236 void wxStyledTextCtrl::SetTextRaw(const char* text
)
3238 SendMsg(SCI_SETTEXT
, 0, (long)text
);
3241 wxCharBuffer
wxStyledTextCtrl::GetTextRaw()
3243 int len
= GetTextLength();
3244 wxCharBuffer
buf(len
);
3245 SendMsg(SCI_GETTEXT
, len
, (long)buf
.data());
3249 void wxStyledTextCtrl::AppendTextRaw(const char* text
)
3251 SendMsg(SCI_APPENDTEXT
, strlen(text
), (long)text
);
3258 //----------------------------------------------------------------------
3261 void wxStyledTextCtrl::OnPaint(wxPaintEvent
& WXUNUSED(evt
)) {
3263 m_swx
->DoPaint(&dc
, GetUpdateRegion().GetBox());
3266 void wxStyledTextCtrl::OnScrollWin(wxScrollWinEvent
& evt
) {
3267 if (evt
.GetOrientation() == wxHORIZONTAL
)
3268 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
3270 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
3273 void wxStyledTextCtrl::OnScroll(wxScrollEvent
& evt
) {
3274 wxScrollBar
* sb
= wxDynamicCast(evt
.GetEventObject(), wxScrollBar
);
3276 if (sb
->IsVertical())
3277 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
3279 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
3283 void wxStyledTextCtrl::OnSize(wxSizeEvent
& WXUNUSED(evt
)) {
3285 wxSize sz
= GetClientSize();
3286 m_swx
->DoSize(sz
.x
, sz
.y
);
3290 void wxStyledTextCtrl::OnMouseLeftDown(wxMouseEvent
& evt
) {
3292 wxPoint pt
= evt
.GetPosition();
3293 m_swx
->DoLeftButtonDown(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
3294 evt
.ShiftDown(), evt
.ControlDown(), evt
.AltDown());
3297 void wxStyledTextCtrl::OnMouseMove(wxMouseEvent
& evt
) {
3298 wxPoint pt
= evt
.GetPosition();
3299 m_swx
->DoLeftButtonMove(Point(pt
.x
, pt
.y
));
3302 void wxStyledTextCtrl::OnMouseLeftUp(wxMouseEvent
& evt
) {
3303 wxPoint pt
= evt
.GetPosition();
3304 m_swx
->DoLeftButtonUp(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
3309 void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent
& evt
) {
3310 wxPoint pt
= evt
.GetPosition();
3311 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
3315 void wxStyledTextCtrl::OnMouseMiddleUp(wxMouseEvent
& evt
) {
3316 wxPoint pt
= evt
.GetPosition();
3317 m_swx
->DoMiddleButtonUp(Point(pt
.x
, pt
.y
));
3320 void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent
& evt
) {
3321 wxPoint pt
= evt
.GetPosition();
3322 ScreenToClient(&pt
.x
, &pt
.y
);
3324 Show context menu at event point if it's within the window,
3325 or at caret location if not
3327 wxHitTest ht
= this->HitTest(pt
);
3328 if (ht
!= wxHT_WINDOW_INSIDE
) {
3329 pt
= this->PointFromPosition(this->GetCurrentPos());
3331 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
3335 void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent
& evt
) {
3336 m_swx
->DoMouseWheel(evt
.GetWheelRotation(),
3337 evt
.GetWheelDelta(),
3338 evt
.GetLinesPerAction(),
3340 evt
.IsPageScroll());
3344 void wxStyledTextCtrl::OnChar(wxKeyEvent
& evt
) {
3345 // On (some?) non-US PC keyboards the AltGr key is required to enter some
3346 // common characters. It comes to us as both Alt and Ctrl down so we need
3347 // to let the char through in that case, otherwise if only ctrl or only
3348 // alt let's skip it.
3349 bool ctrl
= evt
.ControlDown();
3351 // On the Mac the Alt key is just a modifier key (like Shift) so we need
3352 // to allow the char events to be processed when Alt is pressed.
3353 // TODO: Should we check MetaDown instead in this case?
3356 bool alt
= evt
.AltDown();
3358 bool skip
= ((ctrl
|| alt
) && ! (ctrl
&& alt
));
3361 // apparently if we don't do this, Unicode keys pressed after non-char
3362 // ASCII ones (e.g. Enter, Tab) are not taken into account (patch 1615989)
3363 if (m_lastKeyDownConsumed
&& evt
.GetUnicodeKey() > 255)
3364 m_lastKeyDownConsumed
= false;
3367 if (!m_lastKeyDownConsumed
&& !skip
) {
3369 int key
= evt
.GetUnicodeKey();
3372 // if the unicode key code is not really a unicode character (it may
3373 // be a function key or etc., the platforms appear to always give us a
3374 // small value in this case) then fallback to the ascii key code but
3375 // don't do anything for function keys or etc.
3377 key
= evt
.GetKeyCode();
3378 keyOk
= (key
<= 127);
3381 m_swx
->DoAddChar(key
);
3385 int key
= evt
.GetKeyCode();
3386 if (key
<= WXK_START
|| key
> WXK_COMMAND
) {
3387 m_swx
->DoAddChar(key
);
3397 void wxStyledTextCtrl::OnKeyDown(wxKeyEvent
& evt
) {
3398 int processed
= m_swx
->DoKeyDown(evt
, &m_lastKeyDownConsumed
);
3399 if (!processed
&& !m_lastKeyDownConsumed
)
3404 void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent
& evt
) {
3405 m_swx
->DoLoseFocus();
3410 void wxStyledTextCtrl::OnGainFocus(wxFocusEvent
& evt
) {
3411 m_swx
->DoGainFocus();
3416 void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent
& WXUNUSED(evt
)) {
3417 m_swx
->DoSysColourChange();
3421 void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent
& WXUNUSED(evt
)) {
3422 // do nothing to help avoid flashing
3427 void wxStyledTextCtrl::OnMenu(wxCommandEvent
& evt
) {
3428 m_swx
->DoCommand(evt
.GetId());
3432 void wxStyledTextCtrl::OnListBox(wxCommandEvent
& WXUNUSED(evt
)) {
3433 m_swx
->DoOnListBox();
3437 void wxStyledTextCtrl::OnIdle(wxIdleEvent
& evt
) {
3438 m_swx
->DoOnIdle(evt
);
3442 wxSize
wxStyledTextCtrl::DoGetBestSize() const
3444 // What would be the best size for a wxSTC?
3445 // Just give a reasonable minimum until something else can be figured out.
3446 return wxSize(200,100);
3450 //----------------------------------------------------------------------
3451 // Turn notifications from Scintilla into events
3454 void wxStyledTextCtrl::NotifyChange() {
3455 wxStyledTextEvent
evt(wxEVT_STC_CHANGE
, GetId());
3456 evt
.SetEventObject(this);
3457 GetEventHandler()->ProcessEvent(evt
);
3461 static void SetEventText(wxStyledTextEvent
& evt
, const char* text
,
3465 evt
.SetText(stc2wx(text
, length
));
3469 void wxStyledTextCtrl::NotifyParent(SCNotification
* _scn
) {
3470 SCNotification
& scn
= *_scn
;
3471 wxStyledTextEvent
evt(0, GetId());
3473 evt
.SetEventObject(this);
3474 evt
.SetPosition(scn
.position
);
3476 evt
.SetModifiers(scn
.modifiers
);
3478 switch (scn
.nmhdr
.code
) {
3479 case SCN_STYLENEEDED
:
3480 evt
.SetEventType(wxEVT_STC_STYLENEEDED
);
3484 evt
.SetEventType(wxEVT_STC_CHARADDED
);
3487 case SCN_SAVEPOINTREACHED
:
3488 evt
.SetEventType(wxEVT_STC_SAVEPOINTREACHED
);
3491 case SCN_SAVEPOINTLEFT
:
3492 evt
.SetEventType(wxEVT_STC_SAVEPOINTLEFT
);
3495 case SCN_MODIFYATTEMPTRO
:
3496 evt
.SetEventType(wxEVT_STC_ROMODIFYATTEMPT
);
3500 evt
.SetEventType(wxEVT_STC_KEY
);
3503 case SCN_DOUBLECLICK
:
3504 evt
.SetEventType(wxEVT_STC_DOUBLECLICK
);
3508 evt
.SetEventType(wxEVT_STC_UPDATEUI
);
3512 evt
.SetEventType(wxEVT_STC_MODIFIED
);
3513 evt
.SetModificationType(scn
.modificationType
);
3514 SetEventText(evt
, scn
.text
, scn
.length
);
3515 evt
.SetLength(scn
.length
);
3516 evt
.SetLinesAdded(scn
.linesAdded
);
3517 evt
.SetLine(scn
.line
);
3518 evt
.SetFoldLevelNow(scn
.foldLevelNow
);
3519 evt
.SetFoldLevelPrev(scn
.foldLevelPrev
);
3522 case SCN_MACRORECORD
:
3523 evt
.SetEventType(wxEVT_STC_MACRORECORD
);
3524 evt
.SetMessage(scn
.message
);
3525 evt
.SetWParam(scn
.wParam
);
3526 evt
.SetLParam(scn
.lParam
);
3529 case SCN_MARGINCLICK
:
3530 evt
.SetEventType(wxEVT_STC_MARGINCLICK
);
3531 evt
.SetMargin(scn
.margin
);
3535 evt
.SetEventType(wxEVT_STC_NEEDSHOWN
);
3536 evt
.SetLength(scn
.length
);
3540 evt
.SetEventType(wxEVT_STC_PAINTED
);
3543 case SCN_AUTOCSELECTION
:
3544 evt
.SetEventType(wxEVT_STC_AUTOCOMP_SELECTION
);
3545 evt
.SetListType(scn
.listType
);
3546 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
3547 evt
.SetPosition(scn
.lParam
);
3550 case SCN_USERLISTSELECTION
:
3551 evt
.SetEventType(wxEVT_STC_USERLISTSELECTION
);
3552 evt
.SetListType(scn
.listType
);
3553 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
3554 evt
.SetPosition(scn
.lParam
);
3557 case SCN_URIDROPPED
:
3558 evt
.SetEventType(wxEVT_STC_URIDROPPED
);
3559 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
3562 case SCN_DWELLSTART
:
3563 evt
.SetEventType(wxEVT_STC_DWELLSTART
);
3569 evt
.SetEventType(wxEVT_STC_DWELLEND
);
3575 evt
.SetEventType(wxEVT_STC_ZOOM
);
3578 case SCN_HOTSPOTCLICK
:
3579 evt
.SetEventType(wxEVT_STC_HOTSPOT_CLICK
);
3582 case SCN_HOTSPOTDOUBLECLICK
:
3583 evt
.SetEventType(wxEVT_STC_HOTSPOT_DCLICK
);
3586 case SCN_CALLTIPCLICK
:
3587 evt
.SetEventType(wxEVT_STC_CALLTIP_CLICK
);
3590 case SCN_INDICATORCLICK
:
3591 evt
.SetEventType(wxEVT_STC_INDICATOR_CLICK
);
3594 case SCN_INDICATORRELEASE
:
3595 evt
.SetEventType(wxEVT_STC_INDICATOR_RELEASE
);
3602 GetEventHandler()->ProcessEvent(evt
);
3606 //----------------------------------------------------------------------
3607 //----------------------------------------------------------------------
3608 //----------------------------------------------------------------------
3610 wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType
, int id
)
3611 : wxCommandEvent(commandType
, id
)
3616 m_modificationType
= 0;
3621 m_foldLevelPrev
= 0;
3629 m_dragAllowMove
= false;
3630 #if wxUSE_DRAG_AND_DROP
3631 m_dragResult
= wxDragNone
;
3635 bool wxStyledTextEvent::GetShift() const { return (m_modifiers
& SCI_SHIFT
) != 0; }
3636 bool wxStyledTextEvent::GetControl() const { return (m_modifiers
& SCI_CTRL
) != 0; }
3637 bool wxStyledTextEvent::GetAlt() const { return (m_modifiers
& SCI_ALT
) != 0; }
3640 wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent
& event
):
3641 wxCommandEvent(event
)
3643 m_position
= event
.m_position
;
3644 m_key
= event
.m_key
;
3645 m_modifiers
= event
.m_modifiers
;
3646 m_modificationType
= event
.m_modificationType
;
3647 m_text
= event
.m_text
;
3648 m_length
= event
.m_length
;
3649 m_linesAdded
= event
.m_linesAdded
;
3650 m_line
= event
.m_line
;
3651 m_foldLevelNow
= event
.m_foldLevelNow
;
3652 m_foldLevelPrev
= event
.m_foldLevelPrev
;
3654 m_margin
= event
.m_margin
;
3656 m_message
= event
.m_message
;
3657 m_wParam
= event
.m_wParam
;
3658 m_lParam
= event
.m_lParam
;
3660 m_listType
= event
.m_listType
;
3664 m_dragText
= event
.m_dragText
;
3665 m_dragAllowMove
=event
.m_dragAllowMove
;
3666 #if wxUSE_DRAG_AND_DROP
3667 m_dragResult
= event
.m_dragResult
;
3671 //----------------------------------------------------------------------
3672 //----------------------------------------------------------------------