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