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