]> git.saurik.com Git - wxWidgets.git/blame - src/stc/stc.cpp
No real changes, just backwards propagate the changes to stc.cpp.
[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() {
fa70ec2b
RD
1507 long start;
1508 long end;
9ce192d4 1509
9e730a78
RD
1510 GetSelection(&start, &end);
1511 int len = end - start;
1512 if (!len) return wxEmptyString;
9ce192d4 1513
3d7a4fe8 1514 wxMemoryBuffer mbuf(len+2);
9e730a78 1515 char* buf = (char*)mbuf.GetWriteBuf(len+1);
b796ba39 1516 SendMsg(2161, 0, (sptr_t)buf);
9e730a78
RD
1517 mbuf.UngetWriteBuf(len);
1518 mbuf.AppendByte(0);
1519 return stc2wx(buf);
4370573a 1520}
9ce192d4 1521
4370573a
RD
1522// Retrieve a range of text.
1523wxString wxStyledTextCtrl::GetTextRange(int startPos, int endPos) {
9e730a78
RD
1524 if (endPos < startPos) {
1525 int temp = startPos;
1526 startPos = endPos;
1527 endPos = temp;
1528 }
1529 int len = endPos - startPos;
1530 if (!len) return wxEmptyString;
1531 wxMemoryBuffer mbuf(len+1);
1532 char* buf = (char*)mbuf.GetWriteBuf(len);
1533 TextRange tr;
1534 tr.lpstrText = buf;
1535 tr.chrg.cpMin = startPos;
1536 tr.chrg.cpMax = endPos;
b796ba39 1537 SendMsg(2162, 0, (sptr_t)&tr);
9e730a78
RD
1538 mbuf.UngetWriteBuf(len);
1539 mbuf.AppendByte(0);
1540 return stc2wx(buf);
9ce192d4
RD
1541}
1542
4370573a 1543// Draw the selection in normal style or with selection highlighted.
8e0945da
VZ
1544void wxStyledTextCtrl::HideSelection(bool normal)
1545{
4370573a
RD
1546 SendMsg(2163, normal, 0);
1547}
9ce192d4 1548
4370573a 1549// Retrieve the line containing a position.
2bfca191 1550int wxStyledTextCtrl::LineFromPosition(int pos) const
8e0945da 1551{
4370573a 1552 return SendMsg(2166, pos, 0);
9ce192d4
RD
1553}
1554
4370573a 1555// Retrieve the position at the start of a line.
2bfca191 1556int wxStyledTextCtrl::PositionFromLine(int line) const
8e0945da 1557{
4370573a
RD
1558 return SendMsg(2167, line, 0);
1559}
9ce192d4 1560
4370573a 1561// Scroll horizontally and vertically.
8e0945da
VZ
1562void wxStyledTextCtrl::LineScroll(int columns, int lines)
1563{
4370573a 1564 SendMsg(2168, columns, lines);
9ce192d4
RD
1565}
1566
4370573a 1567// Ensure the caret is visible.
8e0945da
VZ
1568void wxStyledTextCtrl::EnsureCaretVisible()
1569{
4370573a
RD
1570 SendMsg(2169, 0, 0);
1571}
9ce192d4 1572
4370573a 1573// Replace the selected text with the argument text.
8e0945da
VZ
1574void wxStyledTextCtrl::ReplaceSelection(const wxString& text)
1575{
b796ba39 1576 SendMsg(2170, 0, (sptr_t)(const char*)wx2stc(text));
9ce192d4
RD
1577}
1578
4370573a 1579// Set to read only or read write.
8e0945da
VZ
1580void wxStyledTextCtrl::SetReadOnly(bool readOnly)
1581{
4370573a
RD
1582 SendMsg(2171, readOnly, 0);
1583}
9ce192d4 1584
4370573a 1585// Will a paste succeed?
7d6d76d0 1586bool wxStyledTextCtrl::CanPaste() const
8e0945da 1587{
4370573a 1588 return SendMsg(2173, 0, 0) != 0;
9ce192d4
RD
1589}
1590
a834585d 1591// Are there any undoable actions in the undo history?
93578927 1592bool wxStyledTextCtrl::CanUndo() const
8e0945da 1593{
4370573a
RD
1594 return SendMsg(2174, 0, 0) != 0;
1595}
9ce192d4 1596
4370573a 1597// Delete the undo history.
8e0945da
VZ
1598void wxStyledTextCtrl::EmptyUndoBuffer()
1599{
4370573a 1600 SendMsg(2175, 0, 0);
9ce192d4
RD
1601}
1602
4370573a 1603// Undo one action in the undo history.
8e0945da
VZ
1604void wxStyledTextCtrl::Undo()
1605{
4370573a
RD
1606 SendMsg(2176, 0, 0);
1607}
9ce192d4 1608
4370573a 1609// Cut the selection to the clipboard.
8e0945da
VZ
1610void wxStyledTextCtrl::Cut()
1611{
4370573a 1612 SendMsg(2177, 0, 0);
f6bcfd97
BP
1613}
1614
4370573a 1615// Copy the selection to the clipboard.
8e0945da
VZ
1616void wxStyledTextCtrl::Copy()
1617{
4370573a
RD
1618 SendMsg(2178, 0, 0);
1619}
f6bcfd97 1620
4370573a 1621// Paste the contents of the clipboard into the document replacing the selection.
8e0945da
VZ
1622void wxStyledTextCtrl::Paste()
1623{
4370573a 1624 SendMsg(2179, 0, 0);
f6bcfd97
BP
1625}
1626
4370573a 1627// Clear the selection.
8e0945da
VZ
1628void wxStyledTextCtrl::Clear()
1629{
4370573a
RD
1630 SendMsg(2180, 0, 0);
1631}
f6bcfd97 1632
4370573a 1633// Replace the contents of the document with the argument text.
8e0945da
VZ
1634void wxStyledTextCtrl::SetText(const wxString& text)
1635{
b796ba39 1636 SendMsg(2181, 0, (sptr_t)(const char*)wx2stc(text));
f6bcfd97
BP
1637}
1638
4370573a 1639// Retrieve all the text in the document.
93578927 1640wxString wxStyledTextCtrl::GetText() const {
9e730a78
RD
1641 int len = GetTextLength();
1642 wxMemoryBuffer mbuf(len+1); // leave room for the null...
1643 char* buf = (char*)mbuf.GetWriteBuf(len+1);
b796ba39 1644 SendMsg(2182, len+1, (sptr_t)buf);
9e730a78
RD
1645 mbuf.UngetWriteBuf(len);
1646 mbuf.AppendByte(0);
1647 return stc2wx(buf);
4370573a 1648}
9ce192d4 1649
4370573a 1650// Retrieve the number of characters in the document.
8e0945da
VZ
1651int wxStyledTextCtrl::GetTextLength() const
1652{
4370573a 1653 return SendMsg(2183, 0, 0);
9ce192d4
RD
1654}
1655
a834585d 1656// Set to overtype (true) or insert mode.
8e0945da
VZ
1657void wxStyledTextCtrl::SetOvertype(bool overtype)
1658{
4370573a
RD
1659 SendMsg(2186, overtype, 0);
1660}
9ce192d4 1661
4370573a 1662// Returns true if overtype mode is active otherwise false is returned.
8e0945da
VZ
1663bool wxStyledTextCtrl::GetOvertype() const
1664{
4370573a 1665 return SendMsg(2187, 0, 0) != 0;
9ce192d4
RD
1666}
1667
a834585d 1668// Set the width of the insert mode caret.
8e0945da
VZ
1669void wxStyledTextCtrl::SetCaretWidth(int pixelWidth)
1670{
65ec6247
RD
1671 SendMsg(2188, pixelWidth, 0);
1672}
1673
a834585d 1674// Returns the width of the insert mode caret.
8e0945da
VZ
1675int wxStyledTextCtrl::GetCaretWidth() const
1676{
65ec6247
RD
1677 return SendMsg(2189, 0, 0);
1678}
1679
1680// Sets the position that starts the target which is used for updating the
1681// document without affecting the scroll position.
8e0945da
VZ
1682void wxStyledTextCtrl::SetTargetStart(int pos)
1683{
65ec6247
RD
1684 SendMsg(2190, pos, 0);
1685}
1686
1687// Get the position that starts the target.
8e0945da
VZ
1688int wxStyledTextCtrl::GetTargetStart() const
1689{
65ec6247
RD
1690 return SendMsg(2191, 0, 0);
1691}
1692
1693// Sets the position that ends the target which is used for updating the
1694// document without affecting the scroll position.
8e0945da
VZ
1695void wxStyledTextCtrl::SetTargetEnd(int pos)
1696{
65ec6247
RD
1697 SendMsg(2192, pos, 0);
1698}
1699
1700// Get the position that ends the target.
8e0945da
VZ
1701int wxStyledTextCtrl::GetTargetEnd() const
1702{
65ec6247
RD
1703 return SendMsg(2193, 0, 0);
1704}
1705
1706// Replace the target text with the argument text.
8e54aaed 1707// Text is counted so it can contain NULs.
65ec6247
RD
1708// Returns the length of the replacement text.
1709
9e730a78 1710 int wxStyledTextCtrl::ReplaceTarget(const wxString& text) {
2ed48ef8 1711 const wxWX2MBbuf buf = wx2stc(text);
d7b46878 1712 return SendMsg(2194, wx2stclen(text, buf), (sptr_t)(const char*)buf);
65ec6247
RD
1713}
1714
1715// Replace the target text with the argument text after \d processing.
8e54aaed 1716// Text is counted so it can contain NULs.
65ec6247
RD
1717// Looks for \d where d is between 1 and 9 and replaces these with the strings
1718// matched in the last search operation which were surrounded by \( and \).
1719// Returns the length of the replacement text including any change
1720// caused by processing the \d patterns.
1721
9e730a78 1722 int wxStyledTextCtrl::ReplaceTargetRE(const wxString& text) {
2ed48ef8 1723 const wxWX2MBbuf buf = wx2stc(text);
d7b46878 1724 return SendMsg(2195, wx2stclen(text, buf), (sptr_t)(const char*)buf);
65ec6247
RD
1725}
1726
1727// Search for a counted string in the target and set the target to the found
8e54aaed 1728// range. Text is counted so it can contain NULs.
65ec6247
RD
1729// Returns length of range or -1 for failure in which case target is not moved.
1730
9e730a78 1731 int wxStyledTextCtrl::SearchInTarget(const wxString& text) {
2ed48ef8 1732 const wxWX2MBbuf buf = wx2stc(text);
d7b46878 1733 return SendMsg(2197, wx2stclen(text, buf), (sptr_t)(const char*)buf);
65ec6247
RD
1734}
1735
a834585d 1736// Set the search flags used by SearchInTarget.
8e0945da
VZ
1737void wxStyledTextCtrl::SetSearchFlags(int flags)
1738{
65ec6247
RD
1739 SendMsg(2198, flags, 0);
1740}
1741
a834585d 1742// Get the search flags used by SearchInTarget.
8e0945da
VZ
1743int wxStyledTextCtrl::GetSearchFlags() const
1744{
65ec6247
RD
1745 return SendMsg(2199, 0, 0);
1746}
1747
4370573a 1748// Show a call tip containing a definition near position pos.
8e0945da
VZ
1749void wxStyledTextCtrl::CallTipShow(int pos, const wxString& definition)
1750{
b796ba39 1751 SendMsg(2200, pos, (sptr_t)(const char*)wx2stc(definition));
4370573a 1752}
9ce192d4 1753
4370573a 1754// Remove the call tip from the screen.
8e0945da
VZ
1755void wxStyledTextCtrl::CallTipCancel()
1756{
4370573a 1757 SendMsg(2201, 0, 0);
9ce192d4
RD
1758}
1759
4370573a 1760// Is there an active call tip?
8e0945da
VZ
1761bool wxStyledTextCtrl::CallTipActive()
1762{
4370573a
RD
1763 return SendMsg(2202, 0, 0) != 0;
1764}
9ce192d4 1765
4370573a 1766// Retrieve the position where the caret was before displaying the call tip.
8e0945da
VZ
1767int wxStyledTextCtrl::CallTipPosAtStart()
1768{
4370573a 1769 return SendMsg(2203, 0, 0);
9ce192d4
RD
1770}
1771
4370573a 1772// Highlight a segment of the definition.
8e0945da
VZ
1773void wxStyledTextCtrl::CallTipSetHighlight(int start, int end)
1774{
4370573a 1775 SendMsg(2204, start, end);
9ce192d4
RD
1776}
1777
4370573a 1778// Set the background colour for the call tip.
8e0945da
VZ
1779void wxStyledTextCtrl::CallTipSetBackground(const wxColour& back)
1780{
4370573a
RD
1781 SendMsg(2205, wxColourAsLong(back), 0);
1782}
9ce192d4 1783
9e730a78 1784// Set the foreground colour for the call tip.
8e0945da
VZ
1785void wxStyledTextCtrl::CallTipSetForeground(const wxColour& fore)
1786{
9e730a78
RD
1787 SendMsg(2206, wxColourAsLong(fore), 0);
1788}
1789
1790// Set the foreground colour for the highlighted part of the call tip.
8e0945da
VZ
1791void wxStyledTextCtrl::CallTipSetForegroundHighlight(const wxColour& fore)
1792{
9e730a78
RD
1793 SendMsg(2207, wxColourAsLong(fore), 0);
1794}
1795
b8193d80 1796// Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
8e0945da
VZ
1797void wxStyledTextCtrl::CallTipUseStyle(int tabSize)
1798{
b8193d80
RD
1799 SendMsg(2212, tabSize, 0);
1800}
1801
4370573a 1802// Find the display line of a document line taking hidden lines into account.
8e0945da
VZ
1803int wxStyledTextCtrl::VisibleFromDocLine(int line)
1804{
4370573a 1805 return SendMsg(2220, line, 0);
9ce192d4
RD
1806}
1807
4370573a 1808// Find the document line of a display line taking hidden lines into account.
8e0945da
VZ
1809int wxStyledTextCtrl::DocLineFromVisible(int lineDisplay)
1810{
4370573a
RD
1811 return SendMsg(2221, lineDisplay, 0);
1812}
9ce192d4 1813
1e9bafca 1814// The number of display lines needed to wrap a document line
8e0945da
VZ
1815int wxStyledTextCtrl::WrapCount(int line)
1816{
1e9bafca
RD
1817 return SendMsg(2235, line, 0);
1818}
1819
4370573a
RD
1820// Set the fold level of a line.
1821// This encodes an integer level along with flags indicating whether the
1822// line is a header and whether it is effectively white space.
8e0945da
VZ
1823void wxStyledTextCtrl::SetFoldLevel(int line, int level)
1824{
4370573a
RD
1825 SendMsg(2222, line, level);
1826}
9ce192d4 1827
4370573a 1828// Retrieve the fold level of a line.
8e0945da
VZ
1829int wxStyledTextCtrl::GetFoldLevel(int line) const
1830{
4370573a
RD
1831 return SendMsg(2223, line, 0);
1832}
d134f170 1833
4370573a 1834// Find the last child line of a header line.
8e0945da
VZ
1835int wxStyledTextCtrl::GetLastChild(int line, int level) const
1836{
4370573a 1837 return SendMsg(2224, line, level);
9ce192d4
RD
1838}
1839
4370573a 1840// Find the parent line of a child line.
8e0945da
VZ
1841int wxStyledTextCtrl::GetFoldParent(int line) const
1842{
4370573a
RD
1843 return SendMsg(2225, line, 0);
1844}
9ce192d4 1845
4370573a 1846// Make a range of lines visible.
8e0945da
VZ
1847void wxStyledTextCtrl::ShowLines(int lineStart, int lineEnd)
1848{
4370573a 1849 SendMsg(2226, lineStart, lineEnd);
9ce192d4
RD
1850}
1851
4370573a 1852// Make a range of lines invisible.
8e0945da
VZ
1853void wxStyledTextCtrl::HideLines(int lineStart, int lineEnd)
1854{
4370573a
RD
1855 SendMsg(2227, lineStart, lineEnd);
1856}
9ce192d4 1857
4370573a 1858// Is a line visible?
8e0945da
VZ
1859bool wxStyledTextCtrl::GetLineVisible(int line) const
1860{
4370573a 1861 return SendMsg(2228, line, 0) != 0;
9ce192d4
RD
1862}
1863
4370573a 1864// Show the children of a header line.
8e0945da
VZ
1865void wxStyledTextCtrl::SetFoldExpanded(int line, bool expanded)
1866{
4370573a
RD
1867 SendMsg(2229, line, expanded);
1868}
9ce192d4 1869
4370573a 1870// Is a header line expanded?
8e0945da
VZ
1871bool wxStyledTextCtrl::GetFoldExpanded(int line) const
1872{
4370573a 1873 return SendMsg(2230, line, 0) != 0;
9ce192d4
RD
1874}
1875
4370573a 1876// Switch a header line between expanded and contracted.
8e0945da
VZ
1877void wxStyledTextCtrl::ToggleFold(int line)
1878{
4370573a
RD
1879 SendMsg(2231, line, 0);
1880}
9ce192d4 1881
4370573a 1882// Ensure a particular line is visible by expanding any header line hiding it.
8e0945da
VZ
1883void wxStyledTextCtrl::EnsureVisible(int line)
1884{
4370573a
RD
1885 SendMsg(2232, line, 0);
1886}
9ce192d4 1887
9e730a78 1888// Set some style options for folding.
8e0945da
VZ
1889void wxStyledTextCtrl::SetFoldFlags(int flags)
1890{
4370573a 1891 SendMsg(2233, flags, 0);
9ce192d4
RD
1892}
1893
65ec6247
RD
1894// Ensure a particular line is visible by expanding any header line hiding it.
1895// Use the currently set visibility policy to determine which range to display.
8e0945da
VZ
1896void wxStyledTextCtrl::EnsureVisibleEnforcePolicy(int line)
1897{
65ec6247
RD
1898 SendMsg(2234, line, 0);
1899}
1900
a834585d 1901// Sets whether a tab pressed when caret is within indentation indents.
8e0945da
VZ
1902void wxStyledTextCtrl::SetTabIndents(bool tabIndents)
1903{
65ec6247
RD
1904 SendMsg(2260, tabIndents, 0);
1905}
1906
1907// Does a tab pressed when caret is within indentation indent?
8e0945da
VZ
1908bool wxStyledTextCtrl::GetTabIndents() const
1909{
65ec6247
RD
1910 return SendMsg(2261, 0, 0) != 0;
1911}
1912
a834585d 1913// Sets whether a backspace pressed when caret is within indentation unindents.
8e0945da
VZ
1914void wxStyledTextCtrl::SetBackSpaceUnIndents(bool bsUnIndents)
1915{
65ec6247
RD
1916 SendMsg(2262, bsUnIndents, 0);
1917}
1918
1919// Does a backspace pressed when caret is within indentation unindent?
8e0945da
VZ
1920bool wxStyledTextCtrl::GetBackSpaceUnIndents() const
1921{
65ec6247
RD
1922 return SendMsg(2263, 0, 0) != 0;
1923}
1924
a834585d 1925// Sets the time the mouse must sit still to generate a mouse dwell event.
8e0945da
VZ
1926void wxStyledTextCtrl::SetMouseDwellTime(int periodMilliseconds)
1927{
65ec6247
RD
1928 SendMsg(2264, periodMilliseconds, 0);
1929}
1930
a834585d 1931// Retrieve the time the mouse must sit still to generate a mouse dwell event.
8e0945da
VZ
1932int wxStyledTextCtrl::GetMouseDwellTime() const
1933{
65ec6247
RD
1934 return SendMsg(2265, 0, 0);
1935}
1936
a834585d 1937// Get position of start of word.
8e0945da
VZ
1938int wxStyledTextCtrl::WordStartPosition(int pos, bool onlyWordCharacters)
1939{
1a2fb4cd
RD
1940 return SendMsg(2266, pos, onlyWordCharacters);
1941}
1942
a834585d 1943// Get position of end of word.
8e0945da
VZ
1944int wxStyledTextCtrl::WordEndPosition(int pos, bool onlyWordCharacters)
1945{
1a2fb4cd
RD
1946 return SendMsg(2267, pos, onlyWordCharacters);
1947}
1948
a834585d 1949// Sets whether text is word wrapped.
8e0945da
VZ
1950void wxStyledTextCtrl::SetWrapMode(int mode)
1951{
1a2fb4cd
RD
1952 SendMsg(2268, mode, 0);
1953}
1954
a834585d 1955// Retrieve whether text is word wrapped.
8e0945da
VZ
1956int wxStyledTextCtrl::GetWrapMode() const
1957{
1a2fb4cd
RD
1958 return SendMsg(2269, 0, 0);
1959}
1960
591d01be 1961// Set the display mode of visual flags for wrapped lines.
8e0945da
VZ
1962void wxStyledTextCtrl::SetWrapVisualFlags(int wrapVisualFlags)
1963{
591d01be
RD
1964 SendMsg(2460, wrapVisualFlags, 0);
1965}
1966
4ce59b1f 1967// Retrive the display mode of visual flags for wrapped lines.
8e0945da
VZ
1968int wxStyledTextCtrl::GetWrapVisualFlags() const
1969{
591d01be
RD
1970 return SendMsg(2461, 0, 0);
1971}
1972
1973// Set the location of visual flags for wrapped lines.
8e0945da
VZ
1974void wxStyledTextCtrl::SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation)
1975{
591d01be
RD
1976 SendMsg(2462, wrapVisualFlagsLocation, 0);
1977}
1978
4ce59b1f 1979// Retrive the location of visual flags for wrapped lines.
8e0945da
VZ
1980int wxStyledTextCtrl::GetWrapVisualFlagsLocation() const
1981{
591d01be
RD
1982 return SendMsg(2463, 0, 0);
1983}
1984
1985// Set the start indent for wrapped lines.
8e0945da
VZ
1986void wxStyledTextCtrl::SetWrapStartIndent(int indent)
1987{
591d01be
RD
1988 SendMsg(2464, indent, 0);
1989}
1990
4ce59b1f 1991// Retrive the start indent for wrapped lines.
8e0945da
VZ
1992int wxStyledTextCtrl::GetWrapStartIndent() const
1993{
591d01be
RD
1994 return SendMsg(2465, 0, 0);
1995}
1996
9e96e16f
RD
1997// Sets how wrapped sublines are placed. Default is fixed.
1998void wxStyledTextCtrl::SetWrapIndentMode(int mode)
1999{
2000 SendMsg(2472, mode, 0);
2001}
2002
2003// Retrieve how wrapped sublines are placed. Default is fixed.
2004int wxStyledTextCtrl::GetWrapIndentMode() const
2005{
2006 return SendMsg(2473, 0, 0);
2007}
2008
a834585d 2009// Sets the degree of caching of layout information.
8e0945da
VZ
2010void wxStyledTextCtrl::SetLayoutCache(int mode)
2011{
1a2fb4cd
RD
2012 SendMsg(2272, mode, 0);
2013}
2014
a834585d 2015// Retrieve the degree of caching of layout information.
8e0945da
VZ
2016int wxStyledTextCtrl::GetLayoutCache() const
2017{
1a2fb4cd
RD
2018 return SendMsg(2273, 0, 0);
2019}
2020
a834585d 2021// Sets the document width assumed for scrolling.
8e0945da
VZ
2022void wxStyledTextCtrl::SetScrollWidth(int pixelWidth)
2023{
a834585d
RD
2024 SendMsg(2274, pixelWidth, 0);
2025}
2026
2027// Retrieve the document width assumed for scrolling.
8e0945da
VZ
2028int wxStyledTextCtrl::GetScrollWidth() const
2029{
a834585d
RD
2030 return SendMsg(2275, 0, 0);
2031}
2032
7e0c58e9 2033// Sets whether the maximum width line displayed is used to set scroll width.
8e0945da
VZ
2034void wxStyledTextCtrl::SetScrollWidthTracking(bool tracking)
2035{
7e0c58e9
RD
2036 SendMsg(2516, tracking, 0);
2037}
2038
2039// Retrieve whether the scroll width tracks wide lines.
8e0945da
VZ
2040bool wxStyledTextCtrl::GetScrollWidthTracking() const
2041{
7e0c58e9
RD
2042 return SendMsg(2517, 0, 0) != 0;
2043}
2044
a834585d 2045// Measure the pixel width of some text in a particular style.
8e54aaed 2046// NUL terminated text argument.
a834585d 2047// Does not handle tab or control characters.
8e0945da
VZ
2048int wxStyledTextCtrl::TextWidth(int style, const wxString& text)
2049{
b796ba39 2050 return SendMsg(2276, style, (sptr_t)(const char*)wx2stc(text));
a834585d
RD
2051}
2052
2053// Sets the scroll range so that maximum scroll position has
2054// the last line at the bottom of the view (default).
2055// Setting this to false allows scrolling one page below the last line.
8e0945da
VZ
2056void wxStyledTextCtrl::SetEndAtLastLine(bool endAtLastLine)
2057{
a834585d
RD
2058 SendMsg(2277, endAtLastLine, 0);
2059}
2060
2061// Retrieve whether the maximum scroll position has the last
2062// line at the bottom of the view.
8e0945da
VZ
2063bool wxStyledTextCtrl::GetEndAtLastLine() const
2064{
1e9bafca 2065 return SendMsg(2278, 0, 0) != 0;
a834585d
RD
2066}
2067
2068// Retrieve the height of a particular line of text in pixels.
8e0945da
VZ
2069int wxStyledTextCtrl::TextHeight(int line)
2070{
a834585d
RD
2071 return SendMsg(2279, line, 0);
2072}
2073
9e730a78 2074// Show or hide the vertical scroll bar.
8e0945da
VZ
2075void wxStyledTextCtrl::SetUseVerticalScrollBar(bool show)
2076{
9e730a78
RD
2077 SendMsg(2280, show, 0);
2078}
2079
2080// Is the vertical scroll bar visible?
8e0945da
VZ
2081bool wxStyledTextCtrl::GetUseVerticalScrollBar() const
2082{
9e730a78
RD
2083 return SendMsg(2281, 0, 0) != 0;
2084}
2085
2086// Append a string to the end of the document without changing the selection.
41a499cd 2087void wxStyledTextCtrl::AppendText(const wxString& text) {
2ed48ef8 2088 const wxWX2MBbuf buf = wx2stc(text);
d7b46878 2089 SendMsg(2282, wx2stclen(text, buf), (sptr_t)(const char*)buf);
9e730a78
RD
2090}
2091
2092// Is drawing done in two phases with backgrounds drawn before foregrounds?
8e0945da
VZ
2093bool wxStyledTextCtrl::GetTwoPhaseDraw() const
2094{
9e730a78
RD
2095 return SendMsg(2283, 0, 0) != 0;
2096}
2097
2098// In twoPhaseDraw mode, drawing is performed in two phases, first the background
2099// and then the foreground. This avoids chopping off characters that overlap the next run.
8e0945da
VZ
2100void wxStyledTextCtrl::SetTwoPhaseDraw(bool twoPhase)
2101{
9e730a78
RD
2102 SendMsg(2284, twoPhase, 0);
2103}
2104
9e96e16f
RD
2105// Scroll so that a display line is at the top of the display.
2106void wxStyledTextCtrl::SetFirstVisibleLine(int lineDisplay)
2107{
2108 SendMsg(2613, lineDisplay, 0);
2109}
2110
9e730a78 2111// Make the target range start and end be the same as the selection range start and end.
8e0945da
VZ
2112void wxStyledTextCtrl::TargetFromSelection()
2113{
9e730a78
RD
2114 SendMsg(2287, 0, 0);
2115}
2116
2117// Join the lines in the target.
8e0945da
VZ
2118void wxStyledTextCtrl::LinesJoin()
2119{
9e730a78
RD
2120 SendMsg(2288, 0, 0);
2121}
2122
2123// Split the lines in the target into lines that are less wide than pixelWidth
2124// where possible.
8e0945da
VZ
2125void wxStyledTextCtrl::LinesSplit(int pixelWidth)
2126{
9e730a78
RD
2127 SendMsg(2289, pixelWidth, 0);
2128}
2129
2130// Set the colours used as a chequerboard pattern in the fold margin
8e0945da
VZ
2131void wxStyledTextCtrl::SetFoldMarginColour(bool useSetting, const wxColour& back)
2132{
9e730a78
RD
2133 SendMsg(2290, useSetting, wxColourAsLong(back));
2134}
8e0945da
VZ
2135void wxStyledTextCtrl::SetFoldMarginHiColour(bool useSetting, const wxColour& fore)
2136{
9e730a78
RD
2137 SendMsg(2291, useSetting, wxColourAsLong(fore));
2138}
2139
c26dba42 2140// Move caret down one line.
8e0945da
VZ
2141void wxStyledTextCtrl::LineDown()
2142{
c26dba42
RD
2143 SendMsg(2300, 0, 0);
2144}
2145
2146// Move caret down one line extending selection to new caret position.
8e0945da
VZ
2147void wxStyledTextCtrl::LineDownExtend()
2148{
c26dba42
RD
2149 SendMsg(2301, 0, 0);
2150}
2151
2152// Move caret up one line.
8e0945da
VZ
2153void wxStyledTextCtrl::LineUp()
2154{
c26dba42
RD
2155 SendMsg(2302, 0, 0);
2156}
2157
2158// Move caret up one line extending selection to new caret position.
8e0945da
VZ
2159void wxStyledTextCtrl::LineUpExtend()
2160{
c26dba42
RD
2161 SendMsg(2303, 0, 0);
2162}
2163
2164// Move caret left one character.
8e0945da
VZ
2165void wxStyledTextCtrl::CharLeft()
2166{
c26dba42
RD
2167 SendMsg(2304, 0, 0);
2168}
2169
2170// Move caret left one character extending selection to new caret position.
8e0945da
VZ
2171void wxStyledTextCtrl::CharLeftExtend()
2172{
c26dba42
RD
2173 SendMsg(2305, 0, 0);
2174}
2175
2176// Move caret right one character.
8e0945da
VZ
2177void wxStyledTextCtrl::CharRight()
2178{
c26dba42
RD
2179 SendMsg(2306, 0, 0);
2180}
2181
2182// Move caret right one character extending selection to new caret position.
8e0945da
VZ
2183void wxStyledTextCtrl::CharRightExtend()
2184{
c26dba42
RD
2185 SendMsg(2307, 0, 0);
2186}
2187
2188// Move caret left one word.
8e0945da
VZ
2189void wxStyledTextCtrl::WordLeft()
2190{
c26dba42
RD
2191 SendMsg(2308, 0, 0);
2192}
2193
2194// Move caret left one word extending selection to new caret position.
8e0945da
VZ
2195void wxStyledTextCtrl::WordLeftExtend()
2196{
c26dba42
RD
2197 SendMsg(2309, 0, 0);
2198}
2199
2200// Move caret right one word.
8e0945da
VZ
2201void wxStyledTextCtrl::WordRight()
2202{
c26dba42
RD
2203 SendMsg(2310, 0, 0);
2204}
2205
2206// Move caret right one word extending selection to new caret position.
8e0945da
VZ
2207void wxStyledTextCtrl::WordRightExtend()
2208{
c26dba42
RD
2209 SendMsg(2311, 0, 0);
2210}
2211
2212// Move caret to first position on line.
8e0945da
VZ
2213void wxStyledTextCtrl::Home()
2214{
c26dba42
RD
2215 SendMsg(2312, 0, 0);
2216}
2217
2218// Move caret to first position on line extending selection to new caret position.
8e0945da
VZ
2219void wxStyledTextCtrl::HomeExtend()
2220{
c26dba42
RD
2221 SendMsg(2313, 0, 0);
2222}
2223
2224// Move caret to last position on line.
8e0945da
VZ
2225void wxStyledTextCtrl::LineEnd()
2226{
c26dba42
RD
2227 SendMsg(2314, 0, 0);
2228}
2229
2230// Move caret to last position on line extending selection to new caret position.
8e0945da
VZ
2231void wxStyledTextCtrl::LineEndExtend()
2232{
c26dba42
RD
2233 SendMsg(2315, 0, 0);
2234}
2235
2236// Move caret to first position in document.
8e0945da
VZ
2237void wxStyledTextCtrl::DocumentStart()
2238{
c26dba42
RD
2239 SendMsg(2316, 0, 0);
2240}
2241
2242// Move caret to first position in document extending selection to new caret position.
8e0945da
VZ
2243void wxStyledTextCtrl::DocumentStartExtend()
2244{
c26dba42
RD
2245 SendMsg(2317, 0, 0);
2246}
2247
2248// Move caret to last position in document.
8e0945da
VZ
2249void wxStyledTextCtrl::DocumentEnd()
2250{
c26dba42
RD
2251 SendMsg(2318, 0, 0);
2252}
2253
2254// Move caret to last position in document extending selection to new caret position.
8e0945da
VZ
2255void wxStyledTextCtrl::DocumentEndExtend()
2256{
c26dba42
RD
2257 SendMsg(2319, 0, 0);
2258}
2259
2260// Move caret one page up.
8e0945da
VZ
2261void wxStyledTextCtrl::PageUp()
2262{
c26dba42
RD
2263 SendMsg(2320, 0, 0);
2264}
2265
2266// Move caret one page up extending selection to new caret position.
8e0945da
VZ
2267void wxStyledTextCtrl::PageUpExtend()
2268{
c26dba42
RD
2269 SendMsg(2321, 0, 0);
2270}
2271
2272// Move caret one page down.
8e0945da
VZ
2273void wxStyledTextCtrl::PageDown()
2274{
c26dba42
RD
2275 SendMsg(2322, 0, 0);
2276}
2277
2278// Move caret one page down extending selection to new caret position.
8e0945da
VZ
2279void wxStyledTextCtrl::PageDownExtend()
2280{
c26dba42
RD
2281 SendMsg(2323, 0, 0);
2282}
2283
2284// Switch from insert to overtype mode or the reverse.
8e0945da
VZ
2285void wxStyledTextCtrl::EditToggleOvertype()
2286{
c26dba42
RD
2287 SendMsg(2324, 0, 0);
2288}
2289
2290// Cancel any modes such as call tip or auto-completion list display.
8e0945da
VZ
2291void wxStyledTextCtrl::Cancel()
2292{
c26dba42
RD
2293 SendMsg(2325, 0, 0);
2294}
2295
2296// Delete the selection or if no selection, the character before the caret.
8e0945da
VZ
2297void wxStyledTextCtrl::DeleteBack()
2298{
c26dba42
RD
2299 SendMsg(2326, 0, 0);
2300}
2301
2302// If selection is empty or all on one line replace the selection with a tab character.
2303// If more than one line selected, indent the lines.
8e0945da
VZ
2304void wxStyledTextCtrl::Tab()
2305{
c26dba42
RD
2306 SendMsg(2327, 0, 0);
2307}
2308
2309// Dedent the selected lines.
8e0945da
VZ
2310void wxStyledTextCtrl::BackTab()
2311{
c26dba42
RD
2312 SendMsg(2328, 0, 0);
2313}
2314
2315// Insert a new line, may use a CRLF, CR or LF depending on EOL mode.
8e0945da
VZ
2316void wxStyledTextCtrl::NewLine()
2317{
c26dba42
RD
2318 SendMsg(2329, 0, 0);
2319}
2320
2321// Insert a Form Feed character.
8e0945da
VZ
2322void wxStyledTextCtrl::FormFeed()
2323{
c26dba42
RD
2324 SendMsg(2330, 0, 0);
2325}
2326
2327// Move caret to before first visible character on line.
2328// If already there move to first character on line.
8e0945da
VZ
2329void wxStyledTextCtrl::VCHome()
2330{
c26dba42
RD
2331 SendMsg(2331, 0, 0);
2332}
2333
2334// Like VCHome but extending selection to new caret position.
8e0945da
VZ
2335void wxStyledTextCtrl::VCHomeExtend()
2336{
c26dba42
RD
2337 SendMsg(2332, 0, 0);
2338}
2339
2340// Magnify the displayed text by increasing the sizes by 1 point.
8e0945da
VZ
2341void wxStyledTextCtrl::ZoomIn()
2342{
c26dba42
RD
2343 SendMsg(2333, 0, 0);
2344}
2345
2346// Make the displayed text smaller by decreasing the sizes by 1 point.
8e0945da
VZ
2347void wxStyledTextCtrl::ZoomOut()
2348{
c26dba42
RD
2349 SendMsg(2334, 0, 0);
2350}
2351
2352// Delete the word to the left of the caret.
8e0945da
VZ
2353void wxStyledTextCtrl::DelWordLeft()
2354{
c26dba42
RD
2355 SendMsg(2335, 0, 0);
2356}
2357
2358// Delete the word to the right of the caret.
8e0945da
VZ
2359void wxStyledTextCtrl::DelWordRight()
2360{
c26dba42
RD
2361 SendMsg(2336, 0, 0);
2362}
2363
7e0c58e9 2364// Delete the word to the right of the caret, but not the trailing non-word characters.
8e0945da
VZ
2365void wxStyledTextCtrl::DelWordRightEnd()
2366{
7e0c58e9
RD
2367 SendMsg(2518, 0, 0);
2368}
2369
c26dba42 2370// Cut the line containing the caret.
8e0945da
VZ
2371void wxStyledTextCtrl::LineCut()
2372{
c26dba42
RD
2373 SendMsg(2337, 0, 0);
2374}
2375
2376// Delete the line containing the caret.
8e0945da
VZ
2377void wxStyledTextCtrl::LineDelete()
2378{
c26dba42
RD
2379 SendMsg(2338, 0, 0);
2380}
2381
2382// Switch the current line with the previous.
8e0945da
VZ
2383void wxStyledTextCtrl::LineTranspose()
2384{
c26dba42
RD
2385 SendMsg(2339, 0, 0);
2386}
2387
9e730a78 2388// Duplicate the current line.
8e0945da
VZ
2389void wxStyledTextCtrl::LineDuplicate()
2390{
9e730a78
RD
2391 SendMsg(2404, 0, 0);
2392}
2393
c26dba42 2394// Transform the selection to lower case.
8e0945da
VZ
2395void wxStyledTextCtrl::LowerCase()
2396{
c26dba42
RD
2397 SendMsg(2340, 0, 0);
2398}
2399
2400// Transform the selection to upper case.
8e0945da
VZ
2401void wxStyledTextCtrl::UpperCase()
2402{
c26dba42
RD
2403 SendMsg(2341, 0, 0);
2404}
2405
2406// Scroll the document down, keeping the caret visible.
8e0945da
VZ
2407void wxStyledTextCtrl::LineScrollDown()
2408{
c26dba42
RD
2409 SendMsg(2342, 0, 0);
2410}
2411
2412// Scroll the document up, keeping the caret visible.
8e0945da
VZ
2413void wxStyledTextCtrl::LineScrollUp()
2414{
c26dba42
RD
2415 SendMsg(2343, 0, 0);
2416}
2417
2418// Delete the selection or if no selection, the character before the caret.
2419// Will not delete the character before at the start of a line.
8e0945da
VZ
2420void wxStyledTextCtrl::DeleteBackNotLine()
2421{
c26dba42
RD
2422 SendMsg(2344, 0, 0);
2423}
2424
f114b858 2425// Move caret to first position on display line.
8e0945da
VZ
2426void wxStyledTextCtrl::HomeDisplay()
2427{
f114b858
RD
2428 SendMsg(2345, 0, 0);
2429}
2430
2b5f62a0 2431// Move caret to first position on display line extending selection to
f114b858 2432// new caret position.
8e0945da
VZ
2433void wxStyledTextCtrl::HomeDisplayExtend()
2434{
f114b858
RD
2435 SendMsg(2346, 0, 0);
2436}
2437
2438// Move caret to last position on display line.
8e0945da
VZ
2439void wxStyledTextCtrl::LineEndDisplay()
2440{
f114b858
RD
2441 SendMsg(2347, 0, 0);
2442}
2443
2b5f62a0 2444// Move caret to last position on display line extending selection to new
f114b858 2445// caret position.
8e0945da
VZ
2446void wxStyledTextCtrl::LineEndDisplayExtend()
2447{
f114b858
RD
2448 SendMsg(2348, 0, 0);
2449}
2450
c26dba42
RD
2451// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)?
2452// except they behave differently when word-wrap is enabled:
2453// They go first to the start / end of the display line, like (Home|LineEnd)Display
2454// The difference is that, the cursor is already at the point, it goes on to the start
2455// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
8e0945da
VZ
2456void wxStyledTextCtrl::HomeWrap()
2457{
c26dba42
RD
2458 SendMsg(2349, 0, 0);
2459}
8e0945da
VZ
2460void wxStyledTextCtrl::HomeWrapExtend()
2461{
c26dba42
RD
2462 SendMsg(2450, 0, 0);
2463}
8e0945da
VZ
2464void wxStyledTextCtrl::LineEndWrap()
2465{
c26dba42
RD
2466 SendMsg(2451, 0, 0);
2467}
8e0945da
VZ
2468void wxStyledTextCtrl::LineEndWrapExtend()
2469{
c26dba42
RD
2470 SendMsg(2452, 0, 0);
2471}
8e0945da
VZ
2472void wxStyledTextCtrl::VCHomeWrap()
2473{
c26dba42
RD
2474 SendMsg(2453, 0, 0);
2475}
8e0945da
VZ
2476void wxStyledTextCtrl::VCHomeWrapExtend()
2477{
c26dba42
RD
2478 SendMsg(2454, 0, 0);
2479}
2480
e14d10b0 2481// Copy the line containing the caret.
8e0945da
VZ
2482void wxStyledTextCtrl::LineCopy()
2483{
e14d10b0
RD
2484 SendMsg(2455, 0, 0);
2485}
2486
a834585d 2487// Move the caret inside current view if it's not there already.
8e0945da
VZ
2488void wxStyledTextCtrl::MoveCaretInsideView()
2489{
65ec6247
RD
2490 SendMsg(2401, 0, 0);
2491}
2492
9e96e16f 2493// How many characters are on a line, including end of line characters?
2bfca191 2494int wxStyledTextCtrl::LineLength(int line) const
8e0945da 2495{
4370573a
RD
2496 return SendMsg(2350, line, 0);
2497}
9ce192d4 2498
4370573a 2499// Highlight the characters at two positions.
8e0945da
VZ
2500void wxStyledTextCtrl::BraceHighlight(int pos1, int pos2)
2501{
4370573a
RD
2502 SendMsg(2351, pos1, pos2);
2503}
9ce192d4 2504
4370573a 2505// Highlight the character at a position indicating there is no matching brace.
8e0945da
VZ
2506void wxStyledTextCtrl::BraceBadLight(int pos)
2507{
4370573a 2508 SendMsg(2352, pos, 0);
9ce192d4
RD
2509}
2510
4370573a 2511// Find the position of a matching brace or INVALID_POSITION if no match.
8e0945da
VZ
2512int wxStyledTextCtrl::BraceMatch(int pos)
2513{
4370573a
RD
2514 return SendMsg(2353, pos, 0);
2515}
9ce192d4 2516
a834585d 2517// Are the end of line characters visible?
8e0945da
VZ
2518bool wxStyledTextCtrl::GetViewEOL() const
2519{
4370573a 2520 return SendMsg(2355, 0, 0) != 0;
9ce192d4
RD
2521}
2522
a834585d 2523// Make the end of line characters visible or invisible.
8e0945da
VZ
2524void wxStyledTextCtrl::SetViewEOL(bool visible)
2525{
4370573a
RD
2526 SendMsg(2356, visible, 0);
2527}
9ce192d4 2528
4370573a
RD
2529// Retrieve a pointer to the document object.
2530void* wxStyledTextCtrl::GetDocPointer() {
9e730a78 2531 return (void*)SendMsg(2357);
4370573a 2532}
67003d1a 2533
4370573a
RD
2534// Change the document object used.
2535void wxStyledTextCtrl::SetDocPointer(void* docPointer) {
b796ba39 2536 SendMsg(2358, 0, (sptr_t)docPointer);
67003d1a
RD
2537}
2538
4370573a 2539// Set which document modification events are sent to the container.
8e0945da
VZ
2540void wxStyledTextCtrl::SetModEventMask(int mask)
2541{
4370573a
RD
2542 SendMsg(2359, mask, 0);
2543}
67003d1a 2544
4370573a 2545// Retrieve the column number which text should be kept within.
8e0945da
VZ
2546int wxStyledTextCtrl::GetEdgeColumn() const
2547{
4370573a 2548 return SendMsg(2360, 0, 0);
67003d1a
RD
2549}
2550
4370573a
RD
2551// Set the column number of the edge.
2552// If text goes past the edge then it is highlighted.
8e0945da
VZ
2553void wxStyledTextCtrl::SetEdgeColumn(int column)
2554{
4370573a
RD
2555 SendMsg(2361, column, 0);
2556}
67003d1a 2557
4370573a 2558// Retrieve the edge highlight mode.
8e0945da
VZ
2559int wxStyledTextCtrl::GetEdgeMode() const
2560{
4370573a 2561 return SendMsg(2362, 0, 0);
67003d1a
RD
2562}
2563
4370573a
RD
2564// The edge may be displayed by a line (EDGE_LINE) or by highlighting text that
2565// goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).
8e0945da
VZ
2566void wxStyledTextCtrl::SetEdgeMode(int mode)
2567{
4370573a
RD
2568 SendMsg(2363, mode, 0);
2569}
67003d1a 2570
4370573a 2571// Retrieve the colour used in edge indication.
8e0945da
VZ
2572wxColour wxStyledTextCtrl::GetEdgeColour() const
2573{
4370573a
RD
2574 long c = SendMsg(2364, 0, 0);
2575 return wxColourFromLong(c);
67003d1a
RD
2576}
2577
4370573a 2578// Change the colour used in edge indication.
8e0945da
VZ
2579void wxStyledTextCtrl::SetEdgeColour(const wxColour& edgeColour)
2580{
4370573a
RD
2581 SendMsg(2365, wxColourAsLong(edgeColour), 0);
2582}
67003d1a 2583
4370573a 2584// Sets the current caret position to be the search anchor.
8e0945da
VZ
2585void wxStyledTextCtrl::SearchAnchor()
2586{
4370573a 2587 SendMsg(2366, 0, 0);
67003d1a
RD
2588}
2589
4370573a 2590// Find some text starting at the search anchor.
65ec6247 2591// Does not ensure the selection is visible.
8e0945da
VZ
2592int wxStyledTextCtrl::SearchNext(int flags, const wxString& text)
2593{
b796ba39 2594 return SendMsg(2367, flags, (sptr_t)(const char*)wx2stc(text));
4370573a 2595}
67003d1a 2596
4370573a 2597// Find some text starting at the search anchor and moving backwards.
65ec6247 2598// Does not ensure the selection is visible.
8e0945da
VZ
2599int wxStyledTextCtrl::SearchPrev(int flags, const wxString& text)
2600{
b796ba39 2601 return SendMsg(2368, flags, (sptr_t)(const char*)wx2stc(text));
67003d1a
RD
2602}
2603
4370573a 2604// Retrieves the number of lines completely visible.
8e0945da
VZ
2605int wxStyledTextCtrl::LinesOnScreen() const
2606{
4370573a 2607 return SendMsg(2370, 0, 0);
67003d1a
RD
2608}
2609
4370573a
RD
2610// Set whether a pop up menu is displayed automatically when the user presses
2611// the wrong mouse button.
8e0945da
VZ
2612void wxStyledTextCtrl::UsePopUp(bool allowPopUp)
2613{
4370573a
RD
2614 SendMsg(2371, allowPopUp, 0);
2615}
67003d1a 2616
a834585d 2617// Is the selection rectangular? The alternative is the more common stream selection.
8e0945da
VZ
2618bool wxStyledTextCtrl::SelectionIsRectangle() const
2619{
4370573a 2620 return SendMsg(2372, 0, 0) != 0;
67003d1a
RD
2621}
2622
4370573a
RD
2623// Set the zoom level. This number of points is added to the size of all fonts.
2624// It may be positive to magnify or negative to reduce.
8e0945da
VZ
2625void wxStyledTextCtrl::SetZoom(int zoom)
2626{
4370573a
RD
2627 SendMsg(2373, zoom, 0);
2628}
67003d1a 2629
4370573a 2630// Retrieve the zoom level.
8e0945da
VZ
2631int wxStyledTextCtrl::GetZoom() const
2632{
4370573a 2633 return SendMsg(2374, 0, 0);
67003d1a
RD
2634}
2635
4370573a
RD
2636// Create a new document object.
2637// Starts with reference count of 1 and not selected into editor.
2638void* wxStyledTextCtrl::CreateDocument() {
9e730a78 2639 return (void*)SendMsg(2375);
4370573a 2640}
67003d1a 2641
4370573a
RD
2642// Extend life of document.
2643void wxStyledTextCtrl::AddRefDocument(void* docPointer) {
b796ba39 2644 SendMsg(2376, 0, (sptr_t)docPointer);
67003d1a
RD
2645}
2646
4370573a
RD
2647// Release a reference to the document, deleting document if it fades to black.
2648void wxStyledTextCtrl::ReleaseDocument(void* docPointer) {
b796ba39 2649 SendMsg(2377, 0, (sptr_t)docPointer);
4370573a 2650}
67003d1a 2651
4370573a 2652// Get which document modification events are sent to the container.
8e0945da
VZ
2653int wxStyledTextCtrl::GetModEventMask() const
2654{
4370573a 2655 return SendMsg(2378, 0, 0);
67003d1a
RD
2656}
2657
a834585d 2658// Change internal focus flag.
8e0945da
VZ
2659void wxStyledTextCtrl::SetSTCFocus(bool focus)
2660{
65ec6247
RD
2661 SendMsg(2380, focus, 0);
2662}
2663
a834585d 2664// Get internal focus flag.
8e0945da
VZ
2665bool wxStyledTextCtrl::GetSTCFocus() const
2666{
65ec6247
RD
2667 return SendMsg(2381, 0, 0) != 0;
2668}
2669
a834585d 2670// Change error status - 0 = OK.
8e0945da
VZ
2671void wxStyledTextCtrl::SetStatus(int statusCode)
2672{
65ec6247
RD
2673 SendMsg(2382, statusCode, 0);
2674}
2675
a834585d 2676// Get error status.
8e0945da
VZ
2677int wxStyledTextCtrl::GetStatus() const
2678{
65ec6247
RD
2679 return SendMsg(2383, 0, 0);
2680}
2681
a834585d 2682// Set whether the mouse is captured when its button is pressed.
8e0945da
VZ
2683void wxStyledTextCtrl::SetMouseDownCaptures(bool captures)
2684{
65ec6247
RD
2685 SendMsg(2384, captures, 0);
2686}
2687
a834585d 2688// Get whether mouse gets captured.
8e0945da
VZ
2689bool wxStyledTextCtrl::GetMouseDownCaptures() const
2690{
65ec6247
RD
2691 return SendMsg(2385, 0, 0) != 0;
2692}
2693
a834585d 2694// Sets the cursor to one of the SC_CURSOR* values.
8e0945da
VZ
2695void wxStyledTextCtrl::SetSTCCursor(int cursorType)
2696{
65ec6247
RD
2697 SendMsg(2386, cursorType, 0);
2698}
2699
a834585d 2700// Get cursor type.
8e0945da
VZ
2701int wxStyledTextCtrl::GetSTCCursor() const
2702{
65ec6247
RD
2703 return SendMsg(2387, 0, 0);
2704}
2705
1a2fb4cd 2706// Change the way control characters are displayed:
a834585d 2707// If symbol is < 32, keep the drawn way, else, use the given character.
8e0945da
VZ
2708void wxStyledTextCtrl::SetControlCharSymbol(int symbol)
2709{
1a2fb4cd
RD
2710 SendMsg(2388, symbol, 0);
2711}
2712
a834585d 2713// Get the way control characters are displayed.
8e0945da
VZ
2714int wxStyledTextCtrl::GetControlCharSymbol() const
2715{
1a2fb4cd
RD
2716 return SendMsg(2389, 0, 0);
2717}
2718
a834585d 2719// Move to the previous change in capitalisation.
8e0945da
VZ
2720void wxStyledTextCtrl::WordPartLeft()
2721{
65ec6247
RD
2722 SendMsg(2390, 0, 0);
2723}
2724
a834585d
RD
2725// Move to the previous change in capitalisation extending selection
2726// to new caret position.
8e0945da
VZ
2727void wxStyledTextCtrl::WordPartLeftExtend()
2728{
65ec6247
RD
2729 SendMsg(2391, 0, 0);
2730}
2731
a834585d 2732// Move to the change next in capitalisation.
8e0945da
VZ
2733void wxStyledTextCtrl::WordPartRight()
2734{
65ec6247
RD
2735 SendMsg(2392, 0, 0);
2736}
2737
a834585d
RD
2738// Move to the next change in capitalisation extending selection
2739// to new caret position.
8e0945da
VZ
2740void wxStyledTextCtrl::WordPartRightExtend()
2741{
65ec6247
RD
2742 SendMsg(2393, 0, 0);
2743}
2744
a834585d
RD
2745// Set the way the display area is determined when a particular line
2746// is to be moved to by Find, FindNext, GotoLine, etc.
8e0945da
VZ
2747void wxStyledTextCtrl::SetVisiblePolicy(int visiblePolicy, int visibleSlop)
2748{
65ec6247
RD
2749 SendMsg(2394, visiblePolicy, visibleSlop);
2750}
2751
a834585d 2752// Delete back from the current position to the start of the line.
8e0945da
VZ
2753void wxStyledTextCtrl::DelLineLeft()
2754{
65ec6247
RD
2755 SendMsg(2395, 0, 0);
2756}
2757
a834585d 2758// Delete forwards from the current position to the end of the line.
8e0945da
VZ
2759void wxStyledTextCtrl::DelLineRight()
2760{
65ec6247
RD
2761 SendMsg(2396, 0, 0);
2762}
2763
a834585d 2764// Get and Set the xOffset (ie, horizonal scroll position).
8e0945da
VZ
2765void wxStyledTextCtrl::SetXOffset(int newOffset)
2766{
1a2fb4cd
RD
2767 SendMsg(2397, newOffset, 0);
2768}
8e0945da
VZ
2769int wxStyledTextCtrl::GetXOffset() const
2770{
1a2fb4cd
RD
2771 return SendMsg(2398, 0, 0);
2772}
2773
8e54aaed 2774// Set the last x chosen value to be the caret x position.
8e0945da
VZ
2775void wxStyledTextCtrl::ChooseCaretX()
2776{
9e730a78
RD
2777 SendMsg(2399, 0, 0);
2778}
2779
a834585d
RD
2780// Set the way the caret is kept visible when going sideway.
2781// The exclusion zone is given in pixels.
8e0945da
VZ
2782void wxStyledTextCtrl::SetXCaretPolicy(int caretPolicy, int caretSlop)
2783{
a834585d
RD
2784 SendMsg(2402, caretPolicy, caretSlop);
2785}
2786
2787// Set the way the line the caret is on is kept visible.
2788// The exclusion zone is given in lines.
8e0945da
VZ
2789void wxStyledTextCtrl::SetYCaretPolicy(int caretPolicy, int caretSlop)
2790{
a834585d
RD
2791 SendMsg(2403, caretPolicy, caretSlop);
2792}
2793
9e730a78 2794// Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE).
8e0945da
VZ
2795void wxStyledTextCtrl::SetPrintWrapMode(int mode)
2796{
9e730a78
RD
2797 SendMsg(2406, mode, 0);
2798}
2799
8e54aaed 2800// Is printing line wrapped?
8e0945da
VZ
2801int wxStyledTextCtrl::GetPrintWrapMode() const
2802{
9e730a78
RD
2803 return SendMsg(2407, 0, 0);
2804}
2805
2806// Set a fore colour for active hotspots.
8e0945da
VZ
2807void wxStyledTextCtrl::SetHotspotActiveForeground(bool useSetting, const wxColour& fore)
2808{
9e730a78
RD
2809 SendMsg(2410, useSetting, wxColourAsLong(fore));
2810}
2811
7e0c58e9 2812// Get the fore colour for active hotspots.
8e0945da
VZ
2813wxColour wxStyledTextCtrl::GetHotspotActiveForeground() const
2814{
7e0c58e9
RD
2815 long c = SendMsg(2494, 0, 0);
2816 return wxColourFromLong(c);
2817}
2818
9e730a78 2819// Set a back colour for active hotspots.
8e0945da
VZ
2820void wxStyledTextCtrl::SetHotspotActiveBackground(bool useSetting, const wxColour& back)
2821{
9e730a78
RD
2822 SendMsg(2411, useSetting, wxColourAsLong(back));
2823}
2824
7e0c58e9 2825// Get the back colour for active hotspots.
8e0945da
VZ
2826wxColour wxStyledTextCtrl::GetHotspotActiveBackground() const
2827{
7e0c58e9
RD
2828 long c = SendMsg(2495, 0, 0);
2829 return wxColourFromLong(c);
2830}
2831
9e730a78 2832// Enable / Disable underlining active hotspots.
8e0945da
VZ
2833void wxStyledTextCtrl::SetHotspotActiveUnderline(bool underline)
2834{
9e730a78
RD
2835 SendMsg(2412, underline, 0);
2836}
2837
7e0c58e9 2838// Get whether underlining for active hotspots.
8e0945da
VZ
2839bool wxStyledTextCtrl::GetHotspotActiveUnderline() const
2840{
7e0c58e9
RD
2841 return SendMsg(2496, 0, 0) != 0;
2842}
2843
8e54aaed 2844// Limit hotspots to single line so hotspots on two lines don't merge.
8e0945da
VZ
2845void wxStyledTextCtrl::SetHotspotSingleLine(bool singleLine)
2846{
8e54aaed
RD
2847 SendMsg(2421, singleLine, 0);
2848}
2849
7e0c58e9 2850// Get the HotspotSingleLine property
8e0945da
VZ
2851bool wxStyledTextCtrl::GetHotspotSingleLine() const
2852{
7e0c58e9
RD
2853 return SendMsg(2497, 0, 0) != 0;
2854}
2855
c26dba42 2856// Move caret between paragraphs (delimited by empty lines).
8e0945da
VZ
2857void wxStyledTextCtrl::ParaDown()
2858{
c26dba42
RD
2859 SendMsg(2413, 0, 0);
2860}
8e0945da
VZ
2861void wxStyledTextCtrl::ParaDownExtend()
2862{
c26dba42
RD
2863 SendMsg(2414, 0, 0);
2864}
8e0945da
VZ
2865void wxStyledTextCtrl::ParaUp()
2866{
c26dba42
RD
2867 SendMsg(2415, 0, 0);
2868}
8e0945da
VZ
2869void wxStyledTextCtrl::ParaUpExtend()
2870{
c26dba42
RD
2871 SendMsg(2416, 0, 0);
2872}
2873
e14d10b0
RD
2874// Given a valid document position, return the previous position taking code
2875// page into account. Returns 0 if passed 0.
8e0945da
VZ
2876int wxStyledTextCtrl::PositionBefore(int pos)
2877{
e14d10b0
RD
2878 return SendMsg(2417, pos, 0);
2879}
2880
2881// Given a valid document position, return the next position taking code
2882// page into account. Maximum value returned is the last position in the document.
8e0945da
VZ
2883int wxStyledTextCtrl::PositionAfter(int pos)
2884{
e14d10b0
RD
2885 return SendMsg(2418, pos, 0);
2886}
2887
2888// Copy a range of text to the clipboard. Positions are clipped into the document.
8e0945da
VZ
2889void wxStyledTextCtrl::CopyRange(int start, int end)
2890{
e14d10b0
RD
2891 SendMsg(2419, start, end);
2892}
2893
2894// Copy argument text to the clipboard.
8e0945da
VZ
2895void wxStyledTextCtrl::CopyText(int length, const wxString& text)
2896{
b796ba39 2897 SendMsg(2420, length, (sptr_t)(const char*)wx2stc(text));
e14d10b0
RD
2898}
2899
9e96e16f 2900// Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE/SC_SEL_THIN) or
8e54aaed 2901// by lines (SC_SEL_LINES).
8e0945da
VZ
2902void wxStyledTextCtrl::SetSelectionMode(int mode)
2903{
8e54aaed
RD
2904 SendMsg(2422, mode, 0);
2905}
2906
2907// Get the mode of the current selection.
8e0945da
VZ
2908int wxStyledTextCtrl::GetSelectionMode() const
2909{
8e54aaed
RD
2910 return SendMsg(2423, 0, 0);
2911}
2912
2913// Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line).
8e0945da
VZ
2914int wxStyledTextCtrl::GetLineSelStartPosition(int line)
2915{
8e54aaed
RD
2916 return SendMsg(2424, line, 0);
2917}
2918
2919// Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line).
8e0945da
VZ
2920int wxStyledTextCtrl::GetLineSelEndPosition(int line)
2921{
8e54aaed
RD
2922 return SendMsg(2425, line, 0);
2923}
2924
c26dba42 2925// Move caret down one line, extending rectangular selection to new caret position.
8e0945da
VZ
2926void wxStyledTextCtrl::LineDownRectExtend()
2927{
c26dba42
RD
2928 SendMsg(2426, 0, 0);
2929}
2930
2931// Move caret up one line, extending rectangular selection to new caret position.
8e0945da
VZ
2932void wxStyledTextCtrl::LineUpRectExtend()
2933{
c26dba42
RD
2934 SendMsg(2427, 0, 0);
2935}
2936
2937// Move caret left one character, extending rectangular selection to new caret position.
8e0945da
VZ
2938void wxStyledTextCtrl::CharLeftRectExtend()
2939{
c26dba42
RD
2940 SendMsg(2428, 0, 0);
2941}
2942
2943// Move caret right one character, extending rectangular selection to new caret position.
8e0945da
VZ
2944void wxStyledTextCtrl::CharRightRectExtend()
2945{
c26dba42
RD
2946 SendMsg(2429, 0, 0);
2947}
2948
2949// Move caret to first position on line, extending rectangular selection to new caret position.
8e0945da
VZ
2950void wxStyledTextCtrl::HomeRectExtend()
2951{
c26dba42
RD
2952 SendMsg(2430, 0, 0);
2953}
2954
2955// Move caret to before first visible character on line.
2956// If already there move to first character on line.
2957// In either case, extend rectangular selection to new caret position.
8e0945da
VZ
2958void wxStyledTextCtrl::VCHomeRectExtend()
2959{
c26dba42
RD
2960 SendMsg(2431, 0, 0);
2961}
2962
2963// Move caret to last position on line, extending rectangular selection to new caret position.
8e0945da
VZ
2964void wxStyledTextCtrl::LineEndRectExtend()
2965{
c26dba42
RD
2966 SendMsg(2432, 0, 0);
2967}
2968
2969// Move caret one page up, extending rectangular selection to new caret position.
8e0945da
VZ
2970void wxStyledTextCtrl::PageUpRectExtend()
2971{
c26dba42
RD
2972 SendMsg(2433, 0, 0);
2973}
2974
2975// Move caret one page down, extending rectangular selection to new caret position.
8e0945da
VZ
2976void wxStyledTextCtrl::PageDownRectExtend()
2977{
c26dba42
RD
2978 SendMsg(2434, 0, 0);
2979}
2980
2981// Move caret to top of page, or one page up if already at top of page.
8e0945da
VZ
2982void wxStyledTextCtrl::StutteredPageUp()
2983{
c26dba42
RD
2984 SendMsg(2435, 0, 0);
2985}
2986
2987// Move caret to top of page, or one page up if already at top of page, extending selection to new caret position.
8e0945da
VZ
2988void wxStyledTextCtrl::StutteredPageUpExtend()
2989{
c26dba42
RD
2990 SendMsg(2436, 0, 0);
2991}
2992
2993// Move caret to bottom of page, or one page down if already at bottom of page.
8e0945da
VZ
2994void wxStyledTextCtrl::StutteredPageDown()
2995{
c26dba42
RD
2996 SendMsg(2437, 0, 0);
2997}
2998
2999// Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position.
8e0945da
VZ
3000void wxStyledTextCtrl::StutteredPageDownExtend()
3001{
c26dba42
RD
3002 SendMsg(2438, 0, 0);
3003}
3004
3005// Move caret left one word, position cursor at end of word.
8e0945da
VZ
3006void wxStyledTextCtrl::WordLeftEnd()
3007{
c26dba42
RD
3008 SendMsg(2439, 0, 0);
3009}
3010
3011// Move caret left one word, position cursor at end of word, extending selection to new caret position.
8e0945da
VZ
3012void wxStyledTextCtrl::WordLeftEndExtend()
3013{
c26dba42
RD
3014 SendMsg(2440, 0, 0);
3015}
3016
3017// Move caret right one word, position cursor at end of word.
8e0945da
VZ
3018void wxStyledTextCtrl::WordRightEnd()
3019{
c26dba42
RD
3020 SendMsg(2441, 0, 0);
3021}
3022
3023// Move caret right one word, position cursor at end of word, extending selection to new caret position.
8e0945da
VZ
3024void wxStyledTextCtrl::WordRightEndExtend()
3025{
c26dba42
RD
3026 SendMsg(2442, 0, 0);
3027}
3028
8e54aaed
RD
3029// Set the set of characters making up whitespace for when moving or selecting by word.
3030// Should be called after SetWordChars.
8e0945da
VZ
3031void wxStyledTextCtrl::SetWhitespaceChars(const wxString& characters)
3032{
b796ba39 3033 SendMsg(2443, 0, (sptr_t)(const char*)wx2stc(characters));
8e54aaed
RD
3034}
3035
3036// Reset the set of characters for whitespace and word characters to the defaults.
8e0945da
VZ
3037void wxStyledTextCtrl::SetCharsDefault()
3038{
8e54aaed
RD
3039 SendMsg(2444, 0, 0);
3040}
3041
3042// Get currently selected item position in the auto-completion list
8e0945da
VZ
3043int wxStyledTextCtrl::AutoCompGetCurrent()
3044{
8e54aaed
RD
3045 return SendMsg(2445, 0, 0);
3046}
3047
591d01be 3048// Enlarge the document to a particular size of text bytes.
8e0945da
VZ
3049void wxStyledTextCtrl::Allocate(int bytes)
3050{
591d01be
RD
3051 SendMsg(2446, bytes, 0);
3052}
3053
1e9bafca 3054// Find the position of a column on a line taking into account tabs and
a33203cb 3055// multi-byte characters. If beyond end of line, return line end position.
8e0945da
VZ
3056int wxStyledTextCtrl::FindColumn(int line, int column)
3057{
a33203cb
RD
3058 return SendMsg(2456, line, column);
3059}
3060
1e9bafca 3061// Can the caret preferred x position only be changed by explicit movement commands?
8e0945da
VZ
3062bool wxStyledTextCtrl::GetCaretSticky() const
3063{
1e9bafca
RD
3064 return SendMsg(2457, 0, 0) != 0;
3065}
3066
3067// Stop the caret preferred x position changing when the user types.
8e0945da
VZ
3068void wxStyledTextCtrl::SetCaretSticky(bool useCaretStickyBehaviour)
3069{
1e9bafca
RD
3070 SendMsg(2458, useCaretStickyBehaviour, 0);
3071}
3072
3073// Switch between sticky and non-sticky: meant to be bound to a key.
8e0945da
VZ
3074void wxStyledTextCtrl::ToggleCaretSticky()
3075{
1e9bafca
RD
3076 SendMsg(2459, 0, 0);
3077}
3078
3079// Enable/Disable convert-on-paste for line endings
8e0945da
VZ
3080void wxStyledTextCtrl::SetPasteConvertEndings(bool convert)
3081{
1e9bafca
RD
3082 SendMsg(2467, convert, 0);
3083}
3084
3085// Get convert-on-paste setting
8e0945da
VZ
3086bool wxStyledTextCtrl::GetPasteConvertEndings() const
3087{
1e9bafca
RD
3088 return SendMsg(2468, 0, 0) != 0;
3089}
3090
3091// Duplicate the selection. If selection empty duplicate the line containing the caret.
8e0945da
VZ
3092void wxStyledTextCtrl::SelectionDuplicate()
3093{
1e9bafca
RD
3094 SendMsg(2469, 0, 0);
3095}
3096
b8193d80 3097// Set background alpha of the caret line.
8e0945da
VZ
3098void wxStyledTextCtrl::SetCaretLineBackAlpha(int alpha)
3099{
b8193d80
RD
3100 SendMsg(2470, alpha, 0);
3101}
3102
3103// Get the background alpha of the caret line.
8e0945da
VZ
3104int wxStyledTextCtrl::GetCaretLineBackAlpha() const
3105{
b8193d80
RD
3106 return SendMsg(2471, 0, 0);
3107}
3108
7e0c58e9 3109// Set the style of the caret to be drawn.
8e0945da
VZ
3110void wxStyledTextCtrl::SetCaretStyle(int caretStyle)
3111{
7e0c58e9
RD
3112 SendMsg(2512, caretStyle, 0);
3113}
3114
3115// Returns the current style of the caret.
8e0945da
VZ
3116int wxStyledTextCtrl::GetCaretStyle() const
3117{
7e0c58e9
RD
3118 return SendMsg(2513, 0, 0);
3119}
3120
3121// Set the indicator used for IndicatorFillRange and IndicatorClearRange
8e0945da
VZ
3122void wxStyledTextCtrl::SetIndicatorCurrent(int indicator)
3123{
7e0c58e9
RD
3124 SendMsg(2500, indicator, 0);
3125}
3126
3127// Get the current indicator
8e0945da
VZ
3128int wxStyledTextCtrl::GetIndicatorCurrent() const
3129{
7e0c58e9
RD
3130 return SendMsg(2501, 0, 0);
3131}
3132
3133// Set the value used for IndicatorFillRange
8e0945da
VZ
3134void wxStyledTextCtrl::SetIndicatorValue(int value)
3135{
7e0c58e9
RD
3136 SendMsg(2502, value, 0);
3137}
3138
3139// Get the current indicator vaue
8e0945da
VZ
3140int wxStyledTextCtrl::GetIndicatorValue() const
3141{
7e0c58e9
RD
3142 return SendMsg(2503, 0, 0);
3143}
3144
3145// Turn a indicator on over a range.
8e0945da
VZ
3146void wxStyledTextCtrl::IndicatorFillRange(int position, int fillLength)
3147{
7e0c58e9
RD
3148 SendMsg(2504, position, fillLength);
3149}
3150
3151// Turn a indicator off over a range.
8e0945da
VZ
3152void wxStyledTextCtrl::IndicatorClearRange(int position, int clearLength)
3153{
7e0c58e9
RD
3154 SendMsg(2505, position, clearLength);
3155}
3156
3157// Are any indicators present at position?
8e0945da
VZ
3158int wxStyledTextCtrl::IndicatorAllOnFor(int position)
3159{
7e0c58e9
RD
3160 return SendMsg(2506, position, 0);
3161}
3162
3163// What value does a particular indicator have at at a position?
8e0945da
VZ
3164int wxStyledTextCtrl::IndicatorValueAt(int indicator, int position)
3165{
7e0c58e9
RD
3166 return SendMsg(2507, indicator, position);
3167}
3168
3169// Where does a particular indicator start?
8e0945da
VZ
3170int wxStyledTextCtrl::IndicatorStart(int indicator, int position)
3171{
7e0c58e9
RD
3172 return SendMsg(2508, indicator, position);
3173}
3174
3175// Where does a particular indicator end?
8e0945da
VZ
3176int wxStyledTextCtrl::IndicatorEnd(int indicator, int position)
3177{
7e0c58e9
RD
3178 return SendMsg(2509, indicator, position);
3179}
3180
3181// Set number of entries in position cache
8e0945da
VZ
3182void wxStyledTextCtrl::SetPositionCacheSize(int size)
3183{
7e0c58e9
RD
3184 SendMsg(2514, size, 0);
3185}
3186
3187// How many entries are allocated to the position cache?
8e0945da
VZ
3188int wxStyledTextCtrl::GetPositionCacheSize() const
3189{
7e0c58e9
RD
3190 return SendMsg(2515, 0, 0);
3191}
3192
9e96e16f
RD
3193// Copy the selection, if selection empty copy the line with the caret
3194void wxStyledTextCtrl::CopyAllowLine()
3195{
3196 SendMsg(2519, 0, 0);
3197}
3198
3199// Compact the document buffer and return a read-only pointer to the
3200// characters in the document.
3201const char* wxStyledTextCtrl::GetCharacterPointer() {
3202 return (const char*)SendMsg(2520, 0, 0);
3203}
3204
3205// Always interpret keyboard input as Unicode
3206void wxStyledTextCtrl::SetKeysUnicode(bool keysUnicode)
3207{
3208 SendMsg(2521, keysUnicode, 0);
3209}
3210
3211// Are keys always interpreted as Unicode?
3212bool wxStyledTextCtrl::GetKeysUnicode() const
3213{
3214 return SendMsg(2522, 0, 0) != 0;
3215}
3216
3217// Set the alpha fill colour of the given indicator.
3218void wxStyledTextCtrl::IndicatorSetAlpha(int indicator, int alpha)
3219{
3220 SendMsg(2523, indicator, alpha);
3221}
3222
3223// Get the alpha fill colour of the given indicator.
3224int wxStyledTextCtrl::IndicatorGetAlpha(int indicator) const
3225{
3226 return SendMsg(2524, indicator, 0);
3227}
3228
3229// Set extra ascent for each line
3230void wxStyledTextCtrl::SetExtraAscent(int extraAscent)
3231{
3232 SendMsg(2525, extraAscent, 0);
3233}
3234
3235// Get extra ascent for each line
3236int wxStyledTextCtrl::GetExtraAscent() const
3237{
3238 return SendMsg(2526, 0, 0);
3239}
3240
3241// Set extra descent for each line
3242void wxStyledTextCtrl::SetExtraDescent(int extraDescent)
3243{
3244 SendMsg(2527, extraDescent, 0);
3245}
3246
3247// Get extra descent for each line
3248int wxStyledTextCtrl::GetExtraDescent() const
3249{
3250 return SendMsg(2528, 0, 0);
3251}
3252
3253// Which symbol was defined for markerNumber with MarkerDefine
3254int wxStyledTextCtrl::GetMarkerSymbolDefined(int markerNumber)
3255{
3256 return SendMsg(2529, markerNumber, 0);
3257}
3258
3259// Set the text in the text margin for a line
3260void wxStyledTextCtrl::MarginSetText(int line, const wxString& text)
3261{
3262 SendMsg(2530, line, (sptr_t)(const char*)wx2stc(text));
3263}
3264
3265// Get the text in the text margin for a line
3266wxString wxStyledTextCtrl::MarginGetText(int line) const {
3267 long msg = 2531;
3268 long len = SendMsg(msg, line, 0);
3269
3270 wxMemoryBuffer mbuf(len+1);
3271 char* buf = (char*)mbuf.GetWriteBuf(len+1);
3272 SendMsg(msg, line, (sptr_t)buf);
3273 mbuf.UngetWriteBuf(len);
3274 mbuf.AppendByte(0);
3275 return stc2wx(buf);
3276}
3277
3278// Set the style number for the text margin for a line
3279void wxStyledTextCtrl::MarginSetStyle(int line, int style)
3280{
3281 SendMsg(2532, line, style);
3282}
3283
3284// Get the style number for the text margin for a line
3285int wxStyledTextCtrl::MarginGetStyle(int line) const
3286{
3287 return SendMsg(2533, line, 0);
3288}
3289
3290// Set the style in the text margin for a line
3291void wxStyledTextCtrl::MarginSetStyles(int line, const wxString& styles)
3292{
3293 SendMsg(2534, line, (sptr_t)(const char*)wx2stc(styles));
3294}
3295
3296// Get the styles in the text margin for a line
3297wxString wxStyledTextCtrl::MarginGetStyles(int line) const {
3298 long msg = 2535;
3299 long len = SendMsg(msg, line, 0);
3300
3301 wxMemoryBuffer mbuf(len+1);
3302 char* buf = (char*)mbuf.GetWriteBuf(len+1);
3303 SendMsg(msg, line, (sptr_t)buf);
3304 mbuf.UngetWriteBuf(len);
3305 mbuf.AppendByte(0);
3306 return stc2wx(buf);
3307}
3308
3309// Clear the margin text on all lines
3310void wxStyledTextCtrl::MarginTextClearAll()
3311{
3312 SendMsg(2536, 0, 0);
3313}
3314
3315// Get the start of the range of style numbers used for margin text
3316void wxStyledTextCtrl::MarginSetStyleOffset(int style)
3317{
3318 SendMsg(2537, style, 0);
3319}
3320
3321// Get the start of the range of style numbers used for margin text
3322int wxStyledTextCtrl::MarginGetStyleOffset() const
3323{
3324 return SendMsg(2538, 0, 0);
3325}
3326
3327// Set the annotation text for a line
3328void wxStyledTextCtrl::AnnotationSetText(int line, const wxString& text)
3329{
3330 SendMsg(2540, line, (sptr_t)(const char*)wx2stc(text));
3331}
3332
3333// Get the annotation text for a line
3334wxString wxStyledTextCtrl::AnnotationGetText(int line) const {
3335 long msg = 2541;
3336 long len = SendMsg(msg, line, 0);
3337
3338 wxMemoryBuffer mbuf(len+1);
3339 char* buf = (char*)mbuf.GetWriteBuf(len+1);
3340 SendMsg(msg, line, (sptr_t)buf);
3341 mbuf.UngetWriteBuf(len);
3342 mbuf.AppendByte(0);
3343 return stc2wx(buf);
3344}
3345
3346// Set the style number for the annotations for a line
3347void wxStyledTextCtrl::AnnotationSetStyle(int line, int style)
3348{
3349 SendMsg(2542, line, style);
3350}
3351
3352// Get the style number for the annotations for a line
3353int wxStyledTextCtrl::AnnotationGetStyle(int line) const
3354{
3355 return SendMsg(2543, line, 0);
3356}
3357
3358// Set the annotation styles for a line
3359void wxStyledTextCtrl::AnnotationSetStyles(int line, const wxString& styles)
3360{
3361 SendMsg(2544, line, (sptr_t)(const char*)wx2stc(styles));
3362}
3363
3364// Get the annotation styles for a line
3365wxString wxStyledTextCtrl::AnnotationGetStyles(int line) const {
3366 long msg = 2545;
3367 long len = SendMsg(msg, line, 0);
3368
3369 wxMemoryBuffer mbuf(len+1);
3370 char* buf = (char*)mbuf.GetWriteBuf(len+1);
3371 SendMsg(msg, line, (sptr_t)buf);
3372 mbuf.UngetWriteBuf(len);
3373 mbuf.AppendByte(0);
3374 return stc2wx(buf);
3375}
3376
3377// Get the number of annotation lines for a line
3378int wxStyledTextCtrl::AnnotationGetLines(int line) const
3379{
3380 return SendMsg(2546, line, 0);
3381}
3382
3383// Clear the annotations from all lines
3384void wxStyledTextCtrl::AnnotationClearAll()
3385{
3386 SendMsg(2547, 0, 0);
3387}
3388
3389// Set the visibility for the annotations for a view
3390void wxStyledTextCtrl::AnnotationSetVisible(int visible)
3391{
3392 SendMsg(2548, visible, 0);
3393}
3394
3395// Get the visibility for the annotations for a view
3396int wxStyledTextCtrl::AnnotationGetVisible() const
3397{
3398 return SendMsg(2549, 0, 0);
3399}
3400
3401// Get the start of the range of style numbers used for annotations
3402void wxStyledTextCtrl::AnnotationSetStyleOffset(int style)
3403{
3404 SendMsg(2550, style, 0);
3405}
3406
3407// Get the start of the range of style numbers used for annotations
3408int wxStyledTextCtrl::AnnotationGetStyleOffset() const
3409{
3410 return SendMsg(2551, 0, 0);
3411}
3412
3413// Add a container action to the undo stack
3414void wxStyledTextCtrl::AddUndoAction(int token, int flags)
3415{
3416 SendMsg(2560, token, flags);
3417}
3418
3419// Find the position of a character from a point within the window.
3420int wxStyledTextCtrl::CharPositionFromPoint(int x, int y)
3421{
3422 return SendMsg(2561, x, y);
3423}
3424
3425// Find the position of a character from a point within the window.
3426// Return INVALID_POSITION if not close to text.
3427int wxStyledTextCtrl::CharPositionFromPointClose(int x, int y)
3428{
3429 return SendMsg(2562, x, y);
3430}
3431
3432// Set whether multiple selections can be made
3433void wxStyledTextCtrl::SetMultipleSelection(bool multipleSelection)
3434{
3435 SendMsg(2563, multipleSelection, 0);
3436}
3437
3438// Whether multiple selections can be made
3439bool wxStyledTextCtrl::GetMultipleSelection() const
3440{
3441 return SendMsg(2564, 0, 0) != 0;
3442}
3443
3444// Set whether typing can be performed into multiple selections
3445void wxStyledTextCtrl::SetAdditionalSelectionTyping(bool additionalSelectionTyping)
3446{
3447 SendMsg(2565, additionalSelectionTyping, 0);
3448}
3449
3450// Whether typing can be performed into multiple selections
3451bool wxStyledTextCtrl::GetAdditionalSelectionTyping() const
3452{
3453 return SendMsg(2566, 0, 0) != 0;
3454}
3455
3456// Set whether additional carets will blink
3457void wxStyledTextCtrl::SetAdditionalCaretsBlink(bool additionalCaretsBlink)
3458{
3459 SendMsg(2567, additionalCaretsBlink, 0);
3460}
3461
3462// Whether additional carets will blink
3463bool wxStyledTextCtrl::GetAdditionalCaretsBlink() const
3464{
3465 return SendMsg(2568, 0, 0) != 0;
3466}
3467
3468// Set whether additional carets are visible
3469void wxStyledTextCtrl::SetAdditionalCaretsVisible(bool additionalCaretsBlink)
3470{
3471 SendMsg(2608, additionalCaretsBlink, 0);
3472}
3473
3474// Whether additional carets are visible
3475bool wxStyledTextCtrl::GetAdditionalCaretsVisible() const
3476{
3477 return SendMsg(2609, 0, 0) != 0;
3478}
3479
3480// How many selections are there?
3481int wxStyledTextCtrl::GetSelections() const
3482{
3483 return SendMsg(2570, 0, 0);
3484}
3485
3486// Clear selections to a single empty stream selection
3487void wxStyledTextCtrl::ClearSelections()
3488{
3489 SendMsg(2571, 0, 0);
3490}
3491
3492// Add a selection
3493int wxStyledTextCtrl::AddSelection(int caret, int anchor)
3494{
3495 return SendMsg(2573, caret, anchor);
3496}
3497
3498// Set the main selection
3499void wxStyledTextCtrl::SetMainSelection(int selection)
3500{
3501 SendMsg(2574, selection, 0);
3502}
3503
3504// Which selection is the main selection
3505int wxStyledTextCtrl::GetMainSelection() const
3506{
3507 return SendMsg(2575, 0, 0);
3508}
3509void wxStyledTextCtrl::SetSelectionNCaret(int selection, int pos)
3510{
3511 SendMsg(2576, selection, pos);
3512}
3513int wxStyledTextCtrl::GetSelectionNCaret(int selection) const
3514{
3515 return SendMsg(2577, selection, 0);
3516}
3517void wxStyledTextCtrl::SetSelectionNAnchor(int selection, int posAnchor)
3518{
3519 SendMsg(2578, selection, posAnchor);
3520}
3521int wxStyledTextCtrl::GetSelectionNAnchor(int selection) const
3522{
3523 return SendMsg(2579, selection, 0);
3524}
3525void wxStyledTextCtrl::SetSelectionNCaretVirtualSpace(int selection, int space)
3526{
3527 SendMsg(2580, selection, space);
3528}
3529int wxStyledTextCtrl::GetSelectionNCaretVirtualSpace(int selection) const
3530{
3531 return SendMsg(2581, selection, 0);
3532}
3533void wxStyledTextCtrl::SetSelectionNAnchorVirtualSpace(int selection, int space)
3534{
3535 SendMsg(2582, selection, space);
3536}
3537int wxStyledTextCtrl::GetSelectionNAnchorVirtualSpace(int selection) const
3538{
3539 return SendMsg(2583, selection, 0);
3540}
3541
3542// Sets the position that starts the selection - this becomes the anchor.
3543void wxStyledTextCtrl::SetSelectionNStart(int selection, int pos)
3544{
3545 SendMsg(2584, selection, pos);
3546}
3547
3548// Returns the position at the start of the selection.
3549int wxStyledTextCtrl::GetSelectionNStart(int selection) const
3550{
3551 return SendMsg(2585, selection, 0);
3552}
3553
3554// Sets the position that ends the selection - this becomes the currentPosition.
3555void wxStyledTextCtrl::SetSelectionNEnd(int selection, int pos)
3556{
3557 SendMsg(2586, selection, pos);
3558}
3559
3560// Returns the position at the end of the selection.
3561int wxStyledTextCtrl::GetSelectionNEnd(int selection) const
3562{
3563 return SendMsg(2587, selection, 0);
3564}
3565void wxStyledTextCtrl::SetRectangularSelectionCaret(int pos)
3566{
3567 SendMsg(2588, pos, 0);
3568}
3569int wxStyledTextCtrl::GetRectangularSelectionCaret() const
3570{
3571 return SendMsg(2589, 0, 0);
3572}
3573void wxStyledTextCtrl::SetRectangularSelectionAnchor(int posAnchor)
3574{
3575 SendMsg(2590, posAnchor, 0);
3576}
3577int wxStyledTextCtrl::GetRectangularSelectionAnchor() const
3578{
3579 return SendMsg(2591, 0, 0);
3580}
3581void wxStyledTextCtrl::SetRectangularSelectionCaretVirtualSpace(int space)
3582{
3583 SendMsg(2592, space, 0);
3584}
3585int wxStyledTextCtrl::GetRectangularSelectionCaretVirtualSpace() const
3586{
3587 return SendMsg(2593, 0, 0);
3588}
3589void wxStyledTextCtrl::SetRectangularSelectionAnchorVirtualSpace(int space)
3590{
3591 SendMsg(2594, space, 0);
3592}
3593int wxStyledTextCtrl::GetRectangularSelectionAnchorVirtualSpace() const
3594{
3595 return SendMsg(2595, 0, 0);
3596}
3597void wxStyledTextCtrl::SetVirtualSpaceOptions(int virtualSpaceOptions)
3598{
3599 SendMsg(2596, virtualSpaceOptions, 0);
3600}
3601int wxStyledTextCtrl::GetVirtualSpaceOptions() const
3602{
3603 return SendMsg(2597, 0, 0);
3604}
3605
3606// On GTK+, allow selecting the modifier key to use for mouse-based
3607// rectangular selection. Often the window manager requires Alt+Mouse Drag
3608// for moving windows.
3609// Valid values are SCMOD_CTRL(default), SCMOD_ALT, or SCMOD_SUPER.
3610void wxStyledTextCtrl::SetRectangularSelectionModifier(int modifier)
3611{
3612 SendMsg(2598, modifier, 0);
3613}
3614
3615// Get the modifier key used for rectangular selection.
3616int wxStyledTextCtrl::GetRectangularSelectionModifier() const
3617{
3618 return SendMsg(2599, 0, 0);
3619}
3620
3621// Set the foreground colour of additional selections.
3622// Must have previously called SetSelFore with non-zero first argument for this to have an effect.
3623void wxStyledTextCtrl::SetAdditionalSelForeground(const wxColour& fore)
3624{
3625 SendMsg(2600, wxColourAsLong(fore), 0);
3626}
3627
3628// Set the background colour of additional selections.
3629// Must have previously called SetSelBack with non-zero first argument for this to have an effect.
3630void wxStyledTextCtrl::SetAdditionalSelBackground(const wxColour& back)
3631{
3632 SendMsg(2601, wxColourAsLong(back), 0);
3633}
3634
3635// Set the alpha of the selection.
3636void wxStyledTextCtrl::SetAdditionalSelAlpha(int alpha)
3637{
3638 SendMsg(2602, alpha, 0);
3639}
3640
3641// Get the alpha of the selection.
3642int wxStyledTextCtrl::GetAdditionalSelAlpha() const
3643{
3644 return SendMsg(2603, 0, 0);
3645}
3646
3647// Set the foreground colour of additional carets.
3648void wxStyledTextCtrl::SetAdditionalCaretForeground(const wxColour& fore)
3649{
3650 SendMsg(2604, wxColourAsLong(fore), 0);
3651}
3652
3653// Get the foreground colour of additional carets.
3654wxColour wxStyledTextCtrl::GetAdditionalCaretForeground() const
3655{
3656 long c = SendMsg(2605, 0, 0);
3657 return wxColourFromLong(c);
3658}
3659
3660// Set the main selection to the next selection.
3661void wxStyledTextCtrl::RotateSelection()
3662{
3663 SendMsg(2606, 0, 0);
3664}
3665
3666// Swap that caret and anchor of the main selection.
3667void wxStyledTextCtrl::SwapMainAnchorCaret()
3668{
3669 SendMsg(2607, 0, 0);
3670}
3671
4370573a 3672// Start notifying the container of all key presses and commands.
8e0945da
VZ
3673void wxStyledTextCtrl::StartRecord()
3674{
4370573a
RD
3675 SendMsg(3001, 0, 0);
3676}
67003d1a 3677
4370573a 3678// Stop notifying the container of all key presses and commands.
8e0945da
VZ
3679void wxStyledTextCtrl::StopRecord()
3680{
4370573a 3681 SendMsg(3002, 0, 0);
67003d1a
RD
3682}
3683
4370573a 3684// Set the lexing language of the document.
8e0945da
VZ
3685void wxStyledTextCtrl::SetLexer(int lexer)
3686{
4370573a
RD
3687 SendMsg(4001, lexer, 0);
3688}
67003d1a 3689
4370573a 3690// Retrieve the lexing language of the document.
8e0945da
VZ
3691int wxStyledTextCtrl::GetLexer() const
3692{
4370573a 3693 return SendMsg(4002, 0, 0);
67003d1a
RD
3694}
3695
4370573a 3696// Colourise a segment of the document using the current lexing language.
8e0945da
VZ
3697void wxStyledTextCtrl::Colourise(int start, int end)
3698{
4370573a
RD
3699 SendMsg(4003, start, end);
3700}
67003d1a 3701
4370573a 3702// Set up a value that may be used by a lexer for some optional feature.
8e0945da
VZ
3703void wxStyledTextCtrl::SetProperty(const wxString& key, const wxString& value)
3704{
b796ba39 3705 SendMsg(4004, (sptr_t)(const char*)wx2stc(key), (sptr_t)(const char*)wx2stc(value));
f6bcfd97
BP
3706}
3707
4370573a 3708// Set up the key words used by the lexer.
8e0945da
VZ
3709void wxStyledTextCtrl::SetKeyWords(int keywordSet, const wxString& keyWords)
3710{
b796ba39 3711 SendMsg(4005, keywordSet, (sptr_t)(const char*)wx2stc(keyWords));
4370573a 3712}
f6bcfd97 3713
65ec6247 3714// Set the lexing language of the document based on string name.
8e0945da
VZ
3715void wxStyledTextCtrl::SetLexerLanguage(const wxString& language)
3716{
b796ba39 3717 SendMsg(4006, 0, (sptr_t)(const char*)wx2stc(language));
65ec6247
RD
3718}
3719
1e9bafca
RD
3720// Retrieve a 'property' value previously set with SetProperty.
3721wxString wxStyledTextCtrl::GetProperty(const wxString& key) {
b796ba39 3722 int len = SendMsg(SCI_GETPROPERTY, (sptr_t)(const char*)wx2stc(key), 0);
1e9bafca
RD
3723 if (!len) return wxEmptyString;
3724
3725 wxMemoryBuffer mbuf(len+1);
3726 char* buf = (char*)mbuf.GetWriteBuf(len+1);
b796ba39 3727 SendMsg(4008, (uptr_t)(const char*)wx2stc(key), (sptr_t)buf);
1e9bafca
RD
3728 mbuf.UngetWriteBuf(len);
3729 mbuf.AppendByte(0);
3730 return stc2wx(buf);
3731}
3732
3733// Retrieve a 'property' value previously set with SetProperty,
3734// with '$()' variable replacement on returned buffer.
3735wxString wxStyledTextCtrl::GetPropertyExpanded(const wxString& key) {
b796ba39 3736 int len = SendMsg(SCI_GETPROPERTYEXPANDED, (uptr_t)(const char*)wx2stc(key), 0);
1e9bafca
RD
3737 if (!len) return wxEmptyString;
3738
3739 wxMemoryBuffer mbuf(len+1);
3740 char* buf = (char*)mbuf.GetWriteBuf(len+1);
b796ba39 3741 SendMsg(4009, (uptr_t)(const char*)wx2stc(key), (sptr_t)buf);
1e9bafca
RD
3742 mbuf.UngetWriteBuf(len);
3743 mbuf.AppendByte(0);
3744 return stc2wx(buf);
3745}
3746
3747// Retrieve a 'property' value previously set with SetProperty,
3748// interpreted as an int AFTER any '$()' variable replacement.
8e0945da
VZ
3749int wxStyledTextCtrl::GetPropertyInt(const wxString& key) const
3750{
b796ba39 3751 return SendMsg(4010, (sptr_t)(const char*)wx2stc(key), 0);
1e9bafca
RD
3752}
3753
3754// Retrieve the number of bits the current lexer needs for styling.
8e0945da
VZ
3755int wxStyledTextCtrl::GetStyleBitsNeeded() const
3756{
1e9bafca
RD
3757 return SendMsg(4011, 0, 0);
3758}
3759
a5c2ccf2 3760//}}}
f6bcfd97 3761//----------------------------------------------------------------------
f6bcfd97
BP
3762
3763
4370573a
RD
3764// Returns the line number of the line with the caret.
3765int wxStyledTextCtrl::GetCurrentLine() {
3766 int line = LineFromPosition(GetCurrentPos());
3767 return line;
f6bcfd97
BP
3768}
3769
3770
4370573a
RD
3771// Extract style settings from a spec-string which is composed of one or
3772// more of the following comma separated elements:
3773//
3774// bold turns on bold
3775// italic turns on italics
5ee1d760
RD
3776// fore:[name or #RRGGBB] sets the foreground colour
3777// back:[name or #RRGGBB] sets the background colour
4370573a
RD
3778// face:[facename] sets the font face name to use
3779// size:[num] sets the font size in points
3780// eol turns on eol filling
3781// underline turns on underlining
3782//
3783void wxStyledTextCtrl::StyleSetSpec(int styleNum, const wxString& spec) {
3784
451c5cc7 3785 wxStringTokenizer tkz(spec, wxT(","));
4370573a
RD
3786 while (tkz.HasMoreTokens()) {
3787 wxString token = tkz.GetNextToken();
f6bcfd97 3788
4370573a
RD
3789 wxString option = token.BeforeFirst(':');
3790 wxString val = token.AfterFirst(':');
f6bcfd97 3791
451c5cc7 3792 if (option == wxT("bold"))
4370573a 3793 StyleSetBold(styleNum, true);
f6bcfd97 3794
451c5cc7 3795 else if (option == wxT("italic"))
4370573a 3796 StyleSetItalic(styleNum, true);
9ce192d4 3797
451c5cc7 3798 else if (option == wxT("underline"))
4370573a 3799 StyleSetUnderline(styleNum, true);
9ce192d4 3800
451c5cc7 3801 else if (option == wxT("eol"))
4370573a 3802 StyleSetEOLFilled(styleNum, true);
9ce192d4 3803
451c5cc7 3804 else if (option == wxT("size")) {
4370573a
RD
3805 long points;
3806 if (val.ToLong(&points))
3807 StyleSetSize(styleNum, points);
3808 }
9ce192d4 3809
451c5cc7 3810 else if (option == wxT("face"))
4370573a 3811 StyleSetFaceName(styleNum, val);
9ce192d4 3812
451c5cc7 3813 else if (option == wxT("fore"))
4370573a 3814 StyleSetForeground(styleNum, wxColourFromSpec(val));
9ce192d4 3815
451c5cc7 3816 else if (option == wxT("back"))
4370573a
RD
3817 StyleSetBackground(styleNum, wxColourFromSpec(val));
3818 }
9ce192d4
RD
3819}
3820
3821
7e0c58e9
RD
3822// Get the font of a style
3823wxFont wxStyledTextCtrl::StyleGetFont(int style) {
3824 wxFont font;
3825 font.SetPointSize(StyleGetSize(style));
3826 font.SetFaceName(StyleGetFaceName(style));
3827 if( StyleGetBold(style) )
3828 font.SetWeight(wxFONTWEIGHT_BOLD);
3829 else
3830 font.SetWeight(wxFONTWEIGHT_NORMAL);
3831
3832 if( StyleGetItalic(style) )
3833 font.SetStyle(wxFONTSTYLE_ITALIC);
3834 else
3835 font.SetStyle(wxFONTSTYLE_NORMAL);
3836
3837 return font;
3838}
3839
3840
4370573a
RD
3841// Set style size, face, bold, italic, and underline attributes from
3842// a wxFont's attributes.
3843void wxStyledTextCtrl::StyleSetFont(int styleNum, wxFont& font) {
7475e814
RD
3844#ifdef __WXGTK__
3845 // Ensure that the native font is initialized
3846 int x, y;
3847 GetTextExtent(wxT("X"), &x, &y, NULL, NULL, &font);
3848#endif
af0531a5
RD
3849 int size = font.GetPointSize();
3850 wxString faceName = font.GetFaceName();
3851 bool bold = font.GetWeight() == wxBOLD;
3852 bool italic = font.GetStyle() != wxNORMAL;
3853 bool under = font.GetUnderlined();
c5bd09bf 3854 wxFontEncoding encoding = font.GetEncoding();
7e0c58e9 3855
af0531a5 3856 StyleSetFontAttr(styleNum, size, faceName, bold, italic, under, encoding);
9ce192d4
RD
3857}
3858
4370573a
RD
3859// Set all font style attributes at once.
3860void wxStyledTextCtrl::StyleSetFontAttr(int styleNum, int size,
3861 const wxString& faceName,
3862 bool bold, bool italic,
3727c043
RD
3863 bool underline,
3864 wxFontEncoding encoding) {
4370573a
RD
3865 StyleSetSize(styleNum, size);
3866 StyleSetFaceName(styleNum, faceName);
3867 StyleSetBold(styleNum, bold);
3868 StyleSetItalic(styleNum, italic);
3869 StyleSetUnderline(styleNum, underline);
3727c043
RD
3870 StyleSetFontEncoding(styleNum, encoding);
3871}
9ce192d4 3872
3727c043
RD
3873
3874// Set the character set of the font in a style. Converts the Scintilla
3875// character set values to a wxFontEncoding.
3876void wxStyledTextCtrl::StyleSetCharacterSet(int style, int characterSet)
3877{
3878 wxFontEncoding encoding;
3879
3880 // Translate the Scintilla characterSet to a wxFontEncoding
3881 switch (characterSet) {
3882 default:
3883 case wxSTC_CHARSET_ANSI:
3884 case wxSTC_CHARSET_DEFAULT:
3885 encoding = wxFONTENCODING_DEFAULT;
3886 break;
3887
3888 case wxSTC_CHARSET_BALTIC:
3889 encoding = wxFONTENCODING_ISO8859_13;
3890 break;
3891
3892 case wxSTC_CHARSET_CHINESEBIG5:
3893 encoding = wxFONTENCODING_CP950;
3894 break;
3895
3896 case wxSTC_CHARSET_EASTEUROPE:
3897 encoding = wxFONTENCODING_ISO8859_2;
3898 break;
3899
3900 case wxSTC_CHARSET_GB2312:
3901 encoding = wxFONTENCODING_CP936;
3902 break;
3903
3904 case wxSTC_CHARSET_GREEK:
3905 encoding = wxFONTENCODING_ISO8859_7;
3906 break;
3907
3908 case wxSTC_CHARSET_HANGUL:
3909 encoding = wxFONTENCODING_CP949;
3910 break;
3911
3912 case wxSTC_CHARSET_MAC:
3913 encoding = wxFONTENCODING_DEFAULT;
3914 break;
3915
3916 case wxSTC_CHARSET_OEM:
3917 encoding = wxFONTENCODING_DEFAULT;
3918 break;
3919
3920 case wxSTC_CHARSET_RUSSIAN:
3921 encoding = wxFONTENCODING_KOI8;
3922 break;
3923
3924 case wxSTC_CHARSET_SHIFTJIS:
3925 encoding = wxFONTENCODING_CP932;
3926 break;
3927
3928 case wxSTC_CHARSET_SYMBOL:
3929 encoding = wxFONTENCODING_DEFAULT;
3930 break;
3931
3932 case wxSTC_CHARSET_TURKISH:
3933 encoding = wxFONTENCODING_ISO8859_9;
3934 break;
3935
3936 case wxSTC_CHARSET_JOHAB:
3937 encoding = wxFONTENCODING_DEFAULT;
3938 break;
3939
3940 case wxSTC_CHARSET_HEBREW:
3941 encoding = wxFONTENCODING_ISO8859_8;
3942 break;
3943
3944 case wxSTC_CHARSET_ARABIC:
3945 encoding = wxFONTENCODING_ISO8859_6;
3946 break;
3947
3948 case wxSTC_CHARSET_VIETNAMESE:
3949 encoding = wxFONTENCODING_DEFAULT;
3950 break;
3951
3952 case wxSTC_CHARSET_THAI:
3953 encoding = wxFONTENCODING_ISO8859_11;
3954 break;
1e9bafca
RD
3955
3956 case wxSTC_CHARSET_CYRILLIC:
3957 encoding = wxFONTENCODING_ISO8859_5;
3958 break;
7e0c58e9 3959
1e9bafca
RD
3960 case wxSTC_CHARSET_8859_15:
3961 encoding = wxFONTENCODING_ISO8859_15;;
3962 break;
3727c043
RD
3963 }
3964
3965 // We just have Scintilla track the wxFontEncoding for us. It gets used
3966 // in Font::Create in PlatWX.cpp. We add one to the value so that the
3967 // effective wxFONENCODING_DEFAULT == SC_SHARSET_DEFAULT and so when
3968 // Scintilla internally uses SC_CHARSET_DEFAULT we will translate it back
3969 // to wxFONENCODING_DEFAULT in Font::Create.
3970 SendMsg(SCI_STYLESETCHARACTERSET, style, encoding+1);
3971}
3972
3973
3974// Set the font encoding to be used by a style.
3975void wxStyledTextCtrl::StyleSetFontEncoding(int style, wxFontEncoding encoding)
3976{
3977 SendMsg(SCI_STYLESETCHARACTERSET, style, encoding+1);
9ce192d4
RD
3978}
3979
3980
4370573a
RD
3981// Perform one of the operations defined by the wxSTC_CMD_* constants.
3982void wxStyledTextCtrl::CmdKeyExecute(int cmd) {
3983 SendMsg(cmd);
9ce192d4
RD
3984}
3985
3986
4370573a
RD
3987// Set the left and right margin in the edit area, measured in pixels.
3988void wxStyledTextCtrl::SetMargins(int left, int right) {
3989 SetMarginLeft(left);
3990 SetMarginRight(right);
9ce192d4
RD
3991}
3992
3993
4370573a
RD
3994// Retrieve the point in the window where a position is displayed.
3995wxPoint wxStyledTextCtrl::PointFromPosition(int pos) {
3996 int x = SendMsg(SCI_POINTXFROMPOSITION, 0, pos);
3997 int y = SendMsg(SCI_POINTYFROMPOSITION, 0, pos);
3998 return wxPoint(x, y);
f6bcfd97
BP
3999}
4000
f97d84a6
RD
4001// Scroll enough to make the given line visible
4002void wxStyledTextCtrl::ScrollToLine(int line) {
4003 m_swx->DoScrollToLine(line);
4004}
4005
4006
4007// Scroll enough to make the given column visible
4008void wxStyledTextCtrl::ScrollToColumn(int column) {
4009 m_swx->DoScrollToColumn(column);
4010}
4011
f6bcfd97 4012
2bfca191 4013#if wxUSE_TEXTCTRL
3396739d
VZ
4014bool wxStyledTextCtrl::DoSaveFile(const wxString& filename, int fileType)
4015{
4016 bool ok = wxTextAreaBase::DoSaveFile(filename, fileType);
2bfca191 4017#else
51566b0b
RD
4018bool wxStyledTextCtrl::SaveFile(const wxString& filename)
4019{
3396739d
VZ
4020#if wxUSE_FFILE
4021 wxFFile file(filename, wxT("w"));
4022 bool ok = file.IsOpened() && file.Write(GetValue(), *wxConvCurrent);
4023#else
4024 bool ok = false;
4025#endif // wxUSE_FFILE
4026#endif
4027 if (ok)
4028 {
51566b0b 4029 SetSavePoint();
3396739d
VZ
4030 }
4031 return ok;
51566b0b
RD
4032}
4033
2bfca191 4034#if wxUSE_TEXTCTRL
3396739d
VZ
4035bool wxStyledTextCtrl::DoLoadFile(const wxString& filename, int fileType)
4036{
4037 bool ok = wxTextAreaBase::DoLoadFile(filename, fileType);
2bfca191 4038#else
51566b0b
RD
4039bool wxStyledTextCtrl::LoadFile(const wxString& filename)
4040{
3396739d
VZ
4041#if wxUSE_FFILE
4042 wxFFile file(filename);
4043 bool ok = file.IsOpened();
4044 if (ok)
51566b0b 4045 {
3396739d
VZ
4046 wxString text;
4047 ok = file.ReadAll(&text, *wxConvCurrent);
4048 if (ok)
041973c5 4049 {
3396739d 4050 SetValue(text);
041973c5 4051 }
51566b0b 4052 }
3396739d
VZ
4053#else
4054 bool ok = false;
4055#endif // wxUSE_FFILE
4056#endif
4057 if (ok)
4058 {
4059 EmptyUndoBuffer();
4060 SetSavePoint();
4061 }
4062 return ok;
51566b0b
RD
4063}
4064
2fcce896 4065#if wxUSE_DRAG_AND_DROP
7e126a07
WS
4066wxDragResult wxStyledTextCtrl::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) {
4067 return m_swx->DoDragOver(x, y, def);
4068}
4a65f2c8
RD
4069
4070
7e126a07 4071bool wxStyledTextCtrl::DoDropText(long x, long y, const wxString& data) {
4a65f2c8
RD
4072 return m_swx->DoDropText(x, y, data);
4073}
2fcce896 4074#endif
4a65f2c8
RD
4075
4076
d1558f3d
RD
4077void wxStyledTextCtrl::SetUseAntiAliasing(bool useAA) {
4078 m_swx->SetUseAntiAliasing(useAA);
4079}
4080
4081bool wxStyledTextCtrl::GetUseAntiAliasing() {
4082 return m_swx->GetUseAntiAliasing();
4083}
4084
41a499cd
RD
4085
4086
4087
4088
6f67e6d2 4089void wxStyledTextCtrl::AddTextRaw(const char* text, int length)
41a499cd 4090{
6f67e6d2
RD
4091 if (length == -1)
4092 length = strlen(text);
4093 SendMsg(SCI_ADDTEXT, length, (sptr_t)text);
41a499cd
RD
4094}
4095
4096void wxStyledTextCtrl::InsertTextRaw(int pos, const char* text)
4097{
b796ba39 4098 SendMsg(SCI_INSERTTEXT, pos, (sptr_t)text);
41a499cd
RD
4099}
4100
4101wxCharBuffer wxStyledTextCtrl::GetCurLineRaw(int* linePos)
4102{
4103 int len = LineLength(GetCurrentLine());
4104 if (!len) {
4105 if (linePos) *linePos = 0;
4106 wxCharBuffer empty;
4107 return empty;
4108 }
4109
4110 wxCharBuffer buf(len);
b796ba39 4111 int pos = SendMsg(SCI_GETCURLINE, len, (sptr_t)buf.data());
41a499cd
RD
4112 if (linePos) *linePos = pos;
4113 return buf;
4114}
4115
4116wxCharBuffer wxStyledTextCtrl::GetLineRaw(int line)
4117{
4118 int len = LineLength(line);
4119 if (!len) {
4120 wxCharBuffer empty;
4121 return empty;
4122 }
4123
4124 wxCharBuffer buf(len);
b796ba39 4125 SendMsg(SCI_GETLINE, line, (sptr_t)buf.data());
41a499cd
RD
4126 return buf;
4127}
4128
4129wxCharBuffer wxStyledTextCtrl::GetSelectedTextRaw()
4130{
fa70ec2b
RD
4131 long start;
4132 long end;
41a499cd
RD
4133
4134 GetSelection(&start, &end);
4135 int len = end - start;
4136 if (!len) {
4137 wxCharBuffer empty;
4138 return empty;
7e0c58e9 4139 }
41a499cd
RD
4140
4141 wxCharBuffer buf(len);
b796ba39 4142 SendMsg(SCI_GETSELTEXT, 0, (sptr_t)buf.data());
41a499cd
RD
4143 return buf;
4144}
4145
4146wxCharBuffer wxStyledTextCtrl::GetTextRangeRaw(int startPos, int endPos)
4147{
4148 if (endPos < startPos) {
4149 int temp = startPos;
4150 startPos = endPos;
4151 endPos = temp;
4152 }
4153 int len = endPos - startPos;
4154 if (!len) {
4155 wxCharBuffer empty;
4156 return empty;
7e0c58e9 4157 }
41a499cd
RD
4158
4159 wxCharBuffer buf(len);
4160 TextRange tr;
4161 tr.lpstrText = buf.data();
4162 tr.chrg.cpMin = startPos;
4163 tr.chrg.cpMax = endPos;
b796ba39 4164 SendMsg(SCI_GETTEXTRANGE, 0, (sptr_t)&tr);
41a499cd
RD
4165 return buf;
4166}
4167
4168void wxStyledTextCtrl::SetTextRaw(const char* text)
4169{
b796ba39 4170 SendMsg(SCI_SETTEXT, 0, (sptr_t)text);
41a499cd
RD
4171}
4172
4173wxCharBuffer wxStyledTextCtrl::GetTextRaw()
4174{
949750de
VZ
4175 int len = GetTextLength();
4176 wxCharBuffer buf(len); // adds 1 for NUL automatically
b796ba39 4177 SendMsg(SCI_GETTEXT, len + 1, (sptr_t)buf.data());
41a499cd
RD
4178 return buf;
4179}
4180
6f67e6d2 4181void wxStyledTextCtrl::AppendTextRaw(const char* text, int length)
41a499cd 4182{
6f67e6d2
RD
4183 if (length == -1)
4184 length = strlen(text);
4185 SendMsg(SCI_APPENDTEXT, length, (sptr_t)text);
41a499cd
RD
4186}
4187
4188
4189
4190
4191
9ce192d4
RD
4192//----------------------------------------------------------------------
4193// Event handlers
4194
88a8b04e 4195void wxStyledTextCtrl::OnPaint(wxPaintEvent& WXUNUSED(evt)) {
9ce192d4 4196 wxPaintDC dc(this);
9e730a78 4197 m_swx->DoPaint(&dc, GetUpdateRegion().GetBox());
9ce192d4
RD
4198}
4199
4200void wxStyledTextCtrl::OnScrollWin(wxScrollWinEvent& evt) {
4201 if (evt.GetOrientation() == wxHORIZONTAL)
4202 m_swx->DoHScroll(evt.GetEventType(), evt.GetPosition());
4203 else
4204 m_swx->DoVScroll(evt.GetEventType(), evt.GetPosition());
4205}
4206
5fa4613c
RD
4207void wxStyledTextCtrl::OnScroll(wxScrollEvent& evt) {
4208 wxScrollBar* sb = wxDynamicCast(evt.GetEventObject(), wxScrollBar);
4209 if (sb) {
4210 if (sb->IsVertical())
4211 m_swx->DoVScroll(evt.GetEventType(), evt.GetPosition());
4212 else
4213 m_swx->DoHScroll(evt.GetEventType(), evt.GetPosition());
4214 }
4215}
4216
88a8b04e 4217void wxStyledTextCtrl::OnSize(wxSizeEvent& WXUNUSED(evt)) {
39c0acb6
RD
4218 if (m_swx) {
4219 wxSize sz = GetClientSize();
4220 m_swx->DoSize(sz.x, sz.y);
4221 }
9ce192d4
RD
4222}
4223
4224void wxStyledTextCtrl::OnMouseLeftDown(wxMouseEvent& evt) {
cb1871ca 4225 SetFocus();
9ce192d4 4226 wxPoint pt = evt.GetPosition();
2b5f62a0 4227 m_swx->DoLeftButtonDown(Point(pt.x, pt.y), m_stopWatch.Time(),
9ce192d4
RD
4228 evt.ShiftDown(), evt.ControlDown(), evt.AltDown());
4229}
4230
4231void wxStyledTextCtrl::OnMouseMove(wxMouseEvent& evt) {
4232 wxPoint pt = evt.GetPosition();
2b5f62a0 4233 m_swx->DoLeftButtonMove(Point(pt.x, pt.y));
9ce192d4
RD
4234}
4235
4236void wxStyledTextCtrl::OnMouseLeftUp(wxMouseEvent& evt) {
4237 wxPoint pt = evt.GetPosition();
2b5f62a0 4238 m_swx->DoLeftButtonUp(Point(pt.x, pt.y), m_stopWatch.Time(),
9ce192d4
RD
4239 evt.ControlDown());
4240}
4241
4242
ddf2da08
RD
4243void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent& evt) {
4244 wxPoint pt = evt.GetPosition();
4245 m_swx->DoContextMenu(Point(pt.x, pt.y));
4246}
4247
4248
2b5f62a0
VZ
4249void wxStyledTextCtrl::OnMouseMiddleUp(wxMouseEvent& evt) {
4250 wxPoint pt = evt.GetPosition();
4251 m_swx->DoMiddleButtonUp(Point(pt.x, pt.y));
4252}
4253
65ec6247 4254void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent& evt) {
9ce192d4 4255 wxPoint pt = evt.GetPosition();
65ec6247 4256 ScreenToClient(&pt.x, &pt.y);
25484746
RD
4257 /*
4258 Show context menu at event point if it's within the window,
4259 or at caret location if not
4260 */
4261 wxHitTest ht = this->HitTest(pt);
4262 if (ht != wxHT_WINDOW_INSIDE) {
4263 pt = this->PointFromPosition(this->GetCurrentPos());
4264 }
9ce192d4
RD
4265 m_swx->DoContextMenu(Point(pt.x, pt.y));
4266}
4267
37d62433 4268
60957703
VZ
4269void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt)
4270{
7bd21328
VZ
4271 // Prevent having an event queue with wheel events that cannot be processed
4272 // reasonably fast (see ticket #9057) by ignoring all of them that happen
4273 // during the time interval corresponding to the time it took us to handle
4274 // the last one.
4275 //
4276 // Notice the use of TimeInMicro() instead of Time() to avoid overflow in
4277 // long running programs.
4278 if ( m_timeToBlockWheelEventsUntil <= m_stopWatch.TimeInMicro() )
60957703 4279 {
7bd21328 4280 const wxLongLong beforeMouseWheel = m_stopWatch.TimeInMicro();
60957703
VZ
4281 m_swx->DoMouseWheel(evt.GetWheelRotation(),
4282 evt.GetWheelDelta(),
4283 evt.GetLinesPerAction(),
4284 evt.ControlDown(),
4285 evt.IsPageScroll());
7bd21328
VZ
4286 const wxLongLong afterMouseWheel = m_stopWatch.TimeInMicro();
4287 m_timeToBlockWheelEventsUntil = afterMouseWheel;
4288 m_timeToBlockWheelEventsUntil += afterMouseWheel - beforeMouseWheel;
60957703 4289 }
37d62433
RD
4290}
4291
4292
9ce192d4 4293void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) {
5fd656d5 4294 // On (some?) non-US PC keyboards the AltGr key is required to enter some
f3c2c221
RD
4295 // common characters. It comes to us as both Alt and Ctrl down so we need
4296 // to let the char through in that case, otherwise if only ctrl or only
4297 // alt let's skip it.
4298 bool ctrl = evt.ControlDown();
28e0c28e
RD
4299#ifdef __WXMAC__
4300 // On the Mac the Alt key is just a modifier key (like Shift) so we need
4301 // to allow the char events to be processed when Alt is pressed.
4302 // TODO: Should we check MetaDown instead in this case?
4303 bool alt = false;
4304#else
f3c2c221 4305 bool alt = evt.AltDown();
28e0c28e 4306#endif
00c64037 4307 bool skip = ((ctrl || alt) && ! (ctrl && alt));
f3c2c221 4308
a0421c77
RD
4309#if wxUSE_UNICODE
4310 // apparently if we don't do this, Unicode keys pressed after non-char
4311 // ASCII ones (e.g. Enter, Tab) are not taken into account (patch 1615989)
4312 if (m_lastKeyDownConsumed && evt.GetUnicodeKey() > 255)
4313 m_lastKeyDownConsumed = false;
4314#endif
4315
5fd656d5
RD
4316 if (!m_lastKeyDownConsumed && !skip) {
4317#if wxUSE_UNICODE
4318 int key = evt.GetUnicodeKey();
4319 bool keyOk = true;
4320
4321 // if the unicode key code is not really a unicode character (it may
4322 // be a function key or etc., the platforms appear to always give us a
4323 // small value in this case) then fallback to the ascii key code but
4324 // don't do anything for function keys or etc.
1b14227e 4325 if (key <= 127) {
5fd656d5 4326 key = evt.GetKeyCode();
1b14227e 4327 keyOk = (key <= 127);
5fd656d5
RD
4328 }
4329 if (keyOk) {
4330 m_swx->DoAddChar(key);
4331 return;
4332 }
4333#else
4334 int key = evt.GetKeyCode();
4335 if (key <= WXK_START || key > WXK_COMMAND) {
4336 m_swx->DoAddChar(key);
4337 return;
4338 }
4339#endif
d25f5fbb 4340 }
7e0c58e9 4341
f3c2c221 4342 evt.Skip();
f6bcfd97
BP
4343}
4344
d6582821 4345
f6bcfd97 4346void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) {
5fd656d5 4347 int processed = m_swx->DoKeyDown(evt, &m_lastKeyDownConsumed);
d6582821 4348 if (!processed && !m_lastKeyDownConsumed)
9ce192d4
RD
4349 evt.Skip();
4350}
4351
d6582821 4352
b6bfd8e8 4353void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& evt) {
ec830416 4354 m_swx->DoLoseFocus();
b6bfd8e8 4355 evt.Skip();
9ce192d4
RD
4356}
4357
d6582821 4358
b6bfd8e8 4359void wxStyledTextCtrl::OnGainFocus(wxFocusEvent& evt) {
9ce192d4 4360 m_swx->DoGainFocus();
b6bfd8e8 4361 evt.Skip();
9ce192d4
RD
4362}
4363
d6582821 4364
88a8b04e 4365void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(evt)) {
9ce192d4
RD
4366 m_swx->DoSysColourChange();
4367}
4368
d6582821 4369
88a8b04e 4370void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent& WXUNUSED(evt)) {
9ce192d4
RD
4371 // do nothing to help avoid flashing
4372}
4373
4374
4375
4376void wxStyledTextCtrl::OnMenu(wxCommandEvent& evt) {
4377 m_swx->DoCommand(evt.GetId());
4378}
4379
4380
88a8b04e 4381void wxStyledTextCtrl::OnListBox(wxCommandEvent& WXUNUSED(evt)) {
f6bcfd97
BP
4382 m_swx->DoOnListBox();
4383}
4384
4385
8e54aaed
RD
4386void wxStyledTextCtrl::OnIdle(wxIdleEvent& evt) {
4387 m_swx->DoOnIdle(evt);
4388}
4389
4390
8ae4f086
RD
4391wxSize wxStyledTextCtrl::DoGetBestSize() const
4392{
4393 // What would be the best size for a wxSTC?
4394 // Just give a reasonable minimum until something else can be figured out.
4395 return wxSize(200,100);
4396}
4397
4398
9ce192d4
RD
4399//----------------------------------------------------------------------
4400// Turn notifications from Scintilla into events
4401
f6bcfd97 4402
9ce192d4
RD
4403void wxStyledTextCtrl::NotifyChange() {
4404 wxStyledTextEvent evt(wxEVT_STC_CHANGE, GetId());
a29a241f 4405 evt.SetEventObject(this);
9ce192d4
RD
4406 GetEventHandler()->ProcessEvent(evt);
4407}
4408
2b5f62a0
VZ
4409
4410static void SetEventText(wxStyledTextEvent& evt, const char* text,
4411 size_t length) {
4412 if(!text) return;
4413
1c930beb 4414 evt.SetText(stc2wx(text, length));
2b5f62a0
VZ
4415}
4416
4417
9ce192d4
RD
4418void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
4419 SCNotification& scn = *_scn;
65ec6247
RD
4420 wxStyledTextEvent evt(0, GetId());
4421
a29a241f 4422 evt.SetEventObject(this);
65ec6247
RD
4423 evt.SetPosition(scn.position);
4424 evt.SetKey(scn.ch);
4425 evt.SetModifiers(scn.modifiers);
4426
9ce192d4
RD
4427 switch (scn.nmhdr.code) {
4428 case SCN_STYLENEEDED:
65ec6247 4429 evt.SetEventType(wxEVT_STC_STYLENEEDED);
9ce192d4 4430 break;
65ec6247 4431
9ce192d4 4432 case SCN_CHARADDED:
65ec6247 4433 evt.SetEventType(wxEVT_STC_CHARADDED);
9ce192d4 4434 break;
65ec6247 4435
9ce192d4 4436 case SCN_SAVEPOINTREACHED:
65ec6247 4437 evt.SetEventType(wxEVT_STC_SAVEPOINTREACHED);
9ce192d4 4438 break;
65ec6247 4439
9ce192d4 4440 case SCN_SAVEPOINTLEFT:
65ec6247 4441 evt.SetEventType(wxEVT_STC_SAVEPOINTLEFT);
9ce192d4 4442 break;
65ec6247 4443
9ce192d4 4444 case SCN_MODIFYATTEMPTRO:
65ec6247 4445 evt.SetEventType(wxEVT_STC_ROMODIFYATTEMPT);
9ce192d4 4446 break;
65ec6247
RD
4447
4448 case SCN_KEY:
4449 evt.SetEventType(wxEVT_STC_KEY);
4450 break;
4451
9ce192d4 4452 case SCN_DOUBLECLICK:
65ec6247 4453 evt.SetEventType(wxEVT_STC_DOUBLECLICK);
9ce192d4 4454 break;
65ec6247
RD
4455
4456 case SCN_UPDATEUI:
4457 evt.SetEventType(wxEVT_STC_UPDATEUI);
9ce192d4 4458 break;
65ec6247
RD
4459
4460 case SCN_MODIFIED:
4461 evt.SetEventType(wxEVT_STC_MODIFIED);
4462 evt.SetModificationType(scn.modificationType);
2b5f62a0 4463 SetEventText(evt, scn.text, scn.length);
65ec6247
RD
4464 evt.SetLength(scn.length);
4465 evt.SetLinesAdded(scn.linesAdded);
4466 evt.SetLine(scn.line);
4467 evt.SetFoldLevelNow(scn.foldLevelNow);
4468 evt.SetFoldLevelPrev(scn.foldLevelPrev);
9ce192d4 4469 break;
65ec6247 4470
9ce192d4 4471 case SCN_MACRORECORD:
65ec6247
RD
4472 evt.SetEventType(wxEVT_STC_MACRORECORD);
4473 evt.SetMessage(scn.message);
4474 evt.SetWParam(scn.wParam);
4475 evt.SetLParam(scn.lParam);
9ce192d4 4476 break;
65ec6247 4477
9ce192d4 4478 case SCN_MARGINCLICK:
65ec6247
RD
4479 evt.SetEventType(wxEVT_STC_MARGINCLICK);
4480 evt.SetMargin(scn.margin);
9ce192d4 4481 break;
65ec6247 4482
9ce192d4 4483 case SCN_NEEDSHOWN:
65ec6247
RD
4484 evt.SetEventType(wxEVT_STC_NEEDSHOWN);
4485 evt.SetLength(scn.length);
9ce192d4 4486 break;
65ec6247 4487
65ec6247
RD
4488 case SCN_PAINTED:
4489 evt.SetEventType(wxEVT_STC_PAINTED);
4490 break;
4491
0daf5e6b
RD
4492 case SCN_AUTOCSELECTION:
4493 evt.SetEventType(wxEVT_STC_AUTOCOMP_SELECTION);
4494 evt.SetListType(scn.listType);
4495 SetEventText(evt, scn.text, strlen(scn.text));
4496 evt.SetPosition(scn.lParam);
4497 break;
7e0c58e9 4498
65ec6247
RD
4499 case SCN_USERLISTSELECTION:
4500 evt.SetEventType(wxEVT_STC_USERLISTSELECTION);
4501 evt.SetListType(scn.listType);
2b5f62a0 4502 SetEventText(evt, scn.text, strlen(scn.text));
0daf5e6b 4503 evt.SetPosition(scn.lParam);
65ec6247
RD
4504 break;
4505
4506 case SCN_URIDROPPED:
4507 evt.SetEventType(wxEVT_STC_URIDROPPED);
2b5f62a0 4508 SetEventText(evt, scn.text, strlen(scn.text));
65ec6247
RD
4509 break;
4510
4511 case SCN_DWELLSTART:
4512 evt.SetEventType(wxEVT_STC_DWELLSTART);
4513 evt.SetX(scn.x);
4514 evt.SetY(scn.y);
4515 break;
4516
4517 case SCN_DWELLEND:
4518 evt.SetEventType(wxEVT_STC_DWELLEND);
4519 evt.SetX(scn.x);
4520 evt.SetY(scn.y);
4521 break;
4522
a834585d
RD
4523 case SCN_ZOOM:
4524 evt.SetEventType(wxEVT_STC_ZOOM);
4525 break;
4526
9e730a78
RD
4527 case SCN_HOTSPOTCLICK:
4528 evt.SetEventType(wxEVT_STC_HOTSPOT_CLICK);
4529 break;
4530
4531 case SCN_HOTSPOTDOUBLECLICK:
4532 evt.SetEventType(wxEVT_STC_HOTSPOT_DCLICK);
4533 break;
4534
4535 case SCN_CALLTIPCLICK:
4536 evt.SetEventType(wxEVT_STC_CALLTIP_CLICK);
4537 break;
7e0c58e9
RD
4538
4539 case SCN_INDICATORCLICK:
4540 evt.SetEventType(wxEVT_STC_INDICATOR_CLICK);
4541 break;
4542
4543 case SCN_INDICATORRELEASE:
4544 evt.SetEventType(wxEVT_STC_INDICATOR_RELEASE);
4545 break;
4546
9e96e16f
RD
4547 case SCN_AUTOCCANCELLED:
4548 evt.SetEventType(wxEVT_STC_AUTOCOMP_CANCELLED);
4549 break;
4550
4551 case SCN_AUTOCCHARDELETED:
4552 evt.SetEventType(wxEVT_STC_AUTOCOMP_CHAR_DELETED);
4553 break;
4554
65ec6247
RD
4555 default:
4556 return;
9ce192d4 4557 }
65ec6247
RD
4558
4559 GetEventHandler()->ProcessEvent(evt);
9ce192d4
RD
4560}
4561
4562
9ce192d4
RD
4563//----------------------------------------------------------------------
4564//----------------------------------------------------------------------
4565//----------------------------------------------------------------------
4566
4567wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType, int id)
4568 : wxCommandEvent(commandType, id)
4569{
4570 m_position = 0;
4571 m_key = 0;
4572 m_modifiers = 0;
4573 m_modificationType = 0;
4574 m_length = 0;
4575 m_linesAdded = 0;
4576 m_line = 0;
4577 m_foldLevelNow = 0;
4578 m_foldLevelPrev = 0;
4579 m_margin = 0;
4580 m_message = 0;
4581 m_wParam = 0;
4582 m_lParam = 0;
65ec6247
RD
4583 m_listType = 0;
4584 m_x = 0;
4585 m_y = 0;
92bbd64f 4586#if wxUSE_DRAG_AND_DROP
35f8d83d 4587 m_dragFlags = wxDrag_CopyOnly;
a29a241f 4588 m_dragResult = wxDragNone;
92bbd64f 4589#endif
9ce192d4
RD
4590}
4591
4592bool wxStyledTextEvent::GetShift() const { return (m_modifiers & SCI_SHIFT) != 0; }
4593bool wxStyledTextEvent::GetControl() const { return (m_modifiers & SCI_CTRL) != 0; }
4594bool wxStyledTextEvent::GetAlt() const { return (m_modifiers & SCI_ALT) != 0; }
4595
5fa4613c 4596
41286fd1
JS
4597wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent& event):
4598 wxCommandEvent(event)
4599{
4600 m_position = event.m_position;
4601 m_key = event.m_key;
4602 m_modifiers = event.m_modifiers;
4603 m_modificationType = event.m_modificationType;
4604 m_text = event.m_text;
4605 m_length = event.m_length;
4606 m_linesAdded = event.m_linesAdded;
4607 m_line = event.m_line;
4608 m_foldLevelNow = event.m_foldLevelNow;
4609 m_foldLevelPrev = event.m_foldLevelPrev;
4610
4611 m_margin = event.m_margin;
4612
4613 m_message = event.m_message;
4614 m_wParam = event.m_wParam;
4615 m_lParam = event.m_lParam;
4616
4617 m_listType = event.m_listType;
4618 m_x = event.m_x;
4619 m_y = event.m_y;
9ce192d4 4620
92bbd64f 4621#if wxUSE_DRAG_AND_DROP
35f8d83d
VZ
4622 m_dragText = event.m_dragText;
4623 m_dragFlags = event.m_dragFlags;
41286fd1 4624 m_dragResult = event.m_dragResult;
92bbd64f 4625#endif
9ce192d4
RD
4626}
4627
4628//----------------------------------------------------------------------
4629//----------------------------------------------------------------------
4630
ccec9093
VZ
4631/*static*/ wxVersionInfo wxStyledTextCtrl::GetLibraryVersionInfo()
4632{
9c1f960f 4633 return wxVersionInfo("Scintilla", 2, 3, 0, "Scintilla 2.03");
ccec9093
VZ
4634}
4635
29825f5f 4636#endif // wxUSE_STC