]> git.saurik.com Git - wxWidgets.git/blob - src/stc/stc.cpp
This commit includes the following changes:
[wxWidgets.git] / src / stc / stc.cpp
1 ////////////////////////////////////////////////////////////////////////////
2 // Name: stc.cpp
3 // Purpose: A wxWindows 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/stc/stc.h"
21 #include "ScintillaWX.h"
22
23 #include <wx/tokenzr.h>
24
25 // The following code forces a reference to all of the Scintilla lexers.
26 // If we don't do something like this, then the linker tends to "optimize"
27 // them away. (eric@sourcegear.com)
28
29 int wxForceScintillaLexers(void)
30 {
31 extern LexerModule lmCPP;
32 extern LexerModule lmHTML;
33 extern LexerModule lmXML;
34 extern LexerModule lmProps;
35 extern LexerModule lmErrorList;
36 extern LexerModule lmMake;
37 extern LexerModule lmBatch;
38 extern LexerModule lmPerl;
39 extern LexerModule lmPython;
40 extern LexerModule lmSQL;
41 extern LexerModule lmVB;
42
43 if (
44 &lmCPP
45 && &lmHTML
46 && &lmXML
47 && &lmProps
48 && &lmErrorList
49 && &lmMake
50 && &lmBatch
51 && &lmPerl
52 && &lmPython
53 && &lmSQL
54 && &lmVB
55 )
56 {
57 return 1;
58 }
59 else
60 {
61 return 0;
62 }
63 }
64
65 //----------------------------------------------------------------------
66
67 const wxChar* wxSTCNameStr = "stcwindow";
68
69 BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
70 EVT_PAINT (wxStyledTextCtrl::OnPaint)
71 EVT_SCROLLWIN (wxStyledTextCtrl::OnScrollWin)
72 EVT_SIZE (wxStyledTextCtrl::OnSize)
73 EVT_LEFT_DOWN (wxStyledTextCtrl::OnMouseLeftDown)
74 EVT_MOTION (wxStyledTextCtrl::OnMouseMove)
75 EVT_LEFT_UP (wxStyledTextCtrl::OnMouseLeftUp)
76 EVT_RIGHT_UP (wxStyledTextCtrl::OnMouseRightUp)
77 EVT_CHAR (wxStyledTextCtrl::OnChar)
78 EVT_KILL_FOCUS (wxStyledTextCtrl::OnLoseFocus)
79 EVT_SET_FOCUS (wxStyledTextCtrl::OnGainFocus)
80 EVT_SYS_COLOUR_CHANGED (wxStyledTextCtrl::OnSysColourChanged)
81 EVT_ERASE_BACKGROUND (wxStyledTextCtrl::OnEraseBackground)
82 EVT_MENU_RANGE (-1, -1, wxStyledTextCtrl::OnMenu)
83 END_EVENT_TABLE()
84
85 //----------------------------------------------------------------------
86 // Constructor and Destructor
87
88 wxStyledTextCtrl::wxStyledTextCtrl(wxWindow *parent,
89 wxWindowID id,
90 const wxPoint& pos,
91 const wxSize& size,
92 long style,
93 const wxString& name) :
94 wxControl(parent, id, pos, size,
95 style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS,
96 wxDefaultValidator, name)
97 {
98 m_swx = new ScintillaWX(this);
99 // m_keywords = new WordList;
100 m_stopWatch.Start();
101 m_readOnly = false;
102 m_undoType = wxSTC_UndoCollectAutoStart;
103 }
104
105
106 wxStyledTextCtrl::~wxStyledTextCtrl() {
107 delete m_swx;
108 // delete m_keywords;
109 }
110
111
112 //----------------------------------------------------------------------
113
114 inline long wxStyledTextCtrl::SendMsg(int msg, long wp, long lp) {
115
116 return m_swx->WndProc(msg, wp, lp);
117 }
118
119
120 //----------------------------------------------------------------------
121 // Text retrieval and modification
122
123 wxString wxStyledTextCtrl::GetText() {
124 wxString text;
125 int len = GetTextLength();
126 char* buff = text.GetWriteBuf(len);
127
128 SendMsg(WM_GETTEXT, len, (long)buff);
129 text.UngetWriteBuf();
130 return text;
131 }
132
133
134 bool wxStyledTextCtrl::SetText(const wxString& text) {
135 return SendMsg(WM_SETTEXT, 0, (long)text.c_str()) != 0;
136 }
137
138
139 wxString wxStyledTextCtrl::GetLine(int line) {
140 wxString text;
141 int len = GetLineLength(line);
142 char* buff = text.GetWriteBuf(len+1);
143
144 *((WORD*)buff) = len+1;
145 SendMsg(EM_GETLINE, line, (long)buff);
146 text.UngetWriteBuf();
147 return text;
148 }
149
150
151 void wxStyledTextCtrl::ReplaceSelection(const wxString& text) {
152 SendMsg(EM_REPLACESEL, 0, (long)text.c_str());
153 }
154
155
156 void wxStyledTextCtrl::SetReadOnly(bool readOnly) {
157 SendMsg(EM_SETREADONLY, (long)readOnly);
158 m_readOnly = readOnly;
159 }
160
161
162 bool wxStyledTextCtrl::GetReadOnly() {
163 // TODO: need support in Scintilla to do this right,
164 // until then we'll track it ourselves
165 return m_readOnly;
166 }
167
168
169 void wxStyledTextCtrl::GetTextRange(int startPos, int endPos, char* buff) {
170 TEXTRANGE tr;
171 tr.lpstrText = buff;
172 tr.chrg.cpMin = startPos;
173 tr.chrg.cpMax = endPos;
174 SendMsg(EM_GETTEXTRANGE, 0, (long)&tr);
175 }
176
177
178 wxString wxStyledTextCtrl::GetTextRange(int startPos, int endPos) {
179 wxString text;
180 int len = endPos - startPos;
181 char* buff = text.GetWriteBuf(len);
182 GetTextRange(startPos, endPos, buff);
183 text.UngetWriteBuf();
184 return text;
185 }
186
187
188 void wxStyledTextCtrl::GetStyledTextRange(int startPos, int endPos, char* buff) {
189 TEXTRANGE tr;
190 tr.lpstrText = buff;
191 tr.chrg.cpMin = startPos;
192 tr.chrg.cpMax = endPos;
193 SendMsg(SCI_GETSTYLEDTEXT, 0, (long)&tr);
194 }
195
196
197 wxString wxStyledTextCtrl::GetStyledTextRange(int startPos, int endPos) {
198 wxString text;
199 int len = endPos - startPos;
200 char* buff = text.GetWriteBuf(len*2);
201 GetStyledTextRange(startPos, endPos, buff);
202 text.UngetWriteBuf(len*2);
203 return text;
204 }
205
206
207 void wxStyledTextCtrl::AddText(const wxString& text) {
208 SendMsg(SCI_ADDTEXT, text.Len(), (long)text.c_str());
209 }
210
211
212 void wxStyledTextCtrl::AddStyledText(const wxString& text) {
213 SendMsg(SCI_ADDSTYLEDTEXT, text.Len(), (long)text.c_str());
214 }
215
216
217 void wxStyledTextCtrl::InsertText(int pos, const wxString& text) {
218 SendMsg(SCI_INSERTTEXT, pos, (long)text.c_str());
219 }
220
221
222 void wxStyledTextCtrl::ClearAll() {
223 SendMsg(SCI_CLEARALL);
224 }
225
226
227 char wxStyledTextCtrl::GetCharAt(int pos) {
228 return SendMsg(SCI_GETCHARAT, pos);
229 }
230
231
232 char wxStyledTextCtrl::GetStyleAt(int pos) {
233 return SendMsg(SCI_GETSTYLEAT, pos);
234 }
235
236
237 void wxStyledTextCtrl::SetStyleBits(int bits) {
238 SendMsg(SCI_SETSTYLEBITS, bits);
239 }
240
241
242 int wxStyledTextCtrl::GetStyleBits() {
243 return SendMsg(SCI_GETSTYLEBITS);
244 }
245
246
247 //----------------------------------------------------------------------
248 // Clipboard
249
250
251 void wxStyledTextCtrl::Cut() {
252 SendMsg(WM_CUT);
253 }
254
255
256 void wxStyledTextCtrl::Copy() {
257 SendMsg(WM_COPY);
258 }
259
260
261 void wxStyledTextCtrl::Paste() {
262 SendMsg(WM_PASTE);
263 }
264
265
266 bool wxStyledTextCtrl::CanPaste() {
267 return SendMsg(EM_CANPASTE) != 0;
268 }
269
270
271 void wxStyledTextCtrl::ClearClipbrd() {
272 SendMsg(WM_CLEAR);
273 }
274
275
276
277 //----------------------------------------------------------------------
278 // Undo and Redo
279
280 void wxStyledTextCtrl::Undo() {
281 SendMsg(WM_UNDO);
282 }
283
284
285 bool wxStyledTextCtrl::CanUndo() {
286 return SendMsg(EM_CANUNDO) != 0;
287 }
288
289
290 void wxStyledTextCtrl::EmptyUndoBuffer() {
291 SendMsg(EM_EMPTYUNDOBUFFER);
292 }
293
294
295 void wxStyledTextCtrl::Redo() {
296 SendMsg(SCI_REDO);
297 }
298
299
300 bool wxStyledTextCtrl::CanRedo() {
301 return SendMsg(SCI_CANREDO) != 0;
302 }
303
304
305 void wxStyledTextCtrl::SetUndoCollection(wxSTC_UndoType type) {
306 SendMsg(SCI_SETUNDOCOLLECTION, type);
307 m_undoType = type;
308 }
309
310
311 wxSTC_UndoType wxStyledTextCtrl::GetUndoCollection() {
312 // TODO: need support in Scintilla to do this right,
313 // until then we'll track it ourselves
314 return m_undoType;
315 }
316
317
318 void wxStyledTextCtrl::BeginUndoAction() {
319 SendMsg(SCI_BEGINUNDOACTION);
320 }
321
322
323 void wxStyledTextCtrl::EndUndoAction() {
324 SendMsg(SCI_ENDUNDOACTION);
325 }
326
327
328
329
330 //----------------------------------------------------------------------
331 // Selection and information
332
333
334 void wxStyledTextCtrl::GetSelection(int* startPos, int* endPos) {
335 SendMsg(EM_GETSEL, (long)startPos, (long)endPos);
336 }
337
338
339 void wxStyledTextCtrl::SetSelection(int startPos, int endPos) {
340 SendMsg(EM_SETSEL, startPos, endPos);
341 }
342
343
344 wxString wxStyledTextCtrl::GetSelectedText() {
345 wxString text;
346 int start;
347 int end;
348
349 GetSelection(&start, &end);
350 int len = end - start;
351 char* buff = text.GetWriteBuf(len);
352
353 SendMsg(EM_GETSELTEXT, 0, (long)buff);
354 text.UngetWriteBuf();
355 return text;
356 }
357
358
359 void wxStyledTextCtrl::HideSelection(bool hide) {
360 SendMsg(EM_HIDESELECTION, hide);
361 }
362
363
364 bool wxStyledTextCtrl::GetHideSelection() {
365 return m_swx->GetHideSelection();
366 }
367
368
369 int wxStyledTextCtrl::GetTextLength() {
370 return SendMsg(WM_GETTEXTLENGTH);
371 }
372
373
374 int wxStyledTextCtrl::GetFirstVisibleLine() {
375 return SendMsg(EM_GETFIRSTVISIBLELINE);
376 }
377
378
379 int wxStyledTextCtrl::GetLineCount() {
380 return SendMsg(EM_GETLINECOUNT);
381 }
382
383
384 bool wxStyledTextCtrl::GetModified() {
385 return SendMsg(EM_GETMODIFY) != 0;
386 }
387
388
389 wxRect wxStyledTextCtrl::GetRect() {
390 PRectangle pr;
391 SendMsg(EM_GETRECT, 0, (long)&pr);
392
393 wxRect rect = wxRectFromPRectangle(pr);
394 return rect;
395 }
396
397
398 int wxStyledTextCtrl::GetLineFromPos(int pos) {
399 return SendMsg(EM_LINEFROMCHAR, pos);
400 }
401
402
403 int wxStyledTextCtrl::GetLineStartPos(int line) {
404 return SendMsg(EM_LINEINDEX, line);
405 }
406
407
408 int wxStyledTextCtrl::GetLineLengthAtPos(int pos) {
409 return SendMsg(EM_LINELENGTH, pos);
410 }
411
412
413 int wxStyledTextCtrl::GetLineLength(int line) {
414 return SendMsg(SCI_LINELENGTH, line);
415 }
416
417
418 int wxStyledTextCtrl::GetCurrentLine() {
419 int line = GetLineFromPos(GetCurrentPos());
420 return line;
421 }
422
423
424 wxString wxStyledTextCtrl::GetCurrentLineText(int* linePos) {
425 wxString text;
426 int len = GetLineLength(GetCurrentLine());
427 char* buff = text.GetWriteBuf(len+1);
428
429 int pos = SendMsg(SCI_GETCURLINE, len+1, (long)buff);
430 text.UngetWriteBuf();
431
432 if (linePos)
433 *linePos = pos;
434
435 return text;
436 }
437
438
439 int wxStyledTextCtrl::PositionFromPoint(wxPoint pt) {
440 Point spt(pt.x, pt.y);
441 long rv = SendMsg(EM_CHARFROMPOS, 0, (long)&spt);
442 return LOWORD(rv);
443 }
444
445
446 int wxStyledTextCtrl::LineFromPoint(wxPoint pt) {
447 Point spt(pt.x, pt.y);
448 long rv = SendMsg(EM_CHARFROMPOS, 0, (long)&spt);
449 return HIWORD(rv);
450 }
451
452
453 wxPoint wxStyledTextCtrl::PointFromPosition(int pos) {
454 Point pt;
455 SendMsg(EM_POSFROMCHAR, pos, (long)&pt);
456 return wxPoint(pt.x, pt.y);
457 }
458
459
460 int wxStyledTextCtrl::GetCurrentPos() {
461 return SendMsg(SCI_GETCURRENTPOS);
462 }
463
464
465 int wxStyledTextCtrl::GetAnchor() {
466 return SendMsg(SCI_GETANCHOR);
467 }
468
469
470 void wxStyledTextCtrl::SelectAll() {
471 SendMsg(SCI_SELECTALL);
472 }
473
474
475 void wxStyledTextCtrl::SetCurrentPosition(int pos) {
476 SendMsg(SCI_GOTOPOS, pos);
477 }
478
479
480 void wxStyledTextCtrl::SetAnchor(int pos) {
481 SendMsg(SCI_SETANCHOR, pos);
482 }
483
484
485 void wxStyledTextCtrl::GotoPos(int pos) {
486 SendMsg(SCI_GOTOPOS, pos);
487 }
488
489
490 void wxStyledTextCtrl::GotoLine(int line) {
491 SendMsg(SCI_GOTOLINE, line);
492 }
493
494
495 void wxStyledTextCtrl::ChangePosition(int delta, bool extendSelection) {
496 // TODO: Is documented but doesn't seem to be implemented
497 //SendMsg(SCI_CHANGEPOSITION, delta, extendSelection);
498 }
499
500
501 void wxStyledTextCtrl::PageMove(int cmdKey, bool extendSelection) {
502 // TODO: Is documented but doesn't seem to be implemented
503 //SendMsg(SCI_PAGEMOVE, cmdKey, extendSelection);
504 }
505
506
507 void wxStyledTextCtrl::ScrollBy(int columnDelta, int lineDelta) {
508 SendMsg(EM_LINESCROLL, columnDelta, lineDelta);
509 }
510
511 void wxStyledTextCtrl::ScrollToLine(int line) {
512 m_swx->DoScrollToLine(line);
513 }
514
515
516 void wxStyledTextCtrl::ScrollToColumn(int column) {
517 m_swx->DoScrollToColumn(column);
518 }
519
520
521 void wxStyledTextCtrl::EnsureCaretVisible() {
522 SendMsg(EM_SCROLLCARET);
523 }
524
525
526 void wxStyledTextCtrl::SetCaretPolicy(int policy, int slop) {
527 SendMsg(SCI_SETCARETPOLICY, policy, slop);
528 }
529
530
531 int wxStyledTextCtrl::GetSelectionType() {
532 return SendMsg(EM_SELECTIONTYPE);
533 }
534
535
536
537
538 //----------------------------------------------------------------------
539 // Searching
540
541 int wxStyledTextCtrl::FindText(int minPos, int maxPos,
542 const wxString& text,
543 bool caseSensitive, bool wholeWord) {
544 FINDTEXTEX ft;
545 int flags = 0;
546
547 flags |= caseSensitive ? FR_MATCHCASE : 0;
548 flags |= wholeWord ? FR_WHOLEWORD : 0;
549 ft.chrg.cpMin = minPos;
550 ft.chrg.cpMax = maxPos;
551 ft.lpstrText = (char*)text.c_str();
552
553 return SendMsg(EM_FINDTEXT, flags, (long)&ft);
554 }
555
556
557 void wxStyledTextCtrl::SearchAnchor() {
558 SendMsg(SCI_SEARCHANCHOR);
559 }
560
561
562 int wxStyledTextCtrl::SearchNext(const wxString& text, bool caseSensitive, bool wholeWord) {
563 int flags = 0;
564 flags |= caseSensitive ? FR_MATCHCASE : 0;
565 flags |= wholeWord ? FR_WHOLEWORD : 0;
566
567 return SendMsg(SCI_SEARCHNEXT, flags, (long)text.c_str());
568 }
569
570
571 int wxStyledTextCtrl::SearchPrev(const wxString& text, bool caseSensitive, bool wholeWord) {
572 int flags = 0;
573 flags |= caseSensitive ? FR_MATCHCASE : 0;
574 flags |= wholeWord ? FR_WHOLEWORD : 0;
575
576 return SendMsg(SCI_SEARCHPREV, flags, (long)text.c_str());
577 }
578
579 //----------------------------------------------------------------------
580 // Visible whitespace
581
582
583 bool wxStyledTextCtrl::GetViewWhitespace() {
584 return SendMsg(SCI_GETVIEWWS) != 0;
585 }
586
587
588 void wxStyledTextCtrl::SetViewWhitespace(bool visible) {
589 SendMsg(SCI_SETVIEWWS, visible);
590 }
591
592
593
594 //----------------------------------------------------------------------
595 // Line endings
596
597 wxSTC_EOL wxStyledTextCtrl::GetEOLMode() {
598 return (wxSTC_EOL)SendMsg(SCI_GETEOLMODE);
599 }
600
601
602 void wxStyledTextCtrl::SetEOLMode(wxSTC_EOL mode) {
603 SendMsg(SCI_SETEOLMODE, mode);
604 }
605
606
607 bool wxStyledTextCtrl::GetViewEOL() {
608 return SendMsg(SCI_GETVIEWEOL) != 0;
609 }
610
611
612 void wxStyledTextCtrl::SetViewEOL(bool visible) {
613 SendMsg(SCI_SETVIEWEOL, visible);
614 }
615
616 void wxStyledTextCtrl::ConvertEOL(wxSTC_EOL mode) {
617 SendMsg(SCI_CONVERTEOLS, mode);
618 }
619
620 //----------------------------------------------------------------------
621 // Styling
622
623 int wxStyledTextCtrl::GetEndStyled() {
624 return SendMsg(SCI_GETENDSTYLED);
625 }
626
627
628 void wxStyledTextCtrl::StartStyling(int pos, int mask) {
629 SendMsg(SCI_STARTSTYLING, pos, mask);
630 }
631
632
633 void wxStyledTextCtrl::SetStyleFor(int length, int style) {
634 SendMsg(SCI_SETSTYLING, length, style);
635 }
636
637
638 void wxStyledTextCtrl::SetStyleBytes(int length, char* styleBytes) {
639 SendMsg(SCI_SETSTYLINGEX, length, (long)styleBytes);
640 }
641
642
643 //----------------------------------------------------------------------
644 // Style Definition
645
646
647 static long wxColourAsLong(const wxColour& co) {
648 return (((long)co.Blue() << 16) |
649 ((long)co.Green() << 8) |
650 ((long)co.Red()));
651 }
652
653 static wxColour wxColourFromLong(long c) {
654 wxColour clr;
655 clr.Set(c & 0xff, (c >> 8) & 0xff, (c >> 16) & 0xff);
656 return clr;
657 }
658
659
660 static wxColour wxColourFromSpec(const wxString& spec) {
661 // spec should be #RRGGBB
662 char* junk;
663 int red = strtol(spec.Mid(1,2), &junk, 16);
664 int green = strtol(spec.Mid(3,2), &junk, 16);
665 int blue = strtol(spec.Mid(5,2), &junk, 16);
666 return wxColour(red, green, blue);
667 }
668
669
670 void wxStyledTextCtrl::StyleClearAll() {
671 SendMsg(SCI_STYLECLEARALL);
672 }
673
674
675 void wxStyledTextCtrl::StyleResetDefault() {
676 SendMsg(SCI_STYLERESETDEFAULT);
677 }
678
679
680
681 // Extract style settings from a spec-string which is composed of one or
682 // more of the following comma separated elements:
683 //
684 // bold turns on bold
685 // italic turns on italics
686 // fore:#RRGGBB sets the foreground colour
687 // back:#RRGGBB sets the background colour
688 // face:[facename] sets the font face name to use
689 // size:[num] sets the font size in points
690 // eol turns on eol filling
691 //
692
693 void wxStyledTextCtrl::StyleSetSpec(int styleNum, const wxString& spec) {
694
695 wxStringTokenizer tkz(spec, ",");
696 while (tkz.HasMoreTokens()) {
697 wxString token = tkz.GetNextToken();
698
699 wxString option = token.BeforeFirst(':');
700 wxString val = token.AfterFirst(':');
701
702 if (option == "bold")
703 StyleSetBold(styleNum, true);
704
705 else if (option == "italic")
706 StyleSetItalic(styleNum, true);
707
708 else if (option == "eol")
709 StyleSetEOLFilled(styleNum, true);
710
711 else if (option == "size") {
712 long points;
713 if (val.ToLong(&points))
714 StyleSetSize(styleNum, points);
715 }
716
717 else if (option == "face")
718 StyleSetFaceName(styleNum, val);
719
720 else if (option == "fore")
721 StyleSetForeground(styleNum, wxColourFromSpec(val));
722
723 else if (option == "back")
724 StyleSetBackground(styleNum, wxColourFromSpec(val));
725 }
726 }
727
728
729 void wxStyledTextCtrl::StyleSetForeground(int styleNum, const wxColour& colour) {
730 SendMsg(SCI_STYLESETFORE, styleNum, wxColourAsLong(colour));
731 }
732
733
734 void wxStyledTextCtrl::StyleSetBackground(int styleNum, const wxColour& colour) {
735 SendMsg(SCI_STYLESETBACK, styleNum, wxColourAsLong(colour));
736 }
737
738
739 void wxStyledTextCtrl::StyleSetFont(int styleNum, wxFont& font) {
740 int size = font.GetPointSize();
741 wxString faceName = font.GetFaceName();
742 bool bold = font.GetWeight() == wxBOLD;
743 bool italic = font.GetStyle() != wxNORMAL;
744
745 StyleSetFontAttr(styleNum, size, faceName, bold, italic);
746 }
747
748
749 void wxStyledTextCtrl::StyleSetFontAttr(int styleNum, int size,
750 const wxString& faceName,
751 bool bold, bool italic) {
752 StyleSetSize(styleNum, size);
753 StyleSetFaceName(styleNum, faceName);
754 StyleSetBold(styleNum, bold);
755 StyleSetItalic(styleNum, italic);
756 }
757
758
759 void wxStyledTextCtrl::StyleSetBold(int styleNum, bool bold) {
760 SendMsg(SCI_STYLESETBOLD, styleNum, bold);
761 }
762
763
764 void wxStyledTextCtrl::StyleSetItalic(int styleNum, bool italic) {
765 SendMsg(SCI_STYLESETITALIC, styleNum, italic);
766 }
767
768
769 void wxStyledTextCtrl::StyleSetFaceName(int styleNum, const wxString& faceName) {
770 SendMsg(SCI_STYLESETFONT, styleNum, (long)faceName.c_str());
771 }
772
773
774 void wxStyledTextCtrl::StyleSetSize(int styleNum, int pointSize) {
775 SendMsg(SCI_STYLESETSIZE, styleNum, pointSize);
776 }
777
778
779 void wxStyledTextCtrl::StyleSetEOLFilled(int styleNum, bool fillEOL) {
780 SendMsg(SCI_STYLESETEOLFILLED, styleNum, fillEOL);
781 }
782
783
784 //----------------------------------------------------------------------
785 // Margins in the edit area
786
787 int wxStyledTextCtrl::GetLeftMargin() {
788 return LOWORD(SendMsg(EM_GETMARGINS));
789 }
790
791
792 int wxStyledTextCtrl::GetRightMargin() {
793 return HIWORD(SendMsg(EM_GETMARGINS));
794 }
795
796
797 void wxStyledTextCtrl::SetMargins(int left, int right) {
798 int flag = 0;
799 int val = 0;
800
801 if (right != -1) {
802 flag |= EC_RIGHTMARGIN;
803 val = right << 16;
804 }
805 if (left != -1) {
806 flag |= EC_LEFTMARGIN;
807 val |= (left & 0xffff);
808 }
809
810 SendMsg(EM_SETMARGINS, flag, val);
811 }
812
813
814 //----------------------------------------------------------------------
815 // Margins for selection, markers, etc.
816
817 void wxStyledTextCtrl::SetMarginType(int margin, int type) {
818 SendMsg(SCI_SETMARGINTYPEN, margin, type);
819 }
820
821
822 int wxStyledTextCtrl::GetMarginType(int margin) {
823 return SendMsg(SCI_GETMARGINTYPEN, margin);
824 }
825
826
827 void wxStyledTextCtrl::SetMarginWidth(int margin, int pixelWidth) {
828 SendMsg(SCI_SETMARGINWIDTHN, margin, pixelWidth);
829 }
830
831
832 int wxStyledTextCtrl::GetMarginWidth(int margin) {
833 return SendMsg(SCI_GETMARGINWIDTHN, margin);
834 }
835
836
837 void wxStyledTextCtrl::SetMarginMask(int margin, int mask) {
838 SendMsg(SCI_SETMARGINMASKN, margin, mask);
839 }
840
841
842 int wxStyledTextCtrl::GetMarginMask(int margin) {
843 return SendMsg(SCI_GETMARGINMASKN, margin);
844 }
845
846
847 void wxStyledTextCtrl::SetMarginSensitive(int margin, bool sensitive) {
848 SendMsg(SCI_SETMARGINSENSITIVEN, margin, sensitive);
849 }
850
851
852 bool wxStyledTextCtrl::GetMarginSensitive(int margin) {
853 return SendMsg(SCI_GETMARGINSENSITIVEN, margin) != 0;
854 }
855
856
857
858
859 //----------------------------------------------------------------------
860 // Selection and Caret styles
861
862
863 void wxStyledTextCtrl::SetSelectionForeground(const wxColour& colour) {
864 SendMsg(SCI_SETSELFORE, 0, wxColourAsLong(colour));
865 }
866
867
868 void wxStyledTextCtrl::SetSelectionBackground(const wxColour& colour) {
869 SendMsg(SCI_SETSELBACK, 0, wxColourAsLong(colour));
870 }
871
872
873 void wxStyledTextCtrl::SetCaretForeground(const wxColour& colour) {
874 SendMsg(SCI_SETCARETFORE, 0, wxColourAsLong(colour));
875 }
876
877
878 int wxStyledTextCtrl::GetCaretPeriod() {
879 return SendMsg(SCI_GETCARETPERIOD);
880 }
881
882
883 void wxStyledTextCtrl::SetCaretPeriod(int milliseconds) {
884 SendMsg(SCI_SETCARETPERIOD, milliseconds);
885 }
886
887
888
889 //----------------------------------------------------------------------
890 // Other settings
891
892
893 void wxStyledTextCtrl::SetBufferedDraw(bool isBuffered) {
894 SendMsg(SCI_SETBUFFEREDDRAW, isBuffered);
895 }
896
897
898 void wxStyledTextCtrl::SetTabWidth(int numChars) {
899 SendMsg(SCI_SETTABWIDTH, numChars);
900 }
901
902
903 void wxStyledTextCtrl::SetWordChars(const wxString& wordChars) {
904 SendMsg(SCI_SETTABWIDTH, 0, (long)wordChars.c_str());
905 }
906
907
908 //----------------------------------------------------------------------
909 // Brace highlighting
910
911
912 void wxStyledTextCtrl::BraceHighlight(int pos1, int pos2) {
913 SendMsg(SCI_BRACEHIGHLIGHT, pos1, pos2);
914 }
915
916
917 void wxStyledTextCtrl::BraceBadlight(int pos) {
918 SendMsg(SCI_BRACEBADLIGHT, pos);
919 }
920
921
922 int wxStyledTextCtrl::BraceMatch(int pos, int maxReStyle) {
923 return SendMsg(SCI_BRACEMATCH, pos, maxReStyle);
924 }
925
926
927
928 //----------------------------------------------------------------------
929 // Markers
930
931 void wxStyledTextCtrl::MarkerDefine(int markerNumber, int markerSymbol,
932 const wxColour& foreground,
933 const wxColour& background) {
934 MarkerSetType(markerNumber, markerSymbol);
935 MarkerSetForeground(markerNumber, foreground);
936 MarkerSetBackground(markerNumber, background);
937 }
938
939
940 void wxStyledTextCtrl::MarkerSetType(int markerNumber, int markerSymbol) {
941 SendMsg(SCI_MARKERDEFINE, markerNumber, markerSymbol);
942 }
943
944
945 void wxStyledTextCtrl::MarkerSetForeground(int markerNumber, const wxColour& colour) {
946 SendMsg(SCI_MARKERSETFORE, markerNumber, wxColourAsLong(colour));
947 }
948
949
950 void wxStyledTextCtrl::MarkerSetBackground(int markerNumber, const wxColour& colour) {
951 SendMsg(SCI_MARKERSETBACK, markerNumber, wxColourAsLong(colour));
952 }
953
954
955 int wxStyledTextCtrl::MarkerAdd(int line, int markerNumber) {
956 return SendMsg(SCI_MARKERADD, line, markerNumber);
957 }
958
959
960 void wxStyledTextCtrl::MarkerDelete(int line, int markerNumber) {
961 SendMsg(SCI_MARKERDELETE, line, markerNumber);
962 }
963
964
965 void wxStyledTextCtrl::MarkerDeleteAll(int markerNumber) {
966 SendMsg(SCI_MARKERDELETEALL, markerNumber);
967 }
968
969
970 int wxStyledTextCtrl::MarkerGet(int line) {
971 return SendMsg(SCI_MARKERGET);
972 }
973
974
975 int wxStyledTextCtrl::MarkerGetNextLine(int lineStart, int markerMask) {
976 return SendMsg(SCI_MARKERNEXT, lineStart, markerMask);
977 }
978
979
980 int wxStyledTextCtrl::MarkerGetPrevLine(int lineStart, int markerMask) {
981 // return SendMsg(SCI_MARKERPREV, lineStart, markerMask);
982 return 0;
983 }
984
985
986 int wxStyledTextCtrl::MarkerLineFromHandle(int handle) {
987 return SendMsg(SCI_MARKERLINEFROMHANDLE, handle);
988 }
989
990
991 void wxStyledTextCtrl::MarkerDeleteHandle(int handle) {
992 SendMsg(SCI_MARKERDELETEHANDLE, handle);
993 }
994
995
996
997 //----------------------------------------------------------------------
998 // Indicators
999
1000
1001 void wxStyledTextCtrl::IndicatorSetStyle(int indicNum, int indicStyle) {
1002 SendMsg(SCI_INDICSETSTYLE, indicNum, indicStyle);
1003 }
1004
1005
1006 int wxStyledTextCtrl::IndicatorGetStyle(int indicNum) {
1007 return SendMsg(SCI_INDICGETSTYLE, indicNum);
1008 }
1009
1010
1011 void wxStyledTextCtrl::IndicatorSetColour(int indicNum, const wxColour& colour) {
1012 SendMsg(SCI_INDICSETSTYLE, indicNum, wxColourAsLong(colour));
1013 }
1014
1015
1016
1017 //----------------------------------------------------------------------
1018 // Auto completion
1019
1020
1021 void wxStyledTextCtrl::AutoCompShow(const wxString& listOfWords) {
1022 SendMsg(SCI_AUTOCSHOW, 0, (long)listOfWords.c_str());
1023 }
1024
1025
1026 void wxStyledTextCtrl::AutoCompCancel() {
1027 SendMsg(SCI_AUTOCCANCEL);
1028 }
1029
1030
1031 bool wxStyledTextCtrl::AutoCompActive() {
1032 return SendMsg(SCI_AUTOCACTIVE) != 0;
1033 }
1034
1035
1036 int wxStyledTextCtrl::AutoCompPosAtStart() {
1037 return SendMsg(SCI_AUTOCPOSSTART);
1038 }
1039
1040
1041 void wxStyledTextCtrl::AutoCompComplete() {
1042 SendMsg(SCI_AUTOCCOMPLETE);
1043 }
1044
1045
1046 void wxStyledTextCtrl::AutoCompStopChars(const wxString& stopChars) {
1047 SendMsg(SCI_AUTOCSHOW, 0, (long)stopChars.c_str());
1048 }
1049
1050
1051 //----------------------------------------------------------------------
1052 // Call tips
1053
1054 void wxStyledTextCtrl::CallTipShow(int pos, const wxString& text) {
1055 SendMsg(SCI_CALLTIPSHOW, pos, (long)text.c_str());
1056 }
1057
1058
1059 void wxStyledTextCtrl::CallTipCancel() {
1060 SendMsg(SCI_CALLTIPCANCEL);
1061 }
1062
1063
1064 bool wxStyledTextCtrl::CallTipActive() {
1065 return SendMsg(SCI_CALLTIPACTIVE) != 0;
1066 }
1067
1068
1069 int wxStyledTextCtrl::CallTipPosAtStart() {
1070 return SendMsg(SCI_CALLTIPPOSSTART);
1071 }
1072
1073
1074 void wxStyledTextCtrl::CallTipSetHighlight(int start, int end) {
1075 SendMsg(SCI_CALLTIPSETHLT, start, end);
1076 }
1077
1078
1079 void wxStyledTextCtrl::CallTipSetBackground(const wxColour& colour) {
1080 SendMsg(SCI_CALLTIPSETBACK, wxColourAsLong(colour));
1081 }
1082
1083
1084 //----------------------------------------------------------------------
1085 // Key bindings
1086
1087 void wxStyledTextCtrl::CmdKeyAssign(int key, int modifiers, int cmd) {
1088 SendMsg(SCI_ASSIGNCMDKEY, MAKELONG(key, modifiers), cmd);
1089 }
1090
1091
1092 void wxStyledTextCtrl::CmdKeyClear(int key, int modifiers) {
1093 SendMsg(SCI_CLEARCMDKEY, MAKELONG(key, modifiers));
1094 }
1095
1096
1097 void wxStyledTextCtrl::CmdKeyClearAll() {
1098 SendMsg(SCI_CLEARALLCMDKEYS);
1099 }
1100
1101
1102 void wxStyledTextCtrl::CmdKeyExecute(int cmd) {
1103 SendMsg(cmd);
1104 }
1105
1106
1107
1108 //----------------------------------------------------------------------
1109 // Print formatting
1110
1111 int
1112 wxStyledTextCtrl::FormatRange(bool doDraw,
1113 int startPos,
1114 int endPos,
1115 wxDC* draw,
1116 wxDC* target, // Why does it use two? Can they be the same?
1117 wxRect renderRect,
1118 wxRect pageRect) {
1119 FORMATRANGE fr;
1120
1121 fr.hdc = draw;
1122 fr.hdcTarget = target;
1123 fr.rc.top = renderRect.GetTop();
1124 fr.rc.left = renderRect.GetLeft();
1125 fr.rc.right = renderRect.GetRight();
1126 fr.rc.bottom = renderRect.GetBottom();
1127 fr.rcPage.top = pageRect.GetTop();
1128 fr.rcPage.left = pageRect.GetLeft();
1129 fr.rcPage.right = pageRect.GetRight();
1130 fr.rcPage.bottom = pageRect.GetBottom();
1131 fr.chrg.cpMin = startPos;
1132 fr.chrg.cpMax = endPos;
1133
1134 return SendMsg(EM_FORMATRANGE, doDraw, (long)&fr);
1135 }
1136
1137
1138 //----------------------------------------------------------------------
1139 // Document Sharing
1140
1141 void* wxStyledTextCtrl::GetDocument() {
1142 return (void*)SendMsg(SCI_GETDOCPOINTER);
1143 }
1144
1145
1146 void wxStyledTextCtrl::SetDocument(void* document) {
1147 SendMsg(SCI_SETDOCPOINTER, 0, (long)document);
1148 }
1149
1150
1151 //----------------------------------------------------------------------
1152 // Folding
1153
1154 int wxStyledTextCtrl::VisibleFromDocLine(int docLine) {
1155 return SendMsg(SCI_VISIBLEFROMDOCLINE, docLine);
1156 }
1157
1158
1159 int wxStyledTextCtrl::DocLineFromVisible(int displayLine) {
1160 return SendMsg(SCI_DOCLINEFROMVISIBLE, displayLine);
1161 }
1162
1163
1164 int wxStyledTextCtrl::SetFoldLevel(int line, int level) {
1165 return SendMsg(SCI_SETFOLDLEVEL, line, level);
1166 }
1167
1168
1169 int wxStyledTextCtrl::GetFoldLevel(int line) {
1170 return SendMsg(SCI_GETFOLDLEVEL, line);
1171 }
1172
1173
1174 int wxStyledTextCtrl::GetLastChild(int line) {
1175 return SendMsg(SCI_GETLASTCHILD, line);
1176 }
1177
1178
1179 int wxStyledTextCtrl::GetFoldParent(int line) {
1180 return SendMsg(SCI_GETFOLDPARENT, line);
1181 }
1182
1183
1184 void wxStyledTextCtrl::ShowLines(int lineStart, int lineEnd) {
1185 SendMsg(SCI_SHOWLINES, lineStart, lineEnd);
1186 }
1187
1188
1189 void wxStyledTextCtrl::HideLines(int lineStart, int lineEnd) {
1190 SendMsg(SCI_HIDELINES, lineStart, lineEnd);
1191 }
1192
1193
1194 bool wxStyledTextCtrl::GetLineVisible(int line) {
1195 return SendMsg(SCI_GETLINEVISIBLE, line) != 0;
1196 }
1197
1198
1199 void wxStyledTextCtrl::SetFoldExpanded(int line) {
1200 SendMsg(SCI_SETFOLDEXPANDED, line);
1201 }
1202
1203
1204 bool wxStyledTextCtrl::GetFoldExpanded(int line) {
1205 return SendMsg(SCI_GETFOLDEXPANDED, line) != 0;
1206 }
1207
1208
1209 void wxStyledTextCtrl::ToggleFold(int line) {
1210 SendMsg(SCI_TOGGLEFOLD, line);
1211 }
1212
1213
1214 void wxStyledTextCtrl::EnsureVisible(int line) {
1215 SendMsg(SCI_ENSUREVISIBLE, line);
1216 }
1217
1218
1219 //----------------------------------------------------------------------
1220 // Long Lines
1221
1222 int wxStyledTextCtrl::GetEdgeColumn() {
1223 return SendMsg(SCI_GETEDGECOLUMN);
1224 }
1225
1226 void wxStyledTextCtrl::SetEdgeColumn(int column) {
1227 SendMsg(SCI_SETEDGECOLUMN, column);
1228 }
1229
1230 wxSTC_EDGE wxStyledTextCtrl::GetEdgeMode() {
1231 return (wxSTC_EDGE) SendMsg(SCI_GETEDGEMODE);
1232 }
1233
1234 void wxStyledTextCtrl::SetEdgeMode(wxSTC_EDGE mode){
1235 SendMsg(SCI_SETEDGEMODE, mode);
1236 }
1237
1238 wxColour wxStyledTextCtrl::GetEdgeColour() {
1239 long c = SendMsg(SCI_GETEDGECOLOUR);
1240 return wxColourFromLong(c);
1241 }
1242
1243 void wxStyledTextCtrl::SetEdgeColour(const wxColour& colour) {
1244 SendMsg(SCI_SETEDGECOLOUR, wxColourAsLong(colour));
1245 }
1246
1247
1248 //----------------------------------------------------------------------
1249 // Lexer
1250
1251 void wxStyledTextCtrl::SetLexer(wxSTC_LEX lexer) {
1252 SendMsg(SCI_SETLEXER, lexer);
1253 }
1254
1255
1256 wxSTC_LEX wxStyledTextCtrl::GetLexer() {
1257 return (wxSTC_LEX)SendMsg(SCI_GETLEXER);
1258 }
1259
1260
1261 void wxStyledTextCtrl::Colourise(int start, int end) {
1262 SendMsg(SCI_COLOURISE, start, end);
1263 }
1264
1265
1266 void wxStyledTextCtrl::SetProperty(const wxString& key, const wxString& value) {
1267 SendMsg(SCI_SETPROPERTY, (long)key.c_str(), (long)value.c_str());
1268 }
1269
1270
1271 void wxStyledTextCtrl::SetKeywords(int keywordSet, const wxString& keywordList) {
1272 SendMsg(SCI_SETKEYWORDS, keywordSet, (long)keywordList.c_str());
1273 }
1274
1275
1276
1277 //----------------------------------------------------------------------
1278 // Event handlers
1279
1280 void wxStyledTextCtrl::OnPaint(wxPaintEvent& evt) {
1281 wxPaintDC dc(this);
1282 wxRegion region = GetUpdateRegion();
1283
1284 m_swx->DoPaint(&dc, region.GetBox());
1285 }
1286
1287 void wxStyledTextCtrl::OnScrollWin(wxScrollWinEvent& evt) {
1288 if (evt.GetOrientation() == wxHORIZONTAL)
1289 m_swx->DoHScroll(evt.GetEventType(), evt.GetPosition());
1290 else
1291 m_swx->DoVScroll(evt.GetEventType(), evt.GetPosition());
1292 }
1293
1294 void wxStyledTextCtrl::OnSize(wxSizeEvent& evt) {
1295 wxSize sz = GetClientSize();
1296 m_swx->DoSize(sz.x, sz.y);
1297 }
1298
1299 void wxStyledTextCtrl::OnMouseLeftDown(wxMouseEvent& evt) {
1300 wxPoint pt = evt.GetPosition();
1301 m_swx->DoButtonDown(Point(pt.x, pt.y), m_stopWatch.Time(),
1302 evt.ShiftDown(), evt.ControlDown(), evt.AltDown());
1303 }
1304
1305 void wxStyledTextCtrl::OnMouseMove(wxMouseEvent& evt) {
1306 wxPoint pt = evt.GetPosition();
1307 m_swx->DoButtonMove(Point(pt.x, pt.y));
1308 }
1309
1310 void wxStyledTextCtrl::OnMouseLeftUp(wxMouseEvent& evt) {
1311 wxPoint pt = evt.GetPosition();
1312 m_swx->DoButtonUp(Point(pt.x, pt.y), m_stopWatch.Time(),
1313 evt.ControlDown());
1314 }
1315
1316
1317 void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent& evt) {
1318 wxPoint pt = evt.GetPosition();
1319 m_swx->DoContextMenu(Point(pt.x, pt.y));
1320 }
1321
1322 void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) {
1323 int processed = 0;
1324 long key = evt.KeyCode();
1325 if ((key > WXK_ESCAPE) &&
1326 (key != WXK_DELETE) && (key < 255) &&
1327 !evt.ControlDown() && !evt.AltDown()) {
1328
1329 m_swx->DoAddChar(key);
1330 processed = true;
1331 }
1332 else {
1333 key = toupper(key);
1334 processed = m_swx->DoKeyDown(key, evt.ShiftDown(),
1335 evt.ControlDown(), evt.AltDown());
1336 }
1337 if (! processed)
1338 evt.Skip();
1339 }
1340
1341 void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& evt) {
1342 m_swx->DoLoseFocus();
1343 }
1344
1345 void wxStyledTextCtrl::OnGainFocus(wxFocusEvent& evt) {
1346 m_swx->DoGainFocus();
1347 }
1348
1349 void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent& evt) {
1350 m_swx->DoSysColourChange();
1351 }
1352
1353 void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent& evt) {
1354 // do nothing to help avoid flashing
1355 }
1356
1357
1358
1359 void wxStyledTextCtrl::OnMenu(wxCommandEvent& evt) {
1360 m_swx->DoCommand(evt.GetId());
1361 }
1362
1363
1364 //----------------------------------------------------------------------
1365 // Turn notifications from Scintilla into events
1366
1367 void wxStyledTextCtrl::NotifyChange() {
1368 wxStyledTextEvent evt(wxEVT_STC_CHANGE, GetId());
1369 GetEventHandler()->ProcessEvent(evt);
1370 }
1371
1372 void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
1373 SCNotification& scn = *_scn;
1374 int eventType = 0;
1375 switch (scn.nmhdr.code) {
1376 case SCN_STYLENEEDED:
1377 eventType = wxEVT_STC_STYLENEEDED;
1378 break;
1379 case SCN_CHARADDED:
1380 eventType = wxEVT_STC_CHARADDED;
1381 break;
1382 case SCN_UPDATEUI:
1383 eventType = wxEVT_STC_UPDATEUI;
1384 break;
1385 case SCN_SAVEPOINTREACHED:
1386 eventType = wxEVT_STC_SAVEPOINTREACHED;
1387 break;
1388 case SCN_SAVEPOINTLEFT:
1389 eventType = wxEVT_STC_SAVEPOINTLEFT;
1390 break;
1391 case SCN_MODIFYATTEMPTRO:
1392 eventType = wxEVT_STC_ROMODIFYATTEMPT;
1393 break;
1394 case SCN_DOUBLECLICK:
1395 eventType = wxEVT_STC_DOUBLECLICK;
1396 break;
1397 case SCN_MODIFIED:
1398 eventType = wxEVT_STC_MODIFIED;
1399 break;
1400 case SCN_KEY:
1401 eventType = wxEVT_STC_KEY;
1402 break;
1403 case SCN_MACRORECORD:
1404 eventType = wxEVT_STC_MACRORECORD;
1405 break;
1406 case SCN_MARGINCLICK:
1407 eventType = wxEVT_STC_MARGINCLICK;
1408 break;
1409 case SCN_NEEDSHOWN:
1410 eventType = wxEVT_STC_NEEDSHOWN;
1411 break;
1412 }
1413 if (eventType) {
1414 wxStyledTextEvent evt(eventType, GetId());
1415 evt.SetPosition(scn.position);
1416 evt.SetKey(scn.ch);
1417 evt.SetModifiers(scn.modifiers);
1418 if (eventType == wxEVT_STC_MODIFIED) {
1419 evt.SetModificationType(scn.modificationType);
1420 evt.SetText(scn.text);
1421 evt.SetLength(scn.length);
1422 evt.SetLinesAdded(scn.linesAdded);
1423 evt.SetLine(scn.line);
1424 evt.SetFoldLevelNow(scn.foldLevelNow);
1425 evt.SetFoldLevelPrev(scn.foldLevelPrev);
1426 }
1427 if (eventType == wxEVT_STC_MARGINCLICK)
1428 evt.SetMargin(scn.margin);
1429 if (eventType == wxEVT_STC_MACRORECORD) {
1430 evt.SetMessage(scn.message);
1431 evt.SetWParam(scn.wParam);
1432 evt.SetLParam(scn.lParam);
1433 }
1434
1435 GetEventHandler()->ProcessEvent(evt);
1436 }
1437 }
1438
1439
1440
1441 //----------------------------------------------------------------------
1442 //----------------------------------------------------------------------
1443 //----------------------------------------------------------------------
1444
1445 wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType, int id)
1446 : wxCommandEvent(commandType, id)
1447 {
1448 m_position = 0;
1449 m_key = 0;
1450 m_modifiers = 0;
1451 m_modificationType = 0;
1452 m_length = 0;
1453 m_linesAdded = 0;
1454 m_line = 0;
1455 m_foldLevelNow = 0;
1456 m_foldLevelPrev = 0;
1457 m_margin = 0;
1458 m_message = 0;
1459 m_wParam = 0;
1460 m_lParam = 0;
1461
1462
1463 }
1464
1465 bool wxStyledTextEvent::GetShift() const { return (m_modifiers & SCI_SHIFT) != 0; }
1466 bool wxStyledTextEvent::GetControl() const { return (m_modifiers & SCI_CTRL) != 0; }
1467 bool wxStyledTextEvent::GetAlt() const { return (m_modifiers & SCI_ALT) != 0; }
1468
1469 void wxStyledTextEvent::CopyObject(wxObject& obj) const {
1470 wxCommandEvent::CopyObject(obj);
1471
1472 wxStyledTextEvent* o = (wxStyledTextEvent*)&obj;
1473 o->m_position = m_position;
1474 o->m_key = m_key;
1475 o->m_modifiers = m_modifiers;
1476 o->m_modificationType = m_modificationType;
1477 o->m_text = m_text;
1478 o->m_length = m_length;
1479 o->m_linesAdded = m_linesAdded;
1480 o->m_line = m_line;
1481 o->m_foldLevelNow = m_foldLevelNow;
1482 o->m_foldLevelPrev = m_foldLevelPrev;
1483
1484 o->m_margin = m_margin;
1485
1486 o->m_message = m_message;
1487 o->m_wParam = m_wParam;
1488 o->m_lParam = m_lParam;
1489
1490
1491
1492 }
1493
1494 //----------------------------------------------------------------------
1495 //----------------------------------------------------------------------
1496