- wxDropSource source(wMain.GetID());
- wxTextDataObject data(dragChars);
- wxDragResult result;
-
- source.SetData(data);
- result = source.DoDragDrop(TRUE);
- if (result == wxDragMove && dropWentOutside)
- ClearSelection();
- inDragDrop = FALSE;
- SetDragPosition(invalidPosition);
+#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
+}
+
+
+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;