]> git.saurik.com Git - wxWidgets.git/blame - contrib/src/stc/stc.cpp
Decided I need copy and assignment afterall
[wxWidgets.git] / contrib / src / stc / stc.cpp
CommitLineData
9ce192d4
RD
1////////////////////////////////////////////////////////////////////////////
2// Name: stc.cpp
3// Purpose: A wxWindows implementation of Scintilla. This class is the
4// one meant to be used directly by wx applications. It does not
5// derive directly from the Scintilla classes, but instead
6// delegates most things to the real Scintilla class.
7// This allows the use of Scintilla without polluting the
f6bcfd97 8// namespace with all the classes and identifiers from Scintilla.
9ce192d4
RD
9//
10// Author: Robin Dunn
11//
12// Created: 13-Jan-2000
13// RCS-ID: $Id$
14// Copyright: (c) 2000 by Total Control Software
15// Licence: wxWindows license
16/////////////////////////////////////////////////////////////////////////////
17
f6bcfd97
BP
18#include <ctype.h>
19
9ce192d4
RD
20#include "wx/stc/stc.h"
21#include "ScintillaWX.h"
22
23#include <wx/tokenzr.h>
24
f6bcfd97 25
9ce192d4
RD
26//----------------------------------------------------------------------
27
28const wxChar* wxSTCNameStr = "stcwindow";
29
d25f5fbb
RD
30DEFINE_EVENT_TYPE( wxEVT_STC_CHANGE )
31DEFINE_EVENT_TYPE( wxEVT_STC_STYLENEEDED )
32DEFINE_EVENT_TYPE( wxEVT_STC_CHARADDED )
d25f5fbb
RD
33DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTREACHED )
34DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTLEFT )
35DEFINE_EVENT_TYPE( wxEVT_STC_ROMODIFYATTEMPT )
65ec6247 36DEFINE_EVENT_TYPE( wxEVT_STC_KEY )
d25f5fbb 37DEFINE_EVENT_TYPE( wxEVT_STC_DOUBLECLICK )
65ec6247 38DEFINE_EVENT_TYPE( wxEVT_STC_UPDATEUI )
d25f5fbb 39DEFINE_EVENT_TYPE( wxEVT_STC_MODIFIED )
d25f5fbb
RD
40DEFINE_EVENT_TYPE( wxEVT_STC_MACRORECORD )
41DEFINE_EVENT_TYPE( wxEVT_STC_MARGINCLICK )
42DEFINE_EVENT_TYPE( wxEVT_STC_NEEDSHOWN )
43DEFINE_EVENT_TYPE( wxEVT_STC_POSCHANGED )
65ec6247
RD
44DEFINE_EVENT_TYPE( wxEVT_STC_PAINTED )
45DEFINE_EVENT_TYPE( wxEVT_STC_USERLISTSELECTION )
46DEFINE_EVENT_TYPE( wxEVT_STC_URIDROPPED )
47DEFINE_EVENT_TYPE( wxEVT_STC_DWELLSTART )
48DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND )
a29a241f
RD
49DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG )
50DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER )
51DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP )
d25f5fbb
RD
52
53
9ce192d4
RD
54BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
55 EVT_PAINT (wxStyledTextCtrl::OnPaint)
56 EVT_SCROLLWIN (wxStyledTextCtrl::OnScrollWin)
5fa4613c 57 EVT_SCROLL (wxStyledTextCtrl::OnScroll)
9ce192d4
RD
58 EVT_SIZE (wxStyledTextCtrl::OnSize)
59 EVT_LEFT_DOWN (wxStyledTextCtrl::OnMouseLeftDown)
4ceb1196
RD
60#ifdef __WXMSW__
61 // Let Scintilla see the double click as a second click
62 EVT_LEFT_DCLICK (wxStyledTextCtrl::OnMouseLeftDown)
63#endif
9ce192d4
RD
64 EVT_MOTION (wxStyledTextCtrl::OnMouseMove)
65 EVT_LEFT_UP (wxStyledTextCtrl::OnMouseLeftUp)
ddf2da08
RD
66#ifdef __WXGTK__
67 EVT_RIGHT_UP (wxStyledTextCtrl::OnMouseRightUp)
68#else
65ec6247 69 EVT_CONTEXT_MENU (wxStyledTextCtrl::OnContextMenu)
ddf2da08 70#endif
37d62433 71 EVT_MOUSEWHEEL (wxStyledTextCtrl::OnMouseWheel)
9ce192d4 72 EVT_CHAR (wxStyledTextCtrl::OnChar)
f6bcfd97 73 EVT_KEY_DOWN (wxStyledTextCtrl::OnKeyDown)
9ce192d4
RD
74 EVT_KILL_FOCUS (wxStyledTextCtrl::OnLoseFocus)
75 EVT_SET_FOCUS (wxStyledTextCtrl::OnGainFocus)
76 EVT_SYS_COLOUR_CHANGED (wxStyledTextCtrl::OnSysColourChanged)
77 EVT_ERASE_BACKGROUND (wxStyledTextCtrl::OnEraseBackground)
78 EVT_MENU_RANGE (-1, -1, wxStyledTextCtrl::OnMenu)
f6bcfd97 79 EVT_LISTBOX_DCLICK (-1, wxStyledTextCtrl::OnListBox)
9ce192d4
RD
80END_EVENT_TABLE()
81
f6bcfd97
BP
82
83IMPLEMENT_CLASS(wxStyledTextCtrl, wxControl)
84IMPLEMENT_DYNAMIC_CLASS(wxStyledTextEvent, wxCommandEvent)
85
1a2fb4cd
RD
86// forces the linking of the lexer modules
87int Scintilla_LinkLexers();
88
9ce192d4
RD
89//----------------------------------------------------------------------
90// Constructor and Destructor
91
92wxStyledTextCtrl::wxStyledTextCtrl(wxWindow *parent,
93 wxWindowID id,
94 const wxPoint& pos,
95 const wxSize& size,
96 long style,
97 const wxString& name) :
98 wxControl(parent, id, pos, size,
f97d84a6 99 style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS | wxCLIP_CHILDREN,
9ce192d4
RD
100 wxDefaultValidator, name)
101{
1a2fb4cd 102 Scintilla_LinkLexers();
9ce192d4 103 m_swx = new ScintillaWX(this);
9ce192d4 104 m_stopWatch.Start();
d6582821 105 m_lastKeyDownConsumed = FALSE;
5fa4613c
RD
106 m_vScrollBar = NULL;
107 m_hScrollBar = NULL;
9ce192d4
RD
108}
109
110
111wxStyledTextCtrl::~wxStyledTextCtrl() {
112 delete m_swx;
9ce192d4
RD
113}
114
115
116//----------------------------------------------------------------------
117
f6bcfd97 118long wxStyledTextCtrl::SendMsg(int msg, long wp, long lp) {
9ce192d4
RD
119
120 return m_swx->WndProc(msg, wp, lp);
121}
122
123
f97d84a6
RD
124#ifdef MAKELONG
125#undef MAKELONG
126#endif
127
4370573a 128#define MAKELONG(a, b) ((a) | ((b) << 16))
9ce192d4
RD
129
130
4370573a
RD
131static long wxColourAsLong(const wxColour& co) {
132 return (((long)co.Blue() << 16) |
133 ((long)co.Green() << 8) |
134 ((long)co.Red()));
9ce192d4
RD
135}
136
4370573a
RD
137static wxColour wxColourFromLong(long c) {
138 wxColour clr;
139 clr.Set(c & 0xff, (c >> 8) & 0xff, (c >> 16) & 0xff);
140 return clr;
9ce192d4
RD
141}
142
143
4370573a
RD
144static wxColour wxColourFromSpec(const wxString& spec) {
145 // spec should be #RRGGBB
146 char* junk;
147 int red = strtol(spec.Mid(1,2), &junk, 16);
148 int green = strtol(spec.Mid(3,2), &junk, 16);
149 int blue = strtol(spec.Mid(5,2), &junk, 16);
150 return wxColour(red, green, blue);
9ce192d4
RD
151}
152
153
4370573a
RD
154//----------------------------------------------------------------------
155// BEGIN generated section. The following code is automatically generated
156// by gen_iface.py from the contents of Scintilla.iface. Do not edit
157// this file. Edit stc.cpp.in or gen_iface.py instead and regenerate.
9ce192d4
RD
158
159
4370573a 160// Add text to the document
9ce192d4 161void wxStyledTextCtrl::AddText(const wxString& text) {
4370573a 162 SendMsg(2001, text.Len(), (long)text.c_str());
9ce192d4
RD
163}
164
4370573a 165// Add array of cells to document
9ce192d4 166void wxStyledTextCtrl::AddStyledText(const wxString& text) {
4370573a 167 SendMsg(2002, text.Len(), (long)text.c_str());
9ce192d4
RD
168}
169
4370573a 170// Insert string at a position
9ce192d4 171void wxStyledTextCtrl::InsertText(int pos, const wxString& text) {
4370573a 172 SendMsg(2003, pos, (long)text.c_str());
9ce192d4
RD
173}
174
4370573a 175// Delete all text in the document
9ce192d4 176void wxStyledTextCtrl::ClearAll() {
4370573a 177 SendMsg(2004, 0, 0);
9ce192d4
RD
178}
179
4370573a
RD
180// Set all style bytes to 0, remove all folding information
181void wxStyledTextCtrl::ClearDocumentStyle() {
182 SendMsg(2005, 0, 0);
9ce192d4
RD
183}
184
4370573a
RD
185// The number of characters in the document
186int wxStyledTextCtrl::GetLength() {
187 return SendMsg(2006, 0, 0);
9ce192d4
RD
188}
189
4370573a
RD
190// Returns the character byte at the position
191int wxStyledTextCtrl::GetCharAt(int pos) {
192 return SendMsg(2007, pos, 0);
9ce192d4
RD
193}
194
4370573a
RD
195// Returns the position of the caret
196int wxStyledTextCtrl::GetCurrentPos() {
197 return SendMsg(2008, 0, 0);
9ce192d4
RD
198}
199
4370573a
RD
200// Returns the position of the opposite end of the selection to the caret
201int wxStyledTextCtrl::GetAnchor() {
202 return SendMsg(2009, 0, 0);
9ce192d4
RD
203}
204
4370573a
RD
205// Returns the style byte at the position
206int wxStyledTextCtrl::GetStyleAt(int pos) {
207 return SendMsg(2010, pos, 0);
9ce192d4
RD
208}
209
4370573a 210// Redoes the next action on the undo history
9ce192d4 211void wxStyledTextCtrl::Redo() {
4370573a 212 SendMsg(2011, 0, 0);
9ce192d4
RD
213}
214
4370573a
RD
215// Choose between collecting actions into the undo
216// history and discarding them.
217void wxStyledTextCtrl::SetUndoCollection(bool collectUndo) {
218 SendMsg(2012, collectUndo, 0);
9ce192d4
RD
219}
220
4370573a
RD
221// Select all the text in the document.
222void wxStyledTextCtrl::SelectAll() {
223 SendMsg(2013, 0, 0);
9ce192d4
RD
224}
225
4370573a
RD
226// Remember the current position in the undo history as the position
227// at which the document was saved.
228void wxStyledTextCtrl::SetSavePoint() {
229 SendMsg(2014, 0, 0);
9ce192d4
RD
230}
231
4370573a
RD
232// Retrieve a buffer of cells.
233wxString wxStyledTextCtrl::GetStyledText(int startPos, int endPos) {
234 wxString text;
e1a93f46
RD
235 if (endPos < startPos) {
236 int temp = startPos;
237 startPos = endPos;
238 endPos = temp;
239 }
4370573a 240 int len = endPos - startPos;
abb69c6c 241 if (!len) return "";
4370573a 242 TextRange tr;
abb69c6c 243 tr.lpstrText = text.GetWriteBuf(len*2);
4370573a
RD
244 tr.chrg.cpMin = startPos;
245 tr.chrg.cpMax = endPos;
246 SendMsg(2015, 0, (long)&tr);
247 text.UngetWriteBuf(len*2);
248 return text;
9ce192d4
RD
249}
250
4370573a
RD
251// Are there any redoable actions in the undo history.
252bool wxStyledTextCtrl::CanRedo() {
253 return SendMsg(2016, 0, 0) != 0;
9ce192d4
RD
254}
255
4370573a
RD
256// Retrieve the line number at which a particular marker is located
257int wxStyledTextCtrl::MarkerLineFromHandle(int handle) {
258 return SendMsg(2017, handle, 0);
9ce192d4
RD
259}
260
4370573a
RD
261// Delete a marker.
262void wxStyledTextCtrl::MarkerDeleteHandle(int handle) {
263 SendMsg(2018, handle, 0);
9ce192d4
RD
264}
265
4370573a
RD
266// Is undo history being collected?
267bool wxStyledTextCtrl::GetUndoCollection() {
268 return SendMsg(2019, 0, 0) != 0;
9ce192d4
RD
269}
270
4370573a
RD
271// Are white space characters currently visible?
272// Returns one of SCWS_* constants.
273int wxStyledTextCtrl::GetViewWhiteSpace() {
274 return SendMsg(2020, 0, 0);
9ce192d4
RD
275}
276
4370573a
RD
277// Make white space characters invisible, always visible or visible outside indentation.
278void wxStyledTextCtrl::SetViewWhiteSpace(int viewWS) {
279 SendMsg(2021, viewWS, 0);
9ce192d4
RD
280}
281
4370573a 282// Find the position from a point within the window.
9ce192d4 283int wxStyledTextCtrl::PositionFromPoint(wxPoint pt) {
4370573a 284 return SendMsg(2022, pt.x, pt.y);
9ce192d4
RD
285}
286
65ec6247
RD
287// Find the position from a point within the window but return
288// INVALID_POSITION if not close to text.
289int wxStyledTextCtrl::PositionFromPointClose(int x, int y) {
290 return SendMsg(2023, x, y);
291}
292
4370573a
RD
293// Set caret to start of a line and ensure it is visible.
294void wxStyledTextCtrl::GotoLine(int line) {
295 SendMsg(2024, line, 0);
9ce192d4
RD
296}
297
4370573a 298// Set caret to a position and ensure it is visible.
9ce192d4 299void wxStyledTextCtrl::GotoPos(int pos) {
4370573a 300 SendMsg(2025, pos, 0);
9ce192d4
RD
301}
302
4370573a
RD
303// Set the selection anchor to a position. The anchor is the opposite
304// end of the selection from the caret.
305void wxStyledTextCtrl::SetAnchor(int posAnchor) {
306 SendMsg(2026, posAnchor, 0);
9ce192d4
RD
307}
308
4370573a
RD
309// Retrieve the text of the line containing the caret.
310// Returns the index of the caret on the line.
311wxString wxStyledTextCtrl::GetCurLine(int* linePos) {
312 wxString text;
313 int len = LineLength(GetCurrentLine());
8de28db9
RD
314 if (!len) {
315 if (linePos) *linePos = 0;
316 return "";
317 }
318 // Need an extra byte because SCI_GETCURLINE writes a null to the string
319 char* buf = text.GetWriteBuf(len+1);
320
321 int pos = SendMsg(2027, len+1, (long)buf);
abb69c6c 322 text.UngetWriteBuf(len);
4370573a 323 if (linePos) *linePos = pos;
9ce192d4 324
4370573a 325 return text;
9ce192d4
RD
326}
327
4370573a
RD
328// Retrieve the position of the last correctly styled character.
329int wxStyledTextCtrl::GetEndStyled() {
330 return SendMsg(2028, 0, 0);
9ce192d4
RD
331}
332
65ec6247
RD
333// Convert all line endings in the document to one mode.
334void wxStyledTextCtrl::ConvertEOLs(int eolMode) {
335 SendMsg(2029, eolMode, 0);
9ce192d4
RD
336}
337
4370573a
RD
338// Retrieve the current end of line mode - one of CRLF, CR, or LF.
339int wxStyledTextCtrl::GetEOLMode() {
340 return SendMsg(2030, 0, 0);
9ce192d4
RD
341}
342
4370573a
RD
343// Set the current end of line mode.
344void wxStyledTextCtrl::SetEOLMode(int eolMode) {
345 SendMsg(2031, eolMode, 0);
9ce192d4
RD
346}
347
4370573a
RD
348// Set the current styling position to pos and the styling mask to mask.
349// The styling mask can be used to protect some bits in each styling byte from
350// modification.
351void wxStyledTextCtrl::StartStyling(int pos, int mask) {
352 SendMsg(2032, pos, mask);
9ce192d4
RD
353}
354
4370573a
RD
355// Change style from current styling position for length characters to a style
356// and move the current styling position to after this newly styled segment.
357void wxStyledTextCtrl::SetStyling(int length, int style) {
358 SendMsg(2033, length, style);
f6bcfd97
BP
359}
360
4370573a
RD
361// Is drawing done first into a buffer or direct to the screen.
362bool wxStyledTextCtrl::GetBufferedDraw() {
363 return SendMsg(2034, 0, 0) != 0;
f6bcfd97
BP
364}
365
4370573a
RD
366// If drawing is buffered then each line of text is drawn into a bitmap buffer
367// before drawing it to the screen to avoid flicker.
368void wxStyledTextCtrl::SetBufferedDraw(bool buffered) {
369 SendMsg(2035, buffered, 0);
f6bcfd97
BP
370}
371
4370573a
RD
372// Change the visible size of a tab to be a multiple of the width of a space
373// character.
374void wxStyledTextCtrl::SetTabWidth(int tabWidth) {
375 SendMsg(2036, tabWidth, 0);
f6bcfd97
BP
376}
377
4370573a
RD
378// Retrieve the visible size of a tab.
379int wxStyledTextCtrl::GetTabWidth() {
380 return SendMsg(2121, 0, 0);
9ce192d4
RD
381}
382
4370573a
RD
383// Set the code page used to interpret the bytes of the document as characters.
384// The SC_CP_UTF8 value can be used to enter Unicode mode.
385void wxStyledTextCtrl::SetCodePage(int codePage) {
386 SendMsg(2037, codePage, 0);
9ce192d4
RD
387}
388
4370573a 389// Set the symbol used for a particular marker number,
1a2fb4cd 390// and optionally the fore and background colours.
4370573a
RD
391void wxStyledTextCtrl::MarkerDefine(int markerNumber, int markerSymbol,
392 const wxColour& foreground,
393 const wxColour& background) {
9ce192d4 394
4370573a
RD
395 SendMsg(2040, markerNumber, markerSymbol);
396 if (foreground.Ok())
397 MarkerSetForeground(markerNumber, foreground);
398 if (background.Ok())
399 MarkerSetBackground(markerNumber, background);
9ce192d4
RD
400}
401
4370573a
RD
402// Set the foreground colour used for a particular marker number.
403void wxStyledTextCtrl::MarkerSetForeground(int markerNumber, const wxColour& fore) {
404 SendMsg(2041, markerNumber, wxColourAsLong(fore));
9ce192d4
RD
405}
406
4370573a
RD
407// Set the background colour used for a particular marker number.
408void wxStyledTextCtrl::MarkerSetBackground(int markerNumber, const wxColour& back) {
409 SendMsg(2042, markerNumber, wxColourAsLong(back));
9ce192d4
RD
410}
411
1a2fb4cd
RD
412// Add a marker to a line, returning an ID which can be used to find or delete the marker.
413int wxStyledTextCtrl::MarkerAdd(int line, int markerNumber) {
414 return SendMsg(2043, line, markerNumber);
9ce192d4
RD
415}
416
4370573a
RD
417// Delete a marker from a line
418void wxStyledTextCtrl::MarkerDelete(int line, int markerNumber) {
419 SendMsg(2044, line, markerNumber);
9ce192d4
RD
420}
421
4370573a
RD
422// Delete all markers with a particular number from all lines
423void wxStyledTextCtrl::MarkerDeleteAll(int markerNumber) {
424 SendMsg(2045, markerNumber, 0);
9ce192d4
RD
425}
426
4370573a
RD
427// Get a bit mask of all the markers set on a line.
428int wxStyledTextCtrl::MarkerGet(int line) {
429 return SendMsg(2046, line, 0);
9ce192d4
RD
430}
431
4370573a
RD
432// Find the next line after lineStart that includes a marker in mask.
433int wxStyledTextCtrl::MarkerNext(int lineStart, int markerMask) {
434 return SendMsg(2047, lineStart, markerMask);
9ce192d4
RD
435}
436
4370573a
RD
437// Find the previous line before lineStart that includes a marker in mask.
438int wxStyledTextCtrl::MarkerPrevious(int lineStart, int markerMask) {
439 return SendMsg(2048, lineStart, markerMask);
9ce192d4
RD
440}
441
4370573a
RD
442// Set a margin to be either numeric or symbolic.
443void wxStyledTextCtrl::SetMarginType(int margin, int marginType) {
444 SendMsg(2240, margin, marginType);
9ce192d4
RD
445}
446
4370573a
RD
447// Retrieve the type of a margin.
448int wxStyledTextCtrl::GetMarginType(int margin) {
449 return SendMsg(2241, margin, 0);
9ce192d4
RD
450}
451
4370573a
RD
452// Set the width of a margin to a width expressed in pixels.
453void wxStyledTextCtrl::SetMarginWidth(int margin, int pixelWidth) {
454 SendMsg(2242, margin, pixelWidth);
9ce192d4
RD
455}
456
4370573a
RD
457// Retrieve the width of a margin in pixels.
458int wxStyledTextCtrl::GetMarginWidth(int margin) {
459 return SendMsg(2243, margin, 0);
f6bcfd97
BP
460}
461
4370573a
RD
462// Set a mask that determines which markers are displayed in a margin.
463void wxStyledTextCtrl::SetMarginMask(int margin, int mask) {
464 SendMsg(2244, margin, mask);
f6bcfd97
BP
465}
466
4370573a
RD
467// Retrieve the marker mask of a margin.
468int wxStyledTextCtrl::GetMarginMask(int margin) {
469 return SendMsg(2245, margin, 0);
9ce192d4
RD
470}
471
4370573a
RD
472// Make a margin sensitive or insensitive to mouse clicks.
473void wxStyledTextCtrl::SetMarginSensitive(int margin, bool sensitive) {
474 SendMsg(2246, margin, sensitive);
9ce192d4
RD
475}
476
4370573a
RD
477// Retrieve the mouse click sensitivity of a margin.
478bool wxStyledTextCtrl::GetMarginSensitive(int margin) {
479 return SendMsg(2247, margin, 0) != 0;
9ce192d4
RD
480}
481
4370573a 482// Clear all the styles and make equivalent to the global default style.
9ce192d4 483void wxStyledTextCtrl::StyleClearAll() {
4370573a 484 SendMsg(2050, 0, 0);
9ce192d4
RD
485}
486
4370573a
RD
487// Set the foreground colour of a style.
488void wxStyledTextCtrl::StyleSetForeground(int style, const wxColour& fore) {
489 SendMsg(2051, style, wxColourAsLong(fore));
9ce192d4
RD
490}
491
4370573a
RD
492// Set the background colour of a style.
493void wxStyledTextCtrl::StyleSetBackground(int style, const wxColour& back) {
494 SendMsg(2052, style, wxColourAsLong(back));
9ce192d4
RD
495}
496
4370573a
RD
497// Set a style to be bold or not.
498void wxStyledTextCtrl::StyleSetBold(int style, bool bold) {
499 SendMsg(2053, style, bold);
9ce192d4
RD
500}
501
4370573a
RD
502// Set a style to be italic or not.
503void wxStyledTextCtrl::StyleSetItalic(int style, bool italic) {
504 SendMsg(2054, style, italic);
9ce192d4
RD
505}
506
4370573a
RD
507// Set the size of characters of a style.
508void wxStyledTextCtrl::StyleSetSize(int style, int sizePoints) {
509 SendMsg(2055, style, sizePoints);
9ce192d4
RD
510}
511
4370573a
RD
512// Set the font of a style.
513void wxStyledTextCtrl::StyleSetFaceName(int style, const wxString& fontName) {
514 SendMsg(2056, style, (long)fontName.c_str());
9ce192d4
RD
515}
516
4370573a
RD
517// Set a style to have its end of line filled or not.
518void wxStyledTextCtrl::StyleSetEOLFilled(int style, bool filled) {
519 SendMsg(2057, style, filled);
9ce192d4
RD
520}
521
4370573a
RD
522// Reset the default style to its state at startup
523void wxStyledTextCtrl::StyleResetDefault() {
524 SendMsg(2058, 0, 0);
9ce192d4
RD
525}
526
4370573a
RD
527// Set a style to be underlined or not.
528void wxStyledTextCtrl::StyleSetUnderline(int style, bool underline) {
529 SendMsg(2059, style, underline);
9ce192d4
RD
530}
531
65ec6247
RD
532// Set a style to be mixed case, or to force upper or lower case.
533void wxStyledTextCtrl::StyleSetCase(int style, int caseForce) {
534 SendMsg(2060, style, caseForce);
535}
536
4370573a
RD
537// Set the foreground colour of the selection and whether to use this setting.
538void wxStyledTextCtrl::SetSelForeground(bool useSetting, const wxColour& fore) {
539 SendMsg(2067, useSetting, wxColourAsLong(fore));
9ce192d4
RD
540}
541
4370573a
RD
542// Set the background colour of the selection and whether to use this setting.
543void wxStyledTextCtrl::SetSelBackground(bool useSetting, const wxColour& back) {
544 SendMsg(2068, useSetting, wxColourAsLong(back));
9ce192d4
RD
545}
546
4370573a
RD
547// Set the foreground colour of the caret.
548void wxStyledTextCtrl::SetCaretForeground(const wxColour& fore) {
549 SendMsg(2069, wxColourAsLong(fore), 0);
9ce192d4
RD
550}
551
4370573a
RD
552// When key+modifier combination km is pressed perform msg.
553void wxStyledTextCtrl::CmdKeyAssign(int key, int modifiers, int cmd) {
554 SendMsg(2070, MAKELONG(key, modifiers), cmd);
9ce192d4
RD
555}
556
4370573a
RD
557// When key+modifier combination km do nothing.
558void wxStyledTextCtrl::CmdKeyClear(int key, int modifiers) {
559 SendMsg(2071, MAKELONG(key, modifiers));
9ce192d4
RD
560}
561
4370573a
RD
562// Drop all key mappings.
563void wxStyledTextCtrl::CmdKeyClearAll() {
564 SendMsg(2072, 0, 0);
565}
9ce192d4 566
4370573a
RD
567// Set the styles for a segment of the document.
568void wxStyledTextCtrl::SetStyleBytes(int length, char* styleBytes) {
569 SendMsg(2073, length, (long)styleBytes);
9ce192d4
RD
570}
571
4370573a
RD
572// Set a style to be visible or not.
573void wxStyledTextCtrl::StyleSetVisible(int style, bool visible) {
574 SendMsg(2074, style, visible);
575}
9ce192d4 576
4370573a 577// Get the time in milliseconds that the caret is on and off.
9ce192d4 578int wxStyledTextCtrl::GetCaretPeriod() {
4370573a 579 return SendMsg(2075, 0, 0);
9ce192d4
RD
580}
581
4370573a
RD
582// Get the time in milliseconds that the caret is on and off. 0 = steady on.
583void wxStyledTextCtrl::SetCaretPeriod(int periodMilliseconds) {
584 SendMsg(2076, periodMilliseconds, 0);
585}
9ce192d4 586
4370573a
RD
587// Set the set of characters making up words for when moving or selecting
588// by word.
589void wxStyledTextCtrl::SetWordChars(const wxString& characters) {
590 SendMsg(2077, 0, (long)characters.c_str());
9ce192d4
RD
591}
592
4370573a
RD
593// Start a sequence of actions that is undone and redone as a unit.
594// May be nested.
595void wxStyledTextCtrl::BeginUndoAction() {
596 SendMsg(2078, 0, 0);
597}
9ce192d4 598
4370573a
RD
599// End a sequence of actions that is undone and redone as a unit.
600void wxStyledTextCtrl::EndUndoAction() {
601 SendMsg(2079, 0, 0);
602}
9ce192d4 603
4370573a
RD
604// Set an indicator to plain, squiggle or TT.
605void wxStyledTextCtrl::IndicatorSetStyle(int indic, int style) {
606 SendMsg(2080, indic, style);
607}
9ce192d4 608
4370573a
RD
609// Retrieve the style of an indicator.
610int wxStyledTextCtrl::IndicatorGetStyle(int indic) {
611 return SendMsg(2081, indic, 0);
612}
9ce192d4 613
4370573a
RD
614// Set the foreground colour of an indicator.
615void wxStyledTextCtrl::IndicatorSetForeground(int indic, const wxColour& fore) {
616 SendMsg(2082, indic, wxColourAsLong(fore));
9ce192d4
RD
617}
618
4370573a
RD
619// Retrieve the foreground colour of an indicator.
620wxColour wxStyledTextCtrl::IndicatorGetForeground(int indic) {
621 long c = SendMsg(2083, indic, 0);
622 return wxColourFromLong(c);
623}
9ce192d4 624
4370573a
RD
625// Divide each styling byte into lexical class bits (default:5) and indicator
626// bits (default:3). If a lexer requires more than 32 lexical states, then this
627// is used to expand the possible states.
628void wxStyledTextCtrl::SetStyleBits(int bits) {
629 SendMsg(2090, bits, 0);
9ce192d4
RD
630}
631
4370573a
RD
632// Retrieve number of bits in style bytes used to hold the lexical state.
633int wxStyledTextCtrl::GetStyleBits() {
634 return SendMsg(2091, 0, 0);
635}
9ce192d4 636
4370573a
RD
637// Used to hold extra styling information for each line.
638void wxStyledTextCtrl::SetLineState(int line, int state) {
639 SendMsg(2092, line, state);
f6bcfd97
BP
640}
641
4370573a
RD
642// Retrieve the extra styling information for a line.
643int wxStyledTextCtrl::GetLineState(int line) {
644 return SendMsg(2093, line, 0);
645}
f6bcfd97 646
4370573a
RD
647// Retrieve the last line number that has line state.
648int wxStyledTextCtrl::GetMaxLineState() {
649 return SendMsg(2094, 0, 0);
f6bcfd97
BP
650}
651
65ec6247
RD
652// Is the background of the line containing the caret in a different colour?
653bool wxStyledTextCtrl::GetCaretLineVisible() {
654 return SendMsg(2095, 0, 0) != 0;
655}
656
1a2fb4cd 657// Dsplay the background of the line containing the caret in a different colour.
65ec6247
RD
658void wxStyledTextCtrl::SetCaretLineVisible(bool show) {
659 SendMsg(2096, show, 0);
660}
661
662// Get the colour of the background of the line containing the caret.
663wxColour wxStyledTextCtrl::GetCaretLineBack() {
664 long c = SendMsg(2097, 0, 0);
665 return wxColourFromLong(c);
666}
667
668// Set the colour of the background of the line containing the caret.
669void wxStyledTextCtrl::SetCaretLineBack(const wxColour& back) {
670 SendMsg(2098, wxColourAsLong(back), 0);
671}
672
1a2fb4cd
RD
673// Set a style to be changeable or not (read only).
674// Experimental feature, currently buggy.
675void wxStyledTextCtrl::StyleSetChangeable(int style, bool changeable) {
676 SendMsg(2099, style, changeable);
677}
678
4370573a
RD
679// Display a auto-completion list.
680// The lenEntered parameter indicates how many characters before
681// the caret should be used to provide context.
682void wxStyledTextCtrl::AutoCompShow(int lenEntered, const wxString& itemList) {
683 SendMsg(2100, lenEntered, (long)itemList.c_str());
684}
f6bcfd97 685
4370573a
RD
686// Remove the auto-completion list from the screen.
687void wxStyledTextCtrl::AutoCompCancel() {
688 SendMsg(2101, 0, 0);
f6bcfd97
BP
689}
690
4370573a
RD
691// Is there an auto-completion list visible?
692bool wxStyledTextCtrl::AutoCompActive() {
693 return SendMsg(2102, 0, 0) != 0;
694}
f6bcfd97 695
4370573a
RD
696// Retrieve the position of the caret when the auto-completion list was
697// displayed.
698int wxStyledTextCtrl::AutoCompPosStart() {
699 return SendMsg(2103, 0, 0);
f6bcfd97
BP
700}
701
4370573a
RD
702// User has selected an item so remove the list and insert the selection.
703void wxStyledTextCtrl::AutoCompComplete() {
704 SendMsg(2104, 0, 0);
705}
f6bcfd97 706
4370573a
RD
707// Define a set of character that when typed cancel the auto-completion list.
708void wxStyledTextCtrl::AutoCompStops(const wxString& characterSet) {
709 SendMsg(2105, 0, (long)characterSet.c_str());
f6bcfd97
BP
710}
711
4370573a
RD
712// Change the separator character in the string setting up an auto-completion
713// list. Default is space but can be changed if items contain space.
714void wxStyledTextCtrl::AutoCompSetSeparator(int separatorCharacter) {
715 SendMsg(2106, separatorCharacter, 0);
716}
f6bcfd97 717
4370573a
RD
718// Retrieve the auto-completion list separator character.
719int wxStyledTextCtrl::AutoCompGetSeparator() {
720 return SendMsg(2107, 0, 0);
9ce192d4
RD
721}
722
4370573a
RD
723// Select the item in the auto-completion list that starts with a string.
724void wxStyledTextCtrl::AutoCompSelect(const wxString& text) {
725 SendMsg(2108, 0, (long)text.c_str());
726}
9ce192d4 727
4370573a
RD
728// Should the auto-completion list be cancelled if the user backspaces to a
729// position before where the box was created.
730void wxStyledTextCtrl::AutoCompSetCancelAtStart(bool cancel) {
731 SendMsg(2110, cancel, 0);
f6bcfd97
BP
732}
733
4370573a
RD
734// Retrieve whether auto-completion cancelled by backspacing before start.
735bool wxStyledTextCtrl::AutoCompGetCancelAtStart() {
736 return SendMsg(2111, 0, 0) != 0;
737}
f6bcfd97 738
1a2fb4cd
RD
739// Define a set of characters that when typed will cause the autocompletion to
740// choose the selected item.
4370573a
RD
741void wxStyledTextCtrl::AutoCompSetFillUps(const wxString& characterSet) {
742 SendMsg(2112, 0, (long)characterSet.c_str());
743}
9ce192d4 744
4370573a
RD
745// Should a single item auto-completion list automatically choose the item.
746void wxStyledTextCtrl::AutoCompSetChooseSingle(bool chooseSingle) {
747 SendMsg(2113, chooseSingle, 0);
748}
9ce192d4 749
4370573a
RD
750// Retrieve whether a single item auto-completion list automatically choose the item.
751bool wxStyledTextCtrl::AutoCompGetChooseSingle() {
752 return SendMsg(2114, 0, 0) != 0;
9ce192d4
RD
753}
754
4370573a
RD
755// Set whether case is significant when performing auto-completion searches.
756void wxStyledTextCtrl::AutoCompSetIgnoreCase(bool ignoreCase) {
757 SendMsg(2115, ignoreCase, 0);
758}
9ce192d4 759
4370573a
RD
760// Retrieve state of ignore case flag.
761bool wxStyledTextCtrl::AutoCompGetIgnoreCase() {
762 return SendMsg(2116, 0, 0) != 0;
9ce192d4
RD
763}
764
65ec6247
RD
765// Display a list of strings and send notification when user chooses one.
766void wxStyledTextCtrl::UserListShow(int listType, const wxString& itemList) {
767 SendMsg(2117, listType, (long)itemList.c_str());
768}
769
770// Set whether or not autocompletion is hidden automatically when nothing matches
771void wxStyledTextCtrl::AutoCompSetAutoHide(bool autoHide) {
772 SendMsg(2118, autoHide, 0);
773}
774
775// Retrieve whether or not autocompletion is hidden automatically when nothing matches
776bool wxStyledTextCtrl::AutoCompGetAutoHide() {
777 return SendMsg(2119, 0, 0) != 0;
778}
779
1a2fb4cd
RD
780// Set whether or not autocompletion deletes any word characters after the inserted text upon completion
781void wxStyledTextCtrl::AutoCompSetDropRestOfWord(bool dropRestOfWord) {
782 SendMsg(2270, dropRestOfWord, 0);
783}
784
785// Retrieve whether or not autocompletion deletes any word characters after the inserted text upon completion
786bool wxStyledTextCtrl::AutoCompGetDropRestOfWord() {
787 return SendMsg(2271, 0, 0) != 0;
788}
789
4370573a
RD
790// Set the number of spaces used for one level of indentation.
791void wxStyledTextCtrl::SetIndent(int indentSize) {
792 SendMsg(2122, indentSize, 0);
793}
9ce192d4 794
4370573a
RD
795// Retrieve indentation size.
796int wxStyledTextCtrl::GetIndent() {
797 return SendMsg(2123, 0, 0);
9ce192d4
RD
798}
799
4370573a
RD
800// Indentation will only use space characters if useTabs is false, otherwise
801// it will use a combination of tabs and spaces.
802void wxStyledTextCtrl::SetUseTabs(bool useTabs) {
803 SendMsg(2124, useTabs, 0);
804}
9ce192d4 805
4370573a
RD
806// Retrieve whether tabs will be used in indentation.
807bool wxStyledTextCtrl::GetUseTabs() {
808 return SendMsg(2125, 0, 0) != 0;
809}
9ce192d4 810
4370573a
RD
811// Change the indentation of a line to a number of columns.
812void wxStyledTextCtrl::SetLineIndentation(int line, int indentSize) {
813 SendMsg(2126, line, indentSize);
814}
9ce192d4 815
4370573a
RD
816// Retrieve the number of columns that a line is indented.
817int wxStyledTextCtrl::GetLineIndentation(int line) {
818 return SendMsg(2127, line, 0);
9ce192d4
RD
819}
820
4370573a
RD
821// Retrieve the position before the first non indentation character on a line.
822int wxStyledTextCtrl::GetLineIndentPosition(int line) {
823 return SendMsg(2128, line, 0);
824}
9ce192d4 825
4370573a
RD
826// Retrieve the column number of a position, taking tab width into account.
827int wxStyledTextCtrl::GetColumn(int pos) {
828 return SendMsg(2129, pos, 0);
9ce192d4
RD
829}
830
4370573a
RD
831// Show or hide the horizontal scroll bar.
832void wxStyledTextCtrl::SetUseHorizontalScrollBar(bool show) {
833 SendMsg(2130, show, 0);
834}
9ce192d4 835
4370573a
RD
836// Is the horizontal scroll bar visible?
837bool wxStyledTextCtrl::GetUseHorizontalScrollBar() {
838 return SendMsg(2131, 0, 0) != 0;
9ce192d4
RD
839}
840
4370573a
RD
841// Show or hide indentation guides.
842void wxStyledTextCtrl::SetIndentationGuides(bool show) {
843 SendMsg(2132, show, 0);
844}
9ce192d4 845
4370573a
RD
846// Are the indentation guides visible?
847bool wxStyledTextCtrl::GetIndentationGuides() {
848 return SendMsg(2133, 0, 0) != 0;
9ce192d4
RD
849}
850
4370573a
RD
851// Set the highlighted indentation guide column.
852// 0 = no highlighted guide.
853void wxStyledTextCtrl::SetHighlightGuide(int column) {
854 SendMsg(2134, column, 0);
855}
9ce192d4 856
4370573a
RD
857// Get the highlighted indentation guide column.
858int wxStyledTextCtrl::GetHighlightGuide() {
859 return SendMsg(2135, 0, 0);
9ce192d4
RD
860}
861
4370573a
RD
862// Get the position after the last visible characters on a line.
863int wxStyledTextCtrl::GetLineEndPosition(int line) {
864 return SendMsg(2136, line, 0);
865}
9ce192d4 866
4370573a
RD
867// Get the code page used to interpret the bytes of the document as characters.
868int wxStyledTextCtrl::GetCodePage() {
869 return SendMsg(2137, 0, 0);
9ce192d4
RD
870}
871
4370573a
RD
872// Get the foreground colour of the caret.
873wxColour wxStyledTextCtrl::GetCaretForeground() {
874 long c = SendMsg(2138, 0, 0);
875 return wxColourFromLong(c);
876}
9ce192d4 877
4370573a
RD
878// In read-only mode?
879bool wxStyledTextCtrl::GetReadOnly() {
880 return SendMsg(2140, 0, 0) != 0;
9ce192d4
RD
881}
882
4370573a
RD
883// Sets the position of the caret.
884void wxStyledTextCtrl::SetCurrentPos(int pos) {
885 SendMsg(2141, pos, 0);
886}
9ce192d4 887
4370573a
RD
888// Sets the position that starts the selection - this becomes the anchor.
889void wxStyledTextCtrl::SetSelectionStart(int pos) {
890 SendMsg(2142, pos, 0);
9ce192d4
RD
891}
892
4370573a
RD
893// Returns the position at the start of the selection.
894int wxStyledTextCtrl::GetSelectionStart() {
895 return SendMsg(2143, 0, 0);
896}
9ce192d4 897
4370573a
RD
898// Sets the position that ends the selection - this becomes the currentPosition.
899void wxStyledTextCtrl::SetSelectionEnd(int pos) {
900 SendMsg(2144, pos, 0);
9ce192d4
RD
901}
902
4370573a
RD
903// Returns the position at the end of the selection.
904int wxStyledTextCtrl::GetSelectionEnd() {
905 return SendMsg(2145, 0, 0);
906}
9ce192d4 907
4370573a
RD
908// Sets the print magnification added to the point size of each style for printing.
909void wxStyledTextCtrl::SetPrintMagnification(int magnification) {
910 SendMsg(2146, magnification, 0);
9ce192d4
RD
911}
912
4370573a
RD
913// Returns the print magnification.
914int wxStyledTextCtrl::GetPrintMagnification() {
915 return SendMsg(2147, 0, 0);
916}
9ce192d4 917
4370573a
RD
918// Modify colours when printing for clearer printed text.
919void wxStyledTextCtrl::SetPrintColourMode(int mode) {
920 SendMsg(2148, mode, 0);
9ce192d4
RD
921}
922
4370573a
RD
923// Returns the print colour mode.
924int wxStyledTextCtrl::GetPrintColourMode() {
925 return SendMsg(2149, 0, 0);
926}
9ce192d4 927
4370573a
RD
928// Find some text in the document.
929int wxStyledTextCtrl::FindText(int minPos, int maxPos,
930 const wxString& text,
931 bool caseSensitive, bool wholeWord) {
932 TextToFind ft;
933 int flags = 0;
934
935 flags |= caseSensitive ? SCFIND_MATCHCASE : 0;
936 flags |= wholeWord ? SCFIND_WHOLEWORD : 0;
937 ft.chrg.cpMin = minPos;
938 ft.chrg.cpMax = maxPos;
939 ft.lpstrText = (char*)text.c_str();
940
941 return SendMsg(2150, flags, (long)&ft);
942}
943
944// On Windows will draw the document into a display context such as a printer.
945 int wxStyledTextCtrl::FormatRange(bool doDraw,
946 int startPos,
947 int endPos,
948 wxDC* draw,
949 wxDC* target, // Why does it use two? Can they be the same?
950 wxRect renderRect,
951 wxRect pageRect) {
952 RangeToFormat fr;
953
e1a93f46
RD
954 if (endPos < startPos) {
955 int temp = startPos;
956 startPos = endPos;
957 endPos = temp;
958 }
4370573a
RD
959 fr.hdc = draw;
960 fr.hdcTarget = target;
961 fr.rc.top = renderRect.GetTop();
962 fr.rc.left = renderRect.GetLeft();
963 fr.rc.right = renderRect.GetRight();
964 fr.rc.bottom = renderRect.GetBottom();
965 fr.rcPage.top = pageRect.GetTop();
966 fr.rcPage.left = pageRect.GetLeft();
967 fr.rcPage.right = pageRect.GetRight();
968 fr.rcPage.bottom = pageRect.GetBottom();
969 fr.chrg.cpMin = startPos;
970 fr.chrg.cpMax = endPos;
971
972 return SendMsg(2151, doDraw, (long)&fr);
973}
974
975// Retrieve the line at the top of the display.
976int wxStyledTextCtrl::GetFirstVisibleLine() {
977 return SendMsg(2152, 0, 0);
9ce192d4
RD
978}
979
4370573a
RD
980// Retrieve the contents of a line.
981wxString wxStyledTextCtrl::GetLine(int line) {
982 wxString text;
983 int len = LineLength(line);
abb69c6c 984 if (!len) return "";
afc2b641 985 char* buf = text.GetWriteBuf(len);
9ce192d4 986
4370573a 987 int pos = SendMsg(2153, line, (long)buf);
abb69c6c 988 text.UngetWriteBuf(len);
9ce192d4 989
4370573a
RD
990 return text;
991}
992
993// Returns the number of lines in the document. There is always at least one.
994int wxStyledTextCtrl::GetLineCount() {
995 return SendMsg(2154, 0, 0);
996}
9ce192d4 997
4370573a 998// Sets the size in pixels of the left margin.
65ec6247
RD
999void wxStyledTextCtrl::SetMarginLeft(int pixelWidth) {
1000 SendMsg(2155, 0, pixelWidth);
4370573a 1001}
9ce192d4 1002
4370573a
RD
1003// Returns the size in pixels of the left margin.
1004int wxStyledTextCtrl::GetMarginLeft() {
1005 return SendMsg(2156, 0, 0);
9ce192d4
RD
1006}
1007
4370573a 1008// Sets the size in pixels of the right margin.
65ec6247
RD
1009void wxStyledTextCtrl::SetMarginRight(int pixelWidth) {
1010 SendMsg(2157, 0, pixelWidth);
4370573a 1011}
9ce192d4 1012
4370573a
RD
1013// Returns the size in pixels of the right margin.
1014int wxStyledTextCtrl::GetMarginRight() {
1015 return SendMsg(2158, 0, 0);
9ce192d4
RD
1016}
1017
4370573a
RD
1018// Is the document different from when it was last saved?
1019bool wxStyledTextCtrl::GetModify() {
1020 return SendMsg(2159, 0, 0) != 0;
1021}
9ce192d4 1022
4370573a
RD
1023// Select a range of text.
1024void wxStyledTextCtrl::SetSelection(int start, int end) {
1025 SendMsg(2160, start, end);
9ce192d4
RD
1026}
1027
4370573a
RD
1028// Retrieve the selected text.
1029wxString wxStyledTextCtrl::GetSelectedText() {
1030 wxString text;
1031 int start;
1032 int end;
9ce192d4 1033
4370573a
RD
1034 GetSelection(&start, &end);
1035 int len = end - start;
abb69c6c
RD
1036 if (!len) return "";
1037 char* buff = text.GetWriteBuf(len);
9ce192d4 1038
4370573a 1039 SendMsg(2161, 0, (long)buff);
abb69c6c 1040 text.UngetWriteBuf(len);
4370573a
RD
1041 return text;
1042}
9ce192d4 1043
4370573a
RD
1044// Retrieve a range of text.
1045wxString wxStyledTextCtrl::GetTextRange(int startPos, int endPos) {
1046 wxString text;
e1a93f46
RD
1047 if (endPos < startPos) {
1048 int temp = startPos;
1049 startPos = endPos;
1050 endPos = temp;
1051 }
4370573a 1052 int len = endPos - startPos;
abb69c6c
RD
1053 if (!len) return "";
1054 char* buff = text.GetWriteBuf(len);
4370573a
RD
1055 TextRange tr;
1056 tr.lpstrText = buff;
1057 tr.chrg.cpMin = startPos;
1058 tr.chrg.cpMax = endPos;
9ce192d4 1059
4370573a 1060 SendMsg(2162, 0, (long)&tr);
abb69c6c 1061 text.UngetWriteBuf(len);
4370573a 1062 return text;
9ce192d4
RD
1063}
1064
4370573a
RD
1065// Draw the selection in normal style or with selection highlighted.
1066void wxStyledTextCtrl::HideSelection(bool normal) {
1067 SendMsg(2163, normal, 0);
1068}
9ce192d4 1069
4370573a
RD
1070// Retrieve the line containing a position.
1071int wxStyledTextCtrl::LineFromPosition(int pos) {
1072 return SendMsg(2166, pos, 0);
9ce192d4
RD
1073}
1074
4370573a
RD
1075// Retrieve the position at the start of a line.
1076int wxStyledTextCtrl::PositionFromLine(int line) {
1077 return SendMsg(2167, line, 0);
1078}
9ce192d4 1079
4370573a
RD
1080// Scroll horizontally and vertically.
1081void wxStyledTextCtrl::LineScroll(int columns, int lines) {
1082 SendMsg(2168, columns, lines);
9ce192d4
RD
1083}
1084
4370573a
RD
1085// Ensure the caret is visible.
1086void wxStyledTextCtrl::EnsureCaretVisible() {
1087 SendMsg(2169, 0, 0);
1088}
9ce192d4 1089
4370573a
RD
1090// Replace the selected text with the argument text.
1091void wxStyledTextCtrl::ReplaceSelection(const wxString& text) {
1092 SendMsg(2170, 0, (long)text.c_str());
9ce192d4
RD
1093}
1094
4370573a
RD
1095// Set to read only or read write.
1096void wxStyledTextCtrl::SetReadOnly(bool readOnly) {
1097 SendMsg(2171, readOnly, 0);
1098}
9ce192d4 1099
4370573a
RD
1100// Will a paste succeed?
1101bool wxStyledTextCtrl::CanPaste() {
1102 return SendMsg(2173, 0, 0) != 0;
9ce192d4
RD
1103}
1104
4370573a
RD
1105// Are there any undoable actions in the undo history.
1106bool wxStyledTextCtrl::CanUndo() {
1107 return SendMsg(2174, 0, 0) != 0;
1108}
9ce192d4 1109
4370573a
RD
1110// Delete the undo history.
1111void wxStyledTextCtrl::EmptyUndoBuffer() {
1112 SendMsg(2175, 0, 0);
9ce192d4
RD
1113}
1114
4370573a
RD
1115// Undo one action in the undo history.
1116void wxStyledTextCtrl::Undo() {
1117 SendMsg(2176, 0, 0);
1118}
9ce192d4 1119
4370573a
RD
1120// Cut the selection to the clipboard.
1121void wxStyledTextCtrl::Cut() {
1122 SendMsg(2177, 0, 0);
f6bcfd97
BP
1123}
1124
4370573a
RD
1125// Copy the selection to the clipboard.
1126void wxStyledTextCtrl::Copy() {
1127 SendMsg(2178, 0, 0);
1128}
f6bcfd97 1129
4370573a
RD
1130// Paste the contents of the clipboard into the document replacing the selection.
1131void wxStyledTextCtrl::Paste() {
1132 SendMsg(2179, 0, 0);
f6bcfd97
BP
1133}
1134
4370573a
RD
1135// Clear the selection.
1136void wxStyledTextCtrl::Clear() {
1137 SendMsg(2180, 0, 0);
1138}
f6bcfd97 1139
4370573a
RD
1140// Replace the contents of the document with the argument text.
1141void wxStyledTextCtrl::SetText(const wxString& text) {
1142 SendMsg(2181, 0, (long)text.c_str());
f6bcfd97
BP
1143}
1144
4370573a
RD
1145// Retrieve all the text in the document.
1146wxString wxStyledTextCtrl::GetText() {
1147 wxString text;
8de28db9
RD
1148 int len = GetTextLength();
1149 char* buff = text.GetWriteBuf(len+1); // leave room for the null...
f6bcfd97 1150
8de28db9
RD
1151 SendMsg(2182, len+1, (long)buff);
1152 text.UngetWriteBuf(len);
4370573a
RD
1153 return text;
1154}
9ce192d4 1155
4370573a
RD
1156// Retrieve the number of characters in the document.
1157int wxStyledTextCtrl::GetTextLength() {
1158 return SendMsg(2183, 0, 0);
9ce192d4
RD
1159}
1160
4370573a
RD
1161// Set to overtype (true) or insert mode
1162void wxStyledTextCtrl::SetOvertype(bool overtype) {
1163 SendMsg(2186, overtype, 0);
1164}
9ce192d4 1165
4370573a
RD
1166// Returns true if overtype mode is active otherwise false is returned.
1167bool wxStyledTextCtrl::GetOvertype() {
1168 return SendMsg(2187, 0, 0) != 0;
9ce192d4
RD
1169}
1170
65ec6247
RD
1171// Set the width of the insert mode caret
1172void wxStyledTextCtrl::SetCaretWidth(int pixelWidth) {
1173 SendMsg(2188, pixelWidth, 0);
1174}
1175
1176// Returns the width of the insert mode caret
1177int wxStyledTextCtrl::GetCaretWidth() {
1178 return SendMsg(2189, 0, 0);
1179}
1180
1181// Sets the position that starts the target which is used for updating the
1182// document without affecting the scroll position.
1183void wxStyledTextCtrl::SetTargetStart(int pos) {
1184 SendMsg(2190, pos, 0);
1185}
1186
1187// Get the position that starts the target.
1188int wxStyledTextCtrl::GetTargetStart() {
1189 return SendMsg(2191, 0, 0);
1190}
1191
1192// Sets the position that ends the target which is used for updating the
1193// document without affecting the scroll position.
1194void wxStyledTextCtrl::SetTargetEnd(int pos) {
1195 SendMsg(2192, pos, 0);
1196}
1197
1198// Get the position that ends the target.
1199int wxStyledTextCtrl::GetTargetEnd() {
1200 return SendMsg(2193, 0, 0);
1201}
1202
1203// Replace the target text with the argument text.
b8b0e402 1204// Text is counted so it can contain nulls.
65ec6247
RD
1205// Returns the length of the replacement text.
1206
1207 int wxStyledTextCtrl::ReplaceTarget(const wxString& text) {
1208 return SendMsg(2194, text.Len(), (long)text.c_str());
1209
1210}
1211
1212// Replace the target text with the argument text after \d processing.
b8b0e402 1213// Text is counted so it can contain nulls.
65ec6247
RD
1214// Looks for \d where d is between 1 and 9 and replaces these with the strings
1215// matched in the last search operation which were surrounded by \( and \).
1216// Returns the length of the replacement text including any change
1217// caused by processing the \d patterns.
1218
1219 int wxStyledTextCtrl::ReplaceTargetRE(const wxString& text) {
1220 return SendMsg(2195, text.Len(), (long)text.c_str());
1221
1222}
1223
1224// Search for a counted string in the target and set the target to the found
b8b0e402 1225// range. Text is counted so it can contain nulls.
65ec6247
RD
1226// Returns length of range or -1 for failure in which case target is not moved.
1227
1228 int wxStyledTextCtrl::SearchInTarget(const wxString& text) {
1229 return SendMsg(2197, text.Len(), (long)text.c_str());
1230
1231}
1232
1233// Set the search flags used by SearchInTarget
1234void wxStyledTextCtrl::SetSearchFlags(int flags) {
1235 SendMsg(2198, flags, 0);
1236}
1237
1238// Get the search flags used by SearchInTarget
1239int wxStyledTextCtrl::GetSearchFlags() {
1240 return SendMsg(2199, 0, 0);
1241}
1242
4370573a
RD
1243// Show a call tip containing a definition near position pos.
1244void wxStyledTextCtrl::CallTipShow(int pos, const wxString& definition) {
1245 SendMsg(2200, pos, (long)definition.c_str());
1246}
9ce192d4 1247
4370573a
RD
1248// Remove the call tip from the screen.
1249void wxStyledTextCtrl::CallTipCancel() {
1250 SendMsg(2201, 0, 0);
9ce192d4
RD
1251}
1252
4370573a
RD
1253// Is there an active call tip?
1254bool wxStyledTextCtrl::CallTipActive() {
1255 return SendMsg(2202, 0, 0) != 0;
1256}
9ce192d4 1257
4370573a 1258// Retrieve the position where the caret was before displaying the call tip.
9ce192d4 1259int wxStyledTextCtrl::CallTipPosAtStart() {
4370573a 1260 return SendMsg(2203, 0, 0);
9ce192d4
RD
1261}
1262
4370573a 1263// Highlight a segment of the definition.
9ce192d4 1264void wxStyledTextCtrl::CallTipSetHighlight(int start, int end) {
4370573a 1265 SendMsg(2204, start, end);
9ce192d4
RD
1266}
1267
4370573a
RD
1268// Set the background colour for the call tip.
1269void wxStyledTextCtrl::CallTipSetBackground(const wxColour& back) {
1270 SendMsg(2205, wxColourAsLong(back), 0);
1271}
9ce192d4 1272
4370573a
RD
1273// Find the display line of a document line taking hidden lines into account.
1274int wxStyledTextCtrl::VisibleFromDocLine(int line) {
1275 return SendMsg(2220, line, 0);
9ce192d4
RD
1276}
1277
4370573a
RD
1278// Find the document line of a display line taking hidden lines into account.
1279int wxStyledTextCtrl::DocLineFromVisible(int lineDisplay) {
1280 return SendMsg(2221, lineDisplay, 0);
1281}
9ce192d4 1282
4370573a
RD
1283// Set the fold level of a line.
1284// This encodes an integer level along with flags indicating whether the
1285// line is a header and whether it is effectively white space.
1286void wxStyledTextCtrl::SetFoldLevel(int line, int level) {
1287 SendMsg(2222, line, level);
1288}
9ce192d4 1289
4370573a
RD
1290// Retrieve the fold level of a line.
1291int wxStyledTextCtrl::GetFoldLevel(int line) {
1292 return SendMsg(2223, line, 0);
1293}
d134f170 1294
4370573a
RD
1295// Find the last child line of a header line.
1296int wxStyledTextCtrl::GetLastChild(int line, int level) {
1297 return SendMsg(2224, line, level);
9ce192d4
RD
1298}
1299
4370573a
RD
1300// Find the parent line of a child line.
1301int wxStyledTextCtrl::GetFoldParent(int line) {
1302 return SendMsg(2225, line, 0);
1303}
9ce192d4 1304
4370573a
RD
1305// Make a range of lines visible.
1306void wxStyledTextCtrl::ShowLines(int lineStart, int lineEnd) {
1307 SendMsg(2226, lineStart, lineEnd);
9ce192d4
RD
1308}
1309
4370573a
RD
1310// Make a range of lines invisible.
1311void wxStyledTextCtrl::HideLines(int lineStart, int lineEnd) {
1312 SendMsg(2227, lineStart, lineEnd);
1313}
9ce192d4 1314
4370573a
RD
1315// Is a line visible?
1316bool wxStyledTextCtrl::GetLineVisible(int line) {
1317 return SendMsg(2228, line, 0) != 0;
9ce192d4
RD
1318}
1319
4370573a
RD
1320// Show the children of a header line.
1321void wxStyledTextCtrl::SetFoldExpanded(int line, bool expanded) {
1322 SendMsg(2229, line, expanded);
1323}
9ce192d4 1324
4370573a
RD
1325// Is a header line expanded?
1326bool wxStyledTextCtrl::GetFoldExpanded(int line) {
1327 return SendMsg(2230, line, 0) != 0;
9ce192d4
RD
1328}
1329
4370573a
RD
1330// Switch a header line between expanded and contracted.
1331void wxStyledTextCtrl::ToggleFold(int line) {
1332 SendMsg(2231, line, 0);
1333}
9ce192d4 1334
4370573a
RD
1335// Ensure a particular line is visible by expanding any header line hiding it.
1336void wxStyledTextCtrl::EnsureVisible(int line) {
1337 SendMsg(2232, line, 0);
1338}
9ce192d4 1339
4370573a
RD
1340// Set some debugging options for folding
1341void wxStyledTextCtrl::SetFoldFlags(int flags) {
1342 SendMsg(2233, flags, 0);
9ce192d4
RD
1343}
1344
65ec6247
RD
1345// Ensure a particular line is visible by expanding any header line hiding it.
1346// Use the currently set visibility policy to determine which range to display.
1347void wxStyledTextCtrl::EnsureVisibleEnforcePolicy(int line) {
1348 SendMsg(2234, line, 0);
1349}
1350
1351// Sets whether a tab pressed when caret is within indentation indents
1352void wxStyledTextCtrl::SetTabIndents(bool tabIndents) {
1353 SendMsg(2260, tabIndents, 0);
1354}
1355
1356// Does a tab pressed when caret is within indentation indent?
1357bool wxStyledTextCtrl::GetTabIndents() {
1358 return SendMsg(2261, 0, 0) != 0;
1359}
1360
1361// Sets whether a backspace pressed when caret is within indentation unindents
1362void wxStyledTextCtrl::SetBackSpaceUnIndents(bool bsUnIndents) {
1363 SendMsg(2262, bsUnIndents, 0);
1364}
1365
1366// Does a backspace pressed when caret is within indentation unindent?
1367bool wxStyledTextCtrl::GetBackSpaceUnIndents() {
1368 return SendMsg(2263, 0, 0) != 0;
1369}
1370
1371// Sets the time the mouse must sit still to generate a mouse dwell event
1372void wxStyledTextCtrl::SetMouseDwellTime(int periodMilliseconds) {
1373 SendMsg(2264, periodMilliseconds, 0);
1374}
1375
1376// Retrieve the time the mouse must sit still to generate a mouse dwell event
1377int wxStyledTextCtrl::GetMouseDwellTime() {
1378 return SendMsg(2265, 0, 0);
1379}
1380
1a2fb4cd
RD
1381// Get position of start of word
1382int wxStyledTextCtrl::WordStartPosition(int pos, bool onlyWordCharacters) {
1383 return SendMsg(2266, pos, onlyWordCharacters);
1384}
1385
1386// Get position of end of word
1387int wxStyledTextCtrl::WordEndPosition(int pos, bool onlyWordCharacters) {
1388 return SendMsg(2267, pos, onlyWordCharacters);
1389}
1390
1391// Sets whether text is word wrapped
1392void wxStyledTextCtrl::SetWrapMode(int mode) {
1393 SendMsg(2268, mode, 0);
1394}
1395
1396// Retrieve whether text is word wrapped
1397int wxStyledTextCtrl::GetWrapMode() {
1398 return SendMsg(2269, 0, 0);
1399}
1400
1401// Sets the degree of caching of layout information
1402void wxStyledTextCtrl::SetLayoutCache(int mode) {
1403 SendMsg(2272, mode, 0);
1404}
1405
1406// Retrieve the degree of caching of layout information
1407int wxStyledTextCtrl::GetLayoutCache() {
1408 return SendMsg(2273, 0, 0);
1409}
1410
1411// Delete the selection or if no selection, the character before the caret.
1412// Will not delete the chraacter before at the start of a line.
1413void wxStyledTextCtrl::DeleteBackNotLine() {
1414 SendMsg(2344, 0, 0);
1415}
1416
65ec6247
RD
1417// Move the caret inside current view if it's not there already
1418void wxStyledTextCtrl::MoveCaretInsideView() {
1419 SendMsg(2401, 0, 0);
1420}
1421
4370573a
RD
1422// How many characters are on a line, not including end of line characters.
1423int wxStyledTextCtrl::LineLength(int line) {
1424 return SendMsg(2350, line, 0);
1425}
9ce192d4 1426
4370573a
RD
1427// Highlight the characters at two positions.
1428void wxStyledTextCtrl::BraceHighlight(int pos1, int pos2) {
1429 SendMsg(2351, pos1, pos2);
1430}
9ce192d4 1431
4370573a
RD
1432// Highlight the character at a position indicating there is no matching brace.
1433void wxStyledTextCtrl::BraceBadLight(int pos) {
1434 SendMsg(2352, pos, 0);
9ce192d4
RD
1435}
1436
4370573a
RD
1437// Find the position of a matching brace or INVALID_POSITION if no match.
1438int wxStyledTextCtrl::BraceMatch(int pos) {
1439 return SendMsg(2353, pos, 0);
1440}
9ce192d4 1441
4370573a
RD
1442// Are the end of line characters visible.
1443bool wxStyledTextCtrl::GetViewEOL() {
1444 return SendMsg(2355, 0, 0) != 0;
9ce192d4
RD
1445}
1446
4370573a
RD
1447// Make the end of line characters visible or invisible
1448void wxStyledTextCtrl::SetViewEOL(bool visible) {
1449 SendMsg(2356, visible, 0);
1450}
9ce192d4 1451
4370573a
RD
1452// Retrieve a pointer to the document object.
1453void* wxStyledTextCtrl::GetDocPointer() {
1454 return (void*)SendMsg(2357);
1455}
67003d1a 1456
4370573a
RD
1457// Change the document object used.
1458void wxStyledTextCtrl::SetDocPointer(void* docPointer) {
65ec6247 1459 SendMsg(2358, 0, (long)docPointer);
67003d1a
RD
1460}
1461
4370573a
RD
1462// Set which document modification events are sent to the container.
1463void wxStyledTextCtrl::SetModEventMask(int mask) {
1464 SendMsg(2359, mask, 0);
1465}
67003d1a 1466
4370573a
RD
1467// Retrieve the column number which text should be kept within.
1468int wxStyledTextCtrl::GetEdgeColumn() {
1469 return SendMsg(2360, 0, 0);
67003d1a
RD
1470}
1471
4370573a
RD
1472// Set the column number of the edge.
1473// If text goes past the edge then it is highlighted.
1474void wxStyledTextCtrl::SetEdgeColumn(int column) {
1475 SendMsg(2361, column, 0);
1476}
67003d1a 1477
4370573a
RD
1478// Retrieve the edge highlight mode.
1479int wxStyledTextCtrl::GetEdgeMode() {
1480 return SendMsg(2362, 0, 0);
67003d1a
RD
1481}
1482
4370573a
RD
1483// The edge may be displayed by a line (EDGE_LINE) or by highlighting text that
1484// goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).
1485void wxStyledTextCtrl::SetEdgeMode(int mode) {
1486 SendMsg(2363, mode, 0);
1487}
67003d1a 1488
4370573a
RD
1489// Retrieve the colour used in edge indication.
1490wxColour wxStyledTextCtrl::GetEdgeColour() {
1491 long c = SendMsg(2364, 0, 0);
1492 return wxColourFromLong(c);
67003d1a
RD
1493}
1494
4370573a
RD
1495// Change the colour used in edge indication.
1496void wxStyledTextCtrl::SetEdgeColour(const wxColour& edgeColour) {
1497 SendMsg(2365, wxColourAsLong(edgeColour), 0);
1498}
67003d1a 1499
4370573a
RD
1500// Sets the current caret position to be the search anchor.
1501void wxStyledTextCtrl::SearchAnchor() {
1502 SendMsg(2366, 0, 0);
67003d1a
RD
1503}
1504
4370573a 1505// Find some text starting at the search anchor.
65ec6247 1506// Does not ensure the selection is visible.
4370573a
RD
1507int wxStyledTextCtrl::SearchNext(int flags, const wxString& text) {
1508 return SendMsg(2367, flags, (long)text.c_str());
1509}
67003d1a 1510
4370573a 1511// Find some text starting at the search anchor and moving backwards.
65ec6247 1512// Does not ensure the selection is visible.
4370573a
RD
1513int wxStyledTextCtrl::SearchPrev(int flags, const wxString& text) {
1514 return SendMsg(2368, flags, (long)text.c_str());
67003d1a
RD
1515}
1516
4370573a
RD
1517// Set the way the line the caret is on is kept visible.
1518void wxStyledTextCtrl::SetCaretPolicy(int caretPolicy, int caretSlop) {
1519 SendMsg(2369, caretPolicy, caretSlop);
1520}
67003d1a 1521
4370573a
RD
1522// Retrieves the number of lines completely visible.
1523int wxStyledTextCtrl::LinesOnScreen() {
1524 return SendMsg(2370, 0, 0);
67003d1a
RD
1525}
1526
4370573a
RD
1527// Set whether a pop up menu is displayed automatically when the user presses
1528// the wrong mouse button.
1529void wxStyledTextCtrl::UsePopUp(bool allowPopUp) {
1530 SendMsg(2371, allowPopUp, 0);
1531}
67003d1a 1532
4370573a
RD
1533// Is the selection a rectangular. The alternative is the more common stream selection.
1534bool wxStyledTextCtrl::SelectionIsRectangle() {
1535 return SendMsg(2372, 0, 0) != 0;
67003d1a
RD
1536}
1537
4370573a
RD
1538// Set the zoom level. This number of points is added to the size of all fonts.
1539// It may be positive to magnify or negative to reduce.
1540void wxStyledTextCtrl::SetZoom(int zoom) {
1541 SendMsg(2373, zoom, 0);
1542}
67003d1a 1543
4370573a
RD
1544// Retrieve the zoom level.
1545int wxStyledTextCtrl::GetZoom() {
1546 return SendMsg(2374, 0, 0);
67003d1a
RD
1547}
1548
4370573a
RD
1549// Create a new document object.
1550// Starts with reference count of 1 and not selected into editor.
1551void* wxStyledTextCtrl::CreateDocument() {
1552 return (void*)SendMsg(2375);
1553}
67003d1a 1554
4370573a
RD
1555// Extend life of document.
1556void wxStyledTextCtrl::AddRefDocument(void* docPointer) {
1557 SendMsg(2376, (long)docPointer);
67003d1a
RD
1558}
1559
4370573a
RD
1560// Release a reference to the document, deleting document if it fades to black.
1561void wxStyledTextCtrl::ReleaseDocument(void* docPointer) {
1562 SendMsg(2377, (long)docPointer);
1563}
67003d1a 1564
4370573a
RD
1565// Get which document modification events are sent to the container.
1566int wxStyledTextCtrl::GetModEventMask() {
1567 return SendMsg(2378, 0, 0);
67003d1a
RD
1568}
1569
65ec6247 1570// Change internal focus flag
8de28db9 1571void wxStyledTextCtrl::SetSTCFocus(bool focus) {
65ec6247
RD
1572 SendMsg(2380, focus, 0);
1573}
1574
1575// Get internal focus flag
8de28db9 1576bool wxStyledTextCtrl::GetSTCFocus() {
65ec6247
RD
1577 return SendMsg(2381, 0, 0) != 0;
1578}
1579
1580// Change error status - 0 = OK
1581void wxStyledTextCtrl::SetStatus(int statusCode) {
1582 SendMsg(2382, statusCode, 0);
1583}
1584
1585// Get error status
1586int wxStyledTextCtrl::GetStatus() {
1587 return SendMsg(2383, 0, 0);
1588}
1589
1590// Set whether the mouse is captured when its button is pressed
1591void wxStyledTextCtrl::SetMouseDownCaptures(bool captures) {
1592 SendMsg(2384, captures, 0);
1593}
1594
1595// Get whether mouse gets captured
1596bool wxStyledTextCtrl::GetMouseDownCaptures() {
1597 return SendMsg(2385, 0, 0) != 0;
1598}
1599
1600// Sets the cursor to one of the SC_CURSOR* values
1601void wxStyledTextCtrl::SetCursor(int cursorType) {
1602 SendMsg(2386, cursorType, 0);
1603}
1604
1605// Get cursor type
1606int wxStyledTextCtrl::GetCursor() {
1607 return SendMsg(2387, 0, 0);
1608}
1609
1a2fb4cd
RD
1610// Change the way control characters are displayed:
1611// If symbol is < 32, keep the drawn way, else, use the given character
1612void wxStyledTextCtrl::SetControlCharSymbol(int symbol) {
1613 SendMsg(2388, symbol, 0);
1614}
1615
1616// Get the way control characters are displayed
1617int wxStyledTextCtrl::GetControlCharSymbol() {
1618 return SendMsg(2389, 0, 0);
1619}
1620
65ec6247
RD
1621// Move to the previous change in capitalistion
1622void wxStyledTextCtrl::WordPartLeft() {
1623 SendMsg(2390, 0, 0);
1624}
1625
1626// Move to the previous change in capitalistion extending selection to new caret position.
1627void wxStyledTextCtrl::WordPartLeftExtend() {
1628 SendMsg(2391, 0, 0);
1629}
1630
1631// Move to the change next in capitalistion
1632void wxStyledTextCtrl::WordPartRight() {
1633 SendMsg(2392, 0, 0);
1634}
1635
1636// Move to the next change in capitalistion extending selection to new caret position.
1637void wxStyledTextCtrl::WordPartRightExtend() {
1638 SendMsg(2393, 0, 0);
1639}
1640
1641// Set the way the display area is determined when a particular line is to be moved to.
1642void wxStyledTextCtrl::SetVisiblePolicy(int visiblePolicy, int visibleSlop) {
1643 SendMsg(2394, visiblePolicy, visibleSlop);
1644}
1645
1646// Delete back from the current position to the start of the line
1647void wxStyledTextCtrl::DelLineLeft() {
1648 SendMsg(2395, 0, 0);
1649}
1650
1651// Delete forwards from the current position to the end of the line
1652void wxStyledTextCtrl::DelLineRight() {
1653 SendMsg(2396, 0, 0);
1654}
1655
1a2fb4cd
RD
1656// Get and Set the xOffset (ie, horizonal scroll position)
1657void wxStyledTextCtrl::SetXOffset(int newOffset) {
1658 SendMsg(2397, newOffset, 0);
1659}
1660int wxStyledTextCtrl::GetXOffset() {
1661 return SendMsg(2398, 0, 0);
1662}
1663
4370573a
RD
1664// Start notifying the container of all key presses and commands.
1665void wxStyledTextCtrl::StartRecord() {
1666 SendMsg(3001, 0, 0);
1667}
67003d1a 1668
4370573a
RD
1669// Stop notifying the container of all key presses and commands.
1670void wxStyledTextCtrl::StopRecord() {
1671 SendMsg(3002, 0, 0);
67003d1a
RD
1672}
1673
4370573a
RD
1674// Set the lexing language of the document.
1675void wxStyledTextCtrl::SetLexer(int lexer) {
1676 SendMsg(4001, lexer, 0);
1677}
67003d1a 1678
4370573a
RD
1679// Retrieve the lexing language of the document.
1680int wxStyledTextCtrl::GetLexer() {
1681 return SendMsg(4002, 0, 0);
67003d1a
RD
1682}
1683
4370573a
RD
1684// Colourise a segment of the document using the current lexing language.
1685void wxStyledTextCtrl::Colourise(int start, int end) {
1686 SendMsg(4003, start, end);
1687}
67003d1a 1688
4370573a
RD
1689// Set up a value that may be used by a lexer for some optional feature.
1690void wxStyledTextCtrl::SetProperty(const wxString& key, const wxString& value) {
1691 SendMsg(4004, (long)key.c_str(), (long)value.c_str());
f6bcfd97
BP
1692}
1693
4370573a
RD
1694// Set up the key words used by the lexer.
1695void wxStyledTextCtrl::SetKeyWords(int keywordSet, const wxString& keyWords) {
1696 SendMsg(4005, keywordSet, (long)keyWords.c_str());
1697}
f6bcfd97 1698
65ec6247
RD
1699// Set the lexing language of the document based on string name.
1700void wxStyledTextCtrl::SetLexerLanguage(const wxString& language) {
1701 SendMsg(4006, 0, (long)language.c_str());
1702}
1703
4370573a 1704// END of generated section
f6bcfd97 1705//----------------------------------------------------------------------
f6bcfd97
BP
1706
1707
4370573a
RD
1708// Returns the line number of the line with the caret.
1709int wxStyledTextCtrl::GetCurrentLine() {
1710 int line = LineFromPosition(GetCurrentPos());
1711 return line;
f6bcfd97
BP
1712}
1713
1714
4370573a
RD
1715// Extract style settings from a spec-string which is composed of one or
1716// more of the following comma separated elements:
1717//
1718// bold turns on bold
1719// italic turns on italics
1720// fore:#RRGGBB sets the foreground colour
1721// back:#RRGGBB sets the background colour
1722// face:[facename] sets the font face name to use
1723// size:[num] sets the font size in points
1724// eol turns on eol filling
1725// underline turns on underlining
1726//
1727void wxStyledTextCtrl::StyleSetSpec(int styleNum, const wxString& spec) {
1728
1729 wxStringTokenizer tkz(spec, ",");
1730 while (tkz.HasMoreTokens()) {
1731 wxString token = tkz.GetNextToken();
f6bcfd97 1732
4370573a
RD
1733 wxString option = token.BeforeFirst(':');
1734 wxString val = token.AfterFirst(':');
f6bcfd97 1735
4370573a
RD
1736 if (option == "bold")
1737 StyleSetBold(styleNum, true);
f6bcfd97 1738
4370573a
RD
1739 else if (option == "italic")
1740 StyleSetItalic(styleNum, true);
9ce192d4 1741
4370573a
RD
1742 else if (option == "underline")
1743 StyleSetUnderline(styleNum, true);
9ce192d4 1744
4370573a
RD
1745 else if (option == "eol")
1746 StyleSetEOLFilled(styleNum, true);
9ce192d4 1747
4370573a
RD
1748 else if (option == "size") {
1749 long points;
1750 if (val.ToLong(&points))
1751 StyleSetSize(styleNum, points);
1752 }
9ce192d4 1753
4370573a
RD
1754 else if (option == "face")
1755 StyleSetFaceName(styleNum, val);
9ce192d4 1756
4370573a
RD
1757 else if (option == "fore")
1758 StyleSetForeground(styleNum, wxColourFromSpec(val));
9ce192d4 1759
4370573a
RD
1760 else if (option == "back")
1761 StyleSetBackground(styleNum, wxColourFromSpec(val));
1762 }
9ce192d4
RD
1763}
1764
1765
4370573a
RD
1766// Set style size, face, bold, italic, and underline attributes from
1767// a wxFont's attributes.
1768void wxStyledTextCtrl::StyleSetFont(int styleNum, wxFont& font) {
1769 int size = font.GetPointSize();
1770 wxString faceName = font.GetFaceName();
1771 bool bold = font.GetWeight() == wxBOLD;
1772 bool italic = font.GetStyle() != wxNORMAL;
1773 bool under = font.GetUnderlined();
9ce192d4 1774
4370573a
RD
1775 // TODO: add encoding/charset mapping
1776 StyleSetFontAttr(styleNum, size, faceName, bold, italic, under);
9ce192d4
RD
1777}
1778
4370573a
RD
1779// Set all font style attributes at once.
1780void wxStyledTextCtrl::StyleSetFontAttr(int styleNum, int size,
1781 const wxString& faceName,
1782 bool bold, bool italic,
1783 bool underline) {
1784 StyleSetSize(styleNum, size);
1785 StyleSetFaceName(styleNum, faceName);
1786 StyleSetBold(styleNum, bold);
1787 StyleSetItalic(styleNum, italic);
1788 StyleSetUnderline(styleNum, underline);
9ce192d4 1789
4370573a 1790 // TODO: add encoding/charset mapping
9ce192d4
RD
1791}
1792
1793
4370573a
RD
1794// Perform one of the operations defined by the wxSTC_CMD_* constants.
1795void wxStyledTextCtrl::CmdKeyExecute(int cmd) {
1796 SendMsg(cmd);
9ce192d4
RD
1797}
1798
1799
4370573a
RD
1800// Set the left and right margin in the edit area, measured in pixels.
1801void wxStyledTextCtrl::SetMargins(int left, int right) {
1802 SetMarginLeft(left);
1803 SetMarginRight(right);
9ce192d4
RD
1804}
1805
1806
4370573a
RD
1807// Retrieve the start and end positions of the current selection.
1808void wxStyledTextCtrl::GetSelection(int* startPos, int* endPos) {
1809 if (startPos != NULL)
1810 *startPos = SendMsg(SCI_GETSELECTIONSTART);
1811 if (endPos != NULL)
1812 *endPos = SendMsg(SCI_GETSELECTIONEND);
9ce192d4
RD
1813}
1814
1815
4370573a
RD
1816// Retrieve the point in the window where a position is displayed.
1817wxPoint wxStyledTextCtrl::PointFromPosition(int pos) {
1818 int x = SendMsg(SCI_POINTXFROMPOSITION, 0, pos);
1819 int y = SendMsg(SCI_POINTYFROMPOSITION, 0, pos);
1820 return wxPoint(x, y);
f6bcfd97
BP
1821}
1822
f97d84a6
RD
1823// Scroll enough to make the given line visible
1824void wxStyledTextCtrl::ScrollToLine(int line) {
1825 m_swx->DoScrollToLine(line);
1826}
1827
1828
1829// Scroll enough to make the given column visible
1830void wxStyledTextCtrl::ScrollToColumn(int column) {
1831 m_swx->DoScrollToColumn(column);
1832}
1833
f6bcfd97 1834
d25f5fbb 1835
9ce192d4
RD
1836//----------------------------------------------------------------------
1837// Event handlers
1838
1839void wxStyledTextCtrl::OnPaint(wxPaintEvent& evt) {
1840 wxPaintDC dc(this);
1841 wxRegion region = GetUpdateRegion();
1842
1843 m_swx->DoPaint(&dc, region.GetBox());
1844}
1845
1846void wxStyledTextCtrl::OnScrollWin(wxScrollWinEvent& evt) {
1847 if (evt.GetOrientation() == wxHORIZONTAL)
1848 m_swx->DoHScroll(evt.GetEventType(), evt.GetPosition());
1849 else
1850 m_swx->DoVScroll(evt.GetEventType(), evt.GetPosition());
1851}
1852
5fa4613c
RD
1853void wxStyledTextCtrl::OnScroll(wxScrollEvent& evt) {
1854 wxScrollBar* sb = wxDynamicCast(evt.GetEventObject(), wxScrollBar);
1855 if (sb) {
1856 if (sb->IsVertical())
1857 m_swx->DoVScroll(evt.GetEventType(), evt.GetPosition());
1858 else
1859 m_swx->DoHScroll(evt.GetEventType(), evt.GetPosition());
1860 }
1861}
1862
9ce192d4
RD
1863void wxStyledTextCtrl::OnSize(wxSizeEvent& evt) {
1864 wxSize sz = GetClientSize();
1865 m_swx->DoSize(sz.x, sz.y);
1866}
1867
1868void wxStyledTextCtrl::OnMouseLeftDown(wxMouseEvent& evt) {
1869 wxPoint pt = evt.GetPosition();
1870 m_swx->DoButtonDown(Point(pt.x, pt.y), m_stopWatch.Time(),
1871 evt.ShiftDown(), evt.ControlDown(), evt.AltDown());
1872}
1873
1874void wxStyledTextCtrl::OnMouseMove(wxMouseEvent& evt) {
1875 wxPoint pt = evt.GetPosition();
1876 m_swx->DoButtonMove(Point(pt.x, pt.y));
1877}
1878
1879void wxStyledTextCtrl::OnMouseLeftUp(wxMouseEvent& evt) {
1880 wxPoint pt = evt.GetPosition();
1881 m_swx->DoButtonUp(Point(pt.x, pt.y), m_stopWatch.Time(),
1882 evt.ControlDown());
1883}
1884
1885
ddf2da08
RD
1886void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent& evt) {
1887 wxPoint pt = evt.GetPosition();
1888 m_swx->DoContextMenu(Point(pt.x, pt.y));
1889}
1890
1891
65ec6247 1892void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent& evt) {
9ce192d4 1893 wxPoint pt = evt.GetPosition();
65ec6247 1894 ScreenToClient(&pt.x, &pt.y);
9ce192d4
RD
1895 m_swx->DoContextMenu(Point(pt.x, pt.y));
1896}
1897
37d62433
RD
1898
1899void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt) {
1900 m_swx->DoMouseWheel(evt.GetWheelRotation(),
1901 evt.GetWheelDelta(),
65ec6247
RD
1902 evt.GetLinesPerAction(),
1903 evt.ControlDown());
37d62433
RD
1904}
1905
1906
9ce192d4 1907void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) {
9ce192d4 1908 long key = evt.KeyCode();
f3c2c221
RD
1909
1910// printf("OnChar key:%d consumed:%d ctrl:%d alt:%d\n",
1911// key, m_lastKeyDownConsumed, evt.ControlDown(), evt.AltDown());
1912
1913 // AltGr keys???
1914