]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/stc/stc.cpp
Use WS_EX_CONTROLPARENT for wxStaticBox in wxMSW.
[wxWidgets.git] / src / stc / stc.cpp
... / ...
CommitLineData
1////////////////////////////////////////////////////////////////////////////
2// Name: stc.cpp
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.
9//
10// Author: Robin Dunn
11//
12// Created: 13-Jan-2000
13// RCS-ID: $Id$
14// Copyright: (c) 2000 by Total Control Software
15// Licence: wxWindows licence
16/////////////////////////////////////////////////////////////////////////////
17
18/*
19 IMPORTANT: src/stc/stc.cpp is generated by src/stc/gen_iface.py from
20 src/stc/stc.cpp.in, don't edit stc.cpp file as your changes will be
21 lost after the next regeneration, edit stc.cpp.in and rerun the
22 gen_iface.py script instead!
23
24 Parts of this file generated by the script are found in between
25 the special "{{{" and "}}}" markers, the rest of it is copied
26 verbatim from src.h.in.
27 */
28
29// For compilers that support precompilation, includes "wx.h".
30#include "wx/wxprec.h"
31
32#ifdef __BORLANDC__
33 #pragma hdrstop
34#endif
35
36#if wxUSE_STC
37
38#include "wx/stc/stc.h"
39#include "wx/stc/private.h"
40
41#ifndef WX_PRECOMP
42 #include "wx/wx.h"
43#endif // WX_PRECOMP
44
45#include <ctype.h>
46
47#include "wx/tokenzr.h"
48#include "wx/mstream.h"
49#include "wx/image.h"
50#if wxUSE_FFILE
51 #include "wx/ffile.h"
52#elif wxUSE_FILE
53 #include "wx/ffile.h"
54#endif
55
56#include "ScintillaWX.h"
57
58//----------------------------------------------------------------------
59
60const char wxSTCNameStr[] = "stcwindow";
61
62#ifdef MAKELONG
63#undef MAKELONG
64#endif
65
66#define MAKELONG(a, b) ((a) | ((b) << 16))
67
68
69static long wxColourAsLong(const wxColour& co) {
70 return (((long)co.Blue() << 16) |
71 ((long)co.Green() << 8) |
72 ((long)co.Red()));
73}
74
75static wxColour wxColourFromLong(long c) {
76 wxColour clr;
77 clr.Set((unsigned char)(c & 0xff),
78 (unsigned char)((c >> 8) & 0xff),
79 (unsigned char)((c >> 16) & 0xff));
80 return clr;
81}
82
83
84static wxColour wxColourFromSpec(const wxString& spec) {
85 // spec should be a colour name or "#RRGGBB"
86 if (spec.GetChar(0) == wxT('#')) {
87
88 long red, green, blue;
89 red = green = blue = 0;
90 spec.Mid(1,2).ToLong(&red, 16);
91 spec.Mid(3,2).ToLong(&green, 16);
92 spec.Mid(5,2).ToLong(&blue, 16);
93 return wxColour((unsigned char)red,
94 (unsigned char)green,
95 (unsigned char)blue);
96 }
97 else
98 return wxColour(spec);
99}
100
101//----------------------------------------------------------------------
102
103wxDEFINE_EVENT( wxEVT_STC_CHANGE, wxStyledTextEvent );
104wxDEFINE_EVENT( wxEVT_STC_STYLENEEDED, wxStyledTextEvent );
105wxDEFINE_EVENT( wxEVT_STC_CHARADDED, wxStyledTextEvent );
106wxDEFINE_EVENT( wxEVT_STC_SAVEPOINTREACHED, wxStyledTextEvent );
107wxDEFINE_EVENT( wxEVT_STC_SAVEPOINTLEFT, wxStyledTextEvent );
108wxDEFINE_EVENT( wxEVT_STC_ROMODIFYATTEMPT, wxStyledTextEvent );
109wxDEFINE_EVENT( wxEVT_STC_KEY, wxStyledTextEvent );
110wxDEFINE_EVENT( wxEVT_STC_DOUBLECLICK, wxStyledTextEvent );
111wxDEFINE_EVENT( wxEVT_STC_UPDATEUI, wxStyledTextEvent );
112wxDEFINE_EVENT( wxEVT_STC_MODIFIED, wxStyledTextEvent );
113wxDEFINE_EVENT( wxEVT_STC_MACRORECORD, wxStyledTextEvent );
114wxDEFINE_EVENT( wxEVT_STC_MARGINCLICK, wxStyledTextEvent );
115wxDEFINE_EVENT( wxEVT_STC_NEEDSHOWN, wxStyledTextEvent );
116wxDEFINE_EVENT( wxEVT_STC_PAINTED, wxStyledTextEvent );
117wxDEFINE_EVENT( wxEVT_STC_USERLISTSELECTION, wxStyledTextEvent );
118wxDEFINE_EVENT( wxEVT_STC_URIDROPPED, wxStyledTextEvent );
119wxDEFINE_EVENT( wxEVT_STC_DWELLSTART, wxStyledTextEvent );
120wxDEFINE_EVENT( wxEVT_STC_DWELLEND, wxStyledTextEvent );
121wxDEFINE_EVENT( wxEVT_STC_START_DRAG, wxStyledTextEvent );
122wxDEFINE_EVENT( wxEVT_STC_DRAG_OVER, wxStyledTextEvent );
123wxDEFINE_EVENT( wxEVT_STC_DO_DROP, wxStyledTextEvent );
124wxDEFINE_EVENT( wxEVT_STC_ZOOM, wxStyledTextEvent );
125wxDEFINE_EVENT( wxEVT_STC_HOTSPOT_CLICK, wxStyledTextEvent );
126wxDEFINE_EVENT( wxEVT_STC_HOTSPOT_DCLICK, wxStyledTextEvent );
127wxDEFINE_EVENT( wxEVT_STC_CALLTIP_CLICK, wxStyledTextEvent );
128wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_SELECTION, wxStyledTextEvent );
129wxDEFINE_EVENT( wxEVT_STC_INDICATOR_CLICK, wxStyledTextEvent );
130wxDEFINE_EVENT( wxEVT_STC_INDICATOR_RELEASE, wxStyledTextEvent );
131wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_CANCELLED, wxStyledTextEvent );
132wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_CHAR_DELETED, wxStyledTextEvent );
133wxDEFINE_EVENT( wxEVT_STC_HOTSPOT_RELEASE_CLICK, wxStyledTextEvent );
134
135
136
137BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
138 EVT_PAINT (wxStyledTextCtrl::OnPaint)
139 EVT_SCROLLWIN (wxStyledTextCtrl::OnScrollWin)
140 EVT_SCROLL (wxStyledTextCtrl::OnScroll)
141 EVT_SIZE (wxStyledTextCtrl::OnSize)
142 EVT_LEFT_DOWN (wxStyledTextCtrl::OnMouseLeftDown)
143 // Let Scintilla see the double click as a second click
144 EVT_LEFT_DCLICK (wxStyledTextCtrl::OnMouseLeftDown)
145 EVT_MOTION (wxStyledTextCtrl::OnMouseMove)
146 EVT_LEFT_UP (wxStyledTextCtrl::OnMouseLeftUp)
147#if defined(__WXGTK__) || defined(__WXMAC__)
148 EVT_RIGHT_UP (wxStyledTextCtrl::OnMouseRightUp)
149#else
150 EVT_CONTEXT_MENU (wxStyledTextCtrl::OnContextMenu)
151#endif
152 EVT_MOUSEWHEEL (wxStyledTextCtrl::OnMouseWheel)
153 EVT_MIDDLE_UP (wxStyledTextCtrl::OnMouseMiddleUp)
154 EVT_CHAR (wxStyledTextCtrl::OnChar)
155 EVT_KEY_DOWN (wxStyledTextCtrl::OnKeyDown)
156 EVT_KILL_FOCUS (wxStyledTextCtrl::OnLoseFocus)
157 EVT_SET_FOCUS (wxStyledTextCtrl::OnGainFocus)
158 EVT_SYS_COLOUR_CHANGED (wxStyledTextCtrl::OnSysColourChanged)
159 EVT_ERASE_BACKGROUND (wxStyledTextCtrl::OnEraseBackground)
160 EVT_MENU_RANGE (10, 16, wxStyledTextCtrl::OnMenu)
161 EVT_LISTBOX_DCLICK (wxID_ANY, wxStyledTextCtrl::OnListBox)
162END_EVENT_TABLE()
163
164
165IMPLEMENT_CLASS(wxStyledTextCtrl, wxControl)
166IMPLEMENT_DYNAMIC_CLASS(wxStyledTextEvent, wxCommandEvent)
167
168#ifdef LINK_LEXERS
169// forces the linking of the lexer modules
170int Scintilla_LinkLexers();
171#endif
172
173//----------------------------------------------------------------------
174// Constructor and Destructor
175
176wxStyledTextCtrl::wxStyledTextCtrl(wxWindow *parent,
177 wxWindowID id,
178 const wxPoint& pos,
179 const wxSize& size,
180 long style,
181 const wxString& name)
182{
183 m_swx = NULL;
184 Create(parent, id, pos, size, style, name);
185}
186
187
188bool wxStyledTextCtrl::Create(wxWindow *parent,
189 wxWindowID id,
190 const wxPoint& pos,
191 const wxSize& size,
192 long style,
193 const wxString& name)
194{
195 style |= wxVSCROLL | wxHSCROLL;
196 if (!wxControl::Create(parent, id, pos, size,
197 style | wxWANTS_CHARS | wxCLIP_CHILDREN,
198 wxDefaultValidator, name))
199 return false;
200
201#ifdef LINK_LEXERS
202 Scintilla_LinkLexers();
203#endif
204 m_swx = new ScintillaWX(this);
205 m_stopWatch.Start();
206 m_lastKeyDownConsumed = false;
207 m_vScrollBar = NULL;
208 m_hScrollBar = NULL;
209#if wxUSE_UNICODE
210 // Put Scintilla into unicode (UTF-8) mode
211 SetCodePage(wxSTC_CP_UTF8);
212#endif
213
214 SetInitialSize(size);
215
216 // Reduces flicker on GTK+/X11
217 SetBackgroundStyle(wxBG_STYLE_PAINT);
218
219 // Make sure it can take the focus
220 SetCanFocus(true);
221
222 return true;
223}
224
225
226wxStyledTextCtrl::~wxStyledTextCtrl() {
227 delete m_swx;
228}
229
230
231//----------------------------------------------------------------------
232
233wxIntPtr wxStyledTextCtrl::SendMsg(int msg, wxUIntPtr wp, wxIntPtr lp) const
234{
235 return m_swx->WndProc(msg, wp, lp);
236}
237
238//----------------------------------------------------------------------
239
240// Set the vertical scrollbar to use instead of the ont that's built-in.
241void wxStyledTextCtrl::SetVScrollBar(wxScrollBar* bar) {
242 m_vScrollBar = bar;
243 if (bar != NULL) {
244 // ensure that the built-in scrollbar is not visible
245 SetScrollbar(wxVERTICAL, 0, 0, 0);
246 }
247}
248
249
250// Set the horizontal scrollbar to use instead of the ont that's built-in.
251void wxStyledTextCtrl::SetHScrollBar(wxScrollBar* bar) {
252 m_hScrollBar = bar;
253 if (bar != NULL) {
254 // ensure that the built-in scrollbar is not visible
255 SetScrollbar(wxHORIZONTAL, 0, 0, 0);
256 }
257}
258
259//----------------------------------------------------------------------
260// Generated methods implementation section {{{
261
262
263// Add text to the document at current position.
264void wxStyledTextCtrl::AddText(const wxString& text) {
265 const wxWX2MBbuf buf = wx2stc(text);
266 SendMsg(2001, wx2stclen(text, buf), (sptr_t)(const char*)buf);
267}
268
269// Add array of cells to document.
270void wxStyledTextCtrl::AddStyledText(const wxMemoryBuffer& data) {
271 SendMsg(2002, data.GetDataLen(), (sptr_t)data.GetData());
272}
273
274// Insert string at a position.
275void wxStyledTextCtrl::InsertText(int pos, const wxString& text)
276{
277 SendMsg(2003, pos, (sptr_t)(const char*)wx2stc(text));
278}
279
280// Delete all text in the document.
281void wxStyledTextCtrl::ClearAll()
282{
283 SendMsg(2004, 0, 0);
284}
285
286// Delete a range of text in the document.
287void wxStyledTextCtrl::DeleteRange(int pos, int deleteLength)
288{
289 SendMsg(2645, pos, deleteLength);
290}
291
292// Set all style bytes to 0, remove all folding information.
293void wxStyledTextCtrl::ClearDocumentStyle()
294{
295 SendMsg(2005, 0, 0);
296}
297
298// Returns the number of bytes in the document.
299int wxStyledTextCtrl::GetLength() const
300{
301 return SendMsg(2006, 0, 0);
302}
303
304// Returns the character byte at the position.
305int wxStyledTextCtrl::GetCharAt(int pos) const {
306 return (unsigned char)SendMsg(2007, pos, 0);
307}
308
309// Returns the position of the caret.
310int wxStyledTextCtrl::GetCurrentPos() const
311{
312 return SendMsg(2008, 0, 0);
313}
314
315// Returns the position of the opposite end of the selection to the caret.
316int wxStyledTextCtrl::GetAnchor() const
317{
318 return SendMsg(2009, 0, 0);
319}
320
321// Returns the style byte at the position.
322int wxStyledTextCtrl::GetStyleAt(int pos) const {
323 return (unsigned char)SendMsg(2010, pos, 0);
324}
325
326// Redoes the next action on the undo history.
327void wxStyledTextCtrl::Redo()
328{
329 SendMsg(2011, 0, 0);
330}
331
332// Choose between collecting actions into the undo
333// history and discarding them.
334void wxStyledTextCtrl::SetUndoCollection(bool collectUndo)
335{
336 SendMsg(2012, collectUndo, 0);
337}
338
339// Select all the text in the document.
340void wxStyledTextCtrl::SelectAll()
341{
342 SendMsg(2013, 0, 0);
343}
344
345// Remember the current position in the undo history as the position
346// at which the document was saved.
347void wxStyledTextCtrl::SetSavePoint()
348{
349 SendMsg(2014, 0, 0);
350}
351
352// Retrieve a buffer of cells.
353wxMemoryBuffer wxStyledTextCtrl::GetStyledText(int startPos, int endPos) {
354 wxMemoryBuffer buf;
355 if (endPos < startPos) {
356 int temp = startPos;
357 startPos = endPos;
358 endPos = temp;
359 }
360 int len = endPos - startPos;
361 if (!len) return buf;
362 TextRange tr;
363 tr.lpstrText = (char*)buf.GetWriteBuf(len*2+1);
364 tr.chrg.cpMin = startPos;
365 tr.chrg.cpMax = endPos;
366 len = SendMsg(2015, 0, (sptr_t)&tr);
367 buf.UngetWriteBuf(len);
368 return buf;
369}
370
371// Are there any redoable actions in the undo history?
372bool wxStyledTextCtrl::CanRedo() const
373{
374 return SendMsg(2016, 0, 0) != 0;
375}
376
377// Retrieve the line number at which a particular marker is located.
378int wxStyledTextCtrl::MarkerLineFromHandle(int handle)
379{
380 return SendMsg(2017, handle, 0);
381}
382
383// Delete a marker.
384void wxStyledTextCtrl::MarkerDeleteHandle(int handle)
385{
386 SendMsg(2018, handle, 0);
387}
388
389// Is undo history being collected?
390bool wxStyledTextCtrl::GetUndoCollection() const
391{
392 return SendMsg(2019, 0, 0) != 0;
393}
394
395// Are white space characters currently visible?
396// Returns one of SCWS_* constants.
397int wxStyledTextCtrl::GetViewWhiteSpace() const
398{
399 return SendMsg(2020, 0, 0);
400}
401
402// Make white space characters invisible, always visible or visible outside indentation.
403void wxStyledTextCtrl::SetViewWhiteSpace(int viewWS)
404{
405 SendMsg(2021, viewWS, 0);
406}
407
408// Find the position from a point within the window.
409int wxStyledTextCtrl::PositionFromPoint(wxPoint pt) const {
410 return SendMsg(2022, pt.x, pt.y);
411}
412
413// Find the position from a point within the window but return
414// INVALID_POSITION if not close to text.
415int wxStyledTextCtrl::PositionFromPointClose(int x, int y)
416{
417 return SendMsg(2023, x, y);
418}
419
420// Set caret to start of a line and ensure it is visible.
421void wxStyledTextCtrl::GotoLine(int line)
422{
423 SendMsg(2024, line, 0);
424}
425
426// Set caret to a position and ensure it is visible.
427void wxStyledTextCtrl::GotoPos(int pos)
428{
429 SendMsg(2025, pos, 0);
430}
431
432// Set the selection anchor to a position. The anchor is the opposite
433// end of the selection from the caret.
434void wxStyledTextCtrl::SetAnchor(int posAnchor)
435{
436 SendMsg(2026, posAnchor, 0);
437}
438
439// Retrieve the text of the line containing the caret.
440// Returns the index of the caret on the line.
441wxString wxStyledTextCtrl::GetCurLine(int* linePos) {
442 int len = LineLength(GetCurrentLine());
443 if (!len) {
444 if (linePos) *linePos = 0;
445 return wxEmptyString;
446 }
447
448 wxMemoryBuffer mbuf(len+1);
449 char* buf = (char*)mbuf.GetWriteBuf(len+1);
450
451 int pos = SendMsg(2027, len+1, (sptr_t)buf);
452 mbuf.UngetWriteBuf(len);
453 mbuf.AppendByte(0);
454 if (linePos) *linePos = pos;
455 return stc2wx(buf);
456}
457
458// Retrieve the position of the last correctly styled character.
459int wxStyledTextCtrl::GetEndStyled() const
460{
461 return SendMsg(2028, 0, 0);
462}
463
464// Convert all line endings in the document to one mode.
465void wxStyledTextCtrl::ConvertEOLs(int eolMode)
466{
467 SendMsg(2029, eolMode, 0);
468}
469
470// Retrieve the current end of line mode - one of CRLF, CR, or LF.
471int wxStyledTextCtrl::GetEOLMode() const
472{
473 return SendMsg(2030, 0, 0);
474}
475
476// Set the current end of line mode.
477void wxStyledTextCtrl::SetEOLMode(int eolMode)
478{
479 SendMsg(2031, eolMode, 0);
480}
481
482// Set the current styling position to pos and the styling mask to mask.
483// The styling mask can be used to protect some bits in each styling byte from modification.
484void wxStyledTextCtrl::StartStyling(int pos, int mask)
485{
486 SendMsg(2032, pos, mask);
487}
488
489// Change style from current styling position for length characters to a style
490// and move the current styling position to after this newly styled segment.
491void wxStyledTextCtrl::SetStyling(int length, int style)
492{
493 SendMsg(2033, length, style);
494}
495
496// Is drawing done first into a buffer or direct to the screen?
497bool wxStyledTextCtrl::GetBufferedDraw() const
498{
499 return SendMsg(2034, 0, 0) != 0;
500}
501
502// If drawing is buffered then each line of text is drawn into a bitmap buffer
503// before drawing it to the screen to avoid flicker.
504void wxStyledTextCtrl::SetBufferedDraw(bool buffered)
505{
506 SendMsg(2035, buffered, 0);
507}
508
509// Change the visible size of a tab to be a multiple of the width of a space character.
510void wxStyledTextCtrl::SetTabWidth(int tabWidth)
511{
512 SendMsg(2036, tabWidth, 0);
513}
514
515// Retrieve the visible size of a tab.
516int wxStyledTextCtrl::GetTabWidth() const
517{
518 return SendMsg(2121, 0, 0);
519}
520
521// Set the code page used to interpret the bytes of the document as characters.
522void wxStyledTextCtrl::SetCodePage(int codePage) {
523#if wxUSE_UNICODE
524 wxASSERT_MSG(codePage == wxSTC_CP_UTF8,
525 wxT("Only wxSTC_CP_UTF8 may be used when wxUSE_UNICODE is on."));
526#else
527 wxASSERT_MSG(codePage != wxSTC_CP_UTF8,
528 wxT("wxSTC_CP_UTF8 may not be used when wxUSE_UNICODE is off."));
529#endif
530 SendMsg(2037, codePage);
531}
532
533// Set the symbol used for a particular marker number,
534// and optionally the fore and background colours.
535void wxStyledTextCtrl::MarkerDefine(int markerNumber, int markerSymbol,
536 const wxColour& foreground,
537 const wxColour& background) {
538
539 SendMsg(2040, markerNumber, markerSymbol);
540 if (foreground.IsOk())
541 MarkerSetForeground(markerNumber, foreground);
542 if (background.IsOk())
543 MarkerSetBackground(markerNumber, background);
544}
545
546// Set the foreground colour used for a particular marker number.
547void wxStyledTextCtrl::MarkerSetForeground(int markerNumber, const wxColour& fore)
548{
549 SendMsg(2041, markerNumber, wxColourAsLong(fore));
550}
551
552// Set the background colour used for a particular marker number.
553void wxStyledTextCtrl::MarkerSetBackground(int markerNumber, const wxColour& back)
554{
555 SendMsg(2042, markerNumber, wxColourAsLong(back));
556}
557
558// Set the background colour used for a particular marker number when its folding block is selected.
559void wxStyledTextCtrl::MarkerSetBackgroundSelected(int markerNumber, const wxColour& back)
560{
561 SendMsg(2292, markerNumber, wxColourAsLong(back));
562}
563
564// Enable/disable highlight for current folding bloc (smallest one that contains the caret)
565void wxStyledTextCtrl::MarkerEnableHighlight(bool enabled)
566{
567 SendMsg(2293, enabled, 0);
568}
569
570// Add a marker to a line, returning an ID which can be used to find or delete the marker.
571int wxStyledTextCtrl::MarkerAdd(int line, int markerNumber)
572{
573 return SendMsg(2043, line, markerNumber);
574}
575
576// Delete a marker from a line.
577void wxStyledTextCtrl::MarkerDelete(int line, int markerNumber)
578{
579 SendMsg(2044, line, markerNumber);
580}
581
582// Delete all markers with a particular number from all lines.
583void wxStyledTextCtrl::MarkerDeleteAll(int markerNumber)
584{
585 SendMsg(2045, markerNumber, 0);
586}
587
588// Get a bit mask of all the markers set on a line.
589int wxStyledTextCtrl::MarkerGet(int line)
590{
591 return SendMsg(2046, line, 0);
592}
593
594// Find the next line at or after lineStart that includes a marker in mask.
595// Return -1 when no more lines.
596int wxStyledTextCtrl::MarkerNext(int lineStart, int markerMask)
597{
598 return SendMsg(2047, lineStart, markerMask);
599}
600
601// Find the previous line before lineStart that includes a marker in mask.
602int wxStyledTextCtrl::MarkerPrevious(int lineStart, int markerMask)
603{
604 return SendMsg(2048, lineStart, markerMask);
605}
606
607// Define a marker from a bitmap
608void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber, const wxBitmap& bmp) {
609 // convert bmp to a xpm in a string
610 wxMemoryOutputStream strm;
611 wxImage img = bmp.ConvertToImage();
612 if (img.HasAlpha())
613 img.ConvertAlphaToMask();
614 img.SaveFile(strm, wxBITMAP_TYPE_XPM);
615 size_t len = strm.GetSize();
616 char* buff = new char[len+1];
617 strm.CopyTo(buff, len);
618 buff[len] = 0;
619 SendMsg(2049, markerNumber, (sptr_t)buff);
620 delete [] buff;
621
622}
623
624// Add a set of markers to a line.
625void wxStyledTextCtrl::MarkerAddSet(int line, int set)
626{
627 SendMsg(2466, line, set);
628}
629
630// Set the alpha used for a marker that is drawn in the text area, not the margin.
631void wxStyledTextCtrl::MarkerSetAlpha(int markerNumber, int alpha)
632{
633 SendMsg(2476, markerNumber, alpha);
634}
635
636// Set a margin to be either numeric or symbolic.
637void wxStyledTextCtrl::SetMarginType(int margin, int marginType)
638{
639 SendMsg(2240, margin, marginType);
640}
641
642// Retrieve the type of a margin.
643int wxStyledTextCtrl::GetMarginType(int margin) const
644{
645 return SendMsg(2241, margin, 0);
646}
647
648// Set the width of a margin to a width expressed in pixels.
649void wxStyledTextCtrl::SetMarginWidth(int margin, int pixelWidth)
650{
651 SendMsg(2242, margin, pixelWidth);
652}
653
654// Retrieve the width of a margin in pixels.
655int wxStyledTextCtrl::GetMarginWidth(int margin) const
656{
657 return SendMsg(2243, margin, 0);
658}
659
660// Set a mask that determines which markers are displayed in a margin.
661void wxStyledTextCtrl::SetMarginMask(int margin, int mask)
662{
663 SendMsg(2244, margin, mask);
664}
665
666// Retrieve the marker mask of a margin.
667int wxStyledTextCtrl::GetMarginMask(int margin) const
668{
669 return SendMsg(2245, margin, 0);
670}
671
672// Make a margin sensitive or insensitive to mouse clicks.
673void wxStyledTextCtrl::SetMarginSensitive(int margin, bool sensitive)
674{
675 SendMsg(2246, margin, sensitive);
676}
677
678// Retrieve the mouse click sensitivity of a margin.
679bool wxStyledTextCtrl::GetMarginSensitive(int margin) const
680{
681 return SendMsg(2247, margin, 0) != 0;
682}
683
684// Set the cursor shown when the mouse is inside a margin.
685void wxStyledTextCtrl::SetMarginCursor(int margin, int cursor)
686{
687 SendMsg(2248, margin, cursor);
688}
689
690// Retrieve the cursor shown in a margin.
691int wxStyledTextCtrl::GetMarginCursor(int margin) const
692{
693 return SendMsg(2249, margin, 0);
694}
695
696// Clear all the styles and make equivalent to the global default style.
697void wxStyledTextCtrl::StyleClearAll()
698{
699 SendMsg(2050, 0, 0);
700}
701
702// Set the foreground colour of a style.
703void wxStyledTextCtrl::StyleSetForeground(int style, const wxColour& fore)
704{
705 SendMsg(2051, style, wxColourAsLong(fore));
706}
707
708// Set the background colour of a style.
709void wxStyledTextCtrl::StyleSetBackground(int style, const wxColour& back)
710{
711 SendMsg(2052, style, wxColourAsLong(back));
712}
713
714// Set a style to be bold or not.
715void wxStyledTextCtrl::StyleSetBold(int style, bool bold)
716{
717 SendMsg(2053, style, bold);
718}
719
720// Set a style to be italic or not.
721void wxStyledTextCtrl::StyleSetItalic(int style, bool italic)
722{
723 SendMsg(2054, style, italic);
724}
725
726// Set the size of characters of a style.
727void wxStyledTextCtrl::StyleSetSize(int style, int sizePoints)
728{
729 SendMsg(2055, style, sizePoints);
730}
731
732// Set the font of a style.
733void wxStyledTextCtrl::StyleSetFaceName(int style, const wxString& fontName)
734{
735 SendMsg(2056, style, (sptr_t)(const char*)wx2stc(fontName));
736}
737
738// Set a style to have its end of line filled or not.
739void wxStyledTextCtrl::StyleSetEOLFilled(int style, bool filled)
740{
741 SendMsg(2057, style, filled);
742}
743
744// Reset the default style to its state at startup
745void wxStyledTextCtrl::StyleResetDefault()
746{
747 SendMsg(2058, 0, 0);
748}
749
750// Set a style to be underlined or not.
751void wxStyledTextCtrl::StyleSetUnderline(int style, bool underline)
752{
753 SendMsg(2059, style, underline);
754}
755
756// Get the foreground colour of a style.
757wxColour wxStyledTextCtrl::StyleGetForeground(int style) const
758{
759 long c = SendMsg(2481, style, 0);
760 return wxColourFromLong(c);
761}
762
763// Get the background colour of a style.
764wxColour wxStyledTextCtrl::StyleGetBackground(int style) const
765{
766 long c = SendMsg(2482, style, 0);
767 return wxColourFromLong(c);
768}
769
770// Get is a style bold or not.
771bool wxStyledTextCtrl::StyleGetBold(int style) const
772{
773 return SendMsg(2483, style, 0) != 0;
774}
775
776// Get is a style italic or not.
777bool wxStyledTextCtrl::StyleGetItalic(int style) const
778{
779 return SendMsg(2484, style, 0) != 0;
780}
781
782// Get the size of characters of a style.
783int wxStyledTextCtrl::StyleGetSize(int style) const
784{
785 return SendMsg(2485, style, 0);
786}
787
788// Get the font facename of a style
789wxString wxStyledTextCtrl::StyleGetFaceName(int style) {
790 long msg = 2486;
791 long len = SendMsg(msg, style, 0);
792 wxMemoryBuffer mbuf(len+1);
793 char* buf = (char*)mbuf.GetWriteBuf(len+1);
794 SendMsg(msg, style, (sptr_t)buf);
795 mbuf.UngetWriteBuf(len);
796 mbuf.AppendByte(0);
797 return stc2wx(buf);
798}
799
800// Get is a style to have its end of line filled or not.
801bool wxStyledTextCtrl::StyleGetEOLFilled(int style) const
802{
803 return SendMsg(2487, style, 0) != 0;
804}
805
806// Get is a style underlined or not.
807bool wxStyledTextCtrl::StyleGetUnderline(int style) const
808{
809 return SendMsg(2488, style, 0) != 0;
810}
811
812// Get is a style mixed case, or to force upper or lower case.
813int wxStyledTextCtrl::StyleGetCase(int style) const
814{
815 return SendMsg(2489, style, 0);
816}
817
818// Get the character set of the font in a style.
819int wxStyledTextCtrl::StyleGetCharacterSet(int style) const
820{
821 return SendMsg(2490, style, 0);
822}
823
824// Get is a style visible or not.
825bool wxStyledTextCtrl::StyleGetVisible(int style) const
826{
827 return SendMsg(2491, style, 0) != 0;
828}
829
830// Get is a style changeable or not (read only).
831// Experimental feature, currently buggy.
832bool wxStyledTextCtrl::StyleGetChangeable(int style) const
833{
834 return SendMsg(2492, style, 0) != 0;
835}
836
837// Get is a style a hotspot or not.
838bool wxStyledTextCtrl::StyleGetHotSpot(int style) const
839{
840 return SendMsg(2493, style, 0) != 0;
841}
842
843// Set a style to be mixed case, or to force upper or lower case.
844void wxStyledTextCtrl::StyleSetCase(int style, int caseForce)
845{
846 SendMsg(2060, style, caseForce);
847}
848
849// Set the size of characters of a style. Size is in points multiplied by 100.
850void wxStyledTextCtrl::StyleSetSizeFractional(int style, int caseForce)
851{
852 SendMsg(2061, style, caseForce);
853}
854
855// Get the size of characters of a style in points multiplied by 100
856int wxStyledTextCtrl::StyleGetSizeFractional(int style) const
857{
858 return SendMsg(2062, style, 0);
859}
860
861// Set the weight of characters of a style.
862void wxStyledTextCtrl::StyleSetWeight(int style, int weight)
863{
864 SendMsg(2063, style, weight);
865}
866
867// Get the weight of characters of a style.
868int wxStyledTextCtrl::StyleGetWeight(int style) const
869{
870 return SendMsg(2064, style, 0);
871}
872
873// Set a style to be a hotspot or not.
874void wxStyledTextCtrl::StyleSetHotSpot(int style, bool hotspot)
875{
876 SendMsg(2409, style, hotspot);
877}
878
879// Set the foreground colour of the main and additional selections and whether to use this setting.
880void wxStyledTextCtrl::SetSelForeground(bool useSetting, const wxColour& fore)
881{
882 SendMsg(2067, useSetting, wxColourAsLong(fore));
883}
884
885// Set the background colour of the main and additional selections and whether to use this setting.
886void wxStyledTextCtrl::SetSelBackground(bool useSetting, const wxColour& back)
887{
888 SendMsg(2068, useSetting, wxColourAsLong(back));
889}
890
891// Get the alpha of the selection.
892int wxStyledTextCtrl::GetSelAlpha() const
893{
894 return SendMsg(2477, 0, 0);
895}
896
897// Set the alpha of the selection.
898void wxStyledTextCtrl::SetSelAlpha(int alpha)
899{
900 SendMsg(2478, alpha, 0);
901}
902
903// Is the selection end of line filled?
904bool wxStyledTextCtrl::GetSelEOLFilled() const
905{
906 return SendMsg(2479, 0, 0) != 0;
907}
908
909// Set the selection to have its end of line filled or not.
910void wxStyledTextCtrl::SetSelEOLFilled(bool filled)
911{
912 SendMsg(2480, filled, 0);
913}
914
915// Set the foreground colour of the caret.
916void wxStyledTextCtrl::SetCaretForeground(const wxColour& fore)
917{
918 SendMsg(2069, wxColourAsLong(fore), 0);
919}
920
921// When key+modifier combination km is pressed perform msg.
922void wxStyledTextCtrl::CmdKeyAssign(int key, int modifiers, int cmd) {
923 SendMsg(2070, MAKELONG(key, modifiers), cmd);
924}
925
926// When key+modifier combination km is pressed do nothing.
927void wxStyledTextCtrl::CmdKeyClear(int key, int modifiers) {
928 SendMsg(2071, MAKELONG(key, modifiers));
929}
930
931// Drop all key mappings.
932void wxStyledTextCtrl::CmdKeyClearAll()
933{
934 SendMsg(2072, 0, 0);
935}
936
937// Set the styles for a segment of the document.
938void wxStyledTextCtrl::SetStyleBytes(int length, char* styleBytes) {
939 SendMsg(2073, length, (sptr_t)styleBytes);
940}
941
942// Set a style to be visible or not.
943void wxStyledTextCtrl::StyleSetVisible(int style, bool visible)
944{
945 SendMsg(2074, style, visible);
946}
947
948// Get the time in milliseconds that the caret is on and off.
949int wxStyledTextCtrl::GetCaretPeriod() const
950{
951 return SendMsg(2075, 0, 0);
952}
953
954// Get the time in milliseconds that the caret is on and off. 0 = steady on.
955void wxStyledTextCtrl::SetCaretPeriod(int periodMilliseconds)
956{
957 SendMsg(2076, periodMilliseconds, 0);
958}
959
960// Set the set of characters making up words for when moving or selecting by word.
961// First sets defaults like SetCharsDefault.
962void wxStyledTextCtrl::SetWordChars(const wxString& characters)
963{
964 SendMsg(2077, 0, (sptr_t)(const char*)wx2stc(characters));
965}
966
967// Get the set of characters making up words for when moving or selecting by word.
968wxString wxStyledTextCtrl::GetWordChars() const {
969 int msg = 2646;
970 int len = SendMsg(msg, 0, (sptr_t)NULL);
971 if (!len) return wxEmptyString;
972
973 wxMemoryBuffer mbuf(len+1);
974 char* buf = (char*)mbuf.GetWriteBuf(len+1);
975 SendMsg(msg, 0, (sptr_t)buf);
976 mbuf.UngetWriteBuf(len);
977 mbuf.AppendByte(0);
978 return stc2wx(buf);
979}
980
981// Start a sequence of actions that is undone and redone as a unit.
982// May be nested.
983void wxStyledTextCtrl::BeginUndoAction()
984{
985 SendMsg(2078, 0, 0);
986}
987
988// End a sequence of actions that is undone and redone as a unit.
989void wxStyledTextCtrl::EndUndoAction()
990{
991 SendMsg(2079, 0, 0);
992}
993
994// Set an indicator to plain, squiggle or TT.
995void wxStyledTextCtrl::IndicatorSetStyle(int indic, int style)
996{
997 SendMsg(2080, indic, style);
998}
999
1000// Retrieve the style of an indicator.
1001int wxStyledTextCtrl::IndicatorGetStyle(int indic) const
1002{
1003 return SendMsg(2081, indic, 0);
1004}
1005
1006// Set the foreground colour of an indicator.
1007void wxStyledTextCtrl::IndicatorSetForeground(int indic, const wxColour& fore)
1008{
1009 SendMsg(2082, indic, wxColourAsLong(fore));
1010}
1011
1012// Retrieve the foreground colour of an indicator.
1013wxColour wxStyledTextCtrl::IndicatorGetForeground(int indic) const
1014{
1015 long c = SendMsg(2083, indic, 0);
1016 return wxColourFromLong(c);
1017}
1018
1019// Set an indicator to draw under text or over(default).
1020void wxStyledTextCtrl::IndicatorSetUnder(int indic, bool under)
1021{
1022 SendMsg(2510, indic, under);
1023}
1024
1025// Retrieve whether indicator drawn under or over text.
1026bool wxStyledTextCtrl::IndicatorGetUnder(int indic) const
1027{
1028 return SendMsg(2511, indic, 0) != 0;
1029}
1030
1031// Set the foreground colour of all whitespace and whether to use this setting.
1032void wxStyledTextCtrl::SetWhitespaceForeground(bool useSetting, const wxColour& fore)
1033{
1034 SendMsg(2084, useSetting, wxColourAsLong(fore));
1035}
1036
1037// Set the background colour of all whitespace and whether to use this setting.
1038void wxStyledTextCtrl::SetWhitespaceBackground(bool useSetting, const wxColour& back)
1039{
1040 SendMsg(2085, useSetting, wxColourAsLong(back));
1041}
1042
1043// Set the size of the dots used to mark space characters.
1044void wxStyledTextCtrl::SetWhitespaceSize(int size)
1045{
1046 SendMsg(2086, size, 0);
1047}
1048
1049// Get the size of the dots used to mark space characters.
1050int wxStyledTextCtrl::GetWhitespaceSize() const
1051{
1052 return SendMsg(2087, 0, 0);
1053}
1054
1055// Divide each styling byte into lexical class bits (default: 5) and indicator
1056// bits (default: 3). If a lexer requires more than 32 lexical states, then this
1057// is used to expand the possible states.
1058void wxStyledTextCtrl::SetStyleBits(int bits)
1059{
1060 SendMsg(2090, bits, 0);
1061}
1062
1063// Retrieve number of bits in style bytes used to hold the lexical state.
1064int wxStyledTextCtrl::GetStyleBits() const
1065{
1066 return SendMsg(2091, 0, 0);
1067}
1068
1069// Used to hold extra styling information for each line.
1070void wxStyledTextCtrl::SetLineState(int line, int state)
1071{
1072 SendMsg(2092, line, state);
1073}
1074
1075// Retrieve the extra styling information for a line.
1076int wxStyledTextCtrl::GetLineState(int line) const
1077{
1078 return SendMsg(2093, line, 0);
1079}
1080
1081// Retrieve the last line number that has line state.
1082int wxStyledTextCtrl::GetMaxLineState() const
1083{
1084 return SendMsg(2094, 0, 0);
1085}
1086
1087// Is the background of the line containing the caret in a different colour?
1088bool wxStyledTextCtrl::GetCaretLineVisible() const
1089{
1090 return SendMsg(2095, 0, 0) != 0;
1091}
1092
1093// Display the background of the line containing the caret in a different colour.
1094void wxStyledTextCtrl::SetCaretLineVisible(bool show)
1095{
1096 SendMsg(2096, show, 0);
1097}
1098
1099// Get the colour of the background of the line containing the caret.
1100wxColour wxStyledTextCtrl::GetCaretLineBackground() const
1101{
1102 long c = SendMsg(2097, 0, 0);
1103 return wxColourFromLong(c);
1104}
1105
1106// Set the colour of the background of the line containing the caret.
1107void wxStyledTextCtrl::SetCaretLineBackground(const wxColour& back)
1108{
1109 SendMsg(2098, wxColourAsLong(back), 0);
1110}
1111
1112// Set a style to be changeable or not (read only).
1113// Experimental feature, currently buggy.
1114void wxStyledTextCtrl::StyleSetChangeable(int style, bool changeable)
1115{
1116 SendMsg(2099, style, changeable);
1117}
1118
1119// Display a auto-completion list.
1120// The lenEntered parameter indicates how many characters before
1121// the caret should be used to provide context.
1122void wxStyledTextCtrl::AutoCompShow(int lenEntered, const wxString& itemList)
1123{
1124 SendMsg(2100, lenEntered, (sptr_t)(const char*)wx2stc(itemList));
1125}
1126
1127// Remove the auto-completion list from the screen.
1128void wxStyledTextCtrl::AutoCompCancel()
1129{
1130 SendMsg(2101, 0, 0);
1131}
1132
1133// Is there an auto-completion list visible?
1134bool wxStyledTextCtrl::AutoCompActive()
1135{
1136 return SendMsg(2102, 0, 0) != 0;
1137}
1138
1139// Retrieve the position of the caret when the auto-completion list was displayed.
1140int wxStyledTextCtrl::AutoCompPosStart()
1141{
1142 return SendMsg(2103, 0, 0);
1143}
1144
1145// User has selected an item so remove the list and insert the selection.
1146void wxStyledTextCtrl::AutoCompComplete()
1147{
1148 SendMsg(2104, 0, 0);
1149}
1150
1151// Define a set of character that when typed cancel the auto-completion list.
1152void wxStyledTextCtrl::AutoCompStops(const wxString& characterSet)
1153{
1154 SendMsg(2105, 0, (sptr_t)(const char*)wx2stc(characterSet));
1155}
1156
1157// Change the separator character in the string setting up an auto-completion list.
1158// Default is space but can be changed if items contain space.
1159void wxStyledTextCtrl::AutoCompSetSeparator(int separatorCharacter)
1160{
1161 SendMsg(2106, separatorCharacter, 0);
1162}
1163
1164// Retrieve the auto-completion list separator character.
1165int wxStyledTextCtrl::AutoCompGetSeparator() const
1166{
1167 return SendMsg(2107, 0, 0);
1168}
1169
1170// Select the item in the auto-completion list that starts with a string.
1171void wxStyledTextCtrl::AutoCompSelect(const wxString& text)
1172{
1173 SendMsg(2108, 0, (sptr_t)(const char*)wx2stc(text));
1174}
1175
1176// Should the auto-completion list be cancelled if the user backspaces to a
1177// position before where the box was created.
1178void wxStyledTextCtrl::AutoCompSetCancelAtStart(bool cancel)
1179{
1180 SendMsg(2110, cancel, 0);
1181}
1182
1183// Retrieve whether auto-completion cancelled by backspacing before start.
1184bool wxStyledTextCtrl::AutoCompGetCancelAtStart() const
1185{
1186 return SendMsg(2111, 0, 0) != 0;
1187}
1188
1189// Define a set of characters that when typed will cause the autocompletion to
1190// choose the selected item.
1191void wxStyledTextCtrl::AutoCompSetFillUps(const wxString& characterSet)
1192{
1193 SendMsg(2112, 0, (sptr_t)(const char*)wx2stc(characterSet));
1194}
1195
1196// Should a single item auto-completion list automatically choose the item.
1197void wxStyledTextCtrl::AutoCompSetChooseSingle(bool chooseSingle)
1198{
1199 SendMsg(2113, chooseSingle, 0);
1200}
1201
1202// Retrieve whether a single item auto-completion list automatically choose the item.
1203bool wxStyledTextCtrl::AutoCompGetChooseSingle() const
1204{
1205 return SendMsg(2114, 0, 0) != 0;
1206}
1207
1208// Set whether case is significant when performing auto-completion searches.
1209void wxStyledTextCtrl::AutoCompSetIgnoreCase(bool ignoreCase)
1210{
1211 SendMsg(2115, ignoreCase, 0);
1212}
1213
1214// Retrieve state of ignore case flag.
1215bool wxStyledTextCtrl::AutoCompGetIgnoreCase() const
1216{
1217 return SendMsg(2116, 0, 0) != 0;
1218}
1219
1220// Display a list of strings and send notification when user chooses one.
1221void wxStyledTextCtrl::UserListShow(int listType, const wxString& itemList)
1222{
1223 SendMsg(2117, listType, (sptr_t)(const char*)wx2stc(itemList));
1224}
1225
1226// Set whether or not autocompletion is hidden automatically when nothing matches.
1227void wxStyledTextCtrl::AutoCompSetAutoHide(bool autoHide)
1228{
1229 SendMsg(2118, autoHide, 0);
1230}
1231
1232// Retrieve whether or not autocompletion is hidden automatically when nothing matches.
1233bool wxStyledTextCtrl::AutoCompGetAutoHide() const
1234{
1235 return SendMsg(2119, 0, 0) != 0;
1236}
1237
1238// Set whether or not autocompletion deletes any word characters
1239// after the inserted text upon completion.
1240void wxStyledTextCtrl::AutoCompSetDropRestOfWord(bool dropRestOfWord)
1241{
1242 SendMsg(2270, dropRestOfWord, 0);
1243}
1244
1245// Retrieve whether or not autocompletion deletes any word characters
1246// after the inserted text upon completion.
1247bool wxStyledTextCtrl::AutoCompGetDropRestOfWord() const
1248{
1249 return SendMsg(2271, 0, 0) != 0;
1250}
1251
1252// Register an image for use in autocompletion lists.
1253void wxStyledTextCtrl::RegisterImage(int type, const wxBitmap& bmp) {
1254 // convert bmp to a xpm in a string
1255 wxMemoryOutputStream strm;
1256 wxImage img = bmp.ConvertToImage();
1257 if (img.HasAlpha())
1258 img.ConvertAlphaToMask();
1259 img.SaveFile(strm, wxBITMAP_TYPE_XPM);
1260 size_t len = strm.GetSize();
1261 char* buff = new char[len+1];
1262 strm.CopyTo(buff, len);
1263 buff[len] = 0;
1264 SendMsg(2405, type, (sptr_t)buff);
1265 delete [] buff;
1266
1267}
1268
1269// Clear all the registered images.
1270void wxStyledTextCtrl::ClearRegisteredImages()
1271{
1272 SendMsg(2408, 0, 0);
1273}
1274
1275// Retrieve the auto-completion list type-separator character.
1276int wxStyledTextCtrl::AutoCompGetTypeSeparator() const
1277{
1278 return SendMsg(2285, 0, 0);
1279}
1280
1281// Change the type-separator character in the string setting up an auto-completion list.
1282// Default is '?' but can be changed if items contain '?'.
1283void wxStyledTextCtrl::AutoCompSetTypeSeparator(int separatorCharacter)
1284{
1285 SendMsg(2286, separatorCharacter, 0);
1286}
1287
1288// Set the maximum width, in characters, of auto-completion and user lists.
1289// Set to 0 to autosize to fit longest item, which is the default.
1290void wxStyledTextCtrl::AutoCompSetMaxWidth(int characterCount)
1291{
1292 SendMsg(2208, characterCount, 0);
1293}
1294
1295// Get the maximum width, in characters, of auto-completion and user lists.
1296int wxStyledTextCtrl::AutoCompGetMaxWidth() const
1297{
1298 return SendMsg(2209, 0, 0);
1299}
1300
1301// Set the maximum height, in rows, of auto-completion and user lists.
1302// The default is 5 rows.
1303void wxStyledTextCtrl::AutoCompSetMaxHeight(int rowCount)
1304{
1305 SendMsg(2210, rowCount, 0);
1306}
1307
1308// Set the maximum height, in rows, of auto-completion and user lists.
1309int wxStyledTextCtrl::AutoCompGetMaxHeight() const
1310{
1311 return SendMsg(2211, 0, 0);
1312}
1313
1314// Set the number of spaces used for one level of indentation.
1315void wxStyledTextCtrl::SetIndent(int indentSize)
1316{
1317 SendMsg(2122, indentSize, 0);
1318}
1319
1320// Retrieve indentation size.
1321int wxStyledTextCtrl::GetIndent() const
1322{
1323 return SendMsg(2123, 0, 0);
1324}
1325
1326// Indentation will only use space characters if useTabs is false, otherwise
1327// it will use a combination of tabs and spaces.
1328void wxStyledTextCtrl::SetUseTabs(bool useTabs)
1329{
1330 SendMsg(2124, useTabs, 0);
1331}
1332
1333// Retrieve whether tabs will be used in indentation.
1334bool wxStyledTextCtrl::GetUseTabs() const
1335{
1336 return SendMsg(2125, 0, 0) != 0;
1337}
1338
1339// Change the indentation of a line to a number of columns.
1340void wxStyledTextCtrl::SetLineIndentation(int line, int indentSize)
1341{
1342 SendMsg(2126, line, indentSize);
1343}
1344
1345// Retrieve the number of columns that a line is indented.
1346int wxStyledTextCtrl::GetLineIndentation(int line) const
1347{
1348 return SendMsg(2127, line, 0);
1349}
1350
1351// Retrieve the position before the first non indentation character on a line.
1352int wxStyledTextCtrl::GetLineIndentPosition(int line) const
1353{
1354 return SendMsg(2128, line, 0);
1355}
1356
1357// Retrieve the column number of a position, taking tab width into account.
1358int wxStyledTextCtrl::GetColumn(int pos) const
1359{
1360 return SendMsg(2129, pos, 0);
1361}
1362
1363// Count characters between two positions.
1364int wxStyledTextCtrl::CountCharacters(int startPos, int endPos)
1365{
1366 return SendMsg(2633, startPos, endPos);
1367}
1368
1369// Show or hide the horizontal scroll bar.
1370void wxStyledTextCtrl::SetUseHorizontalScrollBar(bool show)
1371{
1372 SendMsg(2130, show, 0);
1373}
1374
1375// Is the horizontal scroll bar visible?
1376bool wxStyledTextCtrl::GetUseHorizontalScrollBar() const
1377{
1378 return SendMsg(2131, 0, 0) != 0;
1379}
1380
1381// Show or hide indentation guides.
1382void wxStyledTextCtrl::SetIndentationGuides(int indentView)
1383{
1384 SendMsg(2132, indentView, 0);
1385}
1386
1387// Are the indentation guides visible?
1388int wxStyledTextCtrl::GetIndentationGuides() const
1389{
1390 return SendMsg(2133, 0, 0);
1391}
1392
1393// Set the highlighted indentation guide column.
1394// 0 = no highlighted guide.
1395void wxStyledTextCtrl::SetHighlightGuide(int column)
1396{
1397 SendMsg(2134, column, 0);
1398}
1399
1400// Get the highlighted indentation guide column.
1401int wxStyledTextCtrl::GetHighlightGuide() const
1402{
1403 return SendMsg(2135, 0, 0);
1404}
1405
1406// Get the position after the last visible characters on a line.
1407int wxStyledTextCtrl::GetLineEndPosition(int line) const
1408{
1409 return SendMsg(2136, line, 0);
1410}
1411
1412// Get the code page used to interpret the bytes of the document as characters.
1413int wxStyledTextCtrl::GetCodePage() const
1414{
1415 return SendMsg(2137, 0, 0);
1416}
1417
1418// Get the foreground colour of the caret.
1419wxColour wxStyledTextCtrl::GetCaretForeground() const
1420{
1421 long c = SendMsg(2138, 0, 0);
1422 return wxColourFromLong(c);
1423}
1424
1425// In read-only mode?
1426bool wxStyledTextCtrl::GetReadOnly() const
1427{
1428 return SendMsg(2140, 0, 0) != 0;
1429}
1430
1431// Sets the position of the caret.
1432void wxStyledTextCtrl::SetCurrentPos(int pos)
1433{
1434 SendMsg(2141, pos, 0);
1435}
1436
1437// Sets the position that starts the selection - this becomes the anchor.
1438void wxStyledTextCtrl::SetSelectionStart(int pos)
1439{
1440 SendMsg(2142, pos, 0);
1441}
1442
1443// Returns the position at the start of the selection.
1444int wxStyledTextCtrl::GetSelectionStart() const
1445{
1446 return SendMsg(2143, 0, 0);
1447}
1448
1449// Sets the position that ends the selection - this becomes the currentPosition.
1450void wxStyledTextCtrl::SetSelectionEnd(int pos)
1451{
1452 SendMsg(2144, pos, 0);
1453}
1454
1455// Returns the position at the end of the selection.
1456int wxStyledTextCtrl::GetSelectionEnd() const
1457{
1458 return SendMsg(2145, 0, 0);
1459}
1460
1461// Set caret to a position, while removing any existing selection.
1462void wxStyledTextCtrl::SetEmptySelection(int pos)
1463{
1464 SendMsg(2556, pos, 0);
1465}
1466
1467// Sets the print magnification added to the point size of each style for printing.
1468void wxStyledTextCtrl::SetPrintMagnification(int magnification)
1469{
1470 SendMsg(2146, magnification, 0);
1471}
1472
1473// Returns the print magnification.
1474int wxStyledTextCtrl::GetPrintMagnification() const
1475{
1476 return SendMsg(2147, 0, 0);
1477}
1478
1479// Modify colours when printing for clearer printed text.
1480void wxStyledTextCtrl::SetPrintColourMode(int mode)
1481{
1482 SendMsg(2148, mode, 0);
1483}
1484
1485// Returns the print colour mode.
1486int wxStyledTextCtrl::GetPrintColourMode() const
1487{
1488 return SendMsg(2149, 0, 0);
1489}
1490
1491// Find some text in the document.
1492int wxStyledTextCtrl::FindText(int minPos, int maxPos,
1493 const wxString& text,
1494 int flags) {
1495 TextToFind ft;
1496 ft.chrg.cpMin = minPos;
1497 ft.chrg.cpMax = maxPos;
1498 const wxWX2MBbuf buf = wx2stc(text);
1499 ft.lpstrText = (char*)(const char*)buf;
1500
1501 return SendMsg(2150, flags, (sptr_t)&ft);
1502}
1503
1504// On Windows, will draw the document into a display context such as a printer.
1505 int wxStyledTextCtrl::FormatRange(bool doDraw,
1506 int startPos,
1507 int endPos,
1508 wxDC* draw,
1509 wxDC* target,
1510 wxRect renderRect,
1511 wxRect pageRect) {
1512 RangeToFormat fr;
1513
1514 if (endPos < startPos) {
1515 int temp = startPos;
1516 startPos = endPos;
1517 endPos = temp;
1518 }
1519 fr.hdc = draw;
1520 fr.hdcTarget = target;
1521 fr.rc.top = renderRect.GetTop();
1522 fr.rc.left = renderRect.GetLeft();
1523 fr.rc.right = renderRect.GetRight();
1524 fr.rc.bottom = renderRect.GetBottom();
1525 fr.rcPage.top = pageRect.GetTop();
1526 fr.rcPage.left = pageRect.GetLeft();
1527 fr.rcPage.right = pageRect.GetRight();
1528 fr.rcPage.bottom = pageRect.GetBottom();
1529 fr.chrg.cpMin = startPos;
1530 fr.chrg.cpMax = endPos;
1531
1532 return SendMsg(2151, doDraw, (sptr_t)&fr);
1533}
1534
1535// Retrieve the display line at the top of the display.
1536int wxStyledTextCtrl::GetFirstVisibleLine() const
1537{
1538 return SendMsg(2152, 0, 0);
1539}
1540
1541// Retrieve the contents of a line.
1542wxString wxStyledTextCtrl::GetLine(int line) const {
1543 int len = LineLength(line);
1544 if (!len) return wxEmptyString;
1545
1546 wxMemoryBuffer mbuf(len+1);
1547 char* buf = (char*)mbuf.GetWriteBuf(len+1);
1548 SendMsg(2153, line, (sptr_t)buf);
1549 mbuf.UngetWriteBuf(len);
1550 mbuf.AppendByte(0);
1551 return stc2wx(buf);
1552}
1553
1554// Returns the number of lines in the document. There is always at least one.
1555int wxStyledTextCtrl::GetLineCount() const
1556{
1557 return SendMsg(2154, 0, 0);
1558}
1559
1560// Sets the size in pixels of the left margin.
1561void wxStyledTextCtrl::SetMarginLeft(int pixelWidth)
1562{
1563 SendMsg(2155, 0, pixelWidth);
1564}
1565
1566// Returns the size in pixels of the left margin.
1567int wxStyledTextCtrl::GetMarginLeft() const
1568{
1569 return SendMsg(2156, 0, 0);
1570}
1571
1572// Sets the size in pixels of the right margin.
1573void wxStyledTextCtrl::SetMarginRight(int pixelWidth)
1574{
1575 SendMsg(2157, 0, pixelWidth);
1576}
1577
1578// Returns the size in pixels of the right margin.
1579int wxStyledTextCtrl::GetMarginRight() const
1580{
1581 return SendMsg(2158, 0, 0);
1582}
1583
1584// Is the document different from when it was last saved?
1585bool wxStyledTextCtrl::GetModify() const
1586{
1587 return SendMsg(2159, 0, 0) != 0;
1588}
1589
1590// Retrieve the selected text.
1591wxString wxStyledTextCtrl::GetSelectedText() {
1592 const int len = SendMsg(SCI_GETSELTEXT, 0, (sptr_t)0);
1593 if (!len) return wxEmptyString;
1594
1595 wxMemoryBuffer mbuf(len+2);
1596 char* buf = (char*)mbuf.GetWriteBuf(len+1);
1597 SendMsg(2161, 0, (sptr_t)buf);
1598 mbuf.UngetWriteBuf(len);
1599 mbuf.AppendByte(0);
1600 return stc2wx(buf);
1601}
1602
1603// Retrieve a range of text.
1604wxString wxStyledTextCtrl::GetTextRange(int startPos, int endPos) {
1605 if (endPos < startPos) {
1606 int temp = startPos;
1607 startPos = endPos;
1608 endPos = temp;
1609 }
1610 int len = endPos - startPos;
1611 if (!len) return wxEmptyString;
1612 wxMemoryBuffer mbuf(len+1);
1613 char* buf = (char*)mbuf.GetWriteBuf(len);
1614 TextRange tr;
1615 tr.lpstrText = buf;
1616 tr.chrg.cpMin = startPos;
1617 tr.chrg.cpMax = endPos;
1618 SendMsg(2162, 0, (sptr_t)&tr);
1619 mbuf.UngetWriteBuf(len);
1620 mbuf.AppendByte(0);
1621 return stc2wx(buf);
1622}
1623
1624// Draw the selection in normal style or with selection highlighted.
1625void wxStyledTextCtrl::HideSelection(bool normal)
1626{
1627 SendMsg(2163, normal, 0);
1628}
1629
1630// Retrieve the line containing a position.
1631int wxStyledTextCtrl::LineFromPosition(int pos) const
1632{
1633 return SendMsg(2166, pos, 0);
1634}
1635
1636// Retrieve the position at the start of a line.
1637int wxStyledTextCtrl::PositionFromLine(int line) const
1638{
1639 return SendMsg(2167, line, 0);
1640}
1641
1642// Scroll horizontally and vertically.
1643void wxStyledTextCtrl::LineScroll(int columns, int lines)
1644{
1645 SendMsg(2168, columns, lines);
1646}
1647
1648// Ensure the caret is visible.
1649void wxStyledTextCtrl::EnsureCaretVisible()
1650{
1651 SendMsg(2169, 0, 0);
1652}
1653
1654// Replace the selected text with the argument text.
1655void wxStyledTextCtrl::ReplaceSelection(const wxString& text)
1656{
1657 SendMsg(2170, 0, (sptr_t)(const char*)wx2stc(text));
1658}
1659
1660// Set to read only or read write.
1661void wxStyledTextCtrl::SetReadOnly(bool readOnly)
1662{
1663 SendMsg(2171, readOnly, 0);
1664}
1665
1666// Will a paste succeed?
1667bool wxStyledTextCtrl::CanPaste() const
1668{
1669 return SendMsg(2173, 0, 0) != 0;
1670}
1671
1672// Are there any undoable actions in the undo history?
1673bool wxStyledTextCtrl::CanUndo() const
1674{
1675 return SendMsg(2174, 0, 0) != 0;
1676}
1677
1678// Delete the undo history.
1679void wxStyledTextCtrl::EmptyUndoBuffer()
1680{
1681 SendMsg(2175, 0, 0);
1682}
1683
1684// Undo one action in the undo history.
1685void wxStyledTextCtrl::Undo()
1686{
1687 SendMsg(2176, 0, 0);
1688}
1689
1690// Cut the selection to the clipboard.
1691void wxStyledTextCtrl::Cut()
1692{
1693 SendMsg(2177, 0, 0);
1694}
1695
1696// Copy the selection to the clipboard.
1697void wxStyledTextCtrl::Copy()
1698{
1699 SendMsg(2178, 0, 0);
1700}
1701
1702// Paste the contents of the clipboard into the document replacing the selection.
1703void wxStyledTextCtrl::Paste()
1704{
1705 SendMsg(2179, 0, 0);
1706}
1707
1708// Clear the selection.
1709void wxStyledTextCtrl::Clear()
1710{
1711 SendMsg(2180, 0, 0);
1712}
1713
1714// Replace the contents of the document with the argument text.
1715void wxStyledTextCtrl::SetText(const wxString& text)
1716{
1717 SendMsg(2181, 0, (sptr_t)(const char*)wx2stc(text));
1718}
1719
1720// Retrieve all the text in the document.
1721wxString wxStyledTextCtrl::GetText() const {
1722 int len = GetTextLength();
1723 wxMemoryBuffer mbuf(len+1); // leave room for the null...
1724 char* buf = (char*)mbuf.GetWriteBuf(len+1);
1725 SendMsg(2182, len+1, (sptr_t)buf);
1726 mbuf.UngetWriteBuf(len);
1727 mbuf.AppendByte(0);
1728 return stc2wx(buf);
1729}
1730
1731// Retrieve the number of characters in the document.
1732int wxStyledTextCtrl::GetTextLength() const
1733{
1734 return SendMsg(2183, 0, 0);
1735}
1736
1737// Set to overtype (true) or insert mode.
1738void wxStyledTextCtrl::SetOvertype(bool overtype)
1739{
1740 SendMsg(2186, overtype, 0);
1741}
1742
1743// Returns true if overtype mode is active otherwise false is returned.
1744bool wxStyledTextCtrl::GetOvertype() const
1745{
1746 return SendMsg(2187, 0, 0) != 0;
1747}
1748
1749// Set the width of the insert mode caret.
1750void wxStyledTextCtrl::SetCaretWidth(int pixelWidth)
1751{
1752 SendMsg(2188, pixelWidth, 0);
1753}
1754
1755// Returns the width of the insert mode caret.
1756int wxStyledTextCtrl::GetCaretWidth() const
1757{
1758 return SendMsg(2189, 0, 0);
1759}
1760
1761// Sets the position that starts the target which is used for updating the
1762// document without affecting the scroll position.
1763void wxStyledTextCtrl::SetTargetStart(int pos)
1764{
1765 SendMsg(2190, pos, 0);
1766}
1767
1768// Get the position that starts the target.
1769int wxStyledTextCtrl::GetTargetStart() const
1770{
1771 return SendMsg(2191, 0, 0);
1772}
1773
1774// Sets the position that ends the target which is used for updating the
1775// document without affecting the scroll position.
1776void wxStyledTextCtrl::SetTargetEnd(int pos)
1777{
1778 SendMsg(2192, pos, 0);
1779}
1780
1781// Get the position that ends the target.
1782int wxStyledTextCtrl::GetTargetEnd() const
1783{
1784 return SendMsg(2193, 0, 0);
1785}
1786
1787// Replace the target text with the argument text.
1788// Text is counted so it can contain NULs.
1789// Returns the length of the replacement text.
1790
1791 int wxStyledTextCtrl::ReplaceTarget(const wxString& text) {
1792 const wxWX2MBbuf buf = wx2stc(text);
1793 return SendMsg(2194, wx2stclen(text, buf), (sptr_t)(const char*)buf);
1794}
1795
1796// Replace the target text with the argument text after \d processing.
1797// Text is counted so it can contain NULs.
1798// Looks for \d where d is between 1 and 9 and replaces these with the strings
1799// matched in the last search operation which were surrounded by \( and \).
1800// Returns the length of the replacement text including any change
1801// caused by processing the \d patterns.
1802
1803 int wxStyledTextCtrl::ReplaceTargetRE(const wxString& text) {
1804 const wxWX2MBbuf buf = wx2stc(text);
1805 return SendMsg(2195, wx2stclen(text, buf), (sptr_t)(const char*)buf);
1806}
1807
1808// Search for a counted string in the target and set the target to the found
1809// range. Text is counted so it can contain NULs.
1810// Returns length of range or -1 for failure in which case target is not moved.
1811
1812 int wxStyledTextCtrl::SearchInTarget(const wxString& text) {
1813 const wxWX2MBbuf buf = wx2stc(text);
1814 return SendMsg(2197, wx2stclen(text, buf), (sptr_t)(const char*)buf);
1815}
1816
1817// Set the search flags used by SearchInTarget.
1818void wxStyledTextCtrl::SetSearchFlags(int flags)
1819{
1820 SendMsg(2198, flags, 0);
1821}
1822
1823// Get the search flags used by SearchInTarget.
1824int wxStyledTextCtrl::GetSearchFlags() const
1825{
1826 return SendMsg(2199, 0, 0);
1827}
1828
1829// Show a call tip containing a definition near position pos.
1830void wxStyledTextCtrl::CallTipShow(int pos, const wxString& definition)
1831{
1832 SendMsg(2200, pos, (sptr_t)(const char*)wx2stc(definition));
1833}
1834
1835// Remove the call tip from the screen.
1836void wxStyledTextCtrl::CallTipCancel()
1837{
1838 SendMsg(2201, 0, 0);
1839}
1840
1841// Is there an active call tip?
1842bool wxStyledTextCtrl::CallTipActive()
1843{
1844 return SendMsg(2202, 0, 0) != 0;
1845}
1846
1847// Retrieve the position where the caret was before displaying the call tip.
1848int wxStyledTextCtrl::CallTipPosAtStart()
1849{
1850 return SendMsg(2203, 0, 0);
1851}
1852
1853// Highlight a segment of the definition.
1854void wxStyledTextCtrl::CallTipSetHighlight(int start, int end)
1855{
1856 SendMsg(2204, start, end);
1857}
1858
1859// Set the background colour for the call tip.
1860void wxStyledTextCtrl::CallTipSetBackground(const wxColour& back)
1861{
1862 SendMsg(2205, wxColourAsLong(back), 0);
1863}
1864
1865// Set the foreground colour for the call tip.
1866void wxStyledTextCtrl::CallTipSetForeground(const wxColour& fore)
1867{
1868 SendMsg(2206, wxColourAsLong(fore), 0);
1869}
1870
1871// Set the foreground colour for the highlighted part of the call tip.
1872void wxStyledTextCtrl::CallTipSetForegroundHighlight(const wxColour& fore)
1873{
1874 SendMsg(2207, wxColourAsLong(fore), 0);
1875}
1876
1877// Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
1878void wxStyledTextCtrl::CallTipUseStyle(int tabSize)
1879{
1880 SendMsg(2212, tabSize, 0);
1881}
1882
1883// Set position of calltip, above or below text.
1884void wxStyledTextCtrl::CallTipSetPosition(bool above)
1885{
1886 SendMsg(2213, above, 0);
1887}
1888
1889// Find the display line of a document line taking hidden lines into account.
1890int wxStyledTextCtrl::VisibleFromDocLine(int line)
1891{
1892 return SendMsg(2220, line, 0);
1893}
1894
1895// Find the document line of a display line taking hidden lines into account.
1896int wxStyledTextCtrl::DocLineFromVisible(int lineDisplay)
1897{
1898 return SendMsg(2221, lineDisplay, 0);
1899}
1900
1901// The number of display lines needed to wrap a document line
1902int wxStyledTextCtrl::WrapCount(int line)
1903{
1904 return SendMsg(2235, line, 0);
1905}
1906
1907// Set the fold level of a line.
1908// This encodes an integer level along with flags indicating whether the
1909// line is a header and whether it is effectively white space.
1910void wxStyledTextCtrl::SetFoldLevel(int line, int level)
1911{
1912 SendMsg(2222, line, level);
1913}
1914
1915// Retrieve the fold level of a line.
1916int wxStyledTextCtrl::GetFoldLevel(int line) const
1917{
1918 return SendMsg(2223, line, 0);
1919}
1920
1921// Find the last child line of a header line.
1922int wxStyledTextCtrl::GetLastChild(int line, int level) const
1923{
1924 return SendMsg(2224, line, level);
1925}
1926
1927// Find the parent line of a child line.
1928int wxStyledTextCtrl::GetFoldParent(int line) const
1929{
1930 return SendMsg(2225, line, 0);
1931}
1932
1933// Make a range of lines visible.
1934void wxStyledTextCtrl::ShowLines(int lineStart, int lineEnd)
1935{
1936 SendMsg(2226, lineStart, lineEnd);
1937}
1938
1939// Make a range of lines invisible.
1940void wxStyledTextCtrl::HideLines(int lineStart, int lineEnd)
1941{
1942 SendMsg(2227, lineStart, lineEnd);
1943}
1944
1945// Is a line visible?
1946bool wxStyledTextCtrl::GetLineVisible(int line) const
1947{
1948 return SendMsg(2228, line, 0) != 0;
1949}
1950
1951// Are all lines visible?
1952bool wxStyledTextCtrl::GetAllLinesVisible() const
1953{
1954 return SendMsg(2236, 0, 0) != 0;
1955}
1956
1957// Show the children of a header line.
1958void wxStyledTextCtrl::SetFoldExpanded(int line, bool expanded)
1959{
1960 SendMsg(2229, line, expanded);
1961}
1962
1963// Is a header line expanded?
1964bool wxStyledTextCtrl::GetFoldExpanded(int line) const
1965{
1966 return SendMsg(2230, line, 0) != 0;
1967}
1968
1969// Switch a header line between expanded and contracted.
1970void wxStyledTextCtrl::ToggleFold(int line)
1971{
1972 SendMsg(2231, line, 0);
1973}
1974
1975// Ensure a particular line is visible by expanding any header line hiding it.
1976void wxStyledTextCtrl::EnsureVisible(int line)
1977{
1978 SendMsg(2232, line, 0);
1979}
1980
1981// Set some style options for folding.
1982void wxStyledTextCtrl::SetFoldFlags(int flags)
1983{
1984 SendMsg(2233, flags, 0);
1985}
1986
1987// Ensure a particular line is visible by expanding any header line hiding it.
1988// Use the currently set visibility policy to determine which range to display.
1989void wxStyledTextCtrl::EnsureVisibleEnforcePolicy(int line)
1990{
1991 SendMsg(2234, line, 0);
1992}
1993
1994// Sets whether a tab pressed when caret is within indentation indents.
1995void wxStyledTextCtrl::SetTabIndents(bool tabIndents)
1996{
1997 SendMsg(2260, tabIndents, 0);
1998}
1999
2000// Does a tab pressed when caret is within indentation indent?
2001bool wxStyledTextCtrl::GetTabIndents() const
2002{
2003 return SendMsg(2261, 0, 0) != 0;
2004}
2005
2006// Sets whether a backspace pressed when caret is within indentation unindents.
2007void wxStyledTextCtrl::SetBackSpaceUnIndents(bool bsUnIndents)
2008{
2009 SendMsg(2262, bsUnIndents, 0);
2010}
2011
2012// Does a backspace pressed when caret is within indentation unindent?
2013bool wxStyledTextCtrl::GetBackSpaceUnIndents() const
2014{
2015 return SendMsg(2263, 0, 0) != 0;
2016}
2017
2018// Sets the time the mouse must sit still to generate a mouse dwell event.
2019void wxStyledTextCtrl::SetMouseDwellTime(int periodMilliseconds)
2020{
2021 SendMsg(2264, periodMilliseconds, 0);
2022}
2023
2024// Retrieve the time the mouse must sit still to generate a mouse dwell event.
2025int wxStyledTextCtrl::GetMouseDwellTime() const
2026{
2027 return SendMsg(2265, 0, 0);
2028}
2029
2030// Get position of start of word.
2031int wxStyledTextCtrl::WordStartPosition(int pos, bool onlyWordCharacters)
2032{
2033 return SendMsg(2266, pos, onlyWordCharacters);
2034}
2035
2036// Get position of end of word.
2037int wxStyledTextCtrl::WordEndPosition(int pos, bool onlyWordCharacters)
2038{
2039 return SendMsg(2267, pos, onlyWordCharacters);
2040}
2041
2042// Sets whether text is word wrapped.
2043void wxStyledTextCtrl::SetWrapMode(int mode)
2044{
2045 SendMsg(2268, mode, 0);
2046}
2047
2048// Retrieve whether text is word wrapped.
2049int wxStyledTextCtrl::GetWrapMode() const
2050{
2051 return SendMsg(2269, 0, 0);
2052}
2053
2054// Set the display mode of visual flags for wrapped lines.
2055void wxStyledTextCtrl::SetWrapVisualFlags(int wrapVisualFlags)
2056{
2057 SendMsg(2460, wrapVisualFlags, 0);
2058}
2059
2060// Retrive the display mode of visual flags for wrapped lines.
2061int wxStyledTextCtrl::GetWrapVisualFlags() const
2062{
2063 return SendMsg(2461, 0, 0);
2064}
2065
2066// Set the location of visual flags for wrapped lines.
2067void wxStyledTextCtrl::SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation)
2068{
2069 SendMsg(2462, wrapVisualFlagsLocation, 0);
2070}
2071
2072// Retrive the location of visual flags for wrapped lines.
2073int wxStyledTextCtrl::GetWrapVisualFlagsLocation() const
2074{
2075 return SendMsg(2463, 0, 0);
2076}
2077
2078// Set the start indent for wrapped lines.
2079void wxStyledTextCtrl::SetWrapStartIndent(int indent)
2080{
2081 SendMsg(2464, indent, 0);
2082}
2083
2084// Retrive the start indent for wrapped lines.
2085int wxStyledTextCtrl::GetWrapStartIndent() const
2086{
2087 return SendMsg(2465, 0, 0);
2088}
2089
2090// Sets how wrapped sublines are placed. Default is fixed.
2091void wxStyledTextCtrl::SetWrapIndentMode(int mode)
2092{
2093 SendMsg(2472, mode, 0);
2094}
2095
2096// Retrieve how wrapped sublines are placed. Default is fixed.
2097int wxStyledTextCtrl::GetWrapIndentMode() const
2098{
2099 return SendMsg(2473, 0, 0);
2100}
2101
2102// Sets the degree of caching of layout information.
2103void wxStyledTextCtrl::SetLayoutCache(int mode)
2104{
2105 SendMsg(2272, mode, 0);
2106}
2107
2108// Retrieve the degree of caching of layout information.
2109int wxStyledTextCtrl::GetLayoutCache() const
2110{
2111 return SendMsg(2273, 0, 0);
2112}
2113
2114// Sets the document width assumed for scrolling.
2115void wxStyledTextCtrl::SetScrollWidth(int pixelWidth)
2116{
2117 SendMsg(2274, pixelWidth, 0);
2118}
2119
2120// Retrieve the document width assumed for scrolling.
2121int wxStyledTextCtrl::GetScrollWidth() const
2122{
2123 return SendMsg(2275, 0, 0);
2124}
2125
2126// Sets whether the maximum width line displayed is used to set scroll width.
2127void wxStyledTextCtrl::SetScrollWidthTracking(bool tracking)
2128{
2129 SendMsg(2516, tracking, 0);
2130}
2131
2132// Retrieve whether the scroll width tracks wide lines.
2133bool wxStyledTextCtrl::GetScrollWidthTracking() const
2134{
2135 return SendMsg(2517, 0, 0) != 0;
2136}
2137
2138// Measure the pixel width of some text in a particular style.
2139// NUL terminated text argument.
2140// Does not handle tab or control characters.
2141int wxStyledTextCtrl::TextWidth(int style, const wxString& text)
2142{
2143 return SendMsg(2276, style, (sptr_t)(const char*)wx2stc(text));
2144}
2145
2146// Sets the scroll range so that maximum scroll position has
2147// the last line at the bottom of the view (default).
2148// Setting this to false allows scrolling one page below the last line.
2149void wxStyledTextCtrl::SetEndAtLastLine(bool endAtLastLine)
2150{
2151 SendMsg(2277, endAtLastLine, 0);
2152}
2153
2154// Retrieve whether the maximum scroll position has the last
2155// line at the bottom of the view.
2156bool wxStyledTextCtrl::GetEndAtLastLine() const
2157{
2158 return SendMsg(2278, 0, 0) != 0;
2159}
2160
2161// Retrieve the height of a particular line of text in pixels.
2162int wxStyledTextCtrl::TextHeight(int line)
2163{
2164 return SendMsg(2279, line, 0);
2165}
2166
2167// Show or hide the vertical scroll bar.
2168void wxStyledTextCtrl::SetUseVerticalScrollBar(bool show)
2169{
2170 SendMsg(2280, show, 0);
2171}
2172
2173// Is the vertical scroll bar visible?
2174bool wxStyledTextCtrl::GetUseVerticalScrollBar() const
2175{
2176 return SendMsg(2281, 0, 0) != 0;
2177}
2178
2179// Append a string to the end of the document without changing the selection.
2180void wxStyledTextCtrl::AppendText(const wxString& text) {
2181 const wxWX2MBbuf buf = wx2stc(text);
2182 SendMsg(2282, wx2stclen(text, buf), (sptr_t)(const char*)buf);
2183}
2184
2185// Is drawing done in two phases with backgrounds drawn before foregrounds?
2186bool wxStyledTextCtrl::GetTwoPhaseDraw() const
2187{
2188 return SendMsg(2283, 0, 0) != 0;
2189}
2190
2191// In twoPhaseDraw mode, drawing is performed in two phases, first the background
2192// and then the foreground. This avoids chopping off characters that overlap the next run.
2193void wxStyledTextCtrl::SetTwoPhaseDraw(bool twoPhase)
2194{
2195 SendMsg(2284, twoPhase, 0);
2196}
2197
2198// Scroll so that a display line is at the top of the display.
2199void wxStyledTextCtrl::SetFirstVisibleLine(int lineDisplay)
2200{
2201 SendMsg(2613, lineDisplay, 0);
2202}
2203
2204// Change the effect of pasting when there are multiple selections.
2205void wxStyledTextCtrl::SetMultiPaste(int multiPaste)
2206{
2207 SendMsg(2614, multiPaste, 0);
2208}
2209
2210// Retrieve the effect of pasting when there are multiple selections..
2211int wxStyledTextCtrl::GetMultiPaste() const
2212{
2213 return SendMsg(2615, 0, 0);
2214}
2215
2216// Retrieve the value of a tag from a regular expression search.
2217wxString wxStyledTextCtrl::GetTag(int tagNumber) const {
2218 int msg = 2616;
2219 int len = SendMsg(msg, tagNumber, (sptr_t)NULL);
2220 if (!len) return wxEmptyString;
2221
2222 wxMemoryBuffer mbuf(len+1);
2223 char* buf = (char*)mbuf.GetWriteBuf(len+1);
2224 SendMsg(msg, tagNumber, (sptr_t)buf);
2225 mbuf.UngetWriteBuf(len);
2226 mbuf.AppendByte(0);
2227 return stc2wx(buf);
2228}
2229
2230// Make the target range start and end be the same as the selection range start and end.
2231void wxStyledTextCtrl::TargetFromSelection()
2232{
2233 SendMsg(2287, 0, 0);
2234}
2235
2236// Join the lines in the target.
2237void wxStyledTextCtrl::LinesJoin()
2238{
2239 SendMsg(2288, 0, 0);
2240}
2241
2242// Split the lines in the target into lines that are less wide than pixelWidth
2243// where possible.
2244void wxStyledTextCtrl::LinesSplit(int pixelWidth)
2245{
2246 SendMsg(2289, pixelWidth, 0);
2247}
2248
2249// Set the colours used as a chequerboard pattern in the fold margin
2250void wxStyledTextCtrl::SetFoldMarginColour(bool useSetting, const wxColour& back)
2251{
2252 SendMsg(2290, useSetting, wxColourAsLong(back));
2253}
2254void wxStyledTextCtrl::SetFoldMarginHiColour(bool useSetting, const wxColour& fore)
2255{
2256 SendMsg(2291, useSetting, wxColourAsLong(fore));
2257}
2258
2259// Move caret down one line.
2260void wxStyledTextCtrl::LineDown()
2261{
2262 SendMsg(2300, 0, 0);
2263}
2264
2265// Move caret down one line extending selection to new caret position.
2266void wxStyledTextCtrl::LineDownExtend()
2267{
2268 SendMsg(2301, 0, 0);
2269}
2270
2271// Move caret up one line.
2272void wxStyledTextCtrl::LineUp()
2273{
2274 SendMsg(2302, 0, 0);
2275}
2276
2277// Move caret up one line extending selection to new caret position.
2278void wxStyledTextCtrl::LineUpExtend()
2279{
2280 SendMsg(2303, 0, 0);
2281}
2282
2283// Move caret left one character.
2284void wxStyledTextCtrl::CharLeft()
2285{
2286 SendMsg(2304, 0, 0);
2287}
2288
2289// Move caret left one character extending selection to new caret position.
2290void wxStyledTextCtrl::CharLeftExtend()
2291{
2292 SendMsg(2305, 0, 0);
2293}
2294
2295// Move caret right one character.
2296void wxStyledTextCtrl::CharRight()
2297{
2298 SendMsg(2306, 0, 0);
2299}
2300
2301// Move caret right one character extending selection to new caret position.
2302void wxStyledTextCtrl::CharRightExtend()
2303{
2304 SendMsg(2307, 0, 0);
2305}
2306
2307// Move caret left one word.
2308void wxStyledTextCtrl::WordLeft()
2309{
2310 SendMsg(2308, 0, 0);
2311}
2312
2313// Move caret left one word extending selection to new caret position.
2314void wxStyledTextCtrl::WordLeftExtend()
2315{
2316 SendMsg(2309, 0, 0);
2317}
2318
2319// Move caret right one word.
2320void wxStyledTextCtrl::WordRight()
2321{
2322 SendMsg(2310, 0, 0);
2323}
2324
2325// Move caret right one word extending selection to new caret position.
2326void wxStyledTextCtrl::WordRightExtend()
2327{
2328 SendMsg(2311, 0, 0);
2329}
2330
2331// Move caret to first position on line.
2332void wxStyledTextCtrl::Home()
2333{
2334 SendMsg(2312, 0, 0);
2335}
2336
2337// Move caret to first position on line extending selection to new caret position.
2338void wxStyledTextCtrl::HomeExtend()
2339{
2340 SendMsg(2313, 0, 0);
2341}
2342
2343// Move caret to last position on line.
2344void wxStyledTextCtrl::LineEnd()
2345{
2346 SendMsg(2314, 0, 0);
2347}
2348
2349// Move caret to last position on line extending selection to new caret position.
2350void wxStyledTextCtrl::LineEndExtend()
2351{
2352 SendMsg(2315, 0, 0);
2353}
2354
2355// Move caret to first position in document.
2356void wxStyledTextCtrl::DocumentStart()
2357{
2358 SendMsg(2316, 0, 0);
2359}
2360
2361// Move caret to first position in document extending selection to new caret position.
2362void wxStyledTextCtrl::DocumentStartExtend()
2363{
2364 SendMsg(2317, 0, 0);
2365}
2366
2367// Move caret to last position in document.
2368void wxStyledTextCtrl::DocumentEnd()
2369{
2370 SendMsg(2318, 0, 0);
2371}
2372
2373// Move caret to last position in document extending selection to new caret position.
2374void wxStyledTextCtrl::DocumentEndExtend()
2375{
2376 SendMsg(2319, 0, 0);
2377}
2378
2379// Move caret one page up.
2380void wxStyledTextCtrl::PageUp()
2381{
2382 SendMsg(2320, 0, 0);
2383}
2384
2385// Move caret one page up extending selection to new caret position.
2386void wxStyledTextCtrl::PageUpExtend()
2387{
2388 SendMsg(2321, 0, 0);
2389}
2390
2391// Move caret one page down.
2392void wxStyledTextCtrl::PageDown()
2393{
2394 SendMsg(2322, 0, 0);
2395}
2396
2397// Move caret one page down extending selection to new caret position.
2398void wxStyledTextCtrl::PageDownExtend()
2399{
2400 SendMsg(2323, 0, 0);
2401}
2402
2403// Switch from insert to overtype mode or the reverse.
2404void wxStyledTextCtrl::EditToggleOvertype()
2405{
2406 SendMsg(2324, 0, 0);
2407}
2408
2409// Cancel any modes such as call tip or auto-completion list display.
2410void wxStyledTextCtrl::Cancel()
2411{
2412 SendMsg(2325, 0, 0);
2413}
2414
2415// Delete the selection or if no selection, the character before the caret.
2416void wxStyledTextCtrl::DeleteBack()
2417{
2418 SendMsg(2326, 0, 0);
2419}
2420
2421// If selection is empty or all on one line replace the selection with a tab character.
2422// If more than one line selected, indent the lines.
2423void wxStyledTextCtrl::Tab()
2424{
2425 SendMsg(2327, 0, 0);
2426}
2427
2428// Dedent the selected lines.
2429void wxStyledTextCtrl::BackTab()
2430{
2431 SendMsg(2328, 0, 0);
2432}
2433
2434// Insert a new line, may use a CRLF, CR or LF depending on EOL mode.
2435void wxStyledTextCtrl::NewLine()
2436{
2437 SendMsg(2329, 0, 0);
2438}
2439
2440// Insert a Form Feed character.
2441void wxStyledTextCtrl::FormFeed()
2442{
2443 SendMsg(2330, 0, 0);
2444}
2445
2446// Move caret to before first visible character on line.
2447// If already there move to first character on line.
2448void wxStyledTextCtrl::VCHome()
2449{
2450 SendMsg(2331, 0, 0);
2451}
2452
2453// Like VCHome but extending selection to new caret position.
2454void wxStyledTextCtrl::VCHomeExtend()
2455{
2456 SendMsg(2332, 0, 0);
2457}
2458
2459// Magnify the displayed text by increasing the sizes by 1 point.
2460void wxStyledTextCtrl::ZoomIn()
2461{
2462 SendMsg(2333, 0, 0);
2463}
2464
2465// Make the displayed text smaller by decreasing the sizes by 1 point.
2466void wxStyledTextCtrl::ZoomOut()
2467{
2468 SendMsg(2334, 0, 0);
2469}
2470
2471// Delete the word to the left of the caret.
2472void wxStyledTextCtrl::DelWordLeft()
2473{
2474 SendMsg(2335, 0, 0);
2475}
2476
2477// Delete the word to the right of the caret.
2478void wxStyledTextCtrl::DelWordRight()
2479{
2480 SendMsg(2336, 0, 0);
2481}
2482
2483// Delete the word to the right of the caret, but not the trailing non-word characters.
2484void wxStyledTextCtrl::DelWordRightEnd()
2485{
2486 SendMsg(2518, 0, 0);
2487}
2488
2489// Cut the line containing the caret.
2490void wxStyledTextCtrl::LineCut()
2491{
2492 SendMsg(2337, 0, 0);
2493}
2494
2495// Delete the line containing the caret.
2496void wxStyledTextCtrl::LineDelete()
2497{
2498 SendMsg(2338, 0, 0);
2499}
2500
2501// Switch the current line with the previous.
2502void wxStyledTextCtrl::LineTranspose()
2503{
2504 SendMsg(2339, 0, 0);
2505}
2506
2507// Duplicate the current line.
2508void wxStyledTextCtrl::LineDuplicate()
2509{
2510 SendMsg(2404, 0, 0);
2511}
2512
2513// Transform the selection to lower case.
2514void wxStyledTextCtrl::LowerCase()
2515{
2516 SendMsg(2340, 0, 0);
2517}
2518
2519// Transform the selection to upper case.
2520void wxStyledTextCtrl::UpperCase()
2521{
2522 SendMsg(2341, 0, 0);
2523}
2524
2525// Scroll the document down, keeping the caret visible.
2526void wxStyledTextCtrl::LineScrollDown()
2527{
2528 SendMsg(2342, 0, 0);
2529}
2530
2531// Scroll the document up, keeping the caret visible.
2532void wxStyledTextCtrl::LineScrollUp()
2533{
2534 SendMsg(2343, 0, 0);
2535}
2536
2537// Delete the selection or if no selection, the character before the caret.
2538// Will not delete the character before at the start of a line.
2539void wxStyledTextCtrl::DeleteBackNotLine()
2540{
2541 SendMsg(2344, 0, 0);
2542}
2543
2544// Move caret to first position on display line.
2545void wxStyledTextCtrl::HomeDisplay()
2546{
2547 SendMsg(2345, 0, 0);
2548}
2549
2550// Move caret to first position on display line extending selection to
2551// new caret position.
2552void wxStyledTextCtrl::HomeDisplayExtend()
2553{
2554 SendMsg(2346, 0, 0);
2555}
2556
2557// Move caret to last position on display line.
2558void wxStyledTextCtrl::LineEndDisplay()
2559{
2560 SendMsg(2347, 0, 0);
2561}
2562
2563// Move caret to last position on display line extending selection to new
2564// caret position.
2565void wxStyledTextCtrl::LineEndDisplayExtend()
2566{
2567 SendMsg(2348, 0, 0);
2568}
2569
2570// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)?
2571// except they behave differently when word-wrap is enabled:
2572// They go first to the start / end of the display line, like (Home|LineEnd)Display
2573// The difference is that, the cursor is already at the point, it goes on to the start
2574// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
2575void wxStyledTextCtrl::HomeWrap()
2576{
2577 SendMsg(2349, 0, 0);
2578}
2579void wxStyledTextCtrl::HomeWrapExtend()
2580{
2581 SendMsg(2450, 0, 0);
2582}
2583void wxStyledTextCtrl::LineEndWrap()
2584{
2585 SendMsg(2451, 0, 0);
2586}
2587void wxStyledTextCtrl::LineEndWrapExtend()
2588{
2589 SendMsg(2452, 0, 0);
2590}
2591void wxStyledTextCtrl::VCHomeWrap()
2592{
2593 SendMsg(2453, 0, 0);
2594}
2595void wxStyledTextCtrl::VCHomeWrapExtend()
2596{
2597 SendMsg(2454, 0, 0);
2598}
2599
2600// Copy the line containing the caret.
2601void wxStyledTextCtrl::LineCopy()
2602{
2603 SendMsg(2455, 0, 0);
2604}
2605
2606// Move the caret inside current view if it's not there already.
2607void wxStyledTextCtrl::MoveCaretInsideView()
2608{
2609 SendMsg(2401, 0, 0);
2610}
2611
2612// How many characters are on a line, including end of line characters?
2613int wxStyledTextCtrl::LineLength(int line) const
2614{
2615 return SendMsg(2350, line, 0);
2616}
2617
2618// Highlight the characters at two positions.
2619void wxStyledTextCtrl::BraceHighlight(int pos1, int pos2)
2620{
2621 SendMsg(2351, pos1, pos2);
2622}
2623
2624// Use specified indicator to highlight matching braces instead of changing their style.
2625void wxStyledTextCtrl::BraceHighlightIndicator(bool useBraceHighlightIndicator, int indicator)
2626{
2627 SendMsg(2498, useBraceHighlightIndicator, indicator);
2628}
2629
2630// Highlight the character at a position indicating there is no matching brace.
2631void wxStyledTextCtrl::BraceBadLight(int pos)
2632{
2633 SendMsg(2352, pos, 0);
2634}
2635
2636// Use specified indicator to highlight non matching brace instead of changing its style.
2637void wxStyledTextCtrl::BraceBadLightIndicator(bool useBraceBadLightIndicator, int indicator)
2638{
2639 SendMsg(2499, useBraceBadLightIndicator, indicator);
2640}
2641
2642// Find the position of a matching brace or INVALID_POSITION if no match.
2643int wxStyledTextCtrl::BraceMatch(int pos)
2644{
2645 return SendMsg(2353, pos, 0);
2646}
2647
2648// Are the end of line characters visible?
2649bool wxStyledTextCtrl::GetViewEOL() const
2650{
2651 return SendMsg(2355, 0, 0) != 0;
2652}
2653
2654// Make the end of line characters visible or invisible.
2655void wxStyledTextCtrl::SetViewEOL(bool visible)
2656{
2657 SendMsg(2356, visible, 0);
2658}
2659
2660// Retrieve a pointer to the document object.
2661void* wxStyledTextCtrl::GetDocPointer() {
2662 return (void*)SendMsg(2357);
2663}
2664
2665// Change the document object used.
2666void wxStyledTextCtrl::SetDocPointer(void* docPointer) {
2667 SendMsg(2358, 0, (sptr_t)docPointer);
2668}
2669
2670// Set which document modification events are sent to the container.
2671void wxStyledTextCtrl::SetModEventMask(int mask)
2672{
2673 SendMsg(2359, mask, 0);
2674}
2675
2676// Retrieve the column number which text should be kept within.
2677int wxStyledTextCtrl::GetEdgeColumn() const
2678{
2679 return SendMsg(2360, 0, 0);
2680}
2681
2682// Set the column number of the edge.
2683// If text goes past the edge then it is highlighted.
2684void wxStyledTextCtrl::SetEdgeColumn(int column)
2685{
2686 SendMsg(2361, column, 0);
2687}
2688
2689// Retrieve the edge highlight mode.
2690int wxStyledTextCtrl::GetEdgeMode() const
2691{
2692 return SendMsg(2362, 0, 0);
2693}
2694
2695// The edge may be displayed by a line (EDGE_LINE) or by highlighting text that
2696// goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).
2697void wxStyledTextCtrl::SetEdgeMode(int mode)
2698{
2699 SendMsg(2363, mode, 0);
2700}
2701
2702// Retrieve the colour used in edge indication.
2703wxColour wxStyledTextCtrl::GetEdgeColour() const
2704{
2705 long c = SendMsg(2364, 0, 0);
2706 return wxColourFromLong(c);
2707}
2708
2709// Change the colour used in edge indication.
2710void wxStyledTextCtrl::SetEdgeColour(const wxColour& edgeColour)
2711{
2712 SendMsg(2365, wxColourAsLong(edgeColour), 0);
2713}
2714
2715// Sets the current caret position to be the search anchor.
2716void wxStyledTextCtrl::SearchAnchor()
2717{
2718 SendMsg(2366, 0, 0);
2719}
2720
2721// Find some text starting at the search anchor.
2722// Does not ensure the selection is visible.
2723int wxStyledTextCtrl::SearchNext(int flags, const wxString& text)
2724{
2725 return SendMsg(2367, flags, (sptr_t)(const char*)wx2stc(text));
2726}
2727
2728// Find some text starting at the search anchor and moving backwards.
2729// Does not ensure the selection is visible.
2730int wxStyledTextCtrl::SearchPrev(int flags, const wxString& text)
2731{
2732 return SendMsg(2368, flags, (sptr_t)(const char*)wx2stc(text));
2733}
2734
2735// Retrieves the number of lines completely visible.
2736int wxStyledTextCtrl::LinesOnScreen() const
2737{
2738 return SendMsg(2370, 0, 0);
2739}
2740
2741// Set whether a pop up menu is displayed automatically when the user presses
2742// the wrong mouse button.
2743void wxStyledTextCtrl::UsePopUp(bool allowPopUp)
2744{
2745 SendMsg(2371, allowPopUp, 0);
2746}
2747
2748// Is the selection rectangular? The alternative is the more common stream selection.
2749bool wxStyledTextCtrl::SelectionIsRectangle() const
2750{
2751 return SendMsg(2372, 0, 0) != 0;
2752}
2753
2754// Set the zoom level. This number of points is added to the size of all fonts.
2755// It may be positive to magnify or negative to reduce.
2756void wxStyledTextCtrl::SetZoom(int zoom)
2757{
2758 SendMsg(2373, zoom, 0);
2759}
2760
2761// Retrieve the zoom level.
2762int wxStyledTextCtrl::GetZoom() const
2763{
2764 return SendMsg(2374, 0, 0);
2765}
2766
2767// Create a new document object.
2768// Starts with reference count of 1 and not selected into editor.
2769void* wxStyledTextCtrl::CreateDocument() {
2770 return (void*)SendMsg(2375);
2771}
2772
2773// Extend life of document.
2774void wxStyledTextCtrl::AddRefDocument(void* docPointer) {
2775 SendMsg(2376, 0, (sptr_t)docPointer);
2776}
2777
2778// Release a reference to the document, deleting document if it fades to black.
2779void wxStyledTextCtrl::ReleaseDocument(void* docPointer) {
2780 SendMsg(2377, 0, (sptr_t)docPointer);
2781}
2782
2783// Get which document modification events are sent to the container.
2784int wxStyledTextCtrl::GetModEventMask() const
2785{
2786 return SendMsg(2378, 0, 0);
2787}
2788
2789// Change internal focus flag.
2790void wxStyledTextCtrl::SetSTCFocus(bool focus)
2791{
2792 SendMsg(2380, focus, 0);
2793}
2794
2795// Get internal focus flag.
2796bool wxStyledTextCtrl::GetSTCFocus() const
2797{
2798 return SendMsg(2381, 0, 0) != 0;
2799}
2800
2801// Change error status - 0 = OK.
2802void wxStyledTextCtrl::SetStatus(int statusCode)
2803{
2804 SendMsg(2382, statusCode, 0);
2805}
2806
2807// Get error status.
2808int wxStyledTextCtrl::GetStatus() const
2809{
2810 return SendMsg(2383, 0, 0);
2811}
2812
2813// Set whether the mouse is captured when its button is pressed.
2814void wxStyledTextCtrl::SetMouseDownCaptures(bool captures)
2815{
2816 SendMsg(2384, captures, 0);
2817}
2818
2819// Get whether mouse gets captured.
2820bool wxStyledTextCtrl::GetMouseDownCaptures() const
2821{
2822 return SendMsg(2385, 0, 0) != 0;
2823}
2824
2825// Sets the cursor to one of the SC_CURSOR* values.
2826void wxStyledTextCtrl::SetSTCCursor(int cursorType)
2827{
2828 SendMsg(2386, cursorType, 0);
2829}
2830
2831// Get cursor type.
2832int wxStyledTextCtrl::GetSTCCursor() const
2833{
2834 return SendMsg(2387, 0, 0);
2835}
2836
2837// Change the way control characters are displayed:
2838// If symbol is < 32, keep the drawn way, else, use the given character.
2839void wxStyledTextCtrl::SetControlCharSymbol(int symbol)
2840{
2841 SendMsg(2388, symbol, 0);
2842}
2843
2844// Get the way control characters are displayed.
2845int wxStyledTextCtrl::GetControlCharSymbol() const
2846{
2847 return SendMsg(2389, 0, 0);
2848}
2849
2850// Move to the previous change in capitalisation.
2851void wxStyledTextCtrl::WordPartLeft()
2852{
2853 SendMsg(2390, 0, 0);
2854}
2855
2856// Move to the previous change in capitalisation extending selection
2857// to new caret position.
2858void wxStyledTextCtrl::WordPartLeftExtend()
2859{
2860 SendMsg(2391, 0, 0);
2861}
2862
2863// Move to the change next in capitalisation.
2864void wxStyledTextCtrl::WordPartRight()
2865{
2866 SendMsg(2392, 0, 0);
2867}
2868
2869// Move to the next change in capitalisation extending selection
2870// to new caret position.
2871void wxStyledTextCtrl::WordPartRightExtend()
2872{
2873 SendMsg(2393, 0, 0);
2874}
2875
2876// Set the way the display area is determined when a particular line
2877// is to be moved to by Find, FindNext, GotoLine, etc.
2878void wxStyledTextCtrl::SetVisiblePolicy(int visiblePolicy, int visibleSlop)
2879{
2880 SendMsg(2394, visiblePolicy, visibleSlop);
2881}
2882
2883// Delete back from the current position to the start of the line.
2884void wxStyledTextCtrl::DelLineLeft()
2885{
2886 SendMsg(2395, 0, 0);
2887}
2888
2889// Delete forwards from the current position to the end of the line.
2890void wxStyledTextCtrl::DelLineRight()
2891{
2892 SendMsg(2396, 0, 0);
2893}
2894
2895// Get and Set the xOffset (ie, horizontal scroll position).
2896void wxStyledTextCtrl::SetXOffset(int newOffset)
2897{
2898 SendMsg(2397, newOffset, 0);
2899}
2900int wxStyledTextCtrl::GetXOffset() const
2901{
2902 return SendMsg(2398, 0, 0);
2903}
2904
2905// Set the last x chosen value to be the caret x position.
2906void wxStyledTextCtrl::ChooseCaretX()
2907{
2908 SendMsg(2399, 0, 0);
2909}
2910
2911// Set the way the caret is kept visible when going sideways.
2912// The exclusion zone is given in pixels.
2913void wxStyledTextCtrl::SetXCaretPolicy(int caretPolicy, int caretSlop)
2914{
2915 SendMsg(2402, caretPolicy, caretSlop);
2916}
2917
2918// Set the way the line the caret is on is kept visible.
2919// The exclusion zone is given in lines.
2920void wxStyledTextCtrl::SetYCaretPolicy(int caretPolicy, int caretSlop)
2921{
2922 SendMsg(2403, caretPolicy, caretSlop);
2923}
2924
2925// Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE).
2926void wxStyledTextCtrl::SetPrintWrapMode(int mode)
2927{
2928 SendMsg(2406, mode, 0);
2929}
2930
2931// Is printing line wrapped?
2932int wxStyledTextCtrl::GetPrintWrapMode() const
2933{
2934 return SendMsg(2407, 0, 0);
2935}
2936
2937// Set a fore colour for active hotspots.
2938void wxStyledTextCtrl::SetHotspotActiveForeground(bool useSetting, const wxColour& fore)
2939{
2940 SendMsg(2410, useSetting, wxColourAsLong(fore));
2941}
2942
2943// Get the fore colour for active hotspots.
2944wxColour wxStyledTextCtrl::GetHotspotActiveForeground() const
2945{
2946 long c = SendMsg(2494, 0, 0);
2947 return wxColourFromLong(c);
2948}
2949
2950// Set a back colour for active hotspots.
2951void wxStyledTextCtrl::SetHotspotActiveBackground(bool useSetting, const wxColour& back)
2952{
2953 SendMsg(2411, useSetting, wxColourAsLong(back));
2954}
2955
2956// Get the back colour for active hotspots.
2957wxColour wxStyledTextCtrl::GetHotspotActiveBackground() const
2958{
2959 long c = SendMsg(2495, 0, 0);
2960 return wxColourFromLong(c);
2961}
2962
2963// Enable / Disable underlining active hotspots.
2964void wxStyledTextCtrl::SetHotspotActiveUnderline(bool underline)
2965{
2966 SendMsg(2412, underline, 0);
2967}
2968
2969// Get whether underlining for active hotspots.
2970bool wxStyledTextCtrl::GetHotspotActiveUnderline() const
2971{
2972 return SendMsg(2496, 0, 0) != 0;
2973}
2974
2975// Limit hotspots to single line so hotspots on two lines don't merge.
2976void wxStyledTextCtrl::SetHotspotSingleLine(bool singleLine)
2977{
2978 SendMsg(2421, singleLine, 0);
2979}
2980
2981// Get the HotspotSingleLine property
2982bool wxStyledTextCtrl::GetHotspotSingleLine() const
2983{
2984 return SendMsg(2497, 0, 0) != 0;
2985}
2986
2987// Move caret between paragraphs (delimited by empty lines).
2988void wxStyledTextCtrl::ParaDown()
2989{
2990 SendMsg(2413, 0, 0);
2991}
2992void wxStyledTextCtrl::ParaDownExtend()
2993{
2994 SendMsg(2414, 0, 0);
2995}
2996void wxStyledTextCtrl::ParaUp()
2997{
2998 SendMsg(2415, 0, 0);
2999}
3000void wxStyledTextCtrl::ParaUpExtend()
3001{
3002 SendMsg(2416, 0, 0);
3003}
3004
3005// Given a valid document position, return the previous position taking code
3006// page into account. Returns 0 if passed 0.
3007int wxStyledTextCtrl::PositionBefore(int pos)
3008{
3009 return SendMsg(2417, pos, 0);
3010}
3011
3012// Given a valid document position, return the next position taking code
3013// page into account. Maximum value returned is the last position in the document.
3014int wxStyledTextCtrl::PositionAfter(int pos)
3015{
3016 return SendMsg(2418, pos, 0);
3017}
3018
3019// Copy a range of text to the clipboard. Positions are clipped into the document.
3020void wxStyledTextCtrl::CopyRange(int start, int end)
3021{
3022 SendMsg(2419, start, end);
3023}
3024
3025// Copy argument text to the clipboard.
3026void wxStyledTextCtrl::CopyText(int length, const wxString& text)
3027{
3028 SendMsg(2420, length, (sptr_t)(const char*)wx2stc(text));
3029}
3030
3031// Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE/SC_SEL_THIN) or
3032// by lines (SC_SEL_LINES).
3033void wxStyledTextCtrl::SetSelectionMode(int mode)
3034{
3035 SendMsg(2422, mode, 0);
3036}
3037
3038// Get the mode of the current selection.
3039int wxStyledTextCtrl::GetSelectionMode() const
3040{
3041 return SendMsg(2423, 0, 0);
3042}
3043
3044// Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line).
3045int wxStyledTextCtrl::GetLineSelStartPosition(int line)
3046{
3047 return SendMsg(2424, line, 0);
3048}
3049
3050// Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line).
3051int wxStyledTextCtrl::GetLineSelEndPosition(int line)
3052{
3053 return SendMsg(2425, line, 0);
3054}
3055
3056// Move caret down one line, extending rectangular selection to new caret position.
3057void wxStyledTextCtrl::LineDownRectExtend()
3058{
3059 SendMsg(2426, 0, 0);
3060}
3061
3062// Move caret up one line, extending rectangular selection to new caret position.
3063void wxStyledTextCtrl::LineUpRectExtend()
3064{
3065 SendMsg(2427, 0, 0);
3066}
3067
3068// Move caret left one character, extending rectangular selection to new caret position.
3069void wxStyledTextCtrl::CharLeftRectExtend()
3070{
3071 SendMsg(2428, 0, 0);
3072}
3073
3074// Move caret right one character, extending rectangular selection to new caret position.
3075void wxStyledTextCtrl::CharRightRectExtend()
3076{
3077 SendMsg(2429, 0, 0);
3078}
3079
3080// Move caret to first position on line, extending rectangular selection to new caret position.
3081void wxStyledTextCtrl::HomeRectExtend()
3082{
3083 SendMsg(2430, 0, 0);
3084}
3085
3086// Move caret to before first visible character on line.
3087// If already there move to first character on line.
3088// In either case, extend rectangular selection to new caret position.
3089void wxStyledTextCtrl::VCHomeRectExtend()
3090{
3091 SendMsg(2431, 0, 0);
3092}
3093
3094// Move caret to last position on line, extending rectangular selection to new caret position.
3095void wxStyledTextCtrl::LineEndRectExtend()
3096{
3097 SendMsg(2432, 0, 0);
3098}
3099
3100// Move caret one page up, extending rectangular selection to new caret position.
3101void wxStyledTextCtrl::PageUpRectExtend()
3102{
3103 SendMsg(2433, 0, 0);
3104}
3105
3106// Move caret one page down, extending rectangular selection to new caret position.
3107void wxStyledTextCtrl::PageDownRectExtend()
3108{
3109 SendMsg(2434, 0, 0);
3110}
3111
3112// Move caret to top of page, or one page up if already at top of page.
3113void wxStyledTextCtrl::StutteredPageUp()
3114{
3115 SendMsg(2435, 0, 0);
3116}
3117
3118// Move caret to top of page, or one page up if already at top of page, extending selection to new caret position.
3119void wxStyledTextCtrl::StutteredPageUpExtend()
3120{
3121 SendMsg(2436, 0, 0);
3122}
3123
3124// Move caret to bottom of page, or one page down if already at bottom of page.
3125void wxStyledTextCtrl::StutteredPageDown()
3126{
3127 SendMsg(2437, 0, 0);
3128}
3129
3130// Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position.
3131void wxStyledTextCtrl::StutteredPageDownExtend()
3132{
3133 SendMsg(2438, 0, 0);
3134}
3135
3136// Move caret left one word, position cursor at end of word.
3137void wxStyledTextCtrl::WordLeftEnd()
3138{
3139 SendMsg(2439, 0, 0);
3140}
3141
3142// Move caret left one word, position cursor at end of word, extending selection to new caret position.
3143void wxStyledTextCtrl::WordLeftEndExtend()
3144{
3145 SendMsg(2440, 0, 0);
3146}
3147
3148// Move caret right one word, position cursor at end of word.
3149void wxStyledTextCtrl::WordRightEnd()
3150{
3151 SendMsg(2441, 0, 0);
3152}
3153
3154// Move caret right one word, position cursor at end of word, extending selection to new caret position.
3155void wxStyledTextCtrl::WordRightEndExtend()
3156{
3157 SendMsg(2442, 0, 0);
3158}
3159
3160// Set the set of characters making up whitespace for when moving or selecting by word.
3161// Should be called after SetWordChars.
3162void wxStyledTextCtrl::SetWhitespaceChars(const wxString& characters)
3163{
3164 SendMsg(2443, 0, (sptr_t)(const char*)wx2stc(characters));
3165}
3166
3167// Get the set of characters making up whitespace for when moving or selecting by word.
3168wxString wxStyledTextCtrl::GetWhitespaceChars() const {
3169 int msg = 2647;
3170 int len = SendMsg(msg, 0, (sptr_t)NULL);
3171 if (!len) return wxEmptyString;
3172
3173 wxMemoryBuffer mbuf(len+1);
3174 char* buf = (char*)mbuf.GetWriteBuf(len+1);
3175 SendMsg(msg, 0, (sptr_t)buf);
3176 mbuf.UngetWriteBuf(len);
3177 mbuf.AppendByte(0);
3178 return stc2wx(buf);
3179}
3180
3181// Set the set of characters making up punctuation characters
3182// Should be called after SetWordChars.
3183void wxStyledTextCtrl::SetPunctuationChars(const wxString& characters)
3184{
3185 SendMsg(2648, 0, (sptr_t)(const char*)wx2stc(characters));
3186}
3187
3188// Get the set of characters making up punctuation characters
3189wxString wxStyledTextCtrl::GetPunctuationChars() const {
3190 int msg = 2649;
3191 int len = SendMsg(msg, 0, (sptr_t)NULL);
3192 if (!len) return wxEmptyString;
3193
3194 wxMemoryBuffer mbuf(len+1);
3195 char* buf = (char*)mbuf.GetWriteBuf(len+1);
3196 SendMsg(msg, 0, (sptr_t)buf);
3197 mbuf.UngetWriteBuf(len);
3198 mbuf.AppendByte(0);
3199 return stc2wx(buf);
3200}
3201
3202// Reset the set of characters for whitespace and word characters to the defaults.
3203void wxStyledTextCtrl::SetCharsDefault()
3204{
3205 SendMsg(2444, 0, 0);
3206}
3207
3208// Get currently selected item position in the auto-completion list
3209int wxStyledTextCtrl::AutoCompGetCurrent() const
3210{
3211 return SendMsg(2445, 0, 0);
3212}
3213
3214// Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference.
3215void wxStyledTextCtrl::AutoCompSetCaseInsensitiveBehaviour(int behaviour)
3216{
3217 SendMsg(2634, behaviour, 0);
3218}
3219
3220// Get auto-completion case insensitive behaviour.
3221int wxStyledTextCtrl::AutoCompGetCaseInsensitiveBehaviour() const
3222{
3223 return SendMsg(2635, 0, 0);
3224}
3225
3226// Enlarge the document to a particular size of text bytes.
3227void wxStyledTextCtrl::Allocate(int bytes)
3228{
3229 SendMsg(2446, bytes, 0);
3230}
3231
3232// Find the position of a column on a line taking into account tabs and
3233// multi-byte characters. If beyond end of line, return line end position.
3234int wxStyledTextCtrl::FindColumn(int line, int column)
3235{
3236 return SendMsg(2456, line, column);
3237}
3238
3239// Can the caret preferred x position only be changed by explicit movement commands?
3240int wxStyledTextCtrl::GetCaretSticky() const
3241{
3242 return SendMsg(2457, 0, 0);
3243}
3244
3245// Stop the caret preferred x position changing when the user types.
3246void wxStyledTextCtrl::SetCaretSticky(int useCaretStickyBehaviour)
3247{
3248 SendMsg(2458, useCaretStickyBehaviour, 0);
3249}
3250
3251// Switch between sticky and non-sticky: meant to be bound to a key.
3252void wxStyledTextCtrl::ToggleCaretSticky()
3253{
3254 SendMsg(2459, 0, 0);
3255}
3256
3257// Enable/Disable convert-on-paste for line endings
3258void wxStyledTextCtrl::SetPasteConvertEndings(bool convert)
3259{
3260 SendMsg(2467, convert, 0);
3261}
3262
3263// Get convert-on-paste setting
3264bool wxStyledTextCtrl::GetPasteConvertEndings() const
3265{
3266 return SendMsg(2468, 0, 0) != 0;
3267}
3268
3269// Duplicate the selection. If selection empty duplicate the line containing the caret.
3270void wxStyledTextCtrl::SelectionDuplicate()
3271{
3272 SendMsg(2469, 0, 0);
3273}
3274
3275// Set background alpha of the caret line.
3276void wxStyledTextCtrl::SetCaretLineBackAlpha(int alpha)
3277{
3278 SendMsg(2470, alpha, 0);
3279}
3280
3281// Get the background alpha of the caret line.
3282int wxStyledTextCtrl::GetCaretLineBackAlpha() const
3283{
3284 return SendMsg(2471, 0, 0);
3285}
3286
3287// Set the style of the caret to be drawn.
3288void wxStyledTextCtrl::SetCaretStyle(int caretStyle)
3289{
3290 SendMsg(2512, caretStyle, 0);
3291}
3292
3293// Returns the current style of the caret.
3294int wxStyledTextCtrl::GetCaretStyle() const
3295{
3296 return SendMsg(2513, 0, 0);
3297}
3298
3299// Set the indicator used for IndicatorFillRange and IndicatorClearRange
3300void wxStyledTextCtrl::SetIndicatorCurrent(int indicator)
3301{
3302 SendMsg(2500, indicator, 0);
3303}
3304
3305// Get the current indicator
3306int wxStyledTextCtrl::GetIndicatorCurrent() const
3307{
3308 return SendMsg(2501, 0, 0);
3309}
3310
3311// Set the value used for IndicatorFillRange
3312void wxStyledTextCtrl::SetIndicatorValue(int value)
3313{
3314 SendMsg(2502, value, 0);
3315}
3316
3317// Get the current indicator value
3318int wxStyledTextCtrl::GetIndicatorValue() const
3319{
3320 return SendMsg(2503, 0, 0);
3321}
3322
3323// Turn a indicator on over a range.
3324void wxStyledTextCtrl::IndicatorFillRange(int position, int fillLength)
3325{
3326 SendMsg(2504, position, fillLength);
3327}
3328
3329// Turn a indicator off over a range.
3330void wxStyledTextCtrl::IndicatorClearRange(int position, int clearLength)
3331{
3332 SendMsg(2505, position, clearLength);
3333}
3334
3335// Are any indicators present at position?
3336int wxStyledTextCtrl::IndicatorAllOnFor(int position)
3337{
3338 return SendMsg(2506, position, 0);
3339}
3340
3341// What value does a particular indicator have at at a position?
3342int wxStyledTextCtrl::IndicatorValueAt(int indicator, int position)
3343{
3344 return SendMsg(2507, indicator, position);
3345}
3346
3347// Where does a particular indicator start?
3348int wxStyledTextCtrl::IndicatorStart(int indicator, int position)
3349{
3350 return SendMsg(2508, indicator, position);
3351}
3352
3353// Where does a particular indicator end?
3354int wxStyledTextCtrl::IndicatorEnd(int indicator, int position)
3355{
3356 return SendMsg(2509, indicator, position);
3357}
3358
3359// Set number of entries in position cache
3360void wxStyledTextCtrl::SetPositionCacheSize(int size)
3361{
3362 SendMsg(2514, size, 0);
3363}
3364
3365// How many entries are allocated to the position cache?
3366int wxStyledTextCtrl::GetPositionCacheSize() const
3367{
3368 return SendMsg(2515, 0, 0);
3369}
3370
3371// Copy the selection, if selection empty copy the line with the caret
3372void wxStyledTextCtrl::CopyAllowLine()
3373{
3374 SendMsg(2519, 0, 0);
3375}
3376
3377// Compact the document buffer and return a read-only pointer to the
3378// characters in the document.
3379const char* wxStyledTextCtrl::GetCharacterPointer() const {
3380 return (const char*)SendMsg(2520, 0, 0);
3381}
3382
3383// Return a read-only pointer to a range of characters in the document.
3384// May move the gap so that the range is contiguous, but will only move up
3385// to rangeLength bytes.
3386const char* wxStyledTextCtrl::GetRangePointer(int position, int rangeLength) const {
3387 return (const char*)SendMsg(2643, position, rangeLength);
3388}
3389
3390// Return a position which, to avoid performance costs, should not be within
3391// the range of a call to GetRangePointer.
3392int wxStyledTextCtrl::GetGapPosition() const
3393{
3394 return SendMsg(2644, 0, 0);
3395}
3396
3397// Always interpret keyboard input as Unicode
3398void wxStyledTextCtrl::SetKeysUnicode(bool keysUnicode)
3399{
3400 SendMsg(2521, keysUnicode, 0);
3401}
3402
3403// Are keys always interpreted as Unicode?
3404bool wxStyledTextCtrl::GetKeysUnicode() const
3405{
3406 return SendMsg(2522, 0, 0) != 0;
3407}
3408
3409// Set the alpha fill colour of the given indicator.
3410void wxStyledTextCtrl::IndicatorSetAlpha(int indicator, int alpha)
3411{
3412 SendMsg(2523, indicator, alpha);
3413}
3414
3415// Get the alpha fill colour of the given indicator.
3416int wxStyledTextCtrl::IndicatorGetAlpha(int indicator) const
3417{
3418 return SendMsg(2524, indicator, 0);
3419}
3420
3421// Set the alpha outline colour of the given indicator.
3422void wxStyledTextCtrl::IndicatorSetOutlineAlpha(int indicator, int alpha)
3423{
3424 SendMsg(2558, indicator, alpha);
3425}
3426
3427// Get the alpha outline colour of the given indicator.
3428int wxStyledTextCtrl::IndicatorGetOutlineAlpha(int indicator) const
3429{
3430 return SendMsg(2559, indicator, 0);
3431}
3432
3433// Set extra ascent for each line
3434void wxStyledTextCtrl::SetExtraAscent(int extraAscent)
3435{
3436 SendMsg(2525, extraAscent, 0);
3437}
3438
3439// Get extra ascent for each line
3440int wxStyledTextCtrl::GetExtraAscent() const
3441{
3442 return SendMsg(2526, 0, 0);
3443}
3444
3445// Set extra descent for each line
3446void wxStyledTextCtrl::SetExtraDescent(int extraDescent)
3447{
3448 SendMsg(2527, extraDescent, 0);
3449}
3450
3451// Get extra descent for each line
3452int wxStyledTextCtrl::GetExtraDescent() const
3453{
3454 return SendMsg(2528, 0, 0);
3455}
3456
3457// Which symbol was defined for markerNumber with MarkerDefine
3458int wxStyledTextCtrl::GetMarkerSymbolDefined(int markerNumber)
3459{
3460 return SendMsg(2529, markerNumber, 0);
3461}
3462
3463// Set the text in the text margin for a line
3464void wxStyledTextCtrl::MarginSetText(int line, const wxString& text)
3465{
3466 SendMsg(2530, line, (sptr_t)(const char*)wx2stc(text));
3467}
3468
3469// Get the text in the text margin for a line
3470wxString wxStyledTextCtrl::MarginGetText(int line) const {
3471 long msg = 2531;
3472 long len = SendMsg(msg, line, 0);
3473
3474 wxMemoryBuffer mbuf(len+1);
3475 char* buf = (char*)mbuf.GetWriteBuf(len+1);
3476 SendMsg(msg, line, (sptr_t)buf);
3477 mbuf.UngetWriteBuf(len);
3478 mbuf.AppendByte(0);
3479 return stc2wx(buf);
3480}
3481
3482// Set the style number for the text margin for a line
3483void wxStyledTextCtrl::MarginSetStyle(int line, int style)
3484{
3485 SendMsg(2532, line, style);
3486}
3487
3488// Get the style number for the text margin for a line
3489int wxStyledTextCtrl::MarginGetStyle(int line) const
3490{
3491 return SendMsg(2533, line, 0);
3492}
3493
3494// Set the style in the text margin for a line
3495void wxStyledTextCtrl::MarginSetStyles(int line, const wxString& styles)
3496{
3497 SendMsg(2534, line, (sptr_t)(const char*)wx2stc(styles));
3498}
3499
3500// Get the styles in the text margin for a line
3501wxString wxStyledTextCtrl::MarginGetStyles(int line) const {
3502 long msg = 2535;
3503 long len = SendMsg(msg, line, 0);
3504
3505 wxMemoryBuffer mbuf(len+1);
3506 char* buf = (char*)mbuf.GetWriteBuf(len+1);
3507 SendMsg(msg, line, (sptr_t)buf);
3508 mbuf.UngetWriteBuf(len);
3509 mbuf.AppendByte(0);
3510 return stc2wx(buf);
3511}
3512
3513// Clear the margin text on all lines
3514void wxStyledTextCtrl::MarginTextClearAll()
3515{
3516 SendMsg(2536, 0, 0);
3517}
3518
3519// Get the start of the range of style numbers used for margin text
3520void wxStyledTextCtrl::MarginSetStyleOffset(int style)
3521{
3522 SendMsg(2537, style, 0);
3523}
3524
3525// Get the start of the range of style numbers used for margin text
3526int wxStyledTextCtrl::MarginGetStyleOffset() const
3527{
3528 return SendMsg(2538, 0, 0);
3529}
3530
3531// Set the margin options.
3532void wxStyledTextCtrl::SetMarginOptions(int marginOptions)
3533{
3534 SendMsg(2539, marginOptions, 0);
3535}
3536
3537// Get the margin options.
3538int wxStyledTextCtrl::GetMarginOptions() const
3539{
3540 return SendMsg(2557, 0, 0);
3541}
3542
3543// Set the annotation text for a line
3544void wxStyledTextCtrl::AnnotationSetText(int line, const wxString& text)
3545{
3546 SendMsg(2540, line, (sptr_t)(const char*)wx2stc(text));
3547}
3548
3549// Get the annotation text for a line
3550wxString wxStyledTextCtrl::AnnotationGetText(int line) const {
3551 long msg = 2541;
3552 long len = SendMsg(msg, line, 0);
3553
3554 wxMemoryBuffer mbuf(len+1);
3555 char* buf = (char*)mbuf.GetWriteBuf(len+1);
3556 SendMsg(msg, line, (sptr_t)buf);
3557 mbuf.UngetWriteBuf(len);
3558 mbuf.AppendByte(0);
3559 return stc2wx(buf);
3560}
3561
3562// Set the style number for the annotations for a line
3563void wxStyledTextCtrl::AnnotationSetStyle(int line, int style)
3564{
3565 SendMsg(2542, line, style);
3566}
3567
3568// Get the style number for the annotations for a line
3569int wxStyledTextCtrl::AnnotationGetStyle(int line) const
3570{
3571 return SendMsg(2543, line, 0);
3572}
3573
3574// Set the annotation styles for a line
3575void wxStyledTextCtrl::AnnotationSetStyles(int line, const wxString& styles)
3576{
3577 SendMsg(2544, line, (sptr_t)(const char*)wx2stc(styles));
3578}
3579
3580// Get the annotation styles for a line
3581wxString wxStyledTextCtrl::AnnotationGetStyles(int line) const {
3582 long msg = 2545;
3583 long len = SendMsg(msg, line, 0);
3584
3585 wxMemoryBuffer mbuf(len+1);
3586 char* buf = (char*)mbuf.GetWriteBuf(len+1);
3587 SendMsg(msg, line, (sptr_t)buf);
3588 mbuf.UngetWriteBuf(len);
3589 mbuf.AppendByte(0);
3590 return stc2wx(buf);
3591}
3592
3593// Get the number of annotation lines for a line
3594int wxStyledTextCtrl::AnnotationGetLines(int line) const
3595{
3596 return SendMsg(2546, line, 0);
3597}
3598
3599// Clear the annotations from all lines
3600void wxStyledTextCtrl::AnnotationClearAll()
3601{
3602 SendMsg(2547, 0, 0);
3603}
3604
3605// Set the visibility for the annotations for a view
3606void wxStyledTextCtrl::AnnotationSetVisible(int visible)
3607{
3608 SendMsg(2548, visible, 0);
3609}
3610
3611// Get the visibility for the annotations for a view
3612int wxStyledTextCtrl::AnnotationGetVisible() const
3613{
3614 return SendMsg(2549, 0, 0);
3615}
3616
3617// Get the start of the range of style numbers used for annotations
3618void wxStyledTextCtrl::AnnotationSetStyleOffset(int style)
3619{
3620 SendMsg(2550, style, 0);
3621}
3622
3623// Get the start of the range of style numbers used for annotations
3624int wxStyledTextCtrl::AnnotationGetStyleOffset() const
3625{
3626 return SendMsg(2551, 0, 0);
3627}
3628
3629// Add a container action to the undo stack
3630void wxStyledTextCtrl::AddUndoAction(int token, int flags)
3631{
3632 SendMsg(2560, token, flags);
3633}
3634
3635// Find the position of a character from a point within the window.
3636int wxStyledTextCtrl::CharPositionFromPoint(int x, int y)
3637{
3638 return SendMsg(2561, x, y);
3639}
3640
3641// Find the position of a character from a point within the window.
3642// Return INVALID_POSITION if not close to text.
3643int wxStyledTextCtrl::CharPositionFromPointClose(int x, int y)
3644{
3645 return SendMsg(2562, x, y);
3646}
3647
3648// Set whether multiple selections can be made
3649void wxStyledTextCtrl::SetMultipleSelection(bool multipleSelection)
3650{
3651 SendMsg(2563, multipleSelection, 0);
3652}
3653
3654// Whether multiple selections can be made
3655bool wxStyledTextCtrl::GetMultipleSelection() const
3656{
3657 return SendMsg(2564, 0, 0) != 0;
3658}
3659
3660// Set whether typing can be performed into multiple selections
3661void wxStyledTextCtrl::SetAdditionalSelectionTyping(bool additionalSelectionTyping)
3662{
3663 SendMsg(2565, additionalSelectionTyping, 0);
3664}
3665
3666// Whether typing can be performed into multiple selections
3667bool wxStyledTextCtrl::GetAdditionalSelectionTyping() const
3668{
3669 return SendMsg(2566, 0, 0) != 0;
3670}
3671
3672// Set whether additional carets will blink
3673void wxStyledTextCtrl::SetAdditionalCaretsBlink(bool additionalCaretsBlink)
3674{
3675 SendMsg(2567, additionalCaretsBlink, 0);
3676}
3677
3678// Whether additional carets will blink
3679bool wxStyledTextCtrl::GetAdditionalCaretsBlink() const
3680{
3681 return SendMsg(2568, 0, 0) != 0;
3682}
3683
3684// Set whether additional carets are visible
3685void wxStyledTextCtrl::SetAdditionalCaretsVisible(bool additionalCaretsBlink)
3686{
3687 SendMsg(2608, additionalCaretsBlink, 0);
3688}
3689
3690// Whether additional carets are visible
3691bool wxStyledTextCtrl::GetAdditionalCaretsVisible() const
3692{
3693 return SendMsg(2609, 0, 0) != 0;
3694}
3695
3696// How many selections are there?
3697int wxStyledTextCtrl::GetSelections() const
3698{
3699 return SendMsg(2570, 0, 0);
3700}
3701
3702// Clear selections to a single empty stream selection
3703void wxStyledTextCtrl::ClearSelections()
3704{
3705 SendMsg(2571, 0, 0);
3706}
3707
3708// Add a selection
3709int wxStyledTextCtrl::AddSelection(int caret, int anchor)
3710{
3711 return SendMsg(2573, caret, anchor);
3712}
3713
3714// Set the main selection
3715void wxStyledTextCtrl::SetMainSelection(int selection)
3716{
3717 SendMsg(2574, selection, 0);
3718}
3719
3720// Which selection is the main selection
3721int wxStyledTextCtrl::GetMainSelection() const
3722{
3723 return SendMsg(2575, 0, 0);
3724}
3725void wxStyledTextCtrl::SetSelectionNCaret(int selection, int pos)
3726{
3727 SendMsg(2576, selection, pos);
3728}
3729int wxStyledTextCtrl::GetSelectionNCaret(int selection) const
3730{
3731 return SendMsg(2577, selection, 0);
3732}
3733void wxStyledTextCtrl::SetSelectionNAnchor(int selection, int posAnchor)
3734{
3735 SendMsg(2578, selection, posAnchor);
3736}
3737int wxStyledTextCtrl::GetSelectionNAnchor(int selection) const
3738{
3739 return SendMsg(2579, selection, 0);
3740}
3741void wxStyledTextCtrl::SetSelectionNCaretVirtualSpace(int selection, int space)
3742{
3743 SendMsg(2580, selection, space);
3744}
3745int wxStyledTextCtrl::GetSelectionNCaretVirtualSpace(int selection) const
3746{
3747 return SendMsg(2581, selection, 0);
3748}
3749void wxStyledTextCtrl::SetSelectionNAnchorVirtualSpace(int selection, int space)
3750{
3751 SendMsg(2582, selection, space);
3752}
3753int wxStyledTextCtrl::GetSelectionNAnchorVirtualSpace(int selection) const
3754{
3755 return SendMsg(2583, selection, 0);
3756}
3757
3758// Sets the position that starts the selection - this becomes the anchor.
3759void wxStyledTextCtrl::SetSelectionNStart(int selection, int pos)
3760{
3761 SendMsg(2584, selection, pos);
3762}
3763
3764// Returns the position at the start of the selection.
3765int wxStyledTextCtrl::GetSelectionNStart(int selection) const
3766{
3767 return SendMsg(2585, selection, 0);
3768}
3769
3770// Sets the position that ends the selection - this becomes the currentPosition.
3771void wxStyledTextCtrl::SetSelectionNEnd(int selection, int pos)
3772{
3773 SendMsg(2586, selection, pos);
3774}
3775
3776// Returns the position at the end of the selection.
3777int wxStyledTextCtrl::GetSelectionNEnd(int selection) const
3778{
3779 return SendMsg(2587, selection, 0);
3780}
3781void wxStyledTextCtrl::SetRectangularSelectionCaret(int pos)
3782{
3783 SendMsg(2588, pos, 0);
3784}
3785int wxStyledTextCtrl::GetRectangularSelectionCaret() const
3786{
3787 return SendMsg(2589, 0, 0);
3788}
3789void wxStyledTextCtrl::SetRectangularSelectionAnchor(int posAnchor)
3790{
3791 SendMsg(2590, posAnchor, 0);
3792}
3793int wxStyledTextCtrl::GetRectangularSelectionAnchor() const
3794{
3795 return SendMsg(2591, 0, 0);
3796}
3797void wxStyledTextCtrl::SetRectangularSelectionCaretVirtualSpace(int space)
3798{
3799 SendMsg(2592, space, 0);
3800}
3801int wxStyledTextCtrl::GetRectangularSelectionCaretVirtualSpace() const
3802{
3803 return SendMsg(2593, 0, 0);
3804}
3805void wxStyledTextCtrl::SetRectangularSelectionAnchorVirtualSpace(int space)
3806{
3807 SendMsg(2594, space, 0);
3808}
3809int wxStyledTextCtrl::GetRectangularSelectionAnchorVirtualSpace() const
3810{
3811 return SendMsg(2595, 0, 0);
3812}
3813void wxStyledTextCtrl::SetVirtualSpaceOptions(int virtualSpaceOptions)
3814{
3815 SendMsg(2596, virtualSpaceOptions, 0);
3816}
3817int wxStyledTextCtrl::GetVirtualSpaceOptions() const
3818{
3819 return SendMsg(2597, 0, 0);
3820}
3821
3822// On GTK+, allow selecting the modifier key to use for mouse-based
3823// rectangular selection. Often the window manager requires Alt+Mouse Drag
3824// for moving windows.
3825// Valid values are SCMOD_CTRL(default), SCMOD_ALT, or SCMOD_SUPER.
3826void wxStyledTextCtrl::SetRectangularSelectionModifier(int modifier)
3827{
3828 SendMsg(2598, modifier, 0);
3829}
3830
3831// Get the modifier key used for rectangular selection.
3832int wxStyledTextCtrl::GetRectangularSelectionModifier() const
3833{
3834 return SendMsg(2599, 0, 0);
3835}
3836
3837// Set the foreground colour of additional selections.
3838// Must have previously called SetSelFore with non-zero first argument for this to have an effect.
3839void wxStyledTextCtrl::SetAdditionalSelForeground(const wxColour& fore)
3840{
3841 SendMsg(2600, wxColourAsLong(fore), 0);
3842}
3843
3844// Set the background colour of additional selections.
3845// Must have previously called SetSelBack with non-zero first argument for this to have an effect.
3846void wxStyledTextCtrl::SetAdditionalSelBackground(const wxColour& back)
3847{
3848 SendMsg(2601, wxColourAsLong(back), 0);
3849}
3850
3851// Set the alpha of the selection.
3852void wxStyledTextCtrl::SetAdditionalSelAlpha(int alpha)
3853{
3854 SendMsg(2602, alpha, 0);
3855}
3856
3857// Get the alpha of the selection.
3858int wxStyledTextCtrl::GetAdditionalSelAlpha() const
3859{
3860 return SendMsg(2603, 0, 0);
3861}
3862
3863// Set the foreground colour of additional carets.
3864void wxStyledTextCtrl::SetAdditionalCaretForeground(const wxColour& fore)
3865{
3866 SendMsg(2604, wxColourAsLong(fore), 0);
3867}
3868
3869// Get the foreground colour of additional carets.
3870wxColour wxStyledTextCtrl::GetAdditionalCaretForeground() const
3871{
3872 long c = SendMsg(2605, 0, 0);
3873 return wxColourFromLong(c);
3874}
3875
3876// Set the main selection to the next selection.
3877void wxStyledTextCtrl::RotateSelection()
3878{
3879 SendMsg(2606, 0, 0);
3880}
3881
3882// Swap that caret and anchor of the main selection.
3883void wxStyledTextCtrl::SwapMainAnchorCaret()
3884{
3885 SendMsg(2607, 0, 0);
3886}
3887
3888// Indicate that the internal state of a lexer has changed over a range and therefore
3889// there may be a need to redraw.
3890int wxStyledTextCtrl::ChangeLexerState(int start, int end)
3891{
3892 return SendMsg(2617, start, end);
3893}
3894
3895// Find the next line at or after lineStart that is a contracted fold header line.
3896// Return -1 when no more lines.
3897int wxStyledTextCtrl::ContractedFoldNext(int lineStart)
3898{
3899 return SendMsg(2618, lineStart, 0);
3900}
3901
3902// Centre current line in window.
3903void wxStyledTextCtrl::VerticalCentreCaret()
3904{
3905 SendMsg(2619, 0, 0);
3906}
3907
3908// Move the selected lines up one line, shifting the line above after the selection
3909void wxStyledTextCtrl::MoveSelectedLinesUp()
3910{
3911 SendMsg(2620, 0, 0);
3912}
3913
3914// Move the selected lines down one line, shifting the line below before the selection
3915void wxStyledTextCtrl::MoveSelectedLinesDown()
3916{
3917 SendMsg(2621, 0, 0);
3918}
3919
3920// Set the identifier reported as idFrom in notification messages.
3921void wxStyledTextCtrl::SetIdentifier(int identifier)
3922{
3923 SendMsg(2622, identifier, 0);
3924}
3925
3926// Get the identifier.
3927int wxStyledTextCtrl::GetIdentifier() const
3928{
3929 return SendMsg(2623, 0, 0);
3930}
3931
3932// Set the width for future RGBA image data.
3933void wxStyledTextCtrl::RGBAImageSetWidth(int width)
3934{
3935 SendMsg(2624, width, 0);
3936}
3937
3938// Set the height for future RGBA image data.
3939void wxStyledTextCtrl::RGBAImageSetHeight(int height)
3940{
3941 SendMsg(2625, height, 0);
3942}
3943
3944// Define a marker from RGBA data.
3945// It has the width and height from RGBAImageSetWidth/Height
3946void wxStyledTextCtrl::MarkerDefineRGBAImage(int markerNumber, const unsigned char* pixels) {
3947 SendMsg(2626, markerNumber, (sptr_t)pixels);
3948}
3949
3950// Register an RGBA image for use in autocompletion lists.
3951// It has the width and height from RGBAImageSetWidth/Height
3952void wxStyledTextCtrl::RegisterRGBAImage(int type, const unsigned char* pixels) {
3953 SendMsg(2627, type, (sptr_t)pixels);
3954}
3955
3956// Scroll to start of document.
3957void wxStyledTextCtrl::ScrollToStart()
3958{
3959 SendMsg(2628, 0, 0);
3960}
3961
3962// Scroll to end of document.
3963void wxStyledTextCtrl::ScrollToEnd()
3964{
3965 SendMsg(2629, 0, 0);
3966}
3967
3968// Set the technology used.
3969void wxStyledTextCtrl::SetTechnology(int technology)
3970{
3971 SendMsg(2630, technology, 0);
3972}
3973
3974// Get the tech.
3975int wxStyledTextCtrl::GetTechnology() const
3976{
3977 return SendMsg(2631, 0, 0);
3978}
3979
3980// Create an ILoader*.
3981void* wxStyledTextCtrl::CreateLoader(int bytes) const {
3982 return (void*)(sptr_t)SendMsg(2632, bytes);
3983}
3984
3985// Start notifying the container of all key presses and commands.
3986void wxStyledTextCtrl::StartRecord()
3987{
3988 SendMsg(3001, 0, 0);
3989}
3990
3991// Stop notifying the container of all key presses and commands.
3992void wxStyledTextCtrl::StopRecord()
3993{
3994 SendMsg(3002, 0, 0);
3995}
3996
3997// Set the lexing language of the document.
3998void wxStyledTextCtrl::SetLexer(int lexer)
3999{
4000 SendMsg(4001, lexer, 0);
4001}
4002
4003// Retrieve the lexing language of the document.
4004int wxStyledTextCtrl::GetLexer() const
4005{
4006 return SendMsg(4002, 0, 0);
4007}
4008
4009// Colourise a segment of the document using the current lexing language.
4010void wxStyledTextCtrl::Colourise(int start, int end)
4011{
4012 SendMsg(4003, start, end);
4013}
4014
4015// Set up a value that may be used by a lexer for some optional feature.
4016void wxStyledTextCtrl::SetProperty(const wxString& key, const wxString& value)
4017{
4018 SendMsg(4004, (sptr_t)(const char*)wx2stc(key), (sptr_t)(const char*)wx2stc(value));
4019}
4020
4021// Set up the key words used by the lexer.
4022void wxStyledTextCtrl::SetKeyWords(int keywordSet, const wxString& keyWords)
4023{
4024 SendMsg(4005, keywordSet, (sptr_t)(const char*)wx2stc(keyWords));
4025}
4026
4027// Set the lexing language of the document based on string name.
4028void wxStyledTextCtrl::SetLexerLanguage(const wxString& language)
4029{
4030 SendMsg(4006, 0, (sptr_t)(const char*)wx2stc(language));
4031}
4032
4033// Retrieve a 'property' value previously set with SetProperty.
4034wxString wxStyledTextCtrl::GetProperty(const wxString& key) {
4035 int len = SendMsg(SCI_GETPROPERTY, (sptr_t)(const char*)wx2stc(key), 0);
4036 if (!len) return wxEmptyString;
4037
4038 wxMemoryBuffer mbuf(len+1);
4039 char* buf = (char*)mbuf.GetWriteBuf(len+1);
4040 SendMsg(4008, (uptr_t)(const char*)wx2stc(key), (sptr_t)buf);
4041 mbuf.UngetWriteBuf(len);
4042 mbuf.AppendByte(0);
4043 return stc2wx(buf);
4044}
4045
4046// Retrieve a 'property' value previously set with SetProperty,
4047// with '$()' variable replacement on returned buffer.
4048wxString wxStyledTextCtrl::GetPropertyExpanded(const wxString& key) {
4049 int len = SendMsg(SCI_GETPROPERTYEXPANDED, (uptr_t)(const char*)wx2stc(key), 0);
4050 if (!len) return wxEmptyString;
4051
4052 wxMemoryBuffer mbuf(len+1);
4053 char* buf = (char*)mbuf.GetWriteBuf(len+1);
4054 SendMsg(4009, (uptr_t)(const char*)wx2stc(key), (sptr_t)buf);
4055 mbuf.UngetWriteBuf(len);
4056 mbuf.AppendByte(0);
4057 return stc2wx(buf);
4058}
4059
4060// Retrieve a 'property' value previously set with SetProperty,
4061// interpreted as an int AFTER any '$()' variable replacement.
4062int wxStyledTextCtrl::GetPropertyInt(const wxString& key) const
4063{
4064 return SendMsg(4010, (sptr_t)(const char*)wx2stc(key), 0);
4065}
4066
4067// Retrieve the number of bits the current lexer needs for styling.
4068int wxStyledTextCtrl::GetStyleBitsNeeded() const
4069{
4070 return SendMsg(4011, 0, 0);
4071}
4072
4073// For private communication between an application and a known lexer.
4074void* wxStyledTextCtrl::PrivateLexerCall(int operation, void* pointer) {
4075 return (void*)(sptr_t)SendMsg(4013, operation, (sptr_t)pointer);
4076}
4077
4078// Retrieve a '\n' separated list of properties understood by the current lexer.
4079wxString wxStyledTextCtrl::PropertyNames() const {
4080 int msg = 4014;
4081 int len = SendMsg(msg, 0, (sptr_t)NULL);
4082 if (!len) return wxEmptyString;
4083
4084 wxMemoryBuffer mbuf(len+1);
4085 char* buf = (char*)mbuf.GetWriteBuf(len+1);
4086 SendMsg(msg, 0, (sptr_t)buf);
4087 mbuf.UngetWriteBuf(len);
4088 mbuf.AppendByte(0);
4089 return stc2wx(buf);
4090}
4091
4092// Retrieve the type of a property.
4093int wxStyledTextCtrl::PropertyType(const wxString& name)
4094{
4095 return SendMsg(4015, (sptr_t)(const char*)wx2stc(name), 0);
4096}
4097
4098// Describe a property.
4099wxString wxStyledTextCtrl::DescribeProperty(const wxString& name) const {
4100 int msg = 4016;
4101 int len = SendMsg(msg, (sptr_t)(const char*)wx2stc(name), (sptr_t)NULL);
4102 if (!len) return wxEmptyString;
4103
4104 wxMemoryBuffer mbuf(len+1);
4105 char* buf = (char*)mbuf.GetWriteBuf(len+1);
4106 SendMsg(msg, (sptr_t)(const char*)wx2stc(name), (sptr_t)buf);
4107 mbuf.UngetWriteBuf(len);
4108 mbuf.AppendByte(0);
4109 return stc2wx(buf);
4110}
4111
4112// Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer.
4113wxString wxStyledTextCtrl::DescribeKeyWordSets() const {
4114 int msg = 4017;
4115 int len = SendMsg(msg, 0, (sptr_t)NULL);
4116 if (!len) return wxEmptyString;
4117
4118 wxMemoryBuffer mbuf(len+1);
4119 char* buf = (char*)mbuf.GetWriteBuf(len+1);
4120 SendMsg(msg, 0, (sptr_t)buf);
4121 mbuf.UngetWriteBuf(len);
4122 mbuf.AppendByte(0);
4123 return stc2wx(buf);
4124}
4125
4126//}}}
4127//----------------------------------------------------------------------
4128
4129
4130// Returns the line number of the line with the caret.
4131int wxStyledTextCtrl::GetCurrentLine() {
4132 int line = LineFromPosition(GetCurrentPos());
4133 return line;
4134}
4135
4136
4137// Extract style settings from a spec-string which is composed of one or
4138// more of the following comma separated elements:
4139//
4140// bold turns on bold
4141// italic turns on italics
4142// fore:[name or #RRGGBB] sets the foreground colour
4143// back:[name or #RRGGBB] sets the background colour
4144// face:[facename] sets the font face name to use
4145// size:[num] sets the font size in points
4146// eol turns on eol filling
4147// underline turns on underlining
4148//
4149void wxStyledTextCtrl::StyleSetSpec(int styleNum, const wxString& spec) {
4150
4151 wxStringTokenizer tkz(spec, wxT(","));
4152 while (tkz.HasMoreTokens()) {
4153 wxString token = tkz.GetNextToken();
4154
4155 wxString option = token.BeforeFirst(':');
4156 wxString val = token.AfterFirst(':');
4157
4158 if (option == wxT("bold"))
4159 StyleSetBold(styleNum, true);
4160
4161 else if (option == wxT("italic"))
4162 StyleSetItalic(styleNum, true);
4163
4164 else if (option == wxT("underline"))
4165 StyleSetUnderline(styleNum, true);
4166
4167 else if (option == wxT("eol"))
4168 StyleSetEOLFilled(styleNum, true);
4169
4170 else if (option == wxT("size")) {
4171 long points;
4172 if (val.ToLong(&points))
4173 StyleSetSize(styleNum, points);
4174 }
4175
4176 else if (option == wxT("face"))
4177 StyleSetFaceName(styleNum, val);
4178
4179 else if (option == wxT("fore"))
4180 StyleSetForeground(styleNum, wxColourFromSpec(val));
4181
4182 else if (option == wxT("back"))
4183 StyleSetBackground(styleNum, wxColourFromSpec(val));
4184 }
4185}
4186
4187
4188// Get the font of a style
4189wxFont wxStyledTextCtrl::StyleGetFont(int style) {
4190 wxFont font;
4191 font.SetPointSize(StyleGetSize(style));
4192 font.SetFaceName(StyleGetFaceName(style));
4193 if( StyleGetBold(style) )
4194 font.SetWeight(wxFONTWEIGHT_BOLD);
4195 else
4196 font.SetWeight(wxFONTWEIGHT_NORMAL);
4197
4198 if( StyleGetItalic(style) )
4199 font.SetStyle(wxFONTSTYLE_ITALIC);
4200 else
4201 font.SetStyle(wxFONTSTYLE_NORMAL);
4202
4203 return font;
4204}
4205
4206
4207// Set style size, face, bold, italic, and underline attributes from
4208// a wxFont's attributes.
4209void wxStyledTextCtrl::StyleSetFont(int styleNum, wxFont& font) {
4210#ifdef __WXGTK__
4211 // Ensure that the native font is initialized
4212 int x, y;
4213 GetTextExtent(wxT("X"), &x, &y, NULL, NULL, &font);
4214#endif
4215 int size = font.GetPointSize();
4216 wxString faceName = font.GetFaceName();
4217 bool bold = font.GetWeight() == wxBOLD;
4218 bool italic = font.GetStyle() != wxNORMAL;
4219 bool under = font.GetUnderlined();
4220 wxFontEncoding encoding = font.GetEncoding();
4221
4222 StyleSetFontAttr(styleNum, size, faceName, bold, italic, under, encoding);
4223}
4224
4225// Set all font style attributes at once.
4226void wxStyledTextCtrl::StyleSetFontAttr(int styleNum, int size,
4227 const wxString& faceName,
4228 bool bold, bool italic,
4229 bool underline,
4230 wxFontEncoding encoding) {
4231 StyleSetSize(styleNum, size);
4232 StyleSetFaceName(styleNum, faceName);
4233 StyleSetBold(styleNum, bold);
4234 StyleSetItalic(styleNum, italic);
4235 StyleSetUnderline(styleNum, underline);
4236 StyleSetFontEncoding(styleNum, encoding);
4237}
4238
4239
4240// Set the character set of the font in a style. Converts the Scintilla
4241// character set values to a wxFontEncoding.
4242void wxStyledTextCtrl::StyleSetCharacterSet(int style, int characterSet)
4243{
4244 wxFontEncoding encoding;
4245
4246 // Translate the Scintilla characterSet to a wxFontEncoding
4247 switch (characterSet) {
4248 default:
4249 case wxSTC_CHARSET_ANSI:
4250 case wxSTC_CHARSET_DEFAULT:
4251 encoding = wxFONTENCODING_DEFAULT;
4252 break;
4253
4254 case wxSTC_CHARSET_BALTIC:
4255 encoding = wxFONTENCODING_ISO8859_13;
4256 break;
4257
4258 case wxSTC_CHARSET_CHINESEBIG5:
4259 encoding = wxFONTENCODING_CP950;
4260 break;
4261
4262 case wxSTC_CHARSET_EASTEUROPE:
4263 encoding = wxFONTENCODING_ISO8859_2;
4264 break;
4265
4266 case wxSTC_CHARSET_GB2312:
4267 encoding = wxFONTENCODING_CP936;
4268 break;
4269
4270 case wxSTC_CHARSET_GREEK:
4271 encoding = wxFONTENCODING_ISO8859_7;
4272 break;
4273
4274 case wxSTC_CHARSET_HANGUL:
4275 encoding = wxFONTENCODING_CP949;
4276 break;
4277
4278 case wxSTC_CHARSET_MAC:
4279 encoding = wxFONTENCODING_DEFAULT;
4280 break;
4281
4282 case wxSTC_CHARSET_OEM:
4283 encoding = wxFONTENCODING_DEFAULT;
4284 break;
4285
4286 case wxSTC_CHARSET_RUSSIAN:
4287 encoding = wxFONTENCODING_KOI8;
4288 break;
4289
4290 case wxSTC_CHARSET_SHIFTJIS:
4291 encoding = wxFONTENCODING_CP932;
4292 break;
4293
4294 case wxSTC_CHARSET_SYMBOL:
4295 encoding = wxFONTENCODING_DEFAULT;
4296 break;
4297
4298 case wxSTC_CHARSET_TURKISH:
4299 encoding = wxFONTENCODING_ISO8859_9;
4300 break;
4301
4302 case wxSTC_CHARSET_JOHAB:
4303 encoding = wxFONTENCODING_DEFAULT;
4304 break;
4305
4306 case wxSTC_CHARSET_HEBREW:
4307 encoding = wxFONTENCODING_ISO8859_8;
4308 break;
4309
4310 case wxSTC_CHARSET_ARABIC:
4311 encoding = wxFONTENCODING_ISO8859_6;
4312 break;
4313
4314 case wxSTC_CHARSET_VIETNAMESE:
4315 encoding = wxFONTENCODING_DEFAULT;
4316 break;
4317
4318 case wxSTC_CHARSET_THAI:
4319 encoding = wxFONTENCODING_ISO8859_11;
4320 break;
4321
4322 case wxSTC_CHARSET_CYRILLIC:
4323 encoding = wxFONTENCODING_ISO8859_5;
4324 break;
4325
4326 case wxSTC_CHARSET_8859_15:
4327 encoding = wxFONTENCODING_ISO8859_15;;
4328 break;
4329 }
4330
4331 // We just have Scintilla track the wxFontEncoding for us. It gets used
4332 // in Font::Create in PlatWX.cpp. We add one to the value so that the
4333 // effective wxFONENCODING_DEFAULT == SC_SHARSET_DEFAULT and so when
4334 // Scintilla internally uses SC_CHARSET_DEFAULT we will translate it back
4335 // to wxFONENCODING_DEFAULT in Font::Create.
4336 SendMsg(SCI_STYLESETCHARACTERSET, style, encoding+1);
4337}
4338
4339
4340// Set the font encoding to be used by a style.
4341void wxStyledTextCtrl::StyleSetFontEncoding(int style, wxFontEncoding encoding)
4342{
4343 SendMsg(SCI_STYLESETCHARACTERSET, style, encoding+1);
4344}
4345
4346
4347// Perform one of the operations defined by the wxSTC_CMD_* constants.
4348void wxStyledTextCtrl::CmdKeyExecute(int cmd) {
4349 SendMsg(cmd);
4350}
4351
4352
4353// Set the left and right margin in the edit area, measured in pixels.
4354void wxStyledTextCtrl::SetMargins(int left, int right) {
4355 SetMarginLeft(left);
4356 SetMarginRight(right);
4357}
4358
4359
4360// Retrieve the point in the window where a position is displayed.
4361wxPoint wxStyledTextCtrl::PointFromPosition(int pos) {
4362 int x = SendMsg(SCI_POINTXFROMPOSITION, 0, pos);
4363 int y = SendMsg(SCI_POINTYFROMPOSITION, 0, pos);
4364 return wxPoint(x, y);
4365}
4366
4367// Scroll enough to make the given line visible
4368void wxStyledTextCtrl::ScrollToLine(int line) {
4369 m_swx->DoScrollToLine(line);
4370}
4371
4372
4373// Scroll enough to make the given column visible
4374void wxStyledTextCtrl::ScrollToColumn(int column) {
4375 m_swx->DoScrollToColumn(column);
4376}
4377
4378
4379void wxStyledTextCtrl::DoSetValue(const wxString& value, int flags)
4380{
4381 if ( flags & SetValue_SelectionOnly )
4382 ReplaceSelection(value);
4383 else
4384 SetText(value);
4385
4386 // We don't send wxEVT_COMMAND_TEXT_UPDATED anyhow, so ignore the
4387 // SetValue_SendEvent bit of the flags
4388}
4389
4390bool
4391wxStyledTextCtrl::DoSaveFile(const wxString& filename, int WXUNUSED(fileType))
4392{
4393#if wxUSE_FFILE || wxUSE_FILE
4394
4395#if wxUSE_FFILE
4396 // Take care to use "b" to ensure that possibly non-native EOLs in the file
4397 // contents are not mangled when saving it.
4398 wxFFile file(filename, wxS("wb"));
4399#elif wxUSE_FILE
4400 wxFile file(filename, wxFile::write);
4401#endif
4402
4403 if ( file.IsOpened() && file.Write(GetValue(), *wxConvCurrent) )
4404 {
4405 SetSavePoint();
4406
4407 return true;
4408 }
4409
4410#endif // !wxUSE_FFILE && !wxUSE_FILE
4411
4412 return false;
4413}
4414
4415bool
4416wxStyledTextCtrl::DoLoadFile(const wxString& filename, int WXUNUSED(fileType))
4417{
4418#if wxUSE_FFILE || wxUSE_FILE
4419
4420#if wxUSE_FFILE
4421 // As above, we want to read the real EOLs from the file, e.g. without
4422 // translating them to just LFs under Windows, so that the original CR LF
4423 // are preserved when it's written back.
4424 wxFFile file(filename, wxS("rb"));
4425#else
4426 wxFile file(filename);
4427#endif
4428
4429 if ( file.IsOpened() )
4430 {
4431 wxString text;
4432 if ( file.ReadAll(&text, *wxConvCurrent) )
4433 {
4434 // Detect the EOL: we use just the first line because there is not
4435 // much we can do if the file uses inconsistent EOLs anyhow, we'd
4436 // need to ask the user about the one we should really use and we
4437 // don't currently provide a way to do it.
4438 //
4439 // We also only check for Unix and DOS EOLs but not classic Mac
4440 // CR-only one as it's obsolete by now.
4441 const wxString::size_type posLF = text.find('\n');
4442 if ( posLF != wxString::npos )
4443 {
4444 // Set EOL mode to ensure that the new lines inserted into the
4445 // text use the same EOLs as the existing ones.
4446 if ( posLF > 0 && text[posLF - 1] == '\r' )
4447 SetEOLMode(wxSTC_EOL_CRLF);
4448 else
4449 SetEOLMode(wxSTC_EOL_LF);
4450 }
4451 //else: Use the default EOL for the current platform.
4452
4453 SetValue(text);
4454 EmptyUndoBuffer();
4455 SetSavePoint();
4456
4457 return true;
4458 }
4459 }
4460#endif // !wxUSE_FFILE && !wxUSE_FILE
4461
4462 return false;
4463}
4464
4465// If we don't derive from wxTextAreaBase, we need to implement these methods
4466// ourselves, otherwise we already inherit them.
4467#if !wxUSE_TEXTCTRL
4468
4469bool wxStyledTextCtrl::SaveFile(const wxString& filename)
4470{
4471 if ( filename.empty() )
4472 return false;
4473
4474 return DoSaveFile(filename, wxTEXT_TYPE_ANY);
4475}
4476
4477bool wxStyledTextCtrl::LoadFile(const wxString& filename)
4478{
4479 if ( filename.empty() )
4480 return false;
4481
4482 return DoLoadFile(filename, wxTEXT_TYPE_ANY);
4483}
4484
4485#endif // !wxUSE_TEXTCTRL
4486
4487#if wxUSE_DRAG_AND_DROP
4488wxDragResult wxStyledTextCtrl::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) {
4489 return m_swx->DoDragOver(x, y, def);
4490}
4491
4492
4493bool wxStyledTextCtrl::DoDropText(long x, long y, const wxString& data) {
4494 return m_swx->DoDropText(x, y, data);
4495}
4496#endif
4497
4498
4499void wxStyledTextCtrl::SetUseAntiAliasing(bool useAA) {
4500 m_swx->SetUseAntiAliasing(useAA);
4501}
4502
4503bool wxStyledTextCtrl::GetUseAntiAliasing() {
4504 return m_swx->GetUseAntiAliasing();
4505}
4506
4507void wxStyledTextCtrl::AnnotationClearLine(int line) {
4508 SendMsg(SCI_ANNOTATIONSETTEXT, line, NULL);
4509}
4510
4511
4512
4513
4514void wxStyledTextCtrl::AddTextRaw(const char* text, int length)
4515{
4516 if (length == -1)
4517 length = strlen(text);
4518 SendMsg(SCI_ADDTEXT, length, (sptr_t)text);
4519}
4520
4521void wxStyledTextCtrl::InsertTextRaw(int pos, const char* text)
4522{
4523 SendMsg(SCI_INSERTTEXT, pos, (sptr_t)text);
4524}
4525
4526wxCharBuffer wxStyledTextCtrl::GetCurLineRaw(int* linePos)
4527{
4528 int len = LineLength(GetCurrentLine());
4529 if (!len) {
4530 if (linePos) *linePos = 0;
4531 wxCharBuffer empty;
4532 return empty;
4533 }
4534
4535 wxCharBuffer buf(len);
4536 int pos = SendMsg(SCI_GETCURLINE, len, (sptr_t)buf.data());
4537 if (linePos) *linePos = pos;
4538 return buf;
4539}
4540
4541wxCharBuffer wxStyledTextCtrl::GetLineRaw(int line)
4542{
4543 int len = LineLength(line);
4544 if (!len) {
4545 wxCharBuffer empty;
4546 return empty;
4547 }
4548
4549 wxCharBuffer buf(len);
4550 SendMsg(SCI_GETLINE, line, (sptr_t)buf.data());
4551 return buf;
4552}
4553
4554wxCharBuffer wxStyledTextCtrl::GetSelectedTextRaw()
4555{
4556 // Calculate the length needed first.
4557 const int len = SendMsg(SCI_GETSELTEXT, 0, (sptr_t)0);
4558
4559 // And then really get the data.
4560 wxCharBuffer buf(len);
4561 SendMsg(SCI_GETSELTEXT, 0, (sptr_t)buf.data());
4562 return buf;
4563}
4564
4565wxCharBuffer wxStyledTextCtrl::GetTextRangeRaw(int startPos, int endPos)
4566{
4567 if (endPos < startPos) {
4568 int temp = startPos;
4569 startPos = endPos;
4570 endPos = temp;
4571 }
4572 int len = endPos - startPos;
4573 if (!len) {
4574 wxCharBuffer empty;
4575 return empty;
4576 }
4577
4578 wxCharBuffer buf(len);
4579 TextRange tr;
4580 tr.lpstrText = buf.data();
4581 tr.chrg.cpMin = startPos;
4582 tr.chrg.cpMax = endPos;
4583 SendMsg(SCI_GETTEXTRANGE, 0, (sptr_t)&tr);
4584 return buf;
4585}
4586
4587void wxStyledTextCtrl::SetTextRaw(const char* text)
4588{
4589 SendMsg(SCI_SETTEXT, 0, (sptr_t)text);
4590}
4591
4592wxCharBuffer wxStyledTextCtrl::GetTextRaw()
4593{
4594 int len = GetTextLength();
4595 wxCharBuffer buf(len); // adds 1 for NUL automatically
4596 SendMsg(SCI_GETTEXT, len + 1, (sptr_t)buf.data());
4597 return buf;
4598}
4599
4600void wxStyledTextCtrl::AppendTextRaw(const char* text, int length)
4601{
4602 if (length == -1)
4603 length = strlen(text);
4604 SendMsg(SCI_APPENDTEXT, length, (sptr_t)text);
4605}
4606
4607
4608
4609
4610
4611//----------------------------------------------------------------------
4612// Event handlers
4613
4614void wxStyledTextCtrl::OnPaint(wxPaintEvent& WXUNUSED(evt)) {
4615 wxPaintDC dc(this);
4616 m_swx->DoPaint(&dc, GetUpdateRegion().GetBox());
4617}
4618
4619void wxStyledTextCtrl::OnScrollWin(wxScrollWinEvent& evt) {
4620 if (evt.GetOrientation() == wxHORIZONTAL)
4621 m_swx->DoHScroll(evt.GetEventType(), evt.GetPosition());
4622 else
4623 m_swx->DoVScroll(evt.GetEventType(), evt.GetPosition());
4624}
4625
4626void wxStyledTextCtrl::OnScroll(wxScrollEvent& evt) {
4627 wxScrollBar* sb = wxDynamicCast(evt.GetEventObject(), wxScrollBar);
4628 if (sb) {
4629 if (sb->IsVertical())
4630 m_swx->DoVScroll(evt.GetEventType(), evt.GetPosition());
4631 else
4632 m_swx->DoHScroll(evt.GetEventType(), evt.GetPosition());
4633 }
4634}
4635
4636void wxStyledTextCtrl::OnSize(wxSizeEvent& WXUNUSED(evt)) {
4637 if (m_swx) {
4638 wxSize sz = GetClientSize();
4639 m_swx->DoSize(sz.x, sz.y);
4640 }
4641}
4642
4643void wxStyledTextCtrl::OnMouseLeftDown(wxMouseEvent& evt) {
4644 SetFocus();
4645 wxPoint pt = evt.GetPosition();
4646 m_swx->DoLeftButtonDown(Point(pt.x, pt.y), m_stopWatch.Time(),
4647 evt.ShiftDown(), evt.ControlDown(), evt.AltDown());
4648}
4649
4650void wxStyledTextCtrl::OnMouseMove(wxMouseEvent& evt) {
4651 wxPoint pt = evt.GetPosition();
4652 m_swx->DoLeftButtonMove(Point(pt.x, pt.y));
4653}
4654
4655void wxStyledTextCtrl::OnMouseLeftUp(wxMouseEvent& evt) {
4656 wxPoint pt = evt.GetPosition();
4657 m_swx->DoLeftButtonUp(Point(pt.x, pt.y), m_stopWatch.Time(),
4658 evt.ControlDown());
4659}
4660
4661
4662void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent& evt) {
4663 wxPoint pt = evt.GetPosition();
4664 m_swx->DoContextMenu(Point(pt.x, pt.y));
4665}
4666
4667
4668void wxStyledTextCtrl::OnMouseMiddleUp(wxMouseEvent& evt) {
4669 wxPoint pt = evt.GetPosition();
4670 m_swx->DoMiddleButtonUp(Point(pt.x, pt.y));
4671}
4672
4673void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent& evt) {
4674 wxPoint pt = evt.GetPosition();
4675 ScreenToClient(&pt.x, &pt.y);
4676 /*
4677 Show context menu at event point if it's within the window,
4678 or at caret location if not
4679 */
4680 wxHitTest ht = this->HitTest(pt);
4681 if (ht != wxHT_WINDOW_INSIDE) {
4682 pt = this->PointFromPosition(this->GetCurrentPos());
4683 }
4684 m_swx->DoContextMenu(Point(pt.x, pt.y));
4685}
4686
4687
4688void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt)
4689{
4690 m_swx->DoMouseWheel(evt.GetWheelRotation(),
4691 evt.GetWheelDelta(),
4692 evt.GetLinesPerAction(),
4693 evt.ControlDown(),
4694 evt.IsPageScroll());
4695}
4696
4697
4698void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) {
4699 // On (some?) non-US PC keyboards the AltGr key is required to enter some
4700 // common characters. It comes to us as both Alt and Ctrl down so we need
4701 // to let the char through in that case, otherwise if only ctrl or only
4702 // alt let's skip it.
4703 bool ctrl = evt.ControlDown();
4704#ifdef __WXMAC__
4705 // On the Mac the Alt key is just a modifier key (like Shift) so we need
4706 // to allow the char events to be processed when Alt is pressed.
4707 // TODO: Should we check MetaDown instead in this case?
4708 bool alt = false;
4709#else
4710 bool alt = evt.AltDown();
4711#endif
4712 bool skip = ((ctrl || alt) && ! (ctrl && alt));
4713
4714#if wxUSE_UNICODE
4715 // apparently if we don't do this, Unicode keys pressed after non-char
4716 // ASCII ones (e.g. Enter, Tab) are not taken into account (patch 1615989)
4717 if (m_lastKeyDownConsumed && evt.GetUnicodeKey() > 255)
4718 m_lastKeyDownConsumed = false;
4719#endif
4720
4721 if (!m_lastKeyDownConsumed && !skip) {
4722#if wxUSE_UNICODE
4723 int key = evt.GetUnicodeKey();
4724 bool keyOk = true;
4725
4726 // if the unicode key code is not really a unicode character (it may
4727 // be a function key or etc., the platforms appear to always give us a
4728 // small value in this case) then fallback to the ascii key code but
4729 // don't do anything for function keys or etc.
4730 if (key <= 127) {
4731 key = evt.GetKeyCode();
4732 keyOk = (key <= 127);
4733 }
4734 if (keyOk) {
4735 m_swx->DoAddChar(key);
4736 return;
4737 }
4738#else
4739 int key = evt.GetKeyCode();
4740 if (key <= WXK_START || key > WXK_COMMAND) {
4741 m_swx->DoAddChar(key);
4742 return;
4743 }
4744#endif
4745 }
4746
4747 evt.Skip();
4748}
4749
4750
4751void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) {
4752 int processed = m_swx->DoKeyDown(evt, &m_lastKeyDownConsumed);
4753 if (!processed && !m_lastKeyDownConsumed)
4754 evt.Skip();
4755}
4756
4757
4758void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& evt) {
4759 m_swx->DoLoseFocus();
4760 evt.Skip();
4761}
4762
4763
4764void wxStyledTextCtrl::OnGainFocus(wxFocusEvent& evt) {
4765 m_swx->DoGainFocus();
4766 evt.Skip();
4767}
4768
4769
4770void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(evt)) {
4771 m_swx->DoSysColourChange();
4772}
4773
4774
4775void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent& WXUNUSED(evt)) {
4776 // do nothing to help avoid flashing
4777}
4778
4779
4780
4781void wxStyledTextCtrl::OnMenu(wxCommandEvent& evt) {
4782 m_swx->DoCommand(evt.GetId());
4783}
4784
4785
4786void wxStyledTextCtrl::OnListBox(wxCommandEvent& WXUNUSED(evt)) {
4787 m_swx->DoOnListBox();
4788}
4789
4790
4791void wxStyledTextCtrl::OnIdle(wxIdleEvent& evt) {
4792 m_swx->DoOnIdle(evt);
4793}
4794
4795
4796wxSize wxStyledTextCtrl::DoGetBestSize() const
4797{
4798 // What would be the best size for a wxSTC?
4799 // Just give a reasonable minimum until something else can be figured out.
4800 return wxSize(200,100);
4801}
4802
4803
4804//----------------------------------------------------------------------
4805// Turn notifications from Scintilla into events
4806
4807
4808void wxStyledTextCtrl::NotifyChange() {
4809 wxStyledTextEvent evt(wxEVT_STC_CHANGE, GetId());
4810 evt.SetEventObject(this);
4811 GetEventHandler()->ProcessEvent(evt);
4812}
4813
4814
4815static void SetEventText(wxStyledTextEvent& evt, const char* text,
4816 size_t length) {
4817 if(!text) return;
4818
4819 evt.SetText(stc2wx(text, length));
4820}
4821
4822
4823void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
4824 SCNotification& scn = *_scn;
4825 wxStyledTextEvent evt(0, GetId());
4826
4827 evt.SetEventObject(this);
4828 evt.SetPosition(scn.position);
4829 evt.SetKey(scn.ch);
4830 evt.SetModifiers(scn.modifiers);
4831
4832 switch (scn.nmhdr.code) {
4833 case SCN_STYLENEEDED:
4834 evt.SetEventType(wxEVT_STC_STYLENEEDED);
4835 break;
4836
4837 case SCN_CHARADDED:
4838 evt.SetEventType(wxEVT_STC_CHARADDED);
4839 break;
4840
4841 case SCN_SAVEPOINTREACHED:
4842 evt.SetEventType(wxEVT_STC_SAVEPOINTREACHED);
4843 break;
4844
4845 case SCN_SAVEPOINTLEFT:
4846 evt.SetEventType(wxEVT_STC_SAVEPOINTLEFT);
4847 break;
4848
4849 case SCN_MODIFYATTEMPTRO:
4850 evt.SetEventType(wxEVT_STC_ROMODIFYATTEMPT);
4851 break;
4852
4853 case SCN_KEY:
4854 evt.SetEventType(wxEVT_STC_KEY);
4855 break;
4856
4857 case SCN_DOUBLECLICK:
4858 evt.SetEventType(wxEVT_STC_DOUBLECLICK);
4859 evt.SetLine(scn.line);
4860 break;
4861
4862 case SCN_UPDATEUI:
4863 evt.SetEventType(wxEVT_STC_UPDATEUI);
4864 evt.SetUpdated(scn.updated);
4865 break;
4866
4867 case SCN_MODIFIED:
4868 evt.SetEventType(wxEVT_STC_MODIFIED);
4869 evt.SetModificationType(scn.modificationType);
4870 SetEventText(evt, scn.text, scn.length);
4871 evt.SetLength(scn.length);
4872 evt.SetLinesAdded(scn.linesAdded);
4873 evt.SetLine(scn.line);
4874 evt.SetFoldLevelNow(scn.foldLevelNow);
4875 evt.SetFoldLevelPrev(scn.foldLevelPrev);
4876 evt.SetToken(scn.token);
4877 evt.SetAnnotationLinesAdded(scn.annotationLinesAdded);
4878 break;
4879
4880 case SCN_MACRORECORD:
4881 evt.SetEventType(wxEVT_STC_MACRORECORD);
4882 evt.SetMessage(scn.message);
4883 evt.SetWParam(scn.wParam);
4884 evt.SetLParam(scn.lParam);
4885 break;
4886
4887 case SCN_MARGINCLICK:
4888 evt.SetEventType(wxEVT_STC_MARGINCLICK);
4889 evt.SetMargin(scn.margin);
4890 break;
4891
4892 case SCN_NEEDSHOWN:
4893 evt.SetEventType(wxEVT_STC_NEEDSHOWN);
4894 evt.SetLength(scn.length);
4895 break;
4896
4897 case SCN_PAINTED:
4898 evt.SetEventType(wxEVT_STC_PAINTED);
4899 break;
4900
4901 case SCN_AUTOCSELECTION:
4902 evt.SetEventType(wxEVT_STC_AUTOCOMP_SELECTION);
4903 evt.SetListType(scn.listType);
4904 SetEventText(evt, scn.text, strlen(scn.text));
4905 evt.SetPosition(scn.lParam);
4906 break;
4907
4908 case SCN_USERLISTSELECTION:
4909 evt.SetEventType(wxEVT_STC_USERLISTSELECTION);
4910 evt.SetListType(scn.listType);
4911 SetEventText(evt, scn.text, strlen(scn.text));
4912 evt.SetPosition(scn.lParam);
4913 break;
4914
4915 case SCN_URIDROPPED:
4916 evt.SetEventType(wxEVT_STC_URIDROPPED);
4917 SetEventText(evt, scn.text, strlen(scn.text));
4918 break;
4919
4920 case SCN_DWELLSTART:
4921 evt.SetEventType(wxEVT_STC_DWELLSTART);
4922 evt.SetX(scn.x);
4923 evt.SetY(scn.y);
4924 break;
4925
4926 case SCN_DWELLEND:
4927 evt.SetEventType(wxEVT_STC_DWELLEND);
4928 evt.SetX(scn.x);
4929 evt.SetY(scn.y);
4930 break;
4931
4932 case SCN_ZOOM:
4933 evt.SetEventType(wxEVT_STC_ZOOM);
4934 break;
4935
4936 case SCN_HOTSPOTCLICK:
4937 evt.SetEventType(wxEVT_STC_HOTSPOT_CLICK);
4938 break;
4939
4940 case SCN_HOTSPOTDOUBLECLICK:
4941 evt.SetEventType(wxEVT_STC_HOTSPOT_DCLICK);
4942 break;
4943
4944 case SCN_CALLTIPCLICK:
4945 evt.SetEventType(wxEVT_STC_CALLTIP_CLICK);
4946 break;
4947
4948 case SCN_INDICATORCLICK:
4949 evt.SetEventType(wxEVT_STC_INDICATOR_CLICK);
4950 break;
4951
4952 case SCN_INDICATORRELEASE:
4953 evt.SetEventType(wxEVT_STC_INDICATOR_RELEASE);
4954 break;
4955
4956 case SCN_AUTOCCANCELLED:
4957 evt.SetEventType(wxEVT_STC_AUTOCOMP_CANCELLED);
4958 break;
4959
4960 case SCN_AUTOCCHARDELETED:
4961 evt.SetEventType(wxEVT_STC_AUTOCOMP_CHAR_DELETED);
4962 break;
4963
4964 case SCN_HOTSPOTRELEASECLICK:
4965 evt.SetEventType(wxEVT_STC_HOTSPOT_RELEASE_CLICK);
4966 break;
4967
4968 default:
4969 return;
4970 }
4971
4972 GetEventHandler()->ProcessEvent(evt);
4973}
4974
4975
4976//----------------------------------------------------------------------
4977//----------------------------------------------------------------------
4978//----------------------------------------------------------------------
4979
4980wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType, int id)
4981 : wxCommandEvent(commandType, id)
4982{
4983 m_position = 0;
4984 m_key = 0;
4985 m_modifiers = 0;
4986 m_modificationType = 0;
4987 m_length = 0;
4988 m_linesAdded = 0;
4989 m_line = 0;
4990 m_foldLevelNow = 0;
4991 m_foldLevelPrev = 0;
4992 m_margin = 0;
4993 m_message = 0;
4994 m_wParam = 0;
4995 m_lParam = 0;
4996 m_listType = 0;
4997 m_x = 0;
4998 m_y = 0;
4999 m_token = 0;
5000 m_annotationLinesAdded = 0;
5001 m_updated = 0;
5002
5003#if wxUSE_DRAG_AND_DROP
5004 m_dragFlags = wxDrag_CopyOnly;
5005 m_dragResult = wxDragNone;
5006#endif
5007}
5008
5009bool wxStyledTextEvent::GetShift() const { return (m_modifiers & SCI_SHIFT) != 0; }
5010bool wxStyledTextEvent::GetControl() const { return (m_modifiers & SCI_CTRL) != 0; }
5011bool wxStyledTextEvent::GetAlt() const { return (m_modifiers & SCI_ALT) != 0; }
5012
5013
5014wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent& event):
5015 wxCommandEvent(event)
5016{
5017 m_position = event.m_position;
5018 m_key = event.m_key;
5019 m_modifiers = event.m_modifiers;
5020 m_modificationType = event.m_modificationType;
5021 m_text = event.m_text;
5022 m_length = event.m_length;
5023 m_linesAdded = event.m_linesAdded;
5024 m_line = event.m_line;
5025 m_foldLevelNow = event.m_foldLevelNow;
5026 m_foldLevelPrev = event.m_foldLevelPrev;
5027
5028 m_margin = event.m_margin;
5029
5030 m_message = event.m_message;
5031 m_wParam = event.m_wParam;
5032 m_lParam = event.m_lParam;
5033
5034 m_listType = event.m_listType;
5035 m_x = event.m_x;
5036 m_y = event.m_y;
5037
5038 m_token = event.m_token;
5039 m_annotationLinesAdded = event.m_annotationLinesAdded;
5040 m_updated = event.m_updated;
5041
5042#if wxUSE_DRAG_AND_DROP
5043 m_dragText = event.m_dragText;
5044 m_dragFlags = event.m_dragFlags;
5045 m_dragResult = event.m_dragResult;
5046#endif
5047}
5048
5049//----------------------------------------------------------------------
5050//----------------------------------------------------------------------
5051
5052/*static*/ wxVersionInfo wxStyledTextCtrl::GetLibraryVersionInfo()
5053{
5054 return wxVersionInfo("Scintilla", 3, 21, 0, "Scintilla 3.21");
5055}
5056
5057#endif // wxUSE_STC