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