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