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 /////////////////////////////////////////////////////////////////////////////
21 #include <wx/tokenzr.h>
22 #include <wx/mstream.h>
26 #include "wx/stc/stc.h"
27 #include "ScintillaWX.h"
29 //----------------------------------------------------------------------
31 const wxChar
* wxSTCNameStr
= wxT("stcwindow");
37 #define MAKELONG(a, b) ((a) | ((b) << 16))
40 static long wxColourAsLong(const wxColour
& co
) {
41 return (((long)co
.Blue() << 16) |
42 ((long)co
.Green() << 8) |
46 static wxColour
wxColourFromLong(long c
) {
48 clr
.Set((unsigned char)(c
& 0xff),
49 (unsigned char)((c
>> 8) & 0xff),
50 (unsigned char)((c
>> 16) & 0xff));
55 static wxColour
wxColourFromSpec(const wxString
& spec
) {
56 // spec should be a colour name or "#RRGGBB"
57 if (spec
.GetChar(0) == wxT('#')) {
59 long red
, green
, blue
;
60 red
= green
= blue
= 0;
61 spec
.Mid(1,2).ToLong(&red
, 16);
62 spec
.Mid(3,2).ToLong(&green
, 16);
63 spec
.Mid(5,2).ToLong(&blue
, 16);
64 return wxColour((unsigned char)red
,
69 return wxColour(spec
);
72 //----------------------------------------------------------------------
74 DEFINE_EVENT_TYPE( wxEVT_STC_CHANGE
)
75 DEFINE_EVENT_TYPE( wxEVT_STC_STYLENEEDED
)
76 DEFINE_EVENT_TYPE( wxEVT_STC_CHARADDED
)
77 DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTREACHED
)
78 DEFINE_EVENT_TYPE( wxEVT_STC_SAVEPOINTLEFT
)
79 DEFINE_EVENT_TYPE( wxEVT_STC_ROMODIFYATTEMPT
)
80 DEFINE_EVENT_TYPE( wxEVT_STC_KEY
)
81 DEFINE_EVENT_TYPE( wxEVT_STC_DOUBLECLICK
)
82 DEFINE_EVENT_TYPE( wxEVT_STC_UPDATEUI
)
83 DEFINE_EVENT_TYPE( wxEVT_STC_MODIFIED
)
84 DEFINE_EVENT_TYPE( wxEVT_STC_MACRORECORD
)
85 DEFINE_EVENT_TYPE( wxEVT_STC_MARGINCLICK
)
86 DEFINE_EVENT_TYPE( wxEVT_STC_NEEDSHOWN
)
87 DEFINE_EVENT_TYPE( wxEVT_STC_PAINTED
)
88 DEFINE_EVENT_TYPE( wxEVT_STC_USERLISTSELECTION
)
89 DEFINE_EVENT_TYPE( wxEVT_STC_URIDROPPED
)
90 DEFINE_EVENT_TYPE( wxEVT_STC_DWELLSTART
)
91 DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND
)
92 DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG
)
93 DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER
)
94 DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP
)
95 DEFINE_EVENT_TYPE( wxEVT_STC_ZOOM
)
96 DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_CLICK
)
97 DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_DCLICK
)
98 DEFINE_EVENT_TYPE( wxEVT_STC_CALLTIP_CLICK
)
102 BEGIN_EVENT_TABLE(wxStyledTextCtrl
, wxControl
)
103 EVT_PAINT (wxStyledTextCtrl::OnPaint
)
104 EVT_SCROLLWIN (wxStyledTextCtrl::OnScrollWin
)
105 EVT_SCROLL (wxStyledTextCtrl::OnScroll
)
106 EVT_SIZE (wxStyledTextCtrl::OnSize
)
107 EVT_LEFT_DOWN (wxStyledTextCtrl::OnMouseLeftDown
)
108 // Let Scintilla see the double click as a second click
109 EVT_LEFT_DCLICK (wxStyledTextCtrl::OnMouseLeftDown
)
110 EVT_MOTION (wxStyledTextCtrl::OnMouseMove
)
111 EVT_LEFT_UP (wxStyledTextCtrl::OnMouseLeftUp
)
112 #if defined(__WXGTK__) || defined(__WXMAC__)
113 EVT_RIGHT_UP (wxStyledTextCtrl::OnMouseRightUp
)
115 EVT_CONTEXT_MENU (wxStyledTextCtrl::OnContextMenu
)
117 EVT_MOUSEWHEEL (wxStyledTextCtrl::OnMouseWheel
)
118 EVT_MIDDLE_UP (wxStyledTextCtrl::OnMouseMiddleUp
)
119 EVT_CHAR (wxStyledTextCtrl::OnChar
)
120 EVT_KEY_DOWN (wxStyledTextCtrl::OnKeyDown
)
121 EVT_KILL_FOCUS (wxStyledTextCtrl::OnLoseFocus
)
122 EVT_SET_FOCUS (wxStyledTextCtrl::OnGainFocus
)
123 EVT_SYS_COLOUR_CHANGED (wxStyledTextCtrl::OnSysColourChanged
)
124 EVT_ERASE_BACKGROUND (wxStyledTextCtrl::OnEraseBackground
)
125 EVT_MENU_RANGE (10, 16, wxStyledTextCtrl::OnMenu
)
126 EVT_LISTBOX_DCLICK (wxID_ANY
, wxStyledTextCtrl::OnListBox
)
130 IMPLEMENT_CLASS(wxStyledTextCtrl
, wxControl
)
131 IMPLEMENT_DYNAMIC_CLASS(wxStyledTextEvent
, wxCommandEvent
)
134 // forces the linking of the lexer modules
135 int Scintilla_LinkLexers();
138 //----------------------------------------------------------------------
139 // Constructor and Destructor
141 wxStyledTextCtrl::wxStyledTextCtrl(wxWindow
*parent
,
146 const wxString
& name
)
149 Create(parent
, id
, pos
, size
, style
, name
);
153 void wxStyledTextCtrl::Create(wxWindow
*parent
,
158 const wxString
& name
)
161 style
|= wxVSCROLL
| wxHSCROLL
;
163 wxControl::Create(parent
, id
, pos
, size
,
164 style
| wxWANTS_CHARS
| wxCLIP_CHILDREN
,
165 wxDefaultValidator
, name
);
168 Scintilla_LinkLexers();
170 m_swx
= new ScintillaWX(this);
172 m_lastKeyDownConsumed
= false;
176 // Put Scintilla into unicode (UTF-8) mode
177 SetCodePage(wxSTC_CP_UTF8
);
180 SetBestFittingSize(size
);
182 // Reduces flicker on GTK+/X11
183 SetBackgroundStyle(wxBG_STYLE_CUSTOM
);
187 wxStyledTextCtrl::~wxStyledTextCtrl() {
192 //----------------------------------------------------------------------
194 long wxStyledTextCtrl::SendMsg(int msg
, long wp
, long lp
) {
196 return m_swx
->WndProc(msg
, wp
, lp
);
199 //----------------------------------------------------------------------
201 // Set the vertical scrollbar to use instead of the ont that's built-in.
202 void wxStyledTextCtrl::SetVScrollBar(wxScrollBar
* bar
) {
205 // ensure that the built-in scrollbar is not visible
206 SetScrollbar(wxVERTICAL
, 0, 0, 0);
211 // Set the horizontal scrollbar to use instead of the ont that's built-in.
212 void wxStyledTextCtrl::SetHScrollBar(wxScrollBar
* bar
) {
215 // ensure that the built-in scrollbar is not visible
216 SetScrollbar(wxHORIZONTAL
, 0, 0, 0);
220 //----------------------------------------------------------------------
221 // BEGIN generated section. The following code is automatically generated
222 // by gen_iface.py from the contents of Scintilla.iface. Do not edit
223 // this file. Edit stc.cpp.in or gen_iface.py instead and regenerate.
227 // END of generated section
228 //----------------------------------------------------------------------
231 // Returns the line number of the line with the caret.
232 int wxStyledTextCtrl::GetCurrentLine() {
233 int line
= LineFromPosition(GetCurrentPos());
238 // Extract style settings from a spec-string which is composed of one or
239 // more of the following comma separated elements:
241 // bold turns on bold
242 // italic turns on italics
243 // fore:[name or #RRGGBB] sets the foreground colour
244 // back:[name or #RRGGBB] sets the background colour
245 // face:[facename] sets the font face name to use
246 // size:[num] sets the font size in points
247 // eol turns on eol filling
248 // underline turns on underlining
250 void wxStyledTextCtrl::StyleSetSpec(int styleNum
, const wxString
& spec
) {
252 wxStringTokenizer
tkz(spec
, wxT(","));
253 while (tkz
.HasMoreTokens()) {
254 wxString token
= tkz
.GetNextToken();
256 wxString option
= token
.BeforeFirst(':');
257 wxString val
= token
.AfterFirst(':');
259 if (option
== wxT("bold"))
260 StyleSetBold(styleNum
, true);
262 else if (option
== wxT("italic"))
263 StyleSetItalic(styleNum
, true);
265 else if (option
== wxT("underline"))
266 StyleSetUnderline(styleNum
, true);
268 else if (option
== wxT("eol"))
269 StyleSetEOLFilled(styleNum
, true);
271 else if (option
== wxT("size")) {
273 if (val
.ToLong(&points
))
274 StyleSetSize(styleNum
, points
);
277 else if (option
== wxT("face"))
278 StyleSetFaceName(styleNum
, val
);
280 else if (option
== wxT("fore"))
281 StyleSetForeground(styleNum
, wxColourFromSpec(val
));
283 else if (option
== wxT("back"))
284 StyleSetBackground(styleNum
, wxColourFromSpec(val
));
289 // Set style size, face, bold, italic, and underline attributes from
290 // a wxFont's attributes.
291 void wxStyledTextCtrl::StyleSetFont(int styleNum
, wxFont
& font
) {
293 // Ensure that the native font is initialized
295 GetTextExtent(wxT("X"), &x
, &y
, NULL
, NULL
, &font
);
297 int size
= font
.GetPointSize();
298 wxString faceName
= font
.GetFaceName();
299 bool bold
= font
.GetWeight() == wxBOLD
;
300 bool italic
= font
.GetStyle() != wxNORMAL
;
301 bool under
= font
.GetUnderlined();
303 // TODO: add encoding/charset mapping
304 StyleSetFontAttr(styleNum
, size
, faceName
, bold
, italic
, under
);
307 // Set all font style attributes at once.
308 void wxStyledTextCtrl::StyleSetFontAttr(int styleNum
, int size
,
309 const wxString
& faceName
,
310 bool bold
, bool italic
,
312 StyleSetSize(styleNum
, size
);
313 StyleSetFaceName(styleNum
, faceName
);
314 StyleSetBold(styleNum
, bold
);
315 StyleSetItalic(styleNum
, italic
);
316 StyleSetUnderline(styleNum
, underline
);
318 // TODO: add encoding/charset mapping
322 // Perform one of the operations defined by the wxSTC_CMD_* constants.
323 void wxStyledTextCtrl::CmdKeyExecute(int cmd
) {
328 // Set the left and right margin in the edit area, measured in pixels.
329 void wxStyledTextCtrl::SetMargins(int left
, int right
) {
331 SetMarginRight(right
);
335 // Retrieve the start and end positions of the current selection.
336 void wxStyledTextCtrl::GetSelection(int* startPos
, int* endPos
) {
337 if (startPos
!= NULL
)
338 *startPos
= SendMsg(SCI_GETSELECTIONSTART
);
340 *endPos
= SendMsg(SCI_GETSELECTIONEND
);
344 // Retrieve the point in the window where a position is displayed.
345 wxPoint
wxStyledTextCtrl::PointFromPosition(int pos
) {
346 int x
= SendMsg(SCI_POINTXFROMPOSITION
, 0, pos
);
347 int y
= SendMsg(SCI_POINTYFROMPOSITION
, 0, pos
);
348 return wxPoint(x
, y
);
351 // Scroll enough to make the given line visible
352 void wxStyledTextCtrl::ScrollToLine(int line
) {
353 m_swx
->DoScrollToLine(line
);
357 // Scroll enough to make the given column visible
358 void wxStyledTextCtrl::ScrollToColumn(int column
) {
359 m_swx
->DoScrollToColumn(column
);
363 bool wxStyledTextCtrl::SaveFile(const wxString
& filename
)
365 wxFile
file(filename
, wxFile::write
);
367 if (!file
.IsOpened())
370 bool success
= file
.Write(GetText(), *wxConvCurrent
);
378 bool wxStyledTextCtrl::LoadFile(const wxString
& filename
)
380 bool success
= false;
381 wxFile
file(filename
, wxFile::read
);
386 // get the file size (assume it is not huge file...)
387 ssize_t len
= (ssize_t
)file
.Length();
392 wxMemoryBuffer
buffer(len
+1);
393 success
= (file
.Read(buffer
.GetData(), len
) == len
);
395 ((char*)buffer
.GetData())[len
] = 0;
396 contents
= wxString(buffer
, *wxConvCurrent
, len
);
400 success
= (file
.Read(wxStringBuffer(buffer
, len
), len
) == len
);
407 success
= true; // empty file is ok
409 success
= false; // len == wxInvalidOffset
424 #if wxUSE_DRAG_AND_DROP
425 wxDragResult
wxStyledTextCtrl::DoDragOver(wxCoord x
, wxCoord y
, wxDragResult def
) {
426 return m_swx
->DoDragOver(x
, y
, def
);
430 bool wxStyledTextCtrl::DoDropText(long x
, long y
, const wxString
& data
) {
431 return m_swx
->DoDropText(x
, y
, data
);
436 void wxStyledTextCtrl::SetUseAntiAliasing(bool useAA
) {
437 m_swx
->SetUseAntiAliasing(useAA
);
440 bool wxStyledTextCtrl::GetUseAntiAliasing() {
441 return m_swx
->GetUseAntiAliasing();
444 //----------------------------------------------------------------------
447 void wxStyledTextCtrl::OnPaint(wxPaintEvent
& WXUNUSED(evt
)) {
449 m_swx
->DoPaint(&dc
, GetUpdateRegion().GetBox());
452 void wxStyledTextCtrl::OnScrollWin(wxScrollWinEvent
& evt
) {
453 if (evt
.GetOrientation() == wxHORIZONTAL
)
454 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
456 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
459 void wxStyledTextCtrl::OnScroll(wxScrollEvent
& evt
) {
460 wxScrollBar
* sb
= wxDynamicCast(evt
.GetEventObject(), wxScrollBar
);
462 if (sb
->IsVertical())
463 m_swx
->DoVScroll(evt
.GetEventType(), evt
.GetPosition());
465 m_swx
->DoHScroll(evt
.GetEventType(), evt
.GetPosition());
469 void wxStyledTextCtrl::OnSize(wxSizeEvent
& WXUNUSED(evt
)) {
471 wxSize sz
= GetClientSize();
472 m_swx
->DoSize(sz
.x
, sz
.y
);
476 void wxStyledTextCtrl::OnMouseLeftDown(wxMouseEvent
& evt
) {
478 wxPoint pt
= evt
.GetPosition();
479 m_swx
->DoLeftButtonDown(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
480 evt
.ShiftDown(), evt
.ControlDown(), evt
.AltDown());
483 void wxStyledTextCtrl::OnMouseMove(wxMouseEvent
& evt
) {
484 wxPoint pt
= evt
.GetPosition();
485 m_swx
->DoLeftButtonMove(Point(pt
.x
, pt
.y
));
488 void wxStyledTextCtrl::OnMouseLeftUp(wxMouseEvent
& evt
) {
489 wxPoint pt
= evt
.GetPosition();
490 m_swx
->DoLeftButtonUp(Point(pt
.x
, pt
.y
), m_stopWatch
.Time(),
495 void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent
& evt
) {
496 wxPoint pt
= evt
.GetPosition();
497 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
501 void wxStyledTextCtrl::OnMouseMiddleUp(wxMouseEvent
& evt
) {
502 wxPoint pt
= evt
.GetPosition();
503 m_swx
->DoMiddleButtonUp(Point(pt
.x
, pt
.y
));
506 void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent
& evt
) {
507 wxPoint pt
= evt
.GetPosition();
508 ScreenToClient(&pt
.x
, &pt
.y
);
510 Show context menu at event point if it's within the window,
511 or at caret location if not
513 wxHitTest ht
= this->HitTest(pt
);
514 if (ht
!= wxHT_WINDOW_INSIDE
) {
515 pt
= this->PointFromPosition(this->GetCurrentPos());
517 m_swx
->DoContextMenu(Point(pt
.x
, pt
.y
));
521 void wxStyledTextCtrl::OnMouseWheel(wxMouseEvent
& evt
) {
522 m_swx
->DoMouseWheel(evt
.GetWheelRotation(),
524 evt
.GetLinesPerAction(),
530 void wxStyledTextCtrl::OnChar(wxKeyEvent
& evt
) {
531 // On (some?) non-US PC keyboards the AltGr key is required to enter some
532 // common characters. It comes to us as both Alt and Ctrl down so we need
533 // to let the char through in that case, otherwise if only ctrl or only
534 // alt let's skip it.
535 bool ctrl
= evt
.ControlDown();
537 // On the Mac the Alt key is just a modifier key (like Shift) so we need
538 // to allow the char events to be processed when Alt is pressed.
539 // TODO: Should we check MetaDown instead in this case?
542 bool alt
= evt
.AltDown();
544 bool skip
= ((ctrl
|| alt
) && ! (ctrl
&& alt
));
546 if (!m_lastKeyDownConsumed
&& !skip
) {
548 int key
= evt
.GetUnicodeKey();
551 // if the unicode key code is not really a unicode character (it may
552 // be a function key or etc., the platforms appear to always give us a
553 // small value in this case) then fallback to the ascii key code but
554 // don't do anything for function keys or etc.
556 key
= evt
.GetKeyCode();
557 keyOk
= (key
<= 127);
560 m_swx
->DoAddChar(key
);
564 int key
= evt
.GetKeyCode();
565 if (key
<= WXK_START
|| key
> WXK_COMMAND
) {
566 m_swx
->DoAddChar(key
);
576 void wxStyledTextCtrl::OnKeyDown(wxKeyEvent
& evt
) {
577 int processed
= m_swx
->DoKeyDown(evt
, &m_lastKeyDownConsumed
);
578 if (!processed
&& !m_lastKeyDownConsumed
)
583 void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent
& evt
) {
584 m_swx
->DoLoseFocus();
589 void wxStyledTextCtrl::OnGainFocus(wxFocusEvent
& evt
) {
590 m_swx
->DoGainFocus();
595 void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent
& WXUNUSED(evt
)) {
596 m_swx
->DoSysColourChange();
600 void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent
& WXUNUSED(evt
)) {
601 // do nothing to help avoid flashing
606 void wxStyledTextCtrl::OnMenu(wxCommandEvent
& evt
) {
607 m_swx
->DoCommand(evt
.GetId());
611 void wxStyledTextCtrl::OnListBox(wxCommandEvent
& WXUNUSED(evt
)) {
612 m_swx
->DoOnListBox();
616 void wxStyledTextCtrl::OnIdle(wxIdleEvent
& evt
) {
617 m_swx
->DoOnIdle(evt
);
621 wxSize
wxStyledTextCtrl::DoGetBestSize() const
623 // What would be the best size for a wxSTC?
624 // Just give a reasonable minimum until something else can be figured out.
625 return wxSize(200,100);
629 //----------------------------------------------------------------------
630 // Turn notifications from Scintilla into events
633 void wxStyledTextCtrl::NotifyChange() {
634 wxStyledTextEvent
evt(wxEVT_STC_CHANGE
, GetId());
635 evt
.SetEventObject(this);
636 GetEventHandler()->ProcessEvent(evt
);
640 static void SetEventText(wxStyledTextEvent
& evt
, const char* text
,
644 // The unicode conversion MUST have a null byte to terminate the
645 // string so move it into a buffer first and give it one.
646 wxMemoryBuffer
buf(length
+1);
647 buf
.AppendData((void*)text
, length
);
649 evt
.SetText(stc2wx(buf
));
653 void wxStyledTextCtrl::NotifyParent(SCNotification
* _scn
) {
654 SCNotification
& scn
= *_scn
;
655 wxStyledTextEvent
evt(0, GetId());
657 evt
.SetEventObject(this);
658 evt
.SetPosition(scn
.position
);
660 evt
.SetModifiers(scn
.modifiers
);
662 switch (scn
.nmhdr
.code
) {
663 case SCN_STYLENEEDED
:
664 evt
.SetEventType(wxEVT_STC_STYLENEEDED
);
668 evt
.SetEventType(wxEVT_STC_CHARADDED
);
671 case SCN_SAVEPOINTREACHED
:
672 evt
.SetEventType(wxEVT_STC_SAVEPOINTREACHED
);
675 case SCN_SAVEPOINTLEFT
:
676 evt
.SetEventType(wxEVT_STC_SAVEPOINTLEFT
);
679 case SCN_MODIFYATTEMPTRO
:
680 evt
.SetEventType(wxEVT_STC_ROMODIFYATTEMPT
);
684 evt
.SetEventType(wxEVT_STC_KEY
);
687 case SCN_DOUBLECLICK
:
688 evt
.SetEventType(wxEVT_STC_DOUBLECLICK
);
692 evt
.SetEventType(wxEVT_STC_UPDATEUI
);
696 evt
.SetEventType(wxEVT_STC_MODIFIED
);
697 evt
.SetModificationType(scn
.modificationType
);
698 SetEventText(evt
, scn
.text
, scn
.length
);
699 evt
.SetLength(scn
.length
);
700 evt
.SetLinesAdded(scn
.linesAdded
);
701 evt
.SetLine(scn
.line
);
702 evt
.SetFoldLevelNow(scn
.foldLevelNow
);
703 evt
.SetFoldLevelPrev(scn
.foldLevelPrev
);
706 case SCN_MACRORECORD
:
707 evt
.SetEventType(wxEVT_STC_MACRORECORD
);
708 evt
.SetMessage(scn
.message
);
709 evt
.SetWParam(scn
.wParam
);
710 evt
.SetLParam(scn
.lParam
);
713 case SCN_MARGINCLICK
:
714 evt
.SetEventType(wxEVT_STC_MARGINCLICK
);
715 evt
.SetMargin(scn
.margin
);
719 evt
.SetEventType(wxEVT_STC_NEEDSHOWN
);
720 evt
.SetLength(scn
.length
);
724 evt
.SetEventType(wxEVT_STC_PAINTED
);
727 case SCN_USERLISTSELECTION
:
728 evt
.SetEventType(wxEVT_STC_USERLISTSELECTION
);
729 evt
.SetListType(scn
.listType
);
730 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
734 evt
.SetEventType(wxEVT_STC_URIDROPPED
);
735 SetEventText(evt
, scn
.text
, strlen(scn
.text
));
739 evt
.SetEventType(wxEVT_STC_DWELLSTART
);
745 evt
.SetEventType(wxEVT_STC_DWELLEND
);
751 evt
.SetEventType(wxEVT_STC_ZOOM
);
754 case SCN_HOTSPOTCLICK
:
755 evt
.SetEventType(wxEVT_STC_HOTSPOT_CLICK
);
758 case SCN_HOTSPOTDOUBLECLICK
:
759 evt
.SetEventType(wxEVT_STC_HOTSPOT_DCLICK
);
762 case SCN_CALLTIPCLICK
:
763 evt
.SetEventType(wxEVT_STC_CALLTIP_CLICK
);
770 GetEventHandler()->ProcessEvent(evt
);
774 //----------------------------------------------------------------------
775 //----------------------------------------------------------------------
776 //----------------------------------------------------------------------
778 wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType
, int id
)
779 : wxCommandEvent(commandType
, id
)
784 m_modificationType
= 0;
797 m_dragAllowMove
= false;
798 #if wxUSE_DRAG_AND_DROP
799 m_dragResult
= wxDragNone
;
803 bool wxStyledTextEvent::GetShift() const { return (m_modifiers
& SCI_SHIFT
) != 0; }
804 bool wxStyledTextEvent::GetControl() const { return (m_modifiers
& SCI_CTRL
) != 0; }
805 bool wxStyledTextEvent::GetAlt() const { return (m_modifiers
& SCI_ALT
) != 0; }
808 wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent
& event
):
809 wxCommandEvent(event
)
811 m_position
= event
.m_position
;
813 m_modifiers
= event
.m_modifiers
;
814 m_modificationType
= event
.m_modificationType
;
815 m_text
= event
.m_text
;
816 m_length
= event
.m_length
;
817 m_linesAdded
= event
.m_linesAdded
;
818 m_line
= event
.m_line
;
819 m_foldLevelNow
= event
.m_foldLevelNow
;
820 m_foldLevelPrev
= event
.m_foldLevelPrev
;
822 m_margin
= event
.m_margin
;
824 m_message
= event
.m_message
;
825 m_wParam
= event
.m_wParam
;
826 m_lParam
= event
.m_lParam
;
828 m_listType
= event
.m_listType
;
832 m_dragText
= event
.m_dragText
;
833 m_dragAllowMove
=event
.m_dragAllowMove
;
834 #if wxUSE_DRAG_AND_DROP
835 m_dragResult
= event
.m_dragResult
;
839 //----------------------------------------------------------------------
840 //----------------------------------------------------------------------