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