]> git.saurik.com Git - wxWidgets.git/blob - src/stc/stc.cpp.in
Used wxRegion code from wxX11.
[wxWidgets.git] / src / stc / stc.cpp.in
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/wx.h>
24 #include <wx/tokenzr.h>
25 #include <wx/mstream.h>
26 #include <wx/image.h>
27
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(c & 0xff, (c >> 8) & 0xff, (c >> 16) & 0xff);
49 return clr;
50 }
51
52
53 static wxColour wxColourFromSpec(const wxString& spec) {
54 // spec should be "#RRGGBB"
55 long red, green, blue;
56 red = green = blue = 0;
57 spec.Mid(1,2).ToLong(&red, 16);
58 spec.Mid(3,2).ToLong(&green, 16);
59 spec.Mid(5,2).ToLong(&blue, 16);
60 return wxColour(red, green, blue);
61 }
62
63 //----------------------------------------------------------------------
64
65 DEFINE_EVENT_TYPE( wxEVT_STC_CHANGE )
66 DEFINE_EVENT_TYPE( wxEVT_STC_STYLENEEDED )
67 DEFINE_EVENT_TYPE( wxEVT_STC_CHARADDED )
68 DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTREACHED )
69 DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTLEFT )
70 DEFINE_EVENT_TYPE( wxEVT_STC_ROMODIFYATTEMPT )
71 DEFINE_EVENT_TYPE( wxEVT_STC_KEY )
72 DEFINE_EVENT_TYPE( wxEVT_STC_DOUBLECLICK )
73 DEFINE_EVENT_TYPE( wxEVT_STC_UPDATEUI )
74 DEFINE_EVENT_TYPE( wxEVT_STC_MODIFIED )
75 DEFINE_EVENT_TYPE( wxEVT_STC_MACRORECORD )
76 DEFINE_EVENT_TYPE( wxEVT_STC_MARGINCLICK )
77 DEFINE_EVENT_TYPE( wxEVT_STC_NEEDSHOWN )
78 DEFINE_EVENT_TYPE( wxEVT_STC_POSCHANGED )
79 DEFINE_EVENT_TYPE( wxEVT_STC_PAINTED )
80 DEFINE_EVENT_TYPE( wxEVT_STC_USERLISTSELECTION )
81 DEFINE_EVENT_TYPE( wxEVT_STC_URIDROPPED )
82 DEFINE_EVENT_TYPE( wxEVT_STC_DWELLSTART )
83 DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND )
84 DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG )
85 DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER )
86 DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP )
87 DEFINE_EVENT_TYPE( wxEVT_STC_ZOOM )
88 DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_CLICK )
89 DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_DCLICK )
90 DEFINE_EVENT_TYPE( wxEVT_STC_CALLTIP_CLICK )
91
92
93
94 BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
95 EVT_PAINT (wxStyledTextCtrl::OnPaint)
96 EVT_SCROLLWIN (wxStyledTextCtrl::OnScrollWin)
97 EVT_SCROLL (wxStyledTextCtrl::OnScroll)
98 EVT_SIZE (wxStyledTextCtrl::OnSize)
99 EVT_LEFT_DOWN (wxStyledTextCtrl::OnMouseLeftDown)
100 // Let Scintilla see the double click as a second click
101 EVT_LEFT_DCLICK (wxStyledTextCtrl::OnMouseLeftDown)
102 EVT_MOTION (wxStyledTextCtrl::OnMouseMove)
103 EVT_LEFT_UP (wxStyledTextCtrl::OnMouseLeftUp)
104 #if defined(__WXGTK__) || defined(__WXMAC__)
105 EVT_RIGHT_UP (wxStyledTextCtrl::OnMouseRightUp)
106 #else
107 EVT_CONTEXT_MENU (wxStyledTextCtrl::OnContextMenu)
108 #endif
109 EVT_MOUSEWHEEL (wxStyledTextCtrl::OnMouseWheel)
110 EVT_MIDDLE_UP (wxStyledTextCtrl::OnMouseMiddleUp)
111 EVT_CHAR (wxStyledTextCtrl::OnChar)
112 EVT_KEY_DOWN (wxStyledTextCtrl::OnKeyDown)
113 EVT_KILL_FOCUS (wxStyledTextCtrl::OnLoseFocus)
114 EVT_SET_FOCUS (wxStyledTextCtrl::OnGainFocus)
115 EVT_SYS_COLOUR_CHANGED (wxStyledTextCtrl::OnSysColourChanged)
116 EVT_ERASE_BACKGROUND (wxStyledTextCtrl::OnEraseBackground)
117 EVT_MENU_RANGE (10, 16, wxStyledTextCtrl::OnMenu)
118 EVT_LISTBOX_DCLICK (-1, wxStyledTextCtrl::OnListBox)
119 END_EVENT_TABLE()
120
121
122 IMPLEMENT_CLASS(wxStyledTextCtrl, wxControl)
123 IMPLEMENT_DYNAMIC_CLASS(wxStyledTextEvent, wxCommandEvent)
124
125 #ifdef LINK_LEXERS
126 // forces the linking of the lexer modules
127 int Scintilla_LinkLexers();
128 #endif
129
130 //----------------------------------------------------------------------
131 // Constructor and Destructor
132
133 wxStyledTextCtrl::wxStyledTextCtrl(wxWindow *parent,
134 wxWindowID id,
135 const wxPoint& pos,
136 const wxSize& size,
137 long style,
138 const wxString& name) :
139 wxControl(parent, id, pos, size,
140 style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS | wxCLIP_CHILDREN,
141 wxDefaultValidator, name)
142 {
143 #ifdef LINK_LEXERS
144 Scintilla_LinkLexers();
145 #endif
146 m_swx = new ScintillaWX(this);
147 m_stopWatch.Start();
148 m_lastKeyDownConsumed = FALSE;
149 m_vScrollBar = NULL;
150 m_hScrollBar = NULL;
151 #if wxUSE_UNICODE
152 // Put Scintilla into unicode (UTF-8) mode
153 SetCodePage(wxSTC_CP_UTF8);
154 #endif
155 }
156
157
158 wxStyledTextCtrl::~wxStyledTextCtrl() {
159 delete m_swx;
160 }
161
162
163 //----------------------------------------------------------------------
164
165 long wxStyledTextCtrl::SendMsg(int msg, long wp, long lp) {
166
167 return m_swx->WndProc(msg, wp, lp);
168 }
169
170
171
172 //----------------------------------------------------------------------
173 // BEGIN generated section. The following code is automatically generated
174 // by gen_iface.py from the contents of Scintilla.iface. Do not edit
175 // this file. Edit stc.cpp.in or gen_iface.py instead and regenerate.
176
177 %(METHOD_IMPS)s
178
179 // END of generated section
180 //----------------------------------------------------------------------
181
182
183 // Returns the line number of the line with the caret.
184 int wxStyledTextCtrl::GetCurrentLine() {
185 int line = LineFromPosition(GetCurrentPos());
186 return line;
187 }
188
189
190 // Extract style settings from a spec-string which is composed of one or
191 // more of the following comma separated elements:
192 //
193 // bold turns on bold
194 // italic turns on italics
195 // fore:#RRGGBB sets the foreground colour
196 // back:#RRGGBB sets the background colour
197 // face:[facename] sets the font face name to use
198 // size:[num] sets the font size in points
199 // eol turns on eol filling
200 // underline turns on underlining
201 //
202 void wxStyledTextCtrl::StyleSetSpec(int styleNum, const wxString& spec) {
203
204 wxStringTokenizer tkz(spec, wxT(","));
205 while (tkz.HasMoreTokens()) {
206 wxString token = tkz.GetNextToken();
207
208 wxString option = token.BeforeFirst(':');
209 wxString val = token.AfterFirst(':');
210
211 if (option == wxT("bold"))
212 StyleSetBold(styleNum, true);
213
214 else if (option == wxT("italic"))
215 StyleSetItalic(styleNum, true);
216
217 else if (option == wxT("underline"))
218 StyleSetUnderline(styleNum, true);
219
220 else if (option == wxT("eol"))
221 StyleSetEOLFilled(styleNum, true);
222
223 else if (option == wxT("size")) {
224 long points;
225 if (val.ToLong(&points))
226 StyleSetSize(styleNum, points);
227 }
228
229 else if (option == wxT("face"))
230 StyleSetFaceName(styleNum, val);
231
232 else if (option == wxT("fore"))
233 StyleSetForeground(styleNum, wxColourFromSpec(val));
234
235 else if (option == wxT("back"))
236 StyleSetBackground(styleNum, wxColourFromSpec(val));
237 }
238 }
239
240
241 // Set style size, face, bold, italic, and underline attributes from
242 // a wxFont's attributes.
243 void wxStyledTextCtrl::StyleSetFont(int styleNum, wxFont& font) {
244 int size = font.GetPointSize();
245 wxString faceName = font.GetFaceName();
246 bool bold = font.GetWeight() == wxBOLD;
247 bool italic = font.GetStyle() != wxNORMAL;
248 bool under = font.GetUnderlined();
249
250 // TODO: add encoding/charset mapping
251 StyleSetFontAttr(styleNum, size, faceName, bold, italic, under);
252 }
253
254 // Set all font style attributes at once.
255 void wxStyledTextCtrl::StyleSetFontAttr(int styleNum, int size,
256 const wxString& faceName,
257 bool bold, bool italic,
258 bool underline) {
259 StyleSetSize(styleNum, size);
260 StyleSetFaceName(styleNum, faceName);
261 StyleSetBold(styleNum, bold);
262 StyleSetItalic(styleNum, italic);
263 StyleSetUnderline(styleNum, underline);
264
265 // TODO: add encoding/charset mapping
266 }
267
268
269 // Perform one of the operations defined by the wxSTC_CMD_* constants.
270 void wxStyledTextCtrl::CmdKeyExecute(int cmd) {
271 SendMsg(cmd);
272 }
273
274
275 // Set the left and right margin in the edit area, measured in pixels.
276 void wxStyledTextCtrl::SetMargins(int left, int right) {
277 SetMarginLeft(left);
278 SetMarginRight(right);
279 }
280
281
282 // Retrieve the start and end positions of the current selection.
283 void wxStyledTextCtrl::GetSelection(int* startPos, int* endPos) {
284 if (startPos != NULL)
285 *startPos = SendMsg(SCI_GETSELECTIONSTART);
286 if (endPos != NULL)
287 *endPos = SendMsg(SCI_GETSELECTIONEND);
288 }
289
290
291 // Retrieve the point in the window where a position is displayed.
292 wxPoint wxStyledTextCtrl::PointFromPosition(int pos) {
293 int x = SendMsg(SCI_POINTXFROMPOSITION, 0, pos);
294 int y = SendMsg(SCI_POINTYFROMPOSITION, 0, pos);
295 return wxPoint(x, y);
296 }
297
298 // Scroll enough to make the given line visible
299 void wxStyledTextCtrl::ScrollToLine(int line) {
300 m_swx->DoScrollToLine(line);
301 }
302
303
304 // Scroll enough to make the given column visible
305 void wxStyledTextCtrl::ScrollToColumn(int column) {
306 m_swx->DoScrollToColumn(column);
307 }
308
309
310
311 //----------------------------------------------------------------------
312 // Event handlers
313
314 void wxStyledTextCtrl::OnPaint(wxPaintEvent& evt) {
315 wxPaintDC dc(this);
316 m_swx->DoPaint(&dc, GetUpdateRegion().GetBox());
317 }
318
319 void wxStyledTextCtrl::OnScrollWin(wxScrollWinEvent& evt) {
320 if (evt.GetOrientation() == wxHORIZONTAL)
321 m_swx->DoHScroll(evt.GetEventType(), evt.GetPosition());
322 else
323 m_swx->DoVScroll(evt.GetEventType(), evt.GetPosition());
324 }
325
326 void wxStyledTextCtrl::OnScroll(wxScrollEvent& evt) {
327 wxScrollBar* sb = wxDynamicCast(evt.GetEventObject(), wxScrollBar);
328 if (sb) {
329 if (sb->IsVertical())
330 m_swx->DoVScroll(evt.GetEventType(), evt.GetPosition());
331 else
332 m_swx->DoHScroll(evt.GetEventType(), evt.GetPosition());
333 }
334 }
335
336 void wxStyledTextCtrl::OnSize(wxSizeEvent& evt) {
337 wxSize sz = GetClientSize();
338 m_swx->DoSize(sz.x, sz.y);
339 }
340
341 void wxStyledTextCtrl::OnMouseLeftDown(wxMouseEvent& evt) {
342 SetFocus();
343 wxPoint pt = evt.GetPosition();
344 m_swx->DoLeftButtonDown(Point(pt.x, pt.y), m_stopWatch.Time(),
345 evt.ShiftDown(), evt.ControlDown(), evt.AltDown());
346 }
347
348 void wxStyledTextCtrl::OnMouseMove(wxMouseEvent& evt) {
349 wxPoint pt = evt.GetPosition();
350 m_swx->DoLeftButtonMove(Point(pt.x, pt.y));
351 }
352
353 void wxStyledTextCtrl::OnMouseLeftUp(wxMouseEvent& evt) {
354 wxPoint pt = evt.GetPosition();
355 m_swx->DoLeftButtonUp(Point(pt.x, pt.y), m_stopWatch.Time(),
356 evt.ControlDown());
357 }
358
359
360 void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent& evt) {
361 wxPoint pt = evt.GetPosition();
362 m_swx->DoContextMenu(Point(pt.x, pt.y));
363 }
364
365
366 void wxStyledTextCtrl::OnMouseMiddleUp(wxMouseEvent& evt) {
367 wxPoint pt = evt.GetPosition();
368 m_swx->DoMiddleButtonUp(Point(pt.x, pt.y));
369 }
370
371 void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent& evt) {
372 wxPoint pt = evt.GetPosition();
373 ScreenToClient(&pt.x, &pt.y);
374 m_swx->DoContextMenu(Point(pt.x, pt.y));
375 }
376
377
378 void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent& evt) {
379 m_swx->DoMouseWheel(evt.GetWheelRotation(),
380 evt.GetWheelDelta(),
381 evt.GetLinesPerAction(),
382 evt.ControlDown(),
383 evt.IsPageScroll());
384 }
385
386
387 void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) {
388 // On (some?) non-US keyboards the AltGr key is required to enter some
389 // common characters. It comes to us as both Alt and Ctrl down so we need
390 // to let the char through in that case, otherwise if only ctrl or only
391 // alt let's skip it.
392 bool ctrl = evt.ControlDown();
393 bool alt = evt.AltDown();
394 bool skip = ((ctrl || alt) && ! (ctrl && alt));
395
396 int key = evt.GetKeyCode();
397
398 // printf("OnChar key:%%d consumed:%%d ctrl:%%d alt:%%d skip:%%d\n",
399 // key, m_lastKeyDownConsumed, ctrl, alt, skip);
400
401 if ( (key <= WXK_START || key > WXK_NUMPAD_DIVIDE) &&
402 !m_lastKeyDownConsumed && !skip) {
403 m_swx->DoAddChar(key);
404 return;
405 }
406 evt.Skip();
407 }
408
409
410 void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) {
411 int key = evt.GetKeyCode();
412 bool shift = evt.ShiftDown(),
413 ctrl = evt.ControlDown(),
414 alt = evt.AltDown();
415
416 int processed = m_swx->DoKeyDown(key, shift, ctrl, alt, &m_lastKeyDownConsumed);
417
418 // printf("KeyDn key:%%d shift:%%d ctrl:%%d alt:%%d processed:%%d consumed:%%d\n",
419 // key, shift, ctrl, alt, processed, m_lastKeyDownConsumed);
420
421 if (!processed && !m_lastKeyDownConsumed)
422 evt.Skip();
423 }
424
425
426 void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& evt) {
427 m_swx->DoLoseFocus();
428 }
429
430
431 void wxStyledTextCtrl::OnGainFocus(wxFocusEvent& evt) {
432 m_swx->DoGainFocus();
433 }
434
435
436 void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent& evt) {
437 m_swx->DoSysColourChange();
438 }
439
440
441 void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent& evt) {
442 // do nothing to help avoid flashing
443 }
444
445
446
447 void wxStyledTextCtrl::OnMenu(wxCommandEvent& evt) {
448 m_swx->DoCommand(evt.GetId());
449 }
450
451
452 void wxStyledTextCtrl::OnListBox(wxCommandEvent& evt) {
453 m_swx->DoOnListBox();
454 }
455
456
457 //----------------------------------------------------------------------
458 // Turn notifications from Scintilla into events
459
460
461 void wxStyledTextCtrl::NotifyChange() {
462 wxStyledTextEvent evt(wxEVT_STC_CHANGE, GetId());
463 evt.SetEventObject(this);
464 GetEventHandler()->ProcessEvent(evt);
465 }
466
467
468 static void SetEventText(wxStyledTextEvent& evt, const char* text,
469 size_t length) {
470 if(!text) return;
471
472 // The unicode conversion MUST have a null byte to terminate the
473 // string so move it into a buffer first and give it one.
474 wxMemoryBuffer buf(length+1);
475 buf.AppendData((void*)text, length);
476 buf.AppendByte(0);
477 evt.SetText(stc2wx(buf));
478 }
479
480
481 void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
482 SCNotification& scn = *_scn;
483 wxStyledTextEvent evt(0, GetId());
484
485 evt.SetEventObject(this);
486 evt.SetPosition(scn.position);
487 evt.SetKey(scn.ch);
488 evt.SetModifiers(scn.modifiers);
489
490 switch (scn.nmhdr.code) {
491 case SCN_STYLENEEDED:
492 evt.SetEventType(wxEVT_STC_STYLENEEDED);
493 break;
494
495 case SCN_CHARADDED:
496 evt.SetEventType(wxEVT_STC_CHARADDED);
497 break;
498
499 case SCN_SAVEPOINTREACHED:
500 evt.SetEventType(wxEVT_STC_SAVEPOINTREACHED);
501 break;
502
503 case SCN_SAVEPOINTLEFT:
504 evt.SetEventType(wxEVT_STC_SAVEPOINTLEFT);
505 break;
506
507 case SCN_MODIFYATTEMPTRO:
508 evt.SetEventType(wxEVT_STC_ROMODIFYATTEMPT);
509 break;
510
511 case SCN_KEY:
512 evt.SetEventType(wxEVT_STC_KEY);
513 break;
514
515 case SCN_DOUBLECLICK:
516 evt.SetEventType(wxEVT_STC_DOUBLECLICK);
517 break;
518
519 case SCN_UPDATEUI:
520 evt.SetEventType(wxEVT_STC_UPDATEUI);
521 break;
522
523 case SCN_MODIFIED:
524 evt.SetEventType(wxEVT_STC_MODIFIED);
525 evt.SetModificationType(scn.modificationType);
526 SetEventText(evt, scn.text, scn.length);
527 evt.SetLength(scn.length);
528 evt.SetLinesAdded(scn.linesAdded);
529 evt.SetLine(scn.line);
530 evt.SetFoldLevelNow(scn.foldLevelNow);
531 evt.SetFoldLevelPrev(scn.foldLevelPrev);
532 break;
533
534 case SCN_MACRORECORD:
535 evt.SetEventType(wxEVT_STC_MACRORECORD);
536 evt.SetMessage(scn.message);
537 evt.SetWParam(scn.wParam);
538 evt.SetLParam(scn.lParam);
539 break;
540
541 case SCN_MARGINCLICK:
542 evt.SetEventType(wxEVT_STC_MARGINCLICK);
543 evt.SetMargin(scn.margin);
544 break;
545
546 case SCN_NEEDSHOWN:
547 evt.SetEventType(wxEVT_STC_NEEDSHOWN);
548 evt.SetLength(scn.length);
549 break;
550
551 case SCN_PAINTED:
552 evt.SetEventType(wxEVT_STC_PAINTED);
553 break;
554
555 case SCN_USERLISTSELECTION:
556 evt.SetEventType(wxEVT_STC_USERLISTSELECTION);
557 evt.SetListType(scn.listType);
558 SetEventText(evt, scn.text, strlen(scn.text));
559 break;
560
561 case SCN_URIDROPPED:
562 evt.SetEventType(wxEVT_STC_URIDROPPED);
563 SetEventText(evt, scn.text, strlen(scn.text));
564 break;
565
566 case SCN_DWELLSTART:
567 evt.SetEventType(wxEVT_STC_DWELLSTART);
568 evt.SetX(scn.x);
569 evt.SetY(scn.y);
570 break;
571
572 case SCN_DWELLEND:
573 evt.SetEventType(wxEVT_STC_DWELLEND);
574 evt.SetX(scn.x);
575 evt.SetY(scn.y);
576 break;
577
578 case SCN_ZOOM:
579 evt.SetEventType(wxEVT_STC_ZOOM);
580 break;
581
582 case SCN_HOTSPOTCLICK:
583 evt.SetEventType(wxEVT_STC_HOTSPOT_CLICK);
584 break;
585
586 case SCN_HOTSPOTDOUBLECLICK:
587 evt.SetEventType(wxEVT_STC_HOTSPOT_DCLICK);
588 break;
589
590 case SCN_CALLTIPCLICK:
591 evt.SetEventType(wxEVT_STC_CALLTIP_CLICK);
592 break;
593
594 default:
595 return;
596 }
597
598 GetEventHandler()->ProcessEvent(evt);
599 }
600
601
602 //----------------------------------------------------------------------
603 //----------------------------------------------------------------------
604 //----------------------------------------------------------------------
605
606 wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType, int id)
607 : wxCommandEvent(commandType, id)
608 {
609 m_position = 0;
610 m_key = 0;
611 m_modifiers = 0;
612 m_modificationType = 0;
613 m_length = 0;
614 m_linesAdded = 0;
615 m_line = 0;
616 m_foldLevelNow = 0;
617 m_foldLevelPrev = 0;
618 m_margin = 0;
619 m_message = 0;
620 m_wParam = 0;
621 m_lParam = 0;
622 m_listType = 0;
623 m_x = 0;
624 m_y = 0;
625 m_dragAllowMove = FALSE;
626 #if wxUSE_DRAG_AND_DROP
627 m_dragResult = wxDragNone;
628 #endif
629 }
630
631 bool wxStyledTextEvent::GetShift() const { return (m_modifiers & SCI_SHIFT) != 0; }
632 bool wxStyledTextEvent::GetControl() const { return (m_modifiers & SCI_CTRL) != 0; }
633 bool wxStyledTextEvent::GetAlt() const { return (m_modifiers & SCI_ALT) != 0; }
634
635
636 wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent& event):
637 wxCommandEvent(event)
638 {
639 m_position = event.m_position;
640 m_key = event.m_key;
641 m_modifiers = event.m_modifiers;
642 m_modificationType = event.m_modificationType;
643 m_text = event.m_text;
644 m_length = event.m_length;
645 m_linesAdded = event.m_linesAdded;
646 m_line = event.m_line;
647 m_foldLevelNow = event.m_foldLevelNow;
648 m_foldLevelPrev = event.m_foldLevelPrev;
649
650 m_margin = event.m_margin;
651
652 m_message = event.m_message;
653 m_wParam = event.m_wParam;
654 m_lParam = event.m_lParam;
655
656 m_listType = event.m_listType;
657 m_x = event.m_x;
658 m_y = event.m_y;
659
660 m_dragText = event.m_dragText;
661 m_dragAllowMove =event.m_dragAllowMove;
662 #if wxUSE_DRAG_AND_DROP
663 m_dragResult = event.m_dragResult;
664 #endif
665 }
666
667 //----------------------------------------------------------------------
668 //----------------------------------------------------------------------
669
670
671
672
673
674
675
676
677