]> git.saurik.com Git - wxWidgets.git/blame - src/stc/stc.cpp
Fix crash in wxDC::GetMultiLineTextExtent() after last commit.
[wxWidgets.git] / src / stc / stc.cpp
CommitLineData
9ce192d4 1////////////////////////////////////////////////////////////////////////////
4ce59b1f 2// Name: stc.cpp
be5a51fb 3// Purpose: A wxWidgets implementation of Scintilla. This class is the
9ce192d4
RD
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
f6bcfd97 8// namespace with all the classes and identifiers from Scintilla.
9ce192d4
RD
9//
10// Author: Robin Dunn
11//
12// Created: 13-Jan-2000
13// RCS-ID: $Id$
14// Copyright: (c) 2000 by Total Control Software
526954c5 15// Licence: wxWindows licence
9ce192d4
RD
16/////////////////////////////////////////////////////////////////////////////
17
a5c2ccf2
VZ
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
54429bb3
RD
29// For compilers that support precompilation, includes "wx.h".
30#include "wx/wxprec.h"
31
32#ifdef __BORLANDC__
33 #pragma hdrstop
34#endif
35
29825f5f
PC
36#if wxUSE_STC
37
38#include "wx/stc/stc.h"
ea88e9bc 39#include "wx/stc/private.h"
54429bb3
RD
40
41#ifndef WX_PRECOMP
29825f5f 42 #include "wx/wx.h"
54429bb3
RD
43#endif // WX_PRECOMP
44
f6bcfd97
BP
45#include <ctype.h>
46
d6655166
WS
47#include "wx/tokenzr.h"
48#include "wx/mstream.h"
49#include "wx/image.h"
e6aed765
VZ
50#if wxUSE_FFILE
51 #include "wx/ffile.h"
52#elif wxUSE_FILE
53 #include "wx/ffile.h"
54#endif
9ce192d4 55
f9ee2e27 56#include "ScintillaWX.h"
f6bcfd97 57
9ce192d4
RD
58//----------------------------------------------------------------------
59
23318a53 60const char wxSTCNameStr[] = "stcwindow";
9ce192d4 61
451c5cc7
RD
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;
c8b75e94
WS
77 clr.Set((unsigned char)(c & 0xff),
78 (unsigned char)((c >> 8) & 0xff),
79 (unsigned char)((c >> 16) & 0xff));
451c5cc7
RD
80 return clr;
81}
82
83
84static wxColour wxColourFromSpec(const wxString& spec) {
5ee1d760
RD
85 // spec should be a colour name or "#RRGGBB"
86 if (spec.GetChar(0) == wxT('#')) {
7e126a07 87
5ee1d760
RD
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);
c8b75e94
WS
93 return wxColour((unsigned char)red,
94 (unsigned char)green,
95 (unsigned char)blue);
5ee1d760
RD
96 }
97 else
98 return wxColour(spec);
451c5cc7
RD
99}
100
101//----------------------------------------------------------------------
102
9b11752c
VZ
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 );
9e96e16f
RD
131wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_CANCELLED, wxStyledTextEvent );
132wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_CHAR_DELETED, wxStyledTextEvent );
54173563 133wxDEFINE_EVENT( wxEVT_STC_HOTSPOT_RELEASE_CLICK, wxStyledTextEvent );
9e730a78 134
d25f5fbb
RD
135
136
9ce192d4
RD
137BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
138 EVT_PAINT (wxStyledTextCtrl::OnPaint)
139 EVT_SCROLLWIN (wxStyledTextCtrl::OnScrollWin)
5fa4613c 140 EVT_SCROLL (wxStyledTextCtrl::OnScroll)
9ce192d4
RD
141 EVT_SIZE (wxStyledTextCtrl::OnSize)
142 EVT_LEFT_DOWN (wxStyledTextCtrl::OnMouseLeftDown)
4ceb1196
RD
143 // Let Scintilla see the double click as a second click
144 EVT_LEFT_DCLICK (wxStyledTextCtrl::OnMouseLeftDown)
9ce192d4
RD
145 EVT_MOTION (wxStyledTextCtrl::OnMouseMove)
146 EVT_LEFT_UP (wxStyledTextCtrl::OnMouseLeftUp)
451c5cc7 147#if defined(__WXGTK__) || defined(__WXMAC__)
ddf2da08
RD
148 EVT_RIGHT_UP (wxStyledTextCtrl::OnMouseRightUp)
149#else
65ec6247 150 EVT_CONTEXT_MENU (wxStyledTextCtrl::OnContextMenu)
ddf2da08 151#endif
37d62433 152 EVT_MOUSEWHEEL (wxStyledTextCtrl::OnMouseWheel)
2b5f62a0 153 EVT_MIDDLE_UP (wxStyledTextCtrl::OnMouseMiddleUp)
9ce192d4 154 EVT_CHAR (wxStyledTextCtrl::OnChar)
f6bcfd97 155 EVT_KEY_DOWN (wxStyledTextCtrl::OnKeyDown)
9ce192d4
RD
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)
dd4aa550 160 EVT_MENU_RANGE (10, 16, wxStyledTextCtrl::OnMenu)
7e126a07 161 EVT_LISTBOX_DCLICK (wxID_ANY, wxStyledTextCtrl::OnListBox)
9ce192d4
RD
162END_EVENT_TABLE()
163
f6bcfd97
BP
164
165IMPLEMENT_CLASS(wxStyledTextCtrl, wxControl)
166IMPLEMENT_DYNAMIC_CLASS(wxStyledTextEvent, wxCommandEvent)
167
40716a51 168#ifdef LINK_LEXERS
1a2fb4cd 169// forces the linking of the lexer modules
a834585d 170int Scintilla_LinkLexers();
40716a51 171#endif
1a2fb4cd 172
9ce192d4
RD
173//----------------------------------------------------------------------
174// Constructor and Destructor
175
176wxStyledTextCtrl::wxStyledTextCtrl(wxWindow *parent,
177 wxWindowID id,
178 const wxPoint& pos,
179 const wxSize& size,
180 long style,
39c0acb6
RD
181 const wxString& name)
182{
183 m_swx = NULL;
184 Create(parent, id, pos, size, style, name);
185}
186
187
a48cb415
RD
188bool wxStyledTextCtrl::Create(wxWindow *parent,
189 wxWindowID id,
190 const wxPoint& pos,
191 const wxSize& size,
192 long style,
193 const wxString& name)
9ce192d4 194{
2659dad3 195 style |= wxVSCROLL | wxHSCROLL;
a48cb415
RD
196 if (!wxControl::Create(parent, id, pos, size,
197 style | wxWANTS_CHARS | wxCLIP_CHILDREN,
198 wxDefaultValidator, name))
199 return false;
39c0acb6 200
40716a51 201#ifdef LINK_LEXERS
a834585d 202 Scintilla_LinkLexers();
40716a51 203#endif
9ce192d4 204 m_swx = new ScintillaWX(this);
9ce192d4 205 m_stopWatch.Start();
7e126a07 206 m_lastKeyDownConsumed = false;
5fa4613c
RD
207 m_vScrollBar = NULL;
208 m_hScrollBar = NULL;
10ef30eb
RD
209#if wxUSE_UNICODE
210 // Put Scintilla into unicode (UTF-8) mode
211 SetCodePage(wxSTC_CP_UTF8);
212#endif
8ae4f086 213
170acdc9 214 SetInitialSize(size);
f9ee2e27 215
be108f96 216 // Reduces flicker on GTK+/X11
c3e0999b 217 SetBackgroundStyle(wxBG_STYLE_PAINT);
439cce14
RD
218
219 // Make sure it can take the focus
220 SetCanFocus(true);
221
a48cb415 222 return true;
9ce192d4
RD
223}
224
225
226wxStyledTextCtrl::~wxStyledTextCtrl() {
227 delete m_swx;
9ce192d4
RD
228}
229
230
231//----------------------------------------------------------------------
232
fafd43c5 233wxIntPtr wxStyledTextCtrl::SendMsg(int msg, wxUIntPtr wp, wxIntPtr lp) const
8e0945da 234{
9ce192d4
RD
235 return m_swx->WndProc(msg, wp, lp);
236}
237
ccfc3219
RD
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}
9ce192d4 248
9ce192d4 249
ccfc3219
RD
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
4370573a 259//----------------------------------------------------------------------
a5c2ccf2 260// Generated methods implementation section {{{
9ce192d4
RD
261
262
591d01be 263// Add text to the document at current position.
9ce192d4 264void wxStyledTextCtrl::AddText(const wxString& text) {
2ed48ef8 265 const wxWX2MBbuf buf = wx2stc(text);
d7b46878 266 SendMsg(2001, wx2stclen(text, buf), (sptr_t)(const char*)buf);
9ce192d4
RD
267}
268
a834585d 269// Add array of cells to document.
10ef30eb 270void wxStyledTextCtrl::AddStyledText(const wxMemoryBuffer& data) {
b796ba39 271 SendMsg(2002, data.GetDataLen(), (sptr_t)data.GetData());
9ce192d4
RD
272}
273
a834585d 274// Insert string at a position.
8e0945da
VZ
275void wxStyledTextCtrl::InsertText(int pos, const wxString& text)
276{
b796ba39 277 SendMsg(2003, pos, (sptr_t)(const char*)wx2stc(text));
9ce192d4
RD
278}
279
a834585d 280// Delete all text in the document.
8e0945da
VZ
281void wxStyledTextCtrl::ClearAll()
282{
4370573a 283 SendMsg(2004, 0, 0);
9ce192d4
RD
284}
285
9b01abb8
RD
286// Delete a range of text in the document.
287void wxStyledTextCtrl::DeleteRange(int pos, int deleteLength)
288{
289 SendMsg(2645, pos, deleteLength);
290}
291
a834585d 292// Set all style bytes to 0, remove all folding information.
8e0945da
VZ
293void wxStyledTextCtrl::ClearDocumentStyle()
294{
4370573a 295 SendMsg(2005, 0, 0);
9ce192d4
RD
296}
297
9e96e16f 298// Returns the number of bytes in the document.
8e0945da
VZ
299int wxStyledTextCtrl::GetLength() const
300{
4370573a 301 return SendMsg(2006, 0, 0);
9ce192d4
RD
302}
303
a834585d 304// Returns the character byte at the position.
8e0945da 305int wxStyledTextCtrl::GetCharAt(int pos) const {
9e730a78 306 return (unsigned char)SendMsg(2007, pos, 0);
9ce192d4
RD
307}
308
a834585d 309// Returns the position of the caret.
8e0945da
VZ
310int wxStyledTextCtrl::GetCurrentPos() const
311{
4370573a 312 return SendMsg(2008, 0, 0);
9ce192d4
RD
313}
314
a834585d 315// Returns the position of the opposite end of the selection to the caret.
8e0945da
VZ
316int wxStyledTextCtrl::GetAnchor() const
317{
4370573a 318 return SendMsg(2009, 0, 0);
9ce192d4
RD
319}
320
a834585d 321// Returns the style byte at the position.
8e0945da 322int wxStyledTextCtrl::GetStyleAt(int pos) const {
9e730a78 323 return (unsigned char)SendMsg(2010, pos, 0);
9ce192d4
RD
324}
325
a834585d 326// Redoes the next action on the undo history.
8e0945da
VZ
327void wxStyledTextCtrl::Redo()
328{
4370573a 329 SendMsg(2011, 0, 0);
9ce192d4
RD
330}
331
4370573a
RD
332// Choose between collecting actions into the undo
333// history and discarding them.
8e0945da
VZ
334void wxStyledTextCtrl::SetUndoCollection(bool collectUndo)
335{
4370573a 336 SendMsg(2012, collectUndo, 0);
9ce192d4
RD
337}
338
4370573a 339// Select all the text in the document.
8e0945da
VZ
340void wxStyledTextCtrl::SelectAll()
341{
4370573a 342 SendMsg(2013, 0, 0);
9ce192d4
RD
343}
344
4370573a
RD
345// Remember the current position in the undo history as the position
346// at which the document was saved.
8e0945da
VZ
347void wxStyledTextCtrl::SetSavePoint()
348{
4370573a 349 SendMsg(2014, 0, 0);
9ce192d4
RD
350}
351
4370573a 352// Retrieve a buffer of cells.
10ef30eb 353wxMemoryBuffer wxStyledTextCtrl::GetStyledText(int startPos, int endPos) {
9e730a78
RD
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;
b796ba39 366 len = SendMsg(2015, 0, (sptr_t)&tr);
9e730a78
RD
367 buf.UngetWriteBuf(len);
368 return buf;
9ce192d4
RD
369}
370
a834585d 371// Are there any redoable actions in the undo history?
93578927 372bool wxStyledTextCtrl::CanRedo() const
8e0945da 373{
4370573a 374 return SendMsg(2016, 0, 0) != 0;
9ce192d4
RD
375}
376
a834585d 377// Retrieve the line number at which a particular marker is located.
8e0945da
VZ
378int wxStyledTextCtrl::MarkerLineFromHandle(int handle)
379{
4370573a 380 return SendMsg(2017, handle, 0);
9ce192d4
RD
381}
382
4370573a 383// Delete a marker.
8e0945da
VZ
384void wxStyledTextCtrl::MarkerDeleteHandle(int handle)
385{
4370573a 386 SendMsg(2018, handle, 0);
9ce192d4
RD
387}
388
4370573a 389// Is undo history being collected?
8e0945da
VZ
390bool wxStyledTextCtrl::GetUndoCollection() const
391{
4370573a 392 return SendMsg(2019, 0, 0) != 0;
9ce192d4
RD
393}
394
4370573a
RD
395// Are white space characters currently visible?
396// Returns one of SCWS_* constants.
8e0945da
VZ
397int wxStyledTextCtrl::GetViewWhiteSpace() const
398{
4370573a 399 return SendMsg(2020, 0, 0);
9ce192d4
RD
400}
401
4370573a 402// Make white space characters invisible, always visible or visible outside indentation.
8e0945da
VZ
403void wxStyledTextCtrl::SetViewWhiteSpace(int viewWS)
404{
4370573a 405 SendMsg(2021, viewWS, 0);
9ce192d4
RD
406}
407
4370573a 408// Find the position from a point within the window.
2bfca191 409int wxStyledTextCtrl::PositionFromPoint(wxPoint pt) const {
9e730a78 410 return SendMsg(2022, pt.x, pt.y);
9ce192d4
RD
411}
412
65ec6247
RD
413// Find the position from a point within the window but return
414// INVALID_POSITION if not close to text.
8e0945da
VZ
415int wxStyledTextCtrl::PositionFromPointClose(int x, int y)
416{
65ec6247
RD
417 return SendMsg(2023, x, y);
418}
419
4370573a 420// Set caret to start of a line and ensure it is visible.
8e0945da
VZ
421void wxStyledTextCtrl::GotoLine(int line)
422{
4370573a 423 SendMsg(2024, line, 0);
9ce192d4
RD
424}
425
4370573a 426// Set caret to a position and ensure it is visible.
8e0945da
VZ
427void wxStyledTextCtrl::GotoPos(int pos)
428{
4370573a 429 SendMsg(2025, pos, 0);
9ce192d4
RD
430}
431
4370573a
RD
432// Set the selection anchor to a position. The anchor is the opposite
433// end of the selection from the caret.
8e0945da
VZ
434void wxStyledTextCtrl::SetAnchor(int posAnchor)
435{
4370573a 436 SendMsg(2026, posAnchor, 0);
9ce192d4
RD
437}
438
4370573a
RD
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) {
9e730a78
RD
442 int len = LineLength(GetCurrentLine());
443 if (!len) {
444 if (linePos) *linePos = 0;
445 return wxEmptyString;
446 }
10ef30eb 447
9e730a78
RD
448 wxMemoryBuffer mbuf(len+1);
449 char* buf = (char*)mbuf.GetWriteBuf(len+1);
8de28db9 450
b796ba39 451 int pos = SendMsg(2027, len+1, (sptr_t)buf);
9e730a78
RD
452 mbuf.UngetWriteBuf(len);
453 mbuf.AppendByte(0);
454 if (linePos) *linePos = pos;
455 return stc2wx(buf);
9ce192d4
RD
456}
457
4370573a 458// Retrieve the position of the last correctly styled character.
8e0945da
VZ
459int wxStyledTextCtrl::GetEndStyled() const
460{
4370573a 461 return SendMsg(2028, 0, 0);
9ce192d4
RD
462}
463
65ec6247 464// Convert all line endings in the document to one mode.
8e0945da
VZ
465void wxStyledTextCtrl::ConvertEOLs(int eolMode)
466{
65ec6247 467 SendMsg(2029, eolMode, 0);
9ce192d4
RD
468}
469
4370573a 470// Retrieve the current end of line mode - one of CRLF, CR, or LF.
8e0945da
VZ
471int wxStyledTextCtrl::GetEOLMode() const
472{
4370573a 473 return SendMsg(2030, 0, 0);
9ce192d4
RD
474}
475
4370573a 476// Set the current end of line mode.
8e0945da
VZ
477void wxStyledTextCtrl::SetEOLMode(int eolMode)
478{
4370573a 479 SendMsg(2031, eolMode, 0);
9ce192d4
RD
480}
481
4370573a 482// Set the current styling position to pos and the styling mask to mask.
a834585d 483// The styling mask can be used to protect some bits in each styling byte from modification.
8e0945da
VZ
484void wxStyledTextCtrl::StartStyling(int pos, int mask)
485{
4370573a 486 SendMsg(2032, pos, mask);
9ce192d4
RD
487}
488
4370573a
RD
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.
8e0945da
VZ
491void wxStyledTextCtrl::SetStyling(int length, int style)
492{
4370573a 493 SendMsg(2033, length, style);
f6bcfd97
BP
494}
495
a834585d 496// Is drawing done first into a buffer or direct to the screen?
8e0945da
VZ
497bool wxStyledTextCtrl::GetBufferedDraw() const
498{
4370573a 499 return SendMsg(2034, 0, 0) != 0;
f6bcfd97
BP
500}
501
4370573a
RD
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.
8e0945da
VZ
504void wxStyledTextCtrl::SetBufferedDraw(bool buffered)
505{
4370573a 506 SendMsg(2035, buffered, 0);
f6bcfd97
BP
507}
508
a834585d 509// Change the visible size of a tab to be a multiple of the width of a space character.
8e0945da
VZ
510void wxStyledTextCtrl::SetTabWidth(int tabWidth)
511{
4370573a 512 SendMsg(2036, tabWidth, 0);
f6bcfd97
BP
513}
514
4370573a 515// Retrieve the visible size of a tab.
8e0945da
VZ
516int wxStyledTextCtrl::GetTabWidth() const
517{
4370573a 518 return SendMsg(2121, 0, 0);
9ce192d4
RD
519}
520
4370573a 521// Set the code page used to interpret the bytes of the document as characters.
4370573a 522void wxStyledTextCtrl::SetCodePage(int codePage) {
10ef30eb
RD
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
9e730a78 530 SendMsg(2037, codePage);
9ce192d4
RD
531}
532
4370573a 533// Set the symbol used for a particular marker number,
1a2fb4cd 534// and optionally the fore and background colours.
4370573a 535void wxStyledTextCtrl::MarkerDefine(int markerNumber, int markerSymbol,
9e730a78
RD
536 const wxColour& foreground,
537 const wxColour& background) {
9ce192d4 538
9e730a78 539 SendMsg(2040, markerNumber, markerSymbol);
6a06eecf 540 if (foreground.IsOk())
9e730a78 541 MarkerSetForeground(markerNumber, foreground);
6a06eecf 542 if (background.IsOk())
9e730a78 543 MarkerSetBackground(markerNumber, background);
9ce192d4
RD
544}
545
4370573a 546// Set the foreground colour used for a particular marker number.
8e0945da
VZ
547void wxStyledTextCtrl::MarkerSetForeground(int markerNumber, const wxColour& fore)
548{
4370573a 549 SendMsg(2041, markerNumber, wxColourAsLong(fore));
9ce192d4
RD
550}
551
4370573a 552// Set the background colour used for a particular marker number.
8e0945da
VZ
553void wxStyledTextCtrl::MarkerSetBackground(int markerNumber, const wxColour& back)
554{
4370573a 555 SendMsg(2042, markerNumber, wxColourAsLong(back));
9ce192d4
RD
556}
557
9b01abb8 558// Set the background colour used for a particular marker number when its folding block is selected.
54173563 559void wxStyledTextCtrl::MarkerSetBackgroundSelected(int markerNumber, const wxColour& back)
9b01abb8
RD
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
1a2fb4cd 570// Add a marker to a line, returning an ID which can be used to find or delete the marker.
8e0945da
VZ
571int wxStyledTextCtrl::MarkerAdd(int line, int markerNumber)
572{
1a2fb4cd 573 return SendMsg(2043, line, markerNumber);
9ce192d4
RD
574}
575
a834585d 576// Delete a marker from a line.
8e0945da
VZ
577void wxStyledTextCtrl::MarkerDelete(int line, int markerNumber)
578{
4370573a 579 SendMsg(2044, line, markerNumber);
9ce192d4
RD
580}
581
a834585d 582// Delete all markers with a particular number from all lines.
8e0945da
VZ
583void wxStyledTextCtrl::MarkerDeleteAll(int markerNumber)
584{
4370573a 585 SendMsg(2045, markerNumber, 0);
9ce192d4
RD
586}
587
4370573a 588// Get a bit mask of all the markers set on a line.
8e0945da
VZ
589int wxStyledTextCtrl::MarkerGet(int line)
590{
4370573a 591 return SendMsg(2046, line, 0);
9ce192d4
RD
592}
593
9b01abb8
RD
594// Find the next line at or after lineStart that includes a marker in mask.
595// Return -1 when no more lines.
8e0945da
VZ
596int wxStyledTextCtrl::MarkerNext(int lineStart, int markerMask)
597{
4370573a 598 return SendMsg(2047, lineStart, markerMask);
9ce192d4
RD
599}
600
4370573a 601// Find the previous line before lineStart that includes a marker in mask.
8e0945da
VZ
602int wxStyledTextCtrl::MarkerPrevious(int lineStart, int markerMask)
603{
4370573a 604 return SendMsg(2048, lineStart, markerMask);
9ce192d4
RD
605}
606
9e730a78
RD
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();
e45b3f17
RD
612 if (img.HasAlpha())
613 img.ConvertAlphaToMask();
9e730a78
RD
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;
b796ba39 619 SendMsg(2049, markerNumber, (sptr_t)buff);
9e730a78 620 delete [] buff;
35f8d83d 621
9e730a78
RD
622}
623
1e9bafca 624// Add a set of markers to a line.
8e0945da
VZ
625void wxStyledTextCtrl::MarkerAddSet(int line, int set)
626{
1e9bafca
RD
627 SendMsg(2466, line, set);
628}
629
b8193d80 630// Set the alpha used for a marker that is drawn in the text area, not the margin.
8e0945da
VZ
631void wxStyledTextCtrl::MarkerSetAlpha(int markerNumber, int alpha)
632{
b8193d80
RD
633 SendMsg(2476, markerNumber, alpha);
634}
635
4370573a 636// Set a margin to be either numeric or symbolic.
8e0945da
VZ
637void wxStyledTextCtrl::SetMarginType(int margin, int marginType)
638{
4370573a 639 SendMsg(2240, margin, marginType);
9ce192d4
RD
640}
641
4370573a 642// Retrieve the type of a margin.
8e0945da
VZ
643int wxStyledTextCtrl::GetMarginType(int margin) const
644{
4370573a 645 return SendMsg(2241, margin, 0);
9ce192d4
RD
646}
647
4370573a 648// Set the width of a margin to a width expressed in pixels.
8e0945da
VZ
649void wxStyledTextCtrl::SetMarginWidth(int margin, int pixelWidth)
650{
4370573a 651 SendMsg(2242, margin, pixelWidth);
9ce192d4
RD
652}
653
4370573a 654// Retrieve the width of a margin in pixels.
8e0945da
VZ
655int wxStyledTextCtrl::GetMarginWidth(int margin) const
656{
4370573a 657 return SendMsg(2243, margin, 0);
f6bcfd97
BP
658}
659
4370573a 660// Set a mask that determines which markers are displayed in a margin.
8e0945da
VZ
661void wxStyledTextCtrl::SetMarginMask(int margin, int mask)
662{
4370573a 663 SendMsg(2244, margin, mask);
f6bcfd97
BP
664}
665
4370573a 666// Retrieve the marker mask of a margin.
8e0945da
VZ
667int wxStyledTextCtrl::GetMarginMask(int margin) const
668{
4370573a 669 return SendMsg(2245, margin, 0);
9ce192d4
RD
670}
671
4370573a 672// Make a margin sensitive or insensitive to mouse clicks.
8e0945da
VZ
673void wxStyledTextCtrl::SetMarginSensitive(int margin, bool sensitive)
674{
4370573a 675 SendMsg(2246, margin, sensitive);
9ce192d4
RD
676}
677
4370573a 678// Retrieve the mouse click sensitivity of a margin.
8e0945da
VZ
679bool wxStyledTextCtrl::GetMarginSensitive(int margin) const
680{
4370573a 681 return SendMsg(2247, margin, 0) != 0;
9ce192d4
RD
682}
683
9b01abb8 684// Set the cursor shown when the mouse is inside a margin.
54173563 685void wxStyledTextCtrl::SetMarginCursor(int margin, int cursor)
9b01abb8
RD
686{
687 SendMsg(2248, margin, cursor);
688}
689
690// Retrieve the cursor shown in a margin.
54173563 691int wxStyledTextCtrl::GetMarginCursor(int margin) const
9b01abb8
RD
692{
693 return SendMsg(2249, margin, 0);
694}
695
4370573a 696// Clear all the styles and make equivalent to the global default style.
8e0945da
VZ
697void wxStyledTextCtrl::StyleClearAll()
698{
4370573a 699 SendMsg(2050, 0, 0);
9ce192d4
RD
700}
701
4370573a 702// Set the foreground colour of a style.
8e0945da
VZ
703void wxStyledTextCtrl::StyleSetForeground(int style, const wxColour& fore)
704{
4370573a 705 SendMsg(2051, style, wxColourAsLong(fore));
9ce192d4
RD
706}
707
4370573a 708// Set the background colour of a style.
8e0945da
VZ
709void wxStyledTextCtrl::StyleSetBackground(int style, const wxColour& back)
710{
4370573a 711 SendMsg(2052, style, wxColourAsLong(back));
9ce192d4
RD
712}
713
4370573a 714// Set a style to be bold or not.
8e0945da
VZ
715void wxStyledTextCtrl::StyleSetBold(int style, bool bold)
716{
4370573a 717 SendMsg(2053, style, bold);
9ce192d4
RD
718}
719
4370573a 720// Set a style to be italic or not.
8e0945da
VZ
721void wxStyledTextCtrl::StyleSetItalic(int style, bool italic)
722{
4370573a 723 SendMsg(2054, style, italic);
9ce192d4
RD
724}
725
4370573a 726// Set the size of characters of a style.
8e0945da
VZ
727void wxStyledTextCtrl::StyleSetSize(int style, int sizePoints)
728{
4370573a 729 SendMsg(2055, style, sizePoints);
9ce192d4
RD
730}
731
4370573a 732// Set the font of a style.
8e0945da
VZ
733void wxStyledTextCtrl::StyleSetFaceName(int style, const wxString& fontName)
734{
b796ba39 735 SendMsg(2056, style, (sptr_t)(const char*)wx2stc(fontName));
9ce192d4
RD
736}
737
4370573a 738// Set a style to have its end of line filled or not.
8e0945da
VZ
739void wxStyledTextCtrl::StyleSetEOLFilled(int style, bool filled)
740{
4370573a 741 SendMsg(2057, style, filled);
9ce192d4
RD
742}
743
4370573a 744// Reset the default style to its state at startup
8e0945da
VZ
745void wxStyledTextCtrl::StyleResetDefault()
746{
4370573a 747 SendMsg(2058, 0, 0);
9ce192d4
RD
748}
749
4370573a 750// Set a style to be underlined or not.
8e0945da
VZ
751void wxStyledTextCtrl::StyleSetUnderline(int style, bool underline)
752{
4370573a 753 SendMsg(2059, style, underline);
9ce192d4
RD
754}
755
7e0c58e9 756// Get the foreground colour of a style.
8e0945da
VZ
757wxColour wxStyledTextCtrl::StyleGetForeground(int style) const
758{
7e0c58e9
RD
759 long c = SendMsg(2481, style, 0);
760 return wxColourFromLong(c);
761}
762
763// Get the background colour of a style.
8e0945da
VZ
764wxColour wxStyledTextCtrl::StyleGetBackground(int style) const
765{
7e0c58e9
RD
766 long c = SendMsg(2482, style, 0);
767 return wxColourFromLong(c);
768}
769
770// Get is a style bold or not.
8e0945da
VZ
771bool wxStyledTextCtrl::StyleGetBold(int style) const
772{
7e0c58e9
RD
773 return SendMsg(2483, style, 0) != 0;
774}
775
776// Get is a style italic or not.
8e0945da
VZ
777bool wxStyledTextCtrl::StyleGetItalic(int style) const
778{
7e0c58e9
RD
779 return SendMsg(2484, style, 0) != 0;
780}
781
782// Get the size of characters of a style.
8e0945da
VZ
783int wxStyledTextCtrl::StyleGetSize(int style) const
784{
7e0c58e9
RD
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);
b796ba39 794 SendMsg(msg, style, (sptr_t)buf);
7e0c58e9
RD
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.
8e0945da
VZ
801bool wxStyledTextCtrl::StyleGetEOLFilled(int style) const
802{
7e0c58e9
RD
803 return SendMsg(2487, style, 0) != 0;
804}
805
806// Get is a style underlined or not.
8e0945da
VZ
807bool wxStyledTextCtrl::StyleGetUnderline(int style) const
808{
7e0c58e9
RD
809 return SendMsg(2488, style, 0) != 0;
810}
811
812// Get is a style mixed case, or to force upper or lower case.
8e0945da
VZ
813int wxStyledTextCtrl::StyleGetCase(int style) const
814{
7e0c58e9
RD
815 return SendMsg(2489, style, 0);
816}
817
818// Get the character set of the font in a style.
8e0945da
VZ
819int wxStyledTextCtrl::StyleGetCharacterSet(int style) const
820{
7e0c58e9
RD
821 return SendMsg(2490, style, 0);
822}
823
824// Get is a style visible or not.
8e0945da
VZ
825bool wxStyledTextCtrl::StyleGetVisible(int style) const
826{
7e0c58e9
RD
827 return SendMsg(2491, style, 0) != 0;
828}
829
830// Get is a style changeable or not (read only).
831// Experimental feature, currently buggy.
8e0945da
VZ
832bool wxStyledTextCtrl::StyleGetChangeable(int style) const
833{
7e0c58e9
RD
834 return SendMsg(2492, style, 0) != 0;
835}
836
837// Get is a style a hotspot or not.
8e0945da
VZ
838bool wxStyledTextCtrl::StyleGetHotSpot(int style) const
839{
7e0c58e9
RD
840 return SendMsg(2493, style, 0) != 0;
841}
842
65ec6247 843// Set a style to be mixed case, or to force upper or lower case.
8e0945da
VZ
844void wxStyledTextCtrl::StyleSetCase(int style, int caseForce)
845{
65ec6247
RD
846 SendMsg(2060, style, caseForce);
847}
848
9b01abb8
RD
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
9e730a78 873// Set a style to be a hotspot or not.
8e0945da
VZ
874void wxStyledTextCtrl::StyleSetHotSpot(int style, bool hotspot)
875{
9e730a78
RD
876 SendMsg(2409, style, hotspot);
877}
878
9e96e16f 879// Set the foreground colour of the main and additional selections and whether to use this setting.
8e0945da
VZ
880void wxStyledTextCtrl::SetSelForeground(bool useSetting, const wxColour& fore)
881{
4370573a 882 SendMsg(2067, useSetting, wxColourAsLong(fore));
9ce192d4
RD
883}
884
9e96e16f 885// Set the background colour of the main and additional selections and whether to use this setting.
8e0945da
VZ
886void wxStyledTextCtrl::SetSelBackground(bool useSetting, const wxColour& back)
887{
4370573a 888 SendMsg(2068, useSetting, wxColourAsLong(back));
9ce192d4
RD
889}
890
b8193d80 891// Get the alpha of the selection.
8e0945da
VZ
892int wxStyledTextCtrl::GetSelAlpha() const
893{
b8193d80
RD
894 return SendMsg(2477, 0, 0);
895}
896
897// Set the alpha of the selection.
8e0945da
VZ
898void wxStyledTextCtrl::SetSelAlpha(int alpha)
899{
b8193d80
RD
900 SendMsg(2478, alpha, 0);
901}
902
7e0c58e9 903// Is the selection end of line filled?
8e0945da
VZ
904bool wxStyledTextCtrl::GetSelEOLFilled() const
905{
7e0c58e9
RD
906 return SendMsg(2479, 0, 0) != 0;
907}
908
909// Set the selection to have its end of line filled or not.
8e0945da
VZ
910void wxStyledTextCtrl::SetSelEOLFilled(bool filled)
911{
7e0c58e9
RD
912 SendMsg(2480, filled, 0);
913}
914
4370573a 915// Set the foreground colour of the caret.
8e0945da
VZ
916void wxStyledTextCtrl::SetCaretForeground(const wxColour& fore)
917{
4370573a 918 SendMsg(2069, wxColourAsLong(fore), 0);
9ce192d4
RD
919}
920
4370573a
RD
921// When key+modifier combination km is pressed perform msg.
922void wxStyledTextCtrl::CmdKeyAssign(int key, int modifiers, int cmd) {
9e730a78 923 SendMsg(2070, MAKELONG(key, modifiers), cmd);
9ce192d4
RD
924}
925
8e54aaed 926// When key+modifier combination km is pressed do nothing.
4370573a 927void wxStyledTextCtrl::CmdKeyClear(int key, int modifiers) {
9e730a78 928 SendMsg(2071, MAKELONG(key, modifiers));
9ce192d4
RD
929}
930
4370573a 931// Drop all key mappings.
8e0945da
VZ
932void wxStyledTextCtrl::CmdKeyClearAll()
933{
4370573a
RD
934 SendMsg(2072, 0, 0);
935}
9ce192d4 936
4370573a
RD
937// Set the styles for a segment of the document.
938void wxStyledTextCtrl::SetStyleBytes(int length, char* styleBytes) {
b796ba39 939 SendMsg(2073, length, (sptr_t)styleBytes);
9ce192d4
RD
940}
941
4370573a 942// Set a style to be visible or not.
8e0945da
VZ
943void wxStyledTextCtrl::StyleSetVisible(int style, bool visible)
944{
4370573a
RD
945 SendMsg(2074, style, visible);
946}
9ce192d4 947
4370573a 948// Get the time in milliseconds that the caret is on and off.
8e0945da
VZ
949int wxStyledTextCtrl::GetCaretPeriod() const
950{
4370573a 951 return SendMsg(2075, 0, 0);
9ce192d4
RD
952}
953
4370573a 954// Get the time in milliseconds that the caret is on and off. 0 = steady on.
8e0945da
VZ
955void wxStyledTextCtrl::SetCaretPeriod(int periodMilliseconds)
956{
4370573a
RD
957 SendMsg(2076, periodMilliseconds, 0);
958}
9ce192d4 959
a834585d 960// Set the set of characters making up words for when moving or selecting by word.
9e96e16f 961// First sets defaults like SetCharsDefault.
8e0945da
VZ
962void wxStyledTextCtrl::SetWordChars(const wxString& characters)
963{
b796ba39 964 SendMsg(2077, 0, (sptr_t)(const char*)wx2stc(characters));
9ce192d4
RD
965}
966
9b01abb8
RD
967// Get the set of characters making up words for when moving or selecting by word.
968wxString wxStyledTextCtrl::GetWordChars() const {
969 int msg = 2646;
c4bdd822 970 int len = SendMsg(msg, 0, (sptr_t)NULL);
9b01abb8
RD
971 if (!len) return wxEmptyString;
972
973 wxMemoryBuffer mbuf(len+1);
974 char* buf = (char*)mbuf.GetWriteBuf(len+1);
54173563 975 SendMsg(msg, 0, (sptr_t)buf);
9b01abb8
RD
976 mbuf.UngetWriteBuf(len);
977 mbuf.AppendByte(0);
978 return stc2wx(buf);
979}
980
4370573a
RD
981// Start a sequence of actions that is undone and redone as a unit.
982// May be nested.
8e0945da
VZ
983void wxStyledTextCtrl::BeginUndoAction()
984{
4370573a
RD
985 SendMsg(2078, 0, 0);
986}
9ce192d4 987
4370573a 988// End a sequence of actions that is undone and redone as a unit.
8e0945da
VZ
989void wxStyledTextCtrl::EndUndoAction()
990{
4370573a
RD
991 SendMsg(2079, 0, 0);
992}
9ce192d4 993
4370573a 994// Set an indicator to plain, squiggle or TT.
8e0945da
VZ
995void wxStyledTextCtrl::IndicatorSetStyle(int indic, int style)
996{
4370573a
RD
997 SendMsg(2080, indic, style);
998}
9ce192d4 999
4370573a 1000// Retrieve the style of an indicator.
8e0945da
VZ
1001int wxStyledTextCtrl::IndicatorGetStyle(int indic) const
1002{
4370573a
RD
1003 return SendMsg(2081, indic, 0);
1004}
9ce192d4 1005
4370573a 1006// Set the foreground colour of an indicator.
8e0945da
VZ
1007void wxStyledTextCtrl::IndicatorSetForeground(int indic, const wxColour& fore)
1008{
4370573a 1009 SendMsg(2082, indic, wxColourAsLong(fore));
9ce192d4
RD
1010}
1011
4370573a 1012// Retrieve the foreground colour of an indicator.
8e0945da
VZ
1013wxColour wxStyledTextCtrl::IndicatorGetForeground(int indic) const
1014{
4370573a
RD
1015 long c = SendMsg(2083, indic, 0);
1016 return wxColourFromLong(c);
1017}
9ce192d4 1018
7e0c58e9 1019// Set an indicator to draw under text or over(default).
8e0945da
VZ
1020void wxStyledTextCtrl::IndicatorSetUnder(int indic, bool under)
1021{
7e0c58e9
RD
1022 SendMsg(2510, indic, under);
1023}
1024
1025// Retrieve whether indicator drawn under or over text.
8e0945da
VZ
1026bool wxStyledTextCtrl::IndicatorGetUnder(int indic) const
1027{
7e0c58e9
RD
1028 return SendMsg(2511, indic, 0) != 0;
1029}
1030
f114b858 1031// Set the foreground colour of all whitespace and whether to use this setting.
8e0945da
VZ
1032void wxStyledTextCtrl::SetWhitespaceForeground(bool useSetting, const wxColour& fore)
1033{
f114b858
RD
1034 SendMsg(2084, useSetting, wxColourAsLong(fore));
1035}
1036
1037// Set the background colour of all whitespace and whether to use this setting.
8e0945da
VZ
1038void wxStyledTextCtrl::SetWhitespaceBackground(bool useSetting, const wxColour& back)
1039{
f114b858
RD
1040 SendMsg(2085, useSetting, wxColourAsLong(back));
1041}
1042
9e96e16f
RD
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
a834585d
RD
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
4370573a 1057// is used to expand the possible states.
8e0945da
VZ
1058void wxStyledTextCtrl::SetStyleBits(int bits)
1059{
4370573a 1060 SendMsg(2090, bits, 0);
9ce192d4
RD
1061}
1062
4370573a 1063// Retrieve number of bits in style bytes used to hold the lexical state.
8e0945da
VZ
1064int wxStyledTextCtrl::GetStyleBits() const
1065{
4370573a
RD
1066 return SendMsg(2091, 0, 0);
1067}
9ce192d4 1068
4370573a 1069// Used to hold extra styling information for each line.
8e0945da
VZ
1070void wxStyledTextCtrl::SetLineState(int line, int state)
1071{
4370573a 1072 SendMsg(2092, line, state);
f6bcfd97
BP
1073}
1074
4370573a 1075// Retrieve the extra styling information for a line.
8e0945da
VZ
1076int wxStyledTextCtrl::GetLineState(int line) const
1077{
4370573a
RD
1078 return SendMsg(2093, line, 0);
1079}
f6bcfd97 1080
4370573a 1081// Retrieve the last line number that has line state.
8e0945da
VZ
1082int wxStyledTextCtrl::GetMaxLineState() const
1083{
4370573a 1084 return SendMsg(2094, 0, 0);
f6bcfd97
BP
1085}
1086
65ec6247 1087// Is the background of the line containing the caret in a different colour?
8e0945da
VZ
1088bool wxStyledTextCtrl::GetCaretLineVisible() const
1089{
65ec6247
RD
1090 return SendMsg(2095, 0, 0) != 0;
1091}
1092
a834585d 1093// Display the background of the line containing the caret in a different colour.
8e0945da
VZ
1094void wxStyledTextCtrl::SetCaretLineVisible(bool show)
1095{
65ec6247
RD
1096 SendMsg(2096, show, 0);
1097}
1098
1099// Get the colour of the background of the line containing the caret.
8e0945da
VZ
1100wxColour wxStyledTextCtrl::GetCaretLineBackground() const
1101{
65ec6247
RD
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.
8e0945da
VZ
1107void wxStyledTextCtrl::SetCaretLineBackground(const wxColour& back)
1108{
65ec6247
RD
1109 SendMsg(2098, wxColourAsLong(back), 0);
1110}
1111
1a2fb4cd
RD
1112// Set a style to be changeable or not (read only).
1113// Experimental feature, currently buggy.
8e0945da
VZ
1114void wxStyledTextCtrl::StyleSetChangeable(int style, bool changeable)
1115{
1a2fb4cd
RD
1116 SendMsg(2099, style, changeable);
1117}
1118
4370573a
RD
1119// Display a auto-completion list.
1120// The lenEntered parameter indicates how many characters before
1121// the caret should be used to provide context.
8e0945da
VZ
1122void wxStyledTextCtrl::AutoCompShow(int lenEntered, const wxString& itemList)
1123{
b796ba39 1124 SendMsg(2100, lenEntered, (sptr_t)(const char*)wx2stc(itemList));
4370573a 1125}
f6bcfd97 1126
4370573a 1127// Remove the auto-completion list from the screen.
8e0945da
VZ
1128void wxStyledTextCtrl::AutoCompCancel()
1129{
4370573a 1130 SendMsg(2101, 0, 0);
f6bcfd97
BP
1131}
1132
4370573a 1133// Is there an auto-completion list visible?
8e0945da
VZ
1134bool wxStyledTextCtrl::AutoCompActive()
1135{
4370573a
RD
1136 return SendMsg(2102, 0, 0) != 0;
1137}
f6bcfd97 1138
a834585d 1139// Retrieve the position of the caret when the auto-completion list was displayed.
8e0945da
VZ
1140int wxStyledTextCtrl::AutoCompPosStart()
1141{
4370573a 1142 return SendMsg(2103, 0, 0);
f6bcfd97
BP
1143}
1144
4370573a 1145// User has selected an item so remove the list and insert the selection.
8e0945da
VZ
1146void wxStyledTextCtrl::AutoCompComplete()
1147{
4370573a
RD
1148 SendMsg(2104, 0, 0);
1149}
f6bcfd97 1150
4370573a 1151// Define a set of character that when typed cancel the auto-completion list.
8e0945da
VZ
1152void wxStyledTextCtrl::AutoCompStops(const wxString& characterSet)
1153{
b796ba39 1154 SendMsg(2105, 0, (sptr_t)(const char*)wx2stc(characterSet));
f6bcfd97
BP
1155}
1156
a834585d
RD
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.
8e0945da
VZ
1159void wxStyledTextCtrl::AutoCompSetSeparator(int separatorCharacter)
1160{
4370573a
RD
1161 SendMsg(2106, separatorCharacter, 0);
1162}
f6bcfd97 1163
4370573a 1164// Retrieve the auto-completion list separator character.
8e0945da
VZ
1165int wxStyledTextCtrl::AutoCompGetSeparator() const
1166{
4370573a 1167 return SendMsg(2107, 0, 0);
9ce192d4
RD
1168}
1169
4370573a 1170// Select the item in the auto-completion list that starts with a string.
8e0945da
VZ
1171void wxStyledTextCtrl::AutoCompSelect(const wxString& text)
1172{
b796ba39 1173 SendMsg(2108, 0, (sptr_t)(const char*)wx2stc(text));
4370573a 1174}
9ce192d4 1175
4370573a
RD
1176// Should the auto-completion list be cancelled if the user backspaces to a
1177// position before where the box was created.
8e0945da
VZ
1178void wxStyledTextCtrl::AutoCompSetCancelAtStart(bool cancel)
1179{
4370573a 1180 SendMsg(2110, cancel, 0);
f6bcfd97
BP
1181}
1182
4370573a 1183// Retrieve whether auto-completion cancelled by backspacing before start.
8e0945da
VZ
1184bool wxStyledTextCtrl::AutoCompGetCancelAtStart() const
1185{
4370573a
RD
1186 return SendMsg(2111, 0, 0) != 0;
1187}
f6bcfd97 1188
1a2fb4cd
RD
1189// Define a set of characters that when typed will cause the autocompletion to
1190// choose the selected item.
8e0945da
VZ
1191void wxStyledTextCtrl::AutoCompSetFillUps(const wxString& characterSet)
1192{
b796ba39 1193 SendMsg(2112, 0, (sptr_t)(const char*)wx2stc(characterSet));
4370573a 1194}
9ce192d4 1195
4370573a 1196// Should a single item auto-completion list automatically choose the item.
8e0945da
VZ
1197void wxStyledTextCtrl::AutoCompSetChooseSingle(bool chooseSingle)
1198{
4370573a
RD
1199 SendMsg(2113, chooseSingle, 0);
1200}
9ce192d4 1201
4370573a 1202// Retrieve whether a single item auto-completion list automatically choose the item.
8e0945da
VZ
1203bool wxStyledTextCtrl::AutoCompGetChooseSingle() const
1204{
4370573a 1205 return SendMsg(2114, 0, 0) != 0;
9ce192d4
RD
1206}
1207
4370573a 1208// Set whether case is significant when performing auto-completion searches.
8e0945da
VZ
1209void wxStyledTextCtrl::AutoCompSetIgnoreCase(bool ignoreCase)
1210{
4370573a
RD
1211 SendMsg(2115, ignoreCase, 0);
1212}
9ce192d4 1213
4370573a 1214// Retrieve state of ignore case flag.
8e0945da
VZ
1215bool wxStyledTextCtrl::AutoCompGetIgnoreCase() const
1216{
4370573a 1217 return SendMsg(2116, 0, 0) != 0;
9ce192d4
RD
1218}
1219
65ec6247 1220// Display a list of strings and send notification when user chooses one.
8e0945da
VZ
1221void wxStyledTextCtrl::UserListShow(int listType, const wxString& itemList)
1222{
b796ba39 1223 SendMsg(2117, listType, (sptr_t)(const char*)wx2stc(itemList));
65ec6247
RD
1224}
1225
a834585d 1226// Set whether or not autocompletion is hidden automatically when nothing matches.
8e0945da
VZ
1227void wxStyledTextCtrl::AutoCompSetAutoHide(bool autoHide)
1228{
65ec6247
RD
1229 SendMsg(2118, autoHide, 0);
1230}
1231
a834585d 1232// Retrieve whether or not autocompletion is hidden automatically when nothing matches.
8e0945da
VZ
1233bool wxStyledTextCtrl::AutoCompGetAutoHide() const
1234{
65ec6247
RD
1235 return SendMsg(2119, 0, 0) != 0;
1236}
1237
a834585d
RD
1238// Set whether or not autocompletion deletes any word characters
1239// after the inserted text upon completion.
8e0945da
VZ
1240void wxStyledTextCtrl::AutoCompSetDropRestOfWord(bool dropRestOfWord)
1241{
1a2fb4cd
RD
1242 SendMsg(2270, dropRestOfWord, 0);
1243}
1244
a834585d
RD
1245// Retrieve whether or not autocompletion deletes any word characters
1246// after the inserted text upon completion.
8e0945da
VZ
1247bool wxStyledTextCtrl::AutoCompGetDropRestOfWord() const
1248{
1a2fb4cd
RD
1249 return SendMsg(2271, 0, 0) != 0;
1250}
1251
9e730a78
RD
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();
e45b3f17
RD
1257 if (img.HasAlpha())
1258 img.ConvertAlphaToMask();
9e730a78
RD
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;
b796ba39 1264 SendMsg(2405, type, (sptr_t)buff);
9e730a78 1265 delete [] buff;
35f8d83d 1266
9e730a78
RD
1267}
1268
1269// Clear all the registered images.
8e0945da
VZ
1270void wxStyledTextCtrl::ClearRegisteredImages()
1271{
9e730a78
RD
1272 SendMsg(2408, 0, 0);
1273}
1274
1275// Retrieve the auto-completion list type-separator character.
8e0945da
VZ
1276int wxStyledTextCtrl::AutoCompGetTypeSeparator() const
1277{
9e730a78
RD
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 '?'.
8e0945da
VZ
1283void wxStyledTextCtrl::AutoCompSetTypeSeparator(int separatorCharacter)
1284{
9e730a78
RD
1285 SendMsg(2286, separatorCharacter, 0);
1286}
1287
1e9bafca
RD
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.
8e0945da
VZ
1290void wxStyledTextCtrl::AutoCompSetMaxWidth(int characterCount)
1291{
1e9bafca
RD
1292 SendMsg(2208, characterCount, 0);
1293}
1294
1295// Get the maximum width, in characters, of auto-completion and user lists.
8e0945da
VZ
1296int wxStyledTextCtrl::AutoCompGetMaxWidth() const
1297{
1e9bafca
RD
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.
8e0945da
VZ
1303void wxStyledTextCtrl::AutoCompSetMaxHeight(int rowCount)
1304{
1e9bafca
RD
1305 SendMsg(2210, rowCount, 0);
1306}
1307
1308// Set the maximum height, in rows, of auto-completion and user lists.
8e0945da
VZ
1309int wxStyledTextCtrl::AutoCompGetMaxHeight() const
1310{
1e9bafca
RD
1311 return SendMsg(2211, 0, 0);
1312}
1313
4370573a 1314// Set the number of spaces used for one level of indentation.
8e0945da
VZ
1315void wxStyledTextCtrl::SetIndent(int indentSize)
1316{
4370573a
RD
1317 SendMsg(2122, indentSize, 0);
1318}
9ce192d4 1319
4370573a 1320// Retrieve indentation size.
8e0945da
VZ
1321int wxStyledTextCtrl::GetIndent() const
1322{
4370573a 1323 return SendMsg(2123, 0, 0);
9ce192d4
RD
1324}
1325
4370573a
RD
1326// Indentation will only use space characters if useTabs is false, otherwise
1327// it will use a combination of tabs and spaces.
8e0945da
VZ
1328void wxStyledTextCtrl::SetUseTabs(bool useTabs)
1329{
4370573a
RD
1330 SendMsg(2124, useTabs, 0);
1331}
9ce192d4 1332
4370573a 1333// Retrieve whether tabs will be used in indentation.
8e0945da
VZ
1334bool wxStyledTextCtrl::GetUseTabs() const
1335{
4370573a
RD
1336 return SendMsg(2125, 0, 0) != 0;
1337}
9ce192d4 1338
4370573a 1339// Change the indentation of a line to a number of columns.
8e0945da
VZ
1340void wxStyledTextCtrl::SetLineIndentation(int line, int indentSize)
1341{
4370573a
RD
1342 SendMsg(2126, line, indentSize);
1343}
9ce192d4 1344
4370573a 1345// Retrieve the number of columns that a line is indented.
8e0945da
VZ
1346int wxStyledTextCtrl::GetLineIndentation(int line) const
1347{
4370573a 1348 return SendMsg(2127, line, 0);
9ce192d4
RD
1349}
1350
4370573a 1351// Retrieve the position before the first non indentation character on a line.
8e0945da
VZ
1352int wxStyledTextCtrl::GetLineIndentPosition(int line) const
1353{
4370573a
RD
1354 return SendMsg(2128, line, 0);
1355}
9ce192d4 1356
4370573a 1357// Retrieve the column number of a position, taking tab width into account.
8e0945da
VZ
1358int wxStyledTextCtrl::GetColumn(int pos) const
1359{
4370573a 1360 return SendMsg(2129, pos, 0);
9ce192d4
RD
1361}
1362
9b01abb8
RD
1363// Count characters between two positions.
1364int wxStyledTextCtrl::CountCharacters(int startPos, int endPos)
1365{
1366 return SendMsg(2633, startPos, endPos);
1367}
1368
4370573a 1369// Show or hide the horizontal scroll bar.
8e0945da
VZ
1370void wxStyledTextCtrl::SetUseHorizontalScrollBar(bool show)
1371{
4370573a
RD
1372 SendMsg(2130, show, 0);
1373}
9ce192d4 1374
4370573a 1375// Is the horizontal scroll bar visible?
8e0945da
VZ
1376bool wxStyledTextCtrl::GetUseHorizontalScrollBar() const
1377{
4370573a 1378 return SendMsg(2131, 0, 0) != 0;
9ce192d4
RD
1379}
1380
4370573a 1381// Show or hide indentation guides.
8e0945da
VZ
1382void wxStyledTextCtrl::SetIndentationGuides(int indentView)
1383{
7e0c58e9 1384 SendMsg(2132, indentView, 0);
4370573a 1385}
9ce192d4 1386
4370573a 1387// Are the indentation guides visible?
8e0945da
VZ
1388int wxStyledTextCtrl::GetIndentationGuides() const
1389{
7e0c58e9 1390 return SendMsg(2133, 0, 0);
9ce192d4
RD
1391}
1392
4370573a
RD
1393// Set the highlighted indentation guide column.
1394// 0 = no highlighted guide.
8e0945da
VZ
1395void wxStyledTextCtrl::SetHighlightGuide(int column)
1396{
4370573a
RD
1397 SendMsg(2134, column, 0);
1398}
9ce192d4 1399
4370573a 1400// Get the highlighted indentation guide column.
8e0945da
VZ
1401int wxStyledTextCtrl::GetHighlightGuide() const
1402{
4370573a 1403 return SendMsg(2135, 0, 0);
9ce192d4
RD
1404}
1405
4370573a 1406// Get the position after the last visible characters on a line.
8e0945da
VZ
1407int wxStyledTextCtrl::GetLineEndPosition(int line) const
1408{
4370573a
RD
1409 return SendMsg(2136, line, 0);
1410}
9ce192d4 1411
4370573a 1412// Get the code page used to interpret the bytes of the document as characters.
8e0945da
VZ
1413int wxStyledTextCtrl::GetCodePage() const
1414{
4370573a 1415 return SendMsg(2137, 0, 0);
9ce192d4
RD
1416}
1417
4370573a 1418// Get the foreground colour of the caret.
8e0945da
VZ
1419wxColour wxStyledTextCtrl::GetCaretForeground() const
1420{
4370573a
RD
1421 long c = SendMsg(2138, 0, 0);
1422 return wxColourFromLong(c);
1423}
9ce192d4 1424
4370573a 1425// In read-only mode?
8e0945da
VZ
1426bool wxStyledTextCtrl::GetReadOnly() const
1427{
4370573a 1428 return SendMsg(2140, 0, 0) != 0;
9ce192d4
RD
1429}
1430
4370573a 1431// Sets the position of the caret.
8e0945da
VZ
1432void wxStyledTextCtrl::SetCurrentPos(int pos)
1433{
4370573a
RD
1434 SendMsg(2141, pos, 0);
1435}
9ce192d4 1436
4370573a 1437// Sets the position that starts the selection - this becomes the anchor.
8e0945da
VZ
1438void wxStyledTextCtrl::SetSelectionStart(int pos)
1439{
4370573a 1440 SendMsg(2142, pos, 0);
9ce192d4
RD
1441}
1442
4370573a 1443// Returns the position at the start of the selection.
8e0945da
VZ
1444int wxStyledTextCtrl::GetSelectionStart() const
1445{
4370573a
RD
1446 return SendMsg(2143, 0, 0);
1447}
9ce192d4 1448
4370573a 1449// Sets the position that ends the selection - this becomes the currentPosition.
8e0945da
VZ
1450void wxStyledTextCtrl::SetSelectionEnd(int pos)
1451{
4370573a 1452 SendMsg(2144, pos, 0);
9ce192d4
RD
1453}
1454
4370573a 1455// Returns the position at the end of the selection.
8e0945da
VZ
1456int wxStyledTextCtrl::GetSelectionEnd() const
1457{
4370573a
RD
1458 return SendMsg(2145, 0, 0);
1459}
9ce192d4 1460
9b01abb8
RD
1461// Set caret to a position, while removing any existing selection.
1462void wxStyledTextCtrl::SetEmptySelection(int pos)
1463{
1464 SendMsg(2556, pos, 0);
1465}
1466
4370573a 1467// Sets the print magnification added to the point size of each style for printing.
8e0945da
VZ
1468void wxStyledTextCtrl::SetPrintMagnification(int magnification)
1469{
4370573a 1470 SendMsg(2146, magnification, 0);
9ce192d4
RD
1471}
1472
4370573a 1473// Returns the print magnification.
8e0945da
VZ
1474int wxStyledTextCtrl::GetPrintMagnification() const
1475{
4370573a
RD
1476 return SendMsg(2147, 0, 0);
1477}
9ce192d4 1478
4370573a 1479// Modify colours when printing for clearer printed text.
8e0945da
VZ
1480void wxStyledTextCtrl::SetPrintColourMode(int mode)
1481{
4370573a 1482 SendMsg(2148, mode, 0);
9ce192d4
RD
1483}
1484
4370573a 1485// Returns the print colour mode.
8e0945da
VZ
1486int wxStyledTextCtrl::GetPrintColourMode() const
1487{
4370573a
RD
1488 return SendMsg(2149, 0, 0);
1489}
9ce192d4 1490
4370573a
RD
1491// Find some text in the document.
1492int wxStyledTextCtrl::FindText(int minPos, int maxPos,
9e730a78
RD
1493 const wxString& text,
1494 int flags) {
1495 TextToFind ft;
1496 ft.chrg.cpMin = minPos;
1497 ft.chrg.cpMax = maxPos;
2ed48ef8 1498 const wxWX2MBbuf buf = wx2stc(text);
9e730a78 1499 ft.lpstrText = (char*)(const char*)buf;
4370573a 1500
b796ba39 1501 return SendMsg(2150, flags, (sptr_t)&ft);
4370573a
RD
1502}
1503
a834585d 1504// On Windows, will draw the document into a display context such as a printer.
a5b274d7
WS
1505 int wxStyledTextCtrl::FormatRange(bool doDraw,
1506 int startPos,
1507 int endPos,
1508 wxDC* draw,
a5c2ccf2 1509 wxDC* target,
a5b274d7
WS
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
b796ba39 1532 return SendMsg(2151, doDraw, (sptr_t)&fr);
9e730a78
RD
1533}
1534
1535// Retrieve the display line at the top of the display.
8e0945da
VZ
1536int wxStyledTextCtrl::GetFirstVisibleLine() const
1537{
4370573a 1538 return SendMsg(2152, 0, 0);
9ce192d4
RD
1539}
1540
4370573a 1541// Retrieve the contents of a line.
2bfca191 1542wxString wxStyledTextCtrl::GetLine(int line) const {
9e730a78
RD
1543 int len = LineLength(line);
1544 if (!len) return wxEmptyString;
9ce192d4 1545
9e730a78
RD
1546 wxMemoryBuffer mbuf(len+1);
1547 char* buf = (char*)mbuf.GetWriteBuf(len+1);
b796ba39 1548 SendMsg(2153, line, (sptr_t)buf);
9e730a78
RD
1549 mbuf.UngetWriteBuf(len);
1550 mbuf.AppendByte(0);
1551 return stc2wx(buf);
4370573a
RD
1552}
1553
1554// Returns the number of lines in the document. There is always at least one.
8e0945da
VZ
1555int wxStyledTextCtrl::GetLineCount() const
1556{
4370573a
RD
1557 return SendMsg(2154, 0, 0);
1558}
9ce192d4 1559
4370573a 1560// Sets the size in pixels of the left margin.
8e0945da
VZ
1561void wxStyledTextCtrl::SetMarginLeft(int pixelWidth)
1562{
65ec6247 1563 SendMsg(2155, 0, pixelWidth);
4370573a 1564}
9ce192d4 1565
4370573a 1566// Returns the size in pixels of the left margin.
8e0945da
VZ
1567int wxStyledTextCtrl::GetMarginLeft() const
1568{
4370573a 1569 return SendMsg(2156, 0, 0);
9ce192d4
RD
1570}
1571
4370573a 1572// Sets the size in pixels of the right margin.
8e0945da
VZ
1573void wxStyledTextCtrl::SetMarginRight(int pixelWidth)
1574{
65ec6247 1575 SendMsg(2157, 0, pixelWidth);
4370573a 1576}
9ce192d4 1577
4370573a 1578// Returns the size in pixels of the right margin.
8e0945da
VZ
1579int wxStyledTextCtrl::GetMarginRight() const
1580{
4370573a 1581 return SendMsg(2158, 0, 0);
9ce192d4
RD
1582}
1583
4370573a 1584// Is the document different from when it was last saved?
8e0945da
VZ
1585bool wxStyledTextCtrl::GetModify() const
1586{
4370573a
RD
1587 return SendMsg(2159, 0, 0) != 0;
1588}
9ce192d4 1589
4370573a
RD
1590// Retrieve the selected text.
1591wxString wxStyledTextCtrl::GetSelectedText() {
6094165c 1592 const int len = SendMsg(SCI_GETSELTEXT, 0, (sptr_t)0);
9e730a78 1593 if (!len) return wxEmptyString;
9ce192d4 1594
3d7a4fe8 1595 wxMemoryBuffer mbuf(len+2);
9e730a78 1596 char* buf = (char*)mbuf.GetWriteBuf(len+1);
b796ba39 1597 SendMsg(2161, 0, (sptr_t)buf);
9e730a78
RD
1598 mbuf.UngetWriteBuf(len);
1599 mbuf.AppendByte(0);
1600 return stc2wx(buf);
4370573a 1601}
9ce192d4 1602
4370573a
RD
1603// Retrieve a range of text.
1604wxString wxStyledTextCtrl::GetTextRange(int startPos, int endPos) {
9e730a78
RD
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;
b796ba39 1618 SendMsg(2162, 0, (sptr_t)&tr);
9e730a78
RD
1619 mbuf.UngetWriteBuf(len);
1620 mbuf.AppendByte(0);
1621 return stc2wx(buf);
9ce192d4
RD
1622}
1623
4370573a 1624// Draw the selection in normal style or with selection highlighted.
8e0945da
VZ
1625void wxStyledTextCtrl::HideSelection(bool normal)
1626{
4370573a
RD
1627 SendMsg(2163, normal, 0);
1628}
9ce192d4 1629
4370573a 1630// Retrieve the line containing a position.
2bfca191 1631int wxStyledTextCtrl::LineFromPosition(int pos) const
8e0945da 1632{
4370573a 1633 return SendMsg(2166, pos, 0);
9ce192d4
RD
1634}
1635
4370573a 1636// Retrieve the position at the start of a line.
2bfca191 1637int wxStyledTextCtrl::PositionFromLine(int line) const
8e0945da 1638{
4370573a
RD
1639 return SendMsg(2167, line, 0);
1640}
9ce192d4 1641
4370573a 1642// Scroll horizontally and vertically.
8e0945da
VZ
1643void wxStyledTextCtrl::LineScroll(int columns, int lines)
1644{
4370573a 1645 SendMsg(2168, columns, lines);
9ce192d4
RD
1646}
1647
4370573a 1648// Ensure the caret is visible.
8e0945da
VZ
1649void wxStyledTextCtrl::EnsureCaretVisible()
1650{
4370573a
RD
1651 SendMsg(2169, 0, 0);
1652}
9ce192d4 1653
4370573a 1654// Replace the selected text with the argument text.
8e0945da
VZ
1655void wxStyledTextCtrl::ReplaceSelection(const wxString& text)
1656{
b796ba39 1657 SendMsg(2170, 0, (sptr_t)(const char*)wx2stc(text));
9ce192d4
RD
1658}
1659
4370573a 1660// Set to read only or read write.
8e0945da
VZ
1661void wxStyledTextCtrl::SetReadOnly(bool readOnly)
1662{
4370573a
RD
1663 SendMsg(2171, readOnly, 0);
1664}
9ce192d4 1665
4370573a 1666// Will a paste succeed?
7d6d76d0 1667bool wxStyledTextCtrl::CanPaste() const
8e0945da 1668{
4370573a 1669 return SendMsg(2173, 0, 0) != 0;
9ce192d4
RD
1670}
1671
a834585d 1672// Are there any undoable actions in the undo history?
93578927 1673bool wxStyledTextCtrl::CanUndo() const
8e0945da 1674{
4370573a
RD
1675 return SendMsg(2174, 0, 0) != 0;
1676}
9ce192d4 1677
4370573a 1678// Delete the undo history.
8e0945da
VZ
1679void wxStyledTextCtrl::EmptyUndoBuffer()
1680{
4370573a 1681 SendMsg(2175, 0, 0);
9ce192d4
RD
1682}
1683
4370573a 1684// Undo one action in the undo history.
8e0945da
VZ
1685void wxStyledTextCtrl::Undo()
1686{
4370573a
RD
1687 SendMsg(2176, 0, 0);
1688}
9ce192d4 1689
4370573a 1690// Cut the selection to the clipboard.
8e0945da
VZ
1691void wxStyledTextCtrl::Cut()
1692{
4370573a 1693 SendMsg(2177, 0, 0);
f6bcfd97
BP
1694}
1695
4370573a 1696// Copy the selection to the clipboard.
8e0945da
VZ
1697void wxStyledTextCtrl::Copy()
1698{
4370573a
RD
1699 SendMsg(2178, 0, 0);
1700}
f6bcfd97 1701
4370573a 1702// Paste the contents of the clipboard into the document replacing the selection.
8e0945da
VZ
1703void wxStyledTextCtrl::Paste()
1704{
4370573a 1705 SendMsg(2179, 0, 0);
f6bcfd97
BP
1706}
1707
4370573a 1708// Clear the selection.
8e0945da
VZ
1709void wxStyledTextCtrl::Clear()
1710{
4370573a
RD
1711 SendMsg(2180, 0, 0);
1712}
f6bcfd97 1713
4370573a 1714// Replace the contents of the document with the argument text.
8e0945da
VZ
1715void wxStyledTextCtrl::SetText(const wxString& text)
1716{
b796ba39 1717 SendMsg(2181, 0, (sptr_t)(const char*)wx2stc(text));
f6bcfd97
BP
1718}
1719
4370573a 1720// Retrieve all the text in the document.
93578927 1721wxString wxStyledTextCtrl::GetText() const {
9e730a78
RD
1722 int len = GetTextLength();
1723 wxMemoryBuffer mbuf(len+1); // leave room for the null...
1724 char* buf = (char*)mbuf.GetWriteBuf(len+1);
b796ba39 1725 SendMsg(2182, len+1, (sptr_t)buf);
9e730a78
RD
1726 mbuf.UngetWriteBuf(len);
1727 mbuf.AppendByte(0);
1728 return stc2wx(buf);
4370573a 1729}
9ce192d4 1730
4370573a 1731// Retrieve the number of characters in the document.
8e0945da
VZ
1732int wxStyledTextCtrl::GetTextLength() const
1733{
4370573a 1734 return SendMsg(2183, 0, 0);
9ce192d4
RD
1735}
1736
a834585d 1737// Set to overtype (true) or insert mode.
8e0945da
VZ
1738void wxStyledTextCtrl::SetOvertype(bool overtype)
1739{
4370573a
RD
1740 SendMsg(2186, overtype, 0);
1741}
9ce192d4 1742
4370573a 1743// Returns true if overtype mode is active otherwise false is returned.
8e0945da
VZ
1744bool wxStyledTextCtrl::GetOvertype() const
1745{
4370573a 1746 return SendMsg(2187, 0, 0) != 0;
9ce192d4
RD
1747}
1748
a834585d 1749// Set the width of the insert mode caret.
8e0945da
VZ
1750void wxStyledTextCtrl::SetCaretWidth(int pixelWidth)
1751{
65ec6247
RD
1752 SendMsg(2188, pixelWidth, 0);
1753}
1754
a834585d 1755// Returns the width of the insert mode caret.
8e0945da
VZ
1756int wxStyledTextCtrl::GetCaretWidth() const
1757{
65ec6247
RD
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.
8e0945da
VZ
1763void wxStyledTextCtrl::SetTargetStart(int pos)
1764{
65ec6247
RD
1765 SendMsg(2190, pos, 0);
1766}
1767
1768// Get the position that starts the target.
8e0945da
VZ
1769int wxStyledTextCtrl::GetTargetStart() const
1770{
65ec6247
RD
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.
8e0945da
VZ
1776void wxStyledTextCtrl::SetTargetEnd(int pos)
1777{
65ec6247
RD
1778 SendMsg(2192, pos, 0);
1779}
1780
1781// Get the position that ends the target.
8e0945da
VZ
1782int wxStyledTextCtrl::GetTargetEnd() const
1783{
65ec6247
RD
1784 return SendMsg(2193, 0, 0);
1785}
1786
1787// Replace the target text with the argument text.
8e54aaed 1788// Text is counted so it can contain NULs.
65ec6247
RD
1789// Returns the length of the replacement text.
1790
9e730a78 1791 int wxStyledTextCtrl::ReplaceTarget(const wxString& text) {
2ed48ef8 1792 const wxWX2MBbuf buf = wx2stc(text);
d7b46878 1793 return SendMsg(2194, wx2stclen(text, buf), (sptr_t)(const char*)buf);
65ec6247
RD
1794}
1795
1796// Replace the target text with the argument text after \d processing.
8e54aaed 1797// Text is counted so it can contain NULs.
65ec6247
RD
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
9e730a78 1803 int wxStyledTextCtrl::ReplaceTargetRE(const wxString& text) {
2ed48ef8 1804 const wxWX2MBbuf buf = wx2stc(text);
d7b46878 1805 return SendMsg(2195, wx2stclen(text, buf), (sptr_t)(const char*)buf);
65ec6247
RD
1806}
1807
1808// Search for a counted string in the target and set the target to the found
8e54aaed 1809// range. Text is counted so it can contain NULs.
65ec6247
RD
1810// Returns length of range or -1 for failure in which case target is not moved.
1811
9e730a78 1812 int wxStyledTextCtrl::SearchInTarget(const wxString& text) {
2ed48ef8 1813 const wxWX2MBbuf buf = wx2stc(text);
d7b46878 1814 return SendMsg(2197, wx2stclen(text, buf), (sptr_t)(const char*)buf);
65ec6247
RD
1815}
1816
a834585d 1817// Set the search flags used by SearchInTarget.
8e0945da
VZ
1818void wxStyledTextCtrl::SetSearchFlags(int flags)
1819{
65ec6247
RD
1820 SendMsg(2198, flags, 0);
1821}
1822
a834585d 1823// Get the search flags used by SearchInTarget.
8e0945da
VZ
1824int wxStyledTextCtrl::GetSearchFlags() const
1825{
65ec6247
RD
1826 return SendMsg(2199, 0, 0);
1827}
1828
4370573a 1829// Show a call tip containing a definition near position pos.
8e0945da
VZ
1830void wxStyledTextCtrl::CallTipShow(int pos, const wxString& definition)
1831{
b796ba39 1832 SendMsg(2200, pos, (sptr_t)(const char*)wx2stc(definition));
4370573a 1833}
9ce192d4 1834
4370573a 1835// Remove the call tip from the screen.
8e0945da
VZ
1836void wxStyledTextCtrl::CallTipCancel()
1837{
4370573a 1838 SendMsg(2201, 0, 0);
9ce192d4
RD
1839}
1840
4370573a 1841// Is there an active call tip?
8e0945da
VZ
1842bool wxStyledTextCtrl::CallTipActive()
1843{
4370573a
RD
1844 return SendMsg(2202, 0, 0) != 0;
1845}
9ce192d4 1846
4370573a 1847// Retrieve the position where the caret was before displaying the call tip.
8e0945da
VZ
1848int wxStyledTextCtrl::CallTipPosAtStart()
1849{
4370573a 1850 return SendMsg(2203, 0, 0);
9ce192d4
RD
1851}
1852
4370573a 1853// Highlight a segment of the definition.
8e0945da
VZ
1854void wxStyledTextCtrl::CallTipSetHighlight(int start, int end)
1855{
4370573a 1856 SendMsg(2204, start, end);
9ce192d4
RD
1857}
1858
4370573a 1859// Set the background colour for the call tip.
8e0945da
VZ
1860void wxStyledTextCtrl::CallTipSetBackground(const wxColour& back)
1861{
4370573a
RD
1862 SendMsg(2205, wxColourAsLong(back), 0);
1863}
9ce192d4 1864
9e730a78 1865// Set the foreground colour for the call tip.
8e0945da
VZ
1866void wxStyledTextCtrl::CallTipSetForeground(const wxColour& fore)
1867{
9e730a78
RD
1868 SendMsg(2206, wxColourAsLong(fore), 0);
1869}
1870
1871// Set the foreground colour for the highlighted part of the call tip.
8e0945da
VZ
1872void wxStyledTextCtrl::CallTipSetForegroundHighlight(const wxColour& fore)
1873{
9e730a78
RD
1874 SendMsg(2207, wxColourAsLong(fore), 0);
1875}
1876
b8193d80 1877// Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
8e0945da
VZ
1878void wxStyledTextCtrl::CallTipUseStyle(int tabSize)
1879{
b8193d80
RD
1880 SendMsg(2212, tabSize, 0);
1881}
1882
9b01abb8
RD
1883// Set position of calltip, above or below text.
1884void wxStyledTextCtrl::CallTipSetPosition(bool above)
1885{
1886 SendMsg(2213, above, 0);
1887}
1888
4370573a 1889// Find the display line of a document line taking hidden lines into account.
8e0945da
VZ
1890int wxStyledTextCtrl::VisibleFromDocLine(int line)
1891{
4370573a 1892 return SendMsg(2220, line, 0);
9ce192d4
RD
1893}
1894
4370573a 1895// Find the document line of a display line taking hidden lines into account.
8e0945da
VZ
1896int wxStyledTextCtrl::DocLineFromVisible(int lineDisplay)
1897{
4370573a
RD
1898 return SendMsg(2221, lineDisplay, 0);
1899}
9ce192d4 1900
1e9bafca 1901// The number of display lines needed to wrap a document line
8e0945da
VZ
1902int wxStyledTextCtrl::WrapCount(int line)
1903{
1e9bafca
RD
1904 return SendMsg(2235, line, 0);
1905}
1906
4370573a
RD
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.
8e0945da
VZ
1910void wxStyledTextCtrl::SetFoldLevel(int line, int level)
1911{
4370573a
RD
1912 SendMsg(2222, line, level);
1913}
9ce192d4 1914
4370573a 1915// Retrieve the fold level of a line.
8e0945da
VZ
1916int wxStyledTextCtrl::GetFoldLevel(int line) const
1917{
4370573a
RD
1918 return SendMsg(2223, line, 0);
1919}
d134f170 1920
4370573a 1921// Find the last child line of a header line.
8e0945da
VZ
1922int wxStyledTextCtrl::GetLastChild(int line, int level) const
1923{
4370573a 1924 return SendMsg(2224, line, level);
9ce192d4
RD
1925}
1926
4370573a 1927// Find the parent line of a child line.
8e0945da
VZ
1928int wxStyledTextCtrl::GetFoldParent(int line) const
1929{
4370573a
RD
1930 return SendMsg(2225, line, 0);
1931}
9ce192d4 1932
4370573a 1933// Make a range of lines visible.
8e0945da
VZ
1934void wxStyledTextCtrl::ShowLines(int lineStart, int lineEnd)
1935{
4370573a 1936 SendMsg(2226, lineStart, lineEnd);
9ce192d4
RD
1937}
1938
4370573a 1939// Make a range of lines invisible.
8e0945da
VZ
1940void wxStyledTextCtrl::HideLines(int lineStart, int lineEnd)
1941{
4370573a
RD
1942 SendMsg(2227, lineStart, lineEnd);
1943}
9ce192d4 1944
4370573a 1945// Is a line visible?
8e0945da
VZ
1946bool wxStyledTextCtrl::GetLineVisible(int line) const
1947{
4370573a 1948 return SendMsg(2228, line, 0) != 0;
9ce192d4
RD
1949}
1950
9b01abb8
RD
1951// Are all lines visible?
1952bool wxStyledTextCtrl::GetAllLinesVisible() const
1953{
1954 return SendMsg(2236, 0, 0) != 0;
1955}
1956
4370573a 1957// Show the children of a header line.
8e0945da
VZ
1958void wxStyledTextCtrl::SetFoldExpanded(int line, bool expanded)
1959{
4370573a
RD
1960 SendMsg(2229, line, expanded);
1961}
9ce192d4 1962
4370573a 1963// Is a header line expanded?
8e0945da
VZ
1964bool wxStyledTextCtrl::GetFoldExpanded(int line) const
1965{
4370573a 1966 return SendMsg(2230, line, 0) != 0;
9ce192d4
RD
1967}
1968
4370573a 1969// Switch a header line between expanded and contracted.
8e0945da
VZ
1970void wxStyledTextCtrl::ToggleFold(int line)
1971{
4370573a
RD
1972 SendMsg(2231, line, 0);
1973}
9ce192d4 1974
4370573a 1975// Ensure a particular line is visible by expanding any header line hiding it.
8e0945da
VZ
1976void wxStyledTextCtrl::EnsureVisible(int line)
1977{
4370573a
RD
1978 SendMsg(2232, line, 0);
1979}
9ce192d4 1980
9e730a78 1981// Set some style options for folding.
8e0945da
VZ
1982void wxStyledTextCtrl::SetFoldFlags(int flags)
1983{
4370573a 1984 SendMsg(2233, flags, 0);
9ce192d4
RD
1985}
1986
65ec6247
RD
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.
8e0945da
VZ
1989void wxStyledTextCtrl::EnsureVisibleEnforcePolicy(int line)
1990{
65ec6247
RD
1991 SendMsg(2234, line, 0);
1992}
1993
a834585d 1994// Sets whether a tab pressed when caret is within indentation indents.
8e0945da
VZ
1995void wxStyledTextCtrl::SetTabIndents(bool tabIndents)
1996{
65ec6247
RD
1997 SendMsg(2260, tabIndents, 0);
1998}
1999
2000// Does a tab pressed when caret is within indentation indent?
8e0945da
VZ
2001bool wxStyledTextCtrl::GetTabIndents() const
2002{
65ec6247
RD
2003 return SendMsg(2261, 0, 0) != 0;
2004}
2005
a834585d 2006// Sets whether a backspace pressed when caret is within indentation unindents.
8e0945da
VZ
2007void wxStyledTextCtrl::SetBackSpaceUnIndents(bool bsUnIndents)
2008{
65ec6247
RD
2009 SendMsg(2262, bsUnIndents, 0);
2010}
2011
2012// Does a backspace pressed when caret is within indentation unindent?
8e0945da
VZ
2013bool wxStyledTextCtrl::GetBackSpaceUnIndents() const
2014{
65ec6247
RD
2015 return SendMsg(2263, 0, 0) != 0;
2016}
2017
a834585d 2018// Sets the time the mouse must sit still to generate a mouse dwell event.
8e0945da
VZ
2019void wxStyledTextCtrl::SetMouseDwellTime(int periodMilliseconds)
2020{
65ec6247
RD
2021 SendMsg(2264, periodMilliseconds, 0);
2022}
2023
a834585d 2024// Retrieve the time the mouse must sit still to generate a mouse dwell event.
8e0945da
VZ
2025int wxStyledTextCtrl::GetMouseDwellTime() const
2026{
65ec6247
RD
2027 return SendMsg(2265, 0, 0);
2028}
2029
a834585d 2030// Get position of start of word.
8e0945da
VZ
2031int wxStyledTextCtrl::WordStartPosition(int pos, bool onlyWordCharacters)
2032{
1a2fb4cd
RD
2033 return SendMsg(2266, pos, onlyWordCharacters);
2034}
2035
a834585d 2036// Get position of end of word.
8e0945da
VZ
2037int wxStyledTextCtrl::WordEndPosition(int pos, bool onlyWordCharacters)
2038{
1a2fb4cd
RD
2039 return SendMsg(2267, pos, onlyWordCharacters);
2040}
2041
a834585d 2042// Sets whether text is word wrapped.
8e0945da
VZ
2043void wxStyledTextCtrl::SetWrapMode(int mode)
2044{
1a2fb4cd
RD
2045 SendMsg(2268, mode, 0);
2046}
2047
a834585d 2048// Retrieve whether text is word wrapped.
8e0945da
VZ
2049int wxStyledTextCtrl::GetWrapMode() const
2050{
1a2fb4cd
RD
2051 return SendMsg(2269, 0, 0);
2052}
2053
591d01be 2054// Set the display mode of visual flags for wrapped lines.
8e0945da
VZ
2055void wxStyledTextCtrl::SetWrapVisualFlags(int wrapVisualFlags)
2056{
591d01be
RD
2057 SendMsg(2460, wrapVisualFlags, 0);
2058}
2059
4ce59b1f 2060// Retrive the display mode of visual flags for wrapped lines.
8e0945da
VZ
2061int wxStyledTextCtrl::GetWrapVisualFlags() const
2062{
591d01be
RD
2063 return SendMsg(2461, 0, 0);
2064}
2065
2066// Set the location of visual flags for wrapped lines.
8e0945da
VZ
2067void wxStyledTextCtrl::SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation)
2068{
591d01be
RD
2069 SendMsg(2462, wrapVisualFlagsLocation, 0);
2070}
2071
4ce59b1f 2072// Retrive the location of visual flags for wrapped lines.
8e0945da
VZ
2073int wxStyledTextCtrl::GetWrapVisualFlagsLocation() const
2074{
591d01be
RD
2075 return SendMsg(2463, 0, 0);
2076}
2077
2078// Set the start indent for wrapped lines.
8e0945da
VZ
2079void wxStyledTextCtrl::SetWrapStartIndent(int indent)
2080{
591d01be
RD
2081 SendMsg(2464, indent, 0);
2082}
2083
4ce59b1f 2084// Retrive the start indent for wrapped lines.
8e0945da
VZ
2085int wxStyledTextCtrl::GetWrapStartIndent() const
2086{
591d01be
RD
2087 return SendMsg(2465, 0, 0);
2088}
2089
9e96e16f
RD
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
a834585d 2102// Sets the degree of caching of layout information.
8e0945da
VZ
2103void wxStyledTextCtrl::SetLayoutCache(int mode)
2104{
1a2fb4cd
RD
2105 SendMsg(2272, mode, 0);
2106}
2107
a834585d 2108// Retrieve the degree of caching of layout information.
8e0945da
VZ
2109int wxStyledTextCtrl::GetLayoutCache() const
2110{
1a2fb4cd
RD
2111 return SendMsg(2273, 0, 0);
2112}
2113
a834585d 2114// Sets the document width assumed for scrolling.
8e0945da
VZ
2115void wxStyledTextCtrl::SetScrollWidth(int pixelWidth)
2116{
a834585d
RD
2117 SendMsg(2274, pixelWidth, 0);
2118}
2119
2120// Retrieve the document width assumed for scrolling.
8e0945da
VZ
2121int wxStyledTextCtrl::GetScrollWidth() const
2122{
a834585d
RD
2123 return SendMsg(2275, 0, 0);
2124}
2125
7e0c58e9 2126// Sets whether the maximum width line displayed is used to set scroll width.
8e0945da
VZ
2127void wxStyledTextCtrl::SetScrollWidthTracking(bool tracking)
2128{
7e0c58e9
RD
2129 SendMsg(2516, tracking, 0);
2130}
2131
2132// Retrieve whether the scroll width tracks wide lines.
8e0945da
VZ
2133bool wxStyledTextCtrl::GetScrollWidthTracking() const
2134{
7e0c58e9
RD
2135 return SendMsg(2517, 0, 0) != 0;
2136}
2137
a834585d 2138// Measure the pixel width of some text in a particular style.
8e54aaed 2139// NUL terminated text argument.
a834585d 2140// Does not handle tab or control characters.
8e0945da
VZ
2141int wxStyledTextCtrl::TextWidth(int style, const wxString& text)
2142{
b796ba39 2143 return SendMsg(2276, style, (sptr_t)(const char*)wx2stc(text));
a834585d
RD
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.
8e0945da
VZ
2149void wxStyledTextCtrl::SetEndAtLastLine(bool endAtLastLine)
2150{
a834585d
RD
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.
8e0945da
VZ
2156bool wxStyledTextCtrl::GetEndAtLastLine() const
2157{
1e9bafca 2158 return SendMsg(2278, 0, 0) != 0;
a834585d
RD
2159}
2160
2161// Retrieve the height of a particular line of text in pixels.
8e0945da
VZ
2162int wxStyledTextCtrl::TextHeight(int line)
2163{
a834585d
RD
2164 return SendMsg(2279, line, 0);
2165}
2166
9e730a78 2167// Show or hide the vertical scroll bar.
8e0945da
VZ
2168void wxStyledTextCtrl::SetUseVerticalScrollBar(bool show)
2169{
9e730a78
RD
2170 SendMsg(2280, show, 0);
2171}
2172
2173// Is the vertical scroll bar visible?
8e0945da
VZ
2174bool wxStyledTextCtrl::GetUseVerticalScrollBar() const
2175{
9e730a78
RD
2176 return SendMsg(2281, 0, 0) != 0;
2177}
2178
2179// Append a string to the end of the document without changing the selection.
41a499cd 2180void wxStyledTextCtrl::AppendText(const wxString& text) {
2ed48ef8 2181 const wxWX2MBbuf buf = wx2stc(text);
d7b46878 2182 SendMsg(2282, wx2stclen(text, buf), (sptr_t)(const char*)buf);
9e730a78
RD
2183}
2184
2185// Is drawing done in two phases with backgrounds drawn before foregrounds?
8e0945da
VZ
2186bool wxStyledTextCtrl::GetTwoPhaseDraw() const
2187{
9e730a78
RD
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.
8e0945da
VZ
2193void wxStyledTextCtrl::SetTwoPhaseDraw(bool twoPhase)
2194{
9e730a78
RD
2195 SendMsg(2284, twoPhase, 0);
2196}
2197
9e96e16f
RD
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
9b01abb8
RD
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;
c4bdd822 2219 int len = SendMsg(msg, tagNumber, (sptr_t)NULL);
9b01abb8
RD
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
9e730a78 2230// Make the target range start and end be the same as the selection range start and end.
8e0945da
VZ
2231void wxStyledTextCtrl::TargetFromSelection()
2232{
9e730a78
RD
2233 SendMsg(2287, 0, 0);
2234}
2235
2236// Join the lines in the target.
8e0945da
VZ
2237void wxStyledTextCtrl::LinesJoin()
2238{
9e730a78
RD
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.
8e0945da
VZ
2244void wxStyledTextCtrl::LinesSplit(int pixelWidth)
2245{
9e730a78
RD
2246 SendMsg(2289, pixelWidth, 0);
2247}
2248
2249// Set the colours used as a chequerboard pattern in the fold margin
8e0945da
VZ
2250void wxStyledTextCtrl::SetFoldMarginColour(bool useSetting, const wxColour& back)
2251{
9e730a78
RD
2252 SendMsg(2290, useSetting, wxColourAsLong(back));
2253}
8e0945da
VZ
2254void wxStyledTextCtrl::SetFoldMarginHiColour(bool useSetting, const wxColour& fore)
2255{
9e730a78
RD
2256 SendMsg(2291, useSetting, wxColourAsLong(fore));
2257}
2258
c26dba42 2259// Move caret down one line.
8e0945da
VZ
2260void wxStyledTextCtrl::LineDown()
2261{
c26dba42
RD
2262 SendMsg(2300, 0, 0);
2263}
2264
2265// Move caret down one line extending selection to new caret position.
8e0945da
VZ
2266void wxStyledTextCtrl::LineDownExtend()
2267{
c26dba42
RD
2268 SendMsg(2301, 0, 0);
2269}
2270
2271// Move caret up one line.
8e0945da
VZ
2272void wxStyledTextCtrl::LineUp()
2273{
c26dba42
RD
2274 SendMsg(2302, 0, 0);
2275}
2276
2277// Move caret up one line extending selection to new caret position.
8e0945da
VZ
2278void wxStyledTextCtrl::LineUpExtend()
2279{
c26dba42
RD
2280 SendMsg(2303, 0, 0);
2281}
2282
2283// Move caret left one character.
8e0945da
VZ
2284void wxStyledTextCtrl::CharLeft()
2285{
c26dba42
RD
2286 SendMsg(2304, 0, 0);
2287}
2288
2289// Move caret left one character extending selection to new caret position.
8e0945da
VZ
2290void wxStyledTextCtrl::CharLeftExtend()
2291{
c26dba42
RD
2292 SendMsg(2305, 0, 0);
2293}
2294
2295// Move caret right one character.
8e0945da
VZ
2296void wxStyledTextCtrl::CharRight()
2297{
c26dba42
RD
2298 SendMsg(2306, 0, 0);
2299}
2300
2301// Move caret right one character extending selection to new caret position.
8e0945da
VZ
2302void wxStyledTextCtrl::CharRightExtend()
2303{
c26dba42
RD
2304 SendMsg(2307, 0, 0);
2305}
2306
2307// Move caret left one word.
8e0945da
VZ
2308void wxStyledTextCtrl::WordLeft()
2309{
c26dba42
RD
2310 SendMsg(2308, 0, 0);
2311}
2312
2313// Move caret left one word extending selection to new caret position.
8e0945da
VZ
2314void wxStyledTextCtrl::WordLeftExtend()
2315{
c26dba42
RD
2316 SendMsg(2309, 0, 0);
2317}
2318
2319// Move caret right one word.
8e0945da
VZ
2320void wxStyledTextCtrl::WordRight()
2321{
c26dba42
RD
2322 SendMsg(2310, 0, 0);
2323}
2324
2325// Move caret right one word extending selection to new caret position.
8e0945da
VZ
2326void wxStyledTextCtrl::WordRightExtend()
2327{
c26dba42
RD
2328 SendMsg(2311, 0, 0);
2329}
2330
2331// Move caret to first position on line.
8e0945da
VZ
2332void wxStyledTextCtrl::Home()
2333{
c26dba42
RD
2334 SendMsg(2312, 0, 0);
2335}
2336
2337// Move caret to first position on line extending selection to new caret position.
8e0945da
VZ
2338void wxStyledTextCtrl::HomeExtend()
2339{
c26dba42
RD
2340 SendMsg(2313, 0, 0);
2341}
2342
2343// Move caret to last position on line.
8e0945da
VZ
2344void wxStyledTextCtrl::LineEnd()
2345{
c26dba42
RD
2346 SendMsg(2314, 0, 0);
2347}
2348
2349// Move caret to last position on line extending selection to new caret position.
8e0945da
VZ
2350void wxStyledTextCtrl::LineEndExtend()
2351{
c26dba42
RD
2352 SendMsg(2315, 0, 0);
2353}
2354
2355// Move caret to first position in document.
8e0945da
VZ
2356void wxStyledTextCtrl::DocumentStart()
2357{
c26dba42
RD
2358 SendMsg(2316, 0, 0);
2359}
2360
2361// Move caret to first position in document extending selection to new caret position.
8e0945da
VZ
2362void wxStyledTextCtrl::DocumentStartExtend()
2363{
c26dba42
RD
2364 SendMsg(2317, 0, 0);
2365}
2366
2367// Move caret to last position in document.
8e0945da
VZ
2368void wxStyledTextCtrl::DocumentEnd()
2369{
c26dba42
RD
2370 SendMsg(2318, 0, 0);
2371}
2372
2373// Move caret to last position in document extending selection to new caret position.
8e0945da
VZ
2374void wxStyledTextCtrl::DocumentEndExtend()
2375{
c26dba42
RD
2376 SendMsg(2319, 0, 0);
2377}
2378
2379// Move caret one page up.
8e0945da
VZ
2380void wxStyledTextCtrl::PageUp()
2381{
c26dba42
RD
2382 SendMsg(2320, 0, 0);
2383}
2384
2385// Move caret one page up extending selection to new caret position.
8e0945da
VZ
2386void wxStyledTextCtrl::PageUpExtend()
2387{
c26dba42
RD
2388 SendMsg(2321, 0, 0);
2389}
2390
2391// Move caret one page down.
8e0945da
VZ
2392void wxStyledTextCtrl::PageDown()
2393{
c26dba42
RD
2394 SendMsg(2322, 0, 0);
2395}
2396
2397// Move caret one page down extending selection to new caret position.
8e0945da
VZ
2398void wxStyledTextCtrl::PageDownExtend()
2399{
c26dba42
RD
2400 SendMsg(2323, 0, 0);
2401}
2402
2403// Switch from insert to overtype mode or the reverse.
8e0945da
VZ
2404void wxStyledTextCtrl::EditToggleOvertype()
2405{
c26dba42
RD
2406 SendMsg(2324, 0, 0);
2407}
2408
2409// Cancel any modes such as call tip or auto-completion list display.
8e0945da
VZ
2410void wxStyledTextCtrl::Cancel()
2411{
c26dba42
RD
2412 SendMsg(2325, 0, 0);
2413}
2414
2415// Delete the selection or if no selection, the character before the caret.
8e0945da
VZ
2416void wxStyledTextCtrl::DeleteBack()
2417{
c26dba42
RD
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.
8e0945da
VZ
2423void wxStyledTextCtrl::Tab()
2424{
c26dba42
RD
2425 SendMsg(2327, 0, 0);
2426}
2427
2428// Dedent the selected lines.
8e0945da
VZ
2429void wxStyledTextCtrl::BackTab()
2430{
c26dba42
RD
2431 SendMsg(2328, 0, 0);
2432}
2433
2434// Insert a new line, may use a CRLF, CR or LF depending on EOL mode.
8e0945da
VZ
2435void wxStyledTextCtrl::NewLine()
2436{
c26dba42
RD
2437 SendMsg(2329, 0, 0);
2438}
2439
2440// Insert a Form Feed character.
8e0945da
VZ
2441void wxStyledTextCtrl::FormFeed()
2442{
c26dba42
RD
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.
8e0945da
VZ
2448void wxStyledTextCtrl::VCHome()
2449{
c26dba42
RD
2450 SendMsg(2331, 0, 0);
2451}
2452
2453// Like VCHome but extending selection to new caret position.
8e0945da
VZ
2454void wxStyledTextCtrl::VCHomeExtend()
2455{
c26dba42
RD
2456 SendMsg(2332, 0, 0);
2457}
2458
2459// Magnify the displayed text by increasing the sizes by 1 point.
8e0945da
VZ
2460void wxStyledTextCtrl::ZoomIn()
2461{
c26dba42
RD
2462 SendMsg(2333, 0, 0);
2463}
2464
2465// Make the displayed text smaller by decreasing the sizes by 1 point.
8e0945da
VZ
2466void wxStyledTextCtrl::ZoomOut()
2467{
c26dba42
RD
2468 SendMsg(2334, 0, 0);
2469}
2470
2471// Delete the word to the left of the caret.
8e0945da
VZ
2472void wxStyledTextCtrl::DelWordLeft()
2473{
c26dba42
RD
2474 SendMsg(2335, 0, 0);
2475}
2476
2477// Delete the word to the right of the caret.
8e0945da
VZ
2478void wxStyledTextCtrl::DelWordRight()
2479{
c26dba42
RD
2480 SendMsg(2336, 0, 0);
2481}
2482
7e0c58e9 2483// Delete the word to the right of the caret, but not the trailing non-word characters.
8e0945da
VZ
2484void wxStyledTextCtrl::DelWordRightEnd()
2485{
7e0c58e9
RD
2486 SendMsg(2518, 0, 0);
2487}
2488
c26dba42 2489// Cut the line containing the caret.
8e0945da
VZ
2490void wxStyledTextCtrl::LineCut()
2491{
c26dba42
RD
2492 SendMsg(2337, 0, 0);
2493}
2494
2495// Delete the line containing the caret.
8e0945da
VZ
2496void wxStyledTextCtrl::LineDelete()
2497{
c26dba42
RD
2498 SendMsg(2338, 0, 0);
2499}
2500
2501// Switch the current line with the previous.
8e0945da
VZ
2502void wxStyledTextCtrl::LineTranspose()
2503{
c26dba42
RD
2504 SendMsg(2339, 0, 0);
2505}
2506
9e730a78 2507// Duplicate the current line.
8e0945da
VZ
2508void wxStyledTextCtrl::LineDuplicate()
2509{
9e730a78
RD
2510 SendMsg(2404, 0, 0);
2511}
2512
c26dba42 2513// Transform the selection to lower case.
8e0945da
VZ
2514void wxStyledTextCtrl::LowerCase()
2515{
c26dba42
RD
2516 SendMsg(2340, 0, 0);
2517}
2518
2519// Transform the selection to upper case.
8e0945da
VZ
2520void wxStyledTextCtrl::UpperCase()
2521{
c26dba42
RD
2522 SendMsg(2341, 0, 0);
2523}
2524
2525// Scroll the document down, keeping the caret visible.
8e0945da
VZ
2526void wxStyledTextCtrl::LineScrollDown()
2527{
c26dba42
RD
2528 SendMsg(2342, 0, 0);
2529}
2530
2531// Scroll the document up, keeping the caret visible.
8e0945da
VZ
2532void wxStyledTextCtrl::LineScrollUp()
2533{
c26dba42
RD
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.
8e0945da
VZ
2539void wxStyledTextCtrl::DeleteBackNotLine()
2540{
c26dba42
RD
2541 SendMsg(2344, 0, 0);
2542}
2543
f114b858 2544// Move caret to first position on display line.
8e0945da
VZ
2545void wxStyledTextCtrl::HomeDisplay()
2546{
f114b858
RD
2547 SendMsg(2345, 0, 0);
2548}
2549
2b5f62a0 2550// Move caret to first position on display line extending selection to
f114b858 2551// new caret position.
8e0945da
VZ
2552void wxStyledTextCtrl::HomeDisplayExtend()
2553{
f114b858
RD
2554 SendMsg(2346, 0, 0);
2555}
2556
2557// Move caret to last position on display line.
8e0945da
VZ
2558void wxStyledTextCtrl::LineEndDisplay()
2559{
f114b858
RD
2560 SendMsg(2347, 0, 0);
2561}
2562
2b5f62a0 2563// Move caret to last position on display line extending selection to new
f114b858 2564// caret position.
8e0945da
VZ
2565void wxStyledTextCtrl::LineEndDisplayExtend()
2566{
f114b858
RD
2567 SendMsg(2348, 0, 0);
2568}
2569
c26dba42
RD
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)?.
8e0945da
VZ
2575void wxStyledTextCtrl::HomeWrap()
2576{
c26dba42
RD
2577 SendMsg(2349, 0, 0);
2578}
8e0945da
VZ
2579void wxStyledTextCtrl::HomeWrapExtend()
2580{
c26dba42
RD
2581 SendMsg(2450, 0, 0);
2582}
8e0945da
VZ
2583void wxStyledTextCtrl::LineEndWrap()
2584{
c26dba42
RD
2585 SendMsg(2451, 0, 0);
2586}
8e0945da
VZ
2587void wxStyledTextCtrl::LineEndWrapExtend()
2588{
c26dba42
RD
2589 SendMsg(2452, 0, 0);
2590}
8e0945da
VZ
2591void wxStyledTextCtrl::VCHomeWrap()
2592{
c26dba42
RD
2593 SendMsg(2453, 0, 0);
2594}
8e0945da
VZ
2595void wxStyledTextCtrl::VCHomeWrapExtend()
2596{
c26dba42
RD
2597 SendMsg(2454, 0, 0);
2598}
2599
e14d10b0 2600// Copy the line containing the caret.
8e0945da
VZ
2601void wxStyledTextCtrl::LineCopy()
2602{
e14d10b0
RD
2603 SendMsg(2455, 0, 0);
2604}
2605
a834585d 2606// Move the caret inside current view if it's not there already.
8e0945da
VZ
2607void wxStyledTextCtrl::MoveCaretInsideView()
2608{
65ec6247
RD
2609 SendMsg(2401, 0, 0);
2610}
2611
9e96e16f 2612// How many characters are on a line, including end of line characters?
2bfca191 2613int wxStyledTextCtrl::LineLength(int line) const
8e0945da 2614{
4370573a
RD
2615 return SendMsg(2350, line, 0);
2616}
9ce192d4 2617
4370573a 2618// Highlight the characters at two positions.
8e0945da
VZ
2619void wxStyledTextCtrl::BraceHighlight(int pos1, int pos2)
2620{
4370573a
RD
2621 SendMsg(2351, pos1, pos2);
2622}
9ce192d4 2623
9b01abb8
RD
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
4370573a 2630// Highlight the character at a position indicating there is no matching brace.
8e0945da
VZ
2631void wxStyledTextCtrl::BraceBadLight(int pos)
2632{
4370573a 2633 SendMsg(2352, pos, 0);
9ce192d4
RD
2634}
2635
9b01abb8
RD
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
4370573a 2642// Find the position of a matching brace or INVALID_POSITION if no match.
8e0945da
VZ
2643int wxStyledTextCtrl::BraceMatch(int pos)
2644{
4370573a
RD
2645 return SendMsg(2353, pos, 0);
2646}
9ce192d4 2647
a834585d 2648// Are the end of line characters visible?
8e0945da
VZ
2649bool wxStyledTextCtrl::GetViewEOL() const
2650{
4370573a 2651 return SendMsg(2355, 0, 0) != 0;
9ce192d4
RD
2652}
2653
a834585d 2654// Make the end of line characters visible or invisible.
8e0945da
VZ
2655void wxStyledTextCtrl::SetViewEOL(bool visible)
2656{
4370573a
RD
2657 SendMsg(2356, visible, 0);
2658}
9ce192d4 2659
4370573a
RD
2660// Retrieve a pointer to the document object.
2661void* wxStyledTextCtrl::GetDocPointer() {
9e730a78 2662 return (void*)SendMsg(2357);
4370573a 2663}
67003d1a 2664
4370573a
RD
2665// Change the document object used.
2666void wxStyledTextCtrl::SetDocPointer(void* docPointer) {
b796ba39 2667 SendMsg(2358, 0, (sptr_t)docPointer);
67003d1a
RD
2668}
2669
4370573a 2670// Set which document modification events are sent to the container.
8e0945da
VZ
2671void wxStyledTextCtrl::SetModEventMask(int mask)
2672{
4370573a
RD
2673 SendMsg(2359, mask, 0);
2674}
67003d1a 2675
4370573a 2676// Retrieve the column number which text should be kept within.
8e0945da
VZ
2677int wxStyledTextCtrl::GetEdgeColumn() const
2678{
4370573a 2679 return SendMsg(2360, 0, 0);
67003d1a
RD
2680}
2681
4370573a
RD
2682// Set the column number of the edge.
2683// If text goes past the edge then it is highlighted.
8e0945da
VZ
2684void wxStyledTextCtrl::SetEdgeColumn(int column)
2685{
4370573a
RD
2686 SendMsg(2361, column, 0);
2687}
67003d1a 2688
4370573a 2689// Retrieve the edge highlight mode.
8e0945da
VZ
2690int wxStyledTextCtrl::GetEdgeMode() const
2691{
4370573a 2692 return SendMsg(2362, 0, 0);
67003d1a
RD
2693}
2694
4370573a
RD
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).
8e0945da
VZ
2697void wxStyledTextCtrl::SetEdgeMode(int mode)
2698{
4370573a
RD
2699 SendMsg(2363, mode, 0);
2700}
67003d1a 2701
4370573a 2702// Retrieve the colour used in edge indication.
8e0945da
VZ
2703wxColour wxStyledTextCtrl::GetEdgeColour() const
2704{
4370573a
RD
2705 long c = SendMsg(2364, 0, 0);
2706 return wxColourFromLong(c);
67003d1a
RD
2707}
2708
4370573a 2709// Change the colour used in edge indication.
8e0945da
VZ
2710void wxStyledTextCtrl::SetEdgeColour(const wxColour& edgeColour)
2711{
4370573a
RD
2712 SendMsg(2365, wxColourAsLong(edgeColour), 0);
2713}
67003d1a 2714
4370573a 2715// Sets the current caret position to be the search anchor.
8e0945da
VZ
2716void wxStyledTextCtrl::SearchAnchor()
2717{
4370573a 2718 SendMsg(2366, 0, 0);
67003d1a
RD
2719}
2720
4370573a 2721// Find some text starting at the search anchor.
65ec6247 2722// Does not ensure the selection is visible.
8e0945da
VZ
2723int wxStyledTextCtrl::SearchNext(int flags, const wxString& text)
2724{
b796ba39 2725 return SendMsg(2367, flags, (sptr_t)(const char*)wx2stc(text));
4370573a 2726}
67003d1a 2727
4370573a 2728// Find some text starting at the search anchor and moving backwards.
65ec6247 2729// Does not ensure the selection is visible.
8e0945da
VZ
2730int wxStyledTextCtrl::SearchPrev(int flags, const wxString& text)
2731{
b796ba39 2732 return SendMsg(2368, flags, (sptr_t)(const char*)wx2stc(text));
67003d1a
RD
2733}
2734
4370573a 2735// Retrieves the number of lines completely visible.
8e0945da
VZ
2736int wxStyledTextCtrl::LinesOnScreen() const
2737{
4370573a 2738 return SendMsg(2370, 0, 0);
67003d1a
RD
2739}
2740
4370573a
RD
2741// Set whether a pop up menu is displayed automatically when the user presses
2742// the wrong mouse button.
8e0945da
VZ
2743void wxStyledTextCtrl::UsePopUp(bool allowPopUp)
2744{
4370573a
RD
2745 SendMsg(2371, allowPopUp, 0);
2746}
67003d1a 2747
a834585d 2748// Is the selection rectangular? The alternative is the more common stream selection.
8e0945da
VZ
2749bool wxStyledTextCtrl::SelectionIsRectangle() const
2750{
4370573a 2751 return SendMsg(2372, 0, 0) != 0;
67003d1a
RD
2752}
2753
4370573a
RD
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.
8e0945da
VZ
2756void wxStyledTextCtrl::SetZoom(int zoom)
2757{
4370573a
RD
2758 SendMsg(2373, zoom, 0);
2759}
67003d1a 2760
4370573a 2761// Retrieve the zoom level.
8e0945da
VZ
2762int wxStyledTextCtrl::GetZoom() const
2763{
4370573a 2764 return SendMsg(2374, 0, 0);
67003d1a
RD
2765}
2766
4370573a
RD
2767// Create a new document object.
2768// Starts with reference count of 1 and not selected into editor.
2769void* wxStyledTextCtrl::CreateDocument() {
9e730a78 2770 return (void*)SendMsg(2375);
4370573a 2771}
67003d1a 2772
4370573a
RD
2773// Extend life of document.
2774void wxStyledTextCtrl::AddRefDocument(void* docPointer) {
b796ba39 2775 SendMsg(2376, 0, (sptr_t)docPointer);
67003d1a
RD
2776}
2777
4370573a
RD
2778// Release a reference to the document, deleting document if it fades to black.
2779void wxStyledTextCtrl::ReleaseDocument(void* docPointer) {
b796ba39 2780 SendMsg(2377, 0, (sptr_t)docPointer);
4370573a 2781}
67003d1a 2782
4370573a 2783// Get which document modification events are sent to the container.
8e0945da
VZ
2784int wxStyledTextCtrl::GetModEventMask() const
2785{
4370573a 2786 return SendMsg(2378, 0, 0);
67003d1a
RD
2787}
2788
a834585d 2789// Change internal focus flag.
8e0945da
VZ
2790void wxStyledTextCtrl::SetSTCFocus(bool focus)
2791{
65ec6247
RD
2792 SendMsg(2380, focus, 0);
2793}
2794
a834585d 2795// Get internal focus flag.
8e0945da
VZ
2796bool wxStyledTextCtrl::GetSTCFocus() const
2797{
65ec6247
RD
2798 return SendMsg(2381, 0, 0) != 0;
2799}
2800
a834585d 2801// Change error status - 0 = OK.
8e0945da
VZ
2802void wxStyledTextCtrl::SetStatus(int statusCode)
2803{
65ec6247
RD
2804 SendMsg(2382, statusCode, 0);
2805}
2806
a834585d 2807// Get error status.
8e0945da
VZ
2808int wxStyledTextCtrl::GetStatus() const
2809{
65ec6247
RD
2810 return SendMsg(2383, 0, 0);
2811}
2812
a834585d 2813// Set whether the mouse is captured when its button is pressed.
8e0945da
VZ
2814void wxStyledTextCtrl::SetMouseDownCaptures(bool captures)
2815{
65ec6247
RD
2816 SendMsg(2384, captures, 0);
2817}
2818
a834585d 2819// Get whether mouse gets captured.
8e0945da
VZ
2820bool wxStyledTextCtrl::GetMouseDownCaptures() const
2821{
65ec6247
RD
2822 return SendMsg(2385, 0, 0) != 0;
2823}
2824
a834585d 2825// Sets the cursor to one of the SC_CURSOR* values.
8e0945da
VZ
2826void wxStyledTextCtrl::SetSTCCursor(int cursorType)
2827{
65ec6247
RD
2828 SendMsg(2386, cursorType, 0);
2829}
2830
a834585d 2831// Get cursor type.
8e0945da
VZ
2832int wxStyledTextCtrl::GetSTCCursor() const
2833{
65ec6247
RD
2834 return SendMsg(2387, 0, 0);
2835}
2836
1a2fb4cd 2837// Change the way control characters are displayed:
a834585d 2838// If symbol is < 32, keep the drawn way, else, use the given character.
8e0945da
VZ
2839void wxStyledTextCtrl::SetControlCharSymbol(int symbol)
2840{
1a2fb4cd
RD
2841 SendMsg(2388, symbol, 0);
2842}
2843
a834585d 2844// Get the way control characters are displayed.
8e0945da
VZ
2845int wxStyledTextCtrl::GetControlCharSymbol() const
2846{
1a2fb4cd
RD
2847 return SendMsg(2389, 0, 0);
2848}
2849
a834585d 2850// Move to the previous change in capitalisation.
8e0945da
VZ
2851void wxStyledTextCtrl::WordPartLeft()
2852{
65ec6247
RD
2853 SendMsg(2390, 0, 0);
2854}
2855
a834585d
RD
2856// Move to the previous change in capitalisation extending selection
2857// to new caret position.
8e0945da
VZ
2858void wxStyledTextCtrl::WordPartLeftExtend()
2859{
65ec6247
RD
2860 SendMsg(2391, 0, 0);
2861}
2862
a834585d 2863// Move to the change next in capitalisation.
8e0945da
VZ
2864void wxStyledTextCtrl::WordPartRight()
2865{
65ec6247
RD
2866 SendMsg(2392, 0, 0);
2867}
2868
a834585d
RD
2869// Move to the next change in capitalisation extending selection
2870// to new caret position.
8e0945da
VZ
2871void wxStyledTextCtrl::WordPartRightExtend()
2872{
65ec6247
RD
2873 SendMsg(2393, 0, 0);
2874}
2875
a834585d
RD
2876// Set the way the display area is determined when a particular line
2877// is to be moved to by Find, FindNext, GotoLine, etc.
8e0945da
VZ
2878void wxStyledTextCtrl::SetVisiblePolicy(int visiblePolicy, int visibleSlop)
2879{
65ec6247
RD
2880 SendMsg(2394, visiblePolicy, visibleSlop);
2881}
2882
a834585d 2883// Delete back from the current position to the start of the line.
8e0945da
VZ
2884void wxStyledTextCtrl::DelLineLeft()
2885{
65ec6247
RD
2886 SendMsg(2395, 0, 0);
2887}
2888
a834585d 2889// Delete forwards from the current position to the end of the line.
8e0945da
VZ
2890void wxStyledTextCtrl::DelLineRight()
2891{
65ec6247
RD
2892 SendMsg(2396, 0, 0);
2893}
2894
9b01abb8 2895// Get and Set the xOffset (ie, horizontal scroll position).
8e0945da
VZ
2896void wxStyledTextCtrl::SetXOffset(int newOffset)
2897{
1a2fb4cd
RD
2898 SendMsg(2397, newOffset, 0);
2899}
8e0945da
VZ
2900int wxStyledTextCtrl::GetXOffset() const
2901{
1a2fb4cd
RD
2902 return SendMsg(2398, 0, 0);
2903}
2904
8e54aaed 2905// Set the last x chosen value to be the caret x position.
8e0945da
VZ
2906void wxStyledTextCtrl::ChooseCaretX()
2907{
9e730a78
RD
2908 SendMsg(2399, 0, 0);
2909}
2910
9b01abb8 2911// Set the way the caret is kept visible when going sideways.
a834585d 2912// The exclusion zone is given in pixels.
8e0945da
VZ
2913void wxStyledTextCtrl::SetXCaretPolicy(int caretPolicy, int caretSlop)
2914{
a834585d
RD
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.
8e0945da
VZ
2920void wxStyledTextCtrl::SetYCaretPolicy(int caretPolicy, int caretSlop)
2921{
a834585d
RD
2922 SendMsg(2403, caretPolicy, caretSlop);
2923}
2924
9e730a78 2925// Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE).
8e0945da
VZ
2926void wxStyledTextCtrl::SetPrintWrapMode(int mode)
2927{
9e730a78
RD
2928 SendMsg(2406, mode, 0);
2929}
2930
8e54aaed 2931// Is printing line wrapped?
8e0945da
VZ
2932int wxStyledTextCtrl::GetPrintWrapMode() const
2933{
9e730a78
RD
2934 return SendMsg(2407, 0, 0);
2935}
2936
2937// Set a fore colour for active hotspots.
8e0945da
VZ
2938void wxStyledTextCtrl::SetHotspotActiveForeground(bool useSetting, const wxColour& fore)
2939{
9e730a78
RD
2940 SendMsg(2410, useSetting, wxColourAsLong(fore));
2941}
2942
7e0c58e9 2943// Get the fore colour for active hotspots.
8e0945da
VZ
2944wxColour wxStyledTextCtrl::GetHotspotActiveForeground() const
2945{
7e0c58e9
RD
2946 long c = SendMsg(2494, 0, 0);
2947 return wxColourFromLong(c);
2948}
2949
9e730a78 2950// Set a back colour for active hotspots.
8e0945da
VZ
2951void wxStyledTextCtrl::SetHotspotActiveBackground(bool useSetting, const wxColour& back)
2952{
9e730a78
RD
2953 SendMsg(2411, useSetting, wxColourAsLong(back));
2954}
2955
7e0c58e9 2956// Get the back colour for active hotspots.
8e0945da
VZ
2957wxColour wxStyledTextCtrl::GetHotspotActiveBackground() const
2958{
7e0c58e9
RD
2959 long c = SendMsg(2495, 0, 0);
2960 return wxColourFromLong(c);
2961}
2962
9e730a78 2963// Enable / Disable underlining active hotspots.
8e0945da
VZ
2964void wxStyledTextCtrl::SetHotspotActiveUnderline(bool underline)
2965{
9e730a78
RD
2966 SendMsg(2412, underline, 0);
2967}
2968
7e0c58e9 2969// Get whether underlining for active hotspots.
8e0945da
VZ
2970bool wxStyledTextCtrl::GetHotspotActiveUnderline() const
2971{
7e0c58e9
RD
2972 return SendMsg(2496, 0, 0) != 0;
2973}
2974
8e54aaed 2975// Limit hotspots to single line so hotspots on two lines don't merge.
8e0945da
VZ
2976void wxStyledTextCtrl::SetHotspotSingleLine(bool singleLine)
2977{
8e54aaed
RD
2978 SendMsg(2421, singleLine, 0);
2979}
2980
7e0c58e9 2981// Get the HotspotSingleLine property
8e0945da
VZ
2982bool wxStyledTextCtrl::GetHotspotSingleLine() const
2983{
7e0c58e9
RD
2984 return SendMsg(2497, 0, 0) != 0;
2985}
2986
c26dba42 2987// Move caret between paragraphs (delimited by empty lines).
8e0945da
VZ
2988void wxStyledTextCtrl::ParaDown()
2989{
c26dba42
RD
2990 SendMsg(2413, 0, 0);
2991}
8e0945da
VZ
2992void wxStyledTextCtrl::ParaDownExtend()
2993{
c26dba42
RD
2994 SendMsg(2414, 0, 0);
2995}
8e0945da
VZ
2996void wxStyledTextCtrl::ParaUp()
2997{
c26dba42
RD
2998 SendMsg(2415, 0, 0);
2999}
8e0945da
VZ
3000void wxStyledTextCtrl::ParaUpExtend()
3001{
c26dba42
RD
3002 SendMsg(2416, 0, 0);
3003}
3004
e14d10b0
RD
3005// Given a valid document position, return the previous position taking code
3006// page into account. Returns 0 if passed 0.
8e0945da
VZ
3007int wxStyledTextCtrl::PositionBefore(int pos)
3008{
e14d10b0
RD
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.
8e0945da
VZ
3014int wxStyledTextCtrl::PositionAfter(int pos)
3015{
e14d10b0
RD
3016 return SendMsg(2418, pos, 0);
3017}
3018
3019// Copy a range of text to the clipboard. Positions are clipped into the document.
8e0945da
VZ
3020void wxStyledTextCtrl::CopyRange(int start, int end)
3021{
e14d10b0
RD
3022 SendMsg(2419, start, end);
3023}
3024
3025// Copy argument text to the clipboard.
8e0945da
VZ
3026void wxStyledTextCtrl::CopyText(int length, const wxString& text)
3027{
b796ba39 3028 SendMsg(2420, length, (sptr_t)(const char*)wx2stc(text));
e14d10b0
RD
3029}
3030
9e96e16f 3031// Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE/SC_SEL_THIN) or
8e54aaed 3032// by lines (SC_SEL_LINES).
8e0945da
VZ
3033void wxStyledTextCtrl::SetSelectionMode(int mode)
3034{
8e54aaed
RD
3035 SendMsg(2422, mode, 0);
3036}
3037
3038// Get the mode of the current selection.
8e0945da
VZ
3039int wxStyledTextCtrl::GetSelectionMode() const
3040{
8e54aaed
RD
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).
8e0945da
VZ
3045int wxStyledTextCtrl::GetLineSelStartPosition(int line)
3046{
8e54aaed
RD
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).
8e0945da
VZ
3051int wxStyledTextCtrl::GetLineSelEndPosition(int line)
3052{
8e54aaed
RD
3053 return SendMsg(2425, line, 0);
3054}
3055
c26dba42 3056// Move caret down one line, extending rectangular selection to new caret position.
8e0945da
VZ
3057void wxStyledTextCtrl::LineDownRectExtend()
3058{
c26dba42
RD
3059 SendMsg(2426, 0, 0);
3060}
3061
3062// Move caret up one line, extending rectangular selection to new caret position.
8e0945da
VZ
3063void wxStyledTextCtrl::LineUpRectExtend()
3064{
c26dba42
RD
3065 SendMsg(2427, 0, 0);
3066}
3067
3068// Move caret left one character, extending rectangular selection to new caret position.
8e0945da
VZ
3069void wxStyledTextCtrl::CharLeftRectExtend()
3070{
c26dba42
RD
3071 SendMsg(2428, 0, 0);
3072}
3073
3074// Move caret right one character, extending rectangular selection to new caret position.
8e0945da
VZ
3075void wxStyledTextCtrl::CharRightRectExtend()
3076{
c26dba42
RD
3077 SendMsg(2429, 0, 0);
3078}
3079
3080// Move caret to first position on line, extending rectangular selection to new caret position.
8e0945da
VZ
3081void wxStyledTextCtrl::HomeRectExtend()
3082{
c26dba42
RD
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.
8e0945da
VZ
3089void wxStyledTextCtrl::VCHomeRectExtend()
3090{
c26dba42
RD
3091 SendMsg(2431, 0, 0);
3092}
3093
3094// Move caret to last position on line, extending rectangular selection to new caret position.
8e0945da
VZ
3095void wxStyledTextCtrl::LineEndRectExtend()
3096{
c26dba42
RD
3097 SendMsg(2432, 0, 0);
3098}
3099
3100// Move caret one page up, extending rectangular selection to new caret position.
8e0945da
VZ
3101void wxStyledTextCtrl::PageUpRectExtend()
3102{
c26dba42
RD
3103 SendMsg(2433, 0, 0);
3104}
3105
3106// Move caret one page down, extending rectangular selection to new caret position.
8e0945da
VZ
3107void wxStyledTextCtrl::PageDownRectExtend()
3108{
c26dba42
RD
3109 SendMsg(2434, 0, 0);
3110}
3111
3112// Move caret to top of page, or one page up if already at top of page.
8e0945da
VZ
3113void wxStyledTextCtrl::StutteredPageUp()
3114{
c26dba42
RD
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.
8e0945da
VZ
3119void wxStyledTextCtrl::StutteredPageUpExtend()
3120{
c26dba42
RD
3121 SendMsg(2436, 0, 0);
3122}
3123
3124// Move caret to bottom of page, or one page down if already at bottom of page.
8e0945da
VZ
3125void wxStyledTextCtrl::StutteredPageDown()
3126{
c26dba42
RD
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.
8e0945da
VZ
3131void wxStyledTextCtrl::StutteredPageDownExtend()
3132{
c26dba42
RD
3133 SendMsg(2438, 0, 0);
3134}
3135
3136// Move caret left one word, position cursor at end of word.
8e0945da
VZ
3137void wxStyledTextCtrl::WordLeftEnd()
3138{
c26dba42
RD
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.
8e0945da
VZ
3143void wxStyledTextCtrl::WordLeftEndExtend()
3144{
c26dba42
RD
3145 SendMsg(2440, 0, 0);
3146}
3147
3148// Move caret right one word, position cursor at end of word.
8e0945da
VZ
3149void wxStyledTextCtrl::WordRightEnd()
3150{
c26dba42
RD
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.
8e0945da
VZ
3155void wxStyledTextCtrl::WordRightEndExtend()
3156{
c26dba42
RD
3157 SendMsg(2442, 0, 0);
3158}
3159
8e54aaed
RD
3160// Set the set of characters making up whitespace for when moving or selecting by word.
3161// Should be called after SetWordChars.
8e0945da
VZ
3162void wxStyledTextCtrl::SetWhitespaceChars(const wxString& characters)
3163{
b796ba39 3164 SendMsg(2443, 0, (sptr_t)(const char*)wx2stc(characters));
8e54aaed
RD
3165}
3166
9b01abb8
RD
3167// Get the set of characters making up whitespace for when moving or selecting by word.
3168wxString wxStyledTextCtrl::GetWhitespaceChars() const {
3169 int msg = 2647;
c4bdd822 3170 int len = SendMsg(msg, 0, (sptr_t)NULL);
9b01abb8
RD
3171 if (!len) return wxEmptyString;
3172
3173 wxMemoryBuffer mbuf(len+1);
3174 char* buf = (char*)mbuf.GetWriteBuf(len+1);
54173563 3175 SendMsg(msg, 0, (sptr_t)buf);
9b01abb8
RD
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;
c4bdd822 3191 int len = SendMsg(msg, 0, (sptr_t)NULL);
9b01abb8
RD
3192 if (!len) return wxEmptyString;
3193
3194 wxMemoryBuffer mbuf(len+1);
3195 char* buf = (char*)mbuf.GetWriteBuf(len+1);
54173563 3196 SendMsg(msg, 0, (sptr_t)buf);
9b01abb8
RD
3197 mbuf.UngetWriteBuf(len);
3198 mbuf.AppendByte(0);
3199 return stc2wx(buf);
3200}
3201
8e54aaed 3202// Reset the set of characters for whitespace and word characters to the defaults.
8e0945da
VZ
3203void wxStyledTextCtrl::SetCharsDefault()
3204{
8e54aaed
RD
3205 SendMsg(2444, 0, 0);
3206}
3207
3208// Get currently selected item position in the auto-completion list
9b01abb8 3209int wxStyledTextCtrl::AutoCompGetCurrent() const
8e0945da 3210{
8e54aaed
RD
3211 return SendMsg(2445, 0, 0);
3212}
3213
9b01abb8 3214// Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference.
54173563 3215void wxStyledTextCtrl::AutoCompSetCaseInsensitiveBehaviour(int behaviour)
9b01abb8
RD
3216{
3217 SendMsg(2634, behaviour, 0);
3218}
3219
3220// Get auto-completion case insensitive behaviour.
54173563 3221int wxStyledTextCtrl::AutoCompGetCaseInsensitiveBehaviour() const
9b01abb8
RD
3222{
3223 return SendMsg(2635, 0, 0);
3224}
3225
591d01be 3226// Enlarge the document to a particular size of text bytes.
8e0945da
VZ
3227void wxStyledTextCtrl::Allocate(int bytes)
3228{
591d01be
RD
3229 SendMsg(2446, bytes, 0);
3230}
3231
1e9bafca 3232// Find the position of a column on a line taking into account tabs and
a33203cb 3233// multi-byte characters. If beyond end of line, return line end position.
8e0945da
VZ
3234int wxStyledTextCtrl::FindColumn(int line, int column)
3235{
a33203cb
RD
3236 return SendMsg(2456, line, column);
3237}
3238
1e9bafca 3239// Can the caret preferred x position only be changed by explicit movement commands?
9b01abb8 3240int wxStyledTextCtrl::GetCaretSticky() const
8e0945da 3241{
9b01abb8 3242 return SendMsg(2457, 0, 0);
1e9bafca
RD
3243}
3244
3245// Stop the caret preferred x position changing when the user types.
9b01abb8 3246void wxStyledTextCtrl::SetCaretSticky(int useCaretStickyBehaviour)
8e0945da 3247{
1e9bafca
RD
3248 SendMsg(2458, useCaretStickyBehaviour, 0);
3249}
3250
3251// Switch between sticky and non-sticky: meant to be bound to a key.
8e0945da
VZ
3252void wxStyledTextCtrl::ToggleCaretSticky()
3253{
1e9bafca
RD
3254 SendMsg(2459, 0, 0);
3255}
3256
3257// Enable/Disable convert-on-paste for line endings
8e0945da
VZ
3258void wxStyledTextCtrl::SetPasteConvertEndings(bool convert)
3259{
1e9bafca
RD
3260 SendMsg(2467, convert, 0);
3261}
3262
3263// Get convert-on-paste setting
8e0945da
VZ
3264bool wxStyledTextCtrl::GetPasteConvertEndings() const
3265{
1e9bafca
RD
3266 return SendMsg(2468, 0, 0) != 0;
3267}
3268
3269// Duplicate the selection. If selection empty duplicate the line containing the caret.
8e0945da
VZ
3270void wxStyledTextCtrl::SelectionDuplicate()
3271{
1e9bafca
RD
3272 SendMsg(2469, 0, 0);
3273}
3274
b8193d80 3275// Set background alpha of the caret line.
8e0945da
VZ
3276void wxStyledTextCtrl::SetCaretLineBackAlpha(int alpha)
3277{
b8193d80
RD
3278 SendMsg(2470, alpha, 0);
3279}
3280
3281// Get the background alpha of the caret line.
8e0945da
VZ
3282int wxStyledTextCtrl::GetCaretLineBackAlpha() const
3283{
b8193d80
RD
3284 return SendMsg(2471, 0, 0);
3285}
3286
7e0c58e9 3287// Set the style of the caret to be drawn.
8e0945da
VZ
3288void wxStyledTextCtrl::SetCaretStyle(int caretStyle)
3289{
7e0c58e9
RD
3290 SendMsg(2512, caretStyle, 0);
3291}
3292
3293// Returns the current style of the caret.
8e0945da
VZ
3294int wxStyledTextCtrl::GetCaretStyle() const
3295{
7e0c58e9
RD
3296 return SendMsg(2513, 0, 0);
3297}
3298
3299// Set the indicator used for IndicatorFillRange and IndicatorClearRange
8e0945da
VZ
3300void wxStyledTextCtrl::SetIndicatorCurrent(int indicator)
3301{
7e0c58e9
RD
3302 SendMsg(2500, indicator, 0);
3303}
3304
3305// Get the current indicator
8e0945da
VZ
3306int wxStyledTextCtrl::GetIndicatorCurrent() const
3307{
7e0c58e9
RD
3308 return SendMsg(2501, 0, 0);
3309}
3310
3311// Set the value used for IndicatorFillRange
8e0945da
VZ
3312void wxStyledTextCtrl::SetIndicatorValue(int value)
3313{
7e0c58e9
RD
3314 SendMsg(2502, value, 0);
3315}
3316
9b01abb8 3317// Get the current indicator value
8e0945da
VZ
3318int wxStyledTextCtrl::GetIndicatorValue() const
3319{
7e0c58e9
RD
3320 return SendMsg(2503, 0, 0);
3321}
3322
3323// Turn a indicator on over a range.
8e0945da
VZ
3324void wxStyledTextCtrl::IndicatorFillRange(int position, int fillLength)
3325{
7e0c58e9
RD
3326 SendMsg(2504, position, fillLength);
3327}
3328
3329// Turn a indicator off over a range.
8e0945da
VZ
3330void wxStyledTextCtrl::IndicatorClearRange(int position, int clearLength)
3331{
7e0c58e9
RD
3332 SendMsg(2505, position, clearLength);
3333}
3334
3335// Are any indicators present at position?
8e0945da
VZ
3336int wxStyledTextCtrl::IndicatorAllOnFor(int position)
3337{
7e0c58e9
RD
3338 return SendMsg(2506, position, 0);
3339}
3340
3341// What value does a particular indicator have at at a position?
8e0945da
VZ
3342int wxStyledTextCtrl::IndicatorValueAt(int indicator, int position)
3343{
7e0c58e9
RD
3344 return SendMsg(2507, indicator, position);
3345}
3346
3347// Where does a particular indicator start?
8e0945da
VZ
3348int wxStyledTextCtrl::IndicatorStart(int indicator, int position)
3349{
7e0c58e9
RD
3350 return SendMsg(2508, indicator, position);
3351}
3352
3353// Where does a particular indicator end?
8e0945da
VZ
3354int wxStyledTextCtrl::IndicatorEnd(int indicator, int position)
3355{
7e0c58e9
RD
3356 return SendMsg(2509, indicator, position);
3357}
3358
3359// Set number of entries in position cache
8e0945da
VZ
3360void wxStyledTextCtrl::SetPositionCacheSize(int size)
3361{
7e0c58e9
RD
3362 SendMsg(2514, size, 0);
3363}
3364
3365// How many entries are allocated to the position cache?
8e0945da
VZ
3366int wxStyledTextCtrl::GetPositionCacheSize() const
3367{
7e0c58e9
RD
3368 return SendMsg(2515, 0, 0);
3369}
3370
9e96e16f
RD
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.
54173563 3379const char* wxStyledTextCtrl::GetCharacterPointer() const {
9e96e16f
RD
3380 return (const char*)SendMsg(2520, 0, 0);
3381}
3382
9b01abb8
RD
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.
54173563
RD
3386const char* wxStyledTextCtrl::GetRangePointer(int position, int rangeLength) const {
3387 return (const char*)SendMsg(2643, position, rangeLength);
9b01abb8
RD
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
9e96e16f
RD
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
9b01abb8 3421// Set the alpha outline colour of the given indicator.
54173563 3422void wxStyledTextCtrl::IndicatorSetOutlineAlpha(int indicator, int alpha)
9b01abb8
RD
3423{
3424 SendMsg(2558, indicator, alpha);
3425}
3426
3427// Get the alpha outline colour of the given indicator.
54173563 3428int wxStyledTextCtrl::IndicatorGetOutlineAlpha(int indicator) const
9b01abb8
RD
3429{
3430 return SendMsg(2559, indicator, 0);
3431}
3432
9e96e16f
RD
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
9b01abb8
RD
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
9e96e16f
RD
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
9b01abb8
RD
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
54173563
RD
3946void wxStyledTextCtrl::MarkerDefineRGBAImage(int markerNumber, const unsigned char* pixels) {
3947 SendMsg(2626, markerNumber, (sptr_t)pixels);
9b01abb8
RD
3948}
3949
3950// Register an RGBA image for use in autocompletion lists.
3951// It has the width and height from RGBAImageSetWidth/Height
54173563
RD
3952void wxStyledTextCtrl::RegisterRGBAImage(int type, const unsigned char* pixels) {
3953 SendMsg(2627, type, (sptr_t)pixels);
9b01abb8
RD
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*.
54173563
RD
3981void* wxStyledTextCtrl::CreateLoader(int bytes) const {
3982 return (void*)(sptr_t)SendMsg(2632, bytes);
9b01abb8
RD
3983}
3984
4370573a 3985// Start notifying the container of all key presses and commands.
8e0945da
VZ
3986void wxStyledTextCtrl::StartRecord()
3987{
4370573a
RD
3988 SendMsg(3001, 0, 0);
3989}
67003d1a 3990
4370573a 3991// Stop notifying the container of all key presses and commands.
8e0945da
VZ
3992void wxStyledTextCtrl::StopRecord()
3993{
4370573a 3994 SendMsg(3002, 0, 0);
67003d1a
RD
3995}
3996
4370573a 3997// Set the lexing language of the document.
8e0945da
VZ
3998void wxStyledTextCtrl::SetLexer(int lexer)
3999{
4370573a
RD
4000 SendMsg(4001, lexer, 0);
4001}
67003d1a 4002
4370573a 4003// Retrieve the lexing language of the document.
8e0945da
VZ
4004int wxStyledTextCtrl::GetLexer() const
4005{
4370573a 4006 return SendMsg(4002, 0, 0);
67003d1a
RD
4007}
4008
4370573a 4009// Colourise a segment of the document using the current lexing language.
8e0945da
VZ
4010void wxStyledTextCtrl::Colourise(int start, int end)
4011{
4370573a
RD
4012 SendMsg(4003, start, end);
4013}
67003d1a 4014
4370573a 4015// Set up a value that may be used by a lexer for some optional feature.
8e0945da
VZ
4016void wxStyledTextCtrl::SetProperty(const wxString& key, const wxString& value)
4017{
b796ba39 4018 SendMsg(4004, (sptr_t)(const char*)wx2stc(key), (sptr_t)(const char*)wx2stc(value));
f6bcfd97
BP
4019}
4020
4370573a 4021// Set up the key words used by the lexer.
8e0945da
VZ
4022void wxStyledTextCtrl::SetKeyWords(int keywordSet, const wxString& keyWords)
4023{
b796ba39 4024 SendMsg(4005, keywordSet, (sptr_t)(const char*)wx2stc(keyWords));
4370573a 4025}
f6bcfd97 4026
65ec6247 4027// Set the lexing language of the document based on string name.
8e0945da
VZ
4028void wxStyledTextCtrl::SetLexerLanguage(const wxString& language)
4029{
b796ba39 4030 SendMsg(4006, 0, (sptr_t)(const char*)wx2stc(language));
65ec6247
RD
4031}
4032
1e9bafca
RD
4033// Retrieve a 'property' value previously set with SetProperty.
4034wxString wxStyledTextCtrl::GetProperty(const wxString& key) {
b796ba39 4035 int len = SendMsg(SCI_GETPROPERTY, (sptr_t)(const char*)wx2stc(key), 0);
1e9bafca
RD
4036 if (!len) return wxEmptyString;
4037
4038 wxMemoryBuffer mbuf(len+1);
4039 char* buf = (char*)mbuf.GetWriteBuf(len+1);
b796ba39 4040 SendMsg(4008, (uptr_t)(const char*)wx2stc(key), (sptr_t)buf);
1e9bafca
RD
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) {
b796ba39 4049 int len = SendMsg(SCI_GETPROPERTYEXPANDED, (uptr_t)(const char*)wx2stc(key), 0);
1e9bafca
RD
4050 if (!len) return wxEmptyString;
4051
4052 wxMemoryBuffer mbuf(len+1);
4053 char* buf = (char*)mbuf.GetWriteBuf(len+1);
b796ba39 4054 SendMsg(4009, (uptr_t)(const char*)wx2stc(key), (sptr_t)buf);
1e9bafca
RD
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.
8e0945da
VZ
4062int wxStyledTextCtrl::GetPropertyInt(const wxString& key) const
4063{
b796ba39 4064 return SendMsg(4010, (sptr_t)(const char*)wx2stc(key), 0);
1e9bafca
RD
4065}
4066
4067// Retrieve the number of bits the current lexer needs for styling.
8e0945da
VZ
4068int wxStyledTextCtrl::GetStyleBitsNeeded() const
4069{
1e9bafca
RD
4070 return SendMsg(4011, 0, 0);
4071}
4072
9b01abb8 4073// For private communication between an application and a known lexer.
54173563
RD
4074void* wxStyledTextCtrl::PrivateLexerCall(int operation, void* pointer) {
4075 return (void*)(sptr_t)SendMsg(4013, operation, (sptr_t)pointer);
9b01abb8
RD
4076}
4077
4078// Retrieve a '\n' separated list of properties understood by the current lexer.
4079wxString wxStyledTextCtrl::PropertyNames() const {
4080 int msg = 4014;
c4bdd822 4081 int len = SendMsg(msg, 0, (sptr_t)NULL);
9b01abb8
RD
4082 if (!len) return wxEmptyString;
4083
4084 wxMemoryBuffer mbuf(len+1);
4085 char* buf = (char*)mbuf.GetWriteBuf(len+1);
54173563 4086 SendMsg(msg, 0, (sptr_t)buf);
9b01abb8
RD
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;
c4bdd822 4101 int len = SendMsg(msg, (sptr_t)(const char*)wx2stc(name), (sptr_t)NULL);
9b01abb8
RD
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;
c4bdd822 4115 int len = SendMsg(msg, 0, (sptr_t)NULL);
9b01abb8
RD
4116 if (!len) return wxEmptyString;
4117
4118 wxMemoryBuffer mbuf(len+1);
4119 char* buf = (char*)mbuf.GetWriteBuf(len+1);
54173563 4120 SendMsg(msg, 0, (sptr_t)buf);
9b01abb8
RD
4121 mbuf.UngetWriteBuf(len);
4122 mbuf.AppendByte(0);
4123 return stc2wx(buf);
4124}
4125
a5c2ccf2 4126//}}}
f6bcfd97 4127//----------------------------------------------------------------------
f6bcfd97
BP
4128
4129
4370573a
RD
4130// Returns the line number of the line with the caret.
4131int wxStyledTextCtrl::GetCurrentLine() {
4132 int line = LineFromPosition(GetCurrentPos());
4133 return line;
f6bcfd97
BP
4134}
4135
4136
4370573a
RD
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
5ee1d760
RD
4142// fore:[name or #RRGGBB] sets the foreground colour
4143// back:[name or #RRGGBB] sets the background colour
4370573a
RD
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
451c5cc7 4151 wxStringTokenizer tkz(spec, wxT(","));
4370573a
RD
4152 while (tkz.HasMoreTokens()) {
4153 wxString token = tkz.GetNextToken();
f6bcfd97 4154
4370573a
RD
4155 wxString option = token.BeforeFirst(':');
4156 wxString val = token.AfterFirst(':');
f6bcfd97 4157
451c5cc7 4158 if (option == wxT("bold"))
4370573a 4159 StyleSetBold(styleNum, true);
f6bcfd97 4160
451c5cc7 4161 else if (option == wxT("italic"))
4370573a 4162 StyleSetItalic(styleNum, true);
9ce192d4 4163
451c5cc7 4164 else if (option == wxT("underline"))
4370573a 4165 StyleSetUnderline(styleNum, true);
9ce192d4 4166
451c5cc7 4167 else if (option == wxT("eol"))
4370573a 4168 StyleSetEOLFilled(styleNum, true);
9ce192d4 4169
451c5cc7 4170 else if (option == wxT("size")) {
4370573a
RD
4171 long points;
4172 if (val.ToLong(&points))
4173 StyleSetSize(styleNum, points);
4174 }
9ce192d4 4175
451c5cc7 4176 else if (option == wxT("face"))
4370573a 4177 StyleSetFaceName(styleNum, val);
9ce192d4 4178
451c5cc7 4179 else if (option == wxT("fore"))
4370573a 4180 StyleSetForeground(styleNum, wxColourFromSpec(val));
9ce192d4 4181
451c5cc7 4182 else if (option == wxT("back"))
4370573a
RD
4183 StyleSetBackground(styleNum, wxColourFromSpec(val));
4184 }
9ce192d4
RD
4185}
4186
4187
7e0c58e9
RD
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
4370573a
RD
4207// Set style size, face, bold, italic, and underline attributes from
4208// a wxFont's attributes.
4209void wxStyledTextCtrl::StyleSetFont(int styleNum, wxFont& font) {
7475e814
RD
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
af0531a5
RD
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();
c5bd09bf 4220 wxFontEncoding encoding = font.GetEncoding();
7e0c58e9 4221
af0531a5 4222 StyleSetFontAttr(styleNum, size, faceName, bold, italic, under, encoding);
9ce192d4
RD
4223}
4224
4370573a
RD
4225// Set all font style attributes at once.
4226void wxStyledTextCtrl::StyleSetFontAttr(int styleNum, int size,
4227 const wxString& faceName,
4228 bool bold, bool italic,
3727c043
RD
4229 bool underline,
4230 wxFontEncoding encoding) {
4370573a
RD
4231 StyleSetSize(styleNum, size);
4232 StyleSetFaceName(styleNum, faceName);
4233 StyleSetBold(styleNum, bold);
4234 StyleSetItalic(styleNum, italic);
4235 StyleSetUnderline(styleNum, underline);
3727c043
RD
4236 StyleSetFontEncoding(styleNum, encoding);
4237}
9ce192d4 4238
3727c043
RD
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;
1e9bafca
RD
4321
4322 case wxSTC_CHARSET_CYRILLIC:
4323 encoding = wxFONTENCODING_ISO8859_5;
4324 break;
7e0c58e9 4325
1e9bafca
RD
4326 case wxSTC_CHARSET_8859_15:
4327 encoding = wxFONTENCODING_ISO8859_15;;
4328 break;
3727c043
RD
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);
9ce192d4
RD
4344}
4345
4346
4370573a
RD
4347// Perform one of the operations defined by the wxSTC_CMD_* constants.
4348void wxStyledTextCtrl::CmdKeyExecute(int cmd) {
4349 SendMsg(cmd);
9ce192d4
RD
4350}
4351
4352
4370573a
RD
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);
9ce192d4
RD
4357}
4358
4359
4370573a
RD
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);
f6bcfd97
BP
4365}
4366
f97d84a6
RD
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
f6bcfd97 4378
ce364c4e
VZ
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
e6aed765
VZ
4390bool
4391wxStyledTextCtrl::DoSaveFile(const wxString& filename, int WXUNUSED(fileType))
51566b0b 4392{
e6aed765
VZ
4393#if wxUSE_FFILE || wxUSE_FILE
4394
3396739d 4395#if wxUSE_FFILE
e6aed765
VZ
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);
3396739d 4401#endif
e6aed765
VZ
4402
4403 if ( file.IsOpened() && file.Write(GetValue(), *wxConvCurrent) )
3396739d 4404 {
51566b0b 4405 SetSavePoint();
e6aed765
VZ
4406
4407 return true;
3396739d 4408 }
e6aed765
VZ
4409
4410#endif // !wxUSE_FFILE && !wxUSE_FILE
4411
4412 return false;
51566b0b
RD
4413}
4414
e6aed765
VZ
4415bool
4416wxStyledTextCtrl::DoLoadFile(const wxString& filename, int WXUNUSED(fileType))
51566b0b 4417{
e6aed765
VZ
4418#if wxUSE_FFILE || wxUSE_FILE
4419
3396739d 4420#if wxUSE_FFILE
e6aed765
VZ
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() )
51566b0b 4430 {
3396739d 4431 wxString text;
e6aed765 4432 if ( file.ReadAll(&text, *wxConvCurrent) )
041973c5 4433 {
e6aed765
VZ
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
3396739d 4453 SetValue(text);
e6aed765
VZ
4454 EmptyUndoBuffer();
4455 SetSavePoint();
4456
4457 return true;
041973c5 4458 }
51566b0b 4459 }
e6aed765
VZ
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);
51566b0b
RD
4475}
4476
e6aed765
VZ
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
2fcce896 4487#if wxUSE_DRAG_AND_DROP
7e126a07
WS
4488wxDragResult wxStyledTextCtrl::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) {
4489 return m_swx->DoDragOver(x, y, def);
4490}
4a65f2c8
RD
4491
4492
7e126a07 4493bool wxStyledTextCtrl::DoDropText(long x, long y, const wxString& data) {
4a65f2c8
RD
4494 return m_swx->DoDropText(x, y, data);
4495}
2fcce896 4496#endif
4a65f2c8
RD
4497
4498
d1558f3d
RD
4499void wxStyledTextCtrl::SetUseAntiAliasing(bool useAA) {
4500 m_swx->SetUseAntiAliasing(useAA);
4501}
4502
4503bool wxStyledTextCtrl::GetUseAntiAliasing() {
4504 return m_swx->GetUseAntiAliasing();
4505}
4506
95725e35
VZ
4507void wxStyledTextCtrl::AnnotationClearLine(int line) {
4508 SendMsg(SCI_ANNOTATIONSETTEXT, line, NULL);
4509}
41a499cd
RD
4510
4511
4512
4513
6f67e6d2 4514void wxStyledTextCtrl::AddTextRaw(const char* text, int length)
41a499cd 4515{
6f67e6d2
RD
4516 if (length == -1)
4517 length = strlen(text);
4518 SendMsg(SCI_ADDTEXT, length, (sptr_t)text);
41a499cd
RD
4519}
4520
4521void wxStyledTextCtrl::InsertTextRaw(int pos, const char* text)
4522{
b796ba39 4523 SendMsg(SCI_INSERTTEXT, pos, (sptr_t)text);
41a499cd
RD
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);
b796ba39 4536 int pos = SendMsg(SCI_GETCURLINE, len, (sptr_t)buf.data());
41a499cd
RD
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);
b796ba39 4550 SendMsg(SCI_GETLINE, line, (sptr_t)buf.data());
41a499cd
RD
4551 return buf;
4552}
4553
4554wxCharBuffer wxStyledTextCtrl::GetSelectedTextRaw()
4555{
1a692f0f
VZ
4556 // Calculate the length needed first.
4557 const int len = SendMsg(SCI_GETSELTEXT, 0, (sptr_t)0);
41a499cd 4558
1a692f0f 4559 // And then really get the data.
41a499cd 4560 wxCharBuffer buf(len);
b796ba39 4561 SendMsg(SCI_GETSELTEXT, 0, (sptr_t)buf.data());
41a499cd
RD
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;
7e0c58e9 4576 }
41a499cd
RD
4577
4578 wxCharBuffer buf(len);
4579 TextRange tr;
4580 tr.lpstrText = buf.data();
4581 tr.chrg.cpMin = startPos;
4582 tr.chrg.cpMax = endPos;
b796ba39 4583 SendMsg(SCI_GETTEXTRANGE, 0, (sptr_t)&tr);
41a499cd
RD
4584 return buf;
4585}
4586
4587void wxStyledTextCtrl::SetTextRaw(const char* text)
4588{
b796ba39 4589 SendMsg(SCI_SETTEXT, 0, (sptr_t)text);
41a499cd
RD
4590}
4591
4592wxCharBuffer wxStyledTextCtrl::GetTextRaw()
4593{
949750de
VZ
4594 int len = GetTextLength();
4595 wxCharBuffer buf(len); // adds 1 for NUL automatically
b796ba39 4596 SendMsg(SCI_GETTEXT, len + 1, (sptr_t)buf.data());
41a499cd
RD
4597 return buf;
4598}
4599
6f67e6d2 4600void wxStyledTextCtrl::AppendTextRaw(const char* text, int length)
41a499cd 4601{
6f67e6d2
RD
4602 if (length == -1)
4603 length = strlen(text);
4604 SendMsg(SCI_APPENDTEXT, length, (sptr_t)text);
41a499cd
RD
4605}
4606
4607
4608
4609
4610
9ce192d4
RD
4611//----------------------------------------------------------------------
4612// Event handlers
4613
88a8b04e 4614void wxStyledTextCtrl::OnPaint(wxPaintEvent& WXUNUSED(evt)) {
9ce192d4 4615 wxPaintDC dc(this);
9e730a78 4616 m_swx->DoPaint(&dc, GetUpdateRegion().GetBox());
9ce192d4
RD
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
5fa4613c
RD
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
88a8b04e 4636void wxStyledTextCtrl::OnSize(wxSizeEvent& WXUNUSED(evt)) {
39c0acb6
RD
4637 if (m_swx) {
4638 wxSize sz = GetClientSize();
4639 m_swx->DoSize(sz.x, sz.y);
4640 }
9ce192d4
RD
4641}
4642
4643void wxStyledTextCtrl::OnMouseLeftDown(wxMouseEvent& evt) {
cb1871ca 4644 SetFocus();
9ce192d4 4645 wxPoint pt = evt.GetPosition();
2b5f62a0 4646 m_swx->DoLeftButtonDown(Point(pt.x, pt.y), m_stopWatch.Time(),
9ce192d4
RD
4647 evt.ShiftDown(), evt.ControlDown(), evt.AltDown());
4648}
4649
4650void wxStyledTextCtrl::OnMouseMove(wxMouseEvent& evt) {
4651 wxPoint pt = evt.GetPosition();
2b5f62a0 4652 m_swx->DoLeftButtonMove(Point(pt.x, pt.y));
9ce192d4
RD
4653}
4654
4655void wxStyledTextCtrl::OnMouseLeftUp(wxMouseEvent& evt) {
4656 wxPoint pt = evt.GetPosition();
2b5f62a0 4657 m_swx->DoLeftButtonUp(Point(pt.x, pt.y), m_stopWatch.Time(),
9ce192d4
RD
4658 evt.ControlDown());
4659}
4660
4661
ddf2da08
RD
4662void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent& evt) {
4663 wxPoint pt = evt.GetPosition();
4664 m_swx->DoContextMenu(Point(pt.x, pt.y));
4665}
4666
4667
2b5f62a0
VZ
4668void wxStyledTextCtrl::OnMouseMiddleUp(wxMouseEvent& evt) {
4669 wxPoint pt = evt.GetPosition();
4670 m_swx->DoMiddleButtonUp(Point(pt.x, pt.y));
4671}
4672
65ec6247 4673void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent& evt) {
9ce192d4 4674 wxPoint pt = evt.GetPosition();
65ec6247 4675 ScreenToClient(&pt.x, &pt.y);
25484746
RD
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 }
9ce192d4
RD
4684 m_swx->DoContextMenu(Point(pt.x, pt.y));
4685}
4686
37d62433 4687
60957703
VZ
4688void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt)
4689{
42a4299b
VZ
4690 m_swx->DoMouseWheel(evt.GetWheelRotation(),
4691 evt.GetWheelDelta(),
4692 evt.GetLinesPerAction(),
4693 evt.ControlDown(),
4694 evt.IsPageScroll());
37d62433
RD
4695}
4696
4697
9ce192d4 4698void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) {
5fd656d5 4699 // On (some?) non-US PC keyboards the AltGr key is required to enter some
f3c2c221
RD
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();
28e0c28e
RD
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
f3c2c221 4710 bool alt = evt.AltDown();
28e0c28e 4711#endif
00c64037 4712 bool skip = ((ctrl || alt) && ! (ctrl && alt));
f3c2c221 4713
a0421c77
RD
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
5fd656d5
RD
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.
1b14227e 4730 if (key <= 127) {
5fd656d5 4731 key = evt.GetKeyCode();
1b14227e 4732 keyOk = (key <= 127);
5fd656d5
RD
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
d25f5fbb 4745 }
7e0c58e9 4746
f3c2c221 4747 evt.Skip();
f6bcfd97
BP
4748}
4749
d6582821 4750
f6bcfd97 4751void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) {
5fd656d5 4752 int processed = m_swx->DoKeyDown(evt, &m_lastKeyDownConsumed);
d6582821 4753 if (!processed && !m_lastKeyDownConsumed)
9ce192d4
RD
4754 evt.Skip();
4755}
4756
d6582821 4757
b6bfd8e8 4758void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& evt) {
ec830416 4759 m_swx->DoLoseFocus();
b6bfd8e8 4760 evt.Skip();
9ce192d4
RD
4761}
4762
d6582821 4763
b6bfd8e8 4764void wxStyledTextCtrl::OnGainFocus(wxFocusEvent& evt) {
9ce192d4 4765 m_swx->DoGainFocus();
b6bfd8e8 4766 evt.Skip();
9ce192d4
RD
4767}
4768
d6582821 4769
88a8b04e 4770void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(evt)) {
9ce192d4
RD
4771 m_swx->DoSysColourChange();
4772}
4773
d6582821 4774
88a8b04e 4775void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent& WXUNUSED(evt)) {
9ce192d4
RD
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
88a8b04e 4786void wxStyledTextCtrl::OnListBox(wxCommandEvent& WXUNUSED(evt)) {
f6bcfd97
BP
4787 m_swx->DoOnListBox();
4788}
4789
4790
8e54aaed
RD
4791void wxStyledTextCtrl::OnIdle(wxIdleEvent& evt) {
4792 m_swx->DoOnIdle(evt);
4793}
4794
4795
8ae4f086
RD
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
9ce192d4
RD
4804//----------------------------------------------------------------------
4805// Turn notifications from Scintilla into events
4806
f6bcfd97 4807
9ce192d4
RD
4808void wxStyledTextCtrl::NotifyChange() {
4809 wxStyledTextEvent evt(wxEVT_STC_CHANGE, GetId());
a29a241f 4810 evt.SetEventObject(this);
9ce192d4
RD
4811 GetEventHandler()->ProcessEvent(evt);
4812}
4813
2b5f62a0
VZ
4814
4815static void SetEventText(wxStyledTextEvent& evt, const char* text,
4816 size_t length) {
4817 if(!text) return;
4818
1c930beb 4819 evt.SetText(stc2wx(text, length));
2b5f62a0
VZ
4820}
4821
4822
9ce192d4
RD
4823void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
4824 SCNotification& scn = *_scn;
65ec6247
RD
4825 wxStyledTextEvent evt(0, GetId());
4826
a29a241f 4827 evt.SetEventObject(this);
65ec6247
RD
4828 evt.SetPosition(scn.position);
4829 evt.SetKey(scn.ch);
4830 evt.SetModifiers(scn.modifiers);
4831
9ce192d4
RD
4832 switch (scn.nmhdr.code) {
4833 case SCN_STYLENEEDED:
65ec6247 4834 evt.SetEventType(wxEVT_STC_STYLENEEDED);
9ce192d4 4835 break;
65ec6247 4836
9ce192d4 4837 case SCN_CHARADDED:
65ec6247 4838 evt.SetEventType(wxEVT_STC_CHARADDED);
9ce192d4 4839 break;
65ec6247 4840
9ce192d4 4841 case SCN_SAVEPOINTREACHED:
65ec6247 4842 evt.SetEventType(wxEVT_STC_SAVEPOINTREACHED);
9ce192d4 4843 break;
65ec6247 4844
9ce192d4 4845 case SCN_SAVEPOINTLEFT:
65ec6247 4846 evt.SetEventType(wxEVT_STC_SAVEPOINTLEFT);
9ce192d4 4847 break;
65ec6247 4848
9ce192d4 4849 case SCN_MODIFYATTEMPTRO:
65ec6247 4850 evt.SetEventType(wxEVT_STC_ROMODIFYATTEMPT);
9ce192d4 4851 break;
65ec6247
RD
4852
4853 case SCN_KEY:
4854 evt.SetEventType(wxEVT_STC_KEY);
4855 break;
4856
9ce192d4 4857 case SCN_DOUBLECLICK:
65ec6247 4858 evt.SetEventType(wxEVT_STC_DOUBLECLICK);
54173563 4859 evt.SetLine(scn.line);
9ce192d4 4860 break;
65ec6247
RD
4861
4862 case SCN_UPDATEUI:
4863 evt.SetEventType(wxEVT_STC_UPDATEUI);
54173563 4864 evt.SetUpdated(scn.updated);
9ce192d4 4865 break;
65ec6247
RD
4866
4867 case SCN_MODIFIED:
4868 evt.SetEventType(wxEVT_STC_MODIFIED);
4869 evt.SetModificationType(scn.modificationType);
2b5f62a0 4870 SetEventText(evt, scn.text, scn.length);
65ec6247
RD
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);
54173563
RD
4876 evt.SetToken(scn.token);
4877 evt.SetAnnotationLinesAdded(scn.annotationLinesAdded);
9ce192d4 4878 break;
65ec6247 4879
9ce192d4 4880 case SCN_MACRORECORD:
65ec6247
RD
4881 evt.SetEventType(wxEVT_STC_MACRORECORD);
4882 evt.SetMessage(scn.message);
4883 evt.SetWParam(scn.wParam);
4884 evt.SetLParam(scn.lParam);
9ce192d4 4885 break;
65ec6247 4886
9ce192d4 4887 case SCN_MARGINCLICK:
65ec6247
RD
4888 evt.SetEventType(wxEVT_STC_MARGINCLICK);
4889 evt.SetMargin(scn.margin);
9ce192d4 4890 break;
65ec6247 4891
9ce192d4 4892 case SCN_NEEDSHOWN:
65ec6247
RD
4893 evt.SetEventType(wxEVT_STC_NEEDSHOWN);
4894 evt.SetLength(scn.length);
9ce192d4 4895 break;
65ec6247 4896
65ec6247
RD
4897 case SCN_PAINTED:
4898 evt.SetEventType(wxEVT_STC_PAINTED);
4899 break;
4900
0daf5e6b
RD
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;
7e0c58e9 4907
65ec6247
RD
4908 case SCN_USERLISTSELECTION:
4909 evt.SetEventType(wxEVT_STC_USERLISTSELECTION);
4910 evt.SetListType(scn.listType);
2b5f62a0 4911 SetEventText(evt, scn.text, strlen(scn.text));
0daf5e6b 4912 evt.SetPosition(scn.lParam);
65ec6247
RD
4913 break;
4914
4915 case SCN_URIDROPPED:
4916 evt.SetEventType(wxEVT_STC_URIDROPPED);
2b5f62a0 4917 SetEventText(evt, scn.text, strlen(scn.text));
65ec6247
RD
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
a834585d
RD
4932 case SCN_ZOOM:
4933 evt.SetEventType(wxEVT_STC_ZOOM);
4934 break;
4935
9e730a78
RD
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;
7e0c58e9
RD
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
9e96e16f
RD
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
54173563
RD
4964 case SCN_HOTSPOTRELEASECLICK:
4965 evt.SetEventType(wxEVT_STC_HOTSPOT_RELEASE_CLICK);
4966 break;
4967
65ec6247
RD
4968 default:
4969 return;
9ce192d4 4970 }
65ec6247
RD
4971
4972 GetEventHandler()->ProcessEvent(evt);
9ce192d4
RD
4973}
4974
4975
9ce192d4
RD
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;
65ec6247
RD
4996 m_listType = 0;
4997 m_x = 0;
4998 m_y = 0;
d01ca1e4
RD
4999 m_token = 0;
5000 m_annotationLinesAdded = 0;
5001 m_updated = 0;
5002
92bbd64f 5003#if wxUSE_DRAG_AND_DROP
35f8d83d 5004 m_dragFlags = wxDrag_CopyOnly;
a29a241f 5005 m_dragResult = wxDragNone;
92bbd64f 5006#endif
9ce192d4
RD
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
5fa4613c 5013
41286fd1
JS
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;
9ce192d4 5037
d01ca1e4
RD
5038 m_token = event.m_token;
5039 m_annotationLinesAdded = event.m_annotationLinesAdded;
5040 m_updated = event.m_updated;
5041
92bbd64f 5042#if wxUSE_DRAG_AND_DROP
35f8d83d
VZ
5043 m_dragText = event.m_dragText;
5044 m_dragFlags = event.m_dragFlags;
41286fd1 5045 m_dragResult = event.m_dragResult;
92bbd64f 5046#endif
9ce192d4
RD
5047}
5048
5049//----------------------------------------------------------------------
5050//----------------------------------------------------------------------
5051
ccec9093
VZ
5052/*static*/ wxVersionInfo wxStyledTextCtrl::GetLibraryVersionInfo()
5053{
d01ca1e4 5054 return wxVersionInfo("Scintilla", 3, 21, 0, "Scintilla 3.21");
ccec9093
VZ
5055}
5056
29825f5f 5057#endif // wxUSE_STC