]> git.saurik.com Git - wxWidgets.git/blame - src/stc/stc.cpp
in wxAuiNotebook, code to reduce flicker on page close
[wxWidgets.git] / src / stc / stc.cpp
CommitLineData
9ce192d4
RD
1////////////////////////////////////////////////////////////////////////////
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
15// Licence: wxWindows license
16/////////////////////////////////////////////////////////////////////////////
17
54429bb3
RD
18// For compilers that support precompilation, includes "wx.h".
19#include "wx/wxprec.h"
20
21#ifdef __BORLANDC__
22 #pragma hdrstop
23#endif
24
29825f5f
PC
25#if wxUSE_STC
26
27#include "wx/stc/stc.h"
54429bb3
RD
28
29#ifndef WX_PRECOMP
29825f5f 30 #include "wx/wx.h"
54429bb3
RD
31#endif // WX_PRECOMP
32
f6bcfd97
BP
33#include <ctype.h>
34
d6655166
WS
35#include "wx/tokenzr.h"
36#include "wx/mstream.h"
37#include "wx/image.h"
38#include "wx/file.h"
9ce192d4 39
f9ee2e27 40#include "ScintillaWX.h"
f6bcfd97 41
9ce192d4
RD
42//----------------------------------------------------------------------
43
10ef30eb 44const wxChar* wxSTCNameStr = wxT("stcwindow");
9ce192d4 45
451c5cc7
RD
46#ifdef MAKELONG
47#undef MAKELONG
48#endif
49
50#define MAKELONG(a, b) ((a) | ((b) << 16))
51
52
53static long wxColourAsLong(const wxColour& co) {
54 return (((long)co.Blue() << 16) |
55 ((long)co.Green() << 8) |
56 ((long)co.Red()));
57}
58
59static wxColour wxColourFromLong(long c) {
60 wxColour clr;
c8b75e94
WS
61 clr.Set((unsigned char)(c & 0xff),
62 (unsigned char)((c >> 8) & 0xff),
63 (unsigned char)((c >> 16) & 0xff));
451c5cc7
RD
64 return clr;
65}
66
67
68static wxColour wxColourFromSpec(const wxString& spec) {
5ee1d760
RD
69 // spec should be a colour name or "#RRGGBB"
70 if (spec.GetChar(0) == wxT('#')) {
7e126a07 71
5ee1d760
RD
72 long red, green, blue;
73 red = green = blue = 0;
74 spec.Mid(1,2).ToLong(&red, 16);
75 spec.Mid(3,2).ToLong(&green, 16);
76 spec.Mid(5,2).ToLong(&blue, 16);
c8b75e94
WS
77 return wxColour((unsigned char)red,
78 (unsigned char)green,
79 (unsigned char)blue);
5ee1d760
RD
80 }
81 else
82 return wxColour(spec);
451c5cc7
RD
83}
84
85//----------------------------------------------------------------------
86
d25f5fbb
RD
87DEFINE_EVENT_TYPE( wxEVT_STC_CHANGE )
88DEFINE_EVENT_TYPE( wxEVT_STC_STYLENEEDED )
89DEFINE_EVENT_TYPE( wxEVT_STC_CHARADDED )
d25f5fbb
RD
90DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTREACHED )
91DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTLEFT )
92DEFINE_EVENT_TYPE( wxEVT_STC_ROMODIFYATTEMPT )
65ec6247 93DEFINE_EVENT_TYPE( wxEVT_STC_KEY )
d25f5fbb 94DEFINE_EVENT_TYPE( wxEVT_STC_DOUBLECLICK )
65ec6247 95DEFINE_EVENT_TYPE( wxEVT_STC_UPDATEUI )
d25f5fbb 96DEFINE_EVENT_TYPE( wxEVT_STC_MODIFIED )
d25f5fbb
RD
97DEFINE_EVENT_TYPE( wxEVT_STC_MACRORECORD )
98DEFINE_EVENT_TYPE( wxEVT_STC_MARGINCLICK )
99DEFINE_EVENT_TYPE( wxEVT_STC_NEEDSHOWN )
65ec6247
RD
100DEFINE_EVENT_TYPE( wxEVT_STC_PAINTED )
101DEFINE_EVENT_TYPE( wxEVT_STC_USERLISTSELECTION )
102DEFINE_EVENT_TYPE( wxEVT_STC_URIDROPPED )
103DEFINE_EVENT_TYPE( wxEVT_STC_DWELLSTART )
104DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND )
a29a241f
RD
105DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG )
106DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER )
107DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP )
a834585d 108DEFINE_EVENT_TYPE( wxEVT_STC_ZOOM )
9e730a78
RD
109DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_CLICK )
110DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_DCLICK )
111DEFINE_EVENT_TYPE( wxEVT_STC_CALLTIP_CLICK )
1e9bafca 112DEFINE_EVENT_TYPE( wxEVT_STC_AUTOCOMP_SELECTION )
9e730a78 113
d25f5fbb
RD
114
115
9ce192d4
RD
116BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
117 EVT_PAINT (wxStyledTextCtrl::OnPaint)
118 EVT_SCROLLWIN (wxStyledTextCtrl::OnScrollWin)
5fa4613c 119 EVT_SCROLL (wxStyledTextCtrl::OnScroll)
9ce192d4
RD
120 EVT_SIZE (wxStyledTextCtrl::OnSize)
121 EVT_LEFT_DOWN (wxStyledTextCtrl::OnMouseLeftDown)
4ceb1196
RD
122 // Let Scintilla see the double click as a second click
123 EVT_LEFT_DCLICK (wxStyledTextCtrl::OnMouseLeftDown)
9ce192d4
RD
124 EVT_MOTION (wxStyledTextCtrl::OnMouseMove)
125 EVT_LEFT_UP (wxStyledTextCtrl::OnMouseLeftUp)
451c5cc7 126#if defined(__WXGTK__) || defined(__WXMAC__)
ddf2da08
RD
127 EVT_RIGHT_UP (wxStyledTextCtrl::OnMouseRightUp)
128#else
65ec6247 129 EVT_CONTEXT_MENU (wxStyledTextCtrl::OnContextMenu)
ddf2da08 130#endif
37d62433 131 EVT_MOUSEWHEEL (wxStyledTextCtrl::OnMouseWheel)
2b5f62a0 132 EVT_MIDDLE_UP (wxStyledTextCtrl::OnMouseMiddleUp)
9ce192d4 133 EVT_CHAR (wxStyledTextCtrl::OnChar)
f6bcfd97 134 EVT_KEY_DOWN (wxStyledTextCtrl::OnKeyDown)
9ce192d4
RD
135 EVT_KILL_FOCUS (wxStyledTextCtrl::OnLoseFocus)
136 EVT_SET_FOCUS (wxStyledTextCtrl::OnGainFocus)
137 EVT_SYS_COLOUR_CHANGED (wxStyledTextCtrl::OnSysColourChanged)
138 EVT_ERASE_BACKGROUND (wxStyledTextCtrl::OnEraseBackground)
dd4aa550 139 EVT_MENU_RANGE (10, 16, wxStyledTextCtrl::OnMenu)
7e126a07 140 EVT_LISTBOX_DCLICK (wxID_ANY, wxStyledTextCtrl::OnListBox)
9ce192d4
RD
141END_EVENT_TABLE()
142
f6bcfd97
BP
143
144IMPLEMENT_CLASS(wxStyledTextCtrl, wxControl)
145IMPLEMENT_DYNAMIC_CLASS(wxStyledTextEvent, wxCommandEvent)
146
40716a51 147#ifdef LINK_LEXERS
1a2fb4cd 148// forces the linking of the lexer modules
a834585d 149int Scintilla_LinkLexers();
40716a51 150#endif
1a2fb4cd 151
9ce192d4
RD
152//----------------------------------------------------------------------
153// Constructor and Destructor
154
155wxStyledTextCtrl::wxStyledTextCtrl(wxWindow *parent,
156 wxWindowID id,
157 const wxPoint& pos,
158 const wxSize& size,
159 long style,
39c0acb6
RD
160 const wxString& name)
161{
162 m_swx = NULL;
163 Create(parent, id, pos, size, style, name);
164}
165
166
a48cb415
RD
167bool wxStyledTextCtrl::Create(wxWindow *parent,
168 wxWindowID id,
169 const wxPoint& pos,
170 const wxSize& size,
171 long style,
172 const wxString& name)
9ce192d4 173{
2659dad3 174 style |= wxVSCROLL | wxHSCROLL;
a48cb415
RD
175 if (!wxControl::Create(parent, id, pos, size,
176 style | wxWANTS_CHARS | wxCLIP_CHILDREN,
177 wxDefaultValidator, name))
178 return false;
39c0acb6 179
40716a51 180#ifdef LINK_LEXERS
a834585d 181 Scintilla_LinkLexers();
40716a51 182#endif
9ce192d4 183 m_swx = new ScintillaWX(this);
9ce192d4 184 m_stopWatch.Start();
7e126a07 185 m_lastKeyDownConsumed = false;
5fa4613c
RD
186 m_vScrollBar = NULL;
187 m_hScrollBar = NULL;
10ef30eb
RD
188#if wxUSE_UNICODE
189 // Put Scintilla into unicode (UTF-8) mode
190 SetCodePage(wxSTC_CP_UTF8);
191#endif
8ae4f086 192
170acdc9 193 SetInitialSize(size);
f9ee2e27 194
be108f96
JS
195 // Reduces flicker on GTK+/X11
196 SetBackgroundStyle(wxBG_STYLE_CUSTOM);
a48cb415 197 return true;
9ce192d4
RD
198}
199
200
201wxStyledTextCtrl::~wxStyledTextCtrl() {
202 delete m_swx;
9ce192d4
RD
203}
204
205
206//----------------------------------------------------------------------
207
f6bcfd97 208long wxStyledTextCtrl::SendMsg(int msg, long wp, long lp) {
9ce192d4
RD
209
210 return m_swx->WndProc(msg, wp, lp);
211}
212
ccfc3219
RD
213//----------------------------------------------------------------------
214
215// Set the vertical scrollbar to use instead of the ont that's built-in.
216void wxStyledTextCtrl::SetVScrollBar(wxScrollBar* bar) {
217 m_vScrollBar = bar;
218 if (bar != NULL) {
219 // ensure that the built-in scrollbar is not visible
220 SetScrollbar(wxVERTICAL, 0, 0, 0);
221 }
222}
9ce192d4 223
9ce192d4 224
ccfc3219
RD
225// Set the horizontal scrollbar to use instead of the ont that's built-in.
226void wxStyledTextCtrl::SetHScrollBar(wxScrollBar* bar) {
227 m_hScrollBar = bar;
228 if (bar != NULL) {
229 // ensure that the built-in scrollbar is not visible
230 SetScrollbar(wxHORIZONTAL, 0, 0, 0);
231 }
232}
233
4370573a
RD
234//----------------------------------------------------------------------
235// BEGIN generated section. The following code is automatically generated
236// by gen_iface.py from the contents of Scintilla.iface. Do not edit
237// this file. Edit stc.cpp.in or gen_iface.py instead and regenerate.
9ce192d4
RD
238
239
591d01be 240// Add text to the document at current position.
9ce192d4 241void wxStyledTextCtrl::AddText(const wxString& text) {
0c5b83b0 242 wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
10ef30eb 243 SendMsg(2001, strlen(buf), (long)(const char*)buf);
9ce192d4
RD
244}
245
a834585d 246// Add array of cells to document.
10ef30eb
RD
247void wxStyledTextCtrl::AddStyledText(const wxMemoryBuffer& data) {
248 SendMsg(2002, data.GetDataLen(), (long)data.GetData());
9ce192d4
RD
249}
250
a834585d 251// Insert string at a position.
9ce192d4 252void wxStyledTextCtrl::InsertText(int pos, const wxString& text) {
0c5b83b0 253 SendMsg(2003, pos, (long)(const char*)wx2stc(text));
9ce192d4
RD
254}
255
a834585d 256// Delete all text in the document.
9ce192d4 257void wxStyledTextCtrl::ClearAll() {
4370573a 258 SendMsg(2004, 0, 0);
9ce192d4
RD
259}
260
a834585d 261// Set all style bytes to 0, remove all folding information.
4370573a
RD
262void wxStyledTextCtrl::ClearDocumentStyle() {
263 SendMsg(2005, 0, 0);
9ce192d4
RD
264}
265
591d01be 266// Returns the number of characters in the document.
4370573a
RD
267int wxStyledTextCtrl::GetLength() {
268 return SendMsg(2006, 0, 0);
9ce192d4
RD
269}
270
a834585d 271// Returns the character byte at the position.
4370573a 272int wxStyledTextCtrl::GetCharAt(int pos) {
9e730a78 273 return (unsigned char)SendMsg(2007, pos, 0);
9ce192d4
RD
274}
275
a834585d 276// Returns the position of the caret.
4370573a
RD
277int wxStyledTextCtrl::GetCurrentPos() {
278 return SendMsg(2008, 0, 0);
9ce192d4
RD
279}
280
a834585d 281// Returns the position of the opposite end of the selection to the caret.
4370573a
RD
282int wxStyledTextCtrl::GetAnchor() {
283 return SendMsg(2009, 0, 0);
9ce192d4
RD
284}
285
a834585d 286// Returns the style byte at the position.
4370573a 287int wxStyledTextCtrl::GetStyleAt(int pos) {
9e730a78 288 return (unsigned char)SendMsg(2010, pos, 0);
9ce192d4
RD
289}
290
a834585d 291// Redoes the next action on the undo history.
9ce192d4 292void wxStyledTextCtrl::Redo() {
4370573a 293 SendMsg(2011, 0, 0);
9ce192d4
RD
294}
295
4370573a
RD
296// Choose between collecting actions into the undo
297// history and discarding them.
298void wxStyledTextCtrl::SetUndoCollection(bool collectUndo) {
299 SendMsg(2012, collectUndo, 0);
9ce192d4
RD
300}
301
4370573a
RD
302// Select all the text in the document.
303void wxStyledTextCtrl::SelectAll() {
304 SendMsg(2013, 0, 0);
9ce192d4
RD
305}
306
4370573a
RD
307// Remember the current position in the undo history as the position
308// at which the document was saved.
309void wxStyledTextCtrl::SetSavePoint() {
310 SendMsg(2014, 0, 0);
9ce192d4
RD
311}
312
4370573a 313// Retrieve a buffer of cells.
10ef30eb 314wxMemoryBuffer wxStyledTextCtrl::GetStyledText(int startPos, int endPos) {
9e730a78
RD
315 wxMemoryBuffer buf;
316 if (endPos < startPos) {
317 int temp = startPos;
318 startPos = endPos;
319 endPos = temp;
320 }
321 int len = endPos - startPos;
322 if (!len) return buf;
323 TextRange tr;
324 tr.lpstrText = (char*)buf.GetWriteBuf(len*2+1);
325 tr.chrg.cpMin = startPos;
326 tr.chrg.cpMax = endPos;
327 len = SendMsg(2015, 0, (long)&tr);
328 buf.UngetWriteBuf(len);
329 return buf;
9ce192d4
RD
330}
331
a834585d 332// Are there any redoable actions in the undo history?
4370573a
RD
333bool wxStyledTextCtrl::CanRedo() {
334 return SendMsg(2016, 0, 0) != 0;
9ce192d4
RD
335}
336
a834585d 337// Retrieve the line number at which a particular marker is located.
4370573a
RD
338int wxStyledTextCtrl::MarkerLineFromHandle(int handle) {
339 return SendMsg(2017, handle, 0);
9ce192d4
RD
340}
341
4370573a
RD
342// Delete a marker.
343void wxStyledTextCtrl::MarkerDeleteHandle(int handle) {
344 SendMsg(2018, handle, 0);
9ce192d4
RD
345}
346
4370573a
RD
347// Is undo history being collected?
348bool wxStyledTextCtrl::GetUndoCollection() {
349 return SendMsg(2019, 0, 0) != 0;
9ce192d4
RD
350}
351
4370573a
RD
352// Are white space characters currently visible?
353// Returns one of SCWS_* constants.
354int wxStyledTextCtrl::GetViewWhiteSpace() {
355 return SendMsg(2020, 0, 0);
9ce192d4
RD
356}
357
4370573a
RD
358// Make white space characters invisible, always visible or visible outside indentation.
359void wxStyledTextCtrl::SetViewWhiteSpace(int viewWS) {
360 SendMsg(2021, viewWS, 0);
9ce192d4
RD
361}
362
4370573a 363// Find the position from a point within the window.
9ce192d4 364int wxStyledTextCtrl::PositionFromPoint(wxPoint pt) {
9e730a78 365 return SendMsg(2022, pt.x, pt.y);
9ce192d4
RD
366}
367
65ec6247
RD
368// Find the position from a point within the window but return
369// INVALID_POSITION if not close to text.
370int wxStyledTextCtrl::PositionFromPointClose(int x, int y) {
371 return SendMsg(2023, x, y);
372}
373
4370573a
RD
374// Set caret to start of a line and ensure it is visible.
375void wxStyledTextCtrl::GotoLine(int line) {
376 SendMsg(2024, line, 0);
9ce192d4
RD
377}
378
4370573a 379// Set caret to a position and ensure it is visible.
9ce192d4 380void wxStyledTextCtrl::GotoPos(int pos) {
4370573a 381 SendMsg(2025, pos, 0);
9ce192d4
RD
382}
383
4370573a
RD
384// Set the selection anchor to a position. The anchor is the opposite
385// end of the selection from the caret.
386void wxStyledTextCtrl::SetAnchor(int posAnchor) {
387 SendMsg(2026, posAnchor, 0);
9ce192d4
RD
388}
389
4370573a
RD
390// Retrieve the text of the line containing the caret.
391// Returns the index of the caret on the line.
392wxString wxStyledTextCtrl::GetCurLine(int* linePos) {
9e730a78
RD
393 int len = LineLength(GetCurrentLine());
394 if (!len) {
395 if (linePos) *linePos = 0;
396 return wxEmptyString;
397 }
10ef30eb 398
9e730a78
RD
399 wxMemoryBuffer mbuf(len+1);
400 char* buf = (char*)mbuf.GetWriteBuf(len+1);
8de28db9 401
9e730a78
RD
402 int pos = SendMsg(2027, len+1, (long)buf);
403 mbuf.UngetWriteBuf(len);
404 mbuf.AppendByte(0);
405 if (linePos) *linePos = pos;
406 return stc2wx(buf);
9ce192d4
RD
407}
408
4370573a
RD
409// Retrieve the position of the last correctly styled character.
410int wxStyledTextCtrl::GetEndStyled() {
411 return SendMsg(2028, 0, 0);
9ce192d4
RD
412}
413
65ec6247
RD
414// Convert all line endings in the document to one mode.
415void wxStyledTextCtrl::ConvertEOLs(int eolMode) {
416 SendMsg(2029, eolMode, 0);
9ce192d4
RD
417}
418
4370573a
RD
419// Retrieve the current end of line mode - one of CRLF, CR, or LF.
420int wxStyledTextCtrl::GetEOLMode() {
421 return SendMsg(2030, 0, 0);
9ce192d4
RD
422}
423
4370573a
RD
424// Set the current end of line mode.
425void wxStyledTextCtrl::SetEOLMode(int eolMode) {
426 SendMsg(2031, eolMode, 0);
9ce192d4
RD
427}
428
4370573a 429// Set the current styling position to pos and the styling mask to mask.
a834585d 430// The styling mask can be used to protect some bits in each styling byte from modification.
4370573a
RD
431void wxStyledTextCtrl::StartStyling(int pos, int mask) {
432 SendMsg(2032, pos, mask);
9ce192d4
RD
433}
434
4370573a
RD
435// Change style from current styling position for length characters to a style
436// and move the current styling position to after this newly styled segment.
437void wxStyledTextCtrl::SetStyling(int length, int style) {
438 SendMsg(2033, length, style);
f6bcfd97
BP
439}
440
a834585d 441// Is drawing done first into a buffer or direct to the screen?
4370573a
RD
442bool wxStyledTextCtrl::GetBufferedDraw() {
443 return SendMsg(2034, 0, 0) != 0;
f6bcfd97
BP
444}
445
4370573a
RD
446// If drawing is buffered then each line of text is drawn into a bitmap buffer
447// before drawing it to the screen to avoid flicker.
448void wxStyledTextCtrl::SetBufferedDraw(bool buffered) {
449 SendMsg(2035, buffered, 0);
f6bcfd97
BP
450}
451
a834585d 452// Change the visible size of a tab to be a multiple of the width of a space character.
4370573a
RD
453void wxStyledTextCtrl::SetTabWidth(int tabWidth) {
454 SendMsg(2036, tabWidth, 0);
f6bcfd97
BP
455}
456
4370573a
RD
457// Retrieve the visible size of a tab.
458int wxStyledTextCtrl::GetTabWidth() {
459 return SendMsg(2121, 0, 0);
9ce192d4
RD
460}
461
4370573a 462// Set the code page used to interpret the bytes of the document as characters.
4370573a 463void wxStyledTextCtrl::SetCodePage(int codePage) {
10ef30eb
RD
464#if wxUSE_UNICODE
465 wxASSERT_MSG(codePage == wxSTC_CP_UTF8,
466 wxT("Only wxSTC_CP_UTF8 may be used when wxUSE_UNICODE is on."));
467#else
468 wxASSERT_MSG(codePage != wxSTC_CP_UTF8,
469 wxT("wxSTC_CP_UTF8 may not be used when wxUSE_UNICODE is off."));
470#endif
9e730a78 471 SendMsg(2037, codePage);
9ce192d4
RD
472}
473
4370573a 474// Set the symbol used for a particular marker number,
1a2fb4cd 475// and optionally the fore and background colours.
4370573a 476void wxStyledTextCtrl::MarkerDefine(int markerNumber, int markerSymbol,
9e730a78
RD
477 const wxColour& foreground,
478 const wxColour& background) {
9ce192d4 479
9e730a78
RD
480 SendMsg(2040, markerNumber, markerSymbol);
481 if (foreground.Ok())
482 MarkerSetForeground(markerNumber, foreground);
483 if (background.Ok())
484 MarkerSetBackground(markerNumber, background);
9ce192d4
RD
485}
486
4370573a
RD
487// Set the foreground colour used for a particular marker number.
488void wxStyledTextCtrl::MarkerSetForeground(int markerNumber, const wxColour& fore) {
489 SendMsg(2041, markerNumber, wxColourAsLong(fore));
9ce192d4
RD
490}
491
4370573a
RD
492// Set the background colour used for a particular marker number.
493void wxStyledTextCtrl::MarkerSetBackground(int markerNumber, const wxColour& back) {
494 SendMsg(2042, markerNumber, wxColourAsLong(back));
9ce192d4
RD
495}
496
1a2fb4cd
RD
497// Add a marker to a line, returning an ID which can be used to find or delete the marker.
498int wxStyledTextCtrl::MarkerAdd(int line, int markerNumber) {
499 return SendMsg(2043, line, markerNumber);
9ce192d4
RD
500}
501
a834585d 502// Delete a marker from a line.
4370573a
RD
503void wxStyledTextCtrl::MarkerDelete(int line, int markerNumber) {
504 SendMsg(2044, line, markerNumber);
9ce192d4
RD
505}
506
a834585d 507// Delete all markers with a particular number from all lines.
4370573a
RD
508void wxStyledTextCtrl::MarkerDeleteAll(int markerNumber) {
509 SendMsg(2045, markerNumber, 0);
9ce192d4
RD
510}
511
4370573a
RD
512// Get a bit mask of all the markers set on a line.
513int wxStyledTextCtrl::MarkerGet(int line) {
514 return SendMsg(2046, line, 0);
9ce192d4
RD
515}
516
4370573a
RD
517// Find the next line after lineStart that includes a marker in mask.
518int wxStyledTextCtrl::MarkerNext(int lineStart, int markerMask) {
519 return SendMsg(2047, lineStart, markerMask);
9ce192d4
RD
520}
521
4370573a
RD
522// Find the previous line before lineStart that includes a marker in mask.
523int wxStyledTextCtrl::MarkerPrevious(int lineStart, int markerMask) {
524 return SendMsg(2048, lineStart, markerMask);
9ce192d4
RD
525}
526
9e730a78
RD
527// Define a marker from a bitmap
528void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber, const wxBitmap& bmp) {
529 // convert bmp to a xpm in a string
530 wxMemoryOutputStream strm;
531 wxImage img = bmp.ConvertToImage();
e45b3f17
RD
532 if (img.HasAlpha())
533 img.ConvertAlphaToMask();
9e730a78
RD
534 img.SaveFile(strm, wxBITMAP_TYPE_XPM);
535 size_t len = strm.GetSize();
536 char* buff = new char[len+1];
537 strm.CopyTo(buff, len);
538 buff[len] = 0;
539 SendMsg(2049, markerNumber, (long)buff);
540 delete [] buff;
a5b274d7 541
9e730a78
RD
542}
543
1e9bafca
RD
544// Add a set of markers to a line.
545void wxStyledTextCtrl::MarkerAddSet(int line, int set) {
546 SendMsg(2466, line, set);
547}
548
b8193d80
RD
549// Set the alpha used for a marker that is drawn in the text area, not the margin.
550void wxStyledTextCtrl::MarkerSetAlpha(int markerNumber, int alpha) {
551 SendMsg(2476, markerNumber, alpha);
552}
553
4370573a
RD
554// Set a margin to be either numeric or symbolic.
555void wxStyledTextCtrl::SetMarginType(int margin, int marginType) {
556 SendMsg(2240, margin, marginType);
9ce192d4
RD
557}
558
4370573a
RD
559// Retrieve the type of a margin.
560int wxStyledTextCtrl::GetMarginType(int margin) {
561 return SendMsg(2241, margin, 0);
9ce192d4
RD
562}
563
4370573a
RD
564// Set the width of a margin to a width expressed in pixels.
565void wxStyledTextCtrl::SetMarginWidth(int margin, int pixelWidth) {
566 SendMsg(2242, margin, pixelWidth);
9ce192d4
RD
567}
568
4370573a
RD
569// Retrieve the width of a margin in pixels.
570int wxStyledTextCtrl::GetMarginWidth(int margin) {
571 return SendMsg(2243, margin, 0);
f6bcfd97
BP
572}
573
4370573a
RD
574// Set a mask that determines which markers are displayed in a margin.
575void wxStyledTextCtrl::SetMarginMask(int margin, int mask) {
576 SendMsg(2244, margin, mask);
f6bcfd97
BP
577}
578
4370573a
RD
579// Retrieve the marker mask of a margin.
580int wxStyledTextCtrl::GetMarginMask(int margin) {
581 return SendMsg(2245, margin, 0);
9ce192d4
RD
582}
583
4370573a
RD
584// Make a margin sensitive or insensitive to mouse clicks.
585void wxStyledTextCtrl::SetMarginSensitive(int margin, bool sensitive) {
586 SendMsg(2246, margin, sensitive);
9ce192d4
RD
587}
588
4370573a
RD
589// Retrieve the mouse click sensitivity of a margin.
590bool wxStyledTextCtrl::GetMarginSensitive(int margin) {
591 return SendMsg(2247, margin, 0) != 0;
9ce192d4
RD
592}
593
4370573a 594// Clear all the styles and make equivalent to the global default style.
9ce192d4 595void wxStyledTextCtrl::StyleClearAll() {
4370573a 596 SendMsg(2050, 0, 0);
9ce192d4
RD
597}
598
4370573a
RD
599// Set the foreground colour of a style.
600void wxStyledTextCtrl::StyleSetForeground(int style, const wxColour& fore) {
601 SendMsg(2051, style, wxColourAsLong(fore));
9ce192d4
RD
602}
603
4370573a
RD
604// Set the background colour of a style.
605void wxStyledTextCtrl::StyleSetBackground(int style, const wxColour& back) {
606 SendMsg(2052, style, wxColourAsLong(back));
9ce192d4
RD
607}
608
4370573a
RD
609// Set a style to be bold or not.
610void wxStyledTextCtrl::StyleSetBold(int style, bool bold) {
611 SendMsg(2053, style, bold);
9ce192d4
RD
612}
613
4370573a
RD
614// Set a style to be italic or not.
615void wxStyledTextCtrl::StyleSetItalic(int style, bool italic) {
616 SendMsg(2054, style, italic);
9ce192d4
RD
617}
618
4370573a
RD
619// Set the size of characters of a style.
620void wxStyledTextCtrl::StyleSetSize(int style, int sizePoints) {
621 SendMsg(2055, style, sizePoints);
9ce192d4
RD
622}
623
4370573a
RD
624// Set the font of a style.
625void wxStyledTextCtrl::StyleSetFaceName(int style, const wxString& fontName) {
0c5b83b0 626 SendMsg(2056, style, (long)(const char*)wx2stc(fontName));
9ce192d4
RD
627}
628
4370573a
RD
629// Set a style to have its end of line filled or not.
630void wxStyledTextCtrl::StyleSetEOLFilled(int style, bool filled) {
631 SendMsg(2057, style, filled);
9ce192d4
RD
632}
633
4370573a
RD
634// Reset the default style to its state at startup
635void wxStyledTextCtrl::StyleResetDefault() {
636 SendMsg(2058, 0, 0);
9ce192d4
RD
637}
638
4370573a
RD
639// Set a style to be underlined or not.
640void wxStyledTextCtrl::StyleSetUnderline(int style, bool underline) {
641 SendMsg(2059, style, underline);
9ce192d4
RD
642}
643
65ec6247
RD
644// Set a style to be mixed case, or to force upper or lower case.
645void wxStyledTextCtrl::StyleSetCase(int style, int caseForce) {
646 SendMsg(2060, style, caseForce);
647}
648
9e730a78
RD
649// Set a style to be a hotspot or not.
650void wxStyledTextCtrl::StyleSetHotSpot(int style, bool hotspot) {
651 SendMsg(2409, style, hotspot);
652}
653
4370573a
RD
654// Set the foreground colour of the selection and whether to use this setting.
655void wxStyledTextCtrl::SetSelForeground(bool useSetting, const wxColour& fore) {
656 SendMsg(2067, useSetting, wxColourAsLong(fore));
9ce192d4
RD
657}
658
4370573a
RD
659// Set the background colour of the selection and whether to use this setting.
660void wxStyledTextCtrl::SetSelBackground(bool useSetting, const wxColour& back) {
661 SendMsg(2068, useSetting, wxColourAsLong(back));
9ce192d4
RD
662}
663
b8193d80
RD
664// Get the alpha of the selection.
665int wxStyledTextCtrl::GetSelAlpha() {
666 return SendMsg(2477, 0, 0);
667}
668
669// Set the alpha of the selection.
670void wxStyledTextCtrl::SetSelAlpha(int alpha) {
671 SendMsg(2478, alpha, 0);
672}
673
4370573a
RD
674// Set the foreground colour of the caret.
675void wxStyledTextCtrl::SetCaretForeground(const wxColour& fore) {
676 SendMsg(2069, wxColourAsLong(fore), 0);
9ce192d4
RD
677}
678
4370573a
RD
679// When key+modifier combination km is pressed perform msg.
680void wxStyledTextCtrl::CmdKeyAssign(int key, int modifiers, int cmd) {
9e730a78 681 SendMsg(2070, MAKELONG(key, modifiers), cmd);
9ce192d4
RD
682}
683
8e54aaed 684// When key+modifier combination km is pressed do nothing.
4370573a 685void wxStyledTextCtrl::CmdKeyClear(int key, int modifiers) {
9e730a78 686 SendMsg(2071, MAKELONG(key, modifiers));
9ce192d4
RD
687}
688
4370573a
RD
689// Drop all key mappings.
690void wxStyledTextCtrl::CmdKeyClearAll() {
691 SendMsg(2072, 0, 0);
692}
9ce192d4 693
4370573a
RD
694// Set the styles for a segment of the document.
695void wxStyledTextCtrl::SetStyleBytes(int length, char* styleBytes) {
9e730a78 696 SendMsg(2073, length, (long)styleBytes);
9ce192d4
RD
697}
698
4370573a
RD
699// Set a style to be visible or not.
700void wxStyledTextCtrl::StyleSetVisible(int style, bool visible) {
701 SendMsg(2074, style, visible);
702}
9ce192d4 703
4370573a 704// Get the time in milliseconds that the caret is on and off.
9ce192d4 705int wxStyledTextCtrl::GetCaretPeriod() {
4370573a 706 return SendMsg(2075, 0, 0);
9ce192d4
RD
707}
708
4370573a
RD
709// Get the time in milliseconds that the caret is on and off. 0 = steady on.
710void wxStyledTextCtrl::SetCaretPeriod(int periodMilliseconds) {
711 SendMsg(2076, periodMilliseconds, 0);
712}
9ce192d4 713
a834585d 714// Set the set of characters making up words for when moving or selecting by word.
8e54aaed 715// First sets deaults like SetCharsDefault.
4370573a 716void wxStyledTextCtrl::SetWordChars(const wxString& characters) {
0c5b83b0 717 SendMsg(2077, 0, (long)(const char*)wx2stc(characters));
9ce192d4
RD
718}
719
4370573a
RD
720// Start a sequence of actions that is undone and redone as a unit.
721// May be nested.
722void wxStyledTextCtrl::BeginUndoAction() {
723 SendMsg(2078, 0, 0);
724}
9ce192d4 725
4370573a
RD
726// End a sequence of actions that is undone and redone as a unit.
727void wxStyledTextCtrl::EndUndoAction() {
728 SendMsg(2079, 0, 0);
729}
9ce192d4 730
4370573a
RD
731// Set an indicator to plain, squiggle or TT.
732void wxStyledTextCtrl::IndicatorSetStyle(int indic, int style) {
733 SendMsg(2080, indic, style);
734}
9ce192d4 735
4370573a
RD
736// Retrieve the style of an indicator.
737int wxStyledTextCtrl::IndicatorGetStyle(int indic) {
738 return SendMsg(2081, indic, 0);
739}
9ce192d4 740
4370573a
RD
741// Set the foreground colour of an indicator.
742void wxStyledTextCtrl::IndicatorSetForeground(int indic, const wxColour& fore) {
743 SendMsg(2082, indic, wxColourAsLong(fore));
9ce192d4
RD
744}
745
4370573a
RD
746// Retrieve the foreground colour of an indicator.
747wxColour wxStyledTextCtrl::IndicatorGetForeground(int indic) {
748 long c = SendMsg(2083, indic, 0);
749 return wxColourFromLong(c);
750}
9ce192d4 751
f114b858
RD
752// Set the foreground colour of all whitespace and whether to use this setting.
753void wxStyledTextCtrl::SetWhitespaceForeground(bool useSetting, const wxColour& fore) {
754 SendMsg(2084, useSetting, wxColourAsLong(fore));
755}
756
757// Set the background colour of all whitespace and whether to use this setting.
758void wxStyledTextCtrl::SetWhitespaceBackground(bool useSetting, const wxColour& back) {
759 SendMsg(2085, useSetting, wxColourAsLong(back));
760}
761
a834585d
RD
762// Divide each styling byte into lexical class bits (default: 5) and indicator
763// bits (default: 3). If a lexer requires more than 32 lexical states, then this
4370573a
RD
764// is used to expand the possible states.
765void wxStyledTextCtrl::SetStyleBits(int bits) {
766 SendMsg(2090, bits, 0);
9ce192d4
RD
767}
768
4370573a
RD
769// Retrieve number of bits in style bytes used to hold the lexical state.
770int wxStyledTextCtrl::GetStyleBits() {
771 return SendMsg(2091, 0, 0);
772}
9ce192d4 773
4370573a
RD
774// Used to hold extra styling information for each line.
775void wxStyledTextCtrl::SetLineState(int line, int state) {
776 SendMsg(2092, line, state);
f6bcfd97
BP
777}
778
4370573a
RD
779// Retrieve the extra styling information for a line.
780int wxStyledTextCtrl::GetLineState(int line) {
781 return SendMsg(2093, line, 0);
782}
f6bcfd97 783
4370573a
RD
784// Retrieve the last line number that has line state.
785int wxStyledTextCtrl::GetMaxLineState() {
786 return SendMsg(2094, 0, 0);
f6bcfd97
BP
787}
788
65ec6247
RD
789// Is the background of the line containing the caret in a different colour?
790bool wxStyledTextCtrl::GetCaretLineVisible() {
791 return SendMsg(2095, 0, 0) != 0;
792}
793
a834585d 794// Display the background of the line containing the caret in a different colour.
65ec6247
RD
795void wxStyledTextCtrl::SetCaretLineVisible(bool show) {
796 SendMsg(2096, show, 0);
797}
798
799// Get the colour of the background of the line containing the caret.
6a93571d 800wxColour wxStyledTextCtrl::GetCaretLineBackground() {
65ec6247
RD
801 long c = SendMsg(2097, 0, 0);
802 return wxColourFromLong(c);
803}
804
805// Set the colour of the background of the line containing the caret.
6a93571d 806void wxStyledTextCtrl::SetCaretLineBackground(const wxColour& back) {
65ec6247
RD
807 SendMsg(2098, wxColourAsLong(back), 0);
808}
809
1a2fb4cd
RD
810// Set a style to be changeable or not (read only).
811// Experimental feature, currently buggy.
812void wxStyledTextCtrl::StyleSetChangeable(int style, bool changeable) {
813 SendMsg(2099, style, changeable);
814}
815
4370573a
RD
816// Display a auto-completion list.
817// The lenEntered parameter indicates how many characters before
818// the caret should be used to provide context.
819void wxStyledTextCtrl::AutoCompShow(int lenEntered, const wxString& itemList) {
0c5b83b0 820 SendMsg(2100, lenEntered, (long)(const char*)wx2stc(itemList));
4370573a 821}
f6bcfd97 822
4370573a
RD
823// Remove the auto-completion list from the screen.
824void wxStyledTextCtrl::AutoCompCancel() {
825 SendMsg(2101, 0, 0);
f6bcfd97
BP
826}
827
4370573a
RD
828// Is there an auto-completion list visible?
829bool wxStyledTextCtrl::AutoCompActive() {
830 return SendMsg(2102, 0, 0) != 0;
831}
f6bcfd97 832
a834585d 833// Retrieve the position of the caret when the auto-completion list was displayed.
4370573a
RD
834int wxStyledTextCtrl::AutoCompPosStart() {
835 return SendMsg(2103, 0, 0);
f6bcfd97
BP
836}
837
4370573a
RD
838// User has selected an item so remove the list and insert the selection.
839void wxStyledTextCtrl::AutoCompComplete() {
840 SendMsg(2104, 0, 0);
841}
f6bcfd97 842
4370573a
RD
843// Define a set of character that when typed cancel the auto-completion list.
844void wxStyledTextCtrl::AutoCompStops(const wxString& characterSet) {
0c5b83b0 845 SendMsg(2105, 0, (long)(const char*)wx2stc(characterSet));
f6bcfd97
BP
846}
847
a834585d
RD
848// Change the separator character in the string setting up an auto-completion list.
849// Default is space but can be changed if items contain space.
4370573a
RD
850void wxStyledTextCtrl::AutoCompSetSeparator(int separatorCharacter) {
851 SendMsg(2106, separatorCharacter, 0);
852}
f6bcfd97 853
4370573a
RD
854// Retrieve the auto-completion list separator character.
855int wxStyledTextCtrl::AutoCompGetSeparator() {
856 return SendMsg(2107, 0, 0);
9ce192d4
RD
857}
858
4370573a
RD
859// Select the item in the auto-completion list that starts with a string.
860void wxStyledTextCtrl::AutoCompSelect(const wxString& text) {
0c5b83b0 861 SendMsg(2108, 0, (long)(const char*)wx2stc(text));
4370573a 862}
9ce192d4 863
4370573a
RD
864// Should the auto-completion list be cancelled if the user backspaces to a
865// position before where the box was created.
866void wxStyledTextCtrl::AutoCompSetCancelAtStart(bool cancel) {
867 SendMsg(2110, cancel, 0);
f6bcfd97
BP
868}
869
4370573a
RD
870// Retrieve whether auto-completion cancelled by backspacing before start.
871bool wxStyledTextCtrl::AutoCompGetCancelAtStart() {
872 return SendMsg(2111, 0, 0) != 0;
873}
f6bcfd97 874
1a2fb4cd
RD
875// Define a set of characters that when typed will cause the autocompletion to
876// choose the selected item.
4370573a 877void wxStyledTextCtrl::AutoCompSetFillUps(const wxString& characterSet) {
0c5b83b0 878 SendMsg(2112, 0, (long)(const char*)wx2stc(characterSet));
4370573a 879}
9ce192d4 880
4370573a
RD
881// Should a single item auto-completion list automatically choose the item.
882void wxStyledTextCtrl::AutoCompSetChooseSingle(bool chooseSingle) {
883 SendMsg(2113, chooseSingle, 0);
884}
9ce192d4 885
4370573a
RD
886// Retrieve whether a single item auto-completion list automatically choose the item.
887bool wxStyledTextCtrl::AutoCompGetChooseSingle() {
888 return SendMsg(2114, 0, 0) != 0;
9ce192d4
RD
889}
890
4370573a
RD
891// Set whether case is significant when performing auto-completion searches.
892void wxStyledTextCtrl::AutoCompSetIgnoreCase(bool ignoreCase) {
893 SendMsg(2115, ignoreCase, 0);
894}
9ce192d4 895
4370573a
RD
896// Retrieve state of ignore case flag.
897bool wxStyledTextCtrl::AutoCompGetIgnoreCase() {
898 return SendMsg(2116, 0, 0) != 0;
9ce192d4
RD
899}
900
65ec6247
RD
901// Display a list of strings and send notification when user chooses one.
902void wxStyledTextCtrl::UserListShow(int listType, const wxString& itemList) {
0c5b83b0 903 SendMsg(2117, listType, (long)(const char*)wx2stc(itemList));
65ec6247
RD
904}
905
a834585d 906// Set whether or not autocompletion is hidden automatically when nothing matches.
65ec6247
RD
907void wxStyledTextCtrl::AutoCompSetAutoHide(bool autoHide) {
908 SendMsg(2118, autoHide, 0);
909}
910
a834585d 911// Retrieve whether or not autocompletion is hidden automatically when nothing matches.
65ec6247
RD
912bool wxStyledTextCtrl::AutoCompGetAutoHide() {
913 return SendMsg(2119, 0, 0) != 0;
914}
915
a834585d
RD
916// Set whether or not autocompletion deletes any word characters
917// after the inserted text upon completion.
1a2fb4cd
RD
918void wxStyledTextCtrl::AutoCompSetDropRestOfWord(bool dropRestOfWord) {
919 SendMsg(2270, dropRestOfWord, 0);
920}
921
a834585d
RD
922// Retrieve whether or not autocompletion deletes any word characters
923// after the inserted text upon completion.
1a2fb4cd
RD
924bool wxStyledTextCtrl::AutoCompGetDropRestOfWord() {
925 return SendMsg(2271, 0, 0) != 0;
926}
927
9e730a78
RD
928// Register an image for use in autocompletion lists.
929void wxStyledTextCtrl::RegisterImage(int type, const wxBitmap& bmp) {
930 // convert bmp to a xpm in a string
931 wxMemoryOutputStream strm;
932 wxImage img = bmp.ConvertToImage();
e45b3f17
RD
933 if (img.HasAlpha())
934 img.ConvertAlphaToMask();
9e730a78
RD
935 img.SaveFile(strm, wxBITMAP_TYPE_XPM);
936 size_t len = strm.GetSize();
937 char* buff = new char[len+1];
938 strm.CopyTo(buff, len);
939 buff[len] = 0;
940 SendMsg(2405, type, (long)buff);
941 delete [] buff;
a5b274d7 942
9e730a78
RD
943}
944
945// Clear all the registered images.
946void wxStyledTextCtrl::ClearRegisteredImages() {
947 SendMsg(2408, 0, 0);
948}
949
950// Retrieve the auto-completion list type-separator character.
951int wxStyledTextCtrl::AutoCompGetTypeSeparator() {
952 return SendMsg(2285, 0, 0);
953}
954
955// Change the type-separator character in the string setting up an auto-completion list.
956// Default is '?' but can be changed if items contain '?'.
957void wxStyledTextCtrl::AutoCompSetTypeSeparator(int separatorCharacter) {
958 SendMsg(2286, separatorCharacter, 0);
959}
960
1e9bafca
RD
961// Set the maximum width, in characters, of auto-completion and user lists.
962// Set to 0 to autosize to fit longest item, which is the default.
963void wxStyledTextCtrl::AutoCompSetMaxWidth(int characterCount) {
964 SendMsg(2208, characterCount, 0);
965}
966
967// Get the maximum width, in characters, of auto-completion and user lists.
968int wxStyledTextCtrl::AutoCompGetMaxWidth() {
969 return SendMsg(2209, 0, 0);
970}
971
972// Set the maximum height, in rows, of auto-completion and user lists.
973// The default is 5 rows.
974void wxStyledTextCtrl::AutoCompSetMaxHeight(int rowCount) {
975 SendMsg(2210, rowCount, 0);
976}
977
978// Set the maximum height, in rows, of auto-completion and user lists.
979int wxStyledTextCtrl::AutoCompGetMaxHeight() {
980 return SendMsg(2211, 0, 0);
981}
982
4370573a
RD
983// Set the number of spaces used for one level of indentation.
984void wxStyledTextCtrl::SetIndent(int indentSize) {
985 SendMsg(2122, indentSize, 0);
986}
9ce192d4 987
4370573a
RD
988// Retrieve indentation size.
989int wxStyledTextCtrl::GetIndent() {
990 return SendMsg(2123, 0, 0);
9ce192d4
RD
991}
992
4370573a
RD
993// Indentation will only use space characters if useTabs is false, otherwise
994// it will use a combination of tabs and spaces.
995void wxStyledTextCtrl::SetUseTabs(bool useTabs) {
996 SendMsg(2124, useTabs, 0);
997}
9ce192d4 998
4370573a
RD
999// Retrieve whether tabs will be used in indentation.
1000bool wxStyledTextCtrl::GetUseTabs() {
1001 return SendMsg(2125, 0, 0) != 0;
1002}
9ce192d4 1003
4370573a
RD
1004// Change the indentation of a line to a number of columns.
1005void wxStyledTextCtrl::SetLineIndentation(int line, int indentSize) {
1006 SendMsg(2126, line, indentSize);
1007}
9ce192d4 1008
4370573a
RD
1009// Retrieve the number of columns that a line is indented.
1010int wxStyledTextCtrl::GetLineIndentation(int line) {
1011 return SendMsg(2127, line, 0);
9ce192d4
RD
1012}
1013
4370573a
RD
1014// Retrieve the position before the first non indentation character on a line.
1015int wxStyledTextCtrl::GetLineIndentPosition(int line) {
1016 return SendMsg(2128, line, 0);
1017}
9ce192d4 1018
4370573a
RD
1019// Retrieve the column number of a position, taking tab width into account.
1020int wxStyledTextCtrl::GetColumn(int pos) {
1021 return SendMsg(2129, pos, 0);
9ce192d4
RD
1022}
1023
4370573a
RD
1024// Show or hide the horizontal scroll bar.
1025void wxStyledTextCtrl::SetUseHorizontalScrollBar(bool show) {
1026 SendMsg(2130, show, 0);
1027}
9ce192d4 1028
4370573a
RD
1029// Is the horizontal scroll bar visible?
1030bool wxStyledTextCtrl::GetUseHorizontalScrollBar() {
1031 return SendMsg(2131, 0, 0) != 0;
9ce192d4
RD
1032}
1033
4370573a
RD
1034// Show or hide indentation guides.
1035void wxStyledTextCtrl::SetIndentationGuides(bool show) {
1036 SendMsg(2132, show, 0);
1037}
9ce192d4 1038
4370573a
RD
1039// Are the indentation guides visible?
1040bool wxStyledTextCtrl::GetIndentationGuides() {
1041 return SendMsg(2133, 0, 0) != 0;
9ce192d4
RD
1042}
1043
4370573a
RD
1044// Set the highlighted indentation guide column.
1045// 0 = no highlighted guide.
1046void wxStyledTextCtrl::SetHighlightGuide(int column) {
1047 SendMsg(2134, column, 0);
1048}
9ce192d4 1049
4370573a
RD
1050// Get the highlighted indentation guide column.
1051int wxStyledTextCtrl::GetHighlightGuide() {
1052 return SendMsg(2135, 0, 0);
9ce192d4
RD
1053}
1054
4370573a
RD
1055// Get the position after the last visible characters on a line.
1056int wxStyledTextCtrl::GetLineEndPosition(int line) {
1057 return SendMsg(2136, line, 0);
1058}
9ce192d4 1059
4370573a
RD
1060// Get the code page used to interpret the bytes of the document as characters.
1061int wxStyledTextCtrl::GetCodePage() {
1062 return SendMsg(2137, 0, 0);
9ce192d4
RD
1063}
1064
4370573a
RD
1065// Get the foreground colour of the caret.
1066wxColour wxStyledTextCtrl::GetCaretForeground() {
1067 long c = SendMsg(2138, 0, 0);
1068 return wxColourFromLong(c);
1069}
9ce192d4 1070
4370573a
RD
1071// In read-only mode?
1072bool wxStyledTextCtrl::GetReadOnly() {
1073 return SendMsg(2140, 0, 0) != 0;
9ce192d4
RD
1074}
1075
4370573a
RD
1076// Sets the position of the caret.
1077void wxStyledTextCtrl::SetCurrentPos(int pos) {
1078 SendMsg(2141, pos, 0);
1079}
9ce192d4 1080
4370573a
RD
1081// Sets the position that starts the selection - this becomes the anchor.
1082void wxStyledTextCtrl::SetSelectionStart(int pos) {
1083 SendMsg(2142, pos, 0);
9ce192d4
RD
1084}
1085
4370573a
RD
1086// Returns the position at the start of the selection.
1087int wxStyledTextCtrl::GetSelectionStart() {
1088 return SendMsg(2143, 0, 0);
1089}
9ce192d4 1090
4370573a
RD
1091// Sets the position that ends the selection - this becomes the currentPosition.
1092void wxStyledTextCtrl::SetSelectionEnd(int pos) {
1093 SendMsg(2144, pos, 0);
9ce192d4
RD
1094}
1095
4370573a
RD
1096// Returns the position at the end of the selection.
1097int wxStyledTextCtrl::GetSelectionEnd() {
1098 return SendMsg(2145, 0, 0);
1099}
9ce192d4 1100
4370573a
RD
1101// Sets the print magnification added to the point size of each style for printing.
1102void wxStyledTextCtrl::SetPrintMagnification(int magnification) {
1103 SendMsg(2146, magnification, 0);
9ce192d4
RD
1104}
1105
4370573a
RD
1106// Returns the print magnification.
1107int wxStyledTextCtrl::GetPrintMagnification() {
1108 return SendMsg(2147, 0, 0);
1109}
9ce192d4 1110
4370573a
RD
1111// Modify colours when printing for clearer printed text.
1112void wxStyledTextCtrl::SetPrintColourMode(int mode) {
1113 SendMsg(2148, mode, 0);
9ce192d4
RD
1114}
1115
4370573a
RD
1116// Returns the print colour mode.
1117int wxStyledTextCtrl::GetPrintColourMode() {
1118 return SendMsg(2149, 0, 0);
1119}
9ce192d4 1120
4370573a
RD
1121// Find some text in the document.
1122int wxStyledTextCtrl::FindText(int minPos, int maxPos,
9e730a78
RD
1123 const wxString& text,
1124 int flags) {
1125 TextToFind ft;
1126 ft.chrg.cpMin = minPos;
1127 ft.chrg.cpMax = maxPos;
1128 wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
1129 ft.lpstrText = (char*)(const char*)buf;
4370573a 1130
9e730a78 1131 return SendMsg(2150, flags, (long)&ft);
4370573a
RD
1132}
1133
a834585d 1134// On Windows, will draw the document into a display context such as a printer.
a5b274d7
WS
1135 int wxStyledTextCtrl::FormatRange(bool doDraw,
1136 int startPos,
1137 int endPos,
1138 wxDC* draw,
1139 wxDC* target,
1140 wxRect renderRect,
1141 wxRect pageRect) {
1142 RangeToFormat fr;
1143
1144 if (endPos < startPos) {
1145 int temp = startPos;
1146 startPos = endPos;
1147 endPos = temp;
1148 }
1149 fr.hdc = draw;
1150 fr.hdcTarget = target;
1151 fr.rc.top = renderRect.GetTop();
1152 fr.rc.left = renderRect.GetLeft();
1153 fr.rc.right = renderRect.GetRight();
1154 fr.rc.bottom = renderRect.GetBottom();
1155 fr.rcPage.top = pageRect.GetTop();
1156 fr.rcPage.left = pageRect.GetLeft();
1157 fr.rcPage.right = pageRect.GetRight();
1158 fr.rcPage.bottom = pageRect.GetBottom();
1159 fr.chrg.cpMin = startPos;
1160 fr.chrg.cpMax = endPos;
1161
1162 return SendMsg(2151, doDraw, (long)&fr);
9e730a78
RD
1163}
1164
1165// Retrieve the display line at the top of the display.
4370573a
RD
1166int wxStyledTextCtrl::GetFirstVisibleLine() {
1167 return SendMsg(2152, 0, 0);
9ce192d4
RD
1168}
1169
4370573a
RD
1170// Retrieve the contents of a line.
1171wxString wxStyledTextCtrl::GetLine(int line) {
9e730a78
RD
1172 int len = LineLength(line);
1173 if (!len) return wxEmptyString;
9ce192d4 1174
9e730a78
RD
1175 wxMemoryBuffer mbuf(len+1);
1176 char* buf = (char*)mbuf.GetWriteBuf(len+1);
1177 SendMsg(2153, line, (long)buf);
1178 mbuf.UngetWriteBuf(len);
1179 mbuf.AppendByte(0);
1180 return stc2wx(buf);
4370573a
RD
1181}
1182
1183// Returns the number of lines in the document. There is always at least one.
1184int wxStyledTextCtrl::GetLineCount() {
1185 return SendMsg(2154, 0, 0);
1186}
9ce192d4 1187
4370573a 1188// Sets the size in pixels of the left margin.
65ec6247
RD
1189void wxStyledTextCtrl::SetMarginLeft(int pixelWidth) {
1190 SendMsg(2155, 0, pixelWidth);
4370573a 1191}
9ce192d4 1192
4370573a
RD
1193// Returns the size in pixels of the left margin.
1194int wxStyledTextCtrl::GetMarginLeft() {
1195 return SendMsg(2156, 0, 0);
9ce192d4
RD
1196}
1197
4370573a 1198// Sets the size in pixels of the right margin.
65ec6247
RD
1199void wxStyledTextCtrl::SetMarginRight(int pixelWidth) {
1200 SendMsg(2157, 0, pixelWidth);
4370573a 1201}
9ce192d4 1202
4370573a
RD
1203// Returns the size in pixels of the right margin.
1204int wxStyledTextCtrl::GetMarginRight() {
1205 return SendMsg(2158, 0, 0);
9ce192d4
RD
1206}
1207
4370573a
RD
1208// Is the document different from when it was last saved?
1209bool wxStyledTextCtrl::GetModify() {
1210 return SendMsg(2159, 0, 0) != 0;
1211}
9ce192d4 1212
4370573a
RD
1213// Select a range of text.
1214void wxStyledTextCtrl::SetSelection(int start, int end) {
1215 SendMsg(2160, start, end);
9ce192d4
RD
1216}
1217
4370573a
RD
1218// Retrieve the selected text.
1219wxString wxStyledTextCtrl::GetSelectedText() {
9e730a78
RD
1220 int start;
1221 int end;
9ce192d4 1222
9e730a78
RD
1223 GetSelection(&start, &end);
1224 int len = end - start;
1225 if (!len) return wxEmptyString;
9ce192d4 1226
3d7a4fe8 1227 wxMemoryBuffer mbuf(len+2);
9e730a78
RD
1228 char* buf = (char*)mbuf.GetWriteBuf(len+1);
1229 SendMsg(2161, 0, (long)buf);
1230 mbuf.UngetWriteBuf(len);
1231 mbuf.AppendByte(0);
1232 return stc2wx(buf);
4370573a 1233}
9ce192d4 1234
4370573a
RD
1235// Retrieve a range of text.
1236wxString wxStyledTextCtrl::GetTextRange(int startPos, int endPos) {
9e730a78
RD
1237 if (endPos < startPos) {
1238 int temp = startPos;
1239 startPos = endPos;
1240 endPos = temp;
1241 }
1242 int len = endPos - startPos;
1243 if (!len) return wxEmptyString;
1244 wxMemoryBuffer mbuf(len+1);
1245 char* buf = (char*)mbuf.GetWriteBuf(len);
1246 TextRange tr;
1247 tr.lpstrText = buf;
1248 tr.chrg.cpMin = startPos;
1249 tr.chrg.cpMax = endPos;
1250 SendMsg(2162, 0, (long)&tr);
1251 mbuf.UngetWriteBuf(len);
1252 mbuf.AppendByte(0);
1253 return stc2wx(buf);
9ce192d4
RD
1254}
1255
4370573a
RD
1256// Draw the selection in normal style or with selection highlighted.
1257void wxStyledTextCtrl::HideSelection(bool normal) {
1258 SendMsg(2163, normal, 0);
1259}
9ce192d4 1260
4370573a
RD
1261// Retrieve the line containing a position.
1262int wxStyledTextCtrl::LineFromPosition(int pos) {
1263 return SendMsg(2166, pos, 0);
9ce192d4
RD
1264}
1265
4370573a
RD
1266// Retrieve the position at the start of a line.
1267int wxStyledTextCtrl::PositionFromLine(int line) {
1268 return SendMsg(2167, line, 0);
1269}
9ce192d4 1270
4370573a
RD
1271// Scroll horizontally and vertically.
1272void wxStyledTextCtrl::LineScroll(int columns, int lines) {
1273 SendMsg(2168, columns, lines);
9ce192d4
RD
1274}
1275
4370573a
RD
1276// Ensure the caret is visible.
1277void wxStyledTextCtrl::EnsureCaretVisible() {
1278 SendMsg(2169, 0, 0);
1279}
9ce192d4 1280
4370573a
RD
1281// Replace the selected text with the argument text.
1282void wxStyledTextCtrl::ReplaceSelection(const wxString& text) {
0c5b83b0 1283 SendMsg(2170, 0, (long)(const char*)wx2stc(text));
9ce192d4
RD
1284}
1285
4370573a
RD
1286// Set to read only or read write.
1287void wxStyledTextCtrl::SetReadOnly(bool readOnly) {
1288 SendMsg(2171, readOnly, 0);
1289}
9ce192d4 1290
4370573a
RD
1291// Will a paste succeed?
1292bool wxStyledTextCtrl::CanPaste() {
1293 return SendMsg(2173, 0, 0) != 0;
9ce192d4
RD
1294}
1295
a834585d 1296// Are there any undoable actions in the undo history?
4370573a
RD
1297bool wxStyledTextCtrl::CanUndo() {
1298 return SendMsg(2174, 0, 0) != 0;
1299}
9ce192d4 1300
4370573a
RD
1301// Delete the undo history.
1302void wxStyledTextCtrl::EmptyUndoBuffer() {
1303 SendMsg(2175, 0, 0);
9ce192d4
RD
1304}
1305
4370573a
RD
1306// Undo one action in the undo history.
1307void wxStyledTextCtrl::Undo() {
1308 SendMsg(2176, 0, 0);
1309}
9ce192d4 1310
4370573a
RD
1311// Cut the selection to the clipboard.
1312void wxStyledTextCtrl::Cut() {
1313 SendMsg(2177, 0, 0);
f6bcfd97
BP
1314}
1315
4370573a
RD
1316// Copy the selection to the clipboard.
1317void wxStyledTextCtrl::Copy() {
1318 SendMsg(2178, 0, 0);
1319}
f6bcfd97 1320
4370573a
RD
1321// Paste the contents of the clipboard into the document replacing the selection.
1322void wxStyledTextCtrl::Paste() {
1323 SendMsg(2179, 0, 0);
f6bcfd97
BP
1324}
1325
4370573a
RD
1326// Clear the selection.
1327void wxStyledTextCtrl::Clear() {
1328 SendMsg(2180, 0, 0);
1329}
f6bcfd97 1330
4370573a
RD
1331// Replace the contents of the document with the argument text.
1332void wxStyledTextCtrl::SetText(const wxString& text) {
0c5b83b0 1333 SendMsg(2181, 0, (long)(const char*)wx2stc(text));
f6bcfd97
BP
1334}
1335
4370573a
RD
1336// Retrieve all the text in the document.
1337wxString wxStyledTextCtrl::GetText() {
9e730a78
RD
1338 int len = GetTextLength();
1339 wxMemoryBuffer mbuf(len+1); // leave room for the null...
1340 char* buf = (char*)mbuf.GetWriteBuf(len+1);
1341 SendMsg(2182, len+1, (long)buf);
1342 mbuf.UngetWriteBuf(len);
1343 mbuf.AppendByte(0);
1344 return stc2wx(buf);
4370573a 1345}
9ce192d4 1346
4370573a
RD
1347// Retrieve the number of characters in the document.
1348int wxStyledTextCtrl::GetTextLength() {
1349 return SendMsg(2183, 0, 0);
9ce192d4
RD
1350}
1351
a834585d 1352// Set to overtype (true) or insert mode.
4370573a
RD
1353void wxStyledTextCtrl::SetOvertype(bool overtype) {
1354 SendMsg(2186, overtype, 0);
1355}
9ce192d4 1356
4370573a
RD
1357// Returns true if overtype mode is active otherwise false is returned.
1358bool wxStyledTextCtrl::GetOvertype() {
1359 return SendMsg(2187, 0, 0) != 0;
9ce192d4
RD
1360}
1361
a834585d 1362// Set the width of the insert mode caret.
65ec6247
RD
1363void wxStyledTextCtrl::SetCaretWidth(int pixelWidth) {
1364 SendMsg(2188, pixelWidth, 0);
1365}
1366
a834585d 1367// Returns the width of the insert mode caret.
65ec6247
RD
1368int wxStyledTextCtrl::GetCaretWidth() {
1369 return SendMsg(2189, 0, 0);
1370}
1371
1372// Sets the position that starts the target which is used for updating the
1373// document without affecting the scroll position.
1374void wxStyledTextCtrl::SetTargetStart(int pos) {
1375 SendMsg(2190, pos, 0);
1376}
1377
1378// Get the position that starts the target.
1379int wxStyledTextCtrl::GetTargetStart() {
1380 return SendMsg(2191, 0, 0);
1381}
1382
1383// Sets the position that ends the target which is used for updating the
1384// document without affecting the scroll position.
1385void wxStyledTextCtrl::SetTargetEnd(int pos) {
1386 SendMsg(2192, pos, 0);
1387}
1388
1389// Get the position that ends the target.
1390int wxStyledTextCtrl::GetTargetEnd() {
1391 return SendMsg(2193, 0, 0);
1392}
1393
1394// Replace the target text with the argument text.
8e54aaed 1395// Text is counted so it can contain NULs.
65ec6247
RD
1396// Returns the length of the replacement text.
1397
9e730a78
RD
1398 int wxStyledTextCtrl::ReplaceTarget(const wxString& text) {
1399 wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
1400 return SendMsg(2194, strlen(buf), (long)(const char*)buf);
65ec6247
RD
1401}
1402
1403// Replace the target text with the argument text after \d processing.
8e54aaed 1404// Text is counted so it can contain NULs.
65ec6247
RD
1405// Looks for \d where d is between 1 and 9 and replaces these with the strings
1406// matched in the last search operation which were surrounded by \( and \).
1407// Returns the length of the replacement text including any change
1408// caused by processing the \d patterns.
1409
9e730a78
RD
1410 int wxStyledTextCtrl::ReplaceTargetRE(const wxString& text) {
1411 wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
1412 return SendMsg(2195, strlen(buf), (long)(const char*)buf);
65ec6247
RD
1413}
1414
1415// Search for a counted string in the target and set the target to the found
8e54aaed 1416// range. Text is counted so it can contain NULs.
65ec6247
RD
1417// Returns length of range or -1 for failure in which case target is not moved.
1418
9e730a78
RD
1419 int wxStyledTextCtrl::SearchInTarget(const wxString& text) {
1420 wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
1421 return SendMsg(2197, strlen(buf), (long)(const char*)buf);
65ec6247
RD
1422}
1423
a834585d 1424// Set the search flags used by SearchInTarget.
65ec6247
RD
1425void wxStyledTextCtrl::SetSearchFlags(int flags) {
1426 SendMsg(2198, flags, 0);
1427}
1428
a834585d 1429// Get the search flags used by SearchInTarget.
65ec6247
RD
1430int wxStyledTextCtrl::GetSearchFlags() {
1431 return SendMsg(2199, 0, 0);
1432}
1433
4370573a
RD
1434// Show a call tip containing a definition near position pos.
1435void wxStyledTextCtrl::CallTipShow(int pos, const wxString& definition) {
0c5b83b0 1436 SendMsg(2200, pos, (long)(const char*)wx2stc(definition));
4370573a 1437}
9ce192d4 1438
4370573a
RD
1439// Remove the call tip from the screen.
1440void wxStyledTextCtrl::CallTipCancel() {
1441 SendMsg(2201, 0, 0);
9ce192d4
RD
1442}
1443
4370573a
RD
1444// Is there an active call tip?
1445bool wxStyledTextCtrl::CallTipActive() {
1446 return SendMsg(2202, 0, 0) != 0;
1447}
9ce192d4 1448
4370573a 1449// Retrieve the position where the caret was before displaying the call tip.
9ce192d4 1450int wxStyledTextCtrl::CallTipPosAtStart() {
4370573a 1451 return SendMsg(2203, 0, 0);
9ce192d4
RD
1452}
1453
4370573a 1454// Highlight a segment of the definition.
9ce192d4 1455void wxStyledTextCtrl::CallTipSetHighlight(int start, int end) {
4370573a 1456 SendMsg(2204, start, end);
9ce192d4
RD
1457}
1458
4370573a
RD
1459// Set the background colour for the call tip.
1460void wxStyledTextCtrl::CallTipSetBackground(const wxColour& back) {
1461 SendMsg(2205, wxColourAsLong(back), 0);
1462}
9ce192d4 1463
9e730a78
RD
1464// Set the foreground colour for the call tip.
1465void wxStyledTextCtrl::CallTipSetForeground(const wxColour& fore) {
1466 SendMsg(2206, wxColourAsLong(fore), 0);
1467}
1468
1469// Set the foreground colour for the highlighted part of the call tip.
1470void wxStyledTextCtrl::CallTipSetForegroundHighlight(const wxColour& fore) {
1471 SendMsg(2207, wxColourAsLong(fore), 0);
1472}
1473
b8193d80
RD
1474// Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
1475void wxStyledTextCtrl::CallTipUseStyle(int tabSize) {
1476 SendMsg(2212, tabSize, 0);
1477}
1478
4370573a
RD
1479// Find the display line of a document line taking hidden lines into account.
1480int wxStyledTextCtrl::VisibleFromDocLine(int line) {
1481 return SendMsg(2220, line, 0);
9ce192d4
RD
1482}
1483
4370573a
RD
1484// Find the document line of a display line taking hidden lines into account.
1485int wxStyledTextCtrl::DocLineFromVisible(int lineDisplay) {
1486 return SendMsg(2221, lineDisplay, 0);
1487}
9ce192d4 1488
1e9bafca
RD
1489// The number of display lines needed to wrap a document line
1490int wxStyledTextCtrl::WrapCount(int line) {
1491 return SendMsg(2235, line, 0);
1492}
1493
4370573a
RD
1494// Set the fold level of a line.
1495// This encodes an integer level along with flags indicating whether the
1496// line is a header and whether it is effectively white space.
1497void wxStyledTextCtrl::SetFoldLevel(int line, int level) {
1498 SendMsg(2222, line, level);
1499}
9ce192d4 1500
4370573a
RD
1501// Retrieve the fold level of a line.
1502int wxStyledTextCtrl::GetFoldLevel(int line) {
1503 return SendMsg(2223, line, 0);
1504}
d134f170 1505
4370573a
RD
1506// Find the last child line of a header line.
1507int wxStyledTextCtrl::GetLastChild(int line, int level) {
1508 return SendMsg(2224, line, level);
9ce192d4
RD
1509}
1510
4370573a
RD
1511// Find the parent line of a child line.
1512int wxStyledTextCtrl::GetFoldParent(int line) {
1513 return SendMsg(2225, line, 0);
1514}
9ce192d4 1515
4370573a
RD
1516// Make a range of lines visible.
1517void wxStyledTextCtrl::ShowLines(int lineStart, int lineEnd) {
1518 SendMsg(2226, lineStart, lineEnd);
9ce192d4
RD
1519}
1520
4370573a
RD
1521// Make a range of lines invisible.
1522void wxStyledTextCtrl::HideLines(int lineStart, int lineEnd) {
1523 SendMsg(2227, lineStart, lineEnd);
1524}
9ce192d4 1525
4370573a
RD
1526// Is a line visible?
1527bool wxStyledTextCtrl::GetLineVisible(int line) {
1528 return SendMsg(2228, line, 0) != 0;
9ce192d4
RD
1529}
1530
4370573a
RD
1531// Show the children of a header line.
1532void wxStyledTextCtrl::SetFoldExpanded(int line, bool expanded) {
1533 SendMsg(2229, line, expanded);
1534}
9ce192d4 1535
4370573a
RD
1536// Is a header line expanded?
1537bool wxStyledTextCtrl::GetFoldExpanded(int line) {
1538 return SendMsg(2230, line, 0) != 0;
9ce192d4
RD
1539}
1540
4370573a
RD
1541// Switch a header line between expanded and contracted.
1542void wxStyledTextCtrl::ToggleFold(int line) {
1543 SendMsg(2231, line, 0);
1544}
9ce192d4 1545
4370573a
RD
1546// Ensure a particular line is visible by expanding any header line hiding it.
1547void wxStyledTextCtrl::EnsureVisible(int line) {
1548 SendMsg(2232, line, 0);
1549}
9ce192d4 1550
9e730a78 1551// Set some style options for folding.
4370573a
RD
1552void wxStyledTextCtrl::SetFoldFlags(int flags) {
1553 SendMsg(2233, flags, 0);
9ce192d4
RD
1554}
1555
65ec6247
RD
1556// Ensure a particular line is visible by expanding any header line hiding it.
1557// Use the currently set visibility policy to determine which range to display.
1558void wxStyledTextCtrl::EnsureVisibleEnforcePolicy(int line) {
1559 SendMsg(2234, line, 0);
1560}
1561
a834585d 1562// Sets whether a tab pressed when caret is within indentation indents.
65ec6247
RD
1563void wxStyledTextCtrl::SetTabIndents(bool tabIndents) {
1564 SendMsg(2260, tabIndents, 0);
1565}
1566
1567// Does a tab pressed when caret is within indentation indent?
1568bool wxStyledTextCtrl::GetTabIndents() {
1569 return SendMsg(2261, 0, 0) != 0;
1570}
1571
a834585d 1572// Sets whether a backspace pressed when caret is within indentation unindents.
65ec6247
RD
1573void wxStyledTextCtrl::SetBackSpaceUnIndents(bool bsUnIndents) {
1574 SendMsg(2262, bsUnIndents, 0);
1575}
1576
1577// Does a backspace pressed when caret is within indentation unindent?
1578bool wxStyledTextCtrl::GetBackSpaceUnIndents() {
1579 return SendMsg(2263, 0, 0) != 0;
1580}
1581
a834585d 1582// Sets the time the mouse must sit still to generate a mouse dwell event.
65ec6247
RD
1583void wxStyledTextCtrl::SetMouseDwellTime(int periodMilliseconds) {
1584 SendMsg(2264, periodMilliseconds, 0);
1585}
1586
a834585d 1587// Retrieve the time the mouse must sit still to generate a mouse dwell event.
65ec6247
RD
1588int wxStyledTextCtrl::GetMouseDwellTime() {
1589 return SendMsg(2265, 0, 0);
1590}
1591
a834585d 1592// Get position of start of word.
1a2fb4cd
RD
1593int wxStyledTextCtrl::WordStartPosition(int pos, bool onlyWordCharacters) {
1594 return SendMsg(2266, pos, onlyWordCharacters);
1595}
1596
a834585d 1597// Get position of end of word.
1a2fb4cd
RD
1598int wxStyledTextCtrl::WordEndPosition(int pos, bool onlyWordCharacters) {
1599 return SendMsg(2267, pos, onlyWordCharacters);
1600}
1601
a834585d 1602// Sets whether text is word wrapped.
1a2fb4cd
RD
1603void wxStyledTextCtrl::SetWrapMode(int mode) {
1604 SendMsg(2268, mode, 0);
1605}
1606
a834585d 1607// Retrieve whether text is word wrapped.
1a2fb4cd
RD
1608int wxStyledTextCtrl::GetWrapMode() {
1609 return SendMsg(2269, 0, 0);
1610}
1611
591d01be
RD
1612// Set the display mode of visual flags for wrapped lines.
1613void wxStyledTextCtrl::SetWrapVisualFlags(int wrapVisualFlags) {
1614 SendMsg(2460, wrapVisualFlags, 0);
1615}
1616
1617// Retrive the display mode of visual flags for wrapped lines.
1618int wxStyledTextCtrl::GetWrapVisualFlags() {
1619 return SendMsg(2461, 0, 0);
1620}
1621
1622// Set the location of visual flags for wrapped lines.
1623void wxStyledTextCtrl::SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation) {
1624 SendMsg(2462, wrapVisualFlagsLocation, 0);
1625}
1626
1627// Retrive the location of visual flags for wrapped lines.
1628int wxStyledTextCtrl::GetWrapVisualFlagsLocation() {
1629 return SendMsg(2463, 0, 0);
1630}
1631
1632// Set the start indent for wrapped lines.
1633void wxStyledTextCtrl::SetWrapStartIndent(int indent) {
1634 SendMsg(2464, indent, 0);
1635}
1636
1637// Retrive the start indent for wrapped lines.
1638int wxStyledTextCtrl::GetWrapStartIndent() {
1639 return SendMsg(2465, 0, 0);
1640}
1641
a834585d 1642// Sets the degree of caching of layout information.
1a2fb4cd
RD
1643void wxStyledTextCtrl::SetLayoutCache(int mode) {
1644 SendMsg(2272, mode, 0);
1645}
1646
a834585d 1647// Retrieve the degree of caching of layout information.
1a2fb4cd
RD
1648int wxStyledTextCtrl::GetLayoutCache() {
1649 return SendMsg(2273, 0, 0);
1650}
1651
a834585d
RD
1652// Sets the document width assumed for scrolling.
1653void wxStyledTextCtrl::SetScrollWidth(int pixelWidth) {
1654 SendMsg(2274, pixelWidth, 0);
1655}
1656
1657// Retrieve the document width assumed for scrolling.
1658int wxStyledTextCtrl::GetScrollWidth() {
1659 return SendMsg(2275, 0, 0);
1660}
1661
1662// Measure the pixel width of some text in a particular style.
8e54aaed 1663// NUL terminated text argument.
a834585d
RD
1664// Does not handle tab or control characters.
1665int wxStyledTextCtrl::TextWidth(int style, const wxString& text) {
1666 return SendMsg(2276, style, (long)(const char*)wx2stc(text));
1667}
1668
1669// Sets the scroll range so that maximum scroll position has
1670// the last line at the bottom of the view (default).
1671// Setting this to false allows scrolling one page below the last line.
1672void wxStyledTextCtrl::SetEndAtLastLine(bool endAtLastLine) {
1673 SendMsg(2277, endAtLastLine, 0);
1674}
1675
1676// Retrieve whether the maximum scroll position has the last
1677// line at the bottom of the view.
1e9bafca
RD
1678bool wxStyledTextCtrl::GetEndAtLastLine() {
1679 return SendMsg(2278, 0, 0) != 0;
a834585d
RD
1680}
1681
1682// Retrieve the height of a particular line of text in pixels.
1683int wxStyledTextCtrl::TextHeight(int line) {
1684 return SendMsg(2279, line, 0);
1685}
1686
9e730a78
RD
1687// Show or hide the vertical scroll bar.
1688void wxStyledTextCtrl::SetUseVerticalScrollBar(bool show) {
1689 SendMsg(2280, show, 0);
1690}
1691
1692// Is the vertical scroll bar visible?
1693bool wxStyledTextCtrl::GetUseVerticalScrollBar() {
1694 return SendMsg(2281, 0, 0) != 0;
1695}
1696
1697// Append a string to the end of the document without changing the selection.
41a499cd
RD
1698void wxStyledTextCtrl::AppendText(const wxString& text) {
1699 wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
1700 SendMsg(2282, strlen(buf), (long)(const char*)buf);
9e730a78
RD
1701}
1702
1703// Is drawing done in two phases with backgrounds drawn before foregrounds?
1704bool wxStyledTextCtrl::GetTwoPhaseDraw() {
1705 return SendMsg(2283, 0, 0) != 0;
1706}
1707
1708// In twoPhaseDraw mode, drawing is performed in two phases, first the background
1709// and then the foreground. This avoids chopping off characters that overlap the next run.
1710void wxStyledTextCtrl::SetTwoPhaseDraw(bool twoPhase) {
1711 SendMsg(2284, twoPhase, 0);
1712}
1713
1714// Make the target range start and end be the same as the selection range start and end.
1715void wxStyledTextCtrl::TargetFromSelection() {
1716 SendMsg(2287, 0, 0);
1717}
1718
1719// Join the lines in the target.
1720void wxStyledTextCtrl::LinesJoin() {
1721 SendMsg(2288, 0, 0);
1722}
1723
1724// Split the lines in the target into lines that are less wide than pixelWidth
1725// where possible.
1726void wxStyledTextCtrl::LinesSplit(int pixelWidth) {
1727 SendMsg(2289, pixelWidth, 0);
1728}
1729
1730// Set the colours used as a chequerboard pattern in the fold margin
1731void wxStyledTextCtrl::SetFoldMarginColour(bool useSetting, const wxColour& back) {
1732 SendMsg(2290, useSetting, wxColourAsLong(back));
1733}
1734void wxStyledTextCtrl::SetFoldMarginHiColour(bool useSetting, const wxColour& fore) {
1735 SendMsg(2291, useSetting, wxColourAsLong(fore));
1736}
1737
c26dba42
RD
1738// Move caret down one line.
1739void wxStyledTextCtrl::LineDown() {
1740 SendMsg(2300, 0, 0);
1741}
1742
1743// Move caret down one line extending selection to new caret position.
1744void wxStyledTextCtrl::LineDownExtend() {
1745 SendMsg(2301, 0, 0);
1746}
1747
1748// Move caret up one line.
1749void wxStyledTextCtrl::LineUp() {
1750 SendMsg(2302, 0, 0);
1751}
1752
1753// Move caret up one line extending selection to new caret position.
1754void wxStyledTextCtrl::LineUpExtend() {
1755 SendMsg(2303, 0, 0);
1756}
1757
1758// Move caret left one character.
1759void wxStyledTextCtrl::CharLeft() {
1760 SendMsg(2304, 0, 0);
1761}
1762
1763// Move caret left one character extending selection to new caret position.
1764void wxStyledTextCtrl::CharLeftExtend() {
1765 SendMsg(2305, 0, 0);
1766}
1767
1768// Move caret right one character.
1769void wxStyledTextCtrl::CharRight() {
1770 SendMsg(2306, 0, 0);
1771}
1772
1773// Move caret right one character extending selection to new caret position.
1774void wxStyledTextCtrl::CharRightExtend() {
1775 SendMsg(2307, 0, 0);
1776}
1777
1778// Move caret left one word.
1779void wxStyledTextCtrl::WordLeft() {
1780 SendMsg(2308, 0, 0);
1781}
1782
1783// Move caret left one word extending selection to new caret position.
1784void wxStyledTextCtrl::WordLeftExtend() {
1785 SendMsg(2309, 0, 0);
1786}
1787
1788// Move caret right one word.
1789void wxStyledTextCtrl::WordRight() {
1790 SendMsg(2310, 0, 0);
1791}
1792
1793// Move caret right one word extending selection to new caret position.
1794void wxStyledTextCtrl::WordRightExtend() {
1795 SendMsg(2311, 0, 0);
1796}
1797
1798// Move caret to first position on line.
1799void wxStyledTextCtrl::Home() {
1800 SendMsg(2312, 0, 0);
1801}
1802
1803// Move caret to first position on line extending selection to new caret position.
1804void wxStyledTextCtrl::HomeExtend() {
1805 SendMsg(2313, 0, 0);
1806}
1807
1808// Move caret to last position on line.
1809void wxStyledTextCtrl::LineEnd() {
1810 SendMsg(2314, 0, 0);
1811}
1812
1813// Move caret to last position on line extending selection to new caret position.
1814void wxStyledTextCtrl::LineEndExtend() {
1815 SendMsg(2315, 0, 0);
1816}
1817
1818// Move caret to first position in document.
1819void wxStyledTextCtrl::DocumentStart() {
1820 SendMsg(2316, 0, 0);
1821}
1822
1823// Move caret to first position in document extending selection to new caret position.
1824void wxStyledTextCtrl::DocumentStartExtend() {
1825 SendMsg(2317, 0, 0);
1826}
1827
1828// Move caret to last position in document.
1829void wxStyledTextCtrl::DocumentEnd() {
1830 SendMsg(2318, 0, 0);
1831}
1832
1833// Move caret to last position in document extending selection to new caret position.
1834void wxStyledTextCtrl::DocumentEndExtend() {
1835 SendMsg(2319, 0, 0);
1836}
1837
1838// Move caret one page up.
1839void wxStyledTextCtrl::PageUp() {
1840 SendMsg(2320, 0, 0);
1841}
1842
1843// Move caret one page up extending selection to new caret position.
1844void wxStyledTextCtrl::PageUpExtend() {
1845 SendMsg(2321, 0, 0);
1846}
1847
1848// Move caret one page down.
1849void wxStyledTextCtrl::PageDown() {
1850 SendMsg(2322, 0, 0);
1851}
1852
1853// Move caret one page down extending selection to new caret position.
1854void wxStyledTextCtrl::PageDownExtend() {
1855 SendMsg(2323, 0, 0);
1856}
1857
1858// Switch from insert to overtype mode or the reverse.
1859void wxStyledTextCtrl::EditToggleOvertype() {
1860 SendMsg(2324, 0, 0);
1861}
1862
1863// Cancel any modes such as call tip or auto-completion list display.
1864void wxStyledTextCtrl::Cancel() {
1865 SendMsg(2325, 0, 0);
1866}
1867
1868// Delete the selection or if no selection, the character before the caret.
1869void wxStyledTextCtrl::DeleteBack() {
1870 SendMsg(2326, 0, 0);
1871}
1872
1873// If selection is empty or all on one line replace the selection with a tab character.
1874// If more than one line selected, indent the lines.
1875void wxStyledTextCtrl::Tab() {
1876 SendMsg(2327, 0, 0);
1877}
1878
1879// Dedent the selected lines.
1880void wxStyledTextCtrl::BackTab() {
1881 SendMsg(2328, 0, 0);
1882}
1883
1884// Insert a new line, may use a CRLF, CR or LF depending on EOL mode.
1885void wxStyledTextCtrl::NewLine() {
1886 SendMsg(2329, 0, 0);
1887}
1888
1889// Insert a Form Feed character.
1890void wxStyledTextCtrl::FormFeed() {
1891 SendMsg(2330, 0, 0);
1892}
1893
1894// Move caret to before first visible character on line.
1895// If already there move to first character on line.
1896void wxStyledTextCtrl::VCHome() {
1897 SendMsg(2331, 0, 0);
1898}
1899
1900// Like VCHome but extending selection to new caret position.
1901void wxStyledTextCtrl::VCHomeExtend() {
1902 SendMsg(2332, 0, 0);
1903}
1904
1905// Magnify the displayed text by increasing the sizes by 1 point.
1906void wxStyledTextCtrl::ZoomIn() {
1907 SendMsg(2333, 0, 0);
1908}
1909
1910// Make the displayed text smaller by decreasing the sizes by 1 point.
1911void wxStyledTextCtrl::ZoomOut() {
1912 SendMsg(2334, 0, 0);
1913}
1914
1915// Delete the word to the left of the caret.
1916void wxStyledTextCtrl::DelWordLeft() {
1917 SendMsg(2335, 0, 0);
1918}
1919
1920// Delete the word to the right of the caret.
1921void wxStyledTextCtrl::DelWordRight() {
1922 SendMsg(2336, 0, 0);
1923}
1924
1925// Cut the line containing the caret.
1926void wxStyledTextCtrl::LineCut() {
1927 SendMsg(2337, 0, 0);
1928}
1929
1930// Delete the line containing the caret.
1931void wxStyledTextCtrl::LineDelete() {
1932 SendMsg(2338, 0, 0);
1933}
1934
1935// Switch the current line with the previous.
1936void wxStyledTextCtrl::LineTranspose() {
1937 SendMsg(2339, 0, 0);
1938}
1939
9e730a78
RD
1940// Duplicate the current line.
1941void wxStyledTextCtrl::LineDuplicate() {
1942 SendMsg(2404, 0, 0);
1943}
1944
c26dba42
RD
1945// Transform the selection to lower case.
1946void wxStyledTextCtrl::LowerCase() {
1947 SendMsg(2340, 0, 0);
1948}
1949
1950// Transform the selection to upper case.
1951void wxStyledTextCtrl::UpperCase() {
1952 SendMsg(2341, 0, 0);
1953}
1954
1955// Scroll the document down, keeping the caret visible.
1956void wxStyledTextCtrl::LineScrollDown() {
1957 SendMsg(2342, 0, 0);
1958}
1959
1960// Scroll the document up, keeping the caret visible.
1961void wxStyledTextCtrl::LineScrollUp() {
1962 SendMsg(2343, 0, 0);
1963}
1964
1965// Delete the selection or if no selection, the character before the caret.
1966// Will not delete the character before at the start of a line.
1967void wxStyledTextCtrl::DeleteBackNotLine() {
1968 SendMsg(2344, 0, 0);
1969}
1970
f114b858
RD
1971// Move caret to first position on display line.
1972void wxStyledTextCtrl::HomeDisplay() {
1973 SendMsg(2345, 0, 0);
1974}
1975
2b5f62a0 1976// Move caret to first position on display line extending selection to
f114b858
RD
1977// new caret position.
1978void wxStyledTextCtrl::HomeDisplayExtend() {
1979 SendMsg(2346, 0, 0);
1980}
1981
1982// Move caret to last position on display line.
1983void wxStyledTextCtrl::LineEndDisplay() {
1984 SendMsg(2347, 0, 0);
1985}
1986
2b5f62a0 1987// Move caret to last position on display line extending selection to new
f114b858
RD
1988// caret position.
1989void wxStyledTextCtrl::LineEndDisplayExtend() {
1990 SendMsg(2348, 0, 0);
1991}
1992
c26dba42
RD
1993// These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)?
1994// except they behave differently when word-wrap is enabled:
1995// They go first to the start / end of the display line, like (Home|LineEnd)Display
1996// The difference is that, the cursor is already at the point, it goes on to the start
1997// or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
1998void wxStyledTextCtrl::HomeWrap() {
1999 SendMsg(2349, 0, 0);
2000}
2001void wxStyledTextCtrl::HomeWrapExtend() {
2002 SendMsg(2450, 0, 0);
2003}
2004void wxStyledTextCtrl::LineEndWrap() {
2005 SendMsg(2451, 0, 0);
2006}
2007void wxStyledTextCtrl::LineEndWrapExtend() {
2008 SendMsg(2452, 0, 0);
2009}
2010void wxStyledTextCtrl::VCHomeWrap() {
2011 SendMsg(2453, 0, 0);
2012}
2013void wxStyledTextCtrl::VCHomeWrapExtend() {
2014 SendMsg(2454, 0, 0);
2015}
2016
e14d10b0
RD
2017// Copy the line containing the caret.
2018void wxStyledTextCtrl::LineCopy() {
2019 SendMsg(2455, 0, 0);
2020}
2021
a834585d 2022// Move the caret inside current view if it's not there already.
65ec6247
RD
2023void wxStyledTextCtrl::MoveCaretInsideView() {
2024 SendMsg(2401, 0, 0);
2025}
2026
a834585d 2027// How many characters are on a line, not including end of line characters?
4370573a
RD
2028int wxStyledTextCtrl::LineLength(int line) {
2029 return SendMsg(2350, line, 0);
2030}
9ce192d4 2031
4370573a
RD
2032// Highlight the characters at two positions.
2033void wxStyledTextCtrl::BraceHighlight(int pos1, int pos2) {
2034 SendMsg(2351, pos1, pos2);
2035}
9ce192d4 2036
4370573a
RD
2037// Highlight the character at a position indicating there is no matching brace.
2038void wxStyledTextCtrl::BraceBadLight(int pos) {
2039 SendMsg(2352, pos, 0);
9ce192d4
RD
2040}
2041
4370573a
RD
2042// Find the position of a matching brace or INVALID_POSITION if no match.
2043int wxStyledTextCtrl::BraceMatch(int pos) {
2044 return SendMsg(2353, pos, 0);
2045}
9ce192d4 2046
a834585d 2047// Are the end of line characters visible?
4370573a
RD
2048bool wxStyledTextCtrl::GetViewEOL() {
2049 return SendMsg(2355, 0, 0) != 0;
9ce192d4
RD
2050}
2051
a834585d 2052// Make the end of line characters visible or invisible.
4370573a
RD
2053void wxStyledTextCtrl::SetViewEOL(bool visible) {
2054 SendMsg(2356, visible, 0);
2055}
9ce192d4 2056
4370573a
RD
2057// Retrieve a pointer to the document object.
2058void* wxStyledTextCtrl::GetDocPointer() {
9e730a78 2059 return (void*)SendMsg(2357);
4370573a 2060}
67003d1a 2061
4370573a
RD
2062// Change the document object used.
2063void wxStyledTextCtrl::SetDocPointer(void* docPointer) {
9e730a78 2064 SendMsg(2358, 0, (long)docPointer);
67003d1a
RD
2065}
2066
4370573a
RD
2067// Set which document modification events are sent to the container.
2068void wxStyledTextCtrl::SetModEventMask(int mask) {
2069 SendMsg(2359, mask, 0);
2070}
67003d1a 2071
4370573a
RD
2072// Retrieve the column number which text should be kept within.
2073int wxStyledTextCtrl::GetEdgeColumn() {
2074 return SendMsg(2360, 0, 0);
67003d1a
RD
2075}
2076
4370573a
RD
2077// Set the column number of the edge.
2078// If text goes past the edge then it is highlighted.
2079void wxStyledTextCtrl::SetEdgeColumn(int column) {
2080 SendMsg(2361, column, 0);
2081}
67003d1a 2082
4370573a
RD
2083// Retrieve the edge highlight mode.
2084int wxStyledTextCtrl::GetEdgeMode() {
2085 return SendMsg(2362, 0, 0);
67003d1a
RD
2086}
2087
4370573a
RD
2088// The edge may be displayed by a line (EDGE_LINE) or by highlighting text that
2089// goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).
2090void wxStyledTextCtrl::SetEdgeMode(int mode) {
2091 SendMsg(2363, mode, 0);
2092}
67003d1a 2093
4370573a
RD
2094// Retrieve the colour used in edge indication.
2095wxColour wxStyledTextCtrl::GetEdgeColour() {
2096 long c = SendMsg(2364, 0, 0);
2097 return wxColourFromLong(c);
67003d1a
RD
2098}
2099
4370573a
RD
2100// Change the colour used in edge indication.
2101void wxStyledTextCtrl::SetEdgeColour(const wxColour& edgeColour) {
2102 SendMsg(2365, wxColourAsLong(edgeColour), 0);
2103}
67003d1a 2104
4370573a
RD
2105// Sets the current caret position to be the search anchor.
2106void wxStyledTextCtrl::SearchAnchor() {
2107 SendMsg(2366, 0, 0);
67003d1a
RD
2108}
2109
4370573a 2110// Find some text starting at the search anchor.
65ec6247 2111// Does not ensure the selection is visible.
4370573a 2112int wxStyledTextCtrl::SearchNext(int flags, const wxString& text) {
0c5b83b0 2113 return SendMsg(2367, flags, (long)(const char*)wx2stc(text));
4370573a 2114}
67003d1a 2115
4370573a 2116// Find some text starting at the search anchor and moving backwards.
65ec6247 2117// Does not ensure the selection is visible.
4370573a 2118int wxStyledTextCtrl::SearchPrev(int flags, const wxString& text) {
0c5b83b0 2119 return SendMsg(2368, flags, (long)(const char*)wx2stc(text));
67003d1a
RD
2120}
2121
4370573a
RD
2122// Retrieves the number of lines completely visible.
2123int wxStyledTextCtrl::LinesOnScreen() {
2124 return SendMsg(2370, 0, 0);
67003d1a
RD
2125}
2126
4370573a
RD
2127// Set whether a pop up menu is displayed automatically when the user presses
2128// the wrong mouse button.
2129void wxStyledTextCtrl::UsePopUp(bool allowPopUp) {
2130 SendMsg(2371, allowPopUp, 0);
2131}
67003d1a 2132
a834585d 2133// Is the selection rectangular? The alternative is the more common stream selection.
4370573a
RD
2134bool wxStyledTextCtrl::SelectionIsRectangle() {
2135 return SendMsg(2372, 0, 0) != 0;
67003d1a
RD
2136}
2137
4370573a
RD
2138// Set the zoom level. This number of points is added to the size of all fonts.
2139// It may be positive to magnify or negative to reduce.
2140void wxStyledTextCtrl::SetZoom(int zoom) {
2141 SendMsg(2373, zoom, 0);
2142}
67003d1a 2143
4370573a
RD
2144// Retrieve the zoom level.
2145int wxStyledTextCtrl::GetZoom() {
2146 return SendMsg(2374, 0, 0);
67003d1a
RD
2147}
2148
4370573a
RD
2149// Create a new document object.
2150// Starts with reference count of 1 and not selected into editor.
2151void* wxStyledTextCtrl::CreateDocument() {
9e730a78 2152 return (void*)SendMsg(2375);
4370573a 2153}
67003d1a 2154
4370573a
RD
2155// Extend life of document.
2156void wxStyledTextCtrl::AddRefDocument(void* docPointer) {
9e730a78 2157 SendMsg(2376, 0, (long)docPointer);
67003d1a
RD
2158}
2159
4370573a
RD
2160// Release a reference to the document, deleting document if it fades to black.
2161void wxStyledTextCtrl::ReleaseDocument(void* docPointer) {
9e730a78 2162 SendMsg(2377, 0, (long)docPointer);
4370573a 2163}
67003d1a 2164
4370573a
RD
2165// Get which document modification events are sent to the container.
2166int wxStyledTextCtrl::GetModEventMask() {
2167 return SendMsg(2378, 0, 0);
67003d1a
RD
2168}
2169
a834585d 2170// Change internal focus flag.
8de28db9 2171void wxStyledTextCtrl::SetSTCFocus(bool focus) {
65ec6247
RD
2172 SendMsg(2380, focus, 0);
2173}
2174
a834585d 2175// Get internal focus flag.
8de28db9 2176bool wxStyledTextCtrl::GetSTCFocus() {
65ec6247
RD
2177 return SendMsg(2381, 0, 0) != 0;
2178}
2179
a834585d 2180// Change error status - 0 = OK.
65ec6247
RD
2181void wxStyledTextCtrl::SetStatus(int statusCode) {
2182 SendMsg(2382, statusCode, 0);
2183}
2184
a834585d 2185// Get error status.
65ec6247
RD
2186int wxStyledTextCtrl::GetStatus() {
2187 return SendMsg(2383, 0, 0);
2188}
2189
a834585d 2190// Set whether the mouse is captured when its button is pressed.
65ec6247
RD
2191void wxStyledTextCtrl::SetMouseDownCaptures(bool captures) {
2192 SendMsg(2384, captures, 0);
2193}
2194
a834585d 2195// Get whether mouse gets captured.
65ec6247
RD
2196bool wxStyledTextCtrl::GetMouseDownCaptures() {
2197 return SendMsg(2385, 0, 0) != 0;
2198}
2199
a834585d 2200// Sets the cursor to one of the SC_CURSOR* values.
88a8b04e 2201void wxStyledTextCtrl::SetSTCCursor(int cursorType) {
65ec6247
RD
2202 SendMsg(2386, cursorType, 0);
2203}
2204
a834585d 2205// Get cursor type.
88a8b04e 2206int wxStyledTextCtrl::GetSTCCursor() {
65ec6247
RD
2207 return SendMsg(2387, 0, 0);
2208}
2209
1a2fb4cd 2210// Change the way control characters are displayed:
a834585d 2211// If symbol is < 32, keep the drawn way, else, use the given character.
1a2fb4cd
RD
2212void wxStyledTextCtrl::SetControlCharSymbol(int symbol) {
2213 SendMsg(2388, symbol, 0);
2214}
2215
a834585d 2216// Get the way control characters are displayed.
1a2fb4cd
RD
2217int wxStyledTextCtrl::GetControlCharSymbol() {
2218 return SendMsg(2389, 0, 0);
2219}
2220
a834585d 2221// Move to the previous change in capitalisation.
65ec6247
RD
2222void wxStyledTextCtrl::WordPartLeft() {
2223 SendMsg(2390, 0, 0);
2224}
2225
a834585d
RD
2226// Move to the previous change in capitalisation extending selection
2227// to new caret position.
65ec6247
RD
2228void wxStyledTextCtrl::WordPartLeftExtend() {
2229 SendMsg(2391, 0, 0);
2230}
2231
a834585d 2232// Move to the change next in capitalisation.
65ec6247
RD
2233void wxStyledTextCtrl::WordPartRight() {
2234 SendMsg(2392, 0, 0);
2235}
2236
a834585d
RD
2237// Move to the next change in capitalisation extending selection
2238// to new caret position.
65ec6247
RD
2239void wxStyledTextCtrl::WordPartRightExtend() {
2240 SendMsg(2393, 0, 0);
2241}
2242
a834585d
RD
2243// Set the way the display area is determined when a particular line
2244// is to be moved to by Find, FindNext, GotoLine, etc.
65ec6247
RD
2245void wxStyledTextCtrl::SetVisiblePolicy(int visiblePolicy, int visibleSlop) {
2246 SendMsg(2394, visiblePolicy, visibleSlop);
2247}
2248
a834585d 2249// Delete back from the current position to the start of the line.
65ec6247
RD
2250void wxStyledTextCtrl::DelLineLeft() {
2251 SendMsg(2395, 0, 0);
2252}
2253
a834585d 2254// Delete forwards from the current position to the end of the line.
65ec6247
RD
2255void wxStyledTextCtrl::DelLineRight() {
2256 SendMsg(2396, 0, 0);
2257}
2258
a834585d 2259// Get and Set the xOffset (ie, horizonal scroll position).
1a2fb4cd
RD
2260void wxStyledTextCtrl::SetXOffset(int newOffset) {
2261 SendMsg(2397, newOffset, 0);
2262}
2263int wxStyledTextCtrl::GetXOffset() {
2264 return SendMsg(2398, 0, 0);
2265}
2266
8e54aaed 2267// Set the last x chosen value to be the caret x position.
9e730a78
RD
2268void wxStyledTextCtrl::ChooseCaretX() {
2269 SendMsg(2399, 0, 0);
2270}
2271
a834585d
RD
2272// Set the way the caret is kept visible when going sideway.
2273// The exclusion zone is given in pixels.
2274void wxStyledTextCtrl::SetXCaretPolicy(int caretPolicy, int caretSlop) {
2275 SendMsg(2402, caretPolicy, caretSlop);
2276}
2277
2278// Set the way the line the caret is on is kept visible.
2279// The exclusion zone is given in lines.
2280void wxStyledTextCtrl::SetYCaretPolicy(int caretPolicy, int caretSlop) {
2281 SendMsg(2403, caretPolicy, caretSlop);
2282}
2283
9e730a78
RD
2284// Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE).
2285void wxStyledTextCtrl::SetPrintWrapMode(int mode) {
2286 SendMsg(2406, mode, 0);
2287}
2288
8e54aaed 2289// Is printing line wrapped?
9e730a78
RD
2290int wxStyledTextCtrl::GetPrintWrapMode() {
2291 return SendMsg(2407, 0, 0);
2292}
2293
2294// Set a fore colour for active hotspots.
2295void wxStyledTextCtrl::SetHotspotActiveForeground(bool useSetting, const wxColour& fore) {
2296 SendMsg(2410, useSetting, wxColourAsLong(fore));
2297}
2298
2299// Set a back colour for active hotspots.
2300void wxStyledTextCtrl::SetHotspotActiveBackground(bool useSetting, const wxColour& back) {
2301 SendMsg(2411, useSetting, wxColourAsLong(back));
2302}
2303
2304// Enable / Disable underlining active hotspots.
2305void wxStyledTextCtrl::SetHotspotActiveUnderline(bool underline) {
2306 SendMsg(2412, underline, 0);
2307}
2308
8e54aaed
RD
2309// Limit hotspots to single line so hotspots on two lines don't merge.
2310void wxStyledTextCtrl::SetHotspotSingleLine(bool singleLine) {
2311 SendMsg(2421, singleLine, 0);
2312}
2313
c26dba42
RD
2314// Move caret between paragraphs (delimited by empty lines).
2315void wxStyledTextCtrl::ParaDown() {
2316 SendMsg(2413, 0, 0);
2317}
2318void wxStyledTextCtrl::ParaDownExtend() {
2319 SendMsg(2414, 0, 0);
2320}
2321void wxStyledTextCtrl::ParaUp() {
2322 SendMsg(2415, 0, 0);
2323}
2324void wxStyledTextCtrl::ParaUpExtend() {
2325 SendMsg(2416, 0, 0);
2326}
2327
e14d10b0
RD
2328// Given a valid document position, return the previous position taking code
2329// page into account. Returns 0 if passed 0.
2330int wxStyledTextCtrl::PositionBefore(int pos) {
2331 return SendMsg(2417, pos, 0);
2332}
2333
2334// Given a valid document position, return the next position taking code
2335// page into account. Maximum value returned is the last position in the document.
2336int wxStyledTextCtrl::PositionAfter(int pos) {
2337 return SendMsg(2418, pos, 0);
2338}
2339
2340// Copy a range of text to the clipboard. Positions are clipped into the document.
2341void wxStyledTextCtrl::CopyRange(int start, int end) {
2342 SendMsg(2419, start, end);
2343}
2344
2345// Copy argument text to the clipboard.
2346void wxStyledTextCtrl::CopyText(int length, const wxString& text) {
2347 SendMsg(2420, length, (long)(const char*)wx2stc(text));
2348}
2349
8e54aaed
RD
2350// Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE) or
2351// by lines (SC_SEL_LINES).
2352void wxStyledTextCtrl::SetSelectionMode(int mode) {
2353 SendMsg(2422, mode, 0);
2354}
2355
2356// Get the mode of the current selection.
2357int wxStyledTextCtrl::GetSelectionMode() {
2358 return SendMsg(2423, 0, 0);
2359}
2360
2361// Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line).
2362int wxStyledTextCtrl::GetLineSelStartPosition(int line) {
2363 return SendMsg(2424, line, 0);
2364}
2365
2366// Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line).
2367int wxStyledTextCtrl::GetLineSelEndPosition(int line) {
2368 return SendMsg(2425, line, 0);
2369}
2370
c26dba42
RD
2371// Move caret down one line, extending rectangular selection to new caret position.
2372void wxStyledTextCtrl::LineDownRectExtend() {
2373 SendMsg(2426, 0, 0);
2374}
2375
2376// Move caret up one line, extending rectangular selection to new caret position.
2377void wxStyledTextCtrl::LineUpRectExtend() {
2378 SendMsg(2427, 0, 0);
2379}
2380
2381// Move caret left one character, extending rectangular selection to new caret position.
2382void wxStyledTextCtrl::CharLeftRectExtend() {
2383 SendMsg(2428, 0, 0);
2384}
2385
2386// Move caret right one character, extending rectangular selection to new caret position.
2387void wxStyledTextCtrl::CharRightRectExtend() {
2388 SendMsg(2429, 0, 0);
2389}
2390
2391// Move caret to first position on line, extending rectangular selection to new caret position.
2392void wxStyledTextCtrl::HomeRectExtend() {
2393 SendMsg(2430, 0, 0);
2394}
2395
2396// Move caret to before first visible character on line.
2397// If already there move to first character on line.
2398// In either case, extend rectangular selection to new caret position.
2399void wxStyledTextCtrl::VCHomeRectExtend() {
2400 SendMsg(2431, 0, 0);
2401}
2402
2403// Move caret to last position on line, extending rectangular selection to new caret position.
2404void wxStyledTextCtrl::LineEndRectExtend() {
2405 SendMsg(2432, 0, 0);
2406}
2407
2408// Move caret one page up, extending rectangular selection to new caret position.
2409void wxStyledTextCtrl::PageUpRectExtend() {
2410 SendMsg(2433, 0, 0);
2411}
2412
2413// Move caret one page down, extending rectangular selection to new caret position.
2414void wxStyledTextCtrl::PageDownRectExtend() {
2415 SendMsg(2434, 0, 0);
2416}
2417
2418// Move caret to top of page, or one page up if already at top of page.
2419void wxStyledTextCtrl::StutteredPageUp() {
2420 SendMsg(2435, 0, 0);
2421}
2422
2423// Move caret to top of page, or one page up if already at top of page, extending selection to new caret position.
2424void wxStyledTextCtrl::StutteredPageUpExtend() {
2425 SendMsg(2436, 0, 0);
2426}
2427
2428// Move caret to bottom of page, or one page down if already at bottom of page.
2429void wxStyledTextCtrl::StutteredPageDown() {
2430 SendMsg(2437, 0, 0);
2431}
2432
2433// Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position.
2434void wxStyledTextCtrl::StutteredPageDownExtend() {
2435 SendMsg(2438, 0, 0);
2436}
2437
2438// Move caret left one word, position cursor at end of word.
2439void wxStyledTextCtrl::WordLeftEnd() {
2440 SendMsg(2439, 0, 0);
2441}
2442
2443// Move caret left one word, position cursor at end of word, extending selection to new caret position.
2444void wxStyledTextCtrl::WordLeftEndExtend() {
2445 SendMsg(2440, 0, 0);
2446}
2447
2448// Move caret right one word, position cursor at end of word.
2449void wxStyledTextCtrl::WordRightEnd() {
2450 SendMsg(2441, 0, 0);
2451}
2452
2453// Move caret right one word, position cursor at end of word, extending selection to new caret position.
2454void wxStyledTextCtrl::WordRightEndExtend() {
2455 SendMsg(2442, 0, 0);
2456}
2457
8e54aaed
RD
2458// Set the set of characters making up whitespace for when moving or selecting by word.
2459// Should be called after SetWordChars.
2460void wxStyledTextCtrl::SetWhitespaceChars(const wxString& characters) {
2461 SendMsg(2443, 0, (long)(const char*)wx2stc(characters));
2462}
2463
2464// Reset the set of characters for whitespace and word characters to the defaults.
2465void wxStyledTextCtrl::SetCharsDefault() {
2466 SendMsg(2444, 0, 0);
2467}
2468
2469// Get currently selected item position in the auto-completion list
2470int wxStyledTextCtrl::AutoCompGetCurrent() {
2471 return SendMsg(2445, 0, 0);
2472}
2473
591d01be
RD
2474// Enlarge the document to a particular size of text bytes.
2475void wxStyledTextCtrl::Allocate(int bytes) {
2476 SendMsg(2446, bytes, 0);
2477}
2478
1e9bafca 2479// Find the position of a column on a line taking into account tabs and
a33203cb
RD
2480// multi-byte characters. If beyond end of line, return line end position.
2481int wxStyledTextCtrl::FindColumn(int line, int column) {
2482 return SendMsg(2456, line, column);
2483}
2484
1e9bafca
RD
2485// Can the caret preferred x position only be changed by explicit movement commands?
2486bool wxStyledTextCtrl::GetCaretSticky() {
2487 return SendMsg(2457, 0, 0) != 0;
2488}
2489
2490// Stop the caret preferred x position changing when the user types.
2491void wxStyledTextCtrl::SetCaretSticky(bool useCaretStickyBehaviour) {
2492 SendMsg(2458, useCaretStickyBehaviour, 0);
2493}
2494
2495// Switch between sticky and non-sticky: meant to be bound to a key.
2496void wxStyledTextCtrl::ToggleCaretSticky() {
2497 SendMsg(2459, 0, 0);
2498}
2499
2500// Enable/Disable convert-on-paste for line endings
2501void wxStyledTextCtrl::SetPasteConvertEndings(bool convert) {
2502 SendMsg(2467, convert, 0);
2503}
2504
2505// Get convert-on-paste setting
2506bool wxStyledTextCtrl::GetPasteConvertEndings() {
2507 return SendMsg(2468, 0, 0) != 0;
2508}
2509
2510// Duplicate the selection. If selection empty duplicate the line containing the caret.
2511void wxStyledTextCtrl::SelectionDuplicate() {
2512 SendMsg(2469, 0, 0);
2513}
2514
b8193d80
RD
2515// Set background alpha of the caret line.
2516void wxStyledTextCtrl::SetCaretLineBackAlpha(int alpha) {
2517 SendMsg(2470, alpha, 0);
2518}
2519
2520// Get the background alpha of the caret line.
2521int wxStyledTextCtrl::GetCaretLineBackAlpha() {
2522 return SendMsg(2471, 0, 0);
2523}
2524
4370573a
RD
2525// Start notifying the container of all key presses and commands.
2526void wxStyledTextCtrl::StartRecord() {
2527 SendMsg(3001, 0, 0);
2528}
67003d1a 2529
4370573a
RD
2530// Stop notifying the container of all key presses and commands.
2531void wxStyledTextCtrl::StopRecord() {
2532 SendMsg(3002, 0, 0);
67003d1a
RD
2533}
2534
4370573a
RD
2535// Set the lexing language of the document.
2536void wxStyledTextCtrl::SetLexer(int lexer) {
2537 SendMsg(4001, lexer, 0);
2538}
67003d1a 2539
4370573a
RD
2540// Retrieve the lexing language of the document.
2541int wxStyledTextCtrl::GetLexer() {
2542 return SendMsg(4002, 0, 0);
67003d1a
RD
2543}
2544
4370573a
RD
2545// Colourise a segment of the document using the current lexing language.
2546void wxStyledTextCtrl::Colourise(int start, int end) {
2547 SendMsg(4003, start, end);
2548}
67003d1a 2549
4370573a
RD
2550// Set up a value that may be used by a lexer for some optional feature.
2551void wxStyledTextCtrl::SetProperty(const wxString& key, const wxString& value) {
0c5b83b0 2552 SendMsg(4004, (long)(const char*)wx2stc(key), (long)(const char*)wx2stc(value));
f6bcfd97
BP
2553}
2554
4370573a
RD
2555// Set up the key words used by the lexer.
2556void wxStyledTextCtrl::SetKeyWords(int keywordSet, const wxString& keyWords) {
0c5b83b0 2557 SendMsg(4005, keywordSet, (long)(const char*)wx2stc(keyWords));
4370573a 2558}
f6bcfd97 2559
65ec6247
RD
2560// Set the lexing language of the document based on string name.
2561void wxStyledTextCtrl::SetLexerLanguage(const wxString& language) {
0c5b83b0 2562 SendMsg(4006, 0, (long)(const char*)wx2stc(language));
65ec6247
RD
2563}
2564
1e9bafca
RD
2565// Retrieve a 'property' value previously set with SetProperty.
2566wxString wxStyledTextCtrl::GetProperty(const wxString& key) {
600b3983 2567 int len = SendMsg(SCI_GETPROPERTY, (long)(const char*)wx2stc(key), 0);
1e9bafca
RD
2568 if (!len) return wxEmptyString;
2569
2570 wxMemoryBuffer mbuf(len+1);
2571 char* buf = (char*)mbuf.GetWriteBuf(len+1);
2572 SendMsg(4008, (long)(const char*)wx2stc(key), (long)buf);
2573 mbuf.UngetWriteBuf(len);
2574 mbuf.AppendByte(0);
2575 return stc2wx(buf);
2576}
2577
2578// Retrieve a 'property' value previously set with SetProperty,
2579// with '$()' variable replacement on returned buffer.
2580wxString wxStyledTextCtrl::GetPropertyExpanded(const wxString& key) {
600b3983 2581 int len = SendMsg(SCI_GETPROPERTYEXPANDED, (long)(const char*)wx2stc(key), 0);
1e9bafca
RD
2582 if (!len) return wxEmptyString;
2583
2584 wxMemoryBuffer mbuf(len+1);
2585 char* buf = (char*)mbuf.GetWriteBuf(len+1);
2586 SendMsg(4009, (long)(const char*)wx2stc(key), (long)buf);
2587 mbuf.UngetWriteBuf(len);
2588 mbuf.AppendByte(0);
2589 return stc2wx(buf);
2590}
2591
2592// Retrieve a 'property' value previously set with SetProperty,
2593// interpreted as an int AFTER any '$()' variable replacement.
2594int wxStyledTextCtrl::GetPropertyInt(const wxString& key) {
2595 return SendMsg(4010, (long)(const char*)wx2stc(key), 0);
2596}
2597
2598// Retrieve the number of bits the current lexer needs for styling.
2599int wxStyledTextCtrl::GetStyleBitsNeeded() {
2600 return SendMsg(4011, 0, 0);
2601}
2602
4370573a 2603// END of generated section
f6bcfd97 2604//----------------------------------------------------------------------
f6bcfd97
BP
2605
2606
4370573a
RD
2607// Returns the line number of the line with the caret.
2608int wxStyledTextCtrl::GetCurrentLine() {
2609 int line = LineFromPosition(GetCurrentPos());
2610 return line;
f6bcfd97
BP
2611}
2612
2613
4370573a
RD
2614// Extract style settings from a spec-string which is composed of one or
2615// more of the following comma separated elements:
2616//
2617// bold turns on bold
2618// italic turns on italics
5ee1d760
RD
2619// fore:[name or #RRGGBB] sets the foreground colour
2620// back:[name or #RRGGBB] sets the background colour
4370573a
RD
2621// face:[facename] sets the font face name to use
2622// size:[num] sets the font size in points
2623// eol turns on eol filling
2624// underline turns on underlining
2625//
2626void wxStyledTextCtrl::StyleSetSpec(int styleNum, const wxString& spec) {
2627
451c5cc7 2628 wxStringTokenizer tkz(spec, wxT(","));
4370573a
RD
2629 while (tkz.HasMoreTokens()) {
2630 wxString token = tkz.GetNextToken();
f6bcfd97 2631
4370573a
RD
2632 wxString option = token.BeforeFirst(':');
2633 wxString val = token.AfterFirst(':');
f6bcfd97 2634
451c5cc7 2635 if (option == wxT("bold"))
4370573a 2636 StyleSetBold(styleNum, true);
f6bcfd97 2637
451c5cc7 2638 else if (option == wxT("italic"))
4370573a 2639 StyleSetItalic(styleNum, true);
9ce192d4 2640
451c5cc7 2641 else if (option == wxT("underline"))
4370573a 2642 StyleSetUnderline(styleNum, true);
9ce192d4 2643
451c5cc7 2644 else if (option == wxT("eol"))
4370573a 2645 StyleSetEOLFilled(styleNum, true);
9ce192d4 2646
451c5cc7 2647 else if (option == wxT("size")) {
4370573a
RD
2648 long points;
2649 if (val.ToLong(&points))
2650 StyleSetSize(styleNum, points);
2651 }
9ce192d4 2652
451c5cc7 2653 else if (option == wxT("face"))
4370573a 2654 StyleSetFaceName(styleNum, val);
9ce192d4 2655
451c5cc7 2656 else if (option == wxT("fore"))
4370573a 2657 StyleSetForeground(styleNum, wxColourFromSpec(val));
9ce192d4 2658
451c5cc7 2659 else if (option == wxT("back"))
4370573a
RD
2660 StyleSetBackground(styleNum, wxColourFromSpec(val));
2661 }
9ce192d4
RD
2662}
2663
2664
4370573a
RD
2665// Set style size, face, bold, italic, and underline attributes from
2666// a wxFont's attributes.
2667void wxStyledTextCtrl::StyleSetFont(int styleNum, wxFont& font) {
7475e814
RD
2668#ifdef __WXGTK__
2669 // Ensure that the native font is initialized
2670 int x, y;
2671 GetTextExtent(wxT("X"), &x, &y, NULL, NULL, &font);
2672#endif
af0531a5
RD
2673 int size = font.GetPointSize();
2674 wxString faceName = font.GetFaceName();
2675 bool bold = font.GetWeight() == wxBOLD;
2676 bool italic = font.GetStyle() != wxNORMAL;
2677 bool under = font.GetUnderlined();
c5bd09bf 2678 wxFontEncoding encoding = font.GetEncoding();
af0531a5
RD
2679
2680 StyleSetFontAttr(styleNum, size, faceName, bold, italic, under, encoding);
9ce192d4
RD
2681}
2682
4370573a
RD
2683// Set all font style attributes at once.
2684void wxStyledTextCtrl::StyleSetFontAttr(int styleNum, int size,
2685 const wxString& faceName,
2686 bool bold, bool italic,
3727c043
RD
2687 bool underline,
2688 wxFontEncoding encoding) {
4370573a
RD
2689 StyleSetSize(styleNum, size);
2690 StyleSetFaceName(styleNum, faceName);
2691 StyleSetBold(styleNum, bold);
2692 StyleSetItalic(styleNum, italic);
2693 StyleSetUnderline(styleNum, underline);
3727c043
RD
2694 StyleSetFontEncoding(styleNum, encoding);
2695}
9ce192d4 2696
3727c043
RD
2697
2698// Set the character set of the font in a style. Converts the Scintilla
2699// character set values to a wxFontEncoding.
2700void wxStyledTextCtrl::StyleSetCharacterSet(int style, int characterSet)
2701{
2702 wxFontEncoding encoding;
2703
2704 // Translate the Scintilla characterSet to a wxFontEncoding
2705 switch (characterSet) {
2706 default:
2707 case wxSTC_CHARSET_ANSI:
2708 case wxSTC_CHARSET_DEFAULT:
2709 encoding = wxFONTENCODING_DEFAULT;
2710 break;
2711
2712 case wxSTC_CHARSET_BALTIC:
2713 encoding = wxFONTENCODING_ISO8859_13;
2714 break;
2715
2716 case wxSTC_CHARSET_CHINESEBIG5:
2717 encoding = wxFONTENCODING_CP950;
2718 break;
2719
2720 case wxSTC_CHARSET_EASTEUROPE:
2721 encoding = wxFONTENCODING_ISO8859_2;
2722 break;
2723
2724 case wxSTC_CHARSET_GB2312:
2725 encoding = wxFONTENCODING_CP936;
2726 break;
2727
2728 case wxSTC_CHARSET_GREEK:
2729 encoding = wxFONTENCODING_ISO8859_7;
2730 break;
2731
2732 case wxSTC_CHARSET_HANGUL:
2733 encoding = wxFONTENCODING_CP949;
2734 break;
2735
2736 case wxSTC_CHARSET_MAC:
2737 encoding = wxFONTENCODING_DEFAULT;
2738 break;
2739
2740 case wxSTC_CHARSET_OEM:
2741 encoding = wxFONTENCODING_DEFAULT;
2742 break;
2743
2744 case wxSTC_CHARSET_RUSSIAN:
2745 encoding = wxFONTENCODING_KOI8;
2746 break;
2747
2748 case wxSTC_CHARSET_SHIFTJIS:
2749 encoding = wxFONTENCODING_CP932;
2750 break;
2751
2752 case wxSTC_CHARSET_SYMBOL:
2753 encoding = wxFONTENCODING_DEFAULT;
2754 break;
2755
2756 case wxSTC_CHARSET_TURKISH:
2757 encoding = wxFONTENCODING_ISO8859_9;
2758 break;
2759
2760 case wxSTC_CHARSET_JOHAB:
2761 encoding = wxFONTENCODING_DEFAULT;
2762 break;
2763
2764 case wxSTC_CHARSET_HEBREW:
2765 encoding = wxFONTENCODING_ISO8859_8;
2766 break;
2767
2768 case wxSTC_CHARSET_ARABIC:
2769 encoding = wxFONTENCODING_ISO8859_6;
2770 break;
2771
2772 case wxSTC_CHARSET_VIETNAMESE:
2773 encoding = wxFONTENCODING_DEFAULT;
2774 break;
2775
2776 case wxSTC_CHARSET_THAI:
2777 encoding = wxFONTENCODING_ISO8859_11;
2778 break;
1e9bafca
RD
2779
2780 case wxSTC_CHARSET_CYRILLIC:
2781 encoding = wxFONTENCODING_ISO8859_5;
2782 break;
2783
2784 case wxSTC_CHARSET_8859_15:
2785 encoding = wxFONTENCODING_ISO8859_15;;
2786 break;
3727c043
RD
2787 }
2788
2789 // We just have Scintilla track the wxFontEncoding for us. It gets used
2790 // in Font::Create in PlatWX.cpp. We add one to the value so that the
2791 // effective wxFONENCODING_DEFAULT == SC_SHARSET_DEFAULT and so when
2792 // Scintilla internally uses SC_CHARSET_DEFAULT we will translate it back
2793 // to wxFONENCODING_DEFAULT in Font::Create.
2794 SendMsg(SCI_STYLESETCHARACTERSET, style, encoding+1);
2795}
2796
2797
2798// Set the font encoding to be used by a style.
2799void wxStyledTextCtrl::StyleSetFontEncoding(int style, wxFontEncoding encoding)
2800{
2801 SendMsg(SCI_STYLESETCHARACTERSET, style, encoding+1);
9ce192d4
RD
2802}
2803
2804
4370573a
RD
2805// Perform one of the operations defined by the wxSTC_CMD_* constants.
2806void wxStyledTextCtrl::CmdKeyExecute(int cmd) {
2807 SendMsg(cmd);
9ce192d4
RD
2808}
2809
2810
4370573a
RD
2811// Set the left and right margin in the edit area, measured in pixels.
2812void wxStyledTextCtrl::SetMargins(int left, int right) {
2813 SetMarginLeft(left);
2814 SetMarginRight(right);
9ce192d4
RD
2815}
2816
2817
4370573a
RD
2818// Retrieve the start and end positions of the current selection.
2819void wxStyledTextCtrl::GetSelection(int* startPos, int* endPos) {
2820 if (startPos != NULL)
2821 *startPos = SendMsg(SCI_GETSELECTIONSTART);
2822 if (endPos != NULL)
2823 *endPos = SendMsg(SCI_GETSELECTIONEND);
9ce192d4
RD
2824}
2825
2826
4370573a
RD
2827// Retrieve the point in the window where a position is displayed.
2828wxPoint wxStyledTextCtrl::PointFromPosition(int pos) {
2829 int x = SendMsg(SCI_POINTXFROMPOSITION, 0, pos);
2830 int y = SendMsg(SCI_POINTYFROMPOSITION, 0, pos);
2831 return wxPoint(x, y);
f6bcfd97
BP
2832}
2833
f97d84a6
RD
2834// Scroll enough to make the given line visible
2835void wxStyledTextCtrl::ScrollToLine(int line) {
2836 m_swx->DoScrollToLine(line);
2837}
2838
2839
2840// Scroll enough to make the given column visible
2841void wxStyledTextCtrl::ScrollToColumn(int column) {
2842 m_swx->DoScrollToColumn(column);
2843}
2844
f6bcfd97 2845
51566b0b
RD
2846bool wxStyledTextCtrl::SaveFile(const wxString& filename)
2847{
2848 wxFile file(filename, wxFile::write);
2849
2850 if (!file.IsOpened())
7e126a07 2851 return false;
51566b0b 2852
88a8b04e 2853 bool success = file.Write(GetText(), *wxConvCurrent);
51566b0b 2854
4a65f2c8 2855 if (success)
51566b0b 2856 SetSavePoint();
4a65f2c8 2857
51566b0b
RD
2858 return success;
2859}
2860
2861bool wxStyledTextCtrl::LoadFile(const wxString& filename)
2862{
041973c5 2863 bool success = false;
51566b0b
RD
2864 wxFile file(filename, wxFile::read);
2865
041973c5 2866 if (file.IsOpened())
51566b0b 2867 {
041973c5 2868 wxString contents;
c8b75e94
WS
2869 // get the file size (assume it is not huge file...)
2870 ssize_t len = (ssize_t)file.Length();
2871
041973c5
RD
2872 if (len > 0)
2873 {
1e545382 2874#if wxUSE_UNICODE
1c26fbe0 2875 wxMemoryBuffer buffer(len+1);
8e5ec9cc 2876 success = (file.Read(buffer.GetData(), len) == len);
ccfc3219 2877 if (success) {
9efe0302
RD
2878 ((char*)buffer.GetData())[len] = 0;
2879 contents = wxString(buffer, *wxConvCurrent, len);
2880 }
88a8b04e 2881#else
8e5ec9cc
MB
2882 wxString buffer;
2883 success = (file.Read(wxStringBuffer(buffer, len), len) == len);
88a8b04e
RD
2884 contents = buffer;
2885#endif
041973c5
RD
2886 }
2887 else
c8b75e94
WS
2888 {
2889 if (len == 0)
2890 success = true; // empty file is ok
2891 else
2892 success = false; // len == wxInvalidOffset
2893 }
041973c5
RD
2894
2895 if (success)
2896 {
2897 SetText(contents);
2898 EmptyUndoBuffer();
2899 SetSavePoint();
2900 }
51566b0b
RD
2901 }
2902
2903 return success;
2904}
2905
d25f5fbb 2906
2fcce896 2907#if wxUSE_DRAG_AND_DROP
7e126a07
WS
2908wxDragResult wxStyledTextCtrl::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) {
2909 return m_swx->DoDragOver(x, y, def);
2910}
4a65f2c8
RD
2911
2912
7e126a07 2913bool wxStyledTextCtrl::DoDropText(long x, long y, const wxString& data) {
4a65f2c8
RD
2914 return m_swx->DoDropText(x, y, data);
2915}
2fcce896 2916#endif
4a65f2c8
RD
2917
2918
d1558f3d
RD
2919void wxStyledTextCtrl::SetUseAntiAliasing(bool useAA) {
2920 m_swx->SetUseAntiAliasing(useAA);
2921}
2922
2923bool wxStyledTextCtrl::GetUseAntiAliasing() {
2924 return m_swx->GetUseAntiAliasing();
2925}
2926
41a499cd
RD
2927
2928
2929
2930
2931void wxStyledTextCtrl::AddTextRaw(const char* text)
2932{
2933 SendMsg(SCI_ADDTEXT, strlen(text), (long)text);
2934}
2935
2936void wxStyledTextCtrl::InsertTextRaw(int pos, const char* text)
2937{
2938 SendMsg(SCI_INSERTTEXT, pos, (long)text);
2939}
2940
2941wxCharBuffer wxStyledTextCtrl::GetCurLineRaw(int* linePos)
2942{
2943 int len = LineLength(GetCurrentLine());
2944 if (!len) {
2945 if (linePos) *linePos = 0;
2946 wxCharBuffer empty;
2947 return empty;
2948 }
2949
2950 wxCharBuffer buf(len);
2951 int pos = SendMsg(SCI_GETCURLINE, len, (long)buf.data());
2952 if (linePos) *linePos = pos;
2953 return buf;
2954}
2955
2956wxCharBuffer wxStyledTextCtrl::GetLineRaw(int line)
2957{
2958 int len = LineLength(line);
2959 if (!len) {
2960 wxCharBuffer empty;
2961 return empty;
2962 }
2963
2964 wxCharBuffer buf(len);
2965 SendMsg(SCI_GETLINE, line, (long)buf.data());
2966 return buf;
2967}
2968
2969wxCharBuffer wxStyledTextCtrl::GetSelectedTextRaw()
2970{
2971 int start;
2972 int end;
2973
2974 GetSelection(&start, &end);
2975 int len = end - start;
2976 if (!len) {
2977 wxCharBuffer empty;
2978 return empty;
2979 }
2980
2981 wxCharBuffer buf(len);
2982 SendMsg(SCI_GETSELTEXT, 0, (long)buf.data());
2983 return buf;
2984}
2985
2986wxCharBuffer wxStyledTextCtrl::GetTextRangeRaw(int startPos, int endPos)
2987{
2988 if (endPos < startPos) {
2989 int temp = startPos;
2990 startPos = endPos;
2991 endPos = temp;
2992 }
2993 int len = endPos - startPos;
2994 if (!len) {
2995 wxCharBuffer empty;
2996 return empty;
2997 }
2998
2999 wxCharBuffer buf(len);
3000 TextRange tr;
3001 tr.lpstrText = buf.data();
3002 tr.chrg.cpMin = startPos;
3003 tr.chrg.cpMax = endPos;
3004 SendMsg(SCI_GETTEXTRANGE, 0, (long)&tr);
3005 return buf;
3006}
3007
3008void wxStyledTextCtrl::SetTextRaw(const char* text)
3009{
3010 SendMsg(SCI_SETTEXT, 0, (long)text);
3011}
3012
3013wxCharBuffer wxStyledTextCtrl::GetTextRaw()
3014{
3015 int len = GetTextLength();
3016 wxCharBuffer buf(len);
3017 SendMsg(SCI_GETTEXT, len, (long)buf.data());
3018 return buf;
3019}
3020
3021void wxStyledTextCtrl::AppendTextRaw(const char* text)
3022{
3023 SendMsg(SCI_APPENDTEXT, strlen(text), (long)text);
3024}
3025
3026
3027
3028
3029
9ce192d4
RD
3030//----------------------------------------------------------------------
3031// Event handlers
3032
88a8b04e 3033void wxStyledTextCtrl::OnPaint(wxPaintEvent& WXUNUSED(evt)) {
9ce192d4 3034 wxPaintDC dc(this);
9e730a78 3035 m_swx->DoPaint(&dc, GetUpdateRegion().GetBox());
9ce192d4
RD
3036}
3037
3038void wxStyledTextCtrl::OnScrollWin(wxScrollWinEvent& evt) {
3039 if (evt.GetOrientation() == wxHORIZONTAL)
3040 m_swx->DoHScroll(evt.GetEventType(), evt.GetPosition());
3041 else
3042 m_swx->DoVScroll(evt.GetEventType(), evt.GetPosition());
3043}
3044
5fa4613c
RD
3045void wxStyledTextCtrl::OnScroll(wxScrollEvent& evt) {
3046 wxScrollBar* sb = wxDynamicCast(evt.GetEventObject(), wxScrollBar);
3047 if (sb) {
3048 if (sb->IsVertical())
3049 m_swx->DoVScroll(evt.GetEventType(), evt.GetPosition());
3050 else
3051 m_swx->DoHScroll(evt.GetEventType(), evt.GetPosition());
3052 }
3053}
3054
88a8b04e 3055void wxStyledTextCtrl::OnSize(wxSizeEvent& WXUNUSED(evt)) {
39c0acb6
RD
3056 if (m_swx) {
3057 wxSize sz = GetClientSize();
3058 m_swx->DoSize(sz.x, sz.y);
3059 }
9ce192d4
RD
3060}
3061
3062void wxStyledTextCtrl::OnMouseLeftDown(wxMouseEvent& evt) {
cb1871ca 3063 SetFocus();
9ce192d4 3064 wxPoint pt = evt.GetPosition();
2b5f62a0 3065 m_swx->DoLeftButtonDown(Point(pt.x, pt.y), m_stopWatch.Time(),
9ce192d4
RD
3066 evt.ShiftDown(), evt.ControlDown(), evt.AltDown());
3067}
3068
3069void wxStyledTextCtrl::OnMouseMove(wxMouseEvent& evt) {
3070 wxPoint pt = evt.GetPosition();
2b5f62a0 3071 m_swx->DoLeftButtonMove(Point(pt.x, pt.y));
9ce192d4
RD
3072}
3073
3074void wxStyledTextCtrl::OnMouseLeftUp(wxMouseEvent& evt) {
3075 wxPoint pt = evt.GetPosition();
2b5f62a0 3076 m_swx->DoLeftButtonUp(Point(pt.x, pt.y), m_stopWatch.Time(),
9ce192d4
RD
3077 evt.ControlDown());
3078}
3079
3080
ddf2da08
RD
3081void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent& evt) {
3082 wxPoint pt = evt.GetPosition();
3083 m_swx->DoContextMenu(Point(pt.x, pt.y));
3084}
3085
3086
2b5f62a0
VZ
3087void wxStyledTextCtrl::OnMouseMiddleUp(wxMouseEvent& evt) {
3088 wxPoint pt = evt.GetPosition();
3089 m_swx->DoMiddleButtonUp(Point(pt.x, pt.y));
3090}
3091
65ec6247 3092void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent& evt) {
9ce192d4 3093 wxPoint pt = evt.GetPosition();
65ec6247 3094 ScreenToClient(&pt.x, &pt.y);
25484746
RD
3095 /*
3096 Show context menu at event point if it's within the window,
3097 or at caret location if not
3098 */
3099 wxHitTest ht = this->HitTest(pt);
3100 if (ht != wxHT_WINDOW_INSIDE) {
3101 pt = this->PointFromPosition(this->GetCurrentPos());
3102 }
9ce192d4
RD
3103 m_swx->DoContextMenu(Point(pt.x, pt.y));
3104}
3105
37d62433
RD
3106
3107void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt) {
3108 m_swx->DoMouseWheel(evt.GetWheelRotation(),
3109 evt.GetWheelDelta(),
65ec6247 3110 evt.GetLinesPerAction(),
9b9337da
RD
3111 evt.ControlDown(),
3112 evt.IsPageScroll());
37d62433
RD
3113}
3114
3115
9ce192d4 3116void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) {
5fd656d5 3117 // On (some?) non-US PC keyboards the AltGr key is required to enter some
f3c2c221
RD
3118 // common characters. It comes to us as both Alt and Ctrl down so we need
3119 // to let the char through in that case, otherwise if only ctrl or only
3120 // alt let's skip it.
3121 bool ctrl = evt.ControlDown();
28e0c28e
RD
3122#ifdef __WXMAC__
3123 // On the Mac the Alt key is just a modifier key (like Shift) so we need
3124 // to allow the char events to be processed when Alt is pressed.
3125 // TODO: Should we check MetaDown instead in this case?
3126 bool alt = false;
3127#else
f3c2c221 3128 bool alt = evt.AltDown();
28e0c28e 3129#endif
00c64037 3130 bool skip = ((ctrl || alt) && ! (ctrl && alt));
f3c2c221 3131
a0421c77
RD
3132#if wxUSE_UNICODE
3133 // apparently if we don't do this, Unicode keys pressed after non-char
3134 // ASCII ones (e.g. Enter, Tab) are not taken into account (patch 1615989)
3135 if (m_lastKeyDownConsumed && evt.GetUnicodeKey() > 255)
3136 m_lastKeyDownConsumed = false;
3137#endif
3138
5fd656d5
RD
3139 if (!m_lastKeyDownConsumed && !skip) {
3140#if wxUSE_UNICODE
3141 int key = evt.GetUnicodeKey();
3142 bool keyOk = true;
3143
3144 // if the unicode key code is not really a unicode character (it may
3145 // be a function key or etc., the platforms appear to always give us a
3146 // small value in this case) then fallback to the ascii key code but
3147 // don't do anything for function keys or etc.
1b14227e 3148 if (key <= 127) {
5fd656d5 3149 key = evt.GetKeyCode();
1b14227e 3150 keyOk = (key <= 127);
5fd656d5
RD
3151 }
3152 if (keyOk) {
3153 m_swx->DoAddChar(key);
3154 return;
3155 }
3156#else
3157 int key = evt.GetKeyCode();
3158 if (key <= WXK_START || key > WXK_COMMAND) {
3159 m_swx->DoAddChar(key);
3160 return;
3161 }
3162#endif
d25f5fbb 3163 }
5fd656d5 3164
f3c2c221 3165 evt.Skip();
f6bcfd97
BP
3166}
3167
d6582821 3168
f6bcfd97 3169void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) {
5fd656d5 3170 int processed = m_swx->DoKeyDown(evt, &m_lastKeyDownConsumed);
d6582821 3171 if (!processed && !m_lastKeyDownConsumed)
9ce192d4
RD
3172 evt.Skip();
3173}
3174
d6582821 3175
b6bfd8e8 3176void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& evt) {
ec830416 3177 m_swx->DoLoseFocus();
b6bfd8e8 3178 evt.Skip();
9ce192d4
RD
3179}
3180
d6582821 3181
b6bfd8e8 3182void wxStyledTextCtrl::OnGainFocus(wxFocusEvent& evt) {
9ce192d4 3183 m_swx->DoGainFocus();
b6bfd8e8 3184 evt.Skip();
9ce192d4
RD
3185}
3186
d6582821 3187
88a8b04e 3188void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(evt)) {
9ce192d4
RD
3189 m_swx->DoSysColourChange();
3190}
3191
d6582821 3192
88a8b04e 3193void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent& WXUNUSED(evt)) {
9ce192d4
RD
3194 // do nothing to help avoid flashing
3195}
3196
3197
3198
3199void wxStyledTextCtrl::OnMenu(wxCommandEvent& evt) {
3200 m_swx->DoCommand(evt.GetId());
3201}
3202
3203
88a8b04e 3204void wxStyledTextCtrl::OnListBox(wxCommandEvent& WXUNUSED(evt)) {
f6bcfd97
BP
3205 m_swx->DoOnListBox();
3206}
3207
3208
8e54aaed
RD
3209void wxStyledTextCtrl::OnIdle(wxIdleEvent& evt) {
3210 m_swx->DoOnIdle(evt);
3211}
3212
3213
8ae4f086
RD
3214wxSize wxStyledTextCtrl::DoGetBestSize() const
3215{
3216 // What would be the best size for a wxSTC?
3217 // Just give a reasonable minimum until something else can be figured out.
3218 return wxSize(200,100);
3219}
3220
3221
9ce192d4
RD
3222//----------------------------------------------------------------------
3223// Turn notifications from Scintilla into events
3224
f6bcfd97 3225
9ce192d4
RD
3226void wxStyledTextCtrl::NotifyChange() {
3227 wxStyledTextEvent evt(wxEVT_STC_CHANGE, GetId());
a29a241f 3228 evt.SetEventObject(this);
9ce192d4
RD
3229 GetEventHandler()->ProcessEvent(evt);
3230}
3231
2b5f62a0
VZ
3232
3233static void SetEventText(wxStyledTextEvent& evt, const char* text,
3234 size_t length) {
3235 if(!text) return;
3236
1c930beb 3237 evt.SetText(stc2wx(text, length));
2b5f62a0
VZ
3238}
3239
3240
9ce192d4
RD
3241void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
3242 SCNotification& scn = *_scn;
65ec6247
RD
3243 wxStyledTextEvent evt(0, GetId());
3244
a29a241f 3245 evt.SetEventObject(this);
65ec6247
RD
3246 evt.SetPosition(scn.position);
3247 evt.SetKey(scn.ch);
3248 evt.SetModifiers(scn.modifiers);
3249
9ce192d4
RD
3250 switch (scn.nmhdr.code) {
3251 case SCN_STYLENEEDED:
65ec6247 3252 evt.SetEventType(wxEVT_STC_STYLENEEDED);
9ce192d4 3253 break;
65ec6247 3254
9ce192d4 3255 case SCN_CHARADDED:
65ec6247 3256 evt.SetEventType(wxEVT_STC_CHARADDED);
9ce192d4 3257 break;
65ec6247 3258
9ce192d4 3259 case SCN_SAVEPOINTREACHED:
65ec6247 3260 evt.SetEventType(wxEVT_STC_SAVEPOINTREACHED);
9ce192d4 3261 break;
65ec6247 3262
9ce192d4 3263 case SCN_SAVEPOINTLEFT:
65ec6247 3264 evt.SetEventType(wxEVT_STC_SAVEPOINTLEFT);
9ce192d4 3265 break;
65ec6247 3266
9ce192d4 3267 case SCN_MODIFYATTEMPTRO:
65ec6247 3268 evt.SetEventType(wxEVT_STC_ROMODIFYATTEMPT);
9ce192d4 3269 break;
65ec6247
RD
3270
3271 case SCN_KEY:
3272 evt.SetEventType(wxEVT_STC_KEY);
3273 break;
3274
9ce192d4 3275 case SCN_DOUBLECLICK:
65ec6247 3276 evt.SetEventType(wxEVT_STC_DOUBLECLICK);
9ce192d4 3277 break;
65ec6247
RD
3278
3279 case SCN_UPDATEUI:
3280 evt.SetEventType(wxEVT_STC_UPDATEUI);
9ce192d4 3281 break;
65ec6247
RD
3282
3283 case SCN_MODIFIED:
3284 evt.SetEventType(wxEVT_STC_MODIFIED);
3285 evt.SetModificationType(scn.modificationType);
2b5f62a0 3286 SetEventText(evt, scn.text, scn.length);
65ec6247
RD
3287 evt.SetLength(scn.length);
3288 evt.SetLinesAdded(scn.linesAdded);
3289 evt.SetLine(scn.line);
3290 evt.SetFoldLevelNow(scn.foldLevelNow);
3291 evt.SetFoldLevelPrev(scn.foldLevelPrev);
9ce192d4 3292 break;
65ec6247 3293
9ce192d4 3294 case SCN_MACRORECORD:
65ec6247
RD
3295 evt.SetEventType(wxEVT_STC_MACRORECORD);
3296 evt.SetMessage(scn.message);
3297 evt.SetWParam(scn.wParam);
3298 evt.SetLParam(scn.lParam);
9ce192d4 3299 break;
65ec6247 3300
9ce192d4 3301 case SCN_MARGINCLICK:
65ec6247
RD
3302 evt.SetEventType(wxEVT_STC_MARGINCLICK);
3303 evt.SetMargin(scn.margin);
9ce192d4 3304 break;
65ec6247 3305
9ce192d4 3306 case SCN_NEEDSHOWN:
65ec6247
RD
3307 evt.SetEventType(wxEVT_STC_NEEDSHOWN);
3308 evt.SetLength(scn.length);
9ce192d4 3309 break;
65ec6247 3310
65ec6247
RD
3311 case SCN_PAINTED:
3312 evt.SetEventType(wxEVT_STC_PAINTED);
3313 break;
3314
0daf5e6b
RD
3315 case SCN_AUTOCSELECTION:
3316 evt.SetEventType(wxEVT_STC_AUTOCOMP_SELECTION);
3317 evt.SetListType(scn.listType);
3318 SetEventText(evt, scn.text, strlen(scn.text));
3319 evt.SetPosition(scn.lParam);
3320 break;
3321
65ec6247
RD
3322 case SCN_USERLISTSELECTION:
3323 evt.SetEventType(wxEVT_STC_USERLISTSELECTION);
3324 evt.SetListType(scn.listType);
2b5f62a0 3325 SetEventText(evt, scn.text, strlen(scn.text));
0daf5e6b 3326 evt.SetPosition(scn.lParam);
65ec6247
RD
3327 break;
3328
3329 case SCN_URIDROPPED:
3330 evt.SetEventType(wxEVT_STC_URIDROPPED);
2b5f62a0 3331 SetEventText(evt, scn.text, strlen(scn.text));
65ec6247
RD
3332 break;
3333
3334 case SCN_DWELLSTART:
3335 evt.SetEventType(wxEVT_STC_DWELLSTART);
3336 evt.SetX(scn.x);
3337 evt.SetY(scn.y);
3338 break;
3339
3340 case SCN_DWELLEND:
3341 evt.SetEventType(wxEVT_STC_DWELLEND);
3342 evt.SetX(scn.x);
3343 evt.SetY(scn.y);
3344 break;
3345
a834585d
RD
3346 case SCN_ZOOM:
3347 evt.SetEventType(wxEVT_STC_ZOOM);
3348 break;
3349
9e730a78
RD
3350 case SCN_HOTSPOTCLICK:
3351 evt.SetEventType(wxEVT_STC_HOTSPOT_CLICK);
3352 break;
3353
3354 case SCN_HOTSPOTDOUBLECLICK:
3355 evt.SetEventType(wxEVT_STC_HOTSPOT_DCLICK);
3356 break;
3357
3358 case SCN_CALLTIPCLICK:
3359 evt.SetEventType(wxEVT_STC_CALLTIP_CLICK);
3360 break;
0daf5e6b 3361
65ec6247
RD
3362 default:
3363 return;
9ce192d4 3364 }
65ec6247
RD
3365
3366 GetEventHandler()->ProcessEvent(evt);
9ce192d4
RD
3367}
3368
3369
9ce192d4
RD
3370//----------------------------------------------------------------------
3371//----------------------------------------------------------------------
3372//----------------------------------------------------------------------
3373
3374wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType, int id)
3375 : wxCommandEvent(commandType, id)
3376{
3377 m_position = 0;
3378 m_key = 0;
3379 m_modifiers = 0;
3380 m_modificationType = 0;
3381 m_length = 0;
3382 m_linesAdded = 0;
3383 m_line = 0;
3384 m_foldLevelNow = 0;
3385 m_foldLevelPrev = 0;
3386 m_margin = 0;
3387 m_message = 0;
3388 m_wParam = 0;
3389 m_lParam = 0;
65ec6247
RD
3390 m_listType = 0;
3391 m_x = 0;
3392 m_y = 0;
7e126a07 3393 m_dragAllowMove = false;
92bbd64f 3394#if wxUSE_DRAG_AND_DROP
a29a241f 3395 m_dragResult = wxDragNone;
92bbd64f 3396#endif
9ce192d4
RD
3397}
3398
3399bool wxStyledTextEvent::GetShift() const { return (m_modifiers & SCI_SHIFT) != 0; }
3400bool wxStyledTextEvent::GetControl() const { return (m_modifiers & SCI_CTRL) != 0; }
3401bool wxStyledTextEvent::GetAlt() const { return (m_modifiers & SCI_ALT) != 0; }
3402
5fa4613c 3403
41286fd1
JS
3404wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent& event):
3405 wxCommandEvent(event)
3406{
3407 m_position = event.m_position;
3408 m_key = event.m_key;
3409 m_modifiers = event.m_modifiers;
3410 m_modificationType = event.m_modificationType;
3411 m_text = event.m_text;
3412 m_length = event.m_length;
3413 m_linesAdded = event.m_linesAdded;
3414 m_line = event.m_line;
3415 m_foldLevelNow = event.m_foldLevelNow;
3416 m_foldLevelPrev = event.m_foldLevelPrev;
3417
3418 m_margin = event.m_margin;
3419
3420 m_message = event.m_message;
3421 m_wParam = event.m_wParam;
3422 m_lParam = event.m_lParam;
3423
3424 m_listType = event.m_listType;
3425 m_x = event.m_x;
3426 m_y = event.m_y;
9ce192d4 3427
41286fd1
JS
3428 m_dragText = event.m_dragText;
3429 m_dragAllowMove =event.m_dragAllowMove;
92bbd64f 3430#if wxUSE_DRAG_AND_DROP
41286fd1 3431 m_dragResult = event.m_dragResult;
92bbd64f 3432#endif
9ce192d4
RD
3433}
3434
3435//----------------------------------------------------------------------
3436//----------------------------------------------------------------------
3437
29825f5f 3438#endif // wxUSE_STC