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