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