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