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 /////////////////////////////////////////////////////////////////////////////
20 #include "wx/stc/stc.h"
21 #include "ScintillaWX.h"
24 #include <wx/tokenzr.h>
25 #include <wx/mstream.h>
30 //----------------------------------------------------------------------
32 const wxChar
* wxSTCNameStr
= wxT("stcwindow");
38 #define MAKELONG(a, b) ((a) | ((b) << 16))
41 static long wxColourAsLong(const wxColour
& co
) {
42 return (((long)co
.Blue() << 16) |
43 ((long)co
.Green() << 8) |
47 static wxColour
wxColourFromLong(long c
) {
49 clr
.Set(c
& 0xff, (c
>> 8) & 0xff, (c
>> 16) & 0xff);
54 static wxColour
wxColourFromSpec(const wxString
& spec
) {
55 // spec should be "#RRGGBB"
56 long red
, green
, blue
;
57 red
= green
= blue
= 0;
58 spec
.Mid(1,2).ToLong(&red
, 16);
59 spec
.Mid(3,2).ToLong(&green
, 16);
60 spec
.Mid(5,2).ToLong(&blue
, 16);
61 return wxColour(red
, green
, blue
);
64 //----------------------------------------------------------------------
66 DEFINE_EVENT_TYPE( wxEVT_STC_CHANGE
)
67 DEFINE_EVENT_TYPE( wxEVT_STC_STYLENEEDED
)
68 DEFINE_EVENT_TYPE( wxEVT_STC_CHARADDED
)
69 DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTREACHED
)
70 DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTLEFT
)
71 DEFINE_EVENT_TYPE( wxEVT_STC_ROMODIFYATTEMPT
)
72 DEFINE_EVENT_TYPE( wxEVT_STC_KEY
)
73 DEFINE_EVENT_TYPE( wxEVT_STC_DOUBLECLICK
)
74 DEFINE_EVENT_TYPE( wxEVT_STC_UPDATEUI
)
75 DEFINE_EVENT_TYPE( wxEVT_STC_MODIFIED
)
76 DEFINE_EVENT_TYPE( wxEVT_STC_MACRORECORD
)
77 DEFINE_EVENT_TYPE( wxEVT_STC_MARGINCLICK
)
78 DEFINE_EVENT_TYPE( wxEVT_STC_NEEDSHOWN
)
79 DEFINE_EVENT_TYPE( wxEVT_STC_PAINTED
)
80 DEFINE_EVENT_TYPE( wxEVT_STC_USERLISTSELECTION
)
81 DEFINE_EVENT_TYPE( wxEVT_STC_URIDROPPED
)
82 DEFINE_EVENT_TYPE( wxEVT_STC_DWELLSTART
)
83 DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND
)
84 DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG
)
85 DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER
)
86 DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP
)
87 DEFINE_EVENT_TYPE( wxEVT_STC_ZOOM
)
88 DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_CLICK
)
89 DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_DCLICK
)
90 DEFINE_EVENT_TYPE( wxEVT_STC_CALLTIP_CLICK
)
94 BEGIN_EVENT_TABLE(wxStyledTextCtrl
, wxControl
)
95 EVT_PAINT (wxStyledTextCtrl::OnPaint
)
96 EVT_SCROLLWIN (wxStyledTextCtrl::OnScrollWin
)
97 EVT_SCROLL (wxStyledTextCtrl::OnScroll
)
98 EVT_SIZE (wxStyledTextCtrl::OnSize
)
99 EVT_LEFT_DOWN (wxStyledTextCtrl::OnMouseLeftDown
)
100 // Let Scintilla see the double click as a second click
101 EVT_LEFT_DCLICK (wxStyledTextCtrl::OnMouseLeftDown
)
102 EVT_MOTION (wxStyledTextCtrl::OnMouseMove
)
103 EVT_LEFT_UP (wxStyledTextCtrl::OnMouseLeftUp
)
104 #if defined(__WXGTK__) || defined(__WXMAC__)
105 EVT_RIGHT_UP (wxStyledTextCtrl::OnMouseRightUp
)
107 EVT_CONTEXT_MENU (wxStyledTextCtrl::OnContextMenu
)
109 EVT_MOUSEWHEEL (wxStyledTextCtrl::OnMouseWheel
)
110 EVT_MIDDLE_UP (wxStyledTextCtrl::OnMouseMiddleUp
)
111 EVT_CHAR (wxStyledTextCtrl::OnChar
)
112 EVT_KEY_DOWN (wxStyledTextCtrl::OnKeyDown
)
113 EVT_KILL_FOCUS (wxStyledTextCtrl::OnLoseFocus
)
114 EVT_SET_FOCUS (wxStyledTextCtrl::OnGainFocus
)
115 EVT_SYS_COLOUR_CHANGED (wxStyledTextCtrl::OnSysColourChanged
)
116 EVT_ERASE_BACKGROUND (wxStyledTextCtrl::OnEraseBackground
)
117 EVT_MENU_RANGE (10, 16, wxStyledTextCtrl::OnMenu
)
118 EVT_LISTBOX_DCLICK (-1, wxStyledTextCtrl::OnListBox
)
122 IMPLEMENT_CLASS(wxStyledTextCtrl
, wxControl
)
123 IMPLEMENT_DYNAMIC_CLASS(wxStyledTextEvent
, wxCommandEvent
)
126 // forces the linking of the lexer modules
127 int Scintilla_LinkLexers();
130 //----------------------------------------------------------------------
131 // Constructor and Destructor
133 wxStyledTextCtrl::wxStyledTextCtrl(wxWindow
*parent
,
138 const wxString
& name
)
141 Create(parent
, id
, pos
, size
, style
, name
);
145 void wxStyledTextCtrl::Create(wxWindow
*parent
,
150 const wxString
& name
)
153 style
|= wxVSCROLL
| wxHSCROLL
;
155 wxControl::Create(parent
, id
, pos
, size
,
156 style
| wxWANTS_CHARS
| wxCLIP_CHILDREN
,
157 wxDefaultValidator
, name
);
160 Scintilla_LinkLexers();
162 m_swx
= new ScintillaWX(this);
164 m_lastKeyDownConsumed
= FALSE
;
168 // Put Scintilla into unicode (UTF-8) mode
169 SetCodePage(wxSTC_CP_UTF8
);
172 SetBestFittingSize(size
);
176 wxStyledTextCtrl::~wxStyledTextCtrl() {
181 //----------------------------------------------------------------------
183 long wxStyledTextCtrl::SendMsg(int msg
, long wp
, long lp
) {
185 return m_swx
->WndProc(msg
, wp
, lp
);
190 //----------------------------------------------------------------------
191 // BEGIN generated section. The following code is automatically generated
192 // by gen_iface.py from the contents of Scintilla.iface. Do not edit
193 // this file. Edit stc.cpp.in or gen_iface.py instead and regenerate.
196 // Add text to the document.
197 void wxStyledTextCtrl::AddText(const wxString
& text
) {
198 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
199 SendMsg(2001, strlen(buf
), (long)(const char*)buf
);
202 // Add array of cells to document.
203 void wxStyledTextCtrl::AddStyledText(const wxMemoryBuffer
& data
) {
204 SendMsg(2002, data
.GetDataLen(), (long)data
.GetData());
207 // Insert string at a position.
208 void wxStyledTextCtrl::InsertText(int pos
, const wxString
& text
) {
209 SendMsg(2003, pos
, (long)(const char*)wx2stc(text
));
212 // Delete all text in the document.
213 void wxStyledTextCtrl::ClearAll() {
217 // Set all style bytes to 0, remove all folding information.
218 void wxStyledTextCtrl::ClearDocumentStyle() {
222 // The number of characters in the document.
223 int wxStyledTextCtrl::GetLength() {
224 return SendMsg(2006, 0, 0);
227 // Returns the character byte at the position.
228 int wxStyledTextCtrl::GetCharAt(int pos
) {
229 return (unsigned char)SendMsg(2007, pos
, 0);
232 // Returns the position of the caret.
233 int wxStyledTextCtrl::GetCurrentPos() {
234 return SendMsg(2008, 0, 0);
237 // Returns the position of the opposite end of the selection to the caret.
238 int wxStyledTextCtrl::GetAnchor() {
239 return SendMsg(2009, 0, 0);
242 // Returns the style byte at the position.
243 int wxStyledTextCtrl::GetStyleAt(int pos
) {
244 return (unsigned char)SendMsg(2010, pos
, 0);
247 // Redoes the next action on the undo history.
248 void wxStyledTextCtrl::Redo() {
252 // Choose between collecting actions into the undo
253 // history and discarding them.
254 void wxStyledTextCtrl::SetUndoCollection(bool collectUndo
) {
255 SendMsg(2012, collectUndo
, 0);
258 // Select all the text in the document.
259 void wxStyledTextCtrl::SelectAll() {
263 // Remember the current position in the undo history as the position
264 // at which the document was saved.
265 void wxStyledTextCtrl::SetSavePoint() {
269 // Retrieve a buffer of cells.
270 wxMemoryBuffer
wxStyledTextCtrl::GetStyledText(int startPos
, int endPos
) {
272 if (endPos
< startPos
) {
277 int len
= endPos
- startPos
;
278 if (!len
) return buf
;
280 tr
.lpstrText
= (char*)buf
.GetWriteBuf(len
*2+1);
281 tr
.chrg
.cpMin
= startPos
;
282 tr
.chrg
.cpMax
= endPos
;
283 len
= SendMsg(2015, 0, (long)&tr
);
284 buf
.UngetWriteBuf(len
);
288 // Are there any redoable actions in the undo history?
289 bool wxStyledTextCtrl::CanRedo() {
290 return SendMsg(2016, 0, 0) != 0;
293 // Retrieve the line number at which a particular marker is located.
294 int wxStyledTextCtrl::MarkerLineFromHandle(int handle
) {
295 return SendMsg(2017, handle
, 0);
299 void wxStyledTextCtrl::MarkerDeleteHandle(int handle
) {
300 SendMsg(2018, handle
, 0);
303 // Is undo history being collected?
304 bool wxStyledTextCtrl::GetUndoCollection() {
305 return SendMsg(2019, 0, 0) != 0;
308 // Are white space characters currently visible?
309 // Returns one of SCWS_* constants.
310 int wxStyledTextCtrl::GetViewWhiteSpace() {
311 return SendMsg(2020, 0, 0);
314 // Make white space characters invisible, always visible or visible outside indentation.
315 void wxStyledTextCtrl::SetViewWhiteSpace(int viewWS
) {
316 SendMsg(2021, viewWS
, 0);
319 // Find the position from a point within the window.
320 int wxStyledTextCtrl::PositionFromPoint(wxPoint pt
) {
321 return SendMsg(2022, pt
.x
, pt
.y
);
324 // Find the position from a point within the window but return
325 // INVALID_POSITION if not close to text.
326 int wxStyledTextCtrl::PositionFromPointClose(int x
, int y
) {
327 return SendMsg(2023, x
, y
);
330 // Set caret to start of a line and ensure it is visible.
331 void wxStyledTextCtrl::GotoLine(int line
) {
332 SendMsg(2024, line
, 0);
335 // Set caret to a position and ensure it is visible.
336 void wxStyledTextCtrl::GotoPos(int pos
) {
337 SendMsg(2025, pos
, 0);
340 // Set the selection anchor to a position. The anchor is the opposite
341 // end of the selection from the caret.
342 void wxStyledTextCtrl::SetAnchor(int posAnchor
) {
343 SendMsg(2026, posAnchor
, 0);
346 // Retrieve the text of the line containing the caret.
347 // Returns the index of the caret on the line.
348 wxString
wxStyledTextCtrl::GetCurLine(int* linePos
) {
349 int len
= LineLength(GetCurrentLine());
351 if (linePos
) *linePos
= 0;
352 return wxEmptyString
;
355 wxMemoryBuffer
mbuf(len
+1);
356 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
358 int pos
= SendMsg(2027, len
+1, (long)buf
);
359 mbuf
.UngetWriteBuf(len
);
361 if (linePos
) *linePos
= pos
;
365 // Retrieve the position of the last correctly styled character.
366 int wxStyledTextCtrl::GetEndStyled() {
367 return SendMsg(2028, 0, 0);
370 // Convert all line endings in the document to one mode.
371 void wxStyledTextCtrl::ConvertEOLs(int eolMode
) {
372 SendMsg(2029, eolMode
, 0);
375 // Retrieve the current end of line mode - one of CRLF, CR, or LF.
376 int wxStyledTextCtrl::GetEOLMode() {
377 return SendMsg(2030, 0, 0);
380 // Set the current end of line mode.
381 void wxStyledTextCtrl::SetEOLMode(int eolMode
) {
382 SendMsg(2031, eolMode
, 0);
385 // Set the current styling position to pos and the styling mask to mask.
386 // The styling mask can be used to protect some bits in each styling byte from modification.
387 void wxStyledTextCtrl::StartStyling(int pos
, int mask
) {
388 SendMsg(2032, pos
, mask
);
391 // Change style from current styling position for length characters to a style
392 // and move the current styling position to after this newly styled segment.
393 void wxStyledTextCtrl::SetStyling(int length
, int style
) {
394 SendMsg(2033, length
, style
);
397 // Is drawing done first into a buffer or direct to the screen?
398 bool wxStyledTextCtrl::GetBufferedDraw() {
399 return SendMsg(2034, 0, 0) != 0;
402 // If drawing is buffered then each line of text is drawn into a bitmap buffer
403 // before drawing it to the screen to avoid flicker.
404 void wxStyledTextCtrl::SetBufferedDraw(bool buffered
) {
405 SendMsg(2035, buffered
, 0);
408 // Change the visible size of a tab to be a multiple of the width of a space character.
409 void wxStyledTextCtrl::SetTabWidth(int tabWidth
) {
410 SendMsg(2036, tabWidth
, 0);
413 // Retrieve the visible size of a tab.
414 int wxStyledTextCtrl::GetTabWidth() {
415 return SendMsg(2121, 0, 0);
418 // Set the code page used to interpret the bytes of the document as characters.
419 void wxStyledTextCtrl::SetCodePage(int codePage
) {
421 wxASSERT_MSG(codePage
== wxSTC_CP_UTF8
,
422 wxT("Only wxSTC_CP_UTF8 may be used when wxUSE_UNICODE is on."));
424 wxASSERT_MSG(codePage
!= wxSTC_CP_UTF8
,
425 wxT("wxSTC_CP_UTF8 may not be used when wxUSE_UNICODE is off."));
427 SendMsg(2037, codePage
);
430 // Set the symbol used for a particular marker number,
431 // and optionally the fore and background colours.
432 void wxStyledTextCtrl::MarkerDefine(int markerNumber
, int markerSymbol
,
433 const wxColour
& foreground
,
434 const wxColour
& background
) {
436 SendMsg(2040, markerNumber
, markerSymbol
);
438 MarkerSetForeground(markerNumber
, foreground
);
440 MarkerSetBackground(markerNumber
, background
);
443 // Set the foreground colour used for a particular marker number.
444 void wxStyledTextCtrl::MarkerSetForeground(int markerNumber
, const wxColour
& fore
) {
445 SendMsg(2041, markerNumber
, wxColourAsLong(fore
));
448 // Set the background colour used for a particular marker number.
449 void wxStyledTextCtrl::MarkerSetBackground(int markerNumber
, const wxColour
& back
) {
450 SendMsg(2042, markerNumber
, wxColourAsLong(back
));
453 // Add a marker to a line, returning an ID which can be used to find or delete the marker.
454 int wxStyledTextCtrl::MarkerAdd(int line
, int markerNumber
) {
455 return SendMsg(2043, line
, markerNumber
);
458 // Delete a marker from a line.
459 void wxStyledTextCtrl::MarkerDelete(int line
, int markerNumber
) {
460 SendMsg(2044, line
, markerNumber
);
463 // Delete all markers with a particular number from all lines.
464 void wxStyledTextCtrl::MarkerDeleteAll(int markerNumber
) {
465 SendMsg(2045, markerNumber
, 0);
468 // Get a bit mask of all the markers set on a line.
469 int wxStyledTextCtrl::MarkerGet(int line
) {
470 return SendMsg(2046, line
, 0);
473 // Find the next line after lineStart that includes a marker in mask.
474 int wxStyledTextCtrl::MarkerNext(int lineStart
, int markerMask
) {
475 return SendMsg(2047, lineStart
, markerMask
);
478 // Find the previous line before lineStart that includes a marker in mask.
479 int wxStyledTextCtrl::MarkerPrevious(int lineStart
, int markerMask
) {
480 return SendMsg(2048, lineStart
, markerMask
);
483 // Define a marker from a bitmap
484 void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber
, const wxBitmap
& bmp
) {
485 // convert bmp to a xpm in a string
486 wxMemoryOutputStream strm
;
487 wxImage img
= bmp
.ConvertToImage();
488 img
.SaveFile(strm
, wxBITMAP_TYPE_XPM
);
489 size_t len
= strm
.GetSize();
490 char* buff
= new char[len
+1];
491 strm
.CopyTo(buff
, len
);
493 SendMsg(2049, markerNumber
, (long)buff
);
498 // Set a margin to be either numeric or symbolic.
499 void wxStyledTextCtrl::SetMarginType(int margin
, int marginType
) {
500 SendMsg(2240, margin
, marginType
);
503 // Retrieve the type of a margin.
504 int wxStyledTextCtrl::GetMarginType(int margin
) {
505 return SendMsg(2241, margin
, 0);
508 // Set the width of a margin to a width expressed in pixels.
509 void wxStyledTextCtrl::SetMarginWidth(int margin
, int pixelWidth
) {
510 SendMsg(2242, margin
, pixelWidth
);
513 // Retrieve the width of a margin in pixels.
514 int wxStyledTextCtrl::GetMarginWidth(int margin
) {
515 return SendMsg(2243, margin
, 0);
518 // Set a mask that determines which markers are displayed in a margin.
519 void wxStyledTextCtrl::SetMarginMask(int margin
, int mask
) {
520 SendMsg(2244, margin
, mask
);
523 // Retrieve the marker mask of a margin.
524 int wxStyledTextCtrl::GetMarginMask(int margin
) {
525 return SendMsg(2245, margin
, 0);
528 // Make a margin sensitive or insensitive to mouse clicks.
529 void wxStyledTextCtrl::SetMarginSensitive(int margin
, bool sensitive
) {
530 SendMsg(2246, margin
, sensitive
);
533 // Retrieve the mouse click sensitivity of a margin.
534 bool wxStyledTextCtrl::GetMarginSensitive(int margin
) {
535 return SendMsg(2247, margin
, 0) != 0;
538 // Clear all the styles and make equivalent to the global default style.
539 void wxStyledTextCtrl::StyleClearAll() {
543 // Set the foreground colour of a style.
544 void wxStyledTextCtrl::StyleSetForeground(int style
, const wxColour
& fore
) {
545 SendMsg(2051, style
, wxColourAsLong(fore
));
548 // Set the background colour of a style.
549 void wxStyledTextCtrl::StyleSetBackground(int style
, const wxColour
& back
) {
550 SendMsg(2052, style
, wxColourAsLong(back
));
553 // Set a style to be bold or not.
554 void wxStyledTextCtrl::StyleSetBold(int style
, bool bold
) {
555 SendMsg(2053, style
, bold
);
558 // Set a style to be italic or not.
559 void wxStyledTextCtrl::StyleSetItalic(int style
, bool italic
) {
560 SendMsg(2054, style
, italic
);
563 // Set the size of characters of a style.
564 void wxStyledTextCtrl::StyleSetSize(int style
, int sizePoints
) {
565 SendMsg(2055, style
, sizePoints
);
568 // Set the font of a style.
569 void wxStyledTextCtrl::StyleSetFaceName(int style
, const wxString
& fontName
) {
570 SendMsg(2056, style
, (long)(const char*)wx2stc(fontName
));
573 // Set a style to have its end of line filled or not.
574 void wxStyledTextCtrl::StyleSetEOLFilled(int style
, bool filled
) {
575 SendMsg(2057, style
, filled
);
578 // Reset the default style to its state at startup
579 void wxStyledTextCtrl::StyleResetDefault() {
583 // Set a style to be underlined or not.
584 void wxStyledTextCtrl::StyleSetUnderline(int style
, bool underline
) {
585 SendMsg(2059, style
, underline
);
588 // Set a style to be mixed case, or to force upper or lower case.
589 void wxStyledTextCtrl::StyleSetCase(int style
, int caseForce
) {
590 SendMsg(2060, style
, caseForce
);
593 // Set the character set of the font in a style.
594 void wxStyledTextCtrl::StyleSetCharacterSet(int style
, int characterSet
) {
595 SendMsg(2066, style
, characterSet
);
598 // Set a style to be a hotspot or not.
599 void wxStyledTextCtrl::StyleSetHotSpot(int style
, bool hotspot
) {
600 SendMsg(2409, style
, hotspot
);
603 // Set the foreground colour of the selection and whether to use this setting.
604 void wxStyledTextCtrl::SetSelForeground(bool useSetting
, const wxColour
& fore
) {
605 SendMsg(2067, useSetting
, wxColourAsLong(fore
));
608 // Set the background colour of the selection and whether to use this setting.
609 void wxStyledTextCtrl::SetSelBackground(bool useSetting
, const wxColour
& back
) {
610 SendMsg(2068, useSetting
, wxColourAsLong(back
));
613 // Set the foreground colour of the caret.
614 void wxStyledTextCtrl::SetCaretForeground(const wxColour
& fore
) {
615 SendMsg(2069, wxColourAsLong(fore
), 0);
618 // When key+modifier combination km is pressed perform msg.
619 void wxStyledTextCtrl::CmdKeyAssign(int key
, int modifiers
, int cmd
) {
620 SendMsg(2070, MAKELONG(key
, modifiers
), cmd
);
623 // When key+modifier combination km is pressed do nothing.
624 void wxStyledTextCtrl::CmdKeyClear(int key
, int modifiers
) {
625 SendMsg(2071, MAKELONG(key
, modifiers
));
628 // Drop all key mappings.
629 void wxStyledTextCtrl::CmdKeyClearAll() {
633 // Set the styles for a segment of the document.
634 void wxStyledTextCtrl::SetStyleBytes(int length
, char* styleBytes
) {
635 SendMsg(2073, length
, (long)styleBytes
);
638 // Set a style to be visible or not.
639 void wxStyledTextCtrl::StyleSetVisible(int style
, bool visible
) {
640 SendMsg(2074, style
, visible
);
643 // Get the time in milliseconds that the caret is on and off.
644 int wxStyledTextCtrl::GetCaretPeriod() {
645 return SendMsg(2075, 0, 0);
648 // Get the time in milliseconds that the caret is on and off. 0 = steady on.
649 void wxStyledTextCtrl::SetCaretPeriod(int periodMilliseconds
) {
650 SendMsg(2076, periodMilliseconds
, 0);
653 // Set the set of characters making up words for when moving or selecting by word.
654 // First sets deaults like SetCharsDefault.
655 void wxStyledTextCtrl::SetWordChars(const wxString
& characters
) {
656 SendMsg(2077, 0, (long)(const char*)wx2stc(characters
));
659 // Start a sequence of actions that is undone and redone as a unit.
661 void wxStyledTextCtrl::BeginUndoAction() {
665 // End a sequence of actions that is undone and redone as a unit.
666 void wxStyledTextCtrl::EndUndoAction() {
670 // Set an indicator to plain, squiggle or TT.
671 void wxStyledTextCtrl::IndicatorSetStyle(int indic
, int style
) {
672 SendMsg(2080, indic
, style
);
675 // Retrieve the style of an indicator.
676 int wxStyledTextCtrl::IndicatorGetStyle(int indic
) {
677 return SendMsg(2081, indic
, 0);
680 // Set the foreground colour of an indicator.
681 void wxStyledTextCtrl::IndicatorSetForeground(int indic
, const wxColour
& fore
) {
682 SendMsg(2082, indic
, wxColourAsLong(fore
));
685 // Retrieve the foreground colour of an indicator.
686 wxColour
wxStyledTextCtrl::IndicatorGetForeground(int indic
) {
687 long c
= SendMsg(2083, indic
, 0);
688 return wxColourFromLong(c
);
691 // Set the foreground colour of all whitespace and whether to use this setting.
692 void wxStyledTextCtrl::SetWhitespaceForeground(bool useSetting
, const wxColour
& fore
) {
693 SendMsg(2084, useSetting
, wxColourAsLong(fore
));
696 // Set the background colour of all whitespace and whether to use this setting.
697 void wxStyledTextCtrl::SetWhitespaceBackground(bool useSetting
, const wxColour
& back
) {
698 SendMsg(2085, useSetting
, wxColourAsLong(back
));
701 // Divide each styling byte into lexical class bits (default: 5) and indicator
702 // bits (default: 3). If a lexer requires more than 32 lexical states, then this
703 // is used to expand the possible states.
704 void wxStyledTextCtrl::SetStyleBits(int bits
) {
705 SendMsg(2090, bits
, 0);
708 // Retrieve number of bits in style bytes used to hold the lexical state.
709 int wxStyledTextCtrl::GetStyleBits() {
710 return SendMsg(2091, 0, 0);
713 // Used to hold extra styling information for each line.
714 void wxStyledTextCtrl::SetLineState(int line
, int state
) {
715 SendMsg(2092, line
, state
);
718 // Retrieve the extra styling information for a line.
719 int wxStyledTextCtrl::GetLineState(int line
) {
720 return SendMsg(2093, line
, 0);
723 // Retrieve the last line number that has line state.
724 int wxStyledTextCtrl::GetMaxLineState() {
725 return SendMsg(2094, 0, 0);
728 // Is the background of the line containing the caret in a different colour?
729 bool wxStyledTextCtrl::GetCaretLineVisible() {
730 return SendMsg(2095, 0, 0) != 0;
733 // Display the background of the line containing the caret in a different colour.
734 void wxStyledTextCtrl::SetCaretLineVisible(bool show
) {
735 SendMsg(2096, show
, 0);
738 // Get the colour of the background of the line containing the caret.
739 wxColour
wxStyledTextCtrl::GetCaretLineBack() {
740 long c
= SendMsg(2097, 0, 0);
741 return wxColourFromLong(c
);
744 // Set the colour of the background of the line containing the caret.
745 void wxStyledTextCtrl::SetCaretLineBack(const wxColour
& back
) {
746 SendMsg(2098, wxColourAsLong(back
), 0);
749 // Set a style to be changeable or not (read only).
750 // Experimental feature, currently buggy.
751 void wxStyledTextCtrl::StyleSetChangeable(int style
, bool changeable
) {
752 SendMsg(2099, style
, changeable
);
755 // Display a auto-completion list.
756 // The lenEntered parameter indicates how many characters before
757 // the caret should be used to provide context.
758 void wxStyledTextCtrl::AutoCompShow(int lenEntered
, const wxString
& itemList
) {
759 SendMsg(2100, lenEntered
, (long)(const char*)wx2stc(itemList
));
762 // Remove the auto-completion list from the screen.
763 void wxStyledTextCtrl::AutoCompCancel() {
767 // Is there an auto-completion list visible?
768 bool wxStyledTextCtrl::AutoCompActive() {
769 return SendMsg(2102, 0, 0) != 0;
772 // Retrieve the position of the caret when the auto-completion list was displayed.
773 int wxStyledTextCtrl::AutoCompPosStart() {
774 return SendMsg(2103, 0, 0);
777 // User has selected an item so remove the list and insert the selection.
778 void wxStyledTextCtrl::AutoCompComplete() {
782 // Define a set of character that when typed cancel the auto-completion list.
783 void wxStyledTextCtrl::AutoCompStops(const wxString
& characterSet
) {
784 SendMsg(2105, 0, (long)(const char*)wx2stc(characterSet
));
787 // Change the separator character in the string setting up an auto-completion list.
788 // Default is space but can be changed if items contain space.
789 void wxStyledTextCtrl::AutoCompSetSeparator(int separatorCharacter
) {
790 SendMsg(2106, separatorCharacter
, 0);
793 // Retrieve the auto-completion list separator character.
794 int wxStyledTextCtrl::AutoCompGetSeparator() {
795 return SendMsg(2107, 0, 0);
798 // Select the item in the auto-completion list that starts with a string.
799 void wxStyledTextCtrl::AutoCompSelect(const wxString
& text
) {
800 SendMsg(2108, 0, (long)(const char*)wx2stc(text
));
803 // Should the auto-completion list be cancelled if the user backspaces to a
804 // position before where the box was created.
805 void wxStyledTextCtrl::AutoCompSetCancelAtStart(bool cancel
) {
806 SendMsg(2110, cancel
, 0);
809 // Retrieve whether auto-completion cancelled by backspacing before start.
810 bool wxStyledTextCtrl::AutoCompGetCancelAtStart() {
811 return SendMsg(2111, 0, 0) != 0;
814 // Define a set of characters that when typed will cause the autocompletion to
815 // choose the selected item.
816 void wxStyledTextCtrl::AutoCompSetFillUps(const wxString
& characterSet
) {
817 SendMsg(2112, 0, (long)(const char*)wx2stc(characterSet
));
820 // Should a single item auto-completion list automatically choose the item.
821 void wxStyledTextCtrl::AutoCompSetChooseSingle(bool chooseSingle
) {
822 SendMsg(2113, chooseSingle
, 0);
825 // Retrieve whether a single item auto-completion list automatically choose the item.
826 bool wxStyledTextCtrl::AutoCompGetChooseSingle() {
827 return SendMsg(2114, 0, 0) != 0;
830 // Set whether case is significant when performing auto-completion searches.
831 void wxStyledTextCtrl::AutoCompSetIgnoreCase(bool ignoreCase
) {
832 SendMsg(2115, ignoreCase
, 0);
835 // Retrieve state of ignore case flag.
836 bool wxStyledTextCtrl::AutoCompGetIgnoreCase() {
837 return SendMsg(2116, 0, 0) != 0;
840 // Display a list of strings and send notification when user chooses one.
841 void wxStyledTextCtrl::UserListShow(int listType
, const wxString
& itemList
) {
842 SendMsg(2117, listType
, (long)(const char*)wx2stc(itemList
));
845 // Set whether or not autocompletion is hidden automatically when nothing matches.
846 void wxStyledTextCtrl::AutoCompSetAutoHide(bool autoHide
) {
847 SendMsg(2118, autoHide
, 0);
850 // Retrieve whether or not autocompletion is hidden automatically when nothing matches.
851 bool wxStyledTextCtrl::AutoCompGetAutoHide() {
852 return SendMsg(2119, 0, 0) != 0;
855 // Set whether or not autocompletion deletes any word characters
856 // after the inserted text upon completion.
857 void wxStyledTextCtrl::AutoCompSetDropRestOfWord(bool dropRestOfWord
) {
858 SendMsg(2270, dropRestOfWord
, 0);
861 // Retrieve whether or not autocompletion deletes any word characters
862 // after the inserted text upon completion.
863 bool wxStyledTextCtrl::AutoCompGetDropRestOfWord() {
864 return SendMsg(2271, 0, 0) != 0;
867 // Register an image for use in autocompletion lists.
868 void wxStyledTextCtrl::RegisterImage(int type
, const wxBitmap
& bmp
) {
869 // convert bmp to a xpm in a string
870 wxMemoryOutputStream strm
;
871 wxImage img
= bmp
.ConvertToImage();
872 img
.SaveFile(strm
, wxBITMAP_TYPE_XPM
);
873 size_t len
= strm
.GetSize();
874 char* buff
= new char[len
+1];
875 strm
.CopyTo(buff
, len
);
877 SendMsg(2405, type
, (long)buff
);
882 // Clear all the registered images.
883 void wxStyledTextCtrl::ClearRegisteredImages() {
887 // Retrieve the auto-completion list type-separator character.
888 int wxStyledTextCtrl::AutoCompGetTypeSeparator() {
889 return SendMsg(2285, 0, 0);
892 // Change the type-separator character in the string setting up an auto-completion list.
893 // Default is '?' but can be changed if items contain '?'.
894 void wxStyledTextCtrl::AutoCompSetTypeSeparator(int separatorCharacter
) {
895 SendMsg(2286, separatorCharacter
, 0);
898 // Set the number of spaces used for one level of indentation.
899 void wxStyledTextCtrl::SetIndent(int indentSize
) {
900 SendMsg(2122, indentSize
, 0);
903 // Retrieve indentation size.
904 int wxStyledTextCtrl::GetIndent() {
905 return SendMsg(2123, 0, 0);
908 // Indentation will only use space characters if useTabs is false, otherwise
909 // it will use a combination of tabs and spaces.
910 void wxStyledTextCtrl::SetUseTabs(bool useTabs
) {
911 SendMsg(2124, useTabs
, 0);
914 // Retrieve whether tabs will be used in indentation.
915 bool wxStyledTextCtrl::GetUseTabs() {
916 return SendMsg(2125, 0, 0) != 0;
919 // Change the indentation of a line to a number of columns.
920 void wxStyledTextCtrl::SetLineIndentation(int line
, int indentSize
) {
921 SendMsg(2126, line
, indentSize
);
924 // Retrieve the number of columns that a line is indented.
925 int wxStyledTextCtrl::GetLineIndentation(int line
) {
926 return SendMsg(2127, line
, 0);
929 // Retrieve the position before the first non indentation character on a line.
930 int wxStyledTextCtrl::GetLineIndentPosition(int line
) {
931 return SendMsg(2128, line
, 0);
934 // Retrieve the column number of a position, taking tab width into account.
935 int wxStyledTextCtrl::GetColumn(int pos
) {
936 return SendMsg(2129, pos
, 0);
939 // Show or hide the horizontal scroll bar.
940 void wxStyledTextCtrl::SetUseHorizontalScrollBar(bool show
) {
941 SendMsg(2130, show
, 0);
944 // Is the horizontal scroll bar visible?
945 bool wxStyledTextCtrl::GetUseHorizontalScrollBar() {
946 return SendMsg(2131, 0, 0) != 0;
949 // Show or hide indentation guides.
950 void wxStyledTextCtrl::SetIndentationGuides(bool show
) {
951 SendMsg(2132, show
, 0);
954 // Are the indentation guides visible?
955 bool wxStyledTextCtrl::GetIndentationGuides() {
956 return SendMsg(2133, 0, 0) != 0;
959 // Set the highlighted indentation guide column.
960 // 0 = no highlighted guide.
961 void wxStyledTextCtrl::SetHighlightGuide(int column
) {
962 SendMsg(2134, column
, 0);
965 // Get the highlighted indentation guide column.
966 int wxStyledTextCtrl::GetHighlightGuide() {
967 return SendMsg(2135, 0, 0);
970 // Get the position after the last visible characters on a line.
971 int wxStyledTextCtrl::GetLineEndPosition(int line
) {
972 return SendMsg(2136, line
, 0);
975 // Get the code page used to interpret the bytes of the document as characters.
976 int wxStyledTextCtrl::GetCodePage() {
977 return SendMsg(2137, 0, 0);
980 // Get the foreground colour of the caret.
981 wxColour
wxStyledTextCtrl::GetCaretForeground() {
982 long c
= SendMsg(2138, 0, 0);
983 return wxColourFromLong(c
);
986 // In read-only mode?
987 bool wxStyledTextCtrl::GetReadOnly() {
988 return SendMsg(2140, 0, 0) != 0;
991 // Sets the position of the caret.
992 void wxStyledTextCtrl::SetCurrentPos(int pos
) {
993 SendMsg(2141, pos
, 0);
996 // Sets the position that starts the selection - this becomes the anchor.
997 void wxStyledTextCtrl::SetSelectionStart(int pos
) {
998 SendMsg(2142, pos
, 0);
1001 // Returns the position at the start of the selection.
1002 int wxStyledTextCtrl::GetSelectionStart() {
1003 return SendMsg(2143, 0, 0);
1006 // Sets the position that ends the selection - this becomes the currentPosition.
1007 void wxStyledTextCtrl::SetSelectionEnd(int pos
) {
1008 SendMsg(2144, pos
, 0);
1011 // Returns the position at the end of the selection.
1012 int wxStyledTextCtrl::GetSelectionEnd() {
1013 return SendMsg(2145, 0, 0);
1016 // Sets the print magnification added to the point size of each style for printing.
1017 void wxStyledTextCtrl::SetPrintMagnification(int magnification
) {
1018 SendMsg(2146, magnification
, 0);
1021 // Returns the print magnification.
1022 int wxStyledTextCtrl::GetPrintMagnification() {
1023 return SendMsg(2147, 0, 0);
1026 // Modify colours when printing for clearer printed text.
1027 void wxStyledTextCtrl::SetPrintColourMode(int mode
) {
1028 SendMsg(2148, mode
, 0);
1031 // Returns the print colour mode.
1032 int wxStyledTextCtrl::GetPrintColourMode() {
1033 return SendMsg(2149, 0, 0);
1036 // Find some text in the document.
1037 int wxStyledTextCtrl::FindText(int minPos
, int maxPos
,
1038 const wxString
& text
,
1041 ft
.chrg
.cpMin
= minPos
;
1042 ft
.chrg
.cpMax
= maxPos
;
1043 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
1044 ft
.lpstrText
= (char*)(const char*)buf
;
1046 return SendMsg(2150, flags
, (long)&ft
);
1049 // On Windows, will draw the document into a display context such as a printer.
1050 int wxStyledTextCtrl::FormatRange(bool doDraw
,
1059 if (endPos
< startPos
) {
1060 int temp
= startPos
;
1065 fr
.hdcTarget
= target
;
1066 fr
.rc
.top
= renderRect
.GetTop();
1067 fr
.rc
.left
= renderRect
.GetLeft();
1068 fr
.rc
.right
= renderRect
.GetRight();
1069 fr
.rc
.bottom
= renderRect
.GetBottom();
1070 fr
.rcPage
.top
= pageRect
.GetTop();
1071 fr
.rcPage
.left
= pageRect
.GetLeft();
1072 fr
.rcPage
.right
= pageRect
.GetRight();
1073 fr
.rcPage
.bottom
= pageRect
.GetBottom();
1074 fr
.chrg
.cpMin
= startPos
;
1075 fr
.chrg
.cpMax
= endPos
;
1077 return SendMsg(2151, doDraw
, (long)&fr
);
1080 // Retrieve the display line at the top of the display.
1081 int wxStyledTextCtrl::GetFirstVisibleLine() {
1082 return SendMsg(2152, 0, 0);
1085 // Retrieve the contents of a line.
1086 wxString
wxStyledTextCtrl::GetLine(int line
) {
1087 int len
= LineLength(line
);
1088 if (!len
) return wxEmptyString
;
1090 wxMemoryBuffer
mbuf(len
+1);
1091 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1092 SendMsg(2153, line
, (long)buf
);
1093 mbuf
.UngetWriteBuf(len
);
1098 // Returns the number of lines in the document. There is always at least one.
1099 int wxStyledTextCtrl::GetLineCount() {
1100 return SendMsg(2154, 0, 0);
1103 // Sets the size in pixels of the left margin.
1104 void wxStyledTextCtrl::SetMarginLeft(int pixelWidth
) {
1105 SendMsg(2155, 0, pixelWidth
);
1108 // Returns the size in pixels of the left margin.
1109 int wxStyledTextCtrl::GetMarginLeft() {
1110 return SendMsg(2156, 0, 0);
1113 // Sets the size in pixels of the right margin.
1114 void wxStyledTextCtrl::SetMarginRight(int pixelWidth
) {
1115 SendMsg(2157, 0, pixelWidth
);
1118 // Returns the size in pixels of the right margin.
1119 int wxStyledTextCtrl::GetMarginRight() {
1120 return SendMsg(2158, 0, 0);
1123 // Is the document different from when it was last saved?
1124 bool wxStyledTextCtrl::GetModify() {
1125 return SendMsg(2159, 0, 0) != 0;
1128 // Select a range of text.
1129 void wxStyledTextCtrl::SetSelection(int start
, int end
) {
1130 SendMsg(2160, start
, end
);
1133 // Retrieve the selected text.
1134 wxString
wxStyledTextCtrl::GetSelectedText() {
1138 GetSelection(&start
, &end
);
1139 int len
= end
- start
;
1140 if (!len
) return wxEmptyString
;
1142 wxMemoryBuffer
mbuf(len
+2);
1143 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1144 SendMsg(2161, 0, (long)buf
);
1145 mbuf
.UngetWriteBuf(len
);
1150 // Retrieve a range of text.
1151 wxString
wxStyledTextCtrl::GetTextRange(int startPos
, int endPos
) {
1152 if (endPos
< startPos
) {
1153 int temp
= startPos
;
1157 int len
= endPos
- startPos
;
1158 if (!len
) return wxEmptyString
;
1159 wxMemoryBuffer
mbuf(len
+1);
1160 char* buf
= (char*)mbuf
.GetWriteBuf(len
);
1163 tr
.chrg
.cpMin
= startPos
;
1164 tr
.chrg
.cpMax
= endPos
;
1165 SendMsg(2162, 0, (long)&tr
);
1166 mbuf
.UngetWriteBuf(len
);
1171 // Draw the selection in normal style or with selection highlighted.
1172 void wxStyledTextCtrl::HideSelection(bool normal
) {
1173 SendMsg(2163, normal
, 0);
1176 // Retrieve the line containing a position.
1177 int wxStyledTextCtrl::LineFromPosition(int pos
) {
1178 return SendMsg(2166, pos
, 0);
1181 // Retrieve the position at the start of a line.
1182 int wxStyledTextCtrl::PositionFromLine(int line
) {
1183 return SendMsg(2167, line
, 0);
1186 // Scroll horizontally and vertically.
1187 void wxStyledTextCtrl::LineScroll(int columns
, int lines
) {
1188 SendMsg(2168, columns
, lines
);
1191 // Ensure the caret is visible.
1192 void wxStyledTextCtrl::EnsureCaretVisible() {
1193 SendMsg(2169, 0, 0);
1196 // Replace the selected text with the argument text.
1197 void wxStyledTextCtrl::ReplaceSelection(const wxString
& text
) {
1198 SendMsg(2170, 0, (long)(const char*)wx2stc(text
));
1201 // Set to read only or read write.
1202 void wxStyledTextCtrl::SetReadOnly(bool readOnly
) {
1203 SendMsg(2171, readOnly
, 0);
1206 // Will a paste succeed?
1207 bool wxStyledTextCtrl::CanPaste() {
1208 return SendMsg(2173, 0, 0) != 0;
1211 // Are there any undoable actions in the undo history?
1212 bool wxStyledTextCtrl::CanUndo() {
1213 return SendMsg(2174, 0, 0) != 0;
1216 // Delete the undo history.
1217 void wxStyledTextCtrl::EmptyUndoBuffer() {
1218 SendMsg(2175, 0, 0);
1221 // Undo one action in the undo history.
1222 void wxStyledTextCtrl::Undo() {
1223 SendMsg(2176, 0, 0);
1226 // Cut the selection to the clipboard.
1227 void wxStyledTextCtrl::Cut() {
1228 SendMsg(2177, 0, 0);
1231 // Copy the selection to the clipboard.
1232 void wxStyledTextCtrl::Copy() {
1233 SendMsg(2178, 0, 0);
1236 // Paste the contents of the clipboard into the document replacing the selection.
1237 void wxStyledTextCtrl::Paste() {
1238 SendMsg(2179, 0, 0);
1241 // Clear the selection.
1242 void wxStyledTextCtrl::Clear() {
1243 SendMsg(2180, 0, 0);
1246 // Replace the contents of the document with the argument text.
1247 void wxStyledTextCtrl::SetText(const wxString
& text
) {
1248 SendMsg(2181, 0, (long)(const char*)wx2stc(text
));
1251 // Retrieve all the text in the document.
1252 wxString
wxStyledTextCtrl::GetText() {
1253 int len
= GetTextLength();
1254 wxMemoryBuffer
mbuf(len
+1); // leave room for the null...
1255 char* buf
= (char*)mbuf
.GetWriteBuf(len
+1);
1256 SendMsg(2182, len
+1, (long)buf
);
1257 mbuf
.UngetWriteBuf(len
);
1262 // Retrieve the number of characters in the document.
1263 int wxStyledTextCtrl::GetTextLength() {
1264 return SendMsg(2183, 0, 0);
1267 // Set to overtype (true) or insert mode.
1268 void wxStyledTextCtrl::SetOvertype(bool overtype
) {
1269 SendMsg(2186, overtype
, 0);
1272 // Returns true if overtype mode is active otherwise false is returned.
1273 bool wxStyledTextCtrl::GetOvertype() {
1274 return SendMsg(2187, 0, 0) != 0;
1277 // Set the width of the insert mode caret.
1278 void wxStyledTextCtrl::SetCaretWidth(int pixelWidth
) {
1279 SendMsg(2188, pixelWidth
, 0);
1282 // Returns the width of the insert mode caret.
1283 int wxStyledTextCtrl::GetCaretWidth() {
1284 return SendMsg(2189, 0, 0);
1287 // Sets the position that starts the target which is used for updating the
1288 // document without affecting the scroll position.
1289 void wxStyledTextCtrl::SetTargetStart(int pos
) {
1290 SendMsg(2190, pos
, 0);
1293 // Get the position that starts the target.
1294 int wxStyledTextCtrl::GetTargetStart() {
1295 return SendMsg(2191, 0, 0);
1298 // Sets the position that ends the target which is used for updating the
1299 // document without affecting the scroll position.
1300 void wxStyledTextCtrl::SetTargetEnd(int pos
) {
1301 SendMsg(2192, pos
, 0);
1304 // Get the position that ends the target.
1305 int wxStyledTextCtrl::GetTargetEnd() {
1306 return SendMsg(2193, 0, 0);
1309 // Replace the target text with the argument text.
1310 // Text is counted so it can contain NULs.
1311 // Returns the length of the replacement text.
1313 int wxStyledTextCtrl::ReplaceTarget(const wxString
& text
) {
1314 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
1315 return SendMsg(2194, strlen(buf
), (long)(const char*)buf
);
1318 // Replace the target text with the argument text after \d processing.
1319 // Text is counted so it can contain NULs.
1320 // Looks for \d where d is between 1 and 9 and replaces these with the strings
1321 // matched in the last search operation which were surrounded by \( and \).
1322 // Returns the length of the replacement text including any change
1323 // caused by processing the \d patterns.
1325 int wxStyledTextCtrl::ReplaceTargetRE(const wxString
& text
) {
1326 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
1327 return SendMsg(2195, strlen(buf
), (long)(const char*)buf
);
1330 // Search for a counted string in the target and set the target to the found
1331 // range. Text is counted so it can contain NULs.
1332 // Returns length of range or -1 for failure in which case target is not moved.
1334 int wxStyledTextCtrl::SearchInTarget(const wxString
& text
) {
1335 wxWX2MBbuf buf
= (wxWX2MBbuf
)wx2stc(text
);
1336 return SendMsg(2197, strlen(buf
), (long)(const char*)buf
);
1339 // Set the search flags used by SearchInTarget.
1340 void wxStyledTextCtrl::SetSearchFlags(int flags
) {
1341 SendMsg(2198, flags
, 0);
1344 // Get the search flags used by SearchInTarget.
1345 int wxStyledTextCtrl::GetSearchFlags() {
1346 return SendMsg(2199, 0, 0);
1349 // Show a call tip containing a definition near position pos.
1350 void wxStyledTextCtrl::CallTipShow(int pos
, const wxString
& definition
) {
1351 SendMsg(2200, pos
, (long)(const char*)wx2stc(definition
));
1354 // Remove the call tip from the screen.
1355 void wxStyledTextCtrl::CallTipCancel() {
1356 SendMsg(2201, 0, 0);
1359 // Is there an active call tip?
1360 bool wxStyledTextCtrl::CallTipActive() {
1361 return SendMsg(2202, 0, 0) != 0;
1364 // Retrieve the position where the caret was before displaying the call tip.
1365 int wxStyledTextCtrl::CallTipPosAtStart() {
1366 return SendMsg(2203, 0, 0);
1369 // Highlight a segment of the definition.
1370 void wxStyledTextCtrl::CallTipSetHighlight(int start
, int end
) {
1371 SendMsg(2204, start
, end
);
1374 // Set the background colour for the call tip.
1375 void wxStyledTextCtrl::CallTipSetBackground(const wxColour
& back
) {
1376 SendMsg(2205, wxColourAsLong(back
), 0);
1379 // Set the foreground colour for the call tip.
1380 void wxStyledTextCtrl::CallTipSetForeground(const wxColour
& fore
) {
1381 SendMsg(2206, wxColourAsLong(fore
), 0);
1384 // Set the foreground colour for the highlighted part of the call tip.
1385 void wxStyledTextCtrl::CallTipSetForegroundHighlight(const wxColour
& fore
) {
1386 SendMsg(2207, wxColourAsLong(fore
), 0);
1389 // Find the display line of a document line taking hidden lines into account.
1390 int wxStyledTextCtrl::VisibleFromDocLine(int line
) {
1391 return SendMsg(2220, line
, 0);
1394 // Find the document line of a display line taking hidden lines into account.
1395 int wxStyledTextCtrl::DocLineFromVisible(int lineDisplay
) {
1396 return SendMsg(2221, lineDisplay
, 0);
1399 // Set the fold level of a line.
1400 // This encodes an integer level along with flags indicating whether the
1401 // line is a header and whether it is effectively white space.
1402 void wxStyledTextCtrl::SetFoldLevel(int line
, int level
) {
1403 SendMsg(2222, line
, level
);
1406 // Retrieve the fold level of a line.
1407 int wxStyledTextCtrl::GetFoldLevel(int line
) {
1408 return SendMsg(2223, line
, 0);
1411 // Find the last child line of a header line.
1412 int wxStyledTextCtrl::GetLastChild(int line
, int level
) {
1413 return SendMsg(2224, line
, level
);
1416 // Find the parent line of a child line.
1417 int wxStyledTextCtrl::GetFoldParent(int line
) {
1418 return SendMsg(2225, line
, 0);
1421 // Make a range of lines visible.
1422 void wxStyledTextCtrl::ShowLines(int lineStart
, int lineEnd
) {
1423 SendMsg(2226, lineStart
, lineEnd
);
1426 // Make a range of lines invisible.
1427 void wxStyledTextCtrl::HideLines(int lineStart
, int lineEnd
) {
1428 SendMsg(2227, lineStart
, lineEnd
);
1431 // Is a line visible?
1432 bool wxStyledTextCtrl::GetLineVisible(int line
) {
1433 return SendMsg(2228, line
, 0) != 0;
1436 // Show the children of a header line.
1437 void wxStyledTextCtrl::SetFoldExpanded(int line
, bool expanded
) {
1438 SendMsg(2229, line
, expanded
);
1441 // Is a header line expanded?
1442 bool wxStyledTextCtrl::GetFoldExpanded(int line
) {
1443 return SendMsg(2230, line
, 0) != 0;
1446 // Switch a header line between expanded and contracted.
1447 void wxStyledTextCtrl::ToggleFold(int line
) {
1448 SendMsg(2231, line
, 0);
1451 // Ensure a particular line is visible by expanding any header line hiding it.
1452 void wxStyledTextCtrl::EnsureVisible(int line
) {
1453 SendMsg(2232, line
, 0);
1456 // Set some style options for folding.
1457 void wxStyledTextCtrl::SetFoldFlags(int flags
) {
1458 SendMsg(2233, flags
, 0);
1461 // Ensure a particular line is visible by expanding any header line hiding it.
1462 // Use the currently set visibility policy to determine which range to display.
1463 void wxStyledTextCtrl::EnsureVisibleEnforcePolicy(int line
) {
1464 SendMsg(2234, line
, 0);
1467 // Sets whether a tab pressed when caret is within indentation indents.
1468 void wxStyledTextCtrl::SetTabIndents(bool tabIndents
) {
1469 SendMsg(2260, tabIndents
, 0);
1472 // Does a tab pressed when caret is within indentation indent?
1473 bool wxStyledTextCtrl::GetTabIndents() {
1474 return SendMsg(2261, 0, 0) != 0;
1477 // Sets whether a backspace pressed when caret is within indentation unindents.
1478 void wxStyledTextCtrl::SetBackSpaceUnIndents(bool bsUnIndents
) {
1479 SendMsg(2262, bsUnIndents
, 0);
1482 // Does a backspace pressed when caret is within indentation unindent?
1483 bool wxStyledTextCtrl::GetBackSpaceUnIndents() {
1484 return SendMsg(2263, 0, 0) != 0;
1487 // Sets the time the mouse must sit still to generate a mouse dwell event.
1488 void wxStyledTextCtrl::SetMouseDwellTime(int periodMilliseconds
) {
1489 SendMsg(2264, periodMilliseconds
, 0);
1492 // Retrieve the time the mouse must sit still to generate a mouse dwell event.
1493 int wxStyledTextCtrl::GetMouseDwellTime() {
1494 return SendMsg(2265, 0, 0);
1497 // Get position of start of word.
1498 int wxStyledTextCtrl::WordStartPosition(int pos
, bool onlyWordCharacters
) {
1499 return SendMsg(2266, pos
, onlyWordCharacters
);
1502 // Get position of end of word.
1503 int wxStyledTextCtrl::WordEndPosition(int pos
, bool onlyWordCharacters
) {
1504 return SendMsg(2267, pos
, onlyWordCharacters
);
1507 // Sets whether text is word wrapped.
1508 void wxStyledTextCtrl::SetWrapMode(int mode
) {
1509 SendMsg(2268, mode
, 0);
1512 // Retrieve whether text is word wrapped.
1513 int wxStyledTextCtrl::GetWrapMode() {
1514 return SendMsg(2269, 0, 0);
1517 // Sets the degree of caching of layout information.
1518 void wxStyledTextCtrl::SetLayoutCache(int mode
) {
1519 SendMsg(2272, mode
, 0);
1522 // Retrieve the degree of caching of layout information.
1523 int wxStyledTextCtrl::GetLayoutCache() {
1524 return SendMsg(2273, 0, 0);
1527 // Sets the document width assumed for scrolling.
1528 void wxStyledTextCtrl::SetScrollWidth(int pixelWidth
) {
1529 SendMsg(2274, pixelWidth
, 0);
1532 // Retrieve the document width assumed for scrolling.
1533 int wxStyledTextCtrl::GetScrollWidth() {
1534 return SendMsg(2275, 0, 0);
1537 // Measure the pixel width of some text in a particular style.
1538 // NUL terminated text argument.
1539 // Does not handle tab or control characters.
1540 int wxStyledTextCtrl::TextWidth(int style
, const wxString
& text
) {
1541 return SendMsg(2276, style
, (long)(const char*)wx2stc(text
));
1544 // Sets the scroll range so that maximum scroll position has
1545 // the last line at the bottom of the view (default).
1546 // Setting this to false allows scrolling one page below the last line.
1547 void wxStyledTextCtrl::SetEndAtLastLine(bool endAtLastLine
) {
1548 SendMsg(2277, endAtLastLine
, 0);
1551 // Retrieve whether the maximum scroll position has the last
1552 // line at the bottom of the view.
1553 int wxStyledTextCtrl::GetEndAtLastLine() {
1554 return SendMsg(2278, 0, 0);
1557 // Retrieve the height of a particular line of text in pixels.
1558 int wxStyledTextCtrl::TextHeight(int line
) {
1559 return SendMsg(2279, line
, 0);
1562 // Show or hide the vertical scroll bar.
1563 void wxStyledTextCtrl::SetUseVerticalScrollBar(bool show
) {
1564 SendMsg(2280, show
, 0);
1567 // Is the vertical scroll bar visible?
1568 bool wxStyledTextCtrl::GetUseVerticalScrollBar() {
1569 return SendMsg(2281, 0, 0) != 0;
1572 // Append a string to the end of the document without changing the selection.
1573 void wxStyledTextCtrl::AppendText(int length
, const wxString
& text
) {
1574 SendMsg(2282, length
, (long)(const char*)wx2stc(text
));
1577 // Is drawing done in two phases with backgrounds drawn before foregrounds?
1578 bool wxStyledTextCtrl::GetTwoPhaseDraw() {
1579 return SendMsg(2283, 0, 0) != 0;
1582 // In twoPhaseDraw mode, drawing is performed in two phases, first the background
1583 // and then the foreground. This avoids chopping off characters that overlap the next run.
1584 void wxStyledTextCtrl::SetTwoPhaseDraw(bool twoPhase
) {
1585 SendMsg(2284, twoPhase
, 0);
1588 // Make the target range start and end be the same as the selection range start and end.
1589 void wxStyledTextCtrl::TargetFromSelection() {
1590 SendMsg(2287, 0, 0);
1593 // Join the lines in the target.
1594 void wxStyledTextCtrl::LinesJoin() {
1595 SendMsg(2288, 0, 0);
1598 // Split the lines in the target into lines that are less wide than pixelWidth
1600 void wxStyledTextCtrl::LinesSplit(int pixelWidth
) {
1601 SendMsg(2289, pixelWidth
, 0);
1604 // Set the colours used as a chequerboard pattern in the fold margin
1605 void wxStyledTextCtrl::SetFoldMarginColour(bool useSetting
, const wxColour
& back
) {
1606 SendMsg(2290, useSetting
, wxColourAsLong(back
));
1608 void wxStyledTextCtrl::SetFoldMarginHiColour(bool useSetting
, const wxColour
& fore
) {
1609 SendMsg(2291, useSetting
, wxColourAsLong(fore
));
1612 // Move caret down one line.
1613 void wxStyledTextCtrl::LineDown() {
1614 SendMsg(2300, 0, 0);
1617 // Move caret down one line extending selection to new caret position.
1618 void wxStyledTextCtrl::LineDownExtend() {
1619 SendMsg(2301, 0, 0);
1622 // Move caret up one line.
1623 void wxStyledTextCtrl::LineUp() {
1624 SendMsg(2302, 0, 0);
1627 // Move caret up one line extending selection to new caret position.
1628 void wxStyledTextCtrl::LineUpExtend() {
1629 SendMsg(2303, 0, 0);
1632 // Move caret left one character.
1633 void wxStyledTextCtrl::CharLeft() {
1634 SendMsg(2304, 0, 0);
1637 // Move caret left one character extending selection to new caret position.
1638 void wxStyledTextCtrl::CharLeftExtend() {
1639 SendMsg(2305, 0, 0);
1642 // Move caret right one character.
1643 void wxStyledTextCtrl::CharRight() {
1644 SendMsg(2306, 0, 0);
1647 // Move caret right one character extending selection to new caret position.
1648 void wxStyledTextCtrl::CharRightExtend() {
1649 SendMsg(2307, 0, 0);
1652 // Move caret left one word.
1653 void wxStyledTextCtrl::WordLeft() {
1654 SendMsg(2308, 0, 0);
1657 // Move caret left one word extending selection to new caret position.
1658 void wxStyledTextCtrl::WordLeftExtend() {
1659 SendMsg(2309, 0, 0);
1662 // Move caret right one word.
1663 void wxStyledTextCtrl::WordRight() {
1664 SendMsg(2310, 0, 0);
1667 // Move caret right one word extending selection to new caret position.
1668 void wxStyledTextCtrl::WordRightExtend() {
1669 SendMsg(2311, 0, 0);
1672 // Move caret to first position on line.
1673 void wxStyledTextCtrl::Home() {
1674 SendMsg(2312, 0, 0);
1677 // Move caret to first position on line extending selection to new caret position.
1678 void wxStyledTextCtrl::HomeExtend() {
1679 SendMsg(2313, 0, 0);
1682 // Move caret to last position on line.
1683 void wxStyledTextCtrl::LineEnd() {
1684 SendMsg(2314, 0, 0);
1687 // Move caret to last position on line extending selection to new caret position.
1688 void wxStyledTextCtrl::LineEndExtend() {
1689 SendMsg(2315, 0, 0);
1692 // Move caret to first position in document.
1693 void wxStyledTextCtrl::DocumentStart() {
1694 SendMsg(2316, 0, 0);
1697 // Move caret to first position in document extending selection to new caret position.
1698 void wxStyledTextCtrl::DocumentStartExtend() {
1699 SendMsg(2317, 0, 0);
1702 // Move caret to last position in document.
1703 void wxStyledTextCtrl::DocumentEnd() {
1704 SendMsg(2318, 0, 0);
1707 // Move caret to last position in document extending selection to new caret position.
1708 void wxStyledTextCtrl::DocumentEndExtend() {
1709 SendMsg(2319, 0, 0);
1712 // Move caret one page up.
1713 void wxStyledTextCtrl::PageUp() {
1714 SendMsg(2320, 0, 0);
1717 // Move caret one page up extending selection to new caret position.
1718 void wxStyledTextCtrl::PageUpExtend() {
1719 SendMsg(2321, 0, 0);
1722 // Move caret one page down.
1723 void wxStyledTextCtrl::PageDown() {
1724 SendMsg(2322, 0, 0);
1727 // Move caret one page down extending selection to new caret position.
1728 void wxStyledTextCtrl::PageDownExtend() {
1729 SendMsg(2323, 0, 0);
1732 // Switch from insert to overtype mode or the reverse.
1733 void wxStyledTextCtrl::EditToggleOvertype() {
1734 SendMsg(2324, 0, 0);
1737 // Cancel any modes such as call tip or auto-completion list display.
1738 void wxStyledTextCtrl::Cancel() {
1739 SendMsg(2325, 0, 0);
1742 // Delete the selection or if no selection, the character before the caret.
1743 void wxStyledTextCtrl::DeleteBack() {
1744 SendMsg(2326, 0, 0);
1747 // If selection is empty or all on one line replace the selection with a tab character.
1748 // If more than one line selected, indent the lines.
1749 void wxStyledTextCtrl::Tab() {
1750 SendMsg(2327, 0, 0);
1753 // Dedent the selected lines.
1754 void wxStyledTextCtrl::BackTab() {
1755 SendMsg(2328, 0, 0);
1758 // Insert a new line, may use a CRLF, CR or LF depending on EOL mode.
1759 void wxStyledTextCtrl::NewLine() {
1760 SendMsg(2329, 0, 0);
1763 // Insert a Form Feed character.
1764 void wxStyledTextCtrl::FormFeed() {
1765 SendMsg(2330, 0, 0);
1768 // Move caret to before first visible character on line.
1769 // If already there move to first character on line.
1770 void wxStyledTextCtrl::VCHome() {
1771 SendMsg(2331, 0, 0);
1774 // Like VCHome but extending selection to new caret position.
1775 void wxStyledTextCtrl::VCHomeExtend() {
1776 SendMsg(2332, 0, 0);
1779 // Magnify the displayed text by increasing the sizes by 1 point.
1780 void wxStyledTextCtrl::ZoomIn() {
1781 SendMsg(2333, 0, 0);
1784 // Make the displayed text smaller by decreasing the sizes by 1 point.
1785 void wxStyledTextCtrl::ZoomOut() {
1786 SendMsg(2334, 0, 0);
1789 // Delete the word to the left of the caret.
1790 void wxStyledTextCtrl::DelWordLeft() {
1791 SendMsg(2335, 0, 0);
1794 // Delete the word to the right of the caret.
1795 void wxStyledTextCtrl::DelWordRight() {
1796 SendMsg(2336, 0, 0);
1799 // Cut the line containing the caret.
1800 void wxStyledTextCtrl::LineCut() {
1801 SendMsg(2337, 0, 0);
1804 // Delete the line containing the caret.
1805 void wxStyledTextCtrl::LineDelete() {
1806 SendMsg(2338, 0, 0);
1809 // Switch the current line with the previous.
1810 void wxStyledTextCtrl::LineTranspose() {
1811 SendMsg(2339, 0, 0);
1814 // Duplicate the current line.
1815 void wxStyledTextCtrl::LineDuplicate() {
1816 SendMsg(2404, 0, 0);
1819 // Transform the selection to lower case.
1820 void wxStyledTextCtrl::LowerCase() {
1821 SendMsg(2340, 0, 0);
1824 // Transform the selection to upper case.
1825 void wxStyledTextCtrl::UpperCase() {
1826 SendMsg(2341, 0, 0);
1829 // Scroll the document down, keeping the caret visible.
1830 void wxStyledTextCtrl::LineScrollDown() {
1831 SendMsg(2342, 0, 0);
1834 // Scroll the document up, keeping the caret visible.
1835 void wxStyledTextCtrl::LineScrollUp() {
1836 SendMsg(2343, 0, 0);
1839 // Delete the selection or if no selection, the character before the caret.
1840 // Will not delete the character before at the start of a line.
1841 void wxStyledTextCtrl::DeleteBackNotLine() {
1842 SendMsg(2344, 0, 0);
1845 // Move caret to first position on display line.
1846 void wxStyledTextCtrl::HomeDisplay() {
1847 SendMsg(2345, 0, 0);
1850 // Move caret to first position on display line extending selection to
1851 // new caret position.
1852 void wxStyledTextCtrl::HomeDisplayExtend() {
1853 SendMsg(2346, 0, 0);
1856 // Move caret to last position on display line.
1857 void wxStyledTextCtrl::LineEndDisplay() {
1858 SendMsg(2347, 0, 0);
1861 // Move caret to last position on display line extending selection to new
1863 void wxStyledTextCtrl::LineEndDisplayExtend() {
1864 SendMsg(2348, 0, 0);
1867 // These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)?
1868 // except they behave differently when word-wrap is enabled:
1869 // They go first to the start / end of the display line, like (Home|LineEnd)Display
1870 // The difference is that, the cursor is already at the point, it goes on to the start
1871 // or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
1872 void wxStyledTextCtrl::HomeWrap() {
1873 SendMsg(2349, 0, 0);
1875 void wxStyledTextCtrl::HomeWrapExtend() {
1876 SendMsg(2450, 0, 0);
1878 void wxStyledTextCtrl::LineEndWrap() {
1879 SendMsg(2451, 0, 0);
1881 void wxStyledTextCtrl::LineEndWrapExtend() {
1882 SendMsg(2452, 0, 0);
1884 void wxStyledTextCtrl::VCHomeWrap() {
1885 SendMsg(2453, 0, 0);
1887 void wxStyledTextCtrl::VCHomeWrapExtend() {
1888 SendMsg(2454, 0, 0);
1891 // Copy the line containing the caret.
1892 void wxStyledTextCtrl::LineCopy() {
1893 SendMsg(2455, 0, 0);
1896 // Move the caret inside current view if it's not there already.
1897 void wxStyledTextCtrl::MoveCaretInsideView() {
1898 SendMsg(2401, 0, 0);
1901 // How many characters are on a line, not including end of line characters?
1902 int wxStyledTextCtrl::LineLength(int line
) {
1903 return SendMsg(2350, line
, 0);
1906 // Highlight the characters at two positions.
1907 void wxStyledTextCtrl::BraceHighlight(int pos1
, int pos2
) {
1908 SendMsg(2351, pos1
, pos2
);
1911 // Highlight the character at a position indicating there is no matching brace.
1912 void wxStyledTextCtrl::BraceBadLight(int pos
) {
1913 SendMsg(2352, pos
, 0);
1916 // Find the position of a matching brace or INVALID_POSITION if no match.
1917 int wxStyledTextCtrl::BraceMatch(int pos
) {
1918 return SendMsg(2353, pos
, 0);
1921 // Are the end of line characters visible?
1922 bool wxStyledTextCtrl::GetViewEOL() {
1923 return SendMsg(2355, 0, 0) != 0;
1926 // Make the end of line characters visible or invisible.
1927 void wxStyledTextCtrl::SetViewEOL(bool visible
) {
1928 SendMsg(2356, visible
, 0);
1931 // Retrieve a pointer to the document object.
1932 void* wxStyledTextCtrl::GetDocPointer() {
1933 return (void*)SendMsg(2357);
1936 // Change the document object used.
1937 void wxStyledTextCtrl::SetDocPointer(void* docPointer
) {
1938 SendMsg(2358, 0, (long)docPointer
);
1941 // Set which document modification events are sent to the container.
1942 void wxStyledTextCtrl::SetModEventMask(int mask
) {
1943 SendMsg(2359, mask
, 0);
1946 // Retrieve the column number which text should be kept within.
1947 int wxStyledTextCtrl::GetEdgeColumn() {
1948 return SendMsg(2360, 0, 0);
1951 // Set the column number of the edge.
1952 // If text goes past the edge then it is highlighted.
1953 void wxStyledTextCtrl::SetEdgeColumn(int column
) {
1954 SendMsg(2361, column
, 0);
1957 // Retrieve the edge highlight mode.
1958 int wxStyledTextCtrl::GetEdgeMode() {
1959 return SendMsg(2362, 0, 0);
1962 // The edge may be displayed by a line (EDGE_LINE) or by highlighting text that
1963 // goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).
1964 void wxStyledTextCtrl::SetEdgeMode(int mode
) {
1965 SendMsg(2363, mode
, 0);
1968 // Retrieve the colour used in edge indication.
1969 wxColour
wxStyledTextCtrl::GetEdgeColour() {
1970 long c
= SendMsg(2364, 0, 0);
1971 return wxColourFromLong(c
);
1974 // Change the colour used in edge indication.
1975 void wxStyledTextCtrl::SetEdgeColour(const wxColour
& edgeColour
) {
1976 SendMsg(2365, wxColourAsLong(edgeColour
), 0);
1979 // Sets the current caret position to be the search anchor.
1980 void wxStyledTextCtrl::SearchAnchor() {
1981 SendMsg(2366, 0, 0);
1984 // Find some text starting at the search anchor.
1985 // Does not ensure the selection is visible.
1986 int wxStyledTextCtrl::SearchNext(int flags
, const wxString
& text
) {
1987 return SendMsg(2367, flags
, (long)(const char*)wx2stc(text
));
1990 // Find some text starting at the search anchor and moving backwards.
1991 // Does not ensure the selection is visible.
1992 int wxStyledTextCtrl::SearchPrev(int flags
, const wxString
& text
) {
1993 return SendMsg(2368, flags
, (long)(const char*)wx2stc(text
));
1996 // Retrieves the number of lines completely visible.
1997 int wxStyledTextCtrl::LinesOnScreen() {
1998 return SendMsg(2370, 0, 0);
2001 // Set whether a pop up menu is displayed automatically when the user presses
2002 // the wrong mouse button.
2003 void wxStyledTextCtrl::UsePopUp(bool allowPopUp
) {
2004 SendMsg(2371, allowPopUp
, 0);
2007 // Is the selection rectangular? The alternative is the more common stream selection.
2008 bool wxStyledTextCtrl::SelectionIsRectangle() {
2009 return SendMsg(2372, 0, 0) != 0;
2012 // Set the zoom level. This number of points is added to the size of all fonts.
2013 // It may be positive to magnify or negative to reduce.
2014 void wxStyledTextCtrl::SetZoom(int zoom
) {
2015 SendMsg(2373, zoom
, 0);
2018 // Retrieve the zoom level.
2019 int wxStyledTextCtrl::GetZoom() {
2020 return SendMsg(2374, 0, 0);
2023 // Create a new document object.
2024 // Starts with reference count of 1 and not selected into editor.
2025 void* wxStyledTextCtrl::CreateDocument() {
2026 return (void*)SendMsg(2375);
2029 // Extend life of document.
2030 void wxStyledTextCtrl::AddRefDocument(void* docPointer
) {
2031 SendMsg(2376, 0, (long)docPointer
);
2034 // Release a reference to the document, deleting document if it fades to black.
2035 void wxStyledTextCtrl::ReleaseDocument(void* docPointer
) {
2036 SendMsg(2377, 0, (long)docPointer
);
2039 // Get which document modification events are sent to the container.
2040 int wxStyledTextCtrl::GetModEventMask() {
2041 return SendMsg(2378, 0, 0);
2044 // Change internal focus flag.
2045 void wxStyledTextCtrl::SetSTCFocus(bool focus
) {
2046 SendMsg(2380, focus
, 0);
2049 // Get internal focus flag.
2050 bool wxStyledTextCtrl::GetSTCFocus() {
2051 return SendMsg(2381, 0, 0) != 0;
2054 // Change error status - 0 = OK.
2055 void wxStyledTextCtrl::SetStatus(int statusCode
) {
2056 SendMsg(2382, statusCode
, 0);
2059 // Get error status.
2060 int wxStyledTextCtrl::GetStatus() {
2061 return SendMsg(2383, 0, 0);
2064 // Set whether the mouse is captured when its button is pressed.
2065 void wxStyledTextCtrl::SetMouseDownCaptures(bool captures
) {
2066 SendMsg(2384, captures
, 0);
2069 // Get whether mouse gets captured.
2070 bool wxStyledTextCtrl::GetMouseDownCaptures() {
2071 return SendMsg(2385, 0, 0) != 0;
2074 // Sets the cursor to one of the SC_CURSOR* values.
2075 void wxStyledTextCtrl::SetSTCCursor(int cursorType
) {
2076 SendMsg(2386, cursorType
, 0);
2080 int wxStyledTextCtrl::GetSTCCursor() {
2081 return SendMsg(2387, 0, 0);
2084 // Change the way control characters are displayed:
2085 // If symbol is < 32, keep the drawn way, else, use the given character.
2086 void wxStyledTextCtrl::SetControlCharSymbol(int symbol
) {
2087 SendMsg(2388, symbol
, 0);
2090 // Get the way control characters are displayed.
2091 int wxStyledTextCtrl::GetControlCharSymbol() {
2092 return SendMsg(2389, 0, 0);
2095 // Move to the previous change in capitalisation.
2096 void wxStyledTextCtrl::WordPartLeft() {
2097 SendMsg(2390, 0, 0);
2100 // Move to the previous change in capitalisation extending selection
2101 // to new caret position.
2102 void wxStyledTextCtrl::WordPartLeftExtend() {
2103 SendMsg(2391, 0, 0);
2106 // Move to the change next in capitalisation.
2107 void wxStyledTextCtrl::WordPartRight() {
2108 SendMsg(2392, 0, 0);
2111 // Move to the next change in capitalisation extending selection
2112 // to new caret position.
2113 void wxStyledTextCtrl::WordPartRightExtend() {
2114 SendMsg(2393, 0, 0);
2117 // Set the way the display area is determined when a particular line
2118 // is to be moved to by Find, FindNext, GotoLine, etc.
2119 void wxStyledTextCtrl::SetVisiblePolicy(int visiblePolicy
, int visibleSlop
) {
2120 SendMsg(2394, visiblePolicy
, visibleSlop
);
2123 // Delete back from the current position to the start of the line.
2124 void wxStyledTextCtrl::DelLineLeft() {
2125 SendMsg(2395, 0, 0);
2128 // Delete forwards from the current position to the end of the line.
2129 void wxStyledTextCtrl::DelLineRight() {
2130 SendMsg(2396, 0, 0);
2133 // Get and Set the xOffset (ie, horizonal scroll position).
2134 void wxStyledTextCtrl::SetXOffset(int newOffset
) {
2135 SendMsg(2397, newOffset
, 0);
2137 int wxStyledTextCtrl::GetXOffset() {
2138 return SendMsg(2398, 0, 0);
2141 // Set the last x chosen value to be the caret x position.
2142 void wxStyledTextCtrl::ChooseCaretX() {
2143 SendMsg(2399, 0, 0);
2146 // Set the way the caret is kept visible when going sideway.
2147 // The exclusion zone is given in pixels.
2148 void wxStyledTextCtrl::SetXCaretPolicy(int caretPolicy
, int caretSlop
) {
2149 SendMsg(2402, caretPolicy
, caretSlop
);
2152 // Set the way the line the caret is on is kept visible.
2153 // The exclusion zone is given in lines.
2154 void wxStyledTextCtrl::SetYCaretPolicy(int caretPolicy
, int caretSlop
) {
2155 SendMsg(2403, caretPolicy
, caretSlop
);
2158 // Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE).
2159 void wxStyledTextCtrl::SetPrintWrapMode(int mode
) {
2160 SendMsg(2406, mode
, 0);
2163 // Is printing line wrapped?
2164 int wxStyledTextCtrl::GetPrintWrapMode() {
2165 return SendMsg(2407, 0, 0);
2168 // Set a fore colour for active hotspots.
2169 void wxStyledTextCtrl::SetHotspotActiveForeground(bool useSetting
, const wxColour
& fore
) {
2170 SendMsg(2410, useSetting
, wxColourAsLong(fore
));
2173 // Set a back colour for active hotspots.
2174 void wxStyledTextCtrl::SetHotspotActiveBackground(bool useSetting
, const wxColour
& back
) {
2175 SendMsg(2411, useSetting
, wxColourAsLong(back
));
2178 // Enable / Disable underlining active hotspots.
2179 void wxStyledTextCtrl::SetHotspotActiveUnderline(bool underline
) {
2180 SendMsg(2412, underline
, 0);
2183 // Limit hotspots to single line so hotspots on two lines don't merge.
2184 void wxStyledTextCtrl::SetHotspotSingleLine(bool singleLine
) {
2185 SendMsg(2421, singleLine
, 0);
2188 // Move caret between paragraphs (delimited by empty lines).
2189 void wxStyledTextCtrl::ParaDown() {
2190 SendMsg(2413, 0, 0);
2192 void wxStyledTextCtrl::ParaDownExtend() {
2193 SendMsg(2414, 0, 0);
2195 void wxStyledTextCtrl::ParaUp() {
2196 SendMsg(2415, 0, 0);
2198 void wxStyledTextCtrl::ParaUpExtend() {
2199 SendMsg(2416, 0, 0);
2202 // Given a valid document position, return the previous position taking code
2203 // page into account. Returns 0 if passed 0.
2204 int wxStyledTextCtrl::PositionBefore(int pos
) {
2205 return SendMsg(2417, pos
, 0);
2208 // Given a valid document position, return the next position taking code
2209 // page into account. Maximum value returned is the last position in the document.
2210 int wxStyledTextCtrl::PositionAfter(int pos
) {
2211 return SendMsg(2418, pos
, 0);
2214 // Copy a range of text to the clipboard. Positions are clipped into the document.
2215 void wxStyledTextCtrl::CopyRange(int start
, int end
) {
2216 SendMsg(2419, start
, end
);
2219 // Copy argument text to the clipboard.
2220 void wxStyledTextCtrl::CopyText(int length
, const wxString
& text
) {
2221 SendMsg(2420, length
, (long)(const char*)wx2stc(text
));
2224 // Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE) or
2225 // by lines (SC_SEL_LINES).
2226 void wxStyledTextCtrl::SetSelectionMode(int mode
) {
2227 SendMsg(2422, mode
, 0);
2230 // Get the mode of the current selection.
2231 int wxStyledTextCtrl::GetSelectionMode() {
2232 return SendMsg(2423, 0, 0);
2235 // Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line).
2236 int wxStyledTextCtrl::GetLineSelStartPosition(int line
) {
2237 return SendMsg(2424, line
, 0);
2240 // Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line).
2241 int wxStyledTextCtrl::GetLineSelEndPosition(int line
) {
2242 return SendMsg(2425, line
, 0);
2245 // Move caret down one line, extending rectangular selection to new caret position.
2246 void wxStyledTextCtrl::LineDownRectExtend() {
2247 SendMsg(2426, 0, 0);
2250 // Move caret up one line, extending rectangular selection to new caret position.
2251 void wxStyledTextCtrl::LineUpRectExtend() {
2252 SendMsg(2427, 0, 0);
2255 // Move caret left one character, extending rectangular selection to new caret position.
2256 void wxStyledTextCtrl::CharLeftRectExtend() {
2257 SendMsg(2428, 0, 0);
2260 // Move caret right one character, extending rectangular selection to new caret position.
2261 void wxStyledTextCtrl::CharRightRectExtend() {
2262 SendMsg(2429, 0, 0);
2265 // Move caret to first position on line, extending rectangular selection to new caret position.
2266 void wxStyledTextCtrl::HomeRectExtend() {
2267 SendMsg(2430, 0, 0);
2270 // Move caret to before first visible character on line.
2271 // If already there move to first character on line.
2272 // In either case, extend rectangular selection to new caret position.
2273 void wxStyledTextCtrl::VCHomeRectExtend() {
2274 SendMsg(2431, 0, 0);
2277 // Move caret to last position on line, extending rectangular selection to new caret position.
2278 void wxStyledTextCtrl::LineEndRectExtend() {
2279 SendMsg(2432, 0, 0);
2282 // Move caret one page up, extending rectangular selection to new caret position.
2283 void wxStyledTextCtrl::PageUpRectExtend() {
2284 SendMsg(2433, 0, 0);
2287 // Move caret one page down, extending rectangular selection to new caret position.
2288 void wxStyledTextCtrl::PageDownRectExtend() {
2289 SendMsg(2434, 0, 0);
2292 // Move caret to top of page, or one page up if already at top of page.
2293 void wxStyledTextCtrl::StutteredPageUp() {
2294 SendMsg(2435, 0, 0);
2297 // Move caret to top of page, or one page up if already at top of page, extending selection to new caret position.
2298 void wxStyledTextCtrl::StutteredPageUpExtend() {
2299 SendMsg(2436, 0, 0);
2302 // Move caret to bottom of page, or one page down if already at bottom of page.
2303 void wxStyledTextCtrl::StutteredPageDown() {
2304 SendMsg(2437, 0, 0);
2307 // Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position.
2308 void wxStyledTextCtrl::StutteredPageDownExtend() {
2309 SendMsg(2438, 0, 0);
2312 // Move caret left one word, position cursor at end of word.
2313 void wxStyledTextCtrl::WordLeftEnd() {
2314 SendMsg(2439, 0, 0);
2317 // Move caret left one word, position cursor at end of word, extending selection to new caret position.
2318 void wxStyledTextCtrl::WordLeftEndExtend() {
2319 SendMsg(2440, 0, 0);
2322 // Move caret right one word, position cursor at end of word.
2323 void wxStyledTextCtrl::WordRightEnd() {
2324 SendMsg(2441, 0, 0);
2327 // Move caret right one word, position cursor at end of word, extending selection to new caret position.
2328 void wxStyledTextCtrl::WordRightEndExtend() {
2329 SendMsg(2442, 0, 0);
2332 // Set the set of characters making up whitespace for when moving or selecting by word.
2333 // Should be called after SetWordChars.
2334 void wxStyledTextCtrl::SetWhitespaceChars(const wxString
& characters
) {
2335 SendMsg(2443, 0, (long)(const char*)wx2stc(characters
));
2338 // Reset the set of characters for whitespace and word characters to the defaults.
2339 void wxStyledTextCtrl::SetCharsDefault() {
2340 SendMsg(2444, 0, 0);
2343 // Get currently selected item position in the auto-completion list
2344 int wxStyledTextCtrl::AutoCompGetCurrent() {
2345 return SendMsg(2445, 0, 0);
2348 // Start notifying the container of all key presses and commands.
2349 void wxStyledTextCtrl::StartRecord() {
2350 SendMsg(3001, 0, 0);
2353 // Stop notifying the container of all key presses and commands.
2354 void wxStyledTextCtrl::StopRecord() {
2355 SendMsg(3002, 0, 0);
2358 // Set the lexing language of the document.
2359 void wxStyledTextCtrl::SetLexer(int lexer
) {
2360 SendMsg(4001, lexer
, 0);
2363 // Retrieve the lexing language of the document.
2364 int wxStyledTextCtrl::GetLexer() {
2365 return SendMsg(4002, 0, 0);
2368 // Colourise a segment of the document using the current lexing language.
2369 void wxStyledTextCtrl::Colourise(int start
, int end
) {
2370 SendMsg(4003, start
, end
);
2373 // Set up a value that may be used by a lexer for some optional feature.
2374 void wxStyledTextCtrl::SetProperty(const wxString
& key
, const wxString
& value
) {
2375 SendMsg(4004, (long)(const char*)wx2stc(key
), (long)(const char*)wx2stc(value
));
2378 // Set up the key words used by the lexer.
2379 void wxStyledTextCtrl::SetKeyWords(int keywordSet
, const wxString
& keyWords
) {
2380 SendMsg(4005, keywordSet
, (long)(const char*)wx2stc(keyWords
));
2383 // Set the lexing language of the document based on string name.
2384 void wxStyledTextCtrl::SetLexerLanguage(const wxString
& language
) {
2385 SendMsg(4006, 0, (long)(const char*)wx2stc(language
));
2388 // END of generated section
2389 //----------------------------------------------------------------------
2392 // Returns the line number of the line with the caret.
2393 int wxStyledTextCtrl::GetCurrentLine() {
2394 int line
= LineFromPosition(GetCurrentPos());
2399 // Extract style settings from a spec-string which is composed of one or
2400 // more of the following comma separated elements:
2402 // bold turns on bold
2403 // italic turns on italics
2404 // fore:#RRGGBB sets the foreground colour
2405 // back:#RRGGBB sets the background colour
2406 // face:[facename] sets the font face name to use
2407 // size:[num] sets the font size in points
2408 // eol turns on eol filling
2409 // underline turns on underlining
2411 void wxStyledTextCtrl::StyleSetSpec(int styleNum
, const wxString
& spec
) {
2413 wxStringTokenizer
tkz(spec
, wxT(","));
2414 while (tkz
.HasMoreTokens()) {
2415 wxString token
= tkz
.GetNextToken();
2417 wxString option
= token
.BeforeFirst(':');
2418 wxString val
= token
.AfterFirst(':');
2420 if (option
== wxT("bold"))
2421 StyleSetBold(styleNum
, true);
2423 else if (option
== wxT("italic"))
2424 StyleSetItalic(styleNum
, true);
2426 else if (option
== wxT("underline"))
2427 StyleSetUnderline(styleNum
, true);
2429 else if (option
== wxT("eol"))
2430 StyleSetEOLFilled(styleNum
, true);
2432 else if (option
== wxT("size")) {
2434 if (val
.ToLong(&points
))
2435 StyleSetSize(styleNum
, points
);
2438 else if (option
== wxT("face"))
2439 StyleSetFaceName(styleNum
, val
);
2441 else if (option
== wxT("fore"))
2442 StyleSetForeground(styleNum
, wxColourFromSpec(val
));
2444 else if (option
== wxT("back"))
2445 StyleSetBackground(styleNum
, wxColourFromSpec(val
));
2450 // Set style size, face, bold, italic, and underline attributes from
2451 // a wxFont's attributes.
2452 void wxStyledTextCtrl::StyleSetFont(int styleNum
, wxFont
& font
) {
2454 // Ensure that the native font is initialized
2456 GetTextExtent(wxT("X"), &x
, &y
, NULL
, NULL
, &font
);
2458 int size
= font
.GetPointSize();
2459 wxString faceName
= font
.GetFaceName();
2460 bool bold
= font
.GetWeight() == wxBOLD
;
2461 bool italic
= font
.GetStyle() != wxNORMAL
;
2462 bool under
= font
.GetUnderlined();
2464 // TODO: add encoding/charset mapping
2465 StyleSetFontAttr(styleNum
, size
, faceName
, bold
, italic
, under
);
2468 // Set all font style attributes at once.
2469 void wxStyledTextCtrl::StyleSetFontAttr(int styleNum
, int size
,
2470 const wxString
& faceName
,
2471 bool bold
, bool italic
,
2473 StyleSetSize(styleNum
, size
);
2474 StyleSetFaceName(styleNum
, faceName
);
2475 StyleSetBold(styleNum
, bold
);
2476 StyleSetItalic(styleNum
, italic
);
2477 StyleSetUnderline(styleNum
, underline
);
2479 // TODO: add encoding/charset mapping
2483 // Perform one of the operations defined by the wxSTC_CMD_* constants.
2484 void wxStyledTextCtrl::CmdKeyExecute(int cmd
) {
2489 // Set the left and right margin in the edit area, measured in pixels.
2490 void wxStyledTextCtrl::SetMargins(int left
, int right
) {
2491 SetMarginLeft(left
);
2492 SetMarginRight(right
);
2496 // Retrieve the start and end positions of the current selection.
2497 void wxStyledTextCtrl::GetSelection(int* startPos
, int* endPos
) {
2498 if (startPos
!= NULL
)
2499 *startPos
= SendMsg(SCI_GETSELECTIONSTART
);
2501 *endPos
= SendMsg(SCI_GETSELECTIONEND
);
2505 // Retrieve the point in the window where a position is displayed.
2506 wxPoint
wxStyledTextCtrl::PointFromPosition(int pos
) {
2507 int x
= SendMsg(SCI_POINTXFROMPOSITION
, 0, pos
);
2508 int y
= SendMsg(SCI_POINTYFROMPOSITION
, 0, pos
);
2509 return wxPoint(x
, y
);
2512 // Scroll enough to make the given line visible
2513 void wxStyledTextCtrl::ScrollToLine(int line
) {
2514 m_swx
->DoScrollToLine(line
);
2518 // Scroll enough to make the given column visible
2519 void wxStyledTextCtrl::ScrollToColumn(int column
) {
2520 m_swx
->DoScrollToColumn(column
);
2524 bool wxStyledTextCtrl::SaveFile(const wxString
& filename
)
2526 wxFile
file(filename
, wxFile::write
);
2528 if (!file
.IsOpened())
2531 bool success
= file
.Write(GetText(), *wxConvCurrent
);
2539 bool wxStyledTextCtrl::LoadFile(const wxString
& filename
)
2541 bool success
= false;
2542 wxFile
file(filename
, wxFile::read
);
2544 if (file
.IsOpened())
2547 off_t len
= file
.Length();
2551 wxMemoryBuffer
buffer(len
+1);
2552 success
= (file
.Read(buffer
.GetData(), len
) == len
);
2554 ((char*)buffer
.GetData())[len
] = 0;
2555 contents
= wxString(buffer
, *wxConvCurrent
, len
);
2559 success
= (file
.Read(wxStringBuffer(buffer
, len
), len
) == len
);
2564 success
= true; // empty file is ok
2578 #if wxUSE_DRAG_AND_DROP
2579 wxDragResult
wxStyledTextCtrl::DoDragOver(wxCoord x
, wxCoord y
, wxDragResult def
) {
2580 return m_swx
->DoDragOver(x
, y
, def
);
2584 bool wxStyledTextCtrl::DoDropText(long x
, long y
, const wxString
& data
) {
2585 return m_swx
->DoDropText(x
, y
, data
);
2590 void wxStyledTextCtrl::SetUseAntiAliasing(bool useAA
) {
2591 m_swx
->SetUseAntiAliasing(useAA
);
2594 bool wxStyledTextCtrl::GetUseAntiAliasing() {
2595 return m_swx
->GetUseAntiAliasing();
2598 //----------------------------------------------------------------------
2601 void wxStyledTextCtrl::OnPaint(wxPaintEvent
& WXUNUSED(evt
)) {
2603 m_swx
->DoPaint(&dc
, GetUpdateRegion().GetBox());
2606 void wxStyledTextCtrl::OnScrollWin(wxScrollWinEvent
& evt
) {
2607 if (evt
.GetOrientation() == wxHORIZONTAL
)
2608 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
2610 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
2613 void wxStyledTextCtrl::OnScroll(wxScrollEvent
& evt
) {
2614 wxScrollBar
* sb
= wxDynamicCast(evt
.GetEventObject(), wxScrollBar
);
2616 if (sb
->IsVertical())
2617 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
2619 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
2623 void wxStyledTextCtrl::OnSize(wxSizeEvent
& WXUNUSED(evt
)) {
2625 wxSize sz
= GetClientSize();
2626 m_swx
->DoSize(sz
.x
, sz
.y
);
2630 void wxStyledTextCtrl::OnMouseLeftDown(wxMouseEvent
& evt
) {
2632 wxPoint pt
= evt
.GetPosition();
2633 m_swx
->DoLeftButtonDown(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
2634 evt
.ShiftDown(), evt
.ControlDown(), evt
.AltDown());
2637 void wxStyledTextCtrl::OnMouseMove(wxMouseEvent
& evt
) {
2638 wxPoint pt
= evt
.GetPosition();
2639 m_swx
->DoLeftButtonMove(Point(pt
.x
, pt
.y
));
2642 void wxStyledTextCtrl::OnMouseLeftUp(wxMouseEvent
& evt
) {
2643 wxPoint pt
= evt
.GetPosition();
2644 m_swx
->DoLeftButtonUp(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
2649 void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent
& evt
) {
2650 wxPoint pt
= evt
.GetPosition();
2651 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
2655 void wxStyledTextCtrl::OnMouseMiddleUp(wxMouseEvent
& evt
) {
2656 wxPoint pt
= evt
.GetPosition();
2657 m_swx
->DoMiddleButtonUp(Point(pt
.x
, pt
.y
));
2660 void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent
& evt
) {
2661 wxPoint pt
= evt
.GetPosition();
2662 ScreenToClient(&pt
.x
, &pt
.y
);
2664 Show context menu at event point if it's within the window,
2665 or at caret location if not
2667 wxHitTest ht
= this->HitTest(pt
);
2668 if (ht
!= wxHT_WINDOW_INSIDE
) {
2669 pt
= this->PointFromPosition(this->GetCurrentPos());
2671 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
2675 void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent
& evt
) {
2676 m_swx
->DoMouseWheel(evt
.GetWheelRotation(),
2677 evt
.GetWheelDelta(),
2678 evt
.GetLinesPerAction(),
2680 evt
.IsPageScroll());
2684 void wxStyledTextCtrl::OnChar(wxKeyEvent
& evt
) {
2685 // On (some?) non-US keyboards the AltGr key is required to enter some
2686 // common characters. It comes to us as both Alt and Ctrl down so we need
2687 // to let the char through in that case, otherwise if only ctrl or only
2688 // alt let's skip it.
2689 bool ctrl
= evt
.ControlDown();
2690 bool alt
= evt
.AltDown();
2691 bool skip
= ((ctrl
|| alt
) && ! (ctrl
&& alt
));
2693 int key
= evt
.GetKeyCode();
2695 // printf("OnChar key:%d consumed:%d ctrl:%d alt:%d skip:%d\n",
2696 // key, m_lastKeyDownConsumed, ctrl, alt, skip);
2698 if ( (key
<= WXK_START
|| key
> WXK_COMMAND
) &&
2699 !m_lastKeyDownConsumed
&& !skip
) {
2700 m_swx
->DoAddChar(key
);
2707 void wxStyledTextCtrl::OnKeyDown(wxKeyEvent
& evt
) {
2708 int key
= evt
.GetKeyCode();
2709 bool shift
= evt
.ShiftDown(),
2710 ctrl
= evt
.ControlDown(),
2711 alt
= evt
.AltDown(),
2712 meta
= evt
.MetaDown();
2714 int processed
= m_swx
->DoKeyDown(key
, shift
, ctrl
, alt
, meta
, &m_lastKeyDownConsumed
);
2716 // printf("KeyDn key:%d shift:%d ctrl:%d alt:%d processed:%d consumed:%d\n",
2717 // key, shift, ctrl, alt, processed, m_lastKeyDownConsumed);
2719 if (!processed
&& !m_lastKeyDownConsumed
)
2724 void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent
& evt
) {
2725 m_swx
->DoLoseFocus();
2730 void wxStyledTextCtrl::OnGainFocus(wxFocusEvent
& evt
) {
2731 m_swx
->DoGainFocus();
2736 void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent
& WXUNUSED(evt
)) {
2737 m_swx
->DoSysColourChange();
2741 void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent
& WXUNUSED(evt
)) {
2742 // do nothing to help avoid flashing
2747 void wxStyledTextCtrl::OnMenu(wxCommandEvent
& evt
) {
2748 m_swx
->DoCommand(evt
.GetId());
2752 void wxStyledTextCtrl::OnListBox(wxCommandEvent
& WXUNUSED(evt
)) {
2753 m_swx
->DoOnListBox();
2757 void wxStyledTextCtrl::OnIdle(wxIdleEvent
& evt
) {
2758 m_swx
->DoOnIdle(evt
);
2762 wxSize
wxStyledTextCtrl::DoGetBestSize() const
2764 // What would be the best size for a wxSTC?
2765 // Just give a reasonable minimum until something else can be figured out.
2766 return wxSize(200,100);
2770 //----------------------------------------------------------------------
2771 // Turn notifications from Scintilla into events
2774 void wxStyledTextCtrl::NotifyChange() {
2775 wxStyledTextEvent
evt(wxEVT_STC_CHANGE
, GetId());
2776 evt
.SetEventObject(this);
2777 GetEventHandler()->ProcessEvent(evt
);
2781 static void SetEventText(wxStyledTextEvent
& evt
, const char* text
,
2785 // The unicode conversion MUST have a null byte to terminate the
2786 // string so move it into a buffer first and give it one.
2787 wxMemoryBuffer
buf(length
+1);
2788 buf
.AppendData((void*)text
, length
);
2790 evt
.SetText(stc2wx(buf
));
2794 void wxStyledTextCtrl::NotifyParent(SCNotification
* _scn
) {
2795 SCNotification
& scn
= *_scn
;
2796 wxStyledTextEvent
evt(0, GetId());
2798 evt
.SetEventObject(this);
2799 evt
.SetPosition(scn
.position
);
2801 evt
.SetModifiers(scn
.modifiers
);
2803 switch (scn
.nmhdr
.code
) {
2804 case SCN_STYLENEEDED
:
2805 evt
.SetEventType(wxEVT_STC_STYLENEEDED
);
2809 evt
.SetEventType(wxEVT_STC_CHARADDED
);
2812 case SCN_SAVEPOINTREACHED
:
2813 evt
.SetEventType(wxEVT_STC_SAVEPOINTREACHED
);
2816 case SCN_SAVEPOINTLEFT
:
2817 evt
.SetEventType(wxEVT_STC_SAVEPOINTLEFT
);
2820 case SCN_MODIFYATTEMPTRO
:
2821 evt
.SetEventType(wxEVT_STC_ROMODIFYATTEMPT
);
2825 evt
.SetEventType(wxEVT_STC_KEY
);
2828 case SCN_DOUBLECLICK
:
2829 evt
.SetEventType(wxEVT_STC_DOUBLECLICK
);
2833 evt
.SetEventType(wxEVT_STC_UPDATEUI
);
2837 evt
.SetEventType(wxEVT_STC_MODIFIED
);
2838 evt
.SetModificationType(scn
.modificationType
);
2839 SetEventText(evt
, scn
.text
, scn
.length
);
2840 evt
.SetLength(scn
.length
);
2841 evt
.SetLinesAdded(scn
.linesAdded
);
2842 evt
.SetLine(scn
.line
);
2843 evt
.SetFoldLevelNow(scn
.foldLevelNow
);
2844 evt
.SetFoldLevelPrev(scn
.foldLevelPrev
);
2847 case SCN_MACRORECORD
:
2848 evt
.SetEventType(wxEVT_STC_MACRORECORD
);
2849 evt
.SetMessage(scn
.message
);
2850 evt
.SetWParam(scn
.wParam
);
2851 evt
.SetLParam(scn
.lParam
);
2854 case SCN_MARGINCLICK
:
2855 evt
.SetEventType(wxEVT_STC_MARGINCLICK
);
2856 evt
.SetMargin(scn
.margin
);
2860 evt
.SetEventType(wxEVT_STC_NEEDSHOWN
);
2861 evt
.SetLength(scn
.length
);
2865 evt
.SetEventType(wxEVT_STC_PAINTED
);
2868 case SCN_USERLISTSELECTION
:
2869 evt
.SetEventType(wxEVT_STC_USERLISTSELECTION
);
2870 evt
.SetListType(scn
.listType
);
2871 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
2874 case SCN_URIDROPPED
:
2875 evt
.SetEventType(wxEVT_STC_URIDROPPED
);
2876 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
2879 case SCN_DWELLSTART
:
2880 evt
.SetEventType(wxEVT_STC_DWELLSTART
);
2886 evt
.SetEventType(wxEVT_STC_DWELLEND
);
2892 evt
.SetEventType(wxEVT_STC_ZOOM
);
2895 case SCN_HOTSPOTCLICK
:
2896 evt
.SetEventType(wxEVT_STC_HOTSPOT_CLICK
);
2899 case SCN_HOTSPOTDOUBLECLICK
:
2900 evt
.SetEventType(wxEVT_STC_HOTSPOT_DCLICK
);
2903 case SCN_CALLTIPCLICK
:
2904 evt
.SetEventType(wxEVT_STC_CALLTIP_CLICK
);
2911 GetEventHandler()->ProcessEvent(evt
);
2915 //----------------------------------------------------------------------
2916 //----------------------------------------------------------------------
2917 //----------------------------------------------------------------------
2919 wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType
, int id
)
2920 : wxCommandEvent(commandType
, id
)
2925 m_modificationType
= 0;
2930 m_foldLevelPrev
= 0;
2938 m_dragAllowMove
= FALSE
;
2939 #if wxUSE_DRAG_AND_DROP
2940 m_dragResult
= wxDragNone
;
2944 bool wxStyledTextEvent::GetShift() const { return (m_modifiers
& SCI_SHIFT
) != 0; }
2945 bool wxStyledTextEvent::GetControl() const { return (m_modifiers
& SCI_CTRL
) != 0; }
2946 bool wxStyledTextEvent::GetAlt() const { return (m_modifiers
& SCI_ALT
) != 0; }
2949 wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent
& event
):
2950 wxCommandEvent(event
)
2952 m_position
= event
.m_position
;
2953 m_key
= event
.m_key
;
2954 m_modifiers
= event
.m_modifiers
;
2955 m_modificationType
= event
.m_modificationType
;
2956 m_text
= event
.m_text
;
2957 m_length
= event
.m_length
;
2958 m_linesAdded
= event
.m_linesAdded
;
2959 m_line
= event
.m_line
;
2960 m_foldLevelNow
= event
.m_foldLevelNow
;
2961 m_foldLevelPrev
= event
.m_foldLevelPrev
;
2963 m_margin
= event
.m_margin
;
2965 m_message
= event
.m_message
;
2966 m_wParam
= event
.m_wParam
;
2967 m_lParam
= event
.m_lParam
;
2969 m_listType
= event
.m_listType
;
2973 m_dragText
= event
.m_dragText
;
2974 m_dragAllowMove
=event
.m_dragAllowMove
;
2975 #if wxUSE_DRAG_AND_DROP
2976 m_dragResult
= event
.m_dragResult
;
2980 //----------------------------------------------------------------------
2981 //----------------------------------------------------------------------