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