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