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