1 ////////////////////////////////////////////////////////////////////////////
3 // Purpose: A wxWidgets implementation of Scintilla. This class is the
4 // one meant to be used directly by wx applications. It does not
5 // derive directly from the Scintilla classes, but instead
6 // delegates most things to the real Scintilla class.
7 // This allows the use of Scintilla without polluting the
8 // namespace with all the classes and identifiers from Scintilla.
12 // Created: 13-Jan-2000
14 // Copyright: (c) 2000 by Total Control Software
15 // Licence: wxWindows license
16 /////////////////////////////////////////////////////////////////////////////
18 // For compilers that support precompilation, includes "wx.h".
19 #include "wx/wxprec.h"
27 #include "wx/stc/stc.h"
28 #include "wx/stc/private.h"
36 #include "wx/tokenzr.h"
37 #include "wx/mstream.h"
41 #include "ScintillaWX.h"
43 //----------------------------------------------------------------------
45 const wxChar
* wxSTCNameStr
= wxT("stcwindow");
51 #define MAKELONG(a, b) ((a) | ((b) << 16))
54 static long wxColourAsLong(const wxColour
& co
) {
55 return (((long)co
.Blue() << 16) |
56 ((long)co
.Green() << 8) |
60 static wxColour
wxColourFromLong(long c
) {
62 clr
.Set((unsigned char)(c
& 0xff),
63 (unsigned char)((c
>> 8) & 0xff),
64 (unsigned char)((c
>> 16) & 0xff));
69 static wxColour
wxColourFromSpec(const wxString
& spec
) {
70 // spec should be a colour name or "#RRGGBB"
71 if (spec
.GetChar(0) == wxT('#')) {
73 long red
, green
, blue
;
74 red
= green
= blue
= 0;
75 spec
.Mid(1,2).ToLong(&red
, 16);
76 spec
.Mid(3,2).ToLong(&green
, 16);
77 spec
.Mid(5,2).ToLong(&blue
, 16);
78 return wxColour((unsigned char)red
,
83 return wxColour(spec
);
86 //----------------------------------------------------------------------
88 DEFINE_EVENT_TYPE( wxEVT_STC_CHANGE
)
89 DEFINE_EVENT_TYPE( wxEVT_STC_STYLENEEDED
)
90 DEFINE_EVENT_TYPE( wxEVT_STC_CHARADDED
)
91 DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTREACHED
)
92 DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTLEFT
)
93 DEFINE_EVENT_TYPE( wxEVT_STC_ROMODIFYATTEMPT
)
94 DEFINE_EVENT_TYPE( wxEVT_STC_KEY
)
95 DEFINE_EVENT_TYPE( wxEVT_STC_DOUBLECLICK
)
96 DEFINE_EVENT_TYPE( wxEVT_STC_UPDATEUI
)
97 DEFINE_EVENT_TYPE( wxEVT_STC_MODIFIED
)
98 DEFINE_EVENT_TYPE( wxEVT_STC_MACRORECORD
)
99 DEFINE_EVENT_TYPE( wxEVT_STC_MARGINCLICK
)
100 DEFINE_EVENT_TYPE( wxEVT_STC_NEEDSHOWN
)
101 DEFINE_EVENT_TYPE( wxEVT_STC_PAINTED
)
102 DEFINE_EVENT_TYPE( wxEVT_STC_USERLISTSELECTION
)
103 DEFINE_EVENT_TYPE( wxEVT_STC_URIDROPPED
)
104 DEFINE_EVENT_TYPE( wxEVT_STC_DWELLSTART
)
105 DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND
)
106 DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG
)
107 DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER
)
108 DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP
)
109 DEFINE_EVENT_TYPE( wxEVT_STC_ZOOM
)
110 DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_CLICK
)
111 DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_DCLICK
)
112 DEFINE_EVENT_TYPE( wxEVT_STC_CALLTIP_CLICK
)
113 DEFINE_EVENT_TYPE( wxEVT_STC_AUTOCOMP_SELECTION
)
114 DEFINE_EVENT_TYPE( wxEVT_STC_INDICATOR_CLICK
)
115 DEFINE_EVENT_TYPE( wxEVT_STC_INDICATOR_RELEASE
)
119 BEGIN_EVENT_TABLE(wxStyledTextCtrl
, wxControl
)
120 EVT_PAINT (wxStyledTextCtrl::OnPaint
)
121 EVT_SCROLLWIN (wxStyledTextCtrl::OnScrollWin
)
122 EVT_SCROLL (wxStyledTextCtrl::OnScroll
)
123 EVT_SIZE (wxStyledTextCtrl::OnSize
)
124 EVT_LEFT_DOWN (wxStyledTextCtrl::OnMouseLeftDown
)
125 // Let Scintilla see the double click as a second click
126 EVT_LEFT_DCLICK (wxStyledTextCtrl::OnMouseLeftDown
)
127 EVT_MOTION (wxStyledTextCtrl::OnMouseMove
)
128 EVT_LEFT_UP (wxStyledTextCtrl::OnMouseLeftUp
)
129 #if defined(__WXGTK__) || defined(__WXMAC__)
130 EVT_RIGHT_UP (wxStyledTextCtrl::OnMouseRightUp
)
132 EVT_CONTEXT_MENU (wxStyledTextCtrl::OnContextMenu
)
134 EVT_MOUSEWHEEL (wxStyledTextCtrl::OnMouseWheel
)
135 EVT_MIDDLE_UP (wxStyledTextCtrl::OnMouseMiddleUp
)
136 EVT_CHAR (wxStyledTextCtrl::OnChar
)
137 EVT_KEY_DOWN (wxStyledTextCtrl::OnKeyDown
)
138 EVT_KILL_FOCUS (wxStyledTextCtrl::OnLoseFocus
)
139 EVT_SET_FOCUS (wxStyledTextCtrl::OnGainFocus
)
140 EVT_SYS_COLOUR_CHANGED (wxStyledTextCtrl::OnSysColourChanged
)
141 EVT_ERASE_BACKGROUND (wxStyledTextCtrl::OnEraseBackground
)
142 EVT_MENU_RANGE (10, 16, wxStyledTextCtrl::OnMenu
)
143 EVT_LISTBOX_DCLICK (wxID_ANY
, wxStyledTextCtrl::OnListBox
)
147 IMPLEMENT_CLASS(wxStyledTextCtrl
, wxControl
)
148 IMPLEMENT_DYNAMIC_CLASS(wxStyledTextEvent
, wxCommandEvent
)
151 // forces the linking of the lexer modules
152 int Scintilla_LinkLexers();
155 //----------------------------------------------------------------------
156 // Constructor and Destructor
158 wxStyledTextCtrl::wxStyledTextCtrl(wxWindow
*parent
,
163 const wxString
& name
)
166 Create(parent
, id
, pos
, size
, style
, name
);
170 bool wxStyledTextCtrl::Create(wxWindow
*parent
,
175 const wxString
& name
)
177 style
|= wxVSCROLL
| wxHSCROLL
;
178 if (!wxControl::Create(parent
, id
, pos
, size
,
179 style
| wxWANTS_CHARS
| wxCLIP_CHILDREN
,
180 wxDefaultValidator
, name
))
184 Scintilla_LinkLexers();
186 m_swx
= new ScintillaWX(this);
188 m_lastKeyDownConsumed
= false;
192 // Put Scintilla into unicode (UTF-8) mode
193 SetCodePage(wxSTC_CP_UTF8
);
196 SetInitialSize(size
);
198 // Reduces flicker on GTK+/X11
199 SetBackgroundStyle(wxBG_STYLE_CUSTOM
);
201 // Make sure it can take the focus
208 wxStyledTextCtrl::~wxStyledTextCtrl() {
213 //----------------------------------------------------------------------
215 long wxStyledTextCtrl::SendMsg(int msg
, long wp
, long lp
) const
217 return m_swx
->WndProc(msg
, wp
, lp
);
220 //----------------------------------------------------------------------
222 // Set the vertical scrollbar to use instead of the ont that's built-in.
223 void wxStyledTextCtrl::SetVScrollBar(wxScrollBar
* bar
) {
226 // ensure that the built-in scrollbar is not visible
227 SetScrollbar(wxVERTICAL
, 0, 0, 0);
232 // Set the horizontal scrollbar to use instead of the ont that's built-in.
233 void wxStyledTextCtrl::SetHScrollBar(wxScrollBar
* bar
) {
236 // ensure that the built-in scrollbar is not visible
237 SetScrollbar(wxHORIZONTAL
, 0, 0, 0);
241 //----------------------------------------------------------------------
242 // BEGIN generated section. The following code is automatically generated
243 // by gen_iface.py from the contents of Scintilla.iface. Do not edit
244 // this file. Edit stc.cpp.in or gen_iface.py instead and regenerate.
247 // Add text to the document at current position.
248 void wxStyledTextCtrl::AddText(const wxString
& text
) {
249 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
250 SendMsg(2001, strlen(buf
), (long)(const char*)buf
);
253 // Add array of cells to document.
254 void wxStyledTextCtrl::AddStyledText(const wxMemoryBuffer
& data
) {
255 SendMsg(2002, data
.GetDataLen(), (long)data
.GetData());
258 // Insert string at a position.
259 void wxStyledTextCtrl::InsertText(int pos
, const wxString
& text
)
261 SendMsg(2003, pos
, (long)(const char*)wx2stc(text
));
264 // Delete all text in the document.
265 void wxStyledTextCtrl::ClearAll()
270 // Set all style bytes to 0, remove all folding information.
271 void wxStyledTextCtrl::ClearDocumentStyle()
276 // Returns the number of characters in the document.
277 int wxStyledTextCtrl::GetLength() const
279 return SendMsg(2006, 0, 0);
282 // Returns the character byte at the position.
283 int wxStyledTextCtrl::GetCharAt(int pos
) const {
284 return (unsigned char)SendMsg(2007, pos
, 0);
287 // Returns the position of the caret.
288 int wxStyledTextCtrl::GetCurrentPos() const
290 return SendMsg(2008, 0, 0);
293 // Returns the position of the opposite end of the selection to the caret.
294 int wxStyledTextCtrl::GetAnchor() const
296 return SendMsg(2009, 0, 0);
299 // Returns the style byte at the position.
300 int wxStyledTextCtrl::GetStyleAt(int pos
) const {
301 return (unsigned char)SendMsg(2010, pos
, 0);
304 // Redoes the next action on the undo history.
305 void wxStyledTextCtrl::Redo()
310 // Choose between collecting actions into the undo
311 // history and discarding them.
312 void wxStyledTextCtrl::SetUndoCollection(bool collectUndo
)
314 SendMsg(2012, collectUndo
, 0);
317 // Select all the text in the document.
318 void wxStyledTextCtrl::SelectAll()
323 // Remember the current position in the undo history as the position
324 // at which the document was saved.
325 void wxStyledTextCtrl::SetSavePoint()
330 // Retrieve a buffer of cells.
331 wxMemoryBuffer
wxStyledTextCtrl::GetStyledText(int startPos
, int endPos
) {
333 if (endPos
< startPos
) {
338 int len
= endPos
- startPos
;
339 if (!len
) return buf
;
341 tr
.lpstrText
= (char*)buf
.GetWriteBuf(len
*2+1);
342 tr
.chrg
.cpMin
= startPos
;
343 tr
.chrg
.cpMax
= endPos
;
344 len
= SendMsg(2015, 0, (long)&tr
);
345 buf
.UngetWriteBuf(len
);
349 // Are there any redoable actions in the undo history?
350 bool wxStyledTextCtrl::CanRedo()
352 return SendMsg(2016, 0, 0) != 0;
355 // Retrieve the line number at which a particular marker is located.
356 int wxStyledTextCtrl::MarkerLineFromHandle(int handle
)
358 return SendMsg(2017, handle
, 0);
362 void wxStyledTextCtrl::MarkerDeleteHandle(int handle
)
364 SendMsg(2018, handle
, 0);
367 // Is undo history being collected?
368 bool wxStyledTextCtrl::GetUndoCollection() const
370 return SendMsg(2019, 0, 0) != 0;
373 // Are white space characters currently visible?
374 // Returns one of SCWS_* constants.
375 int wxStyledTextCtrl::GetViewWhiteSpace() const
377 return SendMsg(2020, 0, 0);
380 // Make white space characters invisible, always visible or visible outside indentation.
381 void wxStyledTextCtrl::SetViewWhiteSpace(int viewWS
)
383 SendMsg(2021, viewWS
, 0);
386 // Find the position from a point within the window.
387 int wxStyledTextCtrl::PositionFromPoint(wxPoint pt
) {
388 return SendMsg(2022, pt
.x
, pt
.y
);
391 // Find the position from a point within the window but return
392 // INVALID_POSITION if not close to text.
393 int wxStyledTextCtrl::PositionFromPointClose(int x
, int y
)
395 return SendMsg(2023, x
, y
);
398 // Set caret to start of a line and ensure it is visible.
399 void wxStyledTextCtrl::GotoLine(int line
)
401 SendMsg(2024, line
, 0);
404 // Set caret to a position and ensure it is visible.
405 void wxStyledTextCtrl::GotoPos(int pos
)
407 SendMsg(2025, pos
, 0);
410 // Set the selection anchor to a position. The anchor is the opposite
411 // end of the selection from the caret.
412 void wxStyledTextCtrl::SetAnchor(int posAnchor
)
414 SendMsg(2026, posAnchor
, 0);
417 // Retrieve the text of the line containing the caret.
418 // Returns the index of the caret on the line.
419 wxString
wxStyledTextCtrl::GetCurLine(int* linePos
) {
420 int len
= LineLength(GetCurrentLine());
422 if (linePos
) *linePos
= 0;
423 return wxEmptyString
;
426 wxMemoryBuffer
mbuf(len
+1);
427 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
429 int pos
= SendMsg(2027, len
+1, (long)buf
);
430 mbuf
.UngetWriteBuf(len
);
432 if (linePos
) *linePos
= pos
;
436 // Retrieve the position of the last correctly styled character.
437 int wxStyledTextCtrl::GetEndStyled() const
439 return SendMsg(2028, 0, 0);
442 // Convert all line endings in the document to one mode.
443 void wxStyledTextCtrl::ConvertEOLs(int eolMode
)
445 SendMsg(2029, eolMode
, 0);
448 // Retrieve the current end of line mode - one of CRLF, CR, or LF.
449 int wxStyledTextCtrl::GetEOLMode() const
451 return SendMsg(2030, 0, 0);
454 // Set the current end of line mode.
455 void wxStyledTextCtrl::SetEOLMode(int eolMode
)
457 SendMsg(2031, eolMode
, 0);
460 // Set the current styling position to pos and the styling mask to mask.
461 // The styling mask can be used to protect some bits in each styling byte from modification.
462 void wxStyledTextCtrl::StartStyling(int pos
, int mask
)
464 SendMsg(2032, pos
, mask
);
467 // Change style from current styling position for length characters to a style
468 // and move the current styling position to after this newly styled segment.
469 void wxStyledTextCtrl::SetStyling(int length
, int style
)
471 SendMsg(2033, length
, style
);
474 // Is drawing done first into a buffer or direct to the screen?
475 bool wxStyledTextCtrl::GetBufferedDraw() const
477 return SendMsg(2034, 0, 0) != 0;
480 // If drawing is buffered then each line of text is drawn into a bitmap buffer
481 // before drawing it to the screen to avoid flicker.
482 void wxStyledTextCtrl::SetBufferedDraw(bool buffered
)
484 SendMsg(2035, buffered
, 0);
487 // Change the visible size of a tab to be a multiple of the width of a space character.
488 void wxStyledTextCtrl::SetTabWidth(int tabWidth
)
490 SendMsg(2036, tabWidth
, 0);
493 // Retrieve the visible size of a tab.
494 int wxStyledTextCtrl::GetTabWidth() const
496 return SendMsg(2121, 0, 0);
499 // Set the code page used to interpret the bytes of the document as characters.
500 void wxStyledTextCtrl::SetCodePage(int codePage
) {
502 wxASSERT_MSG(codePage
== wxSTC_CP_UTF8
,
503 wxT("Only wxSTC_CP_UTF8 may be used when wxUSE_UNICODE is on."));
505 wxASSERT_MSG(codePage
!= wxSTC_CP_UTF8
,
506 wxT("wxSTC_CP_UTF8 may not be used when wxUSE_UNICODE is off."));
508 SendMsg(2037, codePage
);
511 // Set the symbol used for a particular marker number,
512 // and optionally the fore and background colours.
513 void wxStyledTextCtrl::MarkerDefine(int markerNumber
, int markerSymbol
,
514 const wxColour
& foreground
,
515 const wxColour
& background
) {
517 SendMsg(2040, markerNumber
, markerSymbol
);
519 MarkerSetForeground(markerNumber
, foreground
);
521 MarkerSetBackground(markerNumber
, background
);
524 // Set the foreground colour used for a particular marker number.
525 void wxStyledTextCtrl::MarkerSetForeground(int markerNumber
, const wxColour
& fore
)
527 SendMsg(2041, markerNumber
, wxColourAsLong(fore
));
530 // Set the background colour used for a particular marker number.
531 void wxStyledTextCtrl::MarkerSetBackground(int markerNumber
, const wxColour
& back
)
533 SendMsg(2042, markerNumber
, wxColourAsLong(back
));
536 // Add a marker to a line, returning an ID which can be used to find or delete the marker.
537 int wxStyledTextCtrl::MarkerAdd(int line
, int markerNumber
)
539 return SendMsg(2043, line
, markerNumber
);
542 // Delete a marker from a line.
543 void wxStyledTextCtrl::MarkerDelete(int line
, int markerNumber
)
545 SendMsg(2044, line
, markerNumber
);
548 // Delete all markers with a particular number from all lines.
549 void wxStyledTextCtrl::MarkerDeleteAll(int markerNumber
)
551 SendMsg(2045, markerNumber
, 0);
554 // Get a bit mask of all the markers set on a line.
555 int wxStyledTextCtrl::MarkerGet(int line
)
557 return SendMsg(2046, line
, 0);
560 // Find the next line after lineStart that includes a marker in mask.
561 int wxStyledTextCtrl::MarkerNext(int lineStart
, int markerMask
)
563 return SendMsg(2047, lineStart
, markerMask
);
566 // Find the previous line before lineStart that includes a marker in mask.
567 int wxStyledTextCtrl::MarkerPrevious(int lineStart
, int markerMask
)
569 return SendMsg(2048, lineStart
, markerMask
);
572 // Define a marker from a bitmap
573 void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber
, const wxBitmap
& bmp
) {
574 // convert bmp to a xpm in a string
575 wxMemoryOutputStream strm
;
576 wxImage img
= bmp
.ConvertToImage();
578 img
.ConvertAlphaToMask();
579 img
.SaveFile(strm
, wxBITMAP_TYPE_XPM
);
580 size_t len
= strm
.GetSize();
581 char* buff
= new char[len
+1];
582 strm
.CopyTo(buff
, len
);
584 SendMsg(2049, markerNumber
, (long)buff
);
589 // Add a set of markers to a line.
590 void wxStyledTextCtrl::MarkerAddSet(int line
, int set
)
592 SendMsg(2466, line
, set
);
595 // Set the alpha used for a marker that is drawn in the text area, not the margin.
596 void wxStyledTextCtrl::MarkerSetAlpha(int markerNumber
, int alpha
)
598 SendMsg(2476, markerNumber
, alpha
);
601 // Set a margin to be either numeric or symbolic.
602 void wxStyledTextCtrl::SetMarginType(int margin
, int marginType
)
604 SendMsg(2240, margin
, marginType
);
607 // Retrieve the type of a margin.
608 int wxStyledTextCtrl::GetMarginType(int margin
) const
610 return SendMsg(2241, margin
, 0);
613 // Set the width of a margin to a width expressed in pixels.
614 void wxStyledTextCtrl::SetMarginWidth(int margin
, int pixelWidth
)
616 SendMsg(2242, margin
, pixelWidth
);
619 // Retrieve the width of a margin in pixels.
620 int wxStyledTextCtrl::GetMarginWidth(int margin
) const
622 return SendMsg(2243, margin
, 0);
625 // Set a mask that determines which markers are displayed in a margin.
626 void wxStyledTextCtrl::SetMarginMask(int margin
, int mask
)
628 SendMsg(2244, margin
, mask
);
631 // Retrieve the marker mask of a margin.
632 int wxStyledTextCtrl::GetMarginMask(int margin
) const
634 return SendMsg(2245, margin
, 0);
637 // Make a margin sensitive or insensitive to mouse clicks.
638 void wxStyledTextCtrl::SetMarginSensitive(int margin
, bool sensitive
)
640 SendMsg(2246, margin
, sensitive
);
643 // Retrieve the mouse click sensitivity of a margin.
644 bool wxStyledTextCtrl::GetMarginSensitive(int margin
) const
646 return SendMsg(2247, margin
, 0) != 0;
649 // Clear all the styles and make equivalent to the global default style.
650 void wxStyledTextCtrl::StyleClearAll()
655 // Set the foreground colour of a style.
656 void wxStyledTextCtrl::StyleSetForeground(int style
, const wxColour
& fore
)
658 SendMsg(2051, style
, wxColourAsLong(fore
));
661 // Set the background colour of a style.
662 void wxStyledTextCtrl::StyleSetBackground(int style
, const wxColour
& back
)
664 SendMsg(2052, style
, wxColourAsLong(back
));
667 // Set a style to be bold or not.
668 void wxStyledTextCtrl::StyleSetBold(int style
, bool bold
)
670 SendMsg(2053, style
, bold
);
673 // Set a style to be italic or not.
674 void wxStyledTextCtrl::StyleSetItalic(int style
, bool italic
)
676 SendMsg(2054, style
, italic
);
679 // Set the size of characters of a style.
680 void wxStyledTextCtrl::StyleSetSize(int style
, int sizePoints
)
682 SendMsg(2055, style
, sizePoints
);
685 // Set the font of a style.
686 void wxStyledTextCtrl::StyleSetFaceName(int style
, const wxString
& fontName
)
688 SendMsg(2056, style
, (long)(const char*)wx2stc(fontName
));
691 // Set a style to have its end of line filled or not.
692 void wxStyledTextCtrl::StyleSetEOLFilled(int style
, bool filled
)
694 SendMsg(2057, style
, filled
);
697 // Reset the default style to its state at startup
698 void wxStyledTextCtrl::StyleResetDefault()
703 // Set a style to be underlined or not.
704 void wxStyledTextCtrl::StyleSetUnderline(int style
, bool underline
)
706 SendMsg(2059, style
, underline
);
709 // Get the foreground colour of a style.
710 wxColour
wxStyledTextCtrl::StyleGetForeground(int style
) const
712 long c
= SendMsg(2481, style
, 0);
713 return wxColourFromLong(c
);
716 // Get the background colour of a style.
717 wxColour
wxStyledTextCtrl::StyleGetBackground(int style
) const
719 long c
= SendMsg(2482, style
, 0);
720 return wxColourFromLong(c
);
723 // Get is a style bold or not.
724 bool wxStyledTextCtrl::StyleGetBold(int style
) const
726 return SendMsg(2483, style
, 0) != 0;
729 // Get is a style italic or not.
730 bool wxStyledTextCtrl::StyleGetItalic(int style
) const
732 return SendMsg(2484, style
, 0) != 0;
735 // Get the size of characters of a style.
736 int wxStyledTextCtrl::StyleGetSize(int style
) const
738 return SendMsg(2485, style
, 0);
741 // Get the font facename of a style
742 wxString
wxStyledTextCtrl::StyleGetFaceName(int style
) {
744 long len
= SendMsg(msg
, style
, 0);
745 wxMemoryBuffer
mbuf(len
+1);
746 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
747 SendMsg(msg
, style
, (long)buf
);
748 mbuf
.UngetWriteBuf(len
);
753 // Get is a style to have its end of line filled or not.
754 bool wxStyledTextCtrl::StyleGetEOLFilled(int style
) const
756 return SendMsg(2487, style
, 0) != 0;
759 // Get is a style underlined or not.
760 bool wxStyledTextCtrl::StyleGetUnderline(int style
) const
762 return SendMsg(2488, style
, 0) != 0;
765 // Get is a style mixed case, or to force upper or lower case.
766 int wxStyledTextCtrl::StyleGetCase(int style
) const
768 return SendMsg(2489, style
, 0);
771 // Get the character set of the font in a style.
772 int wxStyledTextCtrl::StyleGetCharacterSet(int style
) const
774 return SendMsg(2490, style
, 0);
777 // Get is a style visible or not.
778 bool wxStyledTextCtrl::StyleGetVisible(int style
) const
780 return SendMsg(2491, style
, 0) != 0;
783 // Get is a style changeable or not (read only).
784 // Experimental feature, currently buggy.
785 bool wxStyledTextCtrl::StyleGetChangeable(int style
) const
787 return SendMsg(2492, style
, 0) != 0;
790 // Get is a style a hotspot or not.
791 bool wxStyledTextCtrl::StyleGetHotSpot(int style
) const
793 return SendMsg(2493, style
, 0) != 0;
796 // Set a style to be mixed case, or to force upper or lower case.
797 void wxStyledTextCtrl::StyleSetCase(int style
, int caseForce
)
799 SendMsg(2060, style
, caseForce
);
802 // Set a style to be a hotspot or not.
803 void wxStyledTextCtrl::StyleSetHotSpot(int style
, bool hotspot
)
805 SendMsg(2409, style
, hotspot
);
808 // Set the foreground colour of the selection and whether to use this setting.
809 void wxStyledTextCtrl::SetSelForeground(bool useSetting
, const wxColour
& fore
)
811 SendMsg(2067, useSetting
, wxColourAsLong(fore
));
814 // Set the background colour of the selection and whether to use this setting.
815 void wxStyledTextCtrl::SetSelBackground(bool useSetting
, const wxColour
& back
)
817 SendMsg(2068, useSetting
, wxColourAsLong(back
));
820 // Get the alpha of the selection.
821 int wxStyledTextCtrl::GetSelAlpha() const
823 return SendMsg(2477, 0, 0);
826 // Set the alpha of the selection.
827 void wxStyledTextCtrl::SetSelAlpha(int alpha
)
829 SendMsg(2478, alpha
, 0);
832 // Is the selection end of line filled?
833 bool wxStyledTextCtrl::GetSelEOLFilled() const
835 return SendMsg(2479, 0, 0) != 0;
838 // Set the selection to have its end of line filled or not.
839 void wxStyledTextCtrl::SetSelEOLFilled(bool filled
)
841 SendMsg(2480, filled
, 0);
844 // Set the foreground colour of the caret.
845 void wxStyledTextCtrl::SetCaretForeground(const wxColour
& fore
)
847 SendMsg(2069, wxColourAsLong(fore
), 0);
850 // When key+modifier combination km is pressed perform msg.
851 void wxStyledTextCtrl::CmdKeyAssign(int key
, int modifiers
, int cmd
) {
852 SendMsg(2070, MAKELONG(key
, modifiers
), cmd
);
855 // When key+modifier combination km is pressed do nothing.
856 void wxStyledTextCtrl::CmdKeyClear(int key
, int modifiers
) {
857 SendMsg(2071, MAKELONG(key
, modifiers
));
860 // Drop all key mappings.
861 void wxStyledTextCtrl::CmdKeyClearAll()
866 // Set the styles for a segment of the document.
867 void wxStyledTextCtrl::SetStyleBytes(int length
, char* styleBytes
) {
868 SendMsg(2073, length
, (long)styleBytes
);
871 // Set a style to be visible or not.
872 void wxStyledTextCtrl::StyleSetVisible(int style
, bool visible
)
874 SendMsg(2074, style
, visible
);
877 // Get the time in milliseconds that the caret is on and off.
878 int wxStyledTextCtrl::GetCaretPeriod() const
880 return SendMsg(2075, 0, 0);
883 // Get the time in milliseconds that the caret is on and off. 0 = steady on.
884 void wxStyledTextCtrl::SetCaretPeriod(int periodMilliseconds
)
886 SendMsg(2076, periodMilliseconds
, 0);
889 // Set the set of characters making up words for when moving or selecting by word.
890 // First sets deaults like SetCharsDefault.
891 void wxStyledTextCtrl::SetWordChars(const wxString
& characters
)
893 SendMsg(2077, 0, (long)(const char*)wx2stc(characters
));
896 // Start a sequence of actions that is undone and redone as a unit.
898 void wxStyledTextCtrl::BeginUndoAction()
903 // End a sequence of actions that is undone and redone as a unit.
904 void wxStyledTextCtrl::EndUndoAction()
909 // Set an indicator to plain, squiggle or TT.
910 void wxStyledTextCtrl::IndicatorSetStyle(int indic
, int style
)
912 SendMsg(2080, indic
, style
);
915 // Retrieve the style of an indicator.
916 int wxStyledTextCtrl::IndicatorGetStyle(int indic
) const
918 return SendMsg(2081, indic
, 0);
921 // Set the foreground colour of an indicator.
922 void wxStyledTextCtrl::IndicatorSetForeground(int indic
, const wxColour
& fore
)
924 SendMsg(2082, indic
, wxColourAsLong(fore
));
927 // Retrieve the foreground colour of an indicator.
928 wxColour
wxStyledTextCtrl::IndicatorGetForeground(int indic
) const
930 long c
= SendMsg(2083, indic
, 0);
931 return wxColourFromLong(c
);
934 // Set an indicator to draw under text or over(default).
935 void wxStyledTextCtrl::IndicatorSetUnder(int indic
, bool under
)
937 SendMsg(2510, indic
, under
);
940 // Retrieve whether indicator drawn under or over text.
941 bool wxStyledTextCtrl::IndicatorGetUnder(int indic
) const
943 return SendMsg(2511, indic
, 0) != 0;
946 // Set the foreground colour of all whitespace and whether to use this setting.
947 void wxStyledTextCtrl::SetWhitespaceForeground(bool useSetting
, const wxColour
& fore
)
949 SendMsg(2084, useSetting
, wxColourAsLong(fore
));
952 // Set the background colour of all whitespace and whether to use this setting.
953 void wxStyledTextCtrl::SetWhitespaceBackground(bool useSetting
, const wxColour
& back
)
955 SendMsg(2085, useSetting
, wxColourAsLong(back
));
958 // Divide each styling byte into lexical class bits (default: 5) and indicator
959 // bits (default: 3). If a lexer requires more than 32 lexical states, then this
960 // is used to expand the possible states.
961 void wxStyledTextCtrl::SetStyleBits(int bits
)
963 SendMsg(2090, bits
, 0);
966 // Retrieve number of bits in style bytes used to hold the lexical state.
967 int wxStyledTextCtrl::GetStyleBits() const
969 return SendMsg(2091, 0, 0);
972 // Used to hold extra styling information for each line.
973 void wxStyledTextCtrl::SetLineState(int line
, int state
)
975 SendMsg(2092, line
, state
);
978 // Retrieve the extra styling information for a line.
979 int wxStyledTextCtrl::GetLineState(int line
) const
981 return SendMsg(2093, line
, 0);
984 // Retrieve the last line number that has line state.
985 int wxStyledTextCtrl::GetMaxLineState() const
987 return SendMsg(2094, 0, 0);
990 // Is the background of the line containing the caret in a different colour?
991 bool wxStyledTextCtrl::GetCaretLineVisible() const
993 return SendMsg(2095, 0, 0) != 0;
996 // Display the background of the line containing the caret in a different colour.
997 void wxStyledTextCtrl::SetCaretLineVisible(bool show
)
999 SendMsg(2096, show
, 0);
1002 // Get the colour of the background of the line containing the caret.
1003 wxColour
wxStyledTextCtrl::GetCaretLineBackground() const
1005 long c
= SendMsg(2097, 0, 0);
1006 return wxColourFromLong(c
);
1009 // Set the colour of the background of the line containing the caret.
1010 void wxStyledTextCtrl::SetCaretLineBackground(const wxColour
& back
)
1012 SendMsg(2098, wxColourAsLong(back
), 0);
1015 // Set a style to be changeable or not (read only).
1016 // Experimental feature, currently buggy.
1017 void wxStyledTextCtrl::StyleSetChangeable(int style
, bool changeable
)
1019 SendMsg(2099, style
, changeable
);
1022 // Display a auto-completion list.
1023 // The lenEntered parameter indicates how many characters before
1024 // the caret should be used to provide context.
1025 void wxStyledTextCtrl::AutoCompShow(int lenEntered
, const wxString
& itemList
)
1027 SendMsg(2100, lenEntered
, (long)(const char*)wx2stc(itemList
));
1030 // Remove the auto-completion list from the screen.
1031 void wxStyledTextCtrl::AutoCompCancel()
1033 SendMsg(2101, 0, 0);
1036 // Is there an auto-completion list visible?
1037 bool wxStyledTextCtrl::AutoCompActive()
1039 return SendMsg(2102, 0, 0) != 0;
1042 // Retrieve the position of the caret when the auto-completion list was displayed.
1043 int wxStyledTextCtrl::AutoCompPosStart()
1045 return SendMsg(2103, 0, 0);
1048 // User has selected an item so remove the list and insert the selection.
1049 void wxStyledTextCtrl::AutoCompComplete()
1051 SendMsg(2104, 0, 0);
1054 // Define a set of character that when typed cancel the auto-completion list.
1055 void wxStyledTextCtrl::AutoCompStops(const wxString
& characterSet
)
1057 SendMsg(2105, 0, (long)(const char*)wx2stc(characterSet
));
1060 // Change the separator character in the string setting up an auto-completion list.
1061 // Default is space but can be changed if items contain space.
1062 void wxStyledTextCtrl::AutoCompSetSeparator(int separatorCharacter
)
1064 SendMsg(2106, separatorCharacter
, 0);
1067 // Retrieve the auto-completion list separator character.
1068 int wxStyledTextCtrl::AutoCompGetSeparator() const
1070 return SendMsg(2107, 0, 0);
1073 // Select the item in the auto-completion list that starts with a string.
1074 void wxStyledTextCtrl::AutoCompSelect(const wxString
& text
)
1076 SendMsg(2108, 0, (long)(const char*)wx2stc(text
));
1079 // Should the auto-completion list be cancelled if the user backspaces to a
1080 // position before where the box was created.
1081 void wxStyledTextCtrl::AutoCompSetCancelAtStart(bool cancel
)
1083 SendMsg(2110, cancel
, 0);
1086 // Retrieve whether auto-completion cancelled by backspacing before start.
1087 bool wxStyledTextCtrl::AutoCompGetCancelAtStart() const
1089 return SendMsg(2111, 0, 0) != 0;
1092 // Define a set of characters that when typed will cause the autocompletion to
1093 // choose the selected item.
1094 void wxStyledTextCtrl::AutoCompSetFillUps(const wxString
& characterSet
)
1096 SendMsg(2112, 0, (long)(const char*)wx2stc(characterSet
));
1099 // Should a single item auto-completion list automatically choose the item.
1100 void wxStyledTextCtrl::AutoCompSetChooseSingle(bool chooseSingle
)
1102 SendMsg(2113, chooseSingle
, 0);
1105 // Retrieve whether a single item auto-completion list automatically choose the item.
1106 bool wxStyledTextCtrl::AutoCompGetChooseSingle() const
1108 return SendMsg(2114, 0, 0) != 0;
1111 // Set whether case is significant when performing auto-completion searches.
1112 void wxStyledTextCtrl::AutoCompSetIgnoreCase(bool ignoreCase
)
1114 SendMsg(2115, ignoreCase
, 0);
1117 // Retrieve state of ignore case flag.
1118 bool wxStyledTextCtrl::AutoCompGetIgnoreCase() const
1120 return SendMsg(2116, 0, 0) != 0;
1123 // Display a list of strings and send notification when user chooses one.
1124 void wxStyledTextCtrl::UserListShow(int listType
, const wxString
& itemList
)
1126 SendMsg(2117, listType
, (long)(const char*)wx2stc(itemList
));
1129 // Set whether or not autocompletion is hidden automatically when nothing matches.
1130 void wxStyledTextCtrl::AutoCompSetAutoHide(bool autoHide
)
1132 SendMsg(2118, autoHide
, 0);
1135 // Retrieve whether or not autocompletion is hidden automatically when nothing matches.
1136 bool wxStyledTextCtrl::AutoCompGetAutoHide() const
1138 return SendMsg(2119, 0, 0) != 0;
1141 // Set whether or not autocompletion deletes any word characters
1142 // after the inserted text upon completion.
1143 void wxStyledTextCtrl::AutoCompSetDropRestOfWord(bool dropRestOfWord
)
1145 SendMsg(2270, dropRestOfWord
, 0);
1148 // Retrieve whether or not autocompletion deletes any word characters
1149 // after the inserted text upon completion.
1150 bool wxStyledTextCtrl::AutoCompGetDropRestOfWord() const
1152 return SendMsg(2271, 0, 0) != 0;
1155 // Register an image for use in autocompletion lists.
1156 void wxStyledTextCtrl::RegisterImage(int type
, const wxBitmap
& bmp
) {
1157 // convert bmp to a xpm in a string
1158 wxMemoryOutputStream strm
;
1159 wxImage img
= bmp
.ConvertToImage();
1161 img
.ConvertAlphaToMask();
1162 img
.SaveFile(strm
, wxBITMAP_TYPE_XPM
);
1163 size_t len
= strm
.GetSize();
1164 char* buff
= new char[len
+1];
1165 strm
.CopyTo(buff
, len
);
1167 SendMsg(2405, type
, (long)buff
);
1172 // Clear all the registered images.
1173 void wxStyledTextCtrl::ClearRegisteredImages()
1175 SendMsg(2408, 0, 0);
1178 // Retrieve the auto-completion list type-separator character.
1179 int wxStyledTextCtrl::AutoCompGetTypeSeparator() const
1181 return SendMsg(2285, 0, 0);
1184 // Change the type-separator character in the string setting up an auto-completion list.
1185 // Default is '?' but can be changed if items contain '?'.
1186 void wxStyledTextCtrl::AutoCompSetTypeSeparator(int separatorCharacter
)
1188 SendMsg(2286, separatorCharacter
, 0);
1191 // Set the maximum width, in characters, of auto-completion and user lists.
1192 // Set to 0 to autosize to fit longest item, which is the default.
1193 void wxStyledTextCtrl::AutoCompSetMaxWidth(int characterCount
)
1195 SendMsg(2208, characterCount
, 0);
1198 // Get the maximum width, in characters, of auto-completion and user lists.
1199 int wxStyledTextCtrl::AutoCompGetMaxWidth() const
1201 return SendMsg(2209, 0, 0);
1204 // Set the maximum height, in rows, of auto-completion and user lists.
1205 // The default is 5 rows.
1206 void wxStyledTextCtrl::AutoCompSetMaxHeight(int rowCount
)
1208 SendMsg(2210, rowCount
, 0);
1211 // Set the maximum height, in rows, of auto-completion and user lists.
1212 int wxStyledTextCtrl::AutoCompGetMaxHeight() const
1214 return SendMsg(2211, 0, 0);
1217 // Set the number of spaces used for one level of indentation.
1218 void wxStyledTextCtrl::SetIndent(int indentSize
)
1220 SendMsg(2122, indentSize
, 0);
1223 // Retrieve indentation size.
1224 int wxStyledTextCtrl::GetIndent() const
1226 return SendMsg(2123, 0, 0);
1229 // Indentation will only use space characters if useTabs is false, otherwise
1230 // it will use a combination of tabs and spaces.
1231 void wxStyledTextCtrl::SetUseTabs(bool useTabs
)
1233 SendMsg(2124, useTabs
, 0);
1236 // Retrieve whether tabs will be used in indentation.
1237 bool wxStyledTextCtrl::GetUseTabs() const
1239 return SendMsg(2125, 0, 0) != 0;
1242 // Change the indentation of a line to a number of columns.
1243 void wxStyledTextCtrl::SetLineIndentation(int line
, int indentSize
)
1245 SendMsg(2126, line
, indentSize
);
1248 // Retrieve the number of columns that a line is indented.
1249 int wxStyledTextCtrl::GetLineIndentation(int line
) const
1251 return SendMsg(2127, line
, 0);
1254 // Retrieve the position before the first non indentation character on a line.
1255 int wxStyledTextCtrl::GetLineIndentPosition(int line
) const
1257 return SendMsg(2128, line
, 0);
1260 // Retrieve the column number of a position, taking tab width into account.
1261 int wxStyledTextCtrl::GetColumn(int pos
) const
1263 return SendMsg(2129, pos
, 0);
1266 // Show or hide the horizontal scroll bar.
1267 void wxStyledTextCtrl::SetUseHorizontalScrollBar(bool show
)
1269 SendMsg(2130, show
, 0);
1272 // Is the horizontal scroll bar visible?
1273 bool wxStyledTextCtrl::GetUseHorizontalScrollBar() const
1275 return SendMsg(2131, 0, 0) != 0;
1278 // Show or hide indentation guides.
1279 void wxStyledTextCtrl::SetIndentationGuides(int indentView
)
1281 SendMsg(2132, indentView
, 0);
1284 // Are the indentation guides visible?
1285 int wxStyledTextCtrl::GetIndentationGuides() const
1287 return SendMsg(2133, 0, 0);
1290 // Set the highlighted indentation guide column.
1291 // 0 = no highlighted guide.
1292 void wxStyledTextCtrl::SetHighlightGuide(int column
)
1294 SendMsg(2134, column
, 0);
1297 // Get the highlighted indentation guide column.
1298 int wxStyledTextCtrl::GetHighlightGuide() const
1300 return SendMsg(2135, 0, 0);
1303 // Get the position after the last visible characters on a line.
1304 int wxStyledTextCtrl::GetLineEndPosition(int line
) const
1306 return SendMsg(2136, line
, 0);
1309 // Get the code page used to interpret the bytes of the document as characters.
1310 int wxStyledTextCtrl::GetCodePage() const
1312 return SendMsg(2137, 0, 0);
1315 // Get the foreground colour of the caret.
1316 wxColour
wxStyledTextCtrl::GetCaretForeground() const
1318 long c
= SendMsg(2138, 0, 0);
1319 return wxColourFromLong(c
);
1322 // In read-only mode?
1323 bool wxStyledTextCtrl::GetReadOnly() const
1325 return SendMsg(2140, 0, 0) != 0;
1328 // Sets the position of the caret.
1329 void wxStyledTextCtrl::SetCurrentPos(int pos
)
1331 SendMsg(2141, pos
, 0);
1334 // Sets the position that starts the selection - this becomes the anchor.
1335 void wxStyledTextCtrl::SetSelectionStart(int pos
)
1337 SendMsg(2142, pos
, 0);
1340 // Returns the position at the start of the selection.
1341 int wxStyledTextCtrl::GetSelectionStart() const
1343 return SendMsg(2143, 0, 0);
1346 // Sets the position that ends the selection - this becomes the currentPosition.
1347 void wxStyledTextCtrl::SetSelectionEnd(int pos
)
1349 SendMsg(2144, pos
, 0);
1352 // Returns the position at the end of the selection.
1353 int wxStyledTextCtrl::GetSelectionEnd() const
1355 return SendMsg(2145, 0, 0);
1358 // Sets the print magnification added to the point size of each style for printing.
1359 void wxStyledTextCtrl::SetPrintMagnification(int magnification
)
1361 SendMsg(2146, magnification
, 0);
1364 // Returns the print magnification.
1365 int wxStyledTextCtrl::GetPrintMagnification() const
1367 return SendMsg(2147, 0, 0);
1370 // Modify colours when printing for clearer printed text.
1371 void wxStyledTextCtrl::SetPrintColourMode(int mode
)
1373 SendMsg(2148, mode
, 0);
1376 // Returns the print colour mode.
1377 int wxStyledTextCtrl::GetPrintColourMode() const
1379 return SendMsg(2149, 0, 0);
1382 // Find some text in the document.
1383 int wxStyledTextCtrl::FindText(int minPos
, int maxPos
,
1384 const wxString
& text
,
1387 ft
.chrg
.cpMin
= minPos
;
1388 ft
.chrg
.cpMax
= maxPos
;
1389 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
1390 ft
.lpstrText
= (char*)(const char*)buf
;
1392 return SendMsg(2150, flags
, (long)&ft
);
1395 // On Windows, will draw the document into a display context such as a printer.
1396 int wxStyledTextCtrl::FormatRange(bool doDraw
,
1405 if (endPos
< startPos
) {
1406 int temp
= startPos
;
1411 fr
.hdcTarget
= target
;
1412 fr
.rc
.top
= renderRect
.GetTop();
1413 fr
.rc
.left
= renderRect
.GetLeft();
1414 fr
.rc
.right
= renderRect
.GetRight();
1415 fr
.rc
.bottom
= renderRect
.GetBottom();
1416 fr
.rcPage
.top
= pageRect
.GetTop();
1417 fr
.rcPage
.left
= pageRect
.GetLeft();
1418 fr
.rcPage
.right
= pageRect
.GetRight();
1419 fr
.rcPage
.bottom
= pageRect
.GetBottom();
1420 fr
.chrg
.cpMin
= startPos
;
1421 fr
.chrg
.cpMax
= endPos
;
1423 return SendMsg(2151, doDraw
, (long)&fr
);
1426 // Retrieve the display line at the top of the display.
1427 int wxStyledTextCtrl::GetFirstVisibleLine() const
1429 return SendMsg(2152, 0, 0);
1432 // Retrieve the contents of a line.
1433 wxString
wxStyledTextCtrl::GetLine(int line
) {
1434 int len
= LineLength(line
);
1435 if (!len
) return wxEmptyString
;
1437 wxMemoryBuffer
mbuf(len
+1);
1438 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1439 SendMsg(2153, line
, (long)buf
);
1440 mbuf
.UngetWriteBuf(len
);
1445 // Returns the number of lines in the document. There is always at least one.
1446 int wxStyledTextCtrl::GetLineCount() const
1448 return SendMsg(2154, 0, 0);
1451 // Sets the size in pixels of the left margin.
1452 void wxStyledTextCtrl::SetMarginLeft(int pixelWidth
)
1454 SendMsg(2155, 0, pixelWidth
);
1457 // Returns the size in pixels of the left margin.
1458 int wxStyledTextCtrl::GetMarginLeft() const
1460 return SendMsg(2156, 0, 0);
1463 // Sets the size in pixels of the right margin.
1464 void wxStyledTextCtrl::SetMarginRight(int pixelWidth
)
1466 SendMsg(2157, 0, pixelWidth
);
1469 // Returns the size in pixels of the right margin.
1470 int wxStyledTextCtrl::GetMarginRight() const
1472 return SendMsg(2158, 0, 0);
1475 // Is the document different from when it was last saved?
1476 bool wxStyledTextCtrl::GetModify() const
1478 return SendMsg(2159, 0, 0) != 0;
1481 // Select a range of text.
1482 void wxStyledTextCtrl::SetSelection(int start
, int end
)
1484 SendMsg(2160, start
, end
);
1487 // Retrieve the selected text.
1488 wxString
wxStyledTextCtrl::GetSelectedText() {
1492 GetSelection(&start
, &end
);
1493 int len
= end
- start
;
1494 if (!len
) return wxEmptyString
;
1496 wxMemoryBuffer
mbuf(len
+2);
1497 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1498 SendMsg(2161, 0, (long)buf
);
1499 mbuf
.UngetWriteBuf(len
);
1504 // Retrieve a range of text.
1505 wxString
wxStyledTextCtrl::GetTextRange(int startPos
, int endPos
) {
1506 if (endPos
< startPos
) {
1507 int temp
= startPos
;
1511 int len
= endPos
- startPos
;
1512 if (!len
) return wxEmptyString
;
1513 wxMemoryBuffer
mbuf(len
+1);
1514 char* buf
= (char*)mbuf
.GetWriteBuf(len
);
1517 tr
.chrg
.cpMin
= startPos
;
1518 tr
.chrg
.cpMax
= endPos
;
1519 SendMsg(2162, 0, (long)&tr
);
1520 mbuf
.UngetWriteBuf(len
);
1525 // Draw the selection in normal style or with selection highlighted.
1526 void wxStyledTextCtrl::HideSelection(bool normal
)
1528 SendMsg(2163, normal
, 0);
1531 // Retrieve the line containing a position.
1532 int wxStyledTextCtrl::LineFromPosition(int pos
)
1534 return SendMsg(2166, pos
, 0);
1537 // Retrieve the position at the start of a line.
1538 int wxStyledTextCtrl::PositionFromLine(int line
)
1540 return SendMsg(2167, line
, 0);
1543 // Scroll horizontally and vertically.
1544 void wxStyledTextCtrl::LineScroll(int columns
, int lines
)
1546 SendMsg(2168, columns
, lines
);
1549 // Ensure the caret is visible.
1550 void wxStyledTextCtrl::EnsureCaretVisible()
1552 SendMsg(2169, 0, 0);
1555 // Replace the selected text with the argument text.
1556 void wxStyledTextCtrl::ReplaceSelection(const wxString
& text
)
1558 SendMsg(2170, 0, (long)(const char*)wx2stc(text
));
1561 // Set to read only or read write.
1562 void wxStyledTextCtrl::SetReadOnly(bool readOnly
)
1564 SendMsg(2171, readOnly
, 0);
1567 // Will a paste succeed?
1568 bool wxStyledTextCtrl::CanPaste()
1570 return SendMsg(2173, 0, 0) != 0;
1573 // Are there any undoable actions in the undo history?
1574 bool wxStyledTextCtrl::CanUndo()
1576 return SendMsg(2174, 0, 0) != 0;
1579 // Delete the undo history.
1580 void wxStyledTextCtrl::EmptyUndoBuffer()
1582 SendMsg(2175, 0, 0);
1585 // Undo one action in the undo history.
1586 void wxStyledTextCtrl::Undo()
1588 SendMsg(2176, 0, 0);
1591 // Cut the selection to the clipboard.
1592 void wxStyledTextCtrl::Cut()
1594 SendMsg(2177, 0, 0);
1597 // Copy the selection to the clipboard.
1598 void wxStyledTextCtrl::Copy()
1600 SendMsg(2178, 0, 0);
1603 // Paste the contents of the clipboard into the document replacing the selection.
1604 void wxStyledTextCtrl::Paste()
1606 SendMsg(2179, 0, 0);
1609 // Clear the selection.
1610 void wxStyledTextCtrl::Clear()
1612 SendMsg(2180, 0, 0);
1615 // Replace the contents of the document with the argument text.
1616 void wxStyledTextCtrl::SetText(const wxString
& text
)
1618 SendMsg(2181, 0, (long)(const char*)wx2stc(text
));
1621 // Retrieve all the text in the document.
1622 wxString
wxStyledTextCtrl::GetText() {
1623 int len
= GetTextLength();
1624 wxMemoryBuffer
mbuf(len
+1); // leave room for the null...
1625 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1626 SendMsg(2182, len
+1, (long)buf
);
1627 mbuf
.UngetWriteBuf(len
);
1632 // Retrieve the number of characters in the document.
1633 int wxStyledTextCtrl::GetTextLength() const
1635 return SendMsg(2183, 0, 0);
1638 // Set to overtype (true) or insert mode.
1639 void wxStyledTextCtrl::SetOvertype(bool overtype
)
1641 SendMsg(2186, overtype
, 0);
1644 // Returns true if overtype mode is active otherwise false is returned.
1645 bool wxStyledTextCtrl::GetOvertype() const
1647 return SendMsg(2187, 0, 0) != 0;
1650 // Set the width of the insert mode caret.
1651 void wxStyledTextCtrl::SetCaretWidth(int pixelWidth
)
1653 SendMsg(2188, pixelWidth
, 0);
1656 // Returns the width of the insert mode caret.
1657 int wxStyledTextCtrl::GetCaretWidth() const
1659 return SendMsg(2189, 0, 0);
1662 // Sets the position that starts the target which is used for updating the
1663 // document without affecting the scroll position.
1664 void wxStyledTextCtrl::SetTargetStart(int pos
)
1666 SendMsg(2190, pos
, 0);
1669 // Get the position that starts the target.
1670 int wxStyledTextCtrl::GetTargetStart() const
1672 return SendMsg(2191, 0, 0);
1675 // Sets the position that ends the target which is used for updating the
1676 // document without affecting the scroll position.
1677 void wxStyledTextCtrl::SetTargetEnd(int pos
)
1679 SendMsg(2192, pos
, 0);
1682 // Get the position that ends the target.
1683 int wxStyledTextCtrl::GetTargetEnd() const
1685 return SendMsg(2193, 0, 0);
1688 // Replace the target text with the argument text.
1689 // Text is counted so it can contain NULs.
1690 // Returns the length of the replacement text.
1692 int wxStyledTextCtrl::ReplaceTarget(const wxString
& text
) {
1693 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
1694 return SendMsg(2194, strlen(buf
), (long)(const char*)buf
);
1697 // Replace the target text with the argument text after \d processing.
1698 // Text is counted so it can contain NULs.
1699 // Looks for \d where d is between 1 and 9 and replaces these with the strings
1700 // matched in the last search operation which were surrounded by \( and \).
1701 // Returns the length of the replacement text including any change
1702 // caused by processing the \d patterns.
1704 int wxStyledTextCtrl::ReplaceTargetRE(const wxString
& text
) {
1705 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
1706 return SendMsg(2195, strlen(buf
), (long)(const char*)buf
);
1709 // Search for a counted string in the target and set the target to the found
1710 // range. Text is counted so it can contain NULs.
1711 // Returns length of range or -1 for failure in which case target is not moved.
1713 int wxStyledTextCtrl::SearchInTarget(const wxString
& text
) {
1714 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
1715 return SendMsg(2197, strlen(buf
), (long)(const char*)buf
);
1718 // Set the search flags used by SearchInTarget.
1719 void wxStyledTextCtrl::SetSearchFlags(int flags
)
1721 SendMsg(2198, flags
, 0);
1724 // Get the search flags used by SearchInTarget.
1725 int wxStyledTextCtrl::GetSearchFlags() const
1727 return SendMsg(2199, 0, 0);
1730 // Show a call tip containing a definition near position pos.
1731 void wxStyledTextCtrl::CallTipShow(int pos
, const wxString
& definition
)
1733 SendMsg(2200, pos
, (long)(const char*)wx2stc(definition
));
1736 // Remove the call tip from the screen.
1737 void wxStyledTextCtrl::CallTipCancel()
1739 SendMsg(2201, 0, 0);
1742 // Is there an active call tip?
1743 bool wxStyledTextCtrl::CallTipActive()
1745 return SendMsg(2202, 0, 0) != 0;
1748 // Retrieve the position where the caret was before displaying the call tip.
1749 int wxStyledTextCtrl::CallTipPosAtStart()
1751 return SendMsg(2203, 0, 0);
1754 // Highlight a segment of the definition.
1755 void wxStyledTextCtrl::CallTipSetHighlight(int start
, int end
)
1757 SendMsg(2204, start
, end
);
1760 // Set the background colour for the call tip.
1761 void wxStyledTextCtrl::CallTipSetBackground(const wxColour
& back
)
1763 SendMsg(2205, wxColourAsLong(back
), 0);
1766 // Set the foreground colour for the call tip.
1767 void wxStyledTextCtrl::CallTipSetForeground(const wxColour
& fore
)
1769 SendMsg(2206, wxColourAsLong(fore
), 0);
1772 // Set the foreground colour for the highlighted part of the call tip.
1773 void wxStyledTextCtrl::CallTipSetForegroundHighlight(const wxColour
& fore
)
1775 SendMsg(2207, wxColourAsLong(fore
), 0);
1778 // Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
1779 void wxStyledTextCtrl::CallTipUseStyle(int tabSize
)
1781 SendMsg(2212, tabSize
, 0);
1784 // Find the display line of a document line taking hidden lines into account.
1785 int wxStyledTextCtrl::VisibleFromDocLine(int line
)
1787 return SendMsg(2220, line
, 0);
1790 // Find the document line of a display line taking hidden lines into account.
1791 int wxStyledTextCtrl::DocLineFromVisible(int lineDisplay
)
1793 return SendMsg(2221, lineDisplay
, 0);
1796 // The number of display lines needed to wrap a document line
1797 int wxStyledTextCtrl::WrapCount(int line
)
1799 return SendMsg(2235, line
, 0);
1802 // Set the fold level of a line.
1803 // This encodes an integer level along with flags indicating whether the
1804 // line is a header and whether it is effectively white space.
1805 void wxStyledTextCtrl::SetFoldLevel(int line
, int level
)
1807 SendMsg(2222, line
, level
);
1810 // Retrieve the fold level of a line.
1811 int wxStyledTextCtrl::GetFoldLevel(int line
) const
1813 return SendMsg(2223, line
, 0);
1816 // Find the last child line of a header line.
1817 int wxStyledTextCtrl::GetLastChild(int line
, int level
) const
1819 return SendMsg(2224, line
, level
);
1822 // Find the parent line of a child line.
1823 int wxStyledTextCtrl::GetFoldParent(int line
) const
1825 return SendMsg(2225, line
, 0);
1828 // Make a range of lines visible.
1829 void wxStyledTextCtrl::ShowLines(int lineStart
, int lineEnd
)
1831 SendMsg(2226, lineStart
, lineEnd
);
1834 // Make a range of lines invisible.
1835 void wxStyledTextCtrl::HideLines(int lineStart
, int lineEnd
)
1837 SendMsg(2227, lineStart
, lineEnd
);
1840 // Is a line visible?
1841 bool wxStyledTextCtrl::GetLineVisible(int line
) const
1843 return SendMsg(2228, line
, 0) != 0;
1846 // Show the children of a header line.
1847 void wxStyledTextCtrl::SetFoldExpanded(int line
, bool expanded
)
1849 SendMsg(2229, line
, expanded
);
1852 // Is a header line expanded?
1853 bool wxStyledTextCtrl::GetFoldExpanded(int line
) const
1855 return SendMsg(2230, line
, 0) != 0;
1858 // Switch a header line between expanded and contracted.
1859 void wxStyledTextCtrl::ToggleFold(int line
)
1861 SendMsg(2231, line
, 0);
1864 // Ensure a particular line is visible by expanding any header line hiding it.
1865 void wxStyledTextCtrl::EnsureVisible(int line
)
1867 SendMsg(2232, line
, 0);
1870 // Set some style options for folding.
1871 void wxStyledTextCtrl::SetFoldFlags(int flags
)
1873 SendMsg(2233, flags
, 0);
1876 // Ensure a particular line is visible by expanding any header line hiding it.
1877 // Use the currently set visibility policy to determine which range to display.
1878 void wxStyledTextCtrl::EnsureVisibleEnforcePolicy(int line
)
1880 SendMsg(2234, line
, 0);
1883 // Sets whether a tab pressed when caret is within indentation indents.
1884 void wxStyledTextCtrl::SetTabIndents(bool tabIndents
)
1886 SendMsg(2260, tabIndents
, 0);
1889 // Does a tab pressed when caret is within indentation indent?
1890 bool wxStyledTextCtrl::GetTabIndents() const
1892 return SendMsg(2261, 0, 0) != 0;
1895 // Sets whether a backspace pressed when caret is within indentation unindents.
1896 void wxStyledTextCtrl::SetBackSpaceUnIndents(bool bsUnIndents
)
1898 SendMsg(2262, bsUnIndents
, 0);
1901 // Does a backspace pressed when caret is within indentation unindent?
1902 bool wxStyledTextCtrl::GetBackSpaceUnIndents() const
1904 return SendMsg(2263, 0, 0) != 0;
1907 // Sets the time the mouse must sit still to generate a mouse dwell event.
1908 void wxStyledTextCtrl::SetMouseDwellTime(int periodMilliseconds
)
1910 SendMsg(2264, periodMilliseconds
, 0);
1913 // Retrieve the time the mouse must sit still to generate a mouse dwell event.
1914 int wxStyledTextCtrl::GetMouseDwellTime() const
1916 return SendMsg(2265, 0, 0);
1919 // Get position of start of word.
1920 int wxStyledTextCtrl::WordStartPosition(int pos
, bool onlyWordCharacters
)
1922 return SendMsg(2266, pos
, onlyWordCharacters
);
1925 // Get position of end of word.
1926 int wxStyledTextCtrl::WordEndPosition(int pos
, bool onlyWordCharacters
)
1928 return SendMsg(2267, pos
, onlyWordCharacters
);
1931 // Sets whether text is word wrapped.
1932 void wxStyledTextCtrl::SetWrapMode(int mode
)
1934 SendMsg(2268, mode
, 0);
1937 // Retrieve whether text is word wrapped.
1938 int wxStyledTextCtrl::GetWrapMode() const
1940 return SendMsg(2269, 0, 0);
1943 // Set the display mode of visual flags for wrapped lines.
1944 void wxStyledTextCtrl::SetWrapVisualFlags(int wrapVisualFlags
)
1946 SendMsg(2460, wrapVisualFlags
, 0);
1949 // Retrive the display mode of visual flags for wrapped lines.
1950 int wxStyledTextCtrl::GetWrapVisualFlags() const
1952 return SendMsg(2461, 0, 0);
1955 // Set the location of visual flags for wrapped lines.
1956 void wxStyledTextCtrl::SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation
)
1958 SendMsg(2462, wrapVisualFlagsLocation
, 0);
1961 // Retrive the location of visual flags for wrapped lines.
1962 int wxStyledTextCtrl::GetWrapVisualFlagsLocation() const
1964 return SendMsg(2463, 0, 0);
1967 // Set the start indent for wrapped lines.
1968 void wxStyledTextCtrl::SetWrapStartIndent(int indent
)
1970 SendMsg(2464, indent
, 0);
1973 // Retrive the start indent for wrapped lines.
1974 int wxStyledTextCtrl::GetWrapStartIndent() const
1976 return SendMsg(2465, 0, 0);
1979 // Sets the degree of caching of layout information.
1980 void wxStyledTextCtrl::SetLayoutCache(int mode
)
1982 SendMsg(2272, mode
, 0);
1985 // Retrieve the degree of caching of layout information.
1986 int wxStyledTextCtrl::GetLayoutCache() const
1988 return SendMsg(2273, 0, 0);
1991 // Sets the document width assumed for scrolling.
1992 void wxStyledTextCtrl::SetScrollWidth(int pixelWidth
)
1994 SendMsg(2274, pixelWidth
, 0);
1997 // Retrieve the document width assumed for scrolling.
1998 int wxStyledTextCtrl::GetScrollWidth() const
2000 return SendMsg(2275, 0, 0);
2003 // Sets whether the maximum width line displayed is used to set scroll width.
2004 void wxStyledTextCtrl::SetScrollWidthTracking(bool tracking
)
2006 SendMsg(2516, tracking
, 0);
2009 // Retrieve whether the scroll width tracks wide lines.
2010 bool wxStyledTextCtrl::GetScrollWidthTracking() const
2012 return SendMsg(2517, 0, 0) != 0;
2015 // Measure the pixel width of some text in a particular style.
2016 // NUL terminated text argument.
2017 // Does not handle tab or control characters.
2018 int wxStyledTextCtrl::TextWidth(int style
, const wxString
& text
)
2020 return SendMsg(2276, style
, (long)(const char*)wx2stc(text
));
2023 // Sets the scroll range so that maximum scroll position has
2024 // the last line at the bottom of the view (default).
2025 // Setting this to false allows scrolling one page below the last line.
2026 void wxStyledTextCtrl::SetEndAtLastLine(bool endAtLastLine
)
2028 SendMsg(2277, endAtLastLine
, 0);
2031 // Retrieve whether the maximum scroll position has the last
2032 // line at the bottom of the view.
2033 bool wxStyledTextCtrl::GetEndAtLastLine() const
2035 return SendMsg(2278, 0, 0) != 0;
2038 // Retrieve the height of a particular line of text in pixels.
2039 int wxStyledTextCtrl::TextHeight(int line
)
2041 return SendMsg(2279, line
, 0);
2044 // Show or hide the vertical scroll bar.
2045 void wxStyledTextCtrl::SetUseVerticalScrollBar(bool show
)
2047 SendMsg(2280, show
, 0);
2050 // Is the vertical scroll bar visible?
2051 bool wxStyledTextCtrl::GetUseVerticalScrollBar() const
2053 return SendMsg(2281, 0, 0) != 0;
2056 // Append a string to the end of the document without changing the selection.
2057 void wxStyledTextCtrl::AppendText(const wxString
& text
) {
2058 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
2059 SendMsg(2282, strlen(buf
), (long)(const char*)buf
);
2062 // Is drawing done in two phases with backgrounds drawn before foregrounds?
2063 bool wxStyledTextCtrl::GetTwoPhaseDraw() const
2065 return SendMsg(2283, 0, 0) != 0;
2068 // In twoPhaseDraw mode, drawing is performed in two phases, first the background
2069 // and then the foreground. This avoids chopping off characters that overlap the next run.
2070 void wxStyledTextCtrl::SetTwoPhaseDraw(bool twoPhase
)
2072 SendMsg(2284, twoPhase
, 0);
2075 // Make the target range start and end be the same as the selection range start and end.
2076 void wxStyledTextCtrl::TargetFromSelection()
2078 SendMsg(2287, 0, 0);
2081 // Join the lines in the target.
2082 void wxStyledTextCtrl::LinesJoin()
2084 SendMsg(2288, 0, 0);
2087 // Split the lines in the target into lines that are less wide than pixelWidth
2089 void wxStyledTextCtrl::LinesSplit(int pixelWidth
)
2091 SendMsg(2289, pixelWidth
, 0);
2094 // Set the colours used as a chequerboard pattern in the fold margin
2095 void wxStyledTextCtrl::SetFoldMarginColour(bool useSetting
, const wxColour
& back
)
2097 SendMsg(2290, useSetting
, wxColourAsLong(back
));
2099 void wxStyledTextCtrl::SetFoldMarginHiColour(bool useSetting
, const wxColour
& fore
)
2101 SendMsg(2291, useSetting
, wxColourAsLong(fore
));
2104 // Move caret down one line.
2105 void wxStyledTextCtrl::LineDown()
2107 SendMsg(2300, 0, 0);
2110 // Move caret down one line extending selection to new caret position.
2111 void wxStyledTextCtrl::LineDownExtend()
2113 SendMsg(2301, 0, 0);
2116 // Move caret up one line.
2117 void wxStyledTextCtrl::LineUp()
2119 SendMsg(2302, 0, 0);
2122 // Move caret up one line extending selection to new caret position.
2123 void wxStyledTextCtrl::LineUpExtend()
2125 SendMsg(2303, 0, 0);
2128 // Move caret left one character.
2129 void wxStyledTextCtrl::CharLeft()
2131 SendMsg(2304, 0, 0);
2134 // Move caret left one character extending selection to new caret position.
2135 void wxStyledTextCtrl::CharLeftExtend()
2137 SendMsg(2305, 0, 0);
2140 // Move caret right one character.
2141 void wxStyledTextCtrl::CharRight()
2143 SendMsg(2306, 0, 0);
2146 // Move caret right one character extending selection to new caret position.
2147 void wxStyledTextCtrl::CharRightExtend()
2149 SendMsg(2307, 0, 0);
2152 // Move caret left one word.
2153 void wxStyledTextCtrl::WordLeft()
2155 SendMsg(2308, 0, 0);
2158 // Move caret left one word extending selection to new caret position.
2159 void wxStyledTextCtrl::WordLeftExtend()
2161 SendMsg(2309, 0, 0);
2164 // Move caret right one word.
2165 void wxStyledTextCtrl::WordRight()
2167 SendMsg(2310, 0, 0);
2170 // Move caret right one word extending selection to new caret position.
2171 void wxStyledTextCtrl::WordRightExtend()
2173 SendMsg(2311, 0, 0);
2176 // Move caret to first position on line.
2177 void wxStyledTextCtrl::Home()
2179 SendMsg(2312, 0, 0);
2182 // Move caret to first position on line extending selection to new caret position.
2183 void wxStyledTextCtrl::HomeExtend()
2185 SendMsg(2313, 0, 0);
2188 // Move caret to last position on line.
2189 void wxStyledTextCtrl::LineEnd()
2191 SendMsg(2314, 0, 0);
2194 // Move caret to last position on line extending selection to new caret position.
2195 void wxStyledTextCtrl::LineEndExtend()
2197 SendMsg(2315, 0, 0);
2200 // Move caret to first position in document.
2201 void wxStyledTextCtrl::DocumentStart()
2203 SendMsg(2316, 0, 0);
2206 // Move caret to first position in document extending selection to new caret position.
2207 void wxStyledTextCtrl::DocumentStartExtend()
2209 SendMsg(2317, 0, 0);
2212 // Move caret to last position in document.
2213 void wxStyledTextCtrl::DocumentEnd()
2215 SendMsg(2318, 0, 0);
2218 // Move caret to last position in document extending selection to new caret position.
2219 void wxStyledTextCtrl::DocumentEndExtend()
2221 SendMsg(2319, 0, 0);
2224 // Move caret one page up.
2225 void wxStyledTextCtrl::PageUp()
2227 SendMsg(2320, 0, 0);
2230 // Move caret one page up extending selection to new caret position.
2231 void wxStyledTextCtrl::PageUpExtend()
2233 SendMsg(2321, 0, 0);
2236 // Move caret one page down.
2237 void wxStyledTextCtrl::PageDown()
2239 SendMsg(2322, 0, 0);
2242 // Move caret one page down extending selection to new caret position.
2243 void wxStyledTextCtrl::PageDownExtend()
2245 SendMsg(2323, 0, 0);
2248 // Switch from insert to overtype mode or the reverse.
2249 void wxStyledTextCtrl::EditToggleOvertype()
2251 SendMsg(2324, 0, 0);
2254 // Cancel any modes such as call tip or auto-completion list display.
2255 void wxStyledTextCtrl::Cancel()
2257 SendMsg(2325, 0, 0);
2260 // Delete the selection or if no selection, the character before the caret.
2261 void wxStyledTextCtrl::DeleteBack()
2263 SendMsg(2326, 0, 0);
2266 // If selection is empty or all on one line replace the selection with a tab character.
2267 // If more than one line selected, indent the lines.
2268 void wxStyledTextCtrl::Tab()
2270 SendMsg(2327, 0, 0);
2273 // Dedent the selected lines.
2274 void wxStyledTextCtrl::BackTab()
2276 SendMsg(2328, 0, 0);
2279 // Insert a new line, may use a CRLF, CR or LF depending on EOL mode.
2280 void wxStyledTextCtrl::NewLine()
2282 SendMsg(2329, 0, 0);
2285 // Insert a Form Feed character.
2286 void wxStyledTextCtrl::FormFeed()
2288 SendMsg(2330, 0, 0);
2291 // Move caret to before first visible character on line.
2292 // If already there move to first character on line.
2293 void wxStyledTextCtrl::VCHome()
2295 SendMsg(2331, 0, 0);
2298 // Like VCHome but extending selection to new caret position.
2299 void wxStyledTextCtrl::VCHomeExtend()
2301 SendMsg(2332, 0, 0);
2304 // Magnify the displayed text by increasing the sizes by 1 point.
2305 void wxStyledTextCtrl::ZoomIn()
2307 SendMsg(2333, 0, 0);
2310 // Make the displayed text smaller by decreasing the sizes by 1 point.
2311 void wxStyledTextCtrl::ZoomOut()
2313 SendMsg(2334, 0, 0);
2316 // Delete the word to the left of the caret.
2317 void wxStyledTextCtrl::DelWordLeft()
2319 SendMsg(2335, 0, 0);
2322 // Delete the word to the right of the caret.
2323 void wxStyledTextCtrl::DelWordRight()
2325 SendMsg(2336, 0, 0);
2328 // Delete the word to the right of the caret, but not the trailing non-word characters.
2329 void wxStyledTextCtrl::DelWordRightEnd()
2331 SendMsg(2518, 0, 0);
2334 // Cut the line containing the caret.
2335 void wxStyledTextCtrl::LineCut()
2337 SendMsg(2337, 0, 0);
2340 // Delete the line containing the caret.
2341 void wxStyledTextCtrl::LineDelete()
2343 SendMsg(2338, 0, 0);
2346 // Switch the current line with the previous.
2347 void wxStyledTextCtrl::LineTranspose()
2349 SendMsg(2339, 0, 0);
2352 // Duplicate the current line.
2353 void wxStyledTextCtrl::LineDuplicate()
2355 SendMsg(2404, 0, 0);
2358 // Transform the selection to lower case.
2359 void wxStyledTextCtrl::LowerCase()
2361 SendMsg(2340, 0, 0);
2364 // Transform the selection to upper case.
2365 void wxStyledTextCtrl::UpperCase()
2367 SendMsg(2341, 0, 0);
2370 // Scroll the document down, keeping the caret visible.
2371 void wxStyledTextCtrl::LineScrollDown()
2373 SendMsg(2342, 0, 0);
2376 // Scroll the document up, keeping the caret visible.
2377 void wxStyledTextCtrl::LineScrollUp()
2379 SendMsg(2343, 0, 0);
2382 // Delete the selection or if no selection, the character before the caret.
2383 // Will not delete the character before at the start of a line.
2384 void wxStyledTextCtrl::DeleteBackNotLine()
2386 SendMsg(2344, 0, 0);
2389 // Move caret to first position on display line.
2390 void wxStyledTextCtrl::HomeDisplay()
2392 SendMsg(2345, 0, 0);
2395 // Move caret to first position on display line extending selection to
2396 // new caret position.
2397 void wxStyledTextCtrl::HomeDisplayExtend()
2399 SendMsg(2346, 0, 0);
2402 // Move caret to last position on display line.
2403 void wxStyledTextCtrl::LineEndDisplay()
2405 SendMsg(2347, 0, 0);
2408 // Move caret to last position on display line extending selection to new
2410 void wxStyledTextCtrl::LineEndDisplayExtend()
2412 SendMsg(2348, 0, 0);
2415 // These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)?
2416 // except they behave differently when word-wrap is enabled:
2417 // They go first to the start / end of the display line, like (Home|LineEnd)Display
2418 // The difference is that, the cursor is already at the point, it goes on to the start
2419 // or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
2420 void wxStyledTextCtrl::HomeWrap()
2422 SendMsg(2349, 0, 0);
2424 void wxStyledTextCtrl::HomeWrapExtend()
2426 SendMsg(2450, 0, 0);
2428 void wxStyledTextCtrl::LineEndWrap()
2430 SendMsg(2451, 0, 0);
2432 void wxStyledTextCtrl::LineEndWrapExtend()
2434 SendMsg(2452, 0, 0);
2436 void wxStyledTextCtrl::VCHomeWrap()
2438 SendMsg(2453, 0, 0);
2440 void wxStyledTextCtrl::VCHomeWrapExtend()
2442 SendMsg(2454, 0, 0);
2445 // Copy the line containing the caret.
2446 void wxStyledTextCtrl::LineCopy()
2448 SendMsg(2455, 0, 0);
2451 // Move the caret inside current view if it's not there already.
2452 void wxStyledTextCtrl::MoveCaretInsideView()
2454 SendMsg(2401, 0, 0);
2457 // How many characters are on a line, not including end of line characters?
2458 int wxStyledTextCtrl::LineLength(int line
)
2460 return SendMsg(2350, line
, 0);
2463 // Highlight the characters at two positions.
2464 void wxStyledTextCtrl::BraceHighlight(int pos1
, int pos2
)
2466 SendMsg(2351, pos1
, pos2
);
2469 // Highlight the character at a position indicating there is no matching brace.
2470 void wxStyledTextCtrl::BraceBadLight(int pos
)
2472 SendMsg(2352, pos
, 0);
2475 // Find the position of a matching brace or INVALID_POSITION if no match.
2476 int wxStyledTextCtrl::BraceMatch(int pos
)
2478 return SendMsg(2353, pos
, 0);
2481 // Are the end of line characters visible?
2482 bool wxStyledTextCtrl::GetViewEOL() const
2484 return SendMsg(2355, 0, 0) != 0;
2487 // Make the end of line characters visible or invisible.
2488 void wxStyledTextCtrl::SetViewEOL(bool visible
)
2490 SendMsg(2356, visible
, 0);
2493 // Retrieve a pointer to the document object.
2494 void* wxStyledTextCtrl::GetDocPointer() {
2495 return (void*)SendMsg(2357);
2498 // Change the document object used.
2499 void wxStyledTextCtrl::SetDocPointer(void* docPointer
) {
2500 SendMsg(2358, 0, (long)docPointer
);
2503 // Set which document modification events are sent to the container.
2504 void wxStyledTextCtrl::SetModEventMask(int mask
)
2506 SendMsg(2359, mask
, 0);
2509 // Retrieve the column number which text should be kept within.
2510 int wxStyledTextCtrl::GetEdgeColumn() const
2512 return SendMsg(2360, 0, 0);
2515 // Set the column number of the edge.
2516 // If text goes past the edge then it is highlighted.
2517 void wxStyledTextCtrl::SetEdgeColumn(int column
)
2519 SendMsg(2361, column
, 0);
2522 // Retrieve the edge highlight mode.
2523 int wxStyledTextCtrl::GetEdgeMode() const
2525 return SendMsg(2362, 0, 0);
2528 // The edge may be displayed by a line (EDGE_LINE) or by highlighting text that
2529 // goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).
2530 void wxStyledTextCtrl::SetEdgeMode(int mode
)
2532 SendMsg(2363, mode
, 0);
2535 // Retrieve the colour used in edge indication.
2536 wxColour
wxStyledTextCtrl::GetEdgeColour() const
2538 long c
= SendMsg(2364, 0, 0);
2539 return wxColourFromLong(c
);
2542 // Change the colour used in edge indication.
2543 void wxStyledTextCtrl::SetEdgeColour(const wxColour
& edgeColour
)
2545 SendMsg(2365, wxColourAsLong(edgeColour
), 0);
2548 // Sets the current caret position to be the search anchor.
2549 void wxStyledTextCtrl::SearchAnchor()
2551 SendMsg(2366, 0, 0);
2554 // Find some text starting at the search anchor.
2555 // Does not ensure the selection is visible.
2556 int wxStyledTextCtrl::SearchNext(int flags
, const wxString
& text
)
2558 return SendMsg(2367, flags
, (long)(const char*)wx2stc(text
));
2561 // Find some text starting at the search anchor and moving backwards.
2562 // Does not ensure the selection is visible.
2563 int wxStyledTextCtrl::SearchPrev(int flags
, const wxString
& text
)
2565 return SendMsg(2368, flags
, (long)(const char*)wx2stc(text
));
2568 // Retrieves the number of lines completely visible.
2569 int wxStyledTextCtrl::LinesOnScreen() const
2571 return SendMsg(2370, 0, 0);
2574 // Set whether a pop up menu is displayed automatically when the user presses
2575 // the wrong mouse button.
2576 void wxStyledTextCtrl::UsePopUp(bool allowPopUp
)
2578 SendMsg(2371, allowPopUp
, 0);
2581 // Is the selection rectangular? The alternative is the more common stream selection.
2582 bool wxStyledTextCtrl::SelectionIsRectangle() const
2584 return SendMsg(2372, 0, 0) != 0;
2587 // Set the zoom level. This number of points is added to the size of all fonts.
2588 // It may be positive to magnify or negative to reduce.
2589 void wxStyledTextCtrl::SetZoom(int zoom
)
2591 SendMsg(2373, zoom
, 0);
2594 // Retrieve the zoom level.
2595 int wxStyledTextCtrl::GetZoom() const
2597 return SendMsg(2374, 0, 0);
2600 // Create a new document object.
2601 // Starts with reference count of 1 and not selected into editor.
2602 void* wxStyledTextCtrl::CreateDocument() {
2603 return (void*)SendMsg(2375);
2606 // Extend life of document.
2607 void wxStyledTextCtrl::AddRefDocument(void* docPointer
) {
2608 SendMsg(2376, 0, (long)docPointer
);
2611 // Release a reference to the document, deleting document if it fades to black.
2612 void wxStyledTextCtrl::ReleaseDocument(void* docPointer
) {
2613 SendMsg(2377, 0, (long)docPointer
);
2616 // Get which document modification events are sent to the container.
2617 int wxStyledTextCtrl::GetModEventMask() const
2619 return SendMsg(2378, 0, 0);
2622 // Change internal focus flag.
2623 void wxStyledTextCtrl::SetSTCFocus(bool focus
)
2625 SendMsg(2380, focus
, 0);
2628 // Get internal focus flag.
2629 bool wxStyledTextCtrl::GetSTCFocus() const
2631 return SendMsg(2381, 0, 0) != 0;
2634 // Change error status - 0 = OK.
2635 void wxStyledTextCtrl::SetStatus(int statusCode
)
2637 SendMsg(2382, statusCode
, 0);
2640 // Get error status.
2641 int wxStyledTextCtrl::GetStatus() const
2643 return SendMsg(2383, 0, 0);
2646 // Set whether the mouse is captured when its button is pressed.
2647 void wxStyledTextCtrl::SetMouseDownCaptures(bool captures
)
2649 SendMsg(2384, captures
, 0);
2652 // Get whether mouse gets captured.
2653 bool wxStyledTextCtrl::GetMouseDownCaptures() const
2655 return SendMsg(2385, 0, 0) != 0;
2658 // Sets the cursor to one of the SC_CURSOR* values.
2659 void wxStyledTextCtrl::SetSTCCursor(int cursorType
)
2661 SendMsg(2386, cursorType
, 0);
2665 int wxStyledTextCtrl::GetSTCCursor() const
2667 return SendMsg(2387, 0, 0);
2670 // Change the way control characters are displayed:
2671 // If symbol is < 32, keep the drawn way, else, use the given character.
2672 void wxStyledTextCtrl::SetControlCharSymbol(int symbol
)
2674 SendMsg(2388, symbol
, 0);
2677 // Get the way control characters are displayed.
2678 int wxStyledTextCtrl::GetControlCharSymbol() const
2680 return SendMsg(2389, 0, 0);
2683 // Move to the previous change in capitalisation.
2684 void wxStyledTextCtrl::WordPartLeft()
2686 SendMsg(2390, 0, 0);
2689 // Move to the previous change in capitalisation extending selection
2690 // to new caret position.
2691 void wxStyledTextCtrl::WordPartLeftExtend()
2693 SendMsg(2391, 0, 0);
2696 // Move to the change next in capitalisation.
2697 void wxStyledTextCtrl::WordPartRight()
2699 SendMsg(2392, 0, 0);
2702 // Move to the next change in capitalisation extending selection
2703 // to new caret position.
2704 void wxStyledTextCtrl::WordPartRightExtend()
2706 SendMsg(2393, 0, 0);
2709 // Set the way the display area is determined when a particular line
2710 // is to be moved to by Find, FindNext, GotoLine, etc.
2711 void wxStyledTextCtrl::SetVisiblePolicy(int visiblePolicy
, int visibleSlop
)
2713 SendMsg(2394, visiblePolicy
, visibleSlop
);
2716 // Delete back from the current position to the start of the line.
2717 void wxStyledTextCtrl::DelLineLeft()
2719 SendMsg(2395, 0, 0);
2722 // Delete forwards from the current position to the end of the line.
2723 void wxStyledTextCtrl::DelLineRight()
2725 SendMsg(2396, 0, 0);
2728 // Get and Set the xOffset (ie, horizonal scroll position).
2729 void wxStyledTextCtrl::SetXOffset(int newOffset
)
2731 SendMsg(2397, newOffset
, 0);
2733 int wxStyledTextCtrl::GetXOffset() const
2735 return SendMsg(2398, 0, 0);
2738 // Set the last x chosen value to be the caret x position.
2739 void wxStyledTextCtrl::ChooseCaretX()
2741 SendMsg(2399, 0, 0);
2744 // Set the way the caret is kept visible when going sideway.
2745 // The exclusion zone is given in pixels.
2746 void wxStyledTextCtrl::SetXCaretPolicy(int caretPolicy
, int caretSlop
)
2748 SendMsg(2402, caretPolicy
, caretSlop
);
2751 // Set the way the line the caret is on is kept visible.
2752 // The exclusion zone is given in lines.
2753 void wxStyledTextCtrl::SetYCaretPolicy(int caretPolicy
, int caretSlop
)
2755 SendMsg(2403, caretPolicy
, caretSlop
);
2758 // Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE).
2759 void wxStyledTextCtrl::SetPrintWrapMode(int mode
)
2761 SendMsg(2406, mode
, 0);
2764 // Is printing line wrapped?
2765 int wxStyledTextCtrl::GetPrintWrapMode() const
2767 return SendMsg(2407, 0, 0);
2770 // Set a fore colour for active hotspots.
2771 void wxStyledTextCtrl::SetHotspotActiveForeground(bool useSetting
, const wxColour
& fore
)
2773 SendMsg(2410, useSetting
, wxColourAsLong(fore
));
2776 // Get the fore colour for active hotspots.
2777 wxColour
wxStyledTextCtrl::GetHotspotActiveForeground() const
2779 long c
= SendMsg(2494, 0, 0);
2780 return wxColourFromLong(c
);
2783 // Set a back colour for active hotspots.
2784 void wxStyledTextCtrl::SetHotspotActiveBackground(bool useSetting
, const wxColour
& back
)
2786 SendMsg(2411, useSetting
, wxColourAsLong(back
));
2789 // Get the back colour for active hotspots.
2790 wxColour
wxStyledTextCtrl::GetHotspotActiveBackground() const
2792 long c
= SendMsg(2495, 0, 0);
2793 return wxColourFromLong(c
);
2796 // Enable / Disable underlining active hotspots.
2797 void wxStyledTextCtrl::SetHotspotActiveUnderline(bool underline
)
2799 SendMsg(2412, underline
, 0);
2802 // Get whether underlining for active hotspots.
2803 bool wxStyledTextCtrl::GetHotspotActiveUnderline() const
2805 return SendMsg(2496, 0, 0) != 0;
2808 // Limit hotspots to single line so hotspots on two lines don't merge.
2809 void wxStyledTextCtrl::SetHotspotSingleLine(bool singleLine
)
2811 SendMsg(2421, singleLine
, 0);
2814 // Get the HotspotSingleLine property
2815 bool wxStyledTextCtrl::GetHotspotSingleLine() const
2817 return SendMsg(2497, 0, 0) != 0;
2820 // Move caret between paragraphs (delimited by empty lines).
2821 void wxStyledTextCtrl::ParaDown()
2823 SendMsg(2413, 0, 0);
2825 void wxStyledTextCtrl::ParaDownExtend()
2827 SendMsg(2414, 0, 0);
2829 void wxStyledTextCtrl::ParaUp()
2831 SendMsg(2415, 0, 0);
2833 void wxStyledTextCtrl::ParaUpExtend()
2835 SendMsg(2416, 0, 0);
2838 // Given a valid document position, return the previous position taking code
2839 // page into account. Returns 0 if passed 0.
2840 int wxStyledTextCtrl::PositionBefore(int pos
)
2842 return SendMsg(2417, pos
, 0);
2845 // Given a valid document position, return the next position taking code
2846 // page into account. Maximum value returned is the last position in the document.
2847 int wxStyledTextCtrl::PositionAfter(int pos
)
2849 return SendMsg(2418, pos
, 0);
2852 // Copy a range of text to the clipboard. Positions are clipped into the document.
2853 void wxStyledTextCtrl::CopyRange(int start
, int end
)
2855 SendMsg(2419, start
, end
);
2858 // Copy argument text to the clipboard.
2859 void wxStyledTextCtrl::CopyText(int length
, const wxString
& text
)
2861 SendMsg(2420, length
, (long)(const char*)wx2stc(text
));
2864 // Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE) or
2865 // by lines (SC_SEL_LINES).
2866 void wxStyledTextCtrl::SetSelectionMode(int mode
)
2868 SendMsg(2422, mode
, 0);
2871 // Get the mode of the current selection.
2872 int wxStyledTextCtrl::GetSelectionMode() const
2874 return SendMsg(2423, 0, 0);
2877 // Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line).
2878 int wxStyledTextCtrl::GetLineSelStartPosition(int line
)
2880 return SendMsg(2424, line
, 0);
2883 // Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line).
2884 int wxStyledTextCtrl::GetLineSelEndPosition(int line
)
2886 return SendMsg(2425, line
, 0);
2889 // Move caret down one line, extending rectangular selection to new caret position.
2890 void wxStyledTextCtrl::LineDownRectExtend()
2892 SendMsg(2426, 0, 0);
2895 // Move caret up one line, extending rectangular selection to new caret position.
2896 void wxStyledTextCtrl::LineUpRectExtend()
2898 SendMsg(2427, 0, 0);
2901 // Move caret left one character, extending rectangular selection to new caret position.
2902 void wxStyledTextCtrl::CharLeftRectExtend()
2904 SendMsg(2428, 0, 0);
2907 // Move caret right one character, extending rectangular selection to new caret position.
2908 void wxStyledTextCtrl::CharRightRectExtend()
2910 SendMsg(2429, 0, 0);
2913 // Move caret to first position on line, extending rectangular selection to new caret position.
2914 void wxStyledTextCtrl::HomeRectExtend()
2916 SendMsg(2430, 0, 0);
2919 // Move caret to before first visible character on line.
2920 // If already there move to first character on line.
2921 // In either case, extend rectangular selection to new caret position.
2922 void wxStyledTextCtrl::VCHomeRectExtend()
2924 SendMsg(2431, 0, 0);
2927 // Move caret to last position on line, extending rectangular selection to new caret position.
2928 void wxStyledTextCtrl::LineEndRectExtend()
2930 SendMsg(2432, 0, 0);
2933 // Move caret one page up, extending rectangular selection to new caret position.
2934 void wxStyledTextCtrl::PageUpRectExtend()
2936 SendMsg(2433, 0, 0);
2939 // Move caret one page down, extending rectangular selection to new caret position.
2940 void wxStyledTextCtrl::PageDownRectExtend()
2942 SendMsg(2434, 0, 0);
2945 // Move caret to top of page, or one page up if already at top of page.
2946 void wxStyledTextCtrl::StutteredPageUp()
2948 SendMsg(2435, 0, 0);
2951 // Move caret to top of page, or one page up if already at top of page, extending selection to new caret position.
2952 void wxStyledTextCtrl::StutteredPageUpExtend()
2954 SendMsg(2436, 0, 0);
2957 // Move caret to bottom of page, or one page down if already at bottom of page.
2958 void wxStyledTextCtrl::StutteredPageDown()
2960 SendMsg(2437, 0, 0);
2963 // Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position.
2964 void wxStyledTextCtrl::StutteredPageDownExtend()
2966 SendMsg(2438, 0, 0);
2969 // Move caret left one word, position cursor at end of word.
2970 void wxStyledTextCtrl::WordLeftEnd()
2972 SendMsg(2439, 0, 0);
2975 // Move caret left one word, position cursor at end of word, extending selection to new caret position.
2976 void wxStyledTextCtrl::WordLeftEndExtend()
2978 SendMsg(2440, 0, 0);
2981 // Move caret right one word, position cursor at end of word.
2982 void wxStyledTextCtrl::WordRightEnd()
2984 SendMsg(2441, 0, 0);
2987 // Move caret right one word, position cursor at end of word, extending selection to new caret position.
2988 void wxStyledTextCtrl::WordRightEndExtend()
2990 SendMsg(2442, 0, 0);
2993 // Set the set of characters making up whitespace for when moving or selecting by word.
2994 // Should be called after SetWordChars.
2995 void wxStyledTextCtrl::SetWhitespaceChars(const wxString
& characters
)
2997 SendMsg(2443, 0, (long)(const char*)wx2stc(characters
));
3000 // Reset the set of characters for whitespace and word characters to the defaults.
3001 void wxStyledTextCtrl::SetCharsDefault()
3003 SendMsg(2444, 0, 0);
3006 // Get currently selected item position in the auto-completion list
3007 int wxStyledTextCtrl::AutoCompGetCurrent()
3009 return SendMsg(2445, 0, 0);
3012 // Enlarge the document to a particular size of text bytes.
3013 void wxStyledTextCtrl::Allocate(int bytes
)
3015 SendMsg(2446, bytes
, 0);
3018 // Find the position of a column on a line taking into account tabs and
3019 // multi-byte characters. If beyond end of line, return line end position.
3020 int wxStyledTextCtrl::FindColumn(int line
, int column
)
3022 return SendMsg(2456, line
, column
);
3025 // Can the caret preferred x position only be changed by explicit movement commands?
3026 bool wxStyledTextCtrl::GetCaretSticky() const
3028 return SendMsg(2457, 0, 0) != 0;
3031 // Stop the caret preferred x position changing when the user types.
3032 void wxStyledTextCtrl::SetCaretSticky(bool useCaretStickyBehaviour
)
3034 SendMsg(2458, useCaretStickyBehaviour
, 0);
3037 // Switch between sticky and non-sticky: meant to be bound to a key.
3038 void wxStyledTextCtrl::ToggleCaretSticky()
3040 SendMsg(2459, 0, 0);
3043 // Enable/Disable convert-on-paste for line endings
3044 void wxStyledTextCtrl::SetPasteConvertEndings(bool convert
)
3046 SendMsg(2467, convert
, 0);
3049 // Get convert-on-paste setting
3050 bool wxStyledTextCtrl::GetPasteConvertEndings() const
3052 return SendMsg(2468, 0, 0) != 0;
3055 // Duplicate the selection. If selection empty duplicate the line containing the caret.
3056 void wxStyledTextCtrl::SelectionDuplicate()
3058 SendMsg(2469, 0, 0);
3061 // Set background alpha of the caret line.
3062 void wxStyledTextCtrl::SetCaretLineBackAlpha(int alpha
)
3064 SendMsg(2470, alpha
, 0);
3067 // Get the background alpha of the caret line.
3068 int wxStyledTextCtrl::GetCaretLineBackAlpha() const
3070 return SendMsg(2471, 0, 0);
3073 // Set the style of the caret to be drawn.
3074 void wxStyledTextCtrl::SetCaretStyle(int caretStyle
)
3076 SendMsg(2512, caretStyle
, 0);
3079 // Returns the current style of the caret.
3080 int wxStyledTextCtrl::GetCaretStyle() const
3082 return SendMsg(2513, 0, 0);
3085 // Set the indicator used for IndicatorFillRange and IndicatorClearRange
3086 void wxStyledTextCtrl::SetIndicatorCurrent(int indicator
)
3088 SendMsg(2500, indicator
, 0);
3091 // Get the current indicator
3092 int wxStyledTextCtrl::GetIndicatorCurrent() const
3094 return SendMsg(2501, 0, 0);
3097 // Set the value used for IndicatorFillRange
3098 void wxStyledTextCtrl::SetIndicatorValue(int value
)
3100 SendMsg(2502, value
, 0);
3103 // Get the current indicator vaue
3104 int wxStyledTextCtrl::GetIndicatorValue() const
3106 return SendMsg(2503, 0, 0);
3109 // Turn a indicator on over a range.
3110 void wxStyledTextCtrl::IndicatorFillRange(int position
, int fillLength
)
3112 SendMsg(2504, position
, fillLength
);
3115 // Turn a indicator off over a range.
3116 void wxStyledTextCtrl::IndicatorClearRange(int position
, int clearLength
)
3118 SendMsg(2505, position
, clearLength
);
3121 // Are any indicators present at position?
3122 int wxStyledTextCtrl::IndicatorAllOnFor(int position
)
3124 return SendMsg(2506, position
, 0);
3127 // What value does a particular indicator have at at a position?
3128 int wxStyledTextCtrl::IndicatorValueAt(int indicator
, int position
)
3130 return SendMsg(2507, indicator
, position
);
3133 // Where does a particular indicator start?
3134 int wxStyledTextCtrl::IndicatorStart(int indicator
, int position
)
3136 return SendMsg(2508, indicator
, position
);
3139 // Where does a particular indicator end?
3140 int wxStyledTextCtrl::IndicatorEnd(int indicator
, int position
)
3142 return SendMsg(2509, indicator
, position
);
3145 // Set number of entries in position cache
3146 void wxStyledTextCtrl::SetPositionCacheSize(int size
)
3148 SendMsg(2514, size
, 0);
3151 // How many entries are allocated to the position cache?
3152 int wxStyledTextCtrl::GetPositionCacheSize() const
3154 return SendMsg(2515, 0, 0);
3157 // Start notifying the container of all key presses and commands.
3158 void wxStyledTextCtrl::StartRecord()
3160 SendMsg(3001, 0, 0);
3163 // Stop notifying the container of all key presses and commands.
3164 void wxStyledTextCtrl::StopRecord()
3166 SendMsg(3002, 0, 0);
3169 // Set the lexing language of the document.
3170 void wxStyledTextCtrl::SetLexer(int lexer
)
3172 SendMsg(4001, lexer
, 0);
3175 // Retrieve the lexing language of the document.
3176 int wxStyledTextCtrl::GetLexer() const
3178 return SendMsg(4002, 0, 0);
3181 // Colourise a segment of the document using the current lexing language.
3182 void wxStyledTextCtrl::Colourise(int start
, int end
)
3184 SendMsg(4003, start
, end
);
3187 // Set up a value that may be used by a lexer for some optional feature.
3188 void wxStyledTextCtrl::SetProperty(const wxString
& key
, const wxString
& value
)
3190 SendMsg(4004, (long)(const char*)wx2stc(key
), (long)(const char*)wx2stc(value
));
3193 // Set up the key words used by the lexer.
3194 void wxStyledTextCtrl::SetKeyWords(int keywordSet
, const wxString
& keyWords
)
3196 SendMsg(4005, keywordSet
, (long)(const char*)wx2stc(keyWords
));
3199 // Set the lexing language of the document based on string name.
3200 void wxStyledTextCtrl::SetLexerLanguage(const wxString
& language
)
3202 SendMsg(4006, 0, (long)(const char*)wx2stc(language
));
3205 // Retrieve a 'property' value previously set with SetProperty.
3206 wxString
wxStyledTextCtrl::GetProperty(const wxString
& key
) {
3207 int len
= SendMsg(SCI_GETPROPERTY
, (long)(const char*)wx2stc(key
), 0);
3208 if (!len
) return wxEmptyString
;
3210 wxMemoryBuffer
mbuf(len
+1);
3211 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3212 SendMsg(4008, (long)(const char*)wx2stc(key
), (long)buf
);
3213 mbuf
.UngetWriteBuf(len
);
3218 // Retrieve a 'property' value previously set with SetProperty,
3219 // with '$()' variable replacement on returned buffer.
3220 wxString
wxStyledTextCtrl::GetPropertyExpanded(const wxString
& key
) {
3221 int len
= SendMsg(SCI_GETPROPERTYEXPANDED
, (long)(const char*)wx2stc(key
), 0);
3222 if (!len
) return wxEmptyString
;
3224 wxMemoryBuffer
mbuf(len
+1);
3225 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
3226 SendMsg(4009, (long)(const char*)wx2stc(key
), (long)buf
);
3227 mbuf
.UngetWriteBuf(len
);
3232 // Retrieve a 'property' value previously set with SetProperty,
3233 // interpreted as an int AFTER any '$()' variable replacement.
3234 int wxStyledTextCtrl::GetPropertyInt(const wxString
& key
) const
3236 return SendMsg(4010, (long)(const char*)wx2stc(key
), 0);
3239 // Retrieve the number of bits the current lexer needs for styling.
3240 int wxStyledTextCtrl::GetStyleBitsNeeded() const
3242 return SendMsg(4011, 0, 0);
3245 // END of generated section
3246 //----------------------------------------------------------------------
3249 // Returns the line number of the line with the caret.
3250 int wxStyledTextCtrl::GetCurrentLine() {
3251 int line
= LineFromPosition(GetCurrentPos());
3256 // Extract style settings from a spec-string which is composed of one or
3257 // more of the following comma separated elements:
3259 // bold turns on bold
3260 // italic turns on italics
3261 // fore:[name or #RRGGBB] sets the foreground colour
3262 // back:[name or #RRGGBB] sets the background colour
3263 // face:[facename] sets the font face name to use
3264 // size:[num] sets the font size in points
3265 // eol turns on eol filling
3266 // underline turns on underlining
3268 void wxStyledTextCtrl::StyleSetSpec(int styleNum
, const wxString
& spec
) {
3270 wxStringTokenizer
tkz(spec
, wxT(","));
3271 while (tkz
.HasMoreTokens()) {
3272 wxString token
= tkz
.GetNextToken();
3274 wxString option
= token
.BeforeFirst(':');
3275 wxString val
= token
.AfterFirst(':');
3277 if (option
== wxT("bold"))
3278 StyleSetBold(styleNum
, true);
3280 else if (option
== wxT("italic"))
3281 StyleSetItalic(styleNum
, true);
3283 else if (option
== wxT("underline"))
3284 StyleSetUnderline(styleNum
, true);
3286 else if (option
== wxT("eol"))
3287 StyleSetEOLFilled(styleNum
, true);
3289 else if (option
== wxT("size")) {
3291 if (val
.ToLong(&points
))
3292 StyleSetSize(styleNum
, points
);
3295 else if (option
== wxT("face"))
3296 StyleSetFaceName(styleNum
, val
);
3298 else if (option
== wxT("fore"))
3299 StyleSetForeground(styleNum
, wxColourFromSpec(val
));
3301 else if (option
== wxT("back"))
3302 StyleSetBackground(styleNum
, wxColourFromSpec(val
));
3307 // Get the font of a style
3308 wxFont
wxStyledTextCtrl::StyleGetFont(int style
) {
3310 font
.SetPointSize(StyleGetSize(style
));
3311 font
.SetFaceName(StyleGetFaceName(style
));
3312 if( StyleGetBold(style
) )
3313 font
.SetWeight(wxFONTWEIGHT_BOLD
);
3315 font
.SetWeight(wxFONTWEIGHT_NORMAL
);
3317 if( StyleGetItalic(style
) )
3318 font
.SetStyle(wxFONTSTYLE_ITALIC
);
3320 font
.SetStyle(wxFONTSTYLE_NORMAL
);
3326 // Set style size, face, bold, italic, and underline attributes from
3327 // a wxFont's attributes.
3328 void wxStyledTextCtrl::StyleSetFont(int styleNum
, wxFont
& font
) {
3330 // Ensure that the native font is initialized
3332 GetTextExtent(wxT("X"), &x
, &y
, NULL
, NULL
, &font
);
3334 int size
= font
.GetPointSize();
3335 wxString faceName
= font
.GetFaceName();
3336 bool bold
= font
.GetWeight() == wxBOLD
;
3337 bool italic
= font
.GetStyle() != wxNORMAL
;
3338 bool under
= font
.GetUnderlined();
3339 wxFontEncoding encoding
= font
.GetEncoding();
3341 StyleSetFontAttr(styleNum
, size
, faceName
, bold
, italic
, under
, encoding
);
3344 // Set all font style attributes at once.
3345 void wxStyledTextCtrl::StyleSetFontAttr(int styleNum
, int size
,
3346 const wxString
& faceName
,
3347 bool bold
, bool italic
,
3349 wxFontEncoding encoding
) {
3350 StyleSetSize(styleNum
, size
);
3351 StyleSetFaceName(styleNum
, faceName
);
3352 StyleSetBold(styleNum
, bold
);
3353 StyleSetItalic(styleNum
, italic
);
3354 StyleSetUnderline(styleNum
, underline
);
3355 StyleSetFontEncoding(styleNum
, encoding
);
3359 // Set the character set of the font in a style. Converts the Scintilla
3360 // character set values to a wxFontEncoding.
3361 void wxStyledTextCtrl::StyleSetCharacterSet(int style
, int characterSet
)
3363 wxFontEncoding encoding
;
3365 // Translate the Scintilla characterSet to a wxFontEncoding
3366 switch (characterSet
) {
3368 case wxSTC_CHARSET_ANSI
:
3369 case wxSTC_CHARSET_DEFAULT
:
3370 encoding
= wxFONTENCODING_DEFAULT
;
3373 case wxSTC_CHARSET_BALTIC
:
3374 encoding
= wxFONTENCODING_ISO8859_13
;
3377 case wxSTC_CHARSET_CHINESEBIG5
:
3378 encoding
= wxFONTENCODING_CP950
;
3381 case wxSTC_CHARSET_EASTEUROPE
:
3382 encoding
= wxFONTENCODING_ISO8859_2
;
3385 case wxSTC_CHARSET_GB2312
:
3386 encoding
= wxFONTENCODING_CP936
;
3389 case wxSTC_CHARSET_GREEK
:
3390 encoding
= wxFONTENCODING_ISO8859_7
;
3393 case wxSTC_CHARSET_HANGUL
:
3394 encoding
= wxFONTENCODING_CP949
;
3397 case wxSTC_CHARSET_MAC
:
3398 encoding
= wxFONTENCODING_DEFAULT
;
3401 case wxSTC_CHARSET_OEM
:
3402 encoding
= wxFONTENCODING_DEFAULT
;
3405 case wxSTC_CHARSET_RUSSIAN
:
3406 encoding
= wxFONTENCODING_KOI8
;
3409 case wxSTC_CHARSET_SHIFTJIS
:
3410 encoding
= wxFONTENCODING_CP932
;
3413 case wxSTC_CHARSET_SYMBOL
:
3414 encoding
= wxFONTENCODING_DEFAULT
;
3417 case wxSTC_CHARSET_TURKISH
:
3418 encoding
= wxFONTENCODING_ISO8859_9
;
3421 case wxSTC_CHARSET_JOHAB
:
3422 encoding
= wxFONTENCODING_DEFAULT
;
3425 case wxSTC_CHARSET_HEBREW
:
3426 encoding
= wxFONTENCODING_ISO8859_8
;
3429 case wxSTC_CHARSET_ARABIC
:
3430 encoding
= wxFONTENCODING_ISO8859_6
;
3433 case wxSTC_CHARSET_VIETNAMESE
:
3434 encoding
= wxFONTENCODING_DEFAULT
;
3437 case wxSTC_CHARSET_THAI
:
3438 encoding
= wxFONTENCODING_ISO8859_11
;
3441 case wxSTC_CHARSET_CYRILLIC
:
3442 encoding
= wxFONTENCODING_ISO8859_5
;
3445 case wxSTC_CHARSET_8859_15
:
3446 encoding
= wxFONTENCODING_ISO8859_15
;;
3450 // We just have Scintilla track the wxFontEncoding for us. It gets used
3451 // in Font::Create in PlatWX.cpp. We add one to the value so that the
3452 // effective wxFONENCODING_DEFAULT == SC_SHARSET_DEFAULT and so when
3453 // Scintilla internally uses SC_CHARSET_DEFAULT we will translate it back
3454 // to wxFONENCODING_DEFAULT in Font::Create.
3455 SendMsg(SCI_STYLESETCHARACTERSET
, style
, encoding
+1);
3459 // Set the font encoding to be used by a style.
3460 void wxStyledTextCtrl::StyleSetFontEncoding(int style
, wxFontEncoding encoding
)
3462 SendMsg(SCI_STYLESETCHARACTERSET
, style
, encoding
+1);
3466 // Perform one of the operations defined by the wxSTC_CMD_* constants.
3467 void wxStyledTextCtrl::CmdKeyExecute(int cmd
) {
3472 // Set the left and right margin in the edit area, measured in pixels.
3473 void wxStyledTextCtrl::SetMargins(int left
, int right
) {
3474 SetMarginLeft(left
);
3475 SetMarginRight(right
);
3479 // Retrieve the start and end positions of the current selection.
3480 void wxStyledTextCtrl::GetSelection(int* startPos
, int* endPos
) {
3481 if (startPos
!= NULL
)
3482 *startPos
= SendMsg(SCI_GETSELECTIONSTART
);
3484 *endPos
= SendMsg(SCI_GETSELECTIONEND
);
3488 // Retrieve the point in the window where a position is displayed.
3489 wxPoint
wxStyledTextCtrl::PointFromPosition(int pos
) {
3490 int x
= SendMsg(SCI_POINTXFROMPOSITION
, 0, pos
);
3491 int y
= SendMsg(SCI_POINTYFROMPOSITION
, 0, pos
);
3492 return wxPoint(x
, y
);
3495 // Scroll enough to make the given line visible
3496 void wxStyledTextCtrl::ScrollToLine(int line
) {
3497 m_swx
->DoScrollToLine(line
);
3501 // Scroll enough to make the given column visible
3502 void wxStyledTextCtrl::ScrollToColumn(int column
) {
3503 m_swx
->DoScrollToColumn(column
);
3507 bool wxStyledTextCtrl::SaveFile(const wxString
& filename
)
3509 wxFile
file(filename
, wxFile::write
);
3511 if (!file
.IsOpened())
3514 bool success
= file
.Write(GetText(), *wxConvCurrent
);
3522 bool wxStyledTextCtrl::LoadFile(const wxString
& filename
)
3524 bool success
= false;
3525 wxFile
file(filename
, wxFile::read
);
3527 if (file
.IsOpened())
3530 // get the file size (assume it is not huge file...)
3531 ssize_t len
= (ssize_t
)file
.Length();
3536 wxMemoryBuffer
buffer(len
+1);
3537 success
= (file
.Read(buffer
.GetData(), len
) == len
);
3539 ((char*)buffer
.GetData())[len
] = 0;
3540 contents
= wxString(buffer
, *wxConvCurrent
, len
);
3544 success
= (file
.Read(wxStringBuffer(buffer
, len
), len
) == len
);
3551 success
= true; // empty file is ok
3553 success
= false; // len == wxInvalidOffset
3568 #if wxUSE_DRAG_AND_DROP
3569 wxDragResult
wxStyledTextCtrl::DoDragOver(wxCoord x
, wxCoord y
, wxDragResult def
) {
3570 return m_swx
->DoDragOver(x
, y
, def
);
3574 bool wxStyledTextCtrl::DoDropText(long x
, long y
, const wxString
& data
) {
3575 return m_swx
->DoDropText(x
, y
, data
);
3580 void wxStyledTextCtrl::SetUseAntiAliasing(bool useAA
) {
3581 m_swx
->SetUseAntiAliasing(useAA
);
3584 bool wxStyledTextCtrl::GetUseAntiAliasing() {
3585 return m_swx
->GetUseAntiAliasing();
3592 void wxStyledTextCtrl::AddTextRaw(const char* text
)
3594 SendMsg(SCI_ADDTEXT
, strlen(text
), (long)text
);
3597 void wxStyledTextCtrl::InsertTextRaw(int pos
, const char* text
)
3599 SendMsg(SCI_INSERTTEXT
, pos
, (long)text
);
3602 wxCharBuffer
wxStyledTextCtrl::GetCurLineRaw(int* linePos
)
3604 int len
= LineLength(GetCurrentLine());
3606 if (linePos
) *linePos
= 0;
3611 wxCharBuffer
buf(len
);
3612 int pos
= SendMsg(SCI_GETCURLINE
, len
, (long)buf
.data());
3613 if (linePos
) *linePos
= pos
;
3617 wxCharBuffer
wxStyledTextCtrl::GetLineRaw(int line
)
3619 int len
= LineLength(line
);
3625 wxCharBuffer
buf(len
);
3626 SendMsg(SCI_GETLINE
, line
, (long)buf
.data());
3630 wxCharBuffer
wxStyledTextCtrl::GetSelectedTextRaw()
3635 GetSelection(&start
, &end
);
3636 int len
= end
- start
;
3642 wxCharBuffer
buf(len
);
3643 SendMsg(SCI_GETSELTEXT
, 0, (long)buf
.data());
3647 wxCharBuffer
wxStyledTextCtrl::GetTextRangeRaw(int startPos
, int endPos
)
3649 if (endPos
< startPos
) {
3650 int temp
= startPos
;
3654 int len
= endPos
- startPos
;
3660 wxCharBuffer
buf(len
);
3662 tr
.lpstrText
= buf
.data();
3663 tr
.chrg
.cpMin
= startPos
;
3664 tr
.chrg
.cpMax
= endPos
;
3665 SendMsg(SCI_GETTEXTRANGE
, 0, (long)&tr
);
3669 void wxStyledTextCtrl::SetTextRaw(const char* text
)
3671 SendMsg(SCI_SETTEXT
, 0, (long)text
);
3674 wxCharBuffer
wxStyledTextCtrl::GetTextRaw()
3676 int len
= GetTextLength();
3677 wxCharBuffer
buf(len
);
3678 SendMsg(SCI_GETTEXT
, len
, (long)buf
.data());
3682 void wxStyledTextCtrl::AppendTextRaw(const char* text
)
3684 SendMsg(SCI_APPENDTEXT
, strlen(text
), (long)text
);
3691 //----------------------------------------------------------------------
3694 void wxStyledTextCtrl::OnPaint(wxPaintEvent
& WXUNUSED(evt
)) {
3696 m_swx
->DoPaint(&dc
, GetUpdateRegion().GetBox());
3699 void wxStyledTextCtrl::OnScrollWin(wxScrollWinEvent
& evt
) {
3700 if (evt
.GetOrientation() == wxHORIZONTAL
)
3701 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
3703 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
3706 void wxStyledTextCtrl::OnScroll(wxScrollEvent
& evt
) {
3707 wxScrollBar
* sb
= wxDynamicCast(evt
.GetEventObject(), wxScrollBar
);
3709 if (sb
->IsVertical())
3710 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
3712 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
3716 void wxStyledTextCtrl::OnSize(wxSizeEvent
& WXUNUSED(evt
)) {
3718 wxSize sz
= GetClientSize();
3719 m_swx
->DoSize(sz
.x
, sz
.y
);
3723 void wxStyledTextCtrl::OnMouseLeftDown(wxMouseEvent
& evt
) {
3725 wxPoint pt
= evt
.GetPosition();
3726 m_swx
->DoLeftButtonDown(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
3727 evt
.ShiftDown(), evt
.ControlDown(), evt
.AltDown());
3730 void wxStyledTextCtrl::OnMouseMove(wxMouseEvent
& evt
) {
3731 wxPoint pt
= evt
.GetPosition();
3732 m_swx
->DoLeftButtonMove(Point(pt
.x
, pt
.y
));
3735 void wxStyledTextCtrl::OnMouseLeftUp(wxMouseEvent
& evt
) {
3736 wxPoint pt
= evt
.GetPosition();
3737 m_swx
->DoLeftButtonUp(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
3742 void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent
& evt
) {
3743 wxPoint pt
= evt
.GetPosition();
3744 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
3748 void wxStyledTextCtrl::OnMouseMiddleUp(wxMouseEvent
& evt
) {
3749 wxPoint pt
= evt
.GetPosition();
3750 m_swx
->DoMiddleButtonUp(Point(pt
.x
, pt
.y
));
3753 void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent
& evt
) {
3754 wxPoint pt
= evt
.GetPosition();
3755 ScreenToClient(&pt
.x
, &pt
.y
);
3757 Show context menu at event point if it's within the window,
3758 or at caret location if not
3760 wxHitTest ht
= this->HitTest(pt
);
3761 if (ht
!= wxHT_WINDOW_INSIDE
) {
3762 pt
= this->PointFromPosition(this->GetCurrentPos());
3764 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
3768 void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent
& evt
) {
3769 m_swx
->DoMouseWheel(evt
.GetWheelRotation(),
3770 evt
.GetWheelDelta(),
3771 evt
.GetLinesPerAction(),
3773 evt
.IsPageScroll());
3777 void wxStyledTextCtrl::OnChar(wxKeyEvent
& evt
) {
3778 // On (some?) non-US PC keyboards the AltGr key is required to enter some
3779 // common characters. It comes to us as both Alt and Ctrl down so we need
3780 // to let the char through in that case, otherwise if only ctrl or only
3781 // alt let's skip it.
3782 bool ctrl
= evt
.ControlDown();
3784 // On the Mac the Alt key is just a modifier key (like Shift) so we need
3785 // to allow the char events to be processed when Alt is pressed.
3786 // TODO: Should we check MetaDown instead in this case?
3789 bool alt
= evt
.AltDown();
3791 bool skip
= ((ctrl
|| alt
) && ! (ctrl
&& alt
));
3794 // apparently if we don't do this, Unicode keys pressed after non-char
3795 // ASCII ones (e.g. Enter, Tab) are not taken into account (patch 1615989)
3796 if (m_lastKeyDownConsumed
&& evt
.GetUnicodeKey() > 255)
3797 m_lastKeyDownConsumed
= false;
3800 if (!m_lastKeyDownConsumed
&& !skip
) {
3802 int key
= evt
.GetUnicodeKey();
3805 // if the unicode key code is not really a unicode character (it may
3806 // be a function key or etc., the platforms appear to always give us a
3807 // small value in this case) then fallback to the ascii key code but
3808 // don't do anything for function keys or etc.
3810 key
= evt
.GetKeyCode();
3811 keyOk
= (key
<= 127);
3814 m_swx
->DoAddChar(key
);
3818 int key
= evt
.GetKeyCode();
3819 if (key
<= WXK_START
|| key
> WXK_COMMAND
) {
3820 m_swx
->DoAddChar(key
);
3830 void wxStyledTextCtrl::OnKeyDown(wxKeyEvent
& evt
) {
3831 int processed
= m_swx
->DoKeyDown(evt
, &m_lastKeyDownConsumed
);
3832 if (!processed
&& !m_lastKeyDownConsumed
)
3837 void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent
& evt
) {
3838 m_swx
->DoLoseFocus();
3843 void wxStyledTextCtrl::OnGainFocus(wxFocusEvent
& evt
) {
3844 m_swx
->DoGainFocus();
3849 void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent
& WXUNUSED(evt
)) {
3850 m_swx
->DoSysColourChange();
3854 void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent
& WXUNUSED(evt
)) {
3855 // do nothing to help avoid flashing
3860 void wxStyledTextCtrl::OnMenu(wxCommandEvent
& evt
) {
3861 m_swx
->DoCommand(evt
.GetId());
3865 void wxStyledTextCtrl::OnListBox(wxCommandEvent
& WXUNUSED(evt
)) {
3866 m_swx
->DoOnListBox();
3870 void wxStyledTextCtrl::OnIdle(wxIdleEvent
& evt
) {
3871 m_swx
->DoOnIdle(evt
);
3875 wxSize
wxStyledTextCtrl::DoGetBestSize() const
3877 // What would be the best size for a wxSTC?
3878 // Just give a reasonable minimum until something else can be figured out.
3879 return wxSize(200,100);
3883 //----------------------------------------------------------------------
3884 // Turn notifications from Scintilla into events
3887 void wxStyledTextCtrl::NotifyChange() {
3888 wxStyledTextEvent
evt(wxEVT_STC_CHANGE
, GetId());
3889 evt
.SetEventObject(this);
3890 GetEventHandler()->ProcessEvent(evt
);
3894 static void SetEventText(wxStyledTextEvent
& evt
, const char* text
,
3898 evt
.SetText(stc2wx(text
, length
));
3902 void wxStyledTextCtrl::NotifyParent(SCNotification
* _scn
) {
3903 SCNotification
& scn
= *_scn
;
3904 wxStyledTextEvent
evt(0, GetId());
3906 evt
.SetEventObject(this);
3907 evt
.SetPosition(scn
.position
);
3909 evt
.SetModifiers(scn
.modifiers
);
3911 switch (scn
.nmhdr
.code
) {
3912 case SCN_STYLENEEDED
:
3913 evt
.SetEventType(wxEVT_STC_STYLENEEDED
);
3917 evt
.SetEventType(wxEVT_STC_CHARADDED
);
3920 case SCN_SAVEPOINTREACHED
:
3921 evt
.SetEventType(wxEVT_STC_SAVEPOINTREACHED
);
3924 case SCN_SAVEPOINTLEFT
:
3925 evt
.SetEventType(wxEVT_STC_SAVEPOINTLEFT
);
3928 case SCN_MODIFYATTEMPTRO
:
3929 evt
.SetEventType(wxEVT_STC_ROMODIFYATTEMPT
);
3933 evt
.SetEventType(wxEVT_STC_KEY
);
3936 case SCN_DOUBLECLICK
:
3937 evt
.SetEventType(wxEVT_STC_DOUBLECLICK
);
3941 evt
.SetEventType(wxEVT_STC_UPDATEUI
);
3945 evt
.SetEventType(wxEVT_STC_MODIFIED
);
3946 evt
.SetModificationType(scn
.modificationType
);
3947 SetEventText(evt
, scn
.text
, scn
.length
);
3948 evt
.SetLength(scn
.length
);
3949 evt
.SetLinesAdded(scn
.linesAdded
);
3950 evt
.SetLine(scn
.line
);
3951 evt
.SetFoldLevelNow(scn
.foldLevelNow
);
3952 evt
.SetFoldLevelPrev(scn
.foldLevelPrev
);
3955 case SCN_MACRORECORD
:
3956 evt
.SetEventType(wxEVT_STC_MACRORECORD
);
3957 evt
.SetMessage(scn
.message
);
3958 evt
.SetWParam(scn
.wParam
);
3959 evt
.SetLParam(scn
.lParam
);
3962 case SCN_MARGINCLICK
:
3963 evt
.SetEventType(wxEVT_STC_MARGINCLICK
);
3964 evt
.SetMargin(scn
.margin
);
3968 evt
.SetEventType(wxEVT_STC_NEEDSHOWN
);
3969 evt
.SetLength(scn
.length
);
3973 evt
.SetEventType(wxEVT_STC_PAINTED
);
3976 case SCN_AUTOCSELECTION
:
3977 evt
.SetEventType(wxEVT_STC_AUTOCOMP_SELECTION
);
3978 evt
.SetListType(scn
.listType
);
3979 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
3980 evt
.SetPosition(scn
.lParam
);
3983 case SCN_USERLISTSELECTION
:
3984 evt
.SetEventType(wxEVT_STC_USERLISTSELECTION
);
3985 evt
.SetListType(scn
.listType
);
3986 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
3987 evt
.SetPosition(scn
.lParam
);
3990 case SCN_URIDROPPED
:
3991 evt
.SetEventType(wxEVT_STC_URIDROPPED
);
3992 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
3995 case SCN_DWELLSTART
:
3996 evt
.SetEventType(wxEVT_STC_DWELLSTART
);
4002 evt
.SetEventType(wxEVT_STC_DWELLEND
);
4008 evt
.SetEventType(wxEVT_STC_ZOOM
);
4011 case SCN_HOTSPOTCLICK
:
4012 evt
.SetEventType(wxEVT_STC_HOTSPOT_CLICK
);
4015 case SCN_HOTSPOTDOUBLECLICK
:
4016 evt
.SetEventType(wxEVT_STC_HOTSPOT_DCLICK
);
4019 case SCN_CALLTIPCLICK
:
4020 evt
.SetEventType(wxEVT_STC_CALLTIP_CLICK
);
4023 case SCN_INDICATORCLICK
:
4024 evt
.SetEventType(wxEVT_STC_INDICATOR_CLICK
);
4027 case SCN_INDICATORRELEASE
:
4028 evt
.SetEventType(wxEVT_STC_INDICATOR_RELEASE
);
4035 GetEventHandler()->ProcessEvent(evt
);
4039 //----------------------------------------------------------------------
4040 //----------------------------------------------------------------------
4041 //----------------------------------------------------------------------
4043 wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType
, int id
)
4044 : wxCommandEvent(commandType
, id
)
4049 m_modificationType
= 0;
4054 m_foldLevelPrev
= 0;
4062 m_dragAllowMove
= false;
4063 #if wxUSE_DRAG_AND_DROP
4064 m_dragResult
= wxDragNone
;
4068 bool wxStyledTextEvent::GetShift() const { return (m_modifiers
& SCI_SHIFT
) != 0; }
4069 bool wxStyledTextEvent::GetControl() const { return (m_modifiers
& SCI_CTRL
) != 0; }
4070 bool wxStyledTextEvent::GetAlt() const { return (m_modifiers
& SCI_ALT
) != 0; }
4073 wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent
& event
):
4074 wxCommandEvent(event
)
4076 m_position
= event
.m_position
;
4077 m_key
= event
.m_key
;
4078 m_modifiers
= event
.m_modifiers
;
4079 m_modificationType
= event
.m_modificationType
;
4080 m_text
= event
.m_text
;
4081 m_length
= event
.m_length
;
4082 m_linesAdded
= event
.m_linesAdded
;
4083 m_line
= event
.m_line
;
4084 m_foldLevelNow
= event
.m_foldLevelNow
;
4085 m_foldLevelPrev
= event
.m_foldLevelPrev
;
4087 m_margin
= event
.m_margin
;
4089 m_message
= event
.m_message
;
4090 m_wParam
= event
.m_wParam
;
4091 m_lParam
= event
.m_lParam
;
4093 m_listType
= event
.m_listType
;
4097 m_dragText
= event
.m_dragText
;
4098 m_dragAllowMove
=event
.m_dragAllowMove
;
4099 #if wxUSE_DRAG_AND_DROP
4100 m_dragResult
= event
.m_dragResult
;
4104 //----------------------------------------------------------------------
4105 //----------------------------------------------------------------------