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