1 ////////////////////////////////////////////////////////////////////////////
3 // Purpose: A wxWidgets implementation of Scintilla. This class is the
4 // one meant to be used directly by wx applications. It does not
5 // derive directly from the Scintilla classes, but instead
6 // delegates most things to the real Scintilla class.
7 // This allows the use of Scintilla without polluting the
8 // namespace with all the classes and identifiers from Scintilla.
12 // Created: 13-Jan-2000
14 // Copyright: (c) 2000 by Total Control Software
15 // Licence: wxWindows license
16 /////////////////////////////////////////////////////////////////////////////
20 #define Point macPoint // These names are also defined by some mac headers so
21 #define Style macStyle // change their names, and then undef before we need them
24 #include <wx/tokenzr.h>
25 #include <wx/mstream.h>
32 #include "wx/stc/stc.h"
33 #include "ScintillaWX.h"
35 //----------------------------------------------------------------------
37 const wxChar
* wxSTCNameStr
= wxT("stcwindow");
43 #define MAKELONG(a, b) ((a) | ((b) << 16))
46 static long wxColourAsLong(const wxColour
& co
) {
47 return (((long)co
.Blue() << 16) |
48 ((long)co
.Green() << 8) |
52 static wxColour
wxColourFromLong(long c
) {
54 clr
.Set((unsigned char)(c
& 0xff),
55 (unsigned char)((c
>> 8) & 0xff),
56 (unsigned char)((c
>> 16) & 0xff));
61 static wxColour
wxColourFromSpec(const wxString
& spec
) {
62 // spec should be a colour name or "#RRGGBB"
63 if (spec
.GetChar(0) == wxT('#')) {
65 long red
, green
, blue
;
66 red
= green
= blue
= 0;
67 spec
.Mid(1,2).ToLong(&red
, 16);
68 spec
.Mid(3,2).ToLong(&green
, 16);
69 spec
.Mid(5,2).ToLong(&blue
, 16);
70 return wxColour((unsigned char)red
,
75 return wxColour(spec
);
78 //----------------------------------------------------------------------
80 DEFINE_EVENT_TYPE( wxEVT_STC_CHANGE
)
81 DEFINE_EVENT_TYPE( wxEVT_STC_STYLENEEDED
)
82 DEFINE_EVENT_TYPE( wxEVT_STC_CHARADDED
)
83 DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTREACHED
)
84 DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTLEFT
)
85 DEFINE_EVENT_TYPE( wxEVT_STC_ROMODIFYATTEMPT
)
86 DEFINE_EVENT_TYPE( wxEVT_STC_KEY
)
87 DEFINE_EVENT_TYPE( wxEVT_STC_DOUBLECLICK
)
88 DEFINE_EVENT_TYPE( wxEVT_STC_UPDATEUI
)
89 DEFINE_EVENT_TYPE( wxEVT_STC_MODIFIED
)
90 DEFINE_EVENT_TYPE( wxEVT_STC_MACRORECORD
)
91 DEFINE_EVENT_TYPE( wxEVT_STC_MARGINCLICK
)
92 DEFINE_EVENT_TYPE( wxEVT_STC_NEEDSHOWN
)
93 DEFINE_EVENT_TYPE( wxEVT_STC_PAINTED
)
94 DEFINE_EVENT_TYPE( wxEVT_STC_USERLISTSELECTION
)
95 DEFINE_EVENT_TYPE( wxEVT_STC_URIDROPPED
)
96 DEFINE_EVENT_TYPE( wxEVT_STC_DWELLSTART
)
97 DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND
)
98 DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG
)
99 DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER
)
100 DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP
)
101 DEFINE_EVENT_TYPE( wxEVT_STC_ZOOM
)
102 DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_CLICK
)
103 DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_DCLICK
)
104 DEFINE_EVENT_TYPE( wxEVT_STC_CALLTIP_CLICK
)
108 BEGIN_EVENT_TABLE(wxStyledTextCtrl
, wxControl
)
109 EVT_PAINT (wxStyledTextCtrl::OnPaint
)
110 EVT_SCROLLWIN (wxStyledTextCtrl::OnScrollWin
)
111 EVT_SCROLL (wxStyledTextCtrl::OnScroll
)
112 EVT_SIZE (wxStyledTextCtrl::OnSize
)
113 EVT_LEFT_DOWN (wxStyledTextCtrl::OnMouseLeftDown
)
114 // Let Scintilla see the double click as a second click
115 EVT_LEFT_DCLICK (wxStyledTextCtrl::OnMouseLeftDown
)
116 EVT_MOTION (wxStyledTextCtrl::OnMouseMove
)
117 EVT_LEFT_UP (wxStyledTextCtrl::OnMouseLeftUp
)
118 #if defined(__WXGTK__) || defined(__WXMAC__)
119 EVT_RIGHT_UP (wxStyledTextCtrl::OnMouseRightUp
)
121 EVT_CONTEXT_MENU (wxStyledTextCtrl::OnContextMenu
)
123 EVT_MOUSEWHEEL (wxStyledTextCtrl::OnMouseWheel
)
124 EVT_MIDDLE_UP (wxStyledTextCtrl::OnMouseMiddleUp
)
125 EVT_CHAR (wxStyledTextCtrl::OnChar
)
126 EVT_KEY_DOWN (wxStyledTextCtrl::OnKeyDown
)
127 EVT_KILL_FOCUS (wxStyledTextCtrl::OnLoseFocus
)
128 EVT_SET_FOCUS (wxStyledTextCtrl::OnGainFocus
)
129 EVT_SYS_COLOUR_CHANGED (wxStyledTextCtrl::OnSysColourChanged
)
130 EVT_ERASE_BACKGROUND (wxStyledTextCtrl::OnEraseBackground
)
131 EVT_MENU_RANGE (10, 16, wxStyledTextCtrl::OnMenu
)
132 EVT_LISTBOX_DCLICK (wxID_ANY
, wxStyledTextCtrl::OnListBox
)
136 IMPLEMENT_CLASS(wxStyledTextCtrl
, wxControl
)
137 IMPLEMENT_DYNAMIC_CLASS(wxStyledTextEvent
, wxCommandEvent
)
140 // forces the linking of the lexer modules
141 int Scintilla_LinkLexers();
144 //----------------------------------------------------------------------
145 // Constructor and Destructor
147 wxStyledTextCtrl::wxStyledTextCtrl(wxWindow
*parent
,
152 const wxString
& name
)
155 Create(parent
, id
, pos
, size
, style
, name
);
159 void wxStyledTextCtrl::Create(wxWindow
*parent
,
164 const wxString
& name
)
167 style
|= wxVSCROLL
| wxHSCROLL
;
169 wxControl::Create(parent
, id
, pos
, size
,
170 style
| wxWANTS_CHARS
| wxCLIP_CHILDREN
,
171 wxDefaultValidator
, name
);
174 Scintilla_LinkLexers();
176 m_swx
= new ScintillaWX(this);
178 m_lastKeyDownConsumed
= false;
182 // Put Scintilla into unicode (UTF-8) mode
183 SetCodePage(wxSTC_CP_UTF8
);
186 SetBestFittingSize(size
);
188 // Reduces flicker on GTK+/X11
189 SetBackgroundStyle(wxBG_STYLE_CUSTOM
);
193 wxStyledTextCtrl::~wxStyledTextCtrl() {
198 //----------------------------------------------------------------------
200 long wxStyledTextCtrl::SendMsg(int msg
, long wp
, long lp
) {
202 return m_swx
->WndProc(msg
, wp
, lp
);
205 //----------------------------------------------------------------------
207 // Set the vertical scrollbar to use instead of the ont that's built-in.
208 void wxStyledTextCtrl::SetVScrollBar(wxScrollBar
* bar
) {
211 // ensure that the built-in scrollbar is not visible
212 SetScrollbar(wxVERTICAL
, 0, 0, 0);
217 // Set the horizontal scrollbar to use instead of the ont that's built-in.
218 void wxStyledTextCtrl::SetHScrollBar(wxScrollBar
* bar
) {
221 // ensure that the built-in scrollbar is not visible
222 SetScrollbar(wxHORIZONTAL
, 0, 0, 0);
226 //----------------------------------------------------------------------
227 // BEGIN generated section. The following code is automatically generated
228 // by gen_iface.py from the contents of Scintilla.iface. Do not edit
229 // this file. Edit stc.cpp.in or gen_iface.py instead and regenerate.
233 // END of generated section
234 //----------------------------------------------------------------------
237 // Returns the line number of the line with the caret.
238 int wxStyledTextCtrl::GetCurrentLine() {
239 int line
= LineFromPosition(GetCurrentPos());
244 // Extract style settings from a spec-string which is composed of one or
245 // more of the following comma separated elements:
247 // bold turns on bold
248 // italic turns on italics
249 // fore:[name or #RRGGBB] sets the foreground colour
250 // back:[name or #RRGGBB] sets the background colour
251 // face:[facename] sets the font face name to use
252 // size:[num] sets the font size in points
253 // eol turns on eol filling
254 // underline turns on underlining
256 void wxStyledTextCtrl::StyleSetSpec(int styleNum
, const wxString
& spec
) {
258 wxStringTokenizer
tkz(spec
, wxT(","));
259 while (tkz
.HasMoreTokens()) {
260 wxString token
= tkz
.GetNextToken();
262 wxString option
= token
.BeforeFirst(':');
263 wxString val
= token
.AfterFirst(':');
265 if (option
== wxT("bold"))
266 StyleSetBold(styleNum
, true);
268 else if (option
== wxT("italic"))
269 StyleSetItalic(styleNum
, true);
271 else if (option
== wxT("underline"))
272 StyleSetUnderline(styleNum
, true);
274 else if (option
== wxT("eol"))
275 StyleSetEOLFilled(styleNum
, true);
277 else if (option
== wxT("size")) {
279 if (val
.ToLong(&points
))
280 StyleSetSize(styleNum
, points
);
283 else if (option
== wxT("face"))
284 StyleSetFaceName(styleNum
, val
);
286 else if (option
== wxT("fore"))
287 StyleSetForeground(styleNum
, wxColourFromSpec(val
));
289 else if (option
== wxT("back"))
290 StyleSetBackground(styleNum
, wxColourFromSpec(val
));
295 // Set style size, face, bold, italic, and underline attributes from
296 // a wxFont's attributes.
297 void wxStyledTextCtrl::StyleSetFont(int styleNum
, wxFont
& font
) {
299 // Ensure that the native font is initialized
301 GetTextExtent(wxT("X"), &x
, &y
, NULL
, NULL
, &font
);
303 int size
= font
.GetPointSize();
304 wxString faceName
= font
.GetFaceName();
305 bool bold
= font
.GetWeight() == wxBOLD
;
306 bool italic
= font
.GetStyle() != wxNORMAL
;
307 bool under
= font
.GetUnderlined();
309 // TODO: add encoding/charset mapping
310 StyleSetFontAttr(styleNum
, size
, faceName
, bold
, italic
, under
);
313 // Set all font style attributes at once.
314 void wxStyledTextCtrl::StyleSetFontAttr(int styleNum
, int size
,
315 const wxString
& faceName
,
316 bool bold
, bool italic
,
318 StyleSetSize(styleNum
, size
);
319 StyleSetFaceName(styleNum
, faceName
);
320 StyleSetBold(styleNum
, bold
);
321 StyleSetItalic(styleNum
, italic
);
322 StyleSetUnderline(styleNum
, underline
);
324 // TODO: add encoding/charset mapping
328 // Perform one of the operations defined by the wxSTC_CMD_* constants.
329 void wxStyledTextCtrl::CmdKeyExecute(int cmd
) {
334 // Set the left and right margin in the edit area, measured in pixels.
335 void wxStyledTextCtrl::SetMargins(int left
, int right
) {
337 SetMarginRight(right
);
341 // Retrieve the start and end positions of the current selection.
342 void wxStyledTextCtrl::GetSelection(int* startPos
, int* endPos
) {
343 if (startPos
!= NULL
)
344 *startPos
= SendMsg(SCI_GETSELECTIONSTART
);
346 *endPos
= SendMsg(SCI_GETSELECTIONEND
);
350 // Retrieve the point in the window where a position is displayed.
351 wxPoint
wxStyledTextCtrl::PointFromPosition(int pos
) {
352 int x
= SendMsg(SCI_POINTXFROMPOSITION
, 0, pos
);
353 int y
= SendMsg(SCI_POINTYFROMPOSITION
, 0, pos
);
354 return wxPoint(x
, y
);
357 // Scroll enough to make the given line visible
358 void wxStyledTextCtrl::ScrollToLine(int line
) {
359 m_swx
->DoScrollToLine(line
);
363 // Scroll enough to make the given column visible
364 void wxStyledTextCtrl::ScrollToColumn(int column
) {
365 m_swx
->DoScrollToColumn(column
);
369 bool wxStyledTextCtrl::SaveFile(const wxString
& filename
)
371 wxFile
file(filename
, wxFile::write
);
373 if (!file
.IsOpened())
376 bool success
= file
.Write(GetText(), *wxConvCurrent
);
384 bool wxStyledTextCtrl::LoadFile(const wxString
& filename
)
386 bool success
= false;
387 wxFile
file(filename
, wxFile::read
);
392 // get the file size (assume it is not huge file...)
393 ssize_t len
= (ssize_t
)file
.Length();
398 wxMemoryBuffer
buffer(len
+1);
399 success
= (file
.Read(buffer
.GetData(), len
) == len
);
401 ((char*)buffer
.GetData())[len
] = 0;
402 contents
= wxString(buffer
, *wxConvCurrent
, len
);
406 success
= (file
.Read(wxStringBuffer(buffer
, len
), len
) == len
);
413 success
= true; // empty file is ok
415 success
= false; // len == wxInvalidOffset
430 #if wxUSE_DRAG_AND_DROP
431 wxDragResult
wxStyledTextCtrl::DoDragOver(wxCoord x
, wxCoord y
, wxDragResult def
) {
432 return m_swx
->DoDragOver(x
, y
, def
);
436 bool wxStyledTextCtrl::DoDropText(long x
, long y
, const wxString
& data
) {
437 return m_swx
->DoDropText(x
, y
, data
);
442 void wxStyledTextCtrl::SetUseAntiAliasing(bool useAA
) {
443 m_swx
->SetUseAntiAliasing(useAA
);
446 bool wxStyledTextCtrl::GetUseAntiAliasing() {
447 return m_swx
->GetUseAntiAliasing();
450 //----------------------------------------------------------------------
453 void wxStyledTextCtrl::OnPaint(wxPaintEvent
& WXUNUSED(evt
)) {
455 m_swx
->DoPaint(&dc
, GetUpdateRegion().GetBox());
458 void wxStyledTextCtrl::OnScrollWin(wxScrollWinEvent
& evt
) {
459 if (evt
.GetOrientation() == wxHORIZONTAL
)
460 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
462 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
465 void wxStyledTextCtrl::OnScroll(wxScrollEvent
& evt
) {
466 wxScrollBar
* sb
= wxDynamicCast(evt
.GetEventObject(), wxScrollBar
);
468 if (sb
->IsVertical())
469 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
471 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
475 void wxStyledTextCtrl::OnSize(wxSizeEvent
& WXUNUSED(evt
)) {
477 wxSize sz
= GetClientSize();
478 m_swx
->DoSize(sz
.x
, sz
.y
);
482 void wxStyledTextCtrl::OnMouseLeftDown(wxMouseEvent
& evt
) {
484 wxPoint pt
= evt
.GetPosition();
485 m_swx
->DoLeftButtonDown(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
486 evt
.ShiftDown(), evt
.ControlDown(), evt
.AltDown());
489 void wxStyledTextCtrl::OnMouseMove(wxMouseEvent
& evt
) {
490 wxPoint pt
= evt
.GetPosition();
491 m_swx
->DoLeftButtonMove(Point(pt
.x
, pt
.y
));
494 void wxStyledTextCtrl::OnMouseLeftUp(wxMouseEvent
& evt
) {
495 wxPoint pt
= evt
.GetPosition();
496 m_swx
->DoLeftButtonUp(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
501 void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent
& evt
) {
502 wxPoint pt
= evt
.GetPosition();
503 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
507 void wxStyledTextCtrl::OnMouseMiddleUp(wxMouseEvent
& evt
) {
508 wxPoint pt
= evt
.GetPosition();
509 m_swx
->DoMiddleButtonUp(Point(pt
.x
, pt
.y
));
512 void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent
& evt
) {
513 wxPoint pt
= evt
.GetPosition();
514 ScreenToClient(&pt
.x
, &pt
.y
);
516 Show context menu at event point if it's within the window,
517 or at caret location if not
519 wxHitTest ht
= this->HitTest(pt
);
520 if (ht
!= wxHT_WINDOW_INSIDE
) {
521 pt
= this->PointFromPosition(this->GetCurrentPos());
523 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
527 void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent
& evt
) {
528 m_swx
->DoMouseWheel(evt
.GetWheelRotation(),
530 evt
.GetLinesPerAction(),
536 void wxStyledTextCtrl::OnChar(wxKeyEvent
& evt
) {
537 // On (some?) non-US PC keyboards the AltGr key is required to enter some
538 // common characters. It comes to us as both Alt and Ctrl down so we need
539 // to let the char through in that case, otherwise if only ctrl or only
540 // alt let's skip it.
541 bool ctrl
= evt
.ControlDown();
543 // On the Mac the Alt key is just a modifier key (like Shift) so we need
544 // to allow the char events to be processed when Alt is pressed.
545 // TODO: Should we check MetaDown instead in this case?
548 bool alt
= evt
.AltDown();
550 bool skip
= ((ctrl
|| alt
) && ! (ctrl
&& alt
));
552 if (!m_lastKeyDownConsumed
&& !skip
) {
554 int key
= evt
.GetUnicodeKey();
557 // if the unicode key code is not really a unicode character (it may
558 // be a function key or etc., the platforms appear to always give us a
559 // small value in this case) then fallback to the ascii key code but
560 // don't do anything for function keys or etc.
562 key
= evt
.GetKeyCode();
563 keyOk
= (key
<= 127);
566 m_swx
->DoAddChar(key
);
570 int key
= evt
.GetKeyCode();
571 if (key
<= WXK_START
|| key
> WXK_COMMAND
) {
572 m_swx
->DoAddChar(key
);
582 void wxStyledTextCtrl::OnKeyDown(wxKeyEvent
& evt
) {
583 int processed
= m_swx
->DoKeyDown(evt
, &m_lastKeyDownConsumed
);
584 if (!processed
&& !m_lastKeyDownConsumed
)
589 void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent
& evt
) {
590 m_swx
->DoLoseFocus();
595 void wxStyledTextCtrl::OnGainFocus(wxFocusEvent
& evt
) {
596 m_swx
->DoGainFocus();
601 void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent
& WXUNUSED(evt
)) {
602 m_swx
->DoSysColourChange();
606 void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent
& WXUNUSED(evt
)) {
607 // do nothing to help avoid flashing
612 void wxStyledTextCtrl::OnMenu(wxCommandEvent
& evt
) {
613 m_swx
->DoCommand(evt
.GetId());
617 void wxStyledTextCtrl::OnListBox(wxCommandEvent
& WXUNUSED(evt
)) {
618 m_swx
->DoOnListBox();
622 void wxStyledTextCtrl::OnIdle(wxIdleEvent
& evt
) {
623 m_swx
->DoOnIdle(evt
);
627 wxSize
wxStyledTextCtrl::DoGetBestSize() const
629 // What would be the best size for a wxSTC?
630 // Just give a reasonable minimum until something else can be figured out.
631 return wxSize(200,100);
635 //----------------------------------------------------------------------
636 // Turn notifications from Scintilla into events
639 void wxStyledTextCtrl::NotifyChange() {
640 wxStyledTextEvent
evt(wxEVT_STC_CHANGE
, GetId());
641 evt
.SetEventObject(this);
642 GetEventHandler()->ProcessEvent(evt
);
646 static void SetEventText(wxStyledTextEvent
& evt
, const char* text
,
650 // The unicode conversion MUST have a null byte to terminate the
651 // string so move it into a buffer first and give it one.
652 wxMemoryBuffer
buf(length
+1);
653 buf
.AppendData((void*)text
, length
);
655 evt
.SetText(stc2wx(buf
));
659 void wxStyledTextCtrl::NotifyParent(SCNotification
* _scn
) {
660 SCNotification
& scn
= *_scn
;
661 wxStyledTextEvent
evt(0, GetId());
663 evt
.SetEventObject(this);
664 evt
.SetPosition(scn
.position
);
666 evt
.SetModifiers(scn
.modifiers
);
668 switch (scn
.nmhdr
.code
) {
669 case SCN_STYLENEEDED
:
670 evt
.SetEventType(wxEVT_STC_STYLENEEDED
);
674 evt
.SetEventType(wxEVT_STC_CHARADDED
);
677 case SCN_SAVEPOINTREACHED
:
678 evt
.SetEventType(wxEVT_STC_SAVEPOINTREACHED
);
681 case SCN_SAVEPOINTLEFT
:
682 evt
.SetEventType(wxEVT_STC_SAVEPOINTLEFT
);
685 case SCN_MODIFYATTEMPTRO
:
686 evt
.SetEventType(wxEVT_STC_ROMODIFYATTEMPT
);
690 evt
.SetEventType(wxEVT_STC_KEY
);
693 case SCN_DOUBLECLICK
:
694 evt
.SetEventType(wxEVT_STC_DOUBLECLICK
);
698 evt
.SetEventType(wxEVT_STC_UPDATEUI
);
702 evt
.SetEventType(wxEVT_STC_MODIFIED
);
703 evt
.SetModificationType(scn
.modificationType
);
704 SetEventText(evt
, scn
.text
, scn
.length
);
705 evt
.SetLength(scn
.length
);
706 evt
.SetLinesAdded(scn
.linesAdded
);
707 evt
.SetLine(scn
.line
);
708 evt
.SetFoldLevelNow(scn
.foldLevelNow
);
709 evt
.SetFoldLevelPrev(scn
.foldLevelPrev
);
712 case SCN_MACRORECORD
:
713 evt
.SetEventType(wxEVT_STC_MACRORECORD
);
714 evt
.SetMessage(scn
.message
);
715 evt
.SetWParam(scn
.wParam
);
716 evt
.SetLParam(scn
.lParam
);
719 case SCN_MARGINCLICK
:
720 evt
.SetEventType(wxEVT_STC_MARGINCLICK
);
721 evt
.SetMargin(scn
.margin
);
725 evt
.SetEventType(wxEVT_STC_NEEDSHOWN
);
726 evt
.SetLength(scn
.length
);
730 evt
.SetEventType(wxEVT_STC_PAINTED
);
733 case SCN_USERLISTSELECTION
:
734 evt
.SetEventType(wxEVT_STC_USERLISTSELECTION
);
735 evt
.SetListType(scn
.listType
);
736 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
740 evt
.SetEventType(wxEVT_STC_URIDROPPED
);
741 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
745 evt
.SetEventType(wxEVT_STC_DWELLSTART
);
751 evt
.SetEventType(wxEVT_STC_DWELLEND
);
757 evt
.SetEventType(wxEVT_STC_ZOOM
);
760 case SCN_HOTSPOTCLICK
:
761 evt
.SetEventType(wxEVT_STC_HOTSPOT_CLICK
);
764 case SCN_HOTSPOTDOUBLECLICK
:
765 evt
.SetEventType(wxEVT_STC_HOTSPOT_DCLICK
);
768 case SCN_CALLTIPCLICK
:
769 evt
.SetEventType(wxEVT_STC_CALLTIP_CLICK
);
776 GetEventHandler()->ProcessEvent(evt
);
780 //----------------------------------------------------------------------
781 //----------------------------------------------------------------------
782 //----------------------------------------------------------------------
784 wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType
, int id
)
785 : wxCommandEvent(commandType
, id
)
790 m_modificationType
= 0;
803 m_dragAllowMove
= false;
804 #if wxUSE_DRAG_AND_DROP
805 m_dragResult
= wxDragNone
;
809 bool wxStyledTextEvent::GetShift() const { return (m_modifiers
& SCI_SHIFT
) != 0; }
810 bool wxStyledTextEvent::GetControl() const { return (m_modifiers
& SCI_CTRL
) != 0; }
811 bool wxStyledTextEvent::GetAlt() const { return (m_modifiers
& SCI_ALT
) != 0; }
814 wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent
& event
):
815 wxCommandEvent(event
)
817 m_position
= event
.m_position
;
819 m_modifiers
= event
.m_modifiers
;
820 m_modificationType
= event
.m_modificationType
;
821 m_text
= event
.m_text
;
822 m_length
= event
.m_length
;
823 m_linesAdded
= event
.m_linesAdded
;
824 m_line
= event
.m_line
;
825 m_foldLevelNow
= event
.m_foldLevelNow
;
826 m_foldLevelPrev
= event
.m_foldLevelPrev
;
828 m_margin
= event
.m_margin
;
830 m_message
= event
.m_message
;
831 m_wParam
= event
.m_wParam
;
832 m_lParam
= event
.m_lParam
;
834 m_listType
= event
.m_listType
;
838 m_dragText
= event
.m_dragText
;
839 m_dragAllowMove
=event
.m_dragAllowMove
;
840 #if wxUSE_DRAG_AND_DROP
841 m_dragResult
= event
.m_dragResult
;
845 //----------------------------------------------------------------------
846 //----------------------------------------------------------------------