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