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 #include "wx/stc/stc.h"
21 #include "ScintillaWX.h"
24 #include <wx/tokenzr.h>
25 #include <wx/mstream.h>
30 //----------------------------------------------------------------------
32 const wxChar
* wxSTCNameStr
= wxT("stcwindow");
38 #define MAKELONG(a, b) ((a) | ((b) << 16))
41 static long wxColourAsLong(const wxColour
& co
) {
42 return (((long)co
.Blue() << 16) |
43 ((long)co
.Green() << 8) |
47 static wxColour
wxColourFromLong(long c
) {
49 clr
.Set((unsigned char)(c
& 0xff),
50 (unsigned char)((c
>> 8) & 0xff),
51 (unsigned char)((c
>> 16) & 0xff));
56 static wxColour
wxColourFromSpec(const wxString
& spec
) {
57 // spec should be a colour name or "#RRGGBB"
58 if (spec
.GetChar(0) == wxT('#')) {
60 long red
, green
, blue
;
61 red
= green
= blue
= 0;
62 spec
.Mid(1,2).ToLong(&red
, 16);
63 spec
.Mid(3,2).ToLong(&green
, 16);
64 spec
.Mid(5,2).ToLong(&blue
, 16);
65 return wxColour((unsigned char)red
,
70 return wxColour(spec
);
73 //----------------------------------------------------------------------
75 DEFINE_EVENT_TYPE( wxEVT_STC_CHANGE
)
76 DEFINE_EVENT_TYPE( wxEVT_STC_STYLENEEDED
)
77 DEFINE_EVENT_TYPE( wxEVT_STC_CHARADDED
)
78 DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTREACHED
)
79 DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTLEFT
)
80 DEFINE_EVENT_TYPE( wxEVT_STC_ROMODIFYATTEMPT
)
81 DEFINE_EVENT_TYPE( wxEVT_STC_KEY
)
82 DEFINE_EVENT_TYPE( wxEVT_STC_DOUBLECLICK
)
83 DEFINE_EVENT_TYPE( wxEVT_STC_UPDATEUI
)
84 DEFINE_EVENT_TYPE( wxEVT_STC_MODIFIED
)
85 DEFINE_EVENT_TYPE( wxEVT_STC_MACRORECORD
)
86 DEFINE_EVENT_TYPE( wxEVT_STC_MARGINCLICK
)
87 DEFINE_EVENT_TYPE( wxEVT_STC_NEEDSHOWN
)
88 DEFINE_EVENT_TYPE( wxEVT_STC_PAINTED
)
89 DEFINE_EVENT_TYPE( wxEVT_STC_USERLISTSELECTION
)
90 DEFINE_EVENT_TYPE( wxEVT_STC_URIDROPPED
)
91 DEFINE_EVENT_TYPE( wxEVT_STC_DWELLSTART
)
92 DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND
)
93 DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG
)
94 DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER
)
95 DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP
)
96 DEFINE_EVENT_TYPE( wxEVT_STC_ZOOM
)
97 DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_CLICK
)
98 DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_DCLICK
)
99 DEFINE_EVENT_TYPE( wxEVT_STC_CALLTIP_CLICK
)
103 BEGIN_EVENT_TABLE(wxStyledTextCtrl
, wxControl
)
104 EVT_PAINT (wxStyledTextCtrl::OnPaint
)
105 EVT_SCROLLWIN (wxStyledTextCtrl::OnScrollWin
)
106 EVT_SCROLL (wxStyledTextCtrl::OnScroll
)
107 EVT_SIZE (wxStyledTextCtrl::OnSize
)
108 EVT_LEFT_DOWN (wxStyledTextCtrl::OnMouseLeftDown
)
109 // Let Scintilla see the double click as a second click
110 EVT_LEFT_DCLICK (wxStyledTextCtrl::OnMouseLeftDown
)
111 EVT_MOTION (wxStyledTextCtrl::OnMouseMove
)
112 EVT_LEFT_UP (wxStyledTextCtrl::OnMouseLeftUp
)
113 #if defined(__WXGTK__) || defined(__WXMAC__)
114 EVT_RIGHT_UP (wxStyledTextCtrl::OnMouseRightUp
)
116 EVT_CONTEXT_MENU (wxStyledTextCtrl::OnContextMenu
)
118 EVT_MOUSEWHEEL (wxStyledTextCtrl::OnMouseWheel
)
119 EVT_MIDDLE_UP (wxStyledTextCtrl::OnMouseMiddleUp
)
120 EVT_CHAR (wxStyledTextCtrl::OnChar
)
121 EVT_KEY_DOWN (wxStyledTextCtrl::OnKeyDown
)
122 EVT_KILL_FOCUS (wxStyledTextCtrl::OnLoseFocus
)
123 EVT_SET_FOCUS (wxStyledTextCtrl::OnGainFocus
)
124 EVT_SYS_COLOUR_CHANGED (wxStyledTextCtrl::OnSysColourChanged
)
125 EVT_ERASE_BACKGROUND (wxStyledTextCtrl::OnEraseBackground
)
126 EVT_MENU_RANGE (10, 16, wxStyledTextCtrl::OnMenu
)
127 EVT_LISTBOX_DCLICK (wxID_ANY
, wxStyledTextCtrl::OnListBox
)
131 IMPLEMENT_CLASS(wxStyledTextCtrl
, wxControl
)
132 IMPLEMENT_DYNAMIC_CLASS(wxStyledTextEvent
, wxCommandEvent
)
135 // forces the linking of the lexer modules
136 int Scintilla_LinkLexers();
139 //----------------------------------------------------------------------
140 // Constructor and Destructor
142 wxStyledTextCtrl::wxStyledTextCtrl(wxWindow
*parent
,
147 const wxString
& name
)
150 Create(parent
, id
, pos
, size
, style
, name
);
154 void wxStyledTextCtrl::Create(wxWindow
*parent
,
159 const wxString
& name
)
162 style
|= wxVSCROLL
| wxHSCROLL
;
164 wxControl::Create(parent
, id
, pos
, size
,
165 style
| wxWANTS_CHARS
| wxCLIP_CHILDREN
,
166 wxDefaultValidator
, name
);
169 Scintilla_LinkLexers();
171 m_swx
= new ScintillaWX(this);
173 m_lastKeyDownConsumed
= false;
177 // Put Scintilla into unicode (UTF-8) mode
178 SetCodePage(wxSTC_CP_UTF8
);
181 SetBestFittingSize(size
);
185 wxStyledTextCtrl::~wxStyledTextCtrl() {
190 //----------------------------------------------------------------------
192 long wxStyledTextCtrl::SendMsg(int msg
, long wp
, long lp
) {
194 return m_swx
->WndProc(msg
, wp
, lp
);
197 //----------------------------------------------------------------------
199 // Set the vertical scrollbar to use instead of the ont that's built-in.
200 void wxStyledTextCtrl::SetVScrollBar(wxScrollBar
* bar
) {
203 // ensure that the built-in scrollbar is not visible
204 SetScrollbar(wxVERTICAL
, 0, 0, 0);
209 // Set the horizontal scrollbar to use instead of the ont that's built-in.
210 void wxStyledTextCtrl::SetHScrollBar(wxScrollBar
* bar
) {
213 // ensure that the built-in scrollbar is not visible
214 SetScrollbar(wxHORIZONTAL
, 0, 0, 0);
218 //----------------------------------------------------------------------
219 // BEGIN generated section. The following code is automatically generated
220 // by gen_iface.py from the contents of Scintilla.iface. Do not edit
221 // this file. Edit stc.cpp.in or gen_iface.py instead and regenerate.
225 // END of generated section
226 //----------------------------------------------------------------------
229 // Returns the line number of the line with the caret.
230 int wxStyledTextCtrl::GetCurrentLine() {
231 int line
= LineFromPosition(GetCurrentPos());
236 // Extract style settings from a spec-string which is composed of one or
237 // more of the following comma separated elements:
239 // bold turns on bold
240 // italic turns on italics
241 // fore:[name or #RRGGBB] sets the foreground colour
242 // back:[name or #RRGGBB] sets the background colour
243 // face:[facename] sets the font face name to use
244 // size:[num] sets the font size in points
245 // eol turns on eol filling
246 // underline turns on underlining
248 void wxStyledTextCtrl::StyleSetSpec(int styleNum
, const wxString
& spec
) {
250 wxStringTokenizer
tkz(spec
, wxT(","));
251 while (tkz
.HasMoreTokens()) {
252 wxString token
= tkz
.GetNextToken();
254 wxString option
= token
.BeforeFirst(':');
255 wxString val
= token
.AfterFirst(':');
257 if (option
== wxT("bold"))
258 StyleSetBold(styleNum
, true);
260 else if (option
== wxT("italic"))
261 StyleSetItalic(styleNum
, true);
263 else if (option
== wxT("underline"))
264 StyleSetUnderline(styleNum
, true);
266 else if (option
== wxT("eol"))
267 StyleSetEOLFilled(styleNum
, true);
269 else if (option
== wxT("size")) {
271 if (val
.ToLong(&points
))
272 StyleSetSize(styleNum
, points
);
275 else if (option
== wxT("face"))
276 StyleSetFaceName(styleNum
, val
);
278 else if (option
== wxT("fore"))
279 StyleSetForeground(styleNum
, wxColourFromSpec(val
));
281 else if (option
== wxT("back"))
282 StyleSetBackground(styleNum
, wxColourFromSpec(val
));
287 // Set style size, face, bold, italic, and underline attributes from
288 // a wxFont's attributes.
289 void wxStyledTextCtrl::StyleSetFont(int styleNum
, wxFont
& font
) {
291 // Ensure that the native font is initialized
293 GetTextExtent(wxT("X"), &x
, &y
, NULL
, NULL
, &font
);
295 int size
= font
.GetPointSize();
296 wxString faceName
= font
.GetFaceName();
297 bool bold
= font
.GetWeight() == wxBOLD
;
298 bool italic
= font
.GetStyle() != wxNORMAL
;
299 bool under
= font
.GetUnderlined();
301 // TODO: add encoding/charset mapping
302 StyleSetFontAttr(styleNum
, size
, faceName
, bold
, italic
, under
);
305 // Set all font style attributes at once.
306 void wxStyledTextCtrl::StyleSetFontAttr(int styleNum
, int size
,
307 const wxString
& faceName
,
308 bool bold
, bool italic
,
310 StyleSetSize(styleNum
, size
);
311 StyleSetFaceName(styleNum
, faceName
);
312 StyleSetBold(styleNum
, bold
);
313 StyleSetItalic(styleNum
, italic
);
314 StyleSetUnderline(styleNum
, underline
);
316 // TODO: add encoding/charset mapping
320 // Perform one of the operations defined by the wxSTC_CMD_* constants.
321 void wxStyledTextCtrl::CmdKeyExecute(int cmd
) {
326 // Set the left and right margin in the edit area, measured in pixels.
327 void wxStyledTextCtrl::SetMargins(int left
, int right
) {
329 SetMarginRight(right
);
333 // Retrieve the start and end positions of the current selection.
334 void wxStyledTextCtrl::GetSelection(int* startPos
, int* endPos
) {
335 if (startPos
!= NULL
)
336 *startPos
= SendMsg(SCI_GETSELECTIONSTART
);
338 *endPos
= SendMsg(SCI_GETSELECTIONEND
);
342 // Retrieve the point in the window where a position is displayed.
343 wxPoint
wxStyledTextCtrl::PointFromPosition(int pos
) {
344 int x
= SendMsg(SCI_POINTXFROMPOSITION
, 0, pos
);
345 int y
= SendMsg(SCI_POINTYFROMPOSITION
, 0, pos
);
346 return wxPoint(x
, y
);
349 // Scroll enough to make the given line visible
350 void wxStyledTextCtrl::ScrollToLine(int line
) {
351 m_swx
->DoScrollToLine(line
);
355 // Scroll enough to make the given column visible
356 void wxStyledTextCtrl::ScrollToColumn(int column
) {
357 m_swx
->DoScrollToColumn(column
);
361 bool wxStyledTextCtrl::SaveFile(const wxString
& filename
)
363 wxFile
file(filename
, wxFile::write
);
365 if (!file
.IsOpened())
368 bool success
= file
.Write(GetText(), *wxConvCurrent
);
376 bool wxStyledTextCtrl::LoadFile(const wxString
& filename
)
378 bool success
= false;
379 wxFile
file(filename
, wxFile::read
);
384 // get the file size (assume it is not huge file...)
385 ssize_t len
= (ssize_t
)file
.Length();
390 wxMemoryBuffer
buffer(len
+1);
391 success
= (file
.Read(buffer
.GetData(), len
) == len
);
393 ((char*)buffer
.GetData())[len
] = 0;
394 contents
= wxString(buffer
, *wxConvCurrent
, len
);
398 success
= (file
.Read(wxStringBuffer(buffer
, len
), len
) == len
);
405 success
= true; // empty file is ok
407 success
= false; // len == wxInvalidOffset
422 #if wxUSE_DRAG_AND_DROP
423 wxDragResult
wxStyledTextCtrl::DoDragOver(wxCoord x
, wxCoord y
, wxDragResult def
) {
424 return m_swx
->DoDragOver(x
, y
, def
);
428 bool wxStyledTextCtrl::DoDropText(long x
, long y
, const wxString
& data
) {
429 return m_swx
->DoDropText(x
, y
, data
);
434 void wxStyledTextCtrl::SetUseAntiAliasing(bool useAA
) {
435 m_swx
->SetUseAntiAliasing(useAA
);
438 bool wxStyledTextCtrl::GetUseAntiAliasing() {
439 return m_swx
->GetUseAntiAliasing();
442 //----------------------------------------------------------------------
445 void wxStyledTextCtrl::OnPaint(wxPaintEvent
& WXUNUSED(evt
)) {
447 m_swx
->DoPaint(&dc
, GetUpdateRegion().GetBox());
450 void wxStyledTextCtrl::OnScrollWin(wxScrollWinEvent
& evt
) {
451 if (evt
.GetOrientation() == wxHORIZONTAL
)
452 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
454 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
457 void wxStyledTextCtrl::OnScroll(wxScrollEvent
& evt
) {
458 wxScrollBar
* sb
= wxDynamicCast(evt
.GetEventObject(), wxScrollBar
);
460 if (sb
->IsVertical())
461 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
463 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
467 void wxStyledTextCtrl::OnSize(wxSizeEvent
& WXUNUSED(evt
)) {
469 wxSize sz
= GetClientSize();
470 m_swx
->DoSize(sz
.x
, sz
.y
);
474 void wxStyledTextCtrl::OnMouseLeftDown(wxMouseEvent
& evt
) {
476 wxPoint pt
= evt
.GetPosition();
477 m_swx
->DoLeftButtonDown(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
478 evt
.ShiftDown(), evt
.ControlDown(), evt
.AltDown());
481 void wxStyledTextCtrl::OnMouseMove(wxMouseEvent
& evt
) {
482 wxPoint pt
= evt
.GetPosition();
483 m_swx
->DoLeftButtonMove(Point(pt
.x
, pt
.y
));
486 void wxStyledTextCtrl::OnMouseLeftUp(wxMouseEvent
& evt
) {
487 wxPoint pt
= evt
.GetPosition();
488 m_swx
->DoLeftButtonUp(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
493 void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent
& evt
) {
494 wxPoint pt
= evt
.GetPosition();
495 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
499 void wxStyledTextCtrl::OnMouseMiddleUp(wxMouseEvent
& evt
) {
500 wxPoint pt
= evt
.GetPosition();
501 m_swx
->DoMiddleButtonUp(Point(pt
.x
, pt
.y
));
504 void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent
& evt
) {
505 wxPoint pt
= evt
.GetPosition();
506 ScreenToClient(&pt
.x
, &pt
.y
);
508 Show context menu at event point if it's within the window,
509 or at caret location if not
511 wxHitTest ht
= this->HitTest(pt
);
512 if (ht
!= wxHT_WINDOW_INSIDE
) {
513 pt
= this->PointFromPosition(this->GetCurrentPos());
515 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
519 void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent
& evt
) {
520 m_swx
->DoMouseWheel(evt
.GetWheelRotation(),
522 evt
.GetLinesPerAction(),
528 void wxStyledTextCtrl::OnChar(wxKeyEvent
& evt
) {
529 // On (some?) non-US keyboards the AltGr key is required to enter some
530 // common characters. It comes to us as both Alt and Ctrl down so we need
531 // to let the char through in that case, otherwise if only ctrl or only
532 // alt let's skip it.
533 bool ctrl
= evt
.ControlDown();
535 // On the Mac the Alt key is just a modifier key (like Shift) so we need
536 // to allow the char events to be processed when Alt is pressed.
537 // TODO: Should we check MetaDown instead in this case?
540 bool alt
= evt
.AltDown();
542 bool skip
= ((ctrl
|| alt
) && ! (ctrl
&& alt
));
544 int key
= evt
.GetKeyCode();
546 // printf("OnChar key:%%d consumed:%%d ctrl:%%d alt:%%d skip:%%d\n",
547 // key, m_lastKeyDownConsumed, ctrl, alt, skip);
549 if ( (key
<= WXK_START
|| key
> WXK_COMMAND
) &&
550 !m_lastKeyDownConsumed
&& !skip
) {
551 m_swx
->DoAddChar(key
);
558 void wxStyledTextCtrl::OnKeyDown(wxKeyEvent
& evt
) {
559 int key
= evt
.GetKeyCode();
560 bool shift
= evt
.ShiftDown(),
561 ctrl
= evt
.ControlDown(),
563 meta
= evt
.MetaDown();
565 int processed
= m_swx
->DoKeyDown(key
, shift
, ctrl
, alt
, meta
, &m_lastKeyDownConsumed
);
567 // printf("KeyDn key:%%d shift:%%d ctrl:%%d alt:%%d processed:%%d consumed:%%d\n",
568 // key, shift, ctrl, alt, processed, m_lastKeyDownConsumed);
570 if (!processed
&& !m_lastKeyDownConsumed
)
575 void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent
& evt
) {
576 m_swx
->DoLoseFocus();
581 void wxStyledTextCtrl::OnGainFocus(wxFocusEvent
& evt
) {
582 m_swx
->DoGainFocus();
587 void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent
& WXUNUSED(evt
)) {
588 m_swx
->DoSysColourChange();
592 void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent
& WXUNUSED(evt
)) {
593 // do nothing to help avoid flashing
598 void wxStyledTextCtrl::OnMenu(wxCommandEvent
& evt
) {
599 m_swx
->DoCommand(evt
.GetId());
603 void wxStyledTextCtrl::OnListBox(wxCommandEvent
& WXUNUSED(evt
)) {
604 m_swx
->DoOnListBox();
608 void wxStyledTextCtrl::OnIdle(wxIdleEvent
& evt
) {
609 m_swx
->DoOnIdle(evt
);
613 wxSize
wxStyledTextCtrl::DoGetBestSize() const
615 // What would be the best size for a wxSTC?
616 // Just give a reasonable minimum until something else can be figured out.
617 return wxSize(200,100);
621 //----------------------------------------------------------------------
622 // Turn notifications from Scintilla into events
625 void wxStyledTextCtrl::NotifyChange() {
626 wxStyledTextEvent
evt(wxEVT_STC_CHANGE
, GetId());
627 evt
.SetEventObject(this);
628 GetEventHandler()->ProcessEvent(evt
);
632 static void SetEventText(wxStyledTextEvent
& evt
, const char* text
,
636 // The unicode conversion MUST have a null byte to terminate the
637 // string so move it into a buffer first and give it one.
638 wxMemoryBuffer
buf(length
+1);
639 buf
.AppendData((void*)text
, length
);
641 evt
.SetText(stc2wx(buf
));
645 void wxStyledTextCtrl::NotifyParent(SCNotification
* _scn
) {
646 SCNotification
& scn
= *_scn
;
647 wxStyledTextEvent
evt(0, GetId());
649 evt
.SetEventObject(this);
650 evt
.SetPosition(scn
.position
);
652 evt
.SetModifiers(scn
.modifiers
);
654 switch (scn
.nmhdr
.code
) {
655 case SCN_STYLENEEDED
:
656 evt
.SetEventType(wxEVT_STC_STYLENEEDED
);
660 evt
.SetEventType(wxEVT_STC_CHARADDED
);
663 case SCN_SAVEPOINTREACHED
:
664 evt
.SetEventType(wxEVT_STC_SAVEPOINTREACHED
);
667 case SCN_SAVEPOINTLEFT
:
668 evt
.SetEventType(wxEVT_STC_SAVEPOINTLEFT
);
671 case SCN_MODIFYATTEMPTRO
:
672 evt
.SetEventType(wxEVT_STC_ROMODIFYATTEMPT
);
676 evt
.SetEventType(wxEVT_STC_KEY
);
679 case SCN_DOUBLECLICK
:
680 evt
.SetEventType(wxEVT_STC_DOUBLECLICK
);
684 evt
.SetEventType(wxEVT_STC_UPDATEUI
);
688 evt
.SetEventType(wxEVT_STC_MODIFIED
);
689 evt
.SetModificationType(scn
.modificationType
);
690 SetEventText(evt
, scn
.text
, scn
.length
);
691 evt
.SetLength(scn
.length
);
692 evt
.SetLinesAdded(scn
.linesAdded
);
693 evt
.SetLine(scn
.line
);
694 evt
.SetFoldLevelNow(scn
.foldLevelNow
);
695 evt
.SetFoldLevelPrev(scn
.foldLevelPrev
);
698 case SCN_MACRORECORD
:
699 evt
.SetEventType(wxEVT_STC_MACRORECORD
);
700 evt
.SetMessage(scn
.message
);
701 evt
.SetWParam(scn
.wParam
);
702 evt
.SetLParam(scn
.lParam
);
705 case SCN_MARGINCLICK
:
706 evt
.SetEventType(wxEVT_STC_MARGINCLICK
);
707 evt
.SetMargin(scn
.margin
);
711 evt
.SetEventType(wxEVT_STC_NEEDSHOWN
);
712 evt
.SetLength(scn
.length
);
716 evt
.SetEventType(wxEVT_STC_PAINTED
);
719 case SCN_USERLISTSELECTION
:
720 evt
.SetEventType(wxEVT_STC_USERLISTSELECTION
);
721 evt
.SetListType(scn
.listType
);
722 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
726 evt
.SetEventType(wxEVT_STC_URIDROPPED
);
727 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
731 evt
.SetEventType(wxEVT_STC_DWELLSTART
);
737 evt
.SetEventType(wxEVT_STC_DWELLEND
);
743 evt
.SetEventType(wxEVT_STC_ZOOM
);
746 case SCN_HOTSPOTCLICK
:
747 evt
.SetEventType(wxEVT_STC_HOTSPOT_CLICK
);
750 case SCN_HOTSPOTDOUBLECLICK
:
751 evt
.SetEventType(wxEVT_STC_HOTSPOT_DCLICK
);
754 case SCN_CALLTIPCLICK
:
755 evt
.SetEventType(wxEVT_STC_CALLTIP_CLICK
);
762 GetEventHandler()->ProcessEvent(evt
);
766 //----------------------------------------------------------------------
767 //----------------------------------------------------------------------
768 //----------------------------------------------------------------------
770 wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType
, int id
)
771 : wxCommandEvent(commandType
, id
)
776 m_modificationType
= 0;
789 m_dragAllowMove
= false;
790 #if wxUSE_DRAG_AND_DROP
791 m_dragResult
= wxDragNone
;
795 bool wxStyledTextEvent::GetShift() const { return (m_modifiers
& SCI_SHIFT
) != 0; }
796 bool wxStyledTextEvent::GetControl() const { return (m_modifiers
& SCI_CTRL
) != 0; }
797 bool wxStyledTextEvent::GetAlt() const { return (m_modifiers
& SCI_ALT
) != 0; }
800 wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent
& event
):
801 wxCommandEvent(event
)
803 m_position
= event
.m_position
;
805 m_modifiers
= event
.m_modifiers
;
806 m_modificationType
= event
.m_modificationType
;
807 m_text
= event
.m_text
;
808 m_length
= event
.m_length
;
809 m_linesAdded
= event
.m_linesAdded
;
810 m_line
= event
.m_line
;
811 m_foldLevelNow
= event
.m_foldLevelNow
;
812 m_foldLevelPrev
= event
.m_foldLevelPrev
;
814 m_margin
= event
.m_margin
;
816 m_message
= event
.m_message
;
817 m_wParam
= event
.m_wParam
;
818 m_lParam
= event
.m_lParam
;
820 m_listType
= event
.m_listType
;
824 m_dragText
= event
.m_dragText
;
825 m_dragAllowMove
=event
.m_dragAllowMove
;
826 #if wxUSE_DRAG_AND_DROP
827 m_dragResult
= event
.m_dragResult
;
831 //----------------------------------------------------------------------
832 //----------------------------------------------------------------------