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