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
);
204 wxStyledTextCtrl::~wxStyledTextCtrl() {
209 //----------------------------------------------------------------------
211 long wxStyledTextCtrl::SendMsg(int msg
, long wp
, long lp
) {
213 return m_swx
->WndProc(msg
, wp
, lp
);
216 //----------------------------------------------------------------------
218 // Set the vertical scrollbar to use instead of the ont that's built-in.
219 void wxStyledTextCtrl::SetVScrollBar(wxScrollBar
* bar
) {
222 // ensure that the built-in scrollbar is not visible
223 SetScrollbar(wxVERTICAL
, 0, 0, 0);
228 // Set the horizontal scrollbar to use instead of the ont that's built-in.
229 void wxStyledTextCtrl::SetHScrollBar(wxScrollBar
* bar
) {
232 // ensure that the built-in scrollbar is not visible
233 SetScrollbar(wxHORIZONTAL
, 0, 0, 0);
237 //----------------------------------------------------------------------
238 // BEGIN generated section. The following code is automatically generated
239 // by gen_iface.py from the contents of Scintilla.iface. Do not edit
240 // this file. Edit stc.cpp.in or gen_iface.py instead and regenerate.
243 // Add text to the document at current position.
244 void wxStyledTextCtrl::AddText(const wxString
& text
) {
245 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
246 SendMsg(2001, strlen(buf
), (long)(const char*)buf
);
249 // Add array of cells to document.
250 void wxStyledTextCtrl::AddStyledText(const wxMemoryBuffer
& data
) {
251 SendMsg(2002, data
.GetDataLen(), (long)data
.GetData());
254 // Insert string at a position.
255 void wxStyledTextCtrl::InsertText(int pos
, const wxString
& text
) {
256 SendMsg(2003, pos
, (long)(const char*)wx2stc(text
));
259 // Delete all text in the document.
260 void wxStyledTextCtrl::ClearAll() {
264 // Set all style bytes to 0, remove all folding information.
265 void wxStyledTextCtrl::ClearDocumentStyle() {
269 // Returns the number of characters in the document.
270 int wxStyledTextCtrl::GetLength() {
271 return SendMsg(2006, 0, 0);
274 // Returns the character byte at the position.
275 int wxStyledTextCtrl::GetCharAt(int pos
) {
276 return (unsigned char)SendMsg(2007, pos
, 0);
279 // Returns the position of the caret.
280 int wxStyledTextCtrl::GetCurrentPos() {
281 return SendMsg(2008, 0, 0);
284 // Returns the position of the opposite end of the selection to the caret.
285 int wxStyledTextCtrl::GetAnchor() {
286 return SendMsg(2009, 0, 0);
289 // Returns the style byte at the position.
290 int wxStyledTextCtrl::GetStyleAt(int pos
) {
291 return (unsigned char)SendMsg(2010, pos
, 0);
294 // Redoes the next action on the undo history.
295 void wxStyledTextCtrl::Redo() {
299 // Choose between collecting actions into the undo
300 // history and discarding them.
301 void wxStyledTextCtrl::SetUndoCollection(bool collectUndo
) {
302 SendMsg(2012, collectUndo
, 0);
305 // Select all the text in the document.
306 void wxStyledTextCtrl::SelectAll() {
310 // Remember the current position in the undo history as the position
311 // at which the document was saved.
312 void wxStyledTextCtrl::SetSavePoint() {
316 // Retrieve a buffer of cells.
317 wxMemoryBuffer
wxStyledTextCtrl::GetStyledText(int startPos
, int endPos
) {
319 if (endPos
< startPos
) {
324 int len
= endPos
- startPos
;
325 if (!len
) return buf
;
327 tr
.lpstrText
= (char*)buf
.GetWriteBuf(len
*2+1);
328 tr
.chrg
.cpMin
= startPos
;
329 tr
.chrg
.cpMax
= endPos
;
330 len
= SendMsg(2015, 0, (long)&tr
);
331 buf
.UngetWriteBuf(len
);
335 // Are there any redoable actions in the undo history?
336 bool wxStyledTextCtrl::CanRedo() {
337 return SendMsg(2016, 0, 0) != 0;
340 // Retrieve the line number at which a particular marker is located.
341 int wxStyledTextCtrl::MarkerLineFromHandle(int handle
) {
342 return SendMsg(2017, handle
, 0);
346 void wxStyledTextCtrl::MarkerDeleteHandle(int handle
) {
347 SendMsg(2018, handle
, 0);
350 // Is undo history being collected?
351 bool wxStyledTextCtrl::GetUndoCollection() {
352 return SendMsg(2019, 0, 0) != 0;
355 // Are white space characters currently visible?
356 // Returns one of SCWS_* constants.
357 int wxStyledTextCtrl::GetViewWhiteSpace() {
358 return SendMsg(2020, 0, 0);
361 // Make white space characters invisible, always visible or visible outside indentation.
362 void wxStyledTextCtrl::SetViewWhiteSpace(int viewWS
) {
363 SendMsg(2021, viewWS
, 0);
366 // Find the position from a point within the window.
367 int wxStyledTextCtrl::PositionFromPoint(wxPoint pt
) {
368 return SendMsg(2022, pt
.x
, pt
.y
);
371 // Find the position from a point within the window but return
372 // INVALID_POSITION if not close to text.
373 int wxStyledTextCtrl::PositionFromPointClose(int x
, int y
) {
374 return SendMsg(2023, x
, y
);
377 // Set caret to start of a line and ensure it is visible.
378 void wxStyledTextCtrl::GotoLine(int line
) {
379 SendMsg(2024, line
, 0);
382 // Set caret to a position and ensure it is visible.
383 void wxStyledTextCtrl::GotoPos(int pos
) {
384 SendMsg(2025, pos
, 0);
387 // Set the selection anchor to a position. The anchor is the opposite
388 // end of the selection from the caret.
389 void wxStyledTextCtrl::SetAnchor(int posAnchor
) {
390 SendMsg(2026, posAnchor
, 0);
393 // Retrieve the text of the line containing the caret.
394 // Returns the index of the caret on the line.
395 wxString
wxStyledTextCtrl::GetCurLine(int* linePos
) {
396 int len
= LineLength(GetCurrentLine());
398 if (linePos
) *linePos
= 0;
399 return wxEmptyString
;
402 wxMemoryBuffer
mbuf(len
+1);
403 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
405 int pos
= SendMsg(2027, len
+1, (long)buf
);
406 mbuf
.UngetWriteBuf(len
);
408 if (linePos
) *linePos
= pos
;
412 // Retrieve the position of the last correctly styled character.
413 int wxStyledTextCtrl::GetEndStyled() {
414 return SendMsg(2028, 0, 0);
417 // Convert all line endings in the document to one mode.
418 void wxStyledTextCtrl::ConvertEOLs(int eolMode
) {
419 SendMsg(2029, eolMode
, 0);
422 // Retrieve the current end of line mode - one of CRLF, CR, or LF.
423 int wxStyledTextCtrl::GetEOLMode() {
424 return SendMsg(2030, 0, 0);
427 // Set the current end of line mode.
428 void wxStyledTextCtrl::SetEOLMode(int eolMode
) {
429 SendMsg(2031, eolMode
, 0);
432 // Set the current styling position to pos and the styling mask to mask.
433 // The styling mask can be used to protect some bits in each styling byte from modification.
434 void wxStyledTextCtrl::StartStyling(int pos
, int mask
) {
435 SendMsg(2032, pos
, mask
);
438 // Change style from current styling position for length characters to a style
439 // and move the current styling position to after this newly styled segment.
440 void wxStyledTextCtrl::SetStyling(int length
, int style
) {
441 SendMsg(2033, length
, style
);
444 // Is drawing done first into a buffer or direct to the screen?
445 bool wxStyledTextCtrl::GetBufferedDraw() {
446 return SendMsg(2034, 0, 0) != 0;
449 // If drawing is buffered then each line of text is drawn into a bitmap buffer
450 // before drawing it to the screen to avoid flicker.
451 void wxStyledTextCtrl::SetBufferedDraw(bool buffered
) {
452 SendMsg(2035, buffered
, 0);
455 // Change the visible size of a tab to be a multiple of the width of a space character.
456 void wxStyledTextCtrl::SetTabWidth(int tabWidth
) {
457 SendMsg(2036, tabWidth
, 0);
460 // Retrieve the visible size of a tab.
461 int wxStyledTextCtrl::GetTabWidth() {
462 return SendMsg(2121, 0, 0);
465 // Set the code page used to interpret the bytes of the document as characters.
466 void wxStyledTextCtrl::SetCodePage(int codePage
) {
468 wxASSERT_MSG(codePage
== wxSTC_CP_UTF8
,
469 wxT("Only wxSTC_CP_UTF8 may be used when wxUSE_UNICODE is on."));
471 wxASSERT_MSG(codePage
!= wxSTC_CP_UTF8
,
472 wxT("wxSTC_CP_UTF8 may not be used when wxUSE_UNICODE is off."));
474 SendMsg(2037, codePage
);
477 // Set the symbol used for a particular marker number,
478 // and optionally the fore and background colours.
479 void wxStyledTextCtrl::MarkerDefine(int markerNumber
, int markerSymbol
,
480 const wxColour
& foreground
,
481 const wxColour
& background
) {
483 SendMsg(2040, markerNumber
, markerSymbol
);
485 MarkerSetForeground(markerNumber
, foreground
);
487 MarkerSetBackground(markerNumber
, background
);
490 // Set the foreground colour used for a particular marker number.
491 void wxStyledTextCtrl::MarkerSetForeground(int markerNumber
, const wxColour
& fore
) {
492 SendMsg(2041, markerNumber
, wxColourAsLong(fore
));
495 // Set the background colour used for a particular marker number.
496 void wxStyledTextCtrl::MarkerSetBackground(int markerNumber
, const wxColour
& back
) {
497 SendMsg(2042, markerNumber
, wxColourAsLong(back
));
500 // Add a marker to a line, returning an ID which can be used to find or delete the marker.
501 int wxStyledTextCtrl::MarkerAdd(int line
, int markerNumber
) {
502 return SendMsg(2043, line
, markerNumber
);
505 // Delete a marker from a line.
506 void wxStyledTextCtrl::MarkerDelete(int line
, int markerNumber
) {
507 SendMsg(2044, line
, markerNumber
);
510 // Delete all markers with a particular number from all lines.
511 void wxStyledTextCtrl::MarkerDeleteAll(int markerNumber
) {
512 SendMsg(2045, markerNumber
, 0);
515 // Get a bit mask of all the markers set on a line.
516 int wxStyledTextCtrl::MarkerGet(int line
) {
517 return SendMsg(2046, line
, 0);
520 // Find the next line after lineStart that includes a marker in mask.
521 int wxStyledTextCtrl::MarkerNext(int lineStart
, int markerMask
) {
522 return SendMsg(2047, lineStart
, markerMask
);
525 // Find the previous line before lineStart that includes a marker in mask.
526 int wxStyledTextCtrl::MarkerPrevious(int lineStart
, int markerMask
) {
527 return SendMsg(2048, lineStart
, markerMask
);
530 // Define a marker from a bitmap
531 void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber
, const wxBitmap
& bmp
) {
532 // convert bmp to a xpm in a string
533 wxMemoryOutputStream strm
;
534 wxImage img
= bmp
.ConvertToImage();
536 img
.ConvertAlphaToMask();
537 img
.SaveFile(strm
, wxBITMAP_TYPE_XPM
);
538 size_t len
= strm
.GetSize();
539 char* buff
= new char[len
+1];
540 strm
.CopyTo(buff
, len
);
542 SendMsg(2049, markerNumber
, (long)buff
);
547 // Add a set of markers to a line.
548 void wxStyledTextCtrl::MarkerAddSet(int line
, int set
) {
549 SendMsg(2466, line
, set
);
552 // Set the alpha used for a marker that is drawn in the text area, not the margin.
553 void wxStyledTextCtrl::MarkerSetAlpha(int markerNumber
, int alpha
) {
554 SendMsg(2476, markerNumber
, alpha
);
557 // Set a margin to be either numeric or symbolic.
558 void wxStyledTextCtrl::SetMarginType(int margin
, int marginType
) {
559 SendMsg(2240, margin
, marginType
);
562 // Retrieve the type of a margin.
563 int wxStyledTextCtrl::GetMarginType(int margin
) {
564 return SendMsg(2241, margin
, 0);
567 // Set the width of a margin to a width expressed in pixels.
568 void wxStyledTextCtrl::SetMarginWidth(int margin
, int pixelWidth
) {
569 SendMsg(2242, margin
, pixelWidth
);
572 // Retrieve the width of a margin in pixels.
573 int wxStyledTextCtrl::GetMarginWidth(int margin
) {
574 return SendMsg(2243, margin
, 0);
577 // Set a mask that determines which markers are displayed in a margin.
578 void wxStyledTextCtrl::SetMarginMask(int margin
, int mask
) {
579 SendMsg(2244, margin
, mask
);
582 // Retrieve the marker mask of a margin.
583 int wxStyledTextCtrl::GetMarginMask(int margin
) {
584 return SendMsg(2245, margin
, 0);
587 // Make a margin sensitive or insensitive to mouse clicks.
588 void wxStyledTextCtrl::SetMarginSensitive(int margin
, bool sensitive
) {
589 SendMsg(2246, margin
, sensitive
);
592 // Retrieve the mouse click sensitivity of a margin.
593 bool wxStyledTextCtrl::GetMarginSensitive(int margin
) {
594 return SendMsg(2247, margin
, 0) != 0;
597 // Clear all the styles and make equivalent to the global default style.
598 void wxStyledTextCtrl::StyleClearAll() {
602 // Set the foreground colour of a style.
603 void wxStyledTextCtrl::StyleSetForeground(int style
, const wxColour
& fore
) {
604 SendMsg(2051, style
, wxColourAsLong(fore
));
607 // Set the background colour of a style.
608 void wxStyledTextCtrl::StyleSetBackground(int style
, const wxColour
& back
) {
609 SendMsg(2052, style
, wxColourAsLong(back
));
612 // Set a style to be bold or not.
613 void wxStyledTextCtrl::StyleSetBold(int style
, bool bold
) {
614 SendMsg(2053, style
, bold
);
617 // Set a style to be italic or not.
618 void wxStyledTextCtrl::StyleSetItalic(int style
, bool italic
) {
619 SendMsg(2054, style
, italic
);
622 // Set the size of characters of a style.
623 void wxStyledTextCtrl::StyleSetSize(int style
, int sizePoints
) {
624 SendMsg(2055, style
, sizePoints
);
627 // Set the font of a style.
628 void wxStyledTextCtrl::StyleSetFaceName(int style
, const wxString
& fontName
) {
629 SendMsg(2056, style
, (long)(const char*)wx2stc(fontName
));
632 // Set a style to have its end of line filled or not.
633 void wxStyledTextCtrl::StyleSetEOLFilled(int style
, bool filled
) {
634 SendMsg(2057, style
, filled
);
637 // Reset the default style to its state at startup
638 void wxStyledTextCtrl::StyleResetDefault() {
642 // Set a style to be underlined or not.
643 void wxStyledTextCtrl::StyleSetUnderline(int style
, bool underline
) {
644 SendMsg(2059, style
, underline
);
647 // Get the foreground colour of a style.
648 wxColour
wxStyledTextCtrl::StyleGetForeground(int style
) {
649 long c
= SendMsg(2481, style
, 0);
650 return wxColourFromLong(c
);
653 // Get the background colour of a style.
654 wxColour
wxStyledTextCtrl::StyleGetBackground(int style
) {
655 long c
= SendMsg(2482, style
, 0);
656 return wxColourFromLong(c
);
659 // Get is a style bold or not.
660 bool wxStyledTextCtrl::StyleGetBold(int style
) {
661 return SendMsg(2483, style
, 0) != 0;
664 // Get is a style italic or not.
665 bool wxStyledTextCtrl::StyleGetItalic(int style
) {
666 return SendMsg(2484, style
, 0) != 0;
669 // Get the size of characters of a style.
670 int wxStyledTextCtrl::StyleGetSize(int style
) {
671 return SendMsg(2485, style
, 0);
674 // Get the font facename of a style
675 wxString
wxStyledTextCtrl::StyleGetFaceName(int style
) {
677 long len
= SendMsg(msg
, style
, 0);
678 wxMemoryBuffer
mbuf(len
+1);
679 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
680 SendMsg(msg
, style
, (long)buf
);
681 mbuf
.UngetWriteBuf(len
);
686 // Get is a style to have its end of line filled or not.
687 bool wxStyledTextCtrl::StyleGetEOLFilled(int style
) {
688 return SendMsg(2487, style
, 0) != 0;
691 // Get is a style underlined or not.
692 bool wxStyledTextCtrl::StyleGetUnderline(int style
) {
693 return SendMsg(2488, style
, 0) != 0;
696 // Get is a style mixed case, or to force upper or lower case.
697 int wxStyledTextCtrl::StyleGetCase(int style
) {
698 return SendMsg(2489, style
, 0);
701 // Get the character set of the font in a style.
702 int wxStyledTextCtrl::StyleGetCharacterSet(int style
) {
703 return SendMsg(2490, style
, 0);
706 // Get is a style visible or not.
707 bool wxStyledTextCtrl::StyleGetVisible(int style
) {
708 return SendMsg(2491, style
, 0) != 0;
711 // Get is a style changeable or not (read only).
712 // Experimental feature, currently buggy.
713 bool wxStyledTextCtrl::StyleGetChangeable(int style
) {
714 return SendMsg(2492, style
, 0) != 0;
717 // Get is a style a hotspot or not.
718 bool wxStyledTextCtrl::StyleGetHotSpot(int style
) {
719 return SendMsg(2493, style
, 0) != 0;
722 // Set a style to be mixed case, or to force upper or lower case.
723 void wxStyledTextCtrl::StyleSetCase(int style
, int caseForce
) {
724 SendMsg(2060, style
, caseForce
);
727 // Set a style to be a hotspot or not.
728 void wxStyledTextCtrl::StyleSetHotSpot(int style
, bool hotspot
) {
729 SendMsg(2409, style
, hotspot
);
732 // Set the foreground colour of the selection and whether to use this setting.
733 void wxStyledTextCtrl::SetSelForeground(bool useSetting
, const wxColour
& fore
) {
734 SendMsg(2067, useSetting
, wxColourAsLong(fore
));
737 // Set the background colour of the selection and whether to use this setting.
738 void wxStyledTextCtrl::SetSelBackground(bool useSetting
, const wxColour
& back
) {
739 SendMsg(2068, useSetting
, wxColourAsLong(back
));
742 // Get the alpha of the selection.
743 int wxStyledTextCtrl::GetSelAlpha() {
744 return SendMsg(2477, 0, 0);
747 // Set the alpha of the selection.
748 void wxStyledTextCtrl::SetSelAlpha(int alpha
) {
749 SendMsg(2478, alpha
, 0);
752 // Is the selection end of line filled?
753 bool wxStyledTextCtrl::GetSelEOLFilled() {
754 return SendMsg(2479, 0, 0) != 0;
757 // Set the selection to have its end of line filled or not.
758 void wxStyledTextCtrl::SetSelEOLFilled(bool filled
) {
759 SendMsg(2480, filled
, 0);
762 // Set the foreground colour of the caret.
763 void wxStyledTextCtrl::SetCaretForeground(const wxColour
& fore
) {
764 SendMsg(2069, wxColourAsLong(fore
), 0);
767 // When key+modifier combination km is pressed perform msg.
768 void wxStyledTextCtrl::CmdKeyAssign(int key
, int modifiers
, int cmd
) {
769 SendMsg(2070, MAKELONG(key
, modifiers
), cmd
);
772 // When key+modifier combination km is pressed do nothing.
773 void wxStyledTextCtrl::CmdKeyClear(int key
, int modifiers
) {
774 SendMsg(2071, MAKELONG(key
, modifiers
));
777 // Drop all key mappings.
778 void wxStyledTextCtrl::CmdKeyClearAll() {
782 // Set the styles for a segment of the document.
783 void wxStyledTextCtrl::SetStyleBytes(int length
, char* styleBytes
) {
784 SendMsg(2073, length
, (long)styleBytes
);
787 // Set a style to be visible or not.
788 void wxStyledTextCtrl::StyleSetVisible(int style
, bool visible
) {
789 SendMsg(2074, style
, visible
);
792 // Get the time in milliseconds that the caret is on and off.
793 int wxStyledTextCtrl::GetCaretPeriod() {
794 return SendMsg(2075, 0, 0);
797 // Get the time in milliseconds that the caret is on and off. 0 = steady on.
798 void wxStyledTextCtrl::SetCaretPeriod(int periodMilliseconds
) {
799 SendMsg(2076, periodMilliseconds
, 0);
802 // Set the set of characters making up words for when moving or selecting by word.
803 // First sets deaults like SetCharsDefault.
804 void wxStyledTextCtrl::SetWordChars(const wxString
& characters
) {
805 SendMsg(2077, 0, (long)(const char*)wx2stc(characters
));
808 // Start a sequence of actions that is undone and redone as a unit.
810 void wxStyledTextCtrl::BeginUndoAction() {
814 // End a sequence of actions that is undone and redone as a unit.
815 void wxStyledTextCtrl::EndUndoAction() {
819 // Set an indicator to plain, squiggle or TT.
820 void wxStyledTextCtrl::IndicatorSetStyle(int indic
, int style
) {
821 SendMsg(2080, indic
, style
);
824 // Retrieve the style of an indicator.
825 int wxStyledTextCtrl::IndicatorGetStyle(int indic
) {
826 return SendMsg(2081, indic
, 0);
829 // Set the foreground colour of an indicator.
830 void wxStyledTextCtrl::IndicatorSetForeground(int indic
, const wxColour
& fore
) {
831 SendMsg(2082, indic
, wxColourAsLong(fore
));
834 // Retrieve the foreground colour of an indicator.
835 wxColour
wxStyledTextCtrl::IndicatorGetForeground(int indic
) {
836 long c
= SendMsg(2083, indic
, 0);
837 return wxColourFromLong(c
);
840 // Set an indicator to draw under text or over(default).
841 void wxStyledTextCtrl::IndicatorSetUnder(int indic
, bool under
) {
842 SendMsg(2510, indic
, under
);
845 // Retrieve whether indicator drawn under or over text.
846 bool wxStyledTextCtrl::IndicatorGetUnder(int indic
) {
847 return SendMsg(2511, indic
, 0) != 0;
850 // Set the foreground colour of all whitespace and whether to use this setting.
851 void wxStyledTextCtrl::SetWhitespaceForeground(bool useSetting
, const wxColour
& fore
) {
852 SendMsg(2084, useSetting
, wxColourAsLong(fore
));
855 // Set the background colour of all whitespace and whether to use this setting.
856 void wxStyledTextCtrl::SetWhitespaceBackground(bool useSetting
, const wxColour
& back
) {
857 SendMsg(2085, useSetting
, wxColourAsLong(back
));
860 // Divide each styling byte into lexical class bits (default: 5) and indicator
861 // bits (default: 3). If a lexer requires more than 32 lexical states, then this
862 // is used to expand the possible states.
863 void wxStyledTextCtrl::SetStyleBits(int bits
) {
864 SendMsg(2090, bits
, 0);
867 // Retrieve number of bits in style bytes used to hold the lexical state.
868 int wxStyledTextCtrl::GetStyleBits() {
869 return SendMsg(2091, 0, 0);
872 // Used to hold extra styling information for each line.
873 void wxStyledTextCtrl::SetLineState(int line
, int state
) {
874 SendMsg(2092, line
, state
);
877 // Retrieve the extra styling information for a line.
878 int wxStyledTextCtrl::GetLineState(int line
) {
879 return SendMsg(2093, line
, 0);
882 // Retrieve the last line number that has line state.
883 int wxStyledTextCtrl::GetMaxLineState() {
884 return SendMsg(2094, 0, 0);
887 // Is the background of the line containing the caret in a different colour?
888 bool wxStyledTextCtrl::GetCaretLineVisible() {
889 return SendMsg(2095, 0, 0) != 0;
892 // Display the background of the line containing the caret in a different colour.
893 void wxStyledTextCtrl::SetCaretLineVisible(bool show
) {
894 SendMsg(2096, show
, 0);
897 // Get the colour of the background of the line containing the caret.
898 wxColour
wxStyledTextCtrl::GetCaretLineBackground() {
899 long c
= SendMsg(2097, 0, 0);
900 return wxColourFromLong(c
);
903 // Set the colour of the background of the line containing the caret.
904 void wxStyledTextCtrl::SetCaretLineBackground(const wxColour
& back
) {
905 SendMsg(2098, wxColourAsLong(back
), 0);
908 // Set a style to be changeable or not (read only).
909 // Experimental feature, currently buggy.
910 void wxStyledTextCtrl::StyleSetChangeable(int style
, bool changeable
) {
911 SendMsg(2099, style
, changeable
);
914 // Display a auto-completion list.
915 // The lenEntered parameter indicates how many characters before
916 // the caret should be used to provide context.
917 void wxStyledTextCtrl::AutoCompShow(int lenEntered
, const wxString
& itemList
) {
918 SendMsg(2100, lenEntered
, (long)(const char*)wx2stc(itemList
));
921 // Remove the auto-completion list from the screen.
922 void wxStyledTextCtrl::AutoCompCancel() {
926 // Is there an auto-completion list visible?
927 bool wxStyledTextCtrl::AutoCompActive() {
928 return SendMsg(2102, 0, 0) != 0;
931 // Retrieve the position of the caret when the auto-completion list was displayed.
932 int wxStyledTextCtrl::AutoCompPosStart() {
933 return SendMsg(2103, 0, 0);
936 // User has selected an item so remove the list and insert the selection.
937 void wxStyledTextCtrl::AutoCompComplete() {
941 // Define a set of character that when typed cancel the auto-completion list.
942 void wxStyledTextCtrl::AutoCompStops(const wxString
& characterSet
) {
943 SendMsg(2105, 0, (long)(const char*)wx2stc(characterSet
));
946 // Change the separator character in the string setting up an auto-completion list.
947 // Default is space but can be changed if items contain space.
948 void wxStyledTextCtrl::AutoCompSetSeparator(int separatorCharacter
) {
949 SendMsg(2106, separatorCharacter
, 0);
952 // Retrieve the auto-completion list separator character.
953 int wxStyledTextCtrl::AutoCompGetSeparator() {
954 return SendMsg(2107, 0, 0);
957 // Select the item in the auto-completion list that starts with a string.
958 void wxStyledTextCtrl::AutoCompSelect(const wxString
& text
) {
959 SendMsg(2108, 0, (long)(const char*)wx2stc(text
));
962 // Should the auto-completion list be cancelled if the user backspaces to a
963 // position before where the box was created.
964 void wxStyledTextCtrl::AutoCompSetCancelAtStart(bool cancel
) {
965 SendMsg(2110, cancel
, 0);
968 // Retrieve whether auto-completion cancelled by backspacing before start.
969 bool wxStyledTextCtrl::AutoCompGetCancelAtStart() {
970 return SendMsg(2111, 0, 0) != 0;
973 // Define a set of characters that when typed will cause the autocompletion to
974 // choose the selected item.
975 void wxStyledTextCtrl::AutoCompSetFillUps(const wxString
& characterSet
) {
976 SendMsg(2112, 0, (long)(const char*)wx2stc(characterSet
));
979 // Should a single item auto-completion list automatically choose the item.
980 void wxStyledTextCtrl::AutoCompSetChooseSingle(bool chooseSingle
) {
981 SendMsg(2113, chooseSingle
, 0);
984 // Retrieve whether a single item auto-completion list automatically choose the item.
985 bool wxStyledTextCtrl::AutoCompGetChooseSingle() {
986 return SendMsg(2114, 0, 0) != 0;
989 // Set whether case is significant when performing auto-completion searches.
990 void wxStyledTextCtrl::AutoCompSetIgnoreCase(bool ignoreCase
) {
991 SendMsg(2115, ignoreCase
, 0);
994 // Retrieve state of ignore case flag.
995 bool wxStyledTextCtrl::AutoCompGetIgnoreCase() {
996 return SendMsg(2116, 0, 0) != 0;
999 // Display a list of strings and send notification when user chooses one.
1000 void wxStyledTextCtrl::UserListShow(int listType
, const wxString
& itemList
) {
1001 SendMsg(2117, listType
, (long)(const char*)wx2stc(itemList
));
1004 // Set whether or not autocompletion is hidden automatically when nothing matches.
1005 void wxStyledTextCtrl::AutoCompSetAutoHide(bool autoHide
) {
1006 SendMsg(2118, autoHide
, 0);
1009 // Retrieve whether or not autocompletion is hidden automatically when nothing matches.
1010 bool wxStyledTextCtrl::AutoCompGetAutoHide() {
1011 return SendMsg(2119, 0, 0) != 0;
1014 // Set whether or not autocompletion deletes any word characters
1015 // after the inserted text upon completion.
1016 void wxStyledTextCtrl::AutoCompSetDropRestOfWord(bool dropRestOfWord
) {
1017 SendMsg(2270, dropRestOfWord
, 0);
1020 // Retrieve whether or not autocompletion deletes any word characters
1021 // after the inserted text upon completion.
1022 bool wxStyledTextCtrl::AutoCompGetDropRestOfWord() {
1023 return SendMsg(2271, 0, 0) != 0;
1026 // Register an image for use in autocompletion lists.
1027 void wxStyledTextCtrl::RegisterImage(int type
, const wxBitmap
& bmp
) {
1028 // convert bmp to a xpm in a string
1029 wxMemoryOutputStream strm
;
1030 wxImage img
= bmp
.ConvertToImage();
1032 img
.ConvertAlphaToMask();
1033 img
.SaveFile(strm
, wxBITMAP_TYPE_XPM
);
1034 size_t len
= strm
.GetSize();
1035 char* buff
= new char[len
+1];
1036 strm
.CopyTo(buff
, len
);
1038 SendMsg(2405, type
, (long)buff
);
1043 // Clear all the registered images.
1044 void wxStyledTextCtrl::ClearRegisteredImages() {
1045 SendMsg(2408, 0, 0);
1048 // Retrieve the auto-completion list type-separator character.
1049 int wxStyledTextCtrl::AutoCompGetTypeSeparator() {
1050 return SendMsg(2285, 0, 0);
1053 // Change the type-separator character in the string setting up an auto-completion list.
1054 // Default is '?' but can be changed if items contain '?'.
1055 void wxStyledTextCtrl::AutoCompSetTypeSeparator(int separatorCharacter
) {
1056 SendMsg(2286, separatorCharacter
, 0);
1059 // Set the maximum width, in characters, of auto-completion and user lists.
1060 // Set to 0 to autosize to fit longest item, which is the default.
1061 void wxStyledTextCtrl::AutoCompSetMaxWidth(int characterCount
) {
1062 SendMsg(2208, characterCount
, 0);
1065 // Get the maximum width, in characters, of auto-completion and user lists.
1066 int wxStyledTextCtrl::AutoCompGetMaxWidth() {
1067 return SendMsg(2209, 0, 0);
1070 // Set the maximum height, in rows, of auto-completion and user lists.
1071 // The default is 5 rows.
1072 void wxStyledTextCtrl::AutoCompSetMaxHeight(int rowCount
) {
1073 SendMsg(2210, rowCount
, 0);
1076 // Set the maximum height, in rows, of auto-completion and user lists.
1077 int wxStyledTextCtrl::AutoCompGetMaxHeight() {
1078 return SendMsg(2211, 0, 0);
1081 // Set the number of spaces used for one level of indentation.
1082 void wxStyledTextCtrl::SetIndent(int indentSize
) {
1083 SendMsg(2122, indentSize
, 0);
1086 // Retrieve indentation size.
1087 int wxStyledTextCtrl::GetIndent() {
1088 return SendMsg(2123, 0, 0);
1091 // Indentation will only use space characters if useTabs is false, otherwise
1092 // it will use a combination of tabs and spaces.
1093 void wxStyledTextCtrl::SetUseTabs(bool useTabs
) {
1094 SendMsg(2124, useTabs
, 0);
1097 // Retrieve whether tabs will be used in indentation.
1098 bool wxStyledTextCtrl::GetUseTabs() {
1099 return SendMsg(2125, 0, 0) != 0;
1102 // Change the indentation of a line to a number of columns.
1103 void wxStyledTextCtrl::SetLineIndentation(int line
, int indentSize
) {
1104 SendMsg(2126, line
, indentSize
);
1107 // Retrieve the number of columns that a line is indented.
1108 int wxStyledTextCtrl::GetLineIndentation(int line
) {
1109 return SendMsg(2127, line
, 0);
1112 // Retrieve the position before the first non indentation character on a line.
1113 int wxStyledTextCtrl::GetLineIndentPosition(int line
) {
1114 return SendMsg(2128, line
, 0);
1117 // Retrieve the column number of a position, taking tab width into account.
1118 int wxStyledTextCtrl::GetColumn(int pos
) {
1119 return SendMsg(2129, pos
, 0);
1122 // Show or hide the horizontal scroll bar.
1123 void wxStyledTextCtrl::SetUseHorizontalScrollBar(bool show
) {
1124 SendMsg(2130, show
, 0);
1127 // Is the horizontal scroll bar visible?
1128 bool wxStyledTextCtrl::GetUseHorizontalScrollBar() {
1129 return SendMsg(2131, 0, 0) != 0;
1132 // Show or hide indentation guides.
1133 void wxStyledTextCtrl::SetIndentationGuides(int indentView
) {
1134 SendMsg(2132, indentView
, 0);
1137 // Are the indentation guides visible?
1138 int wxStyledTextCtrl::GetIndentationGuides() {
1139 return SendMsg(2133, 0, 0);
1142 // Set the highlighted indentation guide column.
1143 // 0 = no highlighted guide.
1144 void wxStyledTextCtrl::SetHighlightGuide(int column
) {
1145 SendMsg(2134, column
, 0);
1148 // Get the highlighted indentation guide column.
1149 int wxStyledTextCtrl::GetHighlightGuide() {
1150 return SendMsg(2135, 0, 0);
1153 // Get the position after the last visible characters on a line.
1154 int wxStyledTextCtrl::GetLineEndPosition(int line
) {
1155 return SendMsg(2136, line
, 0);
1158 // Get the code page used to interpret the bytes of the document as characters.
1159 int wxStyledTextCtrl::GetCodePage() {
1160 return SendMsg(2137, 0, 0);
1163 // Get the foreground colour of the caret.
1164 wxColour
wxStyledTextCtrl::GetCaretForeground() {
1165 long c
= SendMsg(2138, 0, 0);
1166 return wxColourFromLong(c
);
1169 // In read-only mode?
1170 bool wxStyledTextCtrl::GetReadOnly() {
1171 return SendMsg(2140, 0, 0) != 0;
1174 // Sets the position of the caret.
1175 void wxStyledTextCtrl::SetCurrentPos(int pos
) {
1176 SendMsg(2141, pos
, 0);
1179 // Sets the position that starts the selection - this becomes the anchor.
1180 void wxStyledTextCtrl::SetSelectionStart(int pos
) {
1181 SendMsg(2142, pos
, 0);
1184 // Returns the position at the start of the selection.
1185 int wxStyledTextCtrl::GetSelectionStart() {
1186 return SendMsg(2143, 0, 0);
1189 // Sets the position that ends the selection - this becomes the currentPosition.
1190 void wxStyledTextCtrl::SetSelectionEnd(int pos
) {
1191 SendMsg(2144, pos
, 0);
1194 // Returns the position at the end of the selection.
1195 int wxStyledTextCtrl::GetSelectionEnd() {
1196 return SendMsg(2145, 0, 0);
1199 // Sets the print magnification added to the point size of each style for printing.
1200 void wxStyledTextCtrl::SetPrintMagnification(int magnification
) {
1201 SendMsg(2146, magnification
, 0);
1204 // Returns the print magnification.
1205 int wxStyledTextCtrl::GetPrintMagnification() {
1206 return SendMsg(2147, 0, 0);
1209 // Modify colours when printing for clearer printed text.
1210 void wxStyledTextCtrl::SetPrintColourMode(int mode
) {
1211 SendMsg(2148, mode
, 0);
1214 // Returns the print colour mode.
1215 int wxStyledTextCtrl::GetPrintColourMode() {
1216 return SendMsg(2149, 0, 0);
1219 // Find some text in the document.
1220 int wxStyledTextCtrl::FindText(int minPos
, int maxPos
,
1221 const wxString
& text
,
1224 ft
.chrg
.cpMin
= minPos
;
1225 ft
.chrg
.cpMax
= maxPos
;
1226 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
1227 ft
.lpstrText
= (char*)(const char*)buf
;
1229 return SendMsg(2150, flags
, (long)&ft
);
1232 // On Windows, will draw the document into a display context such as a printer.
1233 int wxStyledTextCtrl::FormatRange(bool doDraw
,
1242 if (endPos
< startPos
) {
1243 int temp
= startPos
;
1248 fr
.hdcTarget
= target
;
1249 fr
.rc
.top
= renderRect
.GetTop();
1250 fr
.rc
.left
= renderRect
.GetLeft();
1251 fr
.rc
.right
= renderRect
.GetRight();
1252 fr
.rc
.bottom
= renderRect
.GetBottom();
1253 fr
.rcPage
.top
= pageRect
.GetTop();
1254 fr
.rcPage
.left
= pageRect
.GetLeft();
1255 fr
.rcPage
.right
= pageRect
.GetRight();
1256 fr
.rcPage
.bottom
= pageRect
.GetBottom();
1257 fr
.chrg
.cpMin
= startPos
;
1258 fr
.chrg
.cpMax
= endPos
;
1260 return SendMsg(2151, doDraw
, (long)&fr
);
1263 // Retrieve the display line at the top of the display.
1264 int wxStyledTextCtrl::GetFirstVisibleLine() {
1265 return SendMsg(2152, 0, 0);
1268 // Retrieve the contents of a line.
1269 wxString
wxStyledTextCtrl::GetLine(int line
) {
1270 int len
= LineLength(line
);
1271 if (!len
) return wxEmptyString
;
1273 wxMemoryBuffer
mbuf(len
+1);
1274 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1275 SendMsg(2153, line
, (long)buf
);
1276 mbuf
.UngetWriteBuf(len
);
1281 // Returns the number of lines in the document. There is always at least one.
1282 int wxStyledTextCtrl::GetLineCount() {
1283 return SendMsg(2154, 0, 0);
1286 // Sets the size in pixels of the left margin.
1287 void wxStyledTextCtrl::SetMarginLeft(int pixelWidth
) {
1288 SendMsg(2155, 0, pixelWidth
);
1291 // Returns the size in pixels of the left margin.
1292 int wxStyledTextCtrl::GetMarginLeft() {
1293 return SendMsg(2156, 0, 0);
1296 // Sets the size in pixels of the right margin.
1297 void wxStyledTextCtrl::SetMarginRight(int pixelWidth
) {
1298 SendMsg(2157, 0, pixelWidth
);
1301 // Returns the size in pixels of the right margin.
1302 int wxStyledTextCtrl::GetMarginRight() {
1303 return SendMsg(2158, 0, 0);
1306 // Is the document different from when it was last saved?
1307 bool wxStyledTextCtrl::GetModify() {
1308 return SendMsg(2159, 0, 0) != 0;
1311 // Select a range of text.
1312 void wxStyledTextCtrl::SetSelection(int start
, int end
) {
1313 SendMsg(2160, start
, end
);
1316 // Retrieve the selected text.
1317 wxString
wxStyledTextCtrl::GetSelectedText() {
1321 GetSelection(&start
, &end
);
1322 int len
= end
- start
;
1323 if (!len
) return wxEmptyString
;
1325 wxMemoryBuffer
mbuf(len
+2);
1326 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1327 SendMsg(2161, 0, (long)buf
);
1328 mbuf
.UngetWriteBuf(len
);
1333 // Retrieve a range of text.
1334 wxString
wxStyledTextCtrl::GetTextRange(int startPos
, int endPos
) {
1335 if (endPos
< startPos
) {
1336 int temp
= startPos
;
1340 int len
= endPos
- startPos
;
1341 if (!len
) return wxEmptyString
;
1342 wxMemoryBuffer
mbuf(len
+1);
1343 char* buf
= (char*)mbuf
.GetWriteBuf(len
);
1346 tr
.chrg
.cpMin
= startPos
;
1347 tr
.chrg
.cpMax
= endPos
;
1348 SendMsg(2162, 0, (long)&tr
);
1349 mbuf
.UngetWriteBuf(len
);
1354 // Draw the selection in normal style or with selection highlighted.
1355 void wxStyledTextCtrl::HideSelection(bool normal
) {
1356 SendMsg(2163, normal
, 0);
1359 // Retrieve the line containing a position.
1360 int wxStyledTextCtrl::LineFromPosition(int pos
) {
1361 return SendMsg(2166, pos
, 0);
1364 // Retrieve the position at the start of a line.
1365 int wxStyledTextCtrl::PositionFromLine(int line
) {
1366 return SendMsg(2167, line
, 0);
1369 // Scroll horizontally and vertically.
1370 void wxStyledTextCtrl::LineScroll(int columns
, int lines
) {
1371 SendMsg(2168, columns
, lines
);
1374 // Ensure the caret is visible.
1375 void wxStyledTextCtrl::EnsureCaretVisible() {
1376 SendMsg(2169, 0, 0);
1379 // Replace the selected text with the argument text.
1380 void wxStyledTextCtrl::ReplaceSelection(const wxString
& text
) {
1381 SendMsg(2170, 0, (long)(const char*)wx2stc(text
));
1384 // Set to read only or read write.
1385 void wxStyledTextCtrl::SetReadOnly(bool readOnly
) {
1386 SendMsg(2171, readOnly
, 0);
1389 // Will a paste succeed?
1390 bool wxStyledTextCtrl::CanPaste() {
1391 return SendMsg(2173, 0, 0) != 0;
1394 // Are there any undoable actions in the undo history?
1395 bool wxStyledTextCtrl::CanUndo() {
1396 return SendMsg(2174, 0, 0) != 0;
1399 // Delete the undo history.
1400 void wxStyledTextCtrl::EmptyUndoBuffer() {
1401 SendMsg(2175, 0, 0);
1404 // Undo one action in the undo history.
1405 void wxStyledTextCtrl::Undo() {
1406 SendMsg(2176, 0, 0);
1409 // Cut the selection to the clipboard.
1410 void wxStyledTextCtrl::Cut() {
1411 SendMsg(2177, 0, 0);
1414 // Copy the selection to the clipboard.
1415 void wxStyledTextCtrl::Copy() {
1416 SendMsg(2178, 0, 0);
1419 // Paste the contents of the clipboard into the document replacing the selection.
1420 void wxStyledTextCtrl::Paste() {
1421 SendMsg(2179, 0, 0);
1424 // Clear the selection.
1425 void wxStyledTextCtrl::Clear() {
1426 SendMsg(2180, 0, 0);
1429 // Replace the contents of the document with the argument text.
1430 void wxStyledTextCtrl::SetText(const wxString
& text
) {
1431 SendMsg(2181, 0, (long)(const char*)wx2stc(text
));
1434 // Retrieve all the text in the document.
1435 wxString
wxStyledTextCtrl::GetText() {
1436 int len
= GetTextLength();
1437 wxMemoryBuffer
mbuf(len
+1); // leave room for the null...
1438 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1439 SendMsg(2182, len
+1, (long)buf
);
1440 mbuf
.UngetWriteBuf(len
);
1445 // Retrieve the number of characters in the document.
1446 int wxStyledTextCtrl::GetTextLength() {
1447 return SendMsg(2183, 0, 0);
1450 // Set to overtype (true) or insert mode.
1451 void wxStyledTextCtrl::SetOvertype(bool overtype
) {
1452 SendMsg(2186, overtype
, 0);
1455 // Returns true if overtype mode is active otherwise false is returned.
1456 bool wxStyledTextCtrl::GetOvertype() {
1457 return SendMsg(2187, 0, 0) != 0;
1460 // Set the width of the insert mode caret.
1461 void wxStyledTextCtrl::SetCaretWidth(int pixelWidth
) {
1462 SendMsg(2188, pixelWidth
, 0);
1465 // Returns the width of the insert mode caret.
1466 int wxStyledTextCtrl::GetCaretWidth() {
1467 return SendMsg(2189, 0, 0);
1470 // Sets the position that starts the target which is used for updating the
1471 // document without affecting the scroll position.
1472 void wxStyledTextCtrl::SetTargetStart(int pos
) {
1473 SendMsg(2190, pos
, 0);
1476 // Get the position that starts the target.
1477 int wxStyledTextCtrl::GetTargetStart() {
1478 return SendMsg(2191, 0, 0);
1481 // Sets the position that ends the target which is used for updating the
1482 // document without affecting the scroll position.
1483 void wxStyledTextCtrl::SetTargetEnd(int pos
) {
1484 SendMsg(2192, pos
, 0);
1487 // Get the position that ends the target.
1488 int wxStyledTextCtrl::GetTargetEnd() {
1489 return SendMsg(2193, 0, 0);
1492 // Replace the target text with the argument text.
1493 // Text is counted so it can contain NULs.
1494 // Returns the length of the replacement text.
1496 int wxStyledTextCtrl::ReplaceTarget(const wxString
& text
) {
1497 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
1498 return SendMsg(2194, strlen(buf
), (long)(const char*)buf
);
1501 // Replace the target text with the argument text after \d processing.
1502 // Text is counted so it can contain NULs.
1503 // Looks for \d where d is between 1 and 9 and replaces these with the strings
1504 // matched in the last search operation which were surrounded by \( and \).
1505 // Returns the length of the replacement text including any change
1506 // caused by processing the \d patterns.
1508 int wxStyledTextCtrl::ReplaceTargetRE(const wxString
& text
) {
1509 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
1510 return SendMsg(2195, strlen(buf
), (long)(const char*)buf
);
1513 // Search for a counted string in the target and set the target to the found
1514 // range. Text is counted so it can contain NULs.
1515 // Returns length of range or -1 for failure in which case target is not moved.
1517 int wxStyledTextCtrl::SearchInTarget(const wxString
& text
) {
1518 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
1519 return SendMsg(2197, strlen(buf
), (long)(const char*)buf
);
1522 // Set the search flags used by SearchInTarget.
1523 void wxStyledTextCtrl::SetSearchFlags(int flags
) {
1524 SendMsg(2198, flags
, 0);
1527 // Get the search flags used by SearchInTarget.
1528 int wxStyledTextCtrl::GetSearchFlags() {
1529 return SendMsg(2199, 0, 0);
1532 // Show a call tip containing a definition near position pos.
1533 void wxStyledTextCtrl::CallTipShow(int pos
, const wxString
& definition
) {
1534 SendMsg(2200, pos
, (long)(const char*)wx2stc(definition
));
1537 // Remove the call tip from the screen.
1538 void wxStyledTextCtrl::CallTipCancel() {
1539 SendMsg(2201, 0, 0);
1542 // Is there an active call tip?
1543 bool wxStyledTextCtrl::CallTipActive() {
1544 return SendMsg(2202, 0, 0) != 0;
1547 // Retrieve the position where the caret was before displaying the call tip.
1548 int wxStyledTextCtrl::CallTipPosAtStart() {
1549 return SendMsg(2203, 0, 0);
1552 // Highlight a segment of the definition.
1553 void wxStyledTextCtrl::CallTipSetHighlight(int start
, int end
) {
1554 SendMsg(2204, start
, end
);
1557 // Set the background colour for the call tip.
1558 void wxStyledTextCtrl::CallTipSetBackground(const wxColour
& back
) {
1559 SendMsg(2205, wxColourAsLong(back
), 0);
1562 // Set the foreground colour for the call tip.
1563 void wxStyledTextCtrl::CallTipSetForeground(const wxColour
& fore
) {
1564 SendMsg(2206, wxColourAsLong(fore
), 0);
1567 // Set the foreground colour for the highlighted part of the call tip.
1568 void wxStyledTextCtrl::CallTipSetForegroundHighlight(const wxColour
& fore
) {
1569 SendMsg(2207, wxColourAsLong(fore
), 0);
1572 // Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
1573 void wxStyledTextCtrl::CallTipUseStyle(int tabSize
) {
1574 SendMsg(2212, tabSize
, 0);
1577 // Find the display line of a document line taking hidden lines into account.
1578 int wxStyledTextCtrl::VisibleFromDocLine(int line
) {
1579 return SendMsg(2220, line
, 0);
1582 // Find the document line of a display line taking hidden lines into account.
1583 int wxStyledTextCtrl::DocLineFromVisible(int lineDisplay
) {
1584 return SendMsg(2221, lineDisplay
, 0);
1587 // The number of display lines needed to wrap a document line
1588 int wxStyledTextCtrl::WrapCount(int line
) {
1589 return SendMsg(2235, line
, 0);
1592 // Set the fold level of a line.
1593 // This encodes an integer level along with flags indicating whether the
1594 // line is a header and whether it is effectively white space.
1595 void wxStyledTextCtrl::SetFoldLevel(int line
, int level
) {
1596 SendMsg(2222, line
, level
);
1599 // Retrieve the fold level of a line.
1600 int wxStyledTextCtrl::GetFoldLevel(int line
) {
1601 return SendMsg(2223, line
, 0);
1604 // Find the last child line of a header line.
1605 int wxStyledTextCtrl::GetLastChild(int line
, int level
) {
1606 return SendMsg(2224, line
, level
);
1609 // Find the parent line of a child line.
1610 int wxStyledTextCtrl::GetFoldParent(int line
) {
1611 return SendMsg(2225, line
, 0);
1614 // Make a range of lines visible.
1615 void wxStyledTextCtrl::ShowLines(int lineStart
, int lineEnd
) {
1616 SendMsg(2226, lineStart
, lineEnd
);
1619 // Make a range of lines invisible.
1620 void wxStyledTextCtrl::HideLines(int lineStart
, int lineEnd
) {
1621 SendMsg(2227, lineStart
, lineEnd
);
1624 // Is a line visible?
1625 bool wxStyledTextCtrl::GetLineVisible(int line
) {
1626 return SendMsg(2228, line
, 0) != 0;
1629 // Show the children of a header line.
1630 void wxStyledTextCtrl::SetFoldExpanded(int line
, bool expanded
) {
1631 SendMsg(2229, line
, expanded
);
1634 // Is a header line expanded?
1635 bool wxStyledTextCtrl::GetFoldExpanded(int line
) {
1636 return SendMsg(2230, line
, 0) != 0;
1639 // Switch a header line between expanded and contracted.
1640 void wxStyledTextCtrl::ToggleFold(int line
) {
1641 SendMsg(2231, line
, 0);
1644 // Ensure a particular line is visible by expanding any header line hiding it.
1645 void wxStyledTextCtrl::EnsureVisible(int line
) {
1646 SendMsg(2232, line
, 0);
1649 // Set some style options for folding.
1650 void wxStyledTextCtrl::SetFoldFlags(int flags
) {
1651 SendMsg(2233, flags
, 0);
1654 // Ensure a particular line is visible by expanding any header line hiding it.
1655 // Use the currently set visibility policy to determine which range to display.
1656 void wxStyledTextCtrl::EnsureVisibleEnforcePolicy(int line
) {
1657 SendMsg(2234, line
, 0);
1660 // Sets whether a tab pressed when caret is within indentation indents.
1661 void wxStyledTextCtrl::SetTabIndents(bool tabIndents
) {
1662 SendMsg(2260, tabIndents
, 0);
1665 // Does a tab pressed when caret is within indentation indent?
1666 bool wxStyledTextCtrl::GetTabIndents() {
1667 return SendMsg(2261, 0, 0) != 0;
1670 // Sets whether a backspace pressed when caret is within indentation unindents.
1671 void wxStyledTextCtrl::SetBackSpaceUnIndents(bool bsUnIndents
) {
1672 SendMsg(2262, bsUnIndents
, 0);
1675 // Does a backspace pressed when caret is within indentation unindent?
1676 bool wxStyledTextCtrl::GetBackSpaceUnIndents() {
1677 return SendMsg(2263, 0, 0) != 0;
1680 // Sets the time the mouse must sit still to generate a mouse dwell event.
1681 void wxStyledTextCtrl::SetMouseDwellTime(int periodMilliseconds
) {
1682 SendMsg(2264, periodMilliseconds
, 0);
1685 // Retrieve the time the mouse must sit still to generate a mouse dwell event.
1686 int wxStyledTextCtrl::GetMouseDwellTime() {
1687 return SendMsg(2265, 0, 0);
1690 // Get position of start of word.
1691 int wxStyledTextCtrl::WordStartPosition(int pos
, bool onlyWordCharacters
) {
1692 return SendMsg(2266, pos
, onlyWordCharacters
);
1695 // Get position of end of word.
1696 int wxStyledTextCtrl::WordEndPosition(int pos
, bool onlyWordCharacters
) {
1697 return SendMsg(2267, pos
, onlyWordCharacters
);
1700 // Sets whether text is word wrapped.
1701 void wxStyledTextCtrl::SetWrapMode(int mode
) {
1702 SendMsg(2268, mode
, 0);
1705 // Retrieve whether text is word wrapped.
1706 int wxStyledTextCtrl::GetWrapMode() {
1707 return SendMsg(2269, 0, 0);
1710 // Set the display mode of visual flags for wrapped lines.
1711 void wxStyledTextCtrl::SetWrapVisualFlags(int wrapVisualFlags
) {
1712 SendMsg(2460, wrapVisualFlags
, 0);
1715 // Retrive the display mode of visual flags for wrapped lines.
1716 int wxStyledTextCtrl::GetWrapVisualFlags() {
1717 return SendMsg(2461, 0, 0);
1720 // Set the location of visual flags for wrapped lines.
1721 void wxStyledTextCtrl::SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation
) {
1722 SendMsg(2462, wrapVisualFlagsLocation
, 0);
1725 // Retrive the location of visual flags for wrapped lines.
1726 int wxStyledTextCtrl::GetWrapVisualFlagsLocation() {
1727 return SendMsg(2463, 0, 0);
1730 // Set the start indent for wrapped lines.
1731 void wxStyledTextCtrl::SetWrapStartIndent(int indent
) {
1732 SendMsg(2464, indent
, 0);
1735 // Retrive the start indent for wrapped lines.
1736 int wxStyledTextCtrl::GetWrapStartIndent() {
1737 return SendMsg(2465, 0, 0);
1740 // Sets the degree of caching of layout information.
1741 void wxStyledTextCtrl::SetLayoutCache(int mode
) {
1742 SendMsg(2272, mode
, 0);
1745 // Retrieve the degree of caching of layout information.
1746 int wxStyledTextCtrl::GetLayoutCache() {
1747 return SendMsg(2273, 0, 0);
1750 // Sets the document width assumed for scrolling.
1751 void wxStyledTextCtrl::SetScrollWidth(int pixelWidth
) {
1752 SendMsg(2274, pixelWidth
, 0);
1755 // Retrieve the document width assumed for scrolling.
1756 int wxStyledTextCtrl::GetScrollWidth() {
1757 return SendMsg(2275, 0, 0);
1760 // Sets whether the maximum width line displayed is used to set scroll width.
1761 void wxStyledTextCtrl::SetScrollWidthTracking(bool tracking
) {
1762 SendMsg(2516, tracking
, 0);
1765 // Retrieve whether the scroll width tracks wide lines.
1766 bool wxStyledTextCtrl::GetScrollWidthTracking() {
1767 return SendMsg(2517, 0, 0) != 0;
1770 // Measure the pixel width of some text in a particular style.
1771 // NUL terminated text argument.
1772 // Does not handle tab or control characters.
1773 int wxStyledTextCtrl::TextWidth(int style
, const wxString
& text
) {
1774 return SendMsg(2276, style
, (long)(const char*)wx2stc(text
));
1777 // Sets the scroll range so that maximum scroll position has
1778 // the last line at the bottom of the view (default).
1779 // Setting this to false allows scrolling one page below the last line.
1780 void wxStyledTextCtrl::SetEndAtLastLine(bool endAtLastLine
) {
1781 SendMsg(2277, endAtLastLine
, 0);
1784 // Retrieve whether the maximum scroll position has the last
1785 // line at the bottom of the view.
1786 bool wxStyledTextCtrl::GetEndAtLastLine() {
1787 return SendMsg(2278, 0, 0) != 0;
1790 // Retrieve the height of a particular line of text in pixels.
1791 int wxStyledTextCtrl::TextHeight(int line
) {
1792 return SendMsg(2279, line
, 0);
1795 // Show or hide the vertical scroll bar.
1796 void wxStyledTextCtrl::SetUseVerticalScrollBar(bool show
) {
1797 SendMsg(2280, show
, 0);
1800 // Is the vertical scroll bar visible?
1801 bool wxStyledTextCtrl::GetUseVerticalScrollBar() {
1802 return SendMsg(2281, 0, 0) != 0;
1805 // Append a string to the end of the document without changing the selection.
1806 void wxStyledTextCtrl::AppendText(const wxString
& text
) {
1807 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
1808 SendMsg(2282, strlen(buf
), (long)(const char*)buf
);
1811 // Is drawing done in two phases with backgrounds drawn before foregrounds?
1812 bool wxStyledTextCtrl::GetTwoPhaseDraw() {
1813 return SendMsg(2283, 0, 0) != 0;
1816 // In twoPhaseDraw mode, drawing is performed in two phases, first the background
1817 // and then the foreground. This avoids chopping off characters that overlap the next run.
1818 void wxStyledTextCtrl::SetTwoPhaseDraw(bool twoPhase
) {
1819 SendMsg(2284, twoPhase
, 0);
1822 // Make the target range start and end be the same as the selection range start and end.
1823 void wxStyledTextCtrl::TargetFromSelection() {
1824 SendMsg(2287, 0, 0);
1827 // Join the lines in the target.
1828 void wxStyledTextCtrl::LinesJoin() {
1829 SendMsg(2288, 0, 0);
1832 // Split the lines in the target into lines that are less wide than pixelWidth
1834 void wxStyledTextCtrl::LinesSplit(int pixelWidth
) {
1835 SendMsg(2289, pixelWidth
, 0);
1838 // Set the colours used as a chequerboard pattern in the fold margin
1839 void wxStyledTextCtrl::SetFoldMarginColour(bool useSetting
, const wxColour
& back
) {
1840 SendMsg(2290, useSetting
, wxColourAsLong(back
));
1842 void wxStyledTextCtrl::SetFoldMarginHiColour(bool useSetting
, const wxColour
& fore
) {
1843 SendMsg(2291, useSetting
, wxColourAsLong(fore
));
1846 // Move caret down one line.
1847 void wxStyledTextCtrl::LineDown() {
1848 SendMsg(2300, 0, 0);
1851 // Move caret down one line extending selection to new caret position.
1852 void wxStyledTextCtrl::LineDownExtend() {
1853 SendMsg(2301, 0, 0);
1856 // Move caret up one line.
1857 void wxStyledTextCtrl::LineUp() {
1858 SendMsg(2302, 0, 0);
1861 // Move caret up one line extending selection to new caret position.
1862 void wxStyledTextCtrl::LineUpExtend() {
1863 SendMsg(2303, 0, 0);
1866 // Move caret left one character.
1867 void wxStyledTextCtrl::CharLeft() {
1868 SendMsg(2304, 0, 0);
1871 // Move caret left one character extending selection to new caret position.
1872 void wxStyledTextCtrl::CharLeftExtend() {
1873 SendMsg(2305, 0, 0);
1876 // Move caret right one character.
1877 void wxStyledTextCtrl::CharRight() {
1878 SendMsg(2306, 0, 0);
1881 // Move caret right one character extending selection to new caret position.
1882 void wxStyledTextCtrl::CharRightExtend() {
1883 SendMsg(2307, 0, 0);
1886 // Move caret left one word.
1887 void wxStyledTextCtrl::WordLeft() {
1888 SendMsg(2308, 0, 0);
1891 // Move caret left one word extending selection to new caret position.
1892 void wxStyledTextCtrl::WordLeftExtend() {
1893 SendMsg(2309, 0, 0);
1896 // Move caret right one word.
1897 void wxStyledTextCtrl::WordRight() {
1898 SendMsg(2310, 0, 0);
1901 // Move caret right one word extending selection to new caret position.
1902 void wxStyledTextCtrl::WordRightExtend() {
1903 SendMsg(2311, 0, 0);
1906 // Move caret to first position on line.
1907 void wxStyledTextCtrl::Home() {
1908 SendMsg(2312, 0, 0);
1911 // Move caret to first position on line extending selection to new caret position.
1912 void wxStyledTextCtrl::HomeExtend() {
1913 SendMsg(2313, 0, 0);
1916 // Move caret to last position on line.
1917 void wxStyledTextCtrl::LineEnd() {
1918 SendMsg(2314, 0, 0);
1921 // Move caret to last position on line extending selection to new caret position.
1922 void wxStyledTextCtrl::LineEndExtend() {
1923 SendMsg(2315, 0, 0);
1926 // Move caret to first position in document.
1927 void wxStyledTextCtrl::DocumentStart() {
1928 SendMsg(2316, 0, 0);
1931 // Move caret to first position in document extending selection to new caret position.
1932 void wxStyledTextCtrl::DocumentStartExtend() {
1933 SendMsg(2317, 0, 0);
1936 // Move caret to last position in document.
1937 void wxStyledTextCtrl::DocumentEnd() {
1938 SendMsg(2318, 0, 0);
1941 // Move caret to last position in document extending selection to new caret position.
1942 void wxStyledTextCtrl::DocumentEndExtend() {
1943 SendMsg(2319, 0, 0);
1946 // Move caret one page up.
1947 void wxStyledTextCtrl::PageUp() {
1948 SendMsg(2320, 0, 0);
1951 // Move caret one page up extending selection to new caret position.
1952 void wxStyledTextCtrl::PageUpExtend() {
1953 SendMsg(2321, 0, 0);
1956 // Move caret one page down.
1957 void wxStyledTextCtrl::PageDown() {
1958 SendMsg(2322, 0, 0);
1961 // Move caret one page down extending selection to new caret position.
1962 void wxStyledTextCtrl::PageDownExtend() {
1963 SendMsg(2323, 0, 0);
1966 // Switch from insert to overtype mode or the reverse.
1967 void wxStyledTextCtrl::EditToggleOvertype() {
1968 SendMsg(2324, 0, 0);
1971 // Cancel any modes such as call tip or auto-completion list display.
1972 void wxStyledTextCtrl::Cancel() {
1973 SendMsg(2325, 0, 0);
1976 // Delete the selection or if no selection, the character before the caret.
1977 void wxStyledTextCtrl::DeleteBack() {
1978 SendMsg(2326, 0, 0);
1981 // If selection is empty or all on one line replace the selection with a tab character.
1982 // If more than one line selected, indent the lines.
1983 void wxStyledTextCtrl::Tab() {
1984 SendMsg(2327, 0, 0);
1987 // Dedent the selected lines.
1988 void wxStyledTextCtrl::BackTab() {
1989 SendMsg(2328, 0, 0);
1992 // Insert a new line, may use a CRLF, CR or LF depending on EOL mode.
1993 void wxStyledTextCtrl::NewLine() {
1994 SendMsg(2329, 0, 0);
1997 // Insert a Form Feed character.
1998 void wxStyledTextCtrl::FormFeed() {
1999 SendMsg(2330, 0, 0);
2002 // Move caret to before first visible character on line.
2003 // If already there move to first character on line.
2004 void wxStyledTextCtrl::VCHome() {
2005 SendMsg(2331, 0, 0);
2008 // Like VCHome but extending selection to new caret position.
2009 void wxStyledTextCtrl::VCHomeExtend() {
2010 SendMsg(2332, 0, 0);
2013 // Magnify the displayed text by increasing the sizes by 1 point.
2014 void wxStyledTextCtrl::ZoomIn() {
2015 SendMsg(2333, 0, 0);
2018 // Make the displayed text smaller by decreasing the sizes by 1 point.
2019 void wxStyledTextCtrl::ZoomOut() {
2020 SendMsg(2334, 0, 0);
2023 // Delete the word to the left of the caret.
2024 void wxStyledTextCtrl::DelWordLeft() {
2025 SendMsg(2335, 0, 0);
2028 // Delete the word to the right of the caret.
2029 void wxStyledTextCtrl::DelWordRight() {
2030 SendMsg(2336, 0, 0);
2033 // Delete the word to the right of the caret, but not the trailing non-word characters.
2034 void wxStyledTextCtrl::DelWordRightEnd() {
2035 SendMsg(2518, 0, 0);
2038 // Cut the line containing the caret.
2039 void wxStyledTextCtrl::LineCut() {
2040 SendMsg(2337, 0, 0);
2043 // Delete the line containing the caret.
2044 void wxStyledTextCtrl::LineDelete() {
2045 SendMsg(2338, 0, 0);
2048 // Switch the current line with the previous.
2049 void wxStyledTextCtrl::LineTranspose() {
2050 SendMsg(2339, 0, 0);
2053 // Duplicate the current line.
2054 void wxStyledTextCtrl::LineDuplicate() {
2055 SendMsg(2404, 0, 0);
2058 // Transform the selection to lower case.
2059 void wxStyledTextCtrl::LowerCase() {
2060 SendMsg(2340, 0, 0);
2063 // Transform the selection to upper case.
2064 void wxStyledTextCtrl::UpperCase() {
2065 SendMsg(2341, 0, 0);
2068 // Scroll the document down, keeping the caret visible.
2069 void wxStyledTextCtrl::LineScrollDown() {
2070 SendMsg(2342, 0, 0);
2073 // Scroll the document up, keeping the caret visible.
2074 void wxStyledTextCtrl::LineScrollUp() {
2075 SendMsg(2343, 0, 0);
2078 // Delete the selection or if no selection, the character before the caret.
2079 // Will not delete the character before at the start of a line.
2080 void wxStyledTextCtrl::DeleteBackNotLine() {
2081 SendMsg(2344, 0, 0);
2084 // Move caret to first position on display line.
2085 void wxStyledTextCtrl::HomeDisplay() {
2086 SendMsg(2345, 0, 0);
2089 // Move caret to first position on display line extending selection to
2090 // new caret position.
2091 void wxStyledTextCtrl::HomeDisplayExtend() {
2092 SendMsg(2346, 0, 0);
2095 // Move caret to last position on display line.
2096 void wxStyledTextCtrl::LineEndDisplay() {
2097 SendMsg(2347, 0, 0);
2100 // Move caret to last position on display line extending selection to new
2102 void wxStyledTextCtrl::LineEndDisplayExtend() {
2103 SendMsg(2348, 0, 0);
2106 // These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)?
2107 // except they behave differently when word-wrap is enabled:
2108 // They go first to the start / end of the display line, like (Home|LineEnd)Display
2109 // The difference is that, the cursor is already at the point, it goes on to the start
2110 // or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
2111 void wxStyledTextCtrl::HomeWrap() {
2112 SendMsg(2349, 0, 0);
2114 void wxStyledTextCtrl::HomeWrapExtend() {
2115 SendMsg(2450, 0, 0);
2117 void wxStyledTextCtrl::LineEndWrap() {
2118 SendMsg(2451, 0, 0);
2120 void wxStyledTextCtrl::LineEndWrapExtend() {
2121 SendMsg(2452, 0, 0);
2123 void wxStyledTextCtrl::VCHomeWrap() {
2124 SendMsg(2453, 0, 0);
2126 void wxStyledTextCtrl::VCHomeWrapExtend() {
2127 SendMsg(2454, 0, 0);
2130 // Copy the line containing the caret.
2131 void wxStyledTextCtrl::LineCopy() {
2132 SendMsg(2455, 0, 0);
2135 // Move the caret inside current view if it's not there already.
2136 void wxStyledTextCtrl::MoveCaretInsideView() {
2137 SendMsg(2401, 0, 0);
2140 // How many characters are on a line, not including end of line characters?
2141 int wxStyledTextCtrl::LineLength(int line
) {
2142 return SendMsg(2350, line
, 0);
2145 // Highlight the characters at two positions.
2146 void wxStyledTextCtrl::BraceHighlight(int pos1
, int pos2
) {
2147 SendMsg(2351, pos1
, pos2
);
2150 // Highlight the character at a position indicating there is no matching brace.
2151 void wxStyledTextCtrl::BraceBadLight(int pos
) {
2152 SendMsg(2352, pos
, 0);
2155 // Find the position of a matching brace or INVALID_POSITION if no match.
2156 int wxStyledTextCtrl::BraceMatch(int pos
) {
2157 return SendMsg(2353, pos
, 0);
2160 // Are the end of line characters visible?
2161 bool wxStyledTextCtrl::GetViewEOL() {
2162 return SendMsg(2355, 0, 0) != 0;
2165 // Make the end of line characters visible or invisible.
2166 void wxStyledTextCtrl::SetViewEOL(bool visible
) {
2167 SendMsg(2356, visible
, 0);
2170 // Retrieve a pointer to the document object.
2171 void* wxStyledTextCtrl::GetDocPointer() {
2172 return (void*)SendMsg(2357);
2175 // Change the document object used.
2176 void wxStyledTextCtrl::SetDocPointer(void* docPointer
) {
2177 SendMsg(2358, 0, (long)docPointer
);
2180 // Set which document modification events are sent to the container.
2181 void wxStyledTextCtrl::SetModEventMask(int mask
) {
2182 SendMsg(2359, mask
, 0);
2185 // Retrieve the column number which text should be kept within.
2186 int wxStyledTextCtrl::GetEdgeColumn() {
2187 return SendMsg(2360, 0, 0);
2190 // Set the column number of the edge.
2191 // If text goes past the edge then it is highlighted.
2192 void wxStyledTextCtrl::SetEdgeColumn(int column
) {
2193 SendMsg(2361, column
, 0);
2196 // Retrieve the edge highlight mode.
2197 int wxStyledTextCtrl::GetEdgeMode() {
2198 return SendMsg(2362, 0, 0);
2201 // The edge may be displayed by a line (EDGE_LINE) or by highlighting text that
2202 // goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).
2203 void wxStyledTextCtrl::SetEdgeMode(int mode
) {
2204 SendMsg(2363, mode
, 0);
2207 // Retrieve the colour used in edge indication.
2208 wxColour
wxStyledTextCtrl::GetEdgeColour() {
2209 long c
= SendMsg(2364, 0, 0);
2210 return wxColourFromLong(c
);
2213 // Change the colour used in edge indication.
2214 void wxStyledTextCtrl::SetEdgeColour(const wxColour
& edgeColour
) {
2215 SendMsg(2365, wxColourAsLong(edgeColour
), 0);
2218 // Sets the current caret position to be the search anchor.
2219 void wxStyledTextCtrl::SearchAnchor() {
2220 SendMsg(2366, 0, 0);
2223 // Find some text starting at the search anchor.
2224 // Does not ensure the selection is visible.
2225 int wxStyledTextCtrl::SearchNext(int flags
, const wxString
& text
) {
2226 return SendMsg(2367, flags
, (long)(const char*)wx2stc(text
));
2229 // Find some text starting at the search anchor and moving backwards.
2230 // Does not ensure the selection is visible.
2231 int wxStyledTextCtrl::SearchPrev(int flags
, const wxString
& text
) {
2232 return SendMsg(2368, flags
, (long)(const char*)wx2stc(text
));
2235 // Retrieves the number of lines completely visible.
2236 int wxStyledTextCtrl::LinesOnScreen() {
2237 return SendMsg(2370, 0, 0);
2240 // Set whether a pop up menu is displayed automatically when the user presses
2241 // the wrong mouse button.
2242 void wxStyledTextCtrl::UsePopUp(bool allowPopUp
) {
2243 SendMsg(2371, allowPopUp
, 0);
2246 // Is the selection rectangular? The alternative is the more common stream selection.
2247 bool wxStyledTextCtrl::SelectionIsRectangle() {
2248 return SendMsg(2372, 0, 0) != 0;
2251 // Set the zoom level. This number of points is added to the size of all fonts.
2252 // It may be positive to magnify or negative to reduce.
2253 void wxStyledTextCtrl::SetZoom(int zoom
) {
2254 SendMsg(2373, zoom
, 0);
2257 // Retrieve the zoom level.
2258 int wxStyledTextCtrl::GetZoom() {
2259 return SendMsg(2374, 0, 0);
2262 // Create a new document object.
2263 // Starts with reference count of 1 and not selected into editor.
2264 void* wxStyledTextCtrl::CreateDocument() {
2265 return (void*)SendMsg(2375);
2268 // Extend life of document.
2269 void wxStyledTextCtrl::AddRefDocument(void* docPointer
) {
2270 SendMsg(2376, 0, (long)docPointer
);
2273 // Release a reference to the document, deleting document if it fades to black.
2274 void wxStyledTextCtrl::ReleaseDocument(void* docPointer
) {
2275 SendMsg(2377, 0, (long)docPointer
);
2278 // Get which document modification events are sent to the container.
2279 int wxStyledTextCtrl::GetModEventMask() {
2280 return SendMsg(2378, 0, 0);
2283 // Change internal focus flag.
2284 void wxStyledTextCtrl::SetSTCFocus(bool focus
) {
2285 SendMsg(2380, focus
, 0);
2288 // Get internal focus flag.
2289 bool wxStyledTextCtrl::GetSTCFocus() {
2290 return SendMsg(2381, 0, 0) != 0;
2293 // Change error status - 0 = OK.
2294 void wxStyledTextCtrl::SetStatus(int statusCode
) {
2295 SendMsg(2382, statusCode
, 0);
2298 // Get error status.
2299 int wxStyledTextCtrl::GetStatus() {
2300 return SendMsg(2383, 0, 0);
2303 // Set whether the mouse is captured when its button is pressed.
2304 void wxStyledTextCtrl::SetMouseDownCaptures(bool captures
) {
2305 SendMsg(2384, captures
, 0);
2308 // Get whether mouse gets captured.
2309 bool wxStyledTextCtrl::GetMouseDownCaptures() {
2310 return SendMsg(2385, 0, 0) != 0;
2313 // Sets the cursor to one of the SC_CURSOR* values.
2314 void wxStyledTextCtrl::SetSTCCursor(int cursorType
) {
2315 SendMsg(2386, cursorType
, 0);
2319 int wxStyledTextCtrl::GetSTCCursor() {
2320 return SendMsg(2387, 0, 0);
2323 // Change the way control characters are displayed:
2324 // If symbol is < 32, keep the drawn way, else, use the given character.
2325 void wxStyledTextCtrl::SetControlCharSymbol(int symbol
) {
2326 SendMsg(2388, symbol
, 0);
2329 // Get the way control characters are displayed.
2330 int wxStyledTextCtrl::GetControlCharSymbol() {
2331 return SendMsg(2389, 0, 0);
2334 // Move to the previous change in capitalisation.
2335 void wxStyledTextCtrl::WordPartLeft() {
2336 SendMsg(2390, 0, 0);
2339 // Move to the previous change in capitalisation extending selection
2340 // to new caret position.
2341 void wxStyledTextCtrl::WordPartLeftExtend() {
2342 SendMsg(2391, 0, 0);
2345 // Move to the change next in capitalisation.
2346 void wxStyledTextCtrl::WordPartRight() {
2347 SendMsg(2392, 0, 0);
2350 // Move to the next change in capitalisation extending selection
2351 // to new caret position.
2352 void wxStyledTextCtrl::WordPartRightExtend() {
2353 SendMsg(2393, 0, 0);
2356 // Set the way the display area is determined when a particular line
2357 // is to be moved to by Find, FindNext, GotoLine, etc.
2358 void wxStyledTextCtrl::SetVisiblePolicy(int visiblePolicy
, int visibleSlop
) {
2359 SendMsg(2394, visiblePolicy
, visibleSlop
);
2362 // Delete back from the current position to the start of the line.
2363 void wxStyledTextCtrl::DelLineLeft() {
2364 SendMsg(2395, 0, 0);
2367 // Delete forwards from the current position to the end of the line.
2368 void wxStyledTextCtrl::DelLineRight() {
2369 SendMsg(2396, 0, 0);
2372 // Get and Set the xOffset (ie, horizonal scroll position).
2373 void wxStyledTextCtrl::SetXOffset(int newOffset
) {
2374 SendMsg(2397, newOffset
, 0);
2376 int wxStyledTextCtrl::GetXOffset() {
2377 return SendMsg(2398, 0, 0);
2380 // Set the last x chosen value to be the caret x position.
2381 void wxStyledTextCtrl::ChooseCaretX() {
2382 SendMsg(2399, 0, 0);
2385 // Set the way the caret is kept visible when going sideway.
2386 // The exclusion zone is given in pixels.
2387 void wxStyledTextCtrl::SetXCaretPolicy(int caretPolicy
, int caretSlop
) {
2388 SendMsg(2402, caretPolicy
, caretSlop
);
2391 // Set the way the line the caret is on is kept visible.
2392 // The exclusion zone is given in lines.
2393 void wxStyledTextCtrl::SetYCaretPolicy(int caretPolicy
, int caretSlop
) {
2394 SendMsg(2403, caretPolicy
, caretSlop
);
2397 // Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE).
2398 void wxStyledTextCtrl::SetPrintWrapMode(int mode
) {
2399 SendMsg(2406, mode
, 0);
2402 // Is printing line wrapped?
2403 int wxStyledTextCtrl::GetPrintWrapMode() {
2404 return SendMsg(2407, 0, 0);
2407 // Set a fore colour for active hotspots.
2408 void wxStyledTextCtrl::SetHotspotActiveForeground(bool useSetting
, const wxColour
& fore
) {
2409 SendMsg(2410, useSetting
, wxColourAsLong(fore
));
2412 // Get the fore colour for active hotspots.
2413 wxColour
wxStyledTextCtrl::GetHotspotActiveForeground() {
2414 long c
= SendMsg(2494, 0, 0);
2415 return wxColourFromLong(c
);
2418 // Set a back colour for active hotspots.
2419 void wxStyledTextCtrl::SetHotspotActiveBackground(bool useSetting
, const wxColour
& back
) {
2420 SendMsg(2411, useSetting
, wxColourAsLong(back
));
2423 // Get the back colour for active hotspots.
2424 wxColour
wxStyledTextCtrl::GetHotspotActiveBackground() {
2425 long c
= SendMsg(2495, 0, 0);
2426 return wxColourFromLong(c
);
2429 // Enable / Disable underlining active hotspots.
2430 void wxStyledTextCtrl::SetHotspotActiveUnderline(bool underline
) {
2431 SendMsg(2412, underline
, 0);
2434 // Get whether underlining for active hotspots.
2435 bool wxStyledTextCtrl::GetHotspotActiveUnderline() {
2436 return SendMsg(2496, 0, 0) != 0;
2439 // Limit hotspots to single line so hotspots on two lines don't merge.
2440 void wxStyledTextCtrl::SetHotspotSingleLine(bool singleLine
) {
2441 SendMsg(2421, singleLine
, 0);
2444 // Get the HotspotSingleLine property
2445 bool wxStyledTextCtrl::GetHotspotSingleLine() {
2446 return SendMsg(2497, 0, 0) != 0;
2449 // Move caret between paragraphs (delimited by empty lines).
2450 void wxStyledTextCtrl::ParaDown() {
2451 SendMsg(2413, 0, 0);
2453 void wxStyledTextCtrl::ParaDownExtend() {
2454 SendMsg(2414, 0, 0);
2456 void wxStyledTextCtrl::ParaUp() {
2457 SendMsg(2415, 0, 0);
2459 void wxStyledTextCtrl::ParaUpExtend() {
2460 SendMsg(2416, 0, 0);
2463 // Given a valid document position, return the previous position taking code
2464 // page into account. Returns 0 if passed 0.
2465 int wxStyledTextCtrl::PositionBefore(int pos
) {
2466 return SendMsg(2417, pos
, 0);
2469 // Given a valid document position, return the next position taking code
2470 // page into account. Maximum value returned is the last position in the document.
2471 int wxStyledTextCtrl::PositionAfter(int pos
) {
2472 return SendMsg(2418, pos
, 0);
2475 // Copy a range of text to the clipboard. Positions are clipped into the document.
2476 void wxStyledTextCtrl::CopyRange(int start
, int end
) {
2477 SendMsg(2419, start
, end
);
2480 // Copy argument text to the clipboard.
2481 void wxStyledTextCtrl::CopyText(int length
, const wxString
& text
) {
2482 SendMsg(2420, length
, (long)(const char*)wx2stc(text
));
2485 // Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE) or
2486 // by lines (SC_SEL_LINES).
2487 void wxStyledTextCtrl::SetSelectionMode(int mode
) {
2488 SendMsg(2422, mode
, 0);
2491 // Get the mode of the current selection.
2492 int wxStyledTextCtrl::GetSelectionMode() {
2493 return SendMsg(2423, 0, 0);
2496 // Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line).
2497 int wxStyledTextCtrl::GetLineSelStartPosition(int line
) {
2498 return SendMsg(2424, line
, 0);
2501 // Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line).
2502 int wxStyledTextCtrl::GetLineSelEndPosition(int line
) {
2503 return SendMsg(2425, line
, 0);
2506 // Move caret down one line, extending rectangular selection to new caret position.
2507 void wxStyledTextCtrl::LineDownRectExtend() {
2508 SendMsg(2426, 0, 0);
2511 // Move caret up one line, extending rectangular selection to new caret position.
2512 void wxStyledTextCtrl::LineUpRectExtend() {
2513 SendMsg(2427, 0, 0);
2516 // Move caret left one character, extending rectangular selection to new caret position.
2517 void wxStyledTextCtrl::CharLeftRectExtend() {
2518 SendMsg(2428, 0, 0);
2521 // Move caret right one character, extending rectangular selection to new caret position.
2522 void wxStyledTextCtrl::CharRightRectExtend() {
2523 SendMsg(2429, 0, 0);
2526 // Move caret to first position on line, extending rectangular selection to new caret position.
2527 void wxStyledTextCtrl::HomeRectExtend() {
2528 SendMsg(2430, 0, 0);
2531 // Move caret to before first visible character on line.
2532 // If already there move to first character on line.
2533 // In either case, extend rectangular selection to new caret position.
2534 void wxStyledTextCtrl::VCHomeRectExtend() {
2535 SendMsg(2431, 0, 0);
2538 // Move caret to last position on line, extending rectangular selection to new caret position.
2539 void wxStyledTextCtrl::LineEndRectExtend() {
2540 SendMsg(2432, 0, 0);
2543 // Move caret one page up, extending rectangular selection to new caret position.
2544 void wxStyledTextCtrl::PageUpRectExtend() {
2545 SendMsg(2433, 0, 0);
2548 // Move caret one page down, extending rectangular selection to new caret position.
2549 void wxStyledTextCtrl::PageDownRectExtend() {
2550 SendMsg(2434, 0, 0);
2553 // Move caret to top of page, or one page up if already at top of page.
2554 void wxStyledTextCtrl::StutteredPageUp() {
2555 SendMsg(2435, 0, 0);
2558 // Move caret to top of page, or one page up if already at top of page, extending selection to new caret position.
2559 void wxStyledTextCtrl::StutteredPageUpExtend() {
2560 SendMsg(2436, 0, 0);
2563 // Move caret to bottom of page, or one page down if already at bottom of page.
2564 void wxStyledTextCtrl::StutteredPageDown() {
2565 SendMsg(2437, 0, 0);
2568 // Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position.
2569 void wxStyledTextCtrl::StutteredPageDownExtend() {
2570 SendMsg(2438, 0, 0);
2573 // Move caret left one word, position cursor at end of word.
2574 void wxStyledTextCtrl::WordLeftEnd() {
2575 SendMsg(2439, 0, 0);
2578 // Move caret left one word, position cursor at end of word, extending selection to new caret position.
2579 void wxStyledTextCtrl::WordLeftEndExtend() {
2580 SendMsg(2440, 0, 0);
2583 // Move caret right one word, position cursor at end of word.
2584 void wxStyledTextCtrl::WordRightEnd() {
2585 SendMsg(2441, 0, 0);
2588 // Move caret right one word, position cursor at end of word, extending selection to new caret position.
2589 void wxStyledTextCtrl::WordRightEndExtend() {
2590 SendMsg(2442, 0, 0);
2593 // Set the set of characters making up whitespace for when moving or selecting by word.
2594 // Should be called after SetWordChars.
2595 void wxStyledTextCtrl::SetWhitespaceChars(const wxString
& characters
) {
2596 SendMsg(2443, 0, (long)(const char*)wx2stc(characters
));
2599 // Reset the set of characters for whitespace and word characters to the defaults.
2600 void wxStyledTextCtrl::SetCharsDefault() {
2601 SendMsg(2444, 0, 0);
2604 // Get currently selected item position in the auto-completion list
2605 int wxStyledTextCtrl::AutoCompGetCurrent() {
2606 return SendMsg(2445, 0, 0);
2609 // Enlarge the document to a particular size of text bytes.
2610 void wxStyledTextCtrl::Allocate(int bytes
) {
2611 SendMsg(2446, bytes
, 0);
2614 // Find the position of a column on a line taking into account tabs and
2615 // multi-byte characters. If beyond end of line, return line end position.
2616 int wxStyledTextCtrl::FindColumn(int line
, int column
) {
2617 return SendMsg(2456, line
, column
);
2620 // Can the caret preferred x position only be changed by explicit movement commands?
2621 bool wxStyledTextCtrl::GetCaretSticky() {
2622 return SendMsg(2457, 0, 0) != 0;
2625 // Stop the caret preferred x position changing when the user types.
2626 void wxStyledTextCtrl::SetCaretSticky(bool useCaretStickyBehaviour
) {
2627 SendMsg(2458, useCaretStickyBehaviour
, 0);
2630 // Switch between sticky and non-sticky: meant to be bound to a key.
2631 void wxStyledTextCtrl::ToggleCaretSticky() {
2632 SendMsg(2459, 0, 0);
2635 // Enable/Disable convert-on-paste for line endings
2636 void wxStyledTextCtrl::SetPasteConvertEndings(bool convert
) {
2637 SendMsg(2467, convert
, 0);
2640 // Get convert-on-paste setting
2641 bool wxStyledTextCtrl::GetPasteConvertEndings() {
2642 return SendMsg(2468, 0, 0) != 0;
2645 // Duplicate the selection. If selection empty duplicate the line containing the caret.
2646 void wxStyledTextCtrl::SelectionDuplicate() {
2647 SendMsg(2469, 0, 0);
2650 // Set background alpha of the caret line.
2651 void wxStyledTextCtrl::SetCaretLineBackAlpha(int alpha
) {
2652 SendMsg(2470, alpha
, 0);
2655 // Get the background alpha of the caret line.
2656 int wxStyledTextCtrl::GetCaretLineBackAlpha() {
2657 return SendMsg(2471, 0, 0);
2660 // Set the style of the caret to be drawn.
2661 void wxStyledTextCtrl::SetCaretStyle(int caretStyle
) {
2662 SendMsg(2512, caretStyle
, 0);
2665 // Returns the current style of the caret.
2666 int wxStyledTextCtrl::GetCaretStyle() {
2667 return SendMsg(2513, 0, 0);
2670 // Set the indicator used for IndicatorFillRange and IndicatorClearRange
2671 void wxStyledTextCtrl::SetIndicatorCurrent(int indicator
) {
2672 SendMsg(2500, indicator
, 0);
2675 // Get the current indicator
2676 int wxStyledTextCtrl::GetIndicatorCurrent() {
2677 return SendMsg(2501, 0, 0);
2680 // Set the value used for IndicatorFillRange
2681 void wxStyledTextCtrl::SetIndicatorValue(int value
) {
2682 SendMsg(2502, value
, 0);
2685 // Get the current indicator vaue
2686 int wxStyledTextCtrl::GetIndicatorValue() {
2687 return SendMsg(2503, 0, 0);
2690 // Turn a indicator on over a range.
2691 void wxStyledTextCtrl::IndicatorFillRange(int position
, int fillLength
) {
2692 SendMsg(2504, position
, fillLength
);
2695 // Turn a indicator off over a range.
2696 void wxStyledTextCtrl::IndicatorClearRange(int position
, int clearLength
) {
2697 SendMsg(2505, position
, clearLength
);
2700 // Are any indicators present at position?
2701 int wxStyledTextCtrl::IndicatorAllOnFor(int position
) {
2702 return SendMsg(2506, position
, 0);
2705 // What value does a particular indicator have at at a position?
2706 int wxStyledTextCtrl::IndicatorValueAt(int indicator
, int position
) {
2707 return SendMsg(2507, indicator
, position
);
2710 // Where does a particular indicator start?
2711 int wxStyledTextCtrl::IndicatorStart(int indicator
, int position
) {
2712 return SendMsg(2508, indicator
, position
);
2715 // Where does a particular indicator end?
2716 int wxStyledTextCtrl::IndicatorEnd(int indicator
, int position
) {
2717 return SendMsg(2509, indicator
, position
);
2720 // Set number of entries in position cache
2721 void wxStyledTextCtrl::SetPositionCacheSize(int size
) {
2722 SendMsg(2514, size
, 0);
2725 // How many entries are allocated to the position cache?
2726 int wxStyledTextCtrl::GetPositionCacheSize() {
2727 return SendMsg(2515, 0, 0);
2730 // Start notifying the container of all key presses and commands.
2731 void wxStyledTextCtrl::StartRecord() {
2732 SendMsg(3001, 0, 0);
2735 // Stop notifying the container of all key presses and commands.
2736 void wxStyledTextCtrl::StopRecord() {
2737 SendMsg(3002, 0, 0);
2740 // Set the lexing language of the document.
2741 void wxStyledTextCtrl::SetLexer(int lexer
) {
2742 SendMsg(4001, lexer
, 0);
2745 // Retrieve the lexing language of the document.
2746 int wxStyledTextCtrl::GetLexer() {
2747 return SendMsg(4002, 0, 0);
2750 // Colourise a segment of the document using the current lexing language.
2751 void wxStyledTextCtrl::Colourise(int start
, int end
) {
2752 SendMsg(4003, start
, end
);
2755 // Set up a value that may be used by a lexer for some optional feature.
2756 void wxStyledTextCtrl::SetProperty(const wxString
& key
, const wxString
& value
) {
2757 SendMsg(4004, (long)(const char*)wx2stc(key
), (long)(const char*)wx2stc(value
));
2760 // Set up the key words used by the lexer.
2761 void wxStyledTextCtrl::SetKeyWords(int keywordSet
, const wxString
& keyWords
) {
2762 SendMsg(4005, keywordSet
, (long)(const char*)wx2stc(keyWords
));
2765 // Set the lexing language of the document based on string name.
2766 void wxStyledTextCtrl::SetLexerLanguage(const wxString
& language
) {
2767 SendMsg(4006, 0, (long)(const char*)wx2stc(language
));
2770 // Retrieve a 'property' value previously set with SetProperty.
2771 wxString
wxStyledTextCtrl::GetProperty(const wxString
& key
) {
2772 int len
= SendMsg(SCI_GETPROPERTY
, (long)(const char*)wx2stc(key
), 0);
2773 if (!len
) return wxEmptyString
;
2775 wxMemoryBuffer
mbuf(len
+1);
2776 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
2777 SendMsg(4008, (long)(const char*)wx2stc(key
), (long)buf
);
2778 mbuf
.UngetWriteBuf(len
);
2783 // Retrieve a 'property' value previously set with SetProperty,
2784 // with '$()' variable replacement on returned buffer.
2785 wxString
wxStyledTextCtrl::GetPropertyExpanded(const wxString
& key
) {
2786 int len
= SendMsg(SCI_GETPROPERTYEXPANDED
, (long)(const char*)wx2stc(key
), 0);
2787 if (!len
) return wxEmptyString
;
2789 wxMemoryBuffer
mbuf(len
+1);
2790 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
2791 SendMsg(4009, (long)(const char*)wx2stc(key
), (long)buf
);
2792 mbuf
.UngetWriteBuf(len
);
2797 // Retrieve a 'property' value previously set with SetProperty,
2798 // interpreted as an int AFTER any '$()' variable replacement.
2799 int wxStyledTextCtrl::GetPropertyInt(const wxString
& key
) {
2800 return SendMsg(4010, (long)(const char*)wx2stc(key
), 0);
2803 // Retrieve the number of bits the current lexer needs for styling.
2804 int wxStyledTextCtrl::GetStyleBitsNeeded() {
2805 return SendMsg(4011, 0, 0);
2808 // END of generated section
2809 //----------------------------------------------------------------------
2812 // Returns the line number of the line with the caret.
2813 int wxStyledTextCtrl::GetCurrentLine() {
2814 int line
= LineFromPosition(GetCurrentPos());
2819 // Extract style settings from a spec-string which is composed of one or
2820 // more of the following comma separated elements:
2822 // bold turns on bold
2823 // italic turns on italics
2824 // fore:[name or #RRGGBB] sets the foreground colour
2825 // back:[name or #RRGGBB] sets the background colour
2826 // face:[facename] sets the font face name to use
2827 // size:[num] sets the font size in points
2828 // eol turns on eol filling
2829 // underline turns on underlining
2831 void wxStyledTextCtrl::StyleSetSpec(int styleNum
, const wxString
& spec
) {
2833 wxStringTokenizer
tkz(spec
, wxT(","));
2834 while (tkz
.HasMoreTokens()) {
2835 wxString token
= tkz
.GetNextToken();
2837 wxString option
= token
.BeforeFirst(':');
2838 wxString val
= token
.AfterFirst(':');
2840 if (option
== wxT("bold"))
2841 StyleSetBold(styleNum
, true);
2843 else if (option
== wxT("italic"))
2844 StyleSetItalic(styleNum
, true);
2846 else if (option
== wxT("underline"))
2847 StyleSetUnderline(styleNum
, true);
2849 else if (option
== wxT("eol"))
2850 StyleSetEOLFilled(styleNum
, true);
2852 else if (option
== wxT("size")) {
2854 if (val
.ToLong(&points
))
2855 StyleSetSize(styleNum
, points
);
2858 else if (option
== wxT("face"))
2859 StyleSetFaceName(styleNum
, val
);
2861 else if (option
== wxT("fore"))
2862 StyleSetForeground(styleNum
, wxColourFromSpec(val
));
2864 else if (option
== wxT("back"))
2865 StyleSetBackground(styleNum
, wxColourFromSpec(val
));
2870 // Get the font of a style
2871 wxFont
wxStyledTextCtrl::StyleGetFont(int style
) {
2873 font
.SetPointSize(StyleGetSize(style
));
2874 font
.SetFaceName(StyleGetFaceName(style
));
2875 if( StyleGetBold(style
) )
2876 font
.SetWeight(wxFONTWEIGHT_BOLD
);
2878 font
.SetWeight(wxFONTWEIGHT_NORMAL
);
2880 if( StyleGetItalic(style
) )
2881 font
.SetStyle(wxFONTSTYLE_ITALIC
);
2883 font
.SetStyle(wxFONTSTYLE_NORMAL
);
2889 // Set style size, face, bold, italic, and underline attributes from
2890 // a wxFont's attributes.
2891 void wxStyledTextCtrl::StyleSetFont(int styleNum
, wxFont
& font
) {
2893 // Ensure that the native font is initialized
2895 GetTextExtent(wxT("X"), &x
, &y
, NULL
, NULL
, &font
);
2897 int size
= font
.GetPointSize();
2898 wxString faceName
= font
.GetFaceName();
2899 bool bold
= font
.GetWeight() == wxBOLD
;
2900 bool italic
= font
.GetStyle() != wxNORMAL
;
2901 bool under
= font
.GetUnderlined();
2902 wxFontEncoding encoding
= font
.GetEncoding();
2904 StyleSetFontAttr(styleNum
, size
, faceName
, bold
, italic
, under
, encoding
);
2907 // Set all font style attributes at once.
2908 void wxStyledTextCtrl::StyleSetFontAttr(int styleNum
, int size
,
2909 const wxString
& faceName
,
2910 bool bold
, bool italic
,
2912 wxFontEncoding encoding
) {
2913 StyleSetSize(styleNum
, size
);
2914 StyleSetFaceName(styleNum
, faceName
);
2915 StyleSetBold(styleNum
, bold
);
2916 StyleSetItalic(styleNum
, italic
);
2917 StyleSetUnderline(styleNum
, underline
);
2918 StyleSetFontEncoding(styleNum
, encoding
);
2922 // Set the character set of the font in a style. Converts the Scintilla
2923 // character set values to a wxFontEncoding.
2924 void wxStyledTextCtrl::StyleSetCharacterSet(int style
, int characterSet
)
2926 wxFontEncoding encoding
;
2928 // Translate the Scintilla characterSet to a wxFontEncoding
2929 switch (characterSet
) {
2931 case wxSTC_CHARSET_ANSI
:
2932 case wxSTC_CHARSET_DEFAULT
:
2933 encoding
= wxFONTENCODING_DEFAULT
;
2936 case wxSTC_CHARSET_BALTIC
:
2937 encoding
= wxFONTENCODING_ISO8859_13
;
2940 case wxSTC_CHARSET_CHINESEBIG5
:
2941 encoding
= wxFONTENCODING_CP950
;
2944 case wxSTC_CHARSET_EASTEUROPE
:
2945 encoding
= wxFONTENCODING_ISO8859_2
;
2948 case wxSTC_CHARSET_GB2312
:
2949 encoding
= wxFONTENCODING_CP936
;
2952 case wxSTC_CHARSET_GREEK
:
2953 encoding
= wxFONTENCODING_ISO8859_7
;
2956 case wxSTC_CHARSET_HANGUL
:
2957 encoding
= wxFONTENCODING_CP949
;
2960 case wxSTC_CHARSET_MAC
:
2961 encoding
= wxFONTENCODING_DEFAULT
;
2964 case wxSTC_CHARSET_OEM
:
2965 encoding
= wxFONTENCODING_DEFAULT
;
2968 case wxSTC_CHARSET_RUSSIAN
:
2969 encoding
= wxFONTENCODING_KOI8
;
2972 case wxSTC_CHARSET_SHIFTJIS
:
2973 encoding
= wxFONTENCODING_CP932
;
2976 case wxSTC_CHARSET_SYMBOL
:
2977 encoding
= wxFONTENCODING_DEFAULT
;
2980 case wxSTC_CHARSET_TURKISH
:
2981 encoding
= wxFONTENCODING_ISO8859_9
;
2984 case wxSTC_CHARSET_JOHAB
:
2985 encoding
= wxFONTENCODING_DEFAULT
;
2988 case wxSTC_CHARSET_HEBREW
:
2989 encoding
= wxFONTENCODING_ISO8859_8
;
2992 case wxSTC_CHARSET_ARABIC
:
2993 encoding
= wxFONTENCODING_ISO8859_6
;
2996 case wxSTC_CHARSET_VIETNAMESE
:
2997 encoding
= wxFONTENCODING_DEFAULT
;
3000 case wxSTC_CHARSET_THAI
:
3001 encoding
= wxFONTENCODING_ISO8859_11
;
3004 case wxSTC_CHARSET_CYRILLIC
:
3005 encoding
= wxFONTENCODING_ISO8859_5
;
3008 case wxSTC_CHARSET_8859_15
:
3009 encoding
= wxFONTENCODING_ISO8859_15
;;
3013 // We just have Scintilla track the wxFontEncoding for us. It gets used
3014 // in Font::Create in PlatWX.cpp. We add one to the value so that the
3015 // effective wxFONENCODING_DEFAULT == SC_SHARSET_DEFAULT and so when
3016 // Scintilla internally uses SC_CHARSET_DEFAULT we will translate it back
3017 // to wxFONENCODING_DEFAULT in Font::Create.
3018 SendMsg(SCI_STYLESETCHARACTERSET
, style
, encoding
+1);
3022 // Set the font encoding to be used by a style.
3023 void wxStyledTextCtrl::StyleSetFontEncoding(int style
, wxFontEncoding encoding
)
3025 SendMsg(SCI_STYLESETCHARACTERSET
, style
, encoding
+1);
3029 // Perform one of the operations defined by the wxSTC_CMD_* constants.
3030 void wxStyledTextCtrl::CmdKeyExecute(int cmd
) {
3035 // Set the left and right margin in the edit area, measured in pixels.
3036 void wxStyledTextCtrl::SetMargins(int left
, int right
) {
3037 SetMarginLeft(left
);
3038 SetMarginRight(right
);
3042 // Retrieve the start and end positions of the current selection.
3043 void wxStyledTextCtrl::GetSelection(int* startPos
, int* endPos
) {
3044 if (startPos
!= NULL
)
3045 *startPos
= SendMsg(SCI_GETSELECTIONSTART
);
3047 *endPos
= SendMsg(SCI_GETSELECTIONEND
);
3051 // Retrieve the point in the window where a position is displayed.
3052 wxPoint
wxStyledTextCtrl::PointFromPosition(int pos
) {
3053 int x
= SendMsg(SCI_POINTXFROMPOSITION
, 0, pos
);
3054 int y
= SendMsg(SCI_POINTYFROMPOSITION
, 0, pos
);
3055 return wxPoint(x
, y
);
3058 // Scroll enough to make the given line visible
3059 void wxStyledTextCtrl::ScrollToLine(int line
) {
3060 m_swx
->DoScrollToLine(line
);
3064 // Scroll enough to make the given column visible
3065 void wxStyledTextCtrl::ScrollToColumn(int column
) {
3066 m_swx
->DoScrollToColumn(column
);
3070 bool wxStyledTextCtrl::SaveFile(const wxString
& filename
)
3072 wxFile
file(filename
, wxFile::write
);
3074 if (!file
.IsOpened())
3077 bool success
= file
.Write(GetText(), *wxConvCurrent
);
3085 bool wxStyledTextCtrl::LoadFile(const wxString
& filename
)
3087 bool success
= false;
3088 wxFile
file(filename
, wxFile::read
);
3090 if (file
.IsOpened())
3093 // get the file size (assume it is not huge file...)
3094 ssize_t len
= (ssize_t
)file
.Length();
3099 wxMemoryBuffer
buffer(len
+1);
3100 success
= (file
.Read(buffer
.GetData(), len
) == len
);
3102 ((char*)buffer
.GetData())[len
] = 0;
3103 contents
= wxString(buffer
, *wxConvCurrent
, len
);
3107 success
= (file
.Read(wxStringBuffer(buffer
, len
), len
) == len
);
3114 success
= true; // empty file is ok
3116 success
= false; // len == wxInvalidOffset
3131 #if wxUSE_DRAG_AND_DROP
3132 wxDragResult
wxStyledTextCtrl::DoDragOver(wxCoord x
, wxCoord y
, wxDragResult def
) {
3133 return m_swx
->DoDragOver(x
, y
, def
);
3137 bool wxStyledTextCtrl::DoDropText(long x
, long y
, const wxString
& data
) {
3138 return m_swx
->DoDropText(x
, y
, data
);
3143 void wxStyledTextCtrl::SetUseAntiAliasing(bool useAA
) {
3144 m_swx
->SetUseAntiAliasing(useAA
);
3147 bool wxStyledTextCtrl::GetUseAntiAliasing() {
3148 return m_swx
->GetUseAntiAliasing();
3155 void wxStyledTextCtrl::AddTextRaw(const char* text
)
3157 SendMsg(SCI_ADDTEXT
, strlen(text
), (long)text
);
3160 void wxStyledTextCtrl::InsertTextRaw(int pos
, const char* text
)
3162 SendMsg(SCI_INSERTTEXT
, pos
, (long)text
);
3165 wxCharBuffer
wxStyledTextCtrl::GetCurLineRaw(int* linePos
)
3167 int len
= LineLength(GetCurrentLine());
3169 if (linePos
) *linePos
= 0;
3174 wxCharBuffer
buf(len
);
3175 int pos
= SendMsg(SCI_GETCURLINE
, len
, (long)buf
.data());
3176 if (linePos
) *linePos
= pos
;
3180 wxCharBuffer
wxStyledTextCtrl::GetLineRaw(int line
)
3182 int len
= LineLength(line
);
3188 wxCharBuffer
buf(len
);
3189 SendMsg(SCI_GETLINE
, line
, (long)buf
.data());
3193 wxCharBuffer
wxStyledTextCtrl::GetSelectedTextRaw()
3198 GetSelection(&start
, &end
);
3199 int len
= end
- start
;
3205 wxCharBuffer
buf(len
);
3206 SendMsg(SCI_GETSELTEXT
, 0, (long)buf
.data());
3210 wxCharBuffer
wxStyledTextCtrl::GetTextRangeRaw(int startPos
, int endPos
)
3212 if (endPos
< startPos
) {
3213 int temp
= startPos
;
3217 int len
= endPos
- startPos
;
3223 wxCharBuffer
buf(len
);
3225 tr
.lpstrText
= buf
.data();
3226 tr
.chrg
.cpMin
= startPos
;
3227 tr
.chrg
.cpMax
= endPos
;
3228 SendMsg(SCI_GETTEXTRANGE
, 0, (long)&tr
);
3232 void wxStyledTextCtrl::SetTextRaw(const char* text
)
3234 SendMsg(SCI_SETTEXT
, 0, (long)text
);
3237 wxCharBuffer
wxStyledTextCtrl::GetTextRaw()
3239 int len
= GetTextLength();
3240 wxCharBuffer
buf(len
);
3241 SendMsg(SCI_GETTEXT
, len
, (long)buf
.data());
3245 void wxStyledTextCtrl::AppendTextRaw(const char* text
)
3247 SendMsg(SCI_APPENDTEXT
, strlen(text
), (long)text
);
3254 //----------------------------------------------------------------------
3257 void wxStyledTextCtrl::OnPaint(wxPaintEvent
& WXUNUSED(evt
)) {
3259 m_swx
->DoPaint(&dc
, GetUpdateRegion().GetBox());
3262 void wxStyledTextCtrl::OnScrollWin(wxScrollWinEvent
& evt
) {
3263 if (evt
.GetOrientation() == wxHORIZONTAL
)
3264 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
3266 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
3269 void wxStyledTextCtrl::OnScroll(wxScrollEvent
& evt
) {
3270 wxScrollBar
* sb
= wxDynamicCast(evt
.GetEventObject(), wxScrollBar
);
3272 if (sb
->IsVertical())
3273 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
3275 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
3279 void wxStyledTextCtrl::OnSize(wxSizeEvent
& WXUNUSED(evt
)) {
3281 wxSize sz
= GetClientSize();
3282 m_swx
->DoSize(sz
.x
, sz
.y
);
3286 void wxStyledTextCtrl::OnMouseLeftDown(wxMouseEvent
& evt
) {
3288 wxPoint pt
= evt
.GetPosition();
3289 m_swx
->DoLeftButtonDown(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
3290 evt
.ShiftDown(), evt
.ControlDown(), evt
.AltDown());
3293 void wxStyledTextCtrl::OnMouseMove(wxMouseEvent
& evt
) {
3294 wxPoint pt
= evt
.GetPosition();
3295 m_swx
->DoLeftButtonMove(Point(pt
.x
, pt
.y
));
3298 void wxStyledTextCtrl::OnMouseLeftUp(wxMouseEvent
& evt
) {
3299 wxPoint pt
= evt
.GetPosition();
3300 m_swx
->DoLeftButtonUp(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
3305 void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent
& evt
) {
3306 wxPoint pt
= evt
.GetPosition();
3307 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
3311 void wxStyledTextCtrl::OnMouseMiddleUp(wxMouseEvent
& evt
) {
3312 wxPoint pt
= evt
.GetPosition();
3313 m_swx
->DoMiddleButtonUp(Point(pt
.x
, pt
.y
));
3316 void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent
& evt
) {
3317 wxPoint pt
= evt
.GetPosition();
3318 ScreenToClient(&pt
.x
, &pt
.y
);
3320 Show context menu at event point if it's within the window,
3321 or at caret location if not
3323 wxHitTest ht
= this->HitTest(pt
);
3324 if (ht
!= wxHT_WINDOW_INSIDE
) {
3325 pt
= this->PointFromPosition(this->GetCurrentPos());
3327 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
3331 void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent
& evt
) {
3332 m_swx
->DoMouseWheel(evt
.GetWheelRotation(),
3333 evt
.GetWheelDelta(),
3334 evt
.GetLinesPerAction(),
3336 evt
.IsPageScroll());
3340 void wxStyledTextCtrl::OnChar(wxKeyEvent
& evt
) {
3341 // On (some?) non-US PC keyboards the AltGr key is required to enter some
3342 // common characters. It comes to us as both Alt and Ctrl down so we need
3343 // to let the char through in that case, otherwise if only ctrl or only
3344 // alt let's skip it.
3345 bool ctrl
= evt
.ControlDown();
3347 // On the Mac the Alt key is just a modifier key (like Shift) so we need
3348 // to allow the char events to be processed when Alt is pressed.
3349 // TODO: Should we check MetaDown instead in this case?
3352 bool alt
= evt
.AltDown();
3354 bool skip
= ((ctrl
|| alt
) && ! (ctrl
&& alt
));
3357 // apparently if we don't do this, Unicode keys pressed after non-char
3358 // ASCII ones (e.g. Enter, Tab) are not taken into account (patch 1615989)
3359 if (m_lastKeyDownConsumed
&& evt
.GetUnicodeKey() > 255)
3360 m_lastKeyDownConsumed
= false;
3363 if (!m_lastKeyDownConsumed
&& !skip
) {
3365 int key
= evt
.GetUnicodeKey();
3368 // if the unicode key code is not really a unicode character (it may
3369 // be a function key or etc., the platforms appear to always give us a
3370 // small value in this case) then fallback to the ascii key code but
3371 // don't do anything for function keys or etc.
3373 key
= evt
.GetKeyCode();
3374 keyOk
= (key
<= 127);
3377 m_swx
->DoAddChar(key
);
3381 int key
= evt
.GetKeyCode();
3382 if (key
<= WXK_START
|| key
> WXK_COMMAND
) {
3383 m_swx
->DoAddChar(key
);
3393 void wxStyledTextCtrl::OnKeyDown(wxKeyEvent
& evt
) {
3394 int processed
= m_swx
->DoKeyDown(evt
, &m_lastKeyDownConsumed
);
3395 if (!processed
&& !m_lastKeyDownConsumed
)
3400 void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent
& evt
) {
3401 m_swx
->DoLoseFocus();
3406 void wxStyledTextCtrl::OnGainFocus(wxFocusEvent
& evt
) {
3407 m_swx
->DoGainFocus();
3412 void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent
& WXUNUSED(evt
)) {
3413 m_swx
->DoSysColourChange();
3417 void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent
& WXUNUSED(evt
)) {
3418 // do nothing to help avoid flashing
3423 void wxStyledTextCtrl::OnMenu(wxCommandEvent
& evt
) {
3424 m_swx
->DoCommand(evt
.GetId());
3428 void wxStyledTextCtrl::OnListBox(wxCommandEvent
& WXUNUSED(evt
)) {
3429 m_swx
->DoOnListBox();
3433 void wxStyledTextCtrl::OnIdle(wxIdleEvent
& evt
) {
3434 m_swx
->DoOnIdle(evt
);
3438 wxSize
wxStyledTextCtrl::DoGetBestSize() const
3440 // What would be the best size for a wxSTC?
3441 // Just give a reasonable minimum until something else can be figured out.
3442 return wxSize(200,100);
3446 //----------------------------------------------------------------------
3447 // Turn notifications from Scintilla into events
3450 void wxStyledTextCtrl::NotifyChange() {
3451 wxStyledTextEvent
evt(wxEVT_STC_CHANGE
, GetId());
3452 evt
.SetEventObject(this);
3453 GetEventHandler()->ProcessEvent(evt
);
3457 static void SetEventText(wxStyledTextEvent
& evt
, const char* text
,
3461 evt
.SetText(stc2wx(text
, length
));
3465 void wxStyledTextCtrl::NotifyParent(SCNotification
* _scn
) {
3466 SCNotification
& scn
= *_scn
;
3467 wxStyledTextEvent
evt(0, GetId());
3469 evt
.SetEventObject(this);
3470 evt
.SetPosition(scn
.position
);
3472 evt
.SetModifiers(scn
.modifiers
);
3474 switch (scn
.nmhdr
.code
) {
3475 case SCN_STYLENEEDED
:
3476 evt
.SetEventType(wxEVT_STC_STYLENEEDED
);
3480 evt
.SetEventType(wxEVT_STC_CHARADDED
);
3483 case SCN_SAVEPOINTREACHED
:
3484 evt
.SetEventType(wxEVT_STC_SAVEPOINTREACHED
);
3487 case SCN_SAVEPOINTLEFT
:
3488 evt
.SetEventType(wxEVT_STC_SAVEPOINTLEFT
);
3491 case SCN_MODIFYATTEMPTRO
:
3492 evt
.SetEventType(wxEVT_STC_ROMODIFYATTEMPT
);
3496 evt
.SetEventType(wxEVT_STC_KEY
);
3499 case SCN_DOUBLECLICK
:
3500 evt
.SetEventType(wxEVT_STC_DOUBLECLICK
);
3504 evt
.SetEventType(wxEVT_STC_UPDATEUI
);
3508 evt
.SetEventType(wxEVT_STC_MODIFIED
);
3509 evt
.SetModificationType(scn
.modificationType
);
3510 SetEventText(evt
, scn
.text
, scn
.length
);
3511 evt
.SetLength(scn
.length
);
3512 evt
.SetLinesAdded(scn
.linesAdded
);
3513 evt
.SetLine(scn
.line
);
3514 evt
.SetFoldLevelNow(scn
.foldLevelNow
);
3515 evt
.SetFoldLevelPrev(scn
.foldLevelPrev
);
3518 case SCN_MACRORECORD
:
3519 evt
.SetEventType(wxEVT_STC_MACRORECORD
);
3520 evt
.SetMessage(scn
.message
);
3521 evt
.SetWParam(scn
.wParam
);
3522 evt
.SetLParam(scn
.lParam
);
3525 case SCN_MARGINCLICK
:
3526 evt
.SetEventType(wxEVT_STC_MARGINCLICK
);
3527 evt
.SetMargin(scn
.margin
);
3531 evt
.SetEventType(wxEVT_STC_NEEDSHOWN
);
3532 evt
.SetLength(scn
.length
);
3536 evt
.SetEventType(wxEVT_STC_PAINTED
);
3539 case SCN_AUTOCSELECTION
:
3540 evt
.SetEventType(wxEVT_STC_AUTOCOMP_SELECTION
);
3541 evt
.SetListType(scn
.listType
);
3542 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
3543 evt
.SetPosition(scn
.lParam
);
3546 case SCN_USERLISTSELECTION
:
3547 evt
.SetEventType(wxEVT_STC_USERLISTSELECTION
);
3548 evt
.SetListType(scn
.listType
);
3549 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
3550 evt
.SetPosition(scn
.lParam
);
3553 case SCN_URIDROPPED
:
3554 evt
.SetEventType(wxEVT_STC_URIDROPPED
);
3555 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
3558 case SCN_DWELLSTART
:
3559 evt
.SetEventType(wxEVT_STC_DWELLSTART
);
3565 evt
.SetEventType(wxEVT_STC_DWELLEND
);
3571 evt
.SetEventType(wxEVT_STC_ZOOM
);
3574 case SCN_HOTSPOTCLICK
:
3575 evt
.SetEventType(wxEVT_STC_HOTSPOT_CLICK
);
3578 case SCN_HOTSPOTDOUBLECLICK
:
3579 evt
.SetEventType(wxEVT_STC_HOTSPOT_DCLICK
);
3582 case SCN_CALLTIPCLICK
:
3583 evt
.SetEventType(wxEVT_STC_CALLTIP_CLICK
);
3586 case SCN_INDICATORCLICK
:
3587 evt
.SetEventType(wxEVT_STC_INDICATOR_CLICK
);
3590 case SCN_INDICATORRELEASE
:
3591 evt
.SetEventType(wxEVT_STC_INDICATOR_RELEASE
);
3598 GetEventHandler()->ProcessEvent(evt
);
3602 //----------------------------------------------------------------------
3603 //----------------------------------------------------------------------
3604 //----------------------------------------------------------------------
3606 wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType
, int id
)
3607 : wxCommandEvent(commandType
, id
)
3612 m_modificationType
= 0;
3617 m_foldLevelPrev
= 0;
3625 m_dragAllowMove
= false;
3626 #if wxUSE_DRAG_AND_DROP
3627 m_dragResult
= wxDragNone
;
3631 bool wxStyledTextEvent::GetShift() const { return (m_modifiers
& SCI_SHIFT
) != 0; }
3632 bool wxStyledTextEvent::GetControl() const { return (m_modifiers
& SCI_CTRL
) != 0; }
3633 bool wxStyledTextEvent::GetAlt() const { return (m_modifiers
& SCI_ALT
) != 0; }
3636 wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent
& event
):
3637 wxCommandEvent(event
)
3639 m_position
= event
.m_position
;
3640 m_key
= event
.m_key
;
3641 m_modifiers
= event
.m_modifiers
;
3642 m_modificationType
= event
.m_modificationType
;
3643 m_text
= event
.m_text
;
3644 m_length
= event
.m_length
;
3645 m_linesAdded
= event
.m_linesAdded
;
3646 m_line
= event
.m_line
;
3647 m_foldLevelNow
= event
.m_foldLevelNow
;
3648 m_foldLevelPrev
= event
.m_foldLevelPrev
;
3650 m_margin
= event
.m_margin
;
3652 m_message
= event
.m_message
;
3653 m_wParam
= event
.m_wParam
;
3654 m_lParam
= event
.m_lParam
;
3656 m_listType
= event
.m_listType
;
3660 m_dragText
= event
.m_dragText
;
3661 m_dragAllowMove
=event
.m_dragAllowMove
;
3662 #if wxUSE_DRAG_AND_DROP
3663 m_dragResult
= event
.m_dragResult
;
3667 //----------------------------------------------------------------------
3668 //----------------------------------------------------------------------