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