+#if wxUSE_DRAG_AND_DROP
+ // We defer the starting of the DnD, otherwise the LeftUp of a normal
+ // click could be lost and the STC will think it is doing a DnD when the
+ // user just wanted a normal click.
+ startDragTimer->Start(200, true);
+#endif // wxUSE_DRAG_AND_DROP
+}
+
+void ScintillaWX::DoStartDrag() {
+#if wxUSE_DRAG_AND_DROP
+ wxString dragText = stc2wx(drag.s, drag.len);
+
+ // Send an event to allow the drag text to be changed
+ wxStyledTextEvent evt(wxEVT_STC_START_DRAG, stc->GetId());
+ evt.SetEventObject(stc);
+ evt.SetDragText(dragText);
+ evt.SetDragAllowMove(true);
+ evt.SetPosition(wxMin(stc->GetSelectionStart(),
+ stc->GetSelectionEnd()));
+ stc->GetEventHandler()->ProcessEvent(evt);
+ dragText = evt.GetDragText();
+
+ if (dragText.length()) {
+ wxDropSource source(stc);
+ wxTextDataObject data(dragText);
+ wxDragResult result;
+
+ source.SetData(data);
+ dropWentOutside = true;
+ result = source.DoDragDrop(evt.GetDragAllowMove());
+ if (result == wxDragMove && dropWentOutside)
+ ClearSelection();
+ inDragDrop = false;
+ SetDragPosition(invalidPosition);
+ }
+#endif // wxUSE_DRAG_AND_DROP
+}
+
+
+bool ScintillaWX::SetIdle(bool on) {
+ if (idler.state != on) {
+ // connect or disconnect the EVT_IDLE handler
+ if (on)
+ stc->Connect(wxID_ANY, wxEVT_IDLE,
+ (wxObjectEventFunction) (wxEventFunction) (wxIdleEventFunction) &wxStyledTextCtrl::OnIdle);
+ else
+ stc->Disconnect(wxID_ANY, wxEVT_IDLE,
+ (wxObjectEventFunction) (wxEventFunction) (wxIdleEventFunction) &wxStyledTextCtrl::OnIdle);
+ idler.state = on;
+ }
+ return idler.state;