#include <wx/wx.h>
+#include <wx/dnd.h>
//----------------------------------------------------------------------
// BEGIN generated section. The following code is automatically generated
void NotifyChange();
void NotifyParent(SCNotification* scn);
+
private:
DECLARE_EVENT_TABLE()
DECLARE_CLASS(wxStyledTextCtrl)
wxStyledTextEvent(wxEventType commandType=0, int id=0);
~wxStyledTextEvent() {}
- void SetPosition(int pos) { m_position = pos; }
- void SetKey(int k) { m_key = k; }
- void SetModifiers(int m) { m_modifiers = m; }
- void SetModificationType(int t) { m_modificationType = t; }
- void SetText(const char* t) { m_text = t; }
- void SetLength(int len) { m_length = len; }
- void SetLinesAdded(int num) { m_linesAdded = num; }
- void SetLine(int val) { m_line = val; }
- void SetFoldLevelNow(int val) { m_foldLevelNow = val; }
- void SetFoldLevelPrev(int val) { m_foldLevelPrev = val; }
- void SetMargin(int val) { m_margin = val; }
- void SetMessage(int val) { m_message = val; }
- void SetWParam(int val) { m_wParam = val; }
- void SetLParam(int val) { m_lParam = val; }
- void SetListType(int val) { m_listType = val; }
- void SetX(int val) { m_x = val; }
- void SetY(int val) { m_y = val; }
+ void SetPosition(int pos) { m_position = pos; }
+ void SetKey(int k) { m_key = k; }
+ void SetModifiers(int m) { m_modifiers = m; }
+ void SetModificationType(int t) { m_modificationType = t; }
+ void SetText(const char* t) { m_text = t; }
+ void SetLength(int len) { m_length = len; }
+ void SetLinesAdded(int num) { m_linesAdded = num; }
+ void SetLine(int val) { m_line = val; }
+ void SetFoldLevelNow(int val) { m_foldLevelNow = val; }
+ void SetFoldLevelPrev(int val) { m_foldLevelPrev = val; }
+ void SetMargin(int val) { m_margin = val; }
+ void SetMessage(int val) { m_message = val; }
+ void SetWParam(int val) { m_wParam = val; }
+ void SetLParam(int val) { m_lParam = val; }
+ void SetListType(int val) { m_listType = val; }
+ void SetX(int val) { m_x = val; }
+ void SetY(int val) { m_y = val; }
+ void SetDragText(const wxString& val) { m_dragText = val; }
+ void SetDragAllowMove(bool val) { m_dragAllowMove = val; }
+ void SetDragResult(wxDragResult val) { m_dragResult = val; }
int GetPosition() const { return m_position; }
int GetKey() const { return m_key; }
int GetListType() const { return m_listType; }
int GetX() const { return m_x; }
int GetY() const { return m_y; }
+ wxString GetDragText() { return m_dragText; }
+ bool GetDragAllowMove() { return m_dragAllowMove; }
+ wxDragResult GetDragResult() { return m_dragResult; }
bool GetShift() const;
bool GetControl() const;
int m_listType;
int m_x;
int m_y;
+
+ wxString m_dragText; // wxEVT_STC_START_DRAG, wxEVT_STC_DO_DROP
+ bool m_dragAllowMove; // wxEVT_STC_START_DRAG
+
+ wxDragResult m_dragResult; // wxEVT_STC_DRAG_OVER,wxEVT_STC_DO_DROP
#endif
};
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_URIDROPPED, 1666)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLSTART, 1667)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLEND, 1668)
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_START_DRAG, 1669)
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DRAG_OVER, 1670)
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DO_DROP, 1671)
END_DECLARE_EVENT_TYPES()
#else
enum {
wxEVT_STC_URIDROPPED,
wxEVT_STC_DWELLSTART,
wxEVT_STC_DWELLEND,
+ wxEVT_STC_START_DRAG,
+ wxEVT_STC_DRAG_OVER,
+ wxEVT_STC_DO_DROP,
};
#endif
#define EVT_STC_URIDROPPED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_URIDROPPED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_DWELLSTART(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLSTART, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_DWELLEND(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLEND, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-
+#define EVT_STC_START_DRAG(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_START_DRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_DRAG_OVER(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_DO_DROP(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#endif
void ScintillaWX::StartDrag() {
- wxDropSource source(wMain.GetID());
- wxTextDataObject data(wxString(drag.s, drag.len));
- wxDragResult result;
-
- dropWentOutside = true;
- source.SetData(data);
- result = source.DoDragDrop(TRUE);
- if (result == wxDragMove && dropWentOutside)
- ClearSelection();
- inDragDrop = FALSE;
- SetDragPosition(invalidPosition);
+ wxString dragText(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(wMain.GetID());
+ wxTextDataObject data(dragText);
+ wxDragResult result;
+
+ source.SetData(data);
+ dropWentOutside = TRUE;
+ result = source.DoDragDrop(evt.GetDragAllowMove());
+ if (result == wxDragMove && dropWentOutside)
+ ClearSelection();
+ inDragDrop = FALSE;
+ SetDragPosition(invalidPosition);
+ }
}
bool ScintillaWX::DoDropText(long x, long y, const wxString& data) {
SetDragPosition(invalidPosition);
- int movePos = PositionFromLocation(Point(x,y));
- DropAt(movePos, data, dragResult == wxDragMove, FALSE); // TODO: rectangular?
- return TRUE;
+
+ // Send an event to allow the drag details to be changed
+ wxStyledTextEvent evt(wxEVT_STC_DO_DROP, stc->GetId());
+ evt.SetEventObject(stc);
+ evt.SetDragResult(dragResult);
+ evt.SetX(x);
+ evt.SetY(y);
+ evt.SetPosition(PositionFromLocation(Point(x,y)));
+ evt.SetDragText(data);
+ stc->GetEventHandler()->ProcessEvent(evt);
+
+ dragResult = evt.GetDragResult();
+ if (dragResult == wxDragMove || dragResult == wxDragCopy) {
+ DropAt(evt.GetPosition(),
+ evt.GetDragText(),
+ dragResult == wxDragMove,
+ FALSE); // TODO: rectangular?
+ return TRUE;
+ }
+ return FALSE;
}
wxDragResult ScintillaWX::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) {
SetDragPosition(PositionFromLocation(Point(x, y)));
- dragResult = def;
+
+ // Send an event to allow the drag result to be changed
+ wxStyledTextEvent evt(wxEVT_STC_DRAG_OVER, stc->GetId());
+ evt.SetEventObject(stc);
+ evt.SetDragResult(def);
+ evt.SetX(x);
+ evt.SetY(y);
+ evt.SetPosition(PositionFromLocation(Point(x,y)));
+ stc->GetEventHandler()->ProcessEvent(evt);
+
+ dragResult = evt.GetDragResult();
return dragResult;
}
DEFINE_EVENT_TYPE( wxEVT_STC_URIDROPPED )
DEFINE_EVENT_TYPE( wxEVT_STC_DWELLSTART )
DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND )
-
-
+DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG )
+DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER )
+DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP )
BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
void wxStyledTextCtrl::NotifyChange() {
wxStyledTextEvent evt(wxEVT_STC_CHANGE, GetId());
+ evt.SetEventObject(this);
GetEventHandler()->ProcessEvent(evt);
}
SCNotification& scn = *_scn;
wxStyledTextEvent evt(0, GetId());
+ evt.SetEventObject(this);
evt.SetPosition(scn.position);
evt.SetKey(scn.ch);
evt.SetModifiers(scn.modifiers);
}
-
//----------------------------------------------------------------------
//----------------------------------------------------------------------
//----------------------------------------------------------------------
m_listType = 0;
m_x = 0;
m_y = 0;
+ m_dragAllowMove = FALSE;
+ m_dragResult = wxDragNone;
}
bool wxStyledTextEvent::GetShift() const { return (m_modifiers & SCI_SHIFT) != 0; }
o->m_x = m_x;
o->m_y = m_y;
+ o->m_dragText = m_dragText;
+ o->m_dragAllowMove =m_dragAllowMove;
+ o->m_dragResult = m_dragResult;
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
+
+
+
DEFINE_EVENT_TYPE( wxEVT_STC_URIDROPPED )
DEFINE_EVENT_TYPE( wxEVT_STC_DWELLSTART )
DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND )
-
-
+DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG )
+DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER )
+DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP )
BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
void wxStyledTextCtrl::NotifyChange() {
wxStyledTextEvent evt(wxEVT_STC_CHANGE, GetId());
+ evt.SetEventObject(this);
GetEventHandler()->ProcessEvent(evt);
}
SCNotification& scn = *_scn;
wxStyledTextEvent evt(0, GetId());
+ evt.SetEventObject(this);
evt.SetPosition(scn.position);
evt.SetKey(scn.ch);
evt.SetModifiers(scn.modifiers);
}
-
//----------------------------------------------------------------------
//----------------------------------------------------------------------
//----------------------------------------------------------------------
m_listType = 0;
m_x = 0;
m_y = 0;
+ m_dragAllowMove = FALSE;
+ m_dragResult = wxDragNone;
}
bool wxStyledTextEvent::GetShift() const { return (m_modifiers & SCI_SHIFT) != 0; }
o->m_x = m_x;
o->m_y = m_y;
+ o->m_dragText = m_dragText;
+ o->m_dragAllowMove =m_dragAllowMove;
+ o->m_dragResult = m_dragResult;
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
+
+
+
#include <wx/wx.h>
+#include <wx/dnd.h>
//----------------------------------------------------------------------
// BEGIN generated section. The following code is automatically generated
void NotifyChange();
void NotifyParent(SCNotification* scn);
+
private:
DECLARE_EVENT_TABLE()
DECLARE_CLASS(wxStyledTextCtrl)
wxStyledTextEvent(wxEventType commandType=0, int id=0);
~wxStyledTextEvent() {}
- void SetPosition(int pos) { m_position = pos; }
- void SetKey(int k) { m_key = k; }
- void SetModifiers(int m) { m_modifiers = m; }
- void SetModificationType(int t) { m_modificationType = t; }
- void SetText(const char* t) { m_text = t; }
- void SetLength(int len) { m_length = len; }
- void SetLinesAdded(int num) { m_linesAdded = num; }
- void SetLine(int val) { m_line = val; }
- void SetFoldLevelNow(int val) { m_foldLevelNow = val; }
- void SetFoldLevelPrev(int val) { m_foldLevelPrev = val; }
- void SetMargin(int val) { m_margin = val; }
- void SetMessage(int val) { m_message = val; }
- void SetWParam(int val) { m_wParam = val; }
- void SetLParam(int val) { m_lParam = val; }
- void SetListType(int val) { m_listType = val; }
- void SetX(int val) { m_x = val; }
- void SetY(int val) { m_y = val; }
+ void SetPosition(int pos) { m_position = pos; }
+ void SetKey(int k) { m_key = k; }
+ void SetModifiers(int m) { m_modifiers = m; }
+ void SetModificationType(int t) { m_modificationType = t; }
+ void SetText(const char* t) { m_text = t; }
+ void SetLength(int len) { m_length = len; }
+ void SetLinesAdded(int num) { m_linesAdded = num; }
+ void SetLine(int val) { m_line = val; }
+ void SetFoldLevelNow(int val) { m_foldLevelNow = val; }
+ void SetFoldLevelPrev(int val) { m_foldLevelPrev = val; }
+ void SetMargin(int val) { m_margin = val; }
+ void SetMessage(int val) { m_message = val; }
+ void SetWParam(int val) { m_wParam = val; }
+ void SetLParam(int val) { m_lParam = val; }
+ void SetListType(int val) { m_listType = val; }
+ void SetX(int val) { m_x = val; }
+ void SetY(int val) { m_y = val; }
+ void SetDragText(const wxString& val) { m_dragText = val; }
+ void SetDragAllowMove(bool val) { m_dragAllowMove = val; }
+ void SetDragResult(wxDragResult val) { m_dragResult = val; }
int GetPosition() const { return m_position; }
int GetKey() const { return m_key; }
int GetListType() const { return m_listType; }
int GetX() const { return m_x; }
int GetY() const { return m_y; }
+ wxString GetDragText() { return m_dragText; }
+ bool GetDragAllowMove() { return m_dragAllowMove; }
+ wxDragResult GetDragResult() { return m_dragResult; }
bool GetShift() const;
bool GetControl() const;
int m_listType;
int m_x;
int m_y;
+
+ wxString m_dragText; // wxEVT_STC_START_DRAG, wxEVT_STC_DO_DROP
+ bool m_dragAllowMove; // wxEVT_STC_START_DRAG
+
+ wxDragResult m_dragResult; // wxEVT_STC_DRAG_OVER,wxEVT_STC_DO_DROP
#endif
};
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_URIDROPPED, 1666)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLSTART, 1667)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLEND, 1668)
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_START_DRAG, 1669)
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DRAG_OVER, 1670)
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DO_DROP, 1671)
END_DECLARE_EVENT_TYPES()
#else
enum {
wxEVT_STC_URIDROPPED,
wxEVT_STC_DWELLSTART,
wxEVT_STC_DWELLEND,
+ wxEVT_STC_START_DRAG,
+ wxEVT_STC_DRAG_OVER,
+ wxEVT_STC_DO_DROP,
};
#endif
#define EVT_STC_URIDROPPED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_URIDROPPED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_DWELLSTART(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLSTART, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_DWELLEND(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLEND, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-
+#define EVT_STC_START_DRAG(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_START_DRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_DRAG_OVER(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_DO_DROP(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#endif
#include <wx/wx.h>
+#include <wx/dnd.h>
//----------------------------------------------------------------------
// BEGIN generated section. The following code is automatically generated
void NotifyChange();
void NotifyParent(SCNotification* scn);
+
private:
DECLARE_EVENT_TABLE()
DECLARE_CLASS(wxStyledTextCtrl)
wxStyledTextEvent(wxEventType commandType=0, int id=0);
~wxStyledTextEvent() {}
- void SetPosition(int pos) { m_position = pos; }
- void SetKey(int k) { m_key = k; }
- void SetModifiers(int m) { m_modifiers = m; }
- void SetModificationType(int t) { m_modificationType = t; }
- void SetText(const char* t) { m_text = t; }
- void SetLength(int len) { m_length = len; }
- void SetLinesAdded(int num) { m_linesAdded = num; }
- void SetLine(int val) { m_line = val; }
- void SetFoldLevelNow(int val) { m_foldLevelNow = val; }
- void SetFoldLevelPrev(int val) { m_foldLevelPrev = val; }
- void SetMargin(int val) { m_margin = val; }
- void SetMessage(int val) { m_message = val; }
- void SetWParam(int val) { m_wParam = val; }
- void SetLParam(int val) { m_lParam = val; }
- void SetListType(int val) { m_listType = val; }
- void SetX(int val) { m_x = val; }
- void SetY(int val) { m_y = val; }
+ void SetPosition(int pos) { m_position = pos; }
+ void SetKey(int k) { m_key = k; }
+ void SetModifiers(int m) { m_modifiers = m; }
+ void SetModificationType(int t) { m_modificationType = t; }
+ void SetText(const char* t) { m_text = t; }
+ void SetLength(int len) { m_length = len; }
+ void SetLinesAdded(int num) { m_linesAdded = num; }
+ void SetLine(int val) { m_line = val; }
+ void SetFoldLevelNow(int val) { m_foldLevelNow = val; }
+ void SetFoldLevelPrev(int val) { m_foldLevelPrev = val; }
+ void SetMargin(int val) { m_margin = val; }
+ void SetMessage(int val) { m_message = val; }
+ void SetWParam(int val) { m_wParam = val; }
+ void SetLParam(int val) { m_lParam = val; }
+ void SetListType(int val) { m_listType = val; }
+ void SetX(int val) { m_x = val; }
+ void SetY(int val) { m_y = val; }
+ void SetDragText(const wxString& val) { m_dragText = val; }
+ void SetDragAllowMove(bool val) { m_dragAllowMove = val; }
+ void SetDragResult(wxDragResult val) { m_dragResult = val; }
int GetPosition() const { return m_position; }
int GetKey() const { return m_key; }
int GetListType() const { return m_listType; }
int GetX() const { return m_x; }
int GetY() const { return m_y; }
+ wxString GetDragText() { return m_dragText; }
+ bool GetDragAllowMove() { return m_dragAllowMove; }
+ wxDragResult GetDragResult() { return m_dragResult; }
bool GetShift() const;
bool GetControl() const;
int m_listType;
int m_x;
int m_y;
+
+ wxString m_dragText; // wxEVT_STC_START_DRAG, wxEVT_STC_DO_DROP
+ bool m_dragAllowMove; // wxEVT_STC_START_DRAG
+
+ wxDragResult m_dragResult; // wxEVT_STC_DRAG_OVER,wxEVT_STC_DO_DROP
#endif
};
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_URIDROPPED, 1666)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLSTART, 1667)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLEND, 1668)
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_START_DRAG, 1669)
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DRAG_OVER, 1670)
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DO_DROP, 1671)
END_DECLARE_EVENT_TYPES()
#else
enum {
wxEVT_STC_URIDROPPED,
wxEVT_STC_DWELLSTART,
wxEVT_STC_DWELLEND,
+ wxEVT_STC_START_DRAG,
+ wxEVT_STC_DRAG_OVER,
+ wxEVT_STC_DO_DROP,
};
#endif
#define EVT_STC_URIDROPPED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_URIDROPPED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_DWELLSTART(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLSTART, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_DWELLEND(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLEND, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-
+#define EVT_STC_START_DRAG(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_START_DRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_DRAG_OVER(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_DO_DROP(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#endif
void ScintillaWX::StartDrag() {
- wxDropSource source(wMain.GetID());
- wxTextDataObject data(wxString(drag.s, drag.len));
- wxDragResult result;
-
- dropWentOutside = true;
- source.SetData(data);
- result = source.DoDragDrop(TRUE);
- if (result == wxDragMove && dropWentOutside)
- ClearSelection();
- inDragDrop = FALSE;
- SetDragPosition(invalidPosition);
+ wxString dragText(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(wMain.GetID());
+ wxTextDataObject data(dragText);
+ wxDragResult result;
+
+ source.SetData(data);
+ dropWentOutside = TRUE;
+ result = source.DoDragDrop(evt.GetDragAllowMove());
+ if (result == wxDragMove && dropWentOutside)
+ ClearSelection();
+ inDragDrop = FALSE;
+ SetDragPosition(invalidPosition);
+ }
}
bool ScintillaWX::DoDropText(long x, long y, const wxString& data) {
SetDragPosition(invalidPosition);
- int movePos = PositionFromLocation(Point(x,y));
- DropAt(movePos, data, dragResult == wxDragMove, FALSE); // TODO: rectangular?
- return TRUE;
+
+ // Send an event to allow the drag details to be changed
+ wxStyledTextEvent evt(wxEVT_STC_DO_DROP, stc->GetId());
+ evt.SetEventObject(stc);
+ evt.SetDragResult(dragResult);
+ evt.SetX(x);
+ evt.SetY(y);
+ evt.SetPosition(PositionFromLocation(Point(x,y)));
+ evt.SetDragText(data);
+ stc->GetEventHandler()->ProcessEvent(evt);
+
+ dragResult = evt.GetDragResult();
+ if (dragResult == wxDragMove || dragResult == wxDragCopy) {
+ DropAt(evt.GetPosition(),
+ evt.GetDragText(),
+ dragResult == wxDragMove,
+ FALSE); // TODO: rectangular?
+ return TRUE;
+ }
+ return FALSE;
}
wxDragResult ScintillaWX::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) {
SetDragPosition(PositionFromLocation(Point(x, y)));
- dragResult = def;
+
+ // Send an event to allow the drag result to be changed
+ wxStyledTextEvent evt(wxEVT_STC_DRAG_OVER, stc->GetId());
+ evt.SetEventObject(stc);
+ evt.SetDragResult(def);
+ evt.SetX(x);
+ evt.SetY(y);
+ evt.SetPosition(PositionFromLocation(Point(x,y)));
+ stc->GetEventHandler()->ProcessEvent(evt);
+
+ dragResult = evt.GetDragResult();
return dragResult;
}
DEFINE_EVENT_TYPE( wxEVT_STC_URIDROPPED )
DEFINE_EVENT_TYPE( wxEVT_STC_DWELLSTART )
DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND )
-
-
+DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG )
+DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER )
+DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP )
BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
void wxStyledTextCtrl::NotifyChange() {
wxStyledTextEvent evt(wxEVT_STC_CHANGE, GetId());
+ evt.SetEventObject(this);
GetEventHandler()->ProcessEvent(evt);
}
SCNotification& scn = *_scn;
wxStyledTextEvent evt(0, GetId());
+ evt.SetEventObject(this);
evt.SetPosition(scn.position);
evt.SetKey(scn.ch);
evt.SetModifiers(scn.modifiers);
}
-
//----------------------------------------------------------------------
//----------------------------------------------------------------------
//----------------------------------------------------------------------
m_listType = 0;
m_x = 0;
m_y = 0;
+ m_dragAllowMove = FALSE;
+ m_dragResult = wxDragNone;
}
bool wxStyledTextEvent::GetShift() const { return (m_modifiers & SCI_SHIFT) != 0; }
o->m_x = m_x;
o->m_y = m_y;
+ o->m_dragText = m_dragText;
+ o->m_dragAllowMove =m_dragAllowMove;
+ o->m_dragResult = m_dragResult;
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
+
+
+
DEFINE_EVENT_TYPE( wxEVT_STC_URIDROPPED )
DEFINE_EVENT_TYPE( wxEVT_STC_DWELLSTART )
DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND )
-
-
+DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG )
+DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER )
+DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP )
BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
void wxStyledTextCtrl::NotifyChange() {
wxStyledTextEvent evt(wxEVT_STC_CHANGE, GetId());
+ evt.SetEventObject(this);
GetEventHandler()->ProcessEvent(evt);
}
SCNotification& scn = *_scn;
wxStyledTextEvent evt(0, GetId());
+ evt.SetEventObject(this);
evt.SetPosition(scn.position);
evt.SetKey(scn.ch);
evt.SetModifiers(scn.modifiers);
}
-
//----------------------------------------------------------------------
//----------------------------------------------------------------------
//----------------------------------------------------------------------
m_listType = 0;
m_x = 0;
m_y = 0;
+ m_dragAllowMove = FALSE;
+ m_dragResult = wxDragNone;
}
bool wxStyledTextEvent::GetShift() const { return (m_modifiers & SCI_SHIFT) != 0; }
o->m_x = m_x;
o->m_y = m_y;
+ o->m_dragText = m_dragText;
+ o->m_dragAllowMove =m_dragAllowMove;
+ o->m_dragResult = m_dragResult;
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
+
+
+
#include <wx/wx.h>
+#include <wx/dnd.h>
//----------------------------------------------------------------------
// BEGIN generated section. The following code is automatically generated
void NotifyChange();
void NotifyParent(SCNotification* scn);
+
private:
DECLARE_EVENT_TABLE()
DECLARE_CLASS(wxStyledTextCtrl)
wxStyledTextEvent(wxEventType commandType=0, int id=0);
~wxStyledTextEvent() {}
- void SetPosition(int pos) { m_position = pos; }
- void SetKey(int k) { m_key = k; }
- void SetModifiers(int m) { m_modifiers = m; }
- void SetModificationType(int t) { m_modificationType = t; }
- void SetText(const char* t) { m_text = t; }
- void SetLength(int len) { m_length = len; }
- void SetLinesAdded(int num) { m_linesAdded = num; }
- void SetLine(int val) { m_line = val; }
- void SetFoldLevelNow(int val) { m_foldLevelNow = val; }
- void SetFoldLevelPrev(int val) { m_foldLevelPrev = val; }
- void SetMargin(int val) { m_margin = val; }
- void SetMessage(int val) { m_message = val; }
- void SetWParam(int val) { m_wParam = val; }
- void SetLParam(int val) { m_lParam = val; }
- void SetListType(int val) { m_listType = val; }
- void SetX(int val) { m_x = val; }
- void SetY(int val) { m_y = val; }
+ void SetPosition(int pos) { m_position = pos; }
+ void SetKey(int k) { m_key = k; }
+ void SetModifiers(int m) { m_modifiers = m; }
+ void SetModificationType(int t) { m_modificationType = t; }
+ void SetText(const char* t) { m_text = t; }
+ void SetLength(int len) { m_length = len; }
+ void SetLinesAdded(int num) { m_linesAdded = num; }
+ void SetLine(int val) { m_line = val; }
+ void SetFoldLevelNow(int val) { m_foldLevelNow = val; }
+ void SetFoldLevelPrev(int val) { m_foldLevelPrev = val; }
+ void SetMargin(int val) { m_margin = val; }
+ void SetMessage(int val) { m_message = val; }
+ void SetWParam(int val) { m_wParam = val; }
+ void SetLParam(int val) { m_lParam = val; }
+ void SetListType(int val) { m_listType = val; }
+ void SetX(int val) { m_x = val; }
+ void SetY(int val) { m_y = val; }
+ void SetDragText(const wxString& val) { m_dragText = val; }
+ void SetDragAllowMove(bool val) { m_dragAllowMove = val; }
+ void SetDragResult(wxDragResult val) { m_dragResult = val; }
int GetPosition() const { return m_position; }
int GetKey() const { return m_key; }
int GetListType() const { return m_listType; }
int GetX() const { return m_x; }
int GetY() const { return m_y; }
+ wxString GetDragText() { return m_dragText; }
+ bool GetDragAllowMove() { return m_dragAllowMove; }
+ wxDragResult GetDragResult() { return m_dragResult; }
bool GetShift() const;
bool GetControl() const;
int m_listType;
int m_x;
int m_y;
+
+ wxString m_dragText; // wxEVT_STC_START_DRAG, wxEVT_STC_DO_DROP
+ bool m_dragAllowMove; // wxEVT_STC_START_DRAG
+
+ wxDragResult m_dragResult; // wxEVT_STC_DRAG_OVER,wxEVT_STC_DO_DROP
#endif
};
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_URIDROPPED, 1666)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLSTART, 1667)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLEND, 1668)
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_START_DRAG, 1669)
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DRAG_OVER, 1670)
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DO_DROP, 1671)
END_DECLARE_EVENT_TYPES()
#else
enum {
wxEVT_STC_URIDROPPED,
wxEVT_STC_DWELLSTART,
wxEVT_STC_DWELLEND,
+ wxEVT_STC_START_DRAG,
+ wxEVT_STC_DRAG_OVER,
+ wxEVT_STC_DO_DROP,
};
#endif
#define EVT_STC_URIDROPPED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_URIDROPPED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_DWELLSTART(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLSTART, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#define EVT_STC_DWELLEND(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLEND, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
-
+#define EVT_STC_START_DRAG(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_START_DRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_DRAG_OVER(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
+#define EVT_STC_DO_DROP(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ),
#endif
return _resultobj;
}
+#define wxStyledTextEvent_SetDragText(_swigobj,_swigarg0) (_swigobj->SetDragText(_swigarg0))
+static PyObject *_wrap_wxStyledTextEvent_SetDragText(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxStyledTextEvent * _arg0;
+ wxString * _arg1;
+ PyObject * _argo0 = 0;
+ PyObject * _obj1 = 0;
+ char *_kwnames[] = { "self","val", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxStyledTextEvent_SetDragText",_kwnames,&_argo0,&_obj1))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_SetDragText. Expected _wxStyledTextEvent_p.");
+ return NULL;
+ }
+ }
+{
+#if PYTHON_API_VERSION >= 1009
+ char* tmpPtr; int tmpSize;
+ if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) {
+ PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
+ return NULL;
+ }
+ if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1)
+ return NULL;
+ _arg1 = new wxString(tmpPtr, tmpSize);
+#else
+ if (!PyString_Check(_obj1)) {
+ PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
+ return NULL;
+ }
+ _arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1));
+#endif
+}
+{
+ wxPy_BEGIN_ALLOW_THREADS;
+ wxStyledTextEvent_SetDragText(_arg0,*_arg1);
+
+ wxPy_END_ALLOW_THREADS;
+} Py_INCREF(Py_None);
+ _resultobj = Py_None;
+{
+ if (_obj1)
+ delete _arg1;
+}
+ return _resultobj;
+}
+
+#define wxStyledTextEvent_SetDragAllowMove(_swigobj,_swigarg0) (_swigobj->SetDragAllowMove(_swigarg0))
+static PyObject *_wrap_wxStyledTextEvent_SetDragAllowMove(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxStyledTextEvent * _arg0;
+ bool _arg1;
+ PyObject * _argo0 = 0;
+ int tempbool1;
+ char *_kwnames[] = { "self","val", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextEvent_SetDragAllowMove",_kwnames,&_argo0,&tempbool1))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_SetDragAllowMove. Expected _wxStyledTextEvent_p.");
+ return NULL;
+ }
+ }
+ _arg1 = (bool ) tempbool1;
+{
+ wxPy_BEGIN_ALLOW_THREADS;
+ wxStyledTextEvent_SetDragAllowMove(_arg0,_arg1);
+
+ wxPy_END_ALLOW_THREADS;
+} Py_INCREF(Py_None);
+ _resultobj = Py_None;
+ return _resultobj;
+}
+
+#define wxStyledTextEvent_SetDragResult(_swigobj,_swigarg0) (_swigobj->SetDragResult(_swigarg0))
+static PyObject *_wrap_wxStyledTextEvent_SetDragResult(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxStyledTextEvent * _arg0;
+ wxDragResult _arg1;
+ PyObject * _argo0 = 0;
+ char *_kwnames[] = { "self","val", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi:wxStyledTextEvent_SetDragResult",_kwnames,&_argo0,&_arg1))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_SetDragResult. Expected _wxStyledTextEvent_p.");
+ return NULL;
+ }
+ }
+{
+ wxPy_BEGIN_ALLOW_THREADS;
+ wxStyledTextEvent_SetDragResult(_arg0,_arg1);
+
+ wxPy_END_ALLOW_THREADS;
+} Py_INCREF(Py_None);
+ _resultobj = Py_None;
+ return _resultobj;
+}
+
#define wxStyledTextEvent_GetPosition(_swigobj) (_swigobj->GetPosition())
static PyObject *_wrap_wxStyledTextEvent_GetPosition(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
return _resultobj;
}
+#define wxStyledTextEvent_GetDragText(_swigobj) (_swigobj->GetDragText())
+static PyObject *_wrap_wxStyledTextEvent_GetDragText(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxString * _result;
+ wxStyledTextEvent * _arg0;
+ PyObject * _argo0 = 0;
+ char *_kwnames[] = { "self", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextEvent_GetDragText",_kwnames,&_argo0))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_GetDragText. Expected _wxStyledTextEvent_p.");
+ return NULL;
+ }
+ }
+{
+ wxPy_BEGIN_ALLOW_THREADS;
+ _result = new wxString (wxStyledTextEvent_GetDragText(_arg0));
+
+ wxPy_END_ALLOW_THREADS;
+}{
+ _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
+}
+{
+ delete _result;
+}
+ return _resultobj;
+}
+
+#define wxStyledTextEvent_GetDragAllowMove(_swigobj) (_swigobj->GetDragAllowMove())
+static PyObject *_wrap_wxStyledTextEvent_GetDragAllowMove(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ bool _result;
+ wxStyledTextEvent * _arg0;
+ PyObject * _argo0 = 0;
+ char *_kwnames[] = { "self", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextEvent_GetDragAllowMove",_kwnames,&_argo0))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_GetDragAllowMove. Expected _wxStyledTextEvent_p.");
+ return NULL;
+ }
+ }
+{
+ wxPy_BEGIN_ALLOW_THREADS;
+ _result = (bool )wxStyledTextEvent_GetDragAllowMove(_arg0);
+
+ wxPy_END_ALLOW_THREADS;
+} _resultobj = Py_BuildValue("i",_result);
+ return _resultobj;
+}
+
+#define wxStyledTextEvent_GetDragResult(_swigobj) (_swigobj->GetDragResult())
+static PyObject *_wrap_wxStyledTextEvent_GetDragResult(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxDragResult _result;
+ wxStyledTextEvent * _arg0;
+ PyObject * _argo0 = 0;
+ char *_kwnames[] = { "self", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxStyledTextEvent_GetDragResult",_kwnames,&_argo0))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxStyledTextEvent_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxStyledTextEvent_GetDragResult. Expected _wxStyledTextEvent_p.");
+ return NULL;
+ }
+ }
+{
+ wxPy_BEGIN_ALLOW_THREADS;
+ _result = (wxDragResult )wxStyledTextEvent_GetDragResult(_arg0);
+
+ wxPy_END_ALLOW_THREADS;
+} _resultobj = Py_BuildValue("i",_result);
+ return _resultobj;
+}
+
#define wxStyledTextEvent_GetShift(_swigobj) (_swigobj->GetShift())
static PyObject *_wrap_wxStyledTextEvent_GetShift(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
{ "wxStyledTextEvent_GetAlt", (PyCFunction) _wrap_wxStyledTextEvent_GetAlt, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextEvent_GetControl", (PyCFunction) _wrap_wxStyledTextEvent_GetControl, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextEvent_GetShift", (PyCFunction) _wrap_wxStyledTextEvent_GetShift, METH_VARARGS | METH_KEYWORDS },
+ { "wxStyledTextEvent_GetDragResult", (PyCFunction) _wrap_wxStyledTextEvent_GetDragResult, METH_VARARGS | METH_KEYWORDS },
+ { "wxStyledTextEvent_GetDragAllowMove", (PyCFunction) _wrap_wxStyledTextEvent_GetDragAllowMove, METH_VARARGS | METH_KEYWORDS },
+ { "wxStyledTextEvent_GetDragText", (PyCFunction) _wrap_wxStyledTextEvent_GetDragText, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextEvent_GetY", (PyCFunction) _wrap_wxStyledTextEvent_GetY, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextEvent_GetX", (PyCFunction) _wrap_wxStyledTextEvent_GetX, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextEvent_GetListType", (PyCFunction) _wrap_wxStyledTextEvent_GetListType, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextEvent_GetModifiers", (PyCFunction) _wrap_wxStyledTextEvent_GetModifiers, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextEvent_GetKey", (PyCFunction) _wrap_wxStyledTextEvent_GetKey, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextEvent_GetPosition", (PyCFunction) _wrap_wxStyledTextEvent_GetPosition, METH_VARARGS | METH_KEYWORDS },
+ { "wxStyledTextEvent_SetDragResult", (PyCFunction) _wrap_wxStyledTextEvent_SetDragResult, METH_VARARGS | METH_KEYWORDS },
+ { "wxStyledTextEvent_SetDragAllowMove", (PyCFunction) _wrap_wxStyledTextEvent_SetDragAllowMove, METH_VARARGS | METH_KEYWORDS },
+ { "wxStyledTextEvent_SetDragText", (PyCFunction) _wrap_wxStyledTextEvent_SetDragText, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextEvent_SetY", (PyCFunction) _wrap_wxStyledTextEvent_SetY, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextEvent_SetX", (PyCFunction) _wrap_wxStyledTextEvent_SetX, METH_VARARGS | METH_KEYWORDS },
{ "wxStyledTextEvent_SetListType", (PyCFunction) _wrap_wxStyledTextEvent_SetListType, METH_VARARGS | METH_KEYWORDS },
PyDict_SetItemString(d,"wxEVT_STC_URIDROPPED", PyInt_FromLong((long) wxEVT_STC_URIDROPPED));
PyDict_SetItemString(d,"wxEVT_STC_DWELLSTART", PyInt_FromLong((long) wxEVT_STC_DWELLSTART));
PyDict_SetItemString(d,"wxEVT_STC_DWELLEND", PyInt_FromLong((long) wxEVT_STC_DWELLEND));
+ PyDict_SetItemString(d,"wxEVT_STC_START_DRAG", PyInt_FromLong((long) wxEVT_STC_START_DRAG));
+ PyDict_SetItemString(d,"wxEVT_STC_DRAG_OVER", PyInt_FromLong((long) wxEVT_STC_DRAG_OVER));
+ PyDict_SetItemString(d,"wxEVT_STC_DO_DROP", PyInt_FromLong((long) wxEVT_STC_DO_DROP));
wxClassInfo::CleanUpClasses();
def EVT_STC_DWELLEND(win, id, func):
win.Connect(id, -1, wxEVT_STC_DWELLEND, func)
+def EVT_STC_START_DRAG(win, id, func):
+ win.Connect(id, -1, wxEVT_STC_START_DRAG, func)
+
+def EVT_STC_DRAG_OVER(win, id, func):
+ win.Connect(id, -1, wxEVT_STC_DRAG_OVER, func)
+
+def EVT_STC_DO_DROP(win, id, func):
+ win.Connect(id, -1, wxEVT_STC_DO_DROP, func)
"
def EVT_STC_DWELLEND(win, id, func):
win.Connect(id, -1, wxEVT_STC_DWELLEND, func)
+def EVT_STC_START_DRAG(win, id, func):
+ win.Connect(id, -1, wxEVT_STC_START_DRAG, func)
+
+def EVT_STC_DRAG_OVER(win, id, func):
+ win.Connect(id, -1, wxEVT_STC_DRAG_OVER, func)
+
+def EVT_STC_DO_DROP(win, id, func):
+ win.Connect(id, -1, wxEVT_STC_DO_DROP, func)
class wxStyledTextCtrlPtr(wxControlPtr):
def SetY(self, *_args, **_kwargs):
val = apply(stc_c.wxStyledTextEvent_SetY,(self,) + _args, _kwargs)
return val
+ def SetDragText(self, *_args, **_kwargs):
+ val = apply(stc_c.wxStyledTextEvent_SetDragText,(self,) + _args, _kwargs)
+ return val
+ def SetDragAllowMove(self, *_args, **_kwargs):
+ val = apply(stc_c.wxStyledTextEvent_SetDragAllowMove,(self,) + _args, _kwargs)
+ return val
+ def SetDragResult(self, *_args, **_kwargs):
+ val = apply(stc_c.wxStyledTextEvent_SetDragResult,(self,) + _args, _kwargs)
+ return val
def GetPosition(self, *_args, **_kwargs):
val = apply(stc_c.wxStyledTextEvent_GetPosition,(self,) + _args, _kwargs)
return val
def GetY(self, *_args, **_kwargs):
val = apply(stc_c.wxStyledTextEvent_GetY,(self,) + _args, _kwargs)
return val
+ def GetDragText(self, *_args, **_kwargs):
+ val = apply(stc_c.wxStyledTextEvent_GetDragText,(self,) + _args, _kwargs)
+ return val
+ def GetDragAllowMove(self, *_args, **_kwargs):
+ val = apply(stc_c.wxStyledTextEvent_GetDragAllowMove,(self,) + _args, _kwargs)
+ return val
+ def GetDragResult(self, *_args, **_kwargs):
+ val = apply(stc_c.wxStyledTextEvent_GetDragResult,(self,) + _args, _kwargs)
+ return val
def GetShift(self, *_args, **_kwargs):
val = apply(stc_c.wxStyledTextEvent_GetShift,(self,) + _args, _kwargs)
return val
wxEVT_STC_URIDROPPED = stc_c.wxEVT_STC_URIDROPPED
wxEVT_STC_DWELLSTART = stc_c.wxEVT_STC_DWELLSTART
wxEVT_STC_DWELLEND = stc_c.wxEVT_STC_DWELLEND
+wxEVT_STC_START_DRAG = stc_c.wxEVT_STC_START_DRAG
+wxEVT_STC_DRAG_OVER = stc_c.wxEVT_STC_DRAG_OVER
+wxEVT_STC_DO_DROP = stc_c.wxEVT_STC_DO_DROP
#-------------- USER INCLUDE -----------------------
<FONT color=#a020f0>#include </FONT><FONT color=#ff00ff><wx/wx.h></FONT>
+<FONT color=#a020f0>#include </FONT><FONT color=#ff00ff><wx/dnd.h></FONT>
<FONT color=#0000ff>//----------------------------------------------------------------------</FONT>
<FONT color=#0000ff>// BEGIN generated section. The following code is automatically generated</FONT>
<FONT color=#a020f0>#define wxSTC_MARK_CIRCLEPLUSCONNECTED </FONT><FONT color=#ff00ff>19</FONT>
<FONT color=#a020f0>#define wxSTC_MARK_CIRCLEMINUS </FONT><FONT color=#ff00ff>20</FONT>
<FONT color=#a020f0>#define wxSTC_MARK_CIRCLEMINUSCONNECTED </FONT><FONT color=#ff00ff>21</FONT>
+<FONT color=#a020f0>#define wxSTC_MARK_CHARACTER </FONT><FONT color=#ff00ff>10000</FONT>
<FONT color=#0000ff>// Markers used for outlining column</FONT>
<FONT color=#a020f0>#define wxSTC_MARKNUM_FOLDEREND </FONT><FONT color=#ff00ff>25</FONT>
<FONT color=#a020f0>#define wxSTC_MARKNUM_FOLDEROPEN </FONT><FONT color=#ff00ff>31</FONT>
<FONT color=#a020f0>#define wxSTC_MARGIN_SYMBOL </FONT><FONT color=#ff00ff>0</FONT>
<FONT color=#a020f0>#define wxSTC_MARGIN_NUMBER </FONT><FONT color=#ff00ff>1</FONT>
+
+<FONT color=#0000ff>// Styles in range 32..37 are predefined for parts of the UI and are not used as normal styles.</FONT>
+<FONT color=#0000ff>// Styles 38 and 39 are for future use.</FONT>
<FONT color=#a020f0>#define wxSTC_STYLE_DEFAULT </FONT><FONT color=#ff00ff>32</FONT>
<FONT color=#a020f0>#define wxSTC_STYLE_LINENUMBER </FONT><FONT color=#ff00ff>33</FONT>
<FONT color=#a020f0>#define wxSTC_STYLE_BRACELIGHT </FONT><FONT color=#ff00ff>34</FONT>
<FONT color=#a020f0>#define wxSTC_STYLE_BRACEBAD </FONT><FONT color=#ff00ff>35</FONT>
<FONT color=#a020f0>#define wxSTC_STYLE_CONTROLCHAR </FONT><FONT color=#ff00ff>36</FONT>
<FONT color=#a020f0>#define wxSTC_STYLE_INDENTGUIDE </FONT><FONT color=#ff00ff>37</FONT>
+<FONT color=#a020f0>#define wxSTC_STYLE_LASTPREDEFINED </FONT><FONT color=#ff00ff>39</FONT>
<FONT color=#a020f0>#define wxSTC_STYLE_MAX </FONT><FONT color=#ff00ff>127</FONT>
<FONT color=#0000ff>// Character set identifiers are used in StyleSetCharacterSet.</FONT>
<FONT color=#a020f0>#define wxSTC_LEX_EIFFEL </FONT><FONT color=#ff00ff>23</FONT>
<FONT color=#a020f0>#define wxSTC_LEX_EIFFELKW </FONT><FONT color=#ff00ff>24</FONT>
<FONT color=#a020f0>#define wxSTC_LEX_TCL </FONT><FONT color=#ff00ff>25</FONT>
+<FONT color=#a020f0>#define wxSTC_LEX_NNCRONTAB </FONT><FONT color=#ff00ff>26</FONT>
<FONT color=#0000ff>// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a</FONT>
<FONT color=#0000ff>// value assigned in sequence from SCLEX_AUTOMATIC+1.</FONT>
<FONT color=#a020f0>#define wxSTC_C_REGEX </FONT><FONT color=#ff00ff>14</FONT>
<FONT color=#a020f0>#define wxSTC_C_COMMENTLINEDOC </FONT><FONT color=#ff00ff>15</FONT>
<FONT color=#a020f0>#define wxSTC_C_WORD2 </FONT><FONT color=#ff00ff>16</FONT>
+<FONT color=#a020f0>#define wxSTC_C_COMMENTDOCKEYWORD </FONT><FONT color=#ff00ff>17</FONT>
+<FONT color=#a020f0>#define wxSTC_C_COMMENTDOCKEYWORDERROR </FONT><FONT color=#ff00ff>18</FONT>
<FONT color=#0000ff>// Lexical states for SCLEX_HTML, SCLEX_XML</FONT>
<FONT color=#a020f0>#define wxSTC_H_DEFAULT </FONT><FONT color=#ff00ff>0</FONT>
<FONT color=#a020f0>#define wxSTC_H_XCCOMMENT </FONT><FONT color=#ff00ff>20</FONT>
<FONT color=#0000ff>// SGML</FONT>
-<FONT color=#a020f0>#define wxSTC_H_SGML </FONT><FONT color=#ff00ff>21</FONT>
+<FONT color=#a020f0>#define wxSTC_H_SGML_DEFAULT </FONT><FONT color=#ff00ff>21</FONT>
+<FONT color=#a020f0>#define wxSTC_H_SGML_COMMAND </FONT><FONT color=#ff00ff>22</FONT>
+<FONT color=#a020f0>#define wxSTC_H_SGML_1ST_PARAM </FONT><FONT color=#ff00ff>23</FONT>
+<FONT color=#a020f0>#define wxSTC_H_SGML_DOUBLESTRING </FONT><FONT color=#ff00ff>24</FONT>
+<FONT color=#a020f0>#define wxSTC_H_SGML_SIMPLESTRING </FONT><FONT color=#ff00ff>25</FONT>
+<FONT color=#a020f0>#define wxSTC_H_SGML_ERROR </FONT><FONT color=#ff00ff>26</FONT>
+<FONT color=#a020f0>#define wxSTC_H_SGML_SPECIAL </FONT><FONT color=#ff00ff>27</FONT>
+<FONT color=#a020f0>#define wxSTC_H_SGML_ENTITY </FONT><FONT color=#ff00ff>28</FONT>
+<FONT color=#a020f0>#define wxSTC_H_SGML_COMMENT </FONT><FONT color=#ff00ff>29</FONT>
+<FONT color=#a020f0>#define wxSTC_H_SGML_1ST_PARAM_COMMENT </FONT><FONT color=#ff00ff>30</FONT>
+<FONT color=#a020f0>#define wxSTC_H_SGML_BLOCK_DEFAULT </FONT><FONT color=#ff00ff>31</FONT>
<FONT color=#0000ff>// Embedded Javascript</FONT>
<FONT color=#a020f0>#define wxSTC_HJ_START </FONT><FONT color=#ff00ff>40</FONT>
<FONT color=#a020f0>#define wxSTC_EIFFEL_IDENTIFIER </FONT><FONT color=#ff00ff>7</FONT>
<FONT color=#a020f0>#define wxSTC_EIFFEL_STRINGEOL </FONT><FONT color=#ff00ff>8</FONT>
+<FONT color=#0000ff>// Lexical states for the SCLEX_NNCRONTAB (nnCron crontab Lexer)</FONT>
+<FONT color=#a020f0>#define wxSTC_NNCRONTAB_DEFAULT </FONT><FONT color=#ff00ff>0</FONT>
+<FONT color=#a020f0>#define wxSTC_NNCRONTAB_COMMENT </FONT><FONT color=#ff00ff>1</FONT>
+<FONT color=#a020f0>#define wxSTC_NNCRONTAB_TASK </FONT><FONT color=#ff00ff>2</FONT>
+<FONT color=#a020f0>#define wxSTC_NNCRONTAB_SECTION </FONT><FONT color=#ff00ff>3</FONT>
+<FONT color=#a020f0>#define wxSTC_NNCRONTAB_KEYWORD </FONT><FONT color=#ff00ff>4</FONT>
+<FONT color=#a020f0>#define wxSTC_NNCRONTAB_MODIFIER </FONT><FONT color=#ff00ff>5</FONT>
+<FONT color=#a020f0>#define wxSTC_NNCRONTAB_ASTERISK </FONT><FONT color=#ff00ff>6</FONT>
+<FONT color=#a020f0>#define wxSTC_NNCRONTAB_NUMBER </FONT><FONT color=#ff00ff>7</FONT>
+<FONT color=#a020f0>#define wxSTC_NNCRONTAB_STRING </FONT><FONT color=#ff00ff>8</FONT>
+<FONT color=#a020f0>#define wxSTC_NNCRONTAB_ENVIRONMENT </FONT><FONT color=#ff00ff>9</FONT>
+<FONT color=#a020f0>#define wxSTC_NNCRONTAB_IDENTIFIER </FONT><FONT color=#ff00ff>10</FONT>
+
<FONT color=#0000ff>// END of generated section</FONT>
<FONT color=#0000ff>//----------------------------------------------------------------------</FONT>
<FONT color=#0000ff>// Others</FONT>
<B><FONT color=#2e8b57>const</FONT></B> wxPoint& pos = wxDefaultPosition,
<B><FONT color=#2e8b57>const</FONT></B> wxSize& size = wxDefaultSize, <B><FONT color=#2e8b57>long</FONT></B> style = <FONT color=#ff00ff>0</FONT>,
<B><FONT color=#2e8b57>const</FONT></B> <B><FONT color=#2e8b57>char</FONT></B>* name = <FONT color=#ff00ff>"styledtext"</FONT>);
+ %pragma(python) addtomethod = <FONT color=#ff00ff>"__init__:self._setOORInfo(self)"</FONT>
+
<FONT color=#a020f0>#else</FONT>
wxStyledTextCtrl(wxWindow *parent, wxWindowID id,
<B><FONT color=#2e8b57>const</FONT></B> wxPoint& pos = wxDefaultPosition,
<FONT color=#0000ff>// Retrieve the text of the line containing the caret.</FONT>
<FONT color=#0000ff>// Returns the index of the caret on the line.</FONT>
- wxString GetCurLine(<B><FONT color=#2e8b57>int</FONT></B>* OUTPUT=<FONT color=#ff00ff>NULL</FONT>);
+<FONT color=#a020f0> #ifdef SWIG</FONT>
+ wxString GetCurLine(<B><FONT color=#2e8b57>int</FONT></B>* OUTPUT);
+<FONT color=#a020f0>#else</FONT>
+ wxString GetCurLine(<B><FONT color=#2e8b57>int</FONT></B>* linePos=<FONT color=#ff00ff>NULL</FONT>);
+<FONT color=#a020f0>#endif</FONT>
<FONT color=#0000ff>// Retrieve the position of the last correctly styled character.</FONT>
<B><FONT color=#2e8b57>int</FONT></B> GetEndStyled();
<B><FONT color=#2e8b57>int</FONT></B> GetTargetEnd();
<FONT color=#0000ff>// Replace the target text with the argument text.</FONT>
+ <FONT color=#0000ff>// Text is counted so it can contain nulls.</FONT>
<FONT color=#0000ff>// Returns the length of the replacement text.</FONT>
<B><FONT color=#2e8b57>int</FONT></B> ReplaceTarget(<B><FONT color=#2e8b57>const</FONT></B> wxString& text);
<FONT color=#0000ff>// Replace the target text with the argument text after \d processing.</FONT>
+ <FONT color=#0000ff>// Text is counted so it can contain nulls.</FONT>
<FONT color=#0000ff>// Looks for \d where d is between 1 and 9 and replaces these with the strings</FONT>
<FONT color=#0000ff>// matched in the last search operation which were surrounded by \( and \).</FONT>
<FONT color=#0000ff>// Returns the length of the replacement text including any change</FONT>
<B><FONT color=#2e8b57>int</FONT></B> ReplaceTargetRE(<B><FONT color=#2e8b57>const</FONT></B> wxString& text);
<FONT color=#0000ff>// Search for a counted string in the target and set the target to the found</FONT>
- <FONT color=#0000ff>// range.</FONT>
+ <FONT color=#0000ff>// range. Text is counted so it can contain nulls.</FONT>
<FONT color=#0000ff>// Returns length of range or -1 for failure in which case target is not moved.</FONT>
<B><FONT color=#2e8b57>int</FONT></B> SearchInTarget(<B><FONT color=#2e8b57>const</FONT></B> wxString& text);
<B><FONT color=#2e8b57>int</FONT></B> GetModEventMask();
<FONT color=#0000ff>// Change internal focus flag</FONT>
- <B><FONT color=#2e8b57>void</FONT></B> SetFocus(<B><FONT color=#2e8b57>bool</FONT></B> focus);
+ <B><FONT color=#2e8b57>void</FONT></B> SetSTCFocus(<B><FONT color=#2e8b57>bool</FONT></B> focus);
<FONT color=#0000ff>// Get internal focus flag</FONT>
- <B><FONT color=#2e8b57>bool</FONT></B> GetFocus();
+ <B><FONT color=#2e8b57>bool</FONT></B> GetSTCFocus();
<FONT color=#0000ff>// Change error status - 0 = OK</FONT>
<B><FONT color=#2e8b57>void</FONT></B> SetStatus(<B><FONT color=#2e8b57>int</FONT></B> statusCode);
<B><FONT color=#2e8b57>void</FONT></B> NotifyChange();
<B><FONT color=#2e8b57>void</FONT></B> NotifyParent(SCNotification* scn);
+
<B><FONT color=#804040>private</FONT></B>:
DECLARE_EVENT_TABLE()
DECLARE_CLASS(wxStyledTextCtrl)
ScintillaWX* m_swx;
wxStopWatch m_stopWatch;
+ <B><FONT color=#2e8b57>bool</FONT></B> m_lastKeyDownConsumed;
<B><FONT color=#804040>friend</FONT></B> <B><FONT color=#2e8b57>class</FONT></B> ScintillaWX;
<B><FONT color=#804040>friend</FONT></B> <B><FONT color=#2e8b57>class</FONT></B> Platform;
wxStyledTextEvent(wxEventType commandType=<FONT color=#ff00ff>0</FONT>, <B><FONT color=#2e8b57>int</FONT></B> id=<FONT color=#ff00ff>0</FONT>);
~wxStyledTextEvent() {}
- <B><FONT color=#2e8b57>void</FONT></B> SetPosition(<B><FONT color=#2e8b57>int</FONT></B> pos) { m_position = pos; }
- <B><FONT color=#2e8b57>void</FONT></B> SetKey(<B><FONT color=#2e8b57>int</FONT></B> k) { m_key = k; }
- <B><FONT color=#2e8b57>void</FONT></B> SetModifiers(<B><FONT color=#2e8b57>int</FONT></B> m) { m_modifiers = m; }
- <B><FONT color=#2e8b57>void</FONT></B> SetModificationType(<B><FONT color=#2e8b57>int</FONT></B> t) { m_modificationType = t; }
- <B><FONT color=#2e8b57>void</FONT></B> SetText(<B><FONT color=#2e8b57>const</FONT></B> <B><FONT color=#2e8b57>char</FONT></B>* t) { m_text = t; }
- <B><FONT color=#2e8b57>void</FONT></B> SetLength(<B><FONT color=#2e8b57>int</FONT></B> len) { m_length = len; }
- <B><FONT color=#2e8b57>void</FONT></B> SetLinesAdded(<B><FONT color=#2e8b57>int</FONT></B> num) { m_linesAdded = num; }
- <B><FONT color=#2e8b57>void</FONT></B> SetLine(<B><FONT color=#2e8b57>int</FONT></B> val) { m_line = val; }
- <B><FONT color=#2e8b57>void</FONT></B> SetFoldLevelNow(<B><FONT color=#2e8b57>int</FONT></B> val) { m_foldLevelNow = val; }
- <B><FONT color=#2e8b57>void</FONT></B> SetFoldLevelPrev(<B><FONT color=#2e8b57>int</FONT></B> val) { m_foldLevelPrev = val; }
- <B><FONT color=#2e8b57>void</FONT></B> SetMargin(<B><FONT color=#2e8b57>int</FONT></B> val) { m_margin = val; }
- <B><FONT color=#2e8b57>void</FONT></B> SetMessage(<B><FONT color=#2e8b57>int</FONT></B> val) { m_message = val; }
- <B><FONT color=#2e8b57>void</FONT></B> SetWParam(<B><FONT color=#2e8b57>int</FONT></B> val) { m_wParam = val; }
- <B><FONT color=#2e8b57>void</FONT></B> SetLParam(<B><FONT color=#2e8b57>int</FONT></B> val) { m_lParam = val; }
- <B><FONT color=#2e8b57>void</FONT></B> SetListType(<B><FONT color=#2e8b57>int</FONT></B> val) { m_listType = val; }
- <B><FONT color=#2e8b57>void</FONT></B> SetX(<B><FONT color=#2e8b57>int</FONT></B> val) { m_x = val; }
- <B><FONT color=#2e8b57>void</FONT></B> SetY(<B><FONT color=#2e8b57>int</FONT></B> val) { m_y = val; }
+ <B><FONT color=#2e8b57>void</FONT></B> SetPosition(<B><FONT color=#2e8b57>int</FONT></B> pos) { m_position = pos; }
+ <B><FONT color=#2e8b57>void</FONT></B> SetKey(<B><FONT color=#2e8b57>int</FONT></B> k) { m_key = k; }
+ <B><FONT color=#2e8b57>void</FONT></B> SetModifiers(<B><FONT color=#2e8b57>int</FONT></B> m) { m_modifiers = m; }
+ <B><FONT color=#2e8b57>void</FONT></B> SetModificationType(<B><FONT color=#2e8b57>int</FONT></B> t) { m_modificationType = t; }
+ <B><FONT color=#2e8b57>void</FONT></B> SetText(<B><FONT color=#2e8b57>const</FONT></B> <B><FONT color=#2e8b57>char</FONT></B>* t) { m_text = t; }
+ <B><FONT color=#2e8b57>void</FONT></B> SetLength(<B><FONT color=#2e8b57>int</FONT></B> len) { m_length = len; }
+ <B><FONT color=#2e8b57>void</FONT></B> SetLinesAdded(<B><FONT color=#2e8b57>int</FONT></B> num) { m_linesAdded = num; }
+ <B><FONT color=#2e8b57>void</FONT></B> SetLine(<B><FONT color=#2e8b57>int</FONT></B> val) { m_line = val; }
+ <B><FONT color=#2e8b57>void</FONT></B> SetFoldLevelNow(<B><FONT color=#2e8b57>int</FONT></B> val) { m_foldLevelNow = val; }
+ <B><FONT color=#2e8b57>void</FONT></B> SetFoldLevelPrev(<B><FONT color=#2e8b57>int</FONT></B> val) { m_foldLevelPrev = val; }
+ <B><FONT color=#2e8b57>void</FONT></B> SetMargin(<B><FONT color=#2e8b57>int</FONT></B> val) { m_margin = val; }
+ <B><FONT color=#2e8b57>void</FONT></B> SetMessage(<B><FONT color=#2e8b57>int</FONT></B> val) { m_message = val; }
+ <B><FONT color=#2e8b57>void</FONT></B> SetWParam(<B><FONT color=#2e8b57>int</FONT></B> val) { m_wParam = val; }
+ <B><FONT color=#2e8b57>void</FONT></B> SetLParam(<B><FONT color=#2e8b57>int</FONT></B> val) { m_lParam = val; }
+ <B><FONT color=#2e8b57>void</FONT></B> SetListType(<B><FONT color=#2e8b57>int</FONT></B> val) { m_listType = val; }
+ <B><FONT color=#2e8b57>void</FONT></B> SetX(<B><FONT color=#2e8b57>int</FONT></B> val) { m_x = val; }
+ <B><FONT color=#2e8b57>void</FONT></B> SetY(<B><FONT color=#2e8b57>int</FONT></B> val) { m_y = val; }
+ <B><FONT color=#2e8b57>void</FONT></B> SetDragText(<B><FONT color=#2e8b57>const</FONT></B> wxString& val) { m_dragText = val; }
+ <B><FONT color=#2e8b57>void</FONT></B> SetDragAllowMove(<B><FONT color=#2e8b57>bool</FONT></B> val) { m_dragAllowMove = val; }
+ <B><FONT color=#2e8b57>void</FONT></B> SetDragResult(wxDragResult val) { m_dragResult = val; }
<B><FONT color=#2e8b57>int</FONT></B> GetPosition() <B><FONT color=#2e8b57>const</FONT></B> { <B><FONT color=#804040>return</FONT></B> m_position; }
<B><FONT color=#2e8b57>int</FONT></B> GetKey() <B><FONT color=#2e8b57>const</FONT></B> { <B><FONT color=#804040>return</FONT></B> m_key; }
<B><FONT color=#2e8b57>int</FONT></B> GetListType() <B><FONT color=#2e8b57>const</FONT></B> { <B><FONT color=#804040>return</FONT></B> m_listType; }
<B><FONT color=#2e8b57>int</FONT></B> GetX() <B><FONT color=#2e8b57>const</FONT></B> { <B><FONT color=#804040>return</FONT></B> m_x; }
<B><FONT color=#2e8b57>int</FONT></B> GetY() <B><FONT color=#2e8b57>const</FONT></B> { <B><FONT color=#804040>return</FONT></B> m_y; }
+ wxString GetDragText() { <B><FONT color=#804040>return</FONT></B> m_dragText; }
+ <B><FONT color=#2e8b57>bool</FONT></B> GetDragAllowMove() { <B><FONT color=#804040>return</FONT></B> m_dragAllowMove; }
+ wxDragResult GetDragResult() { <B><FONT color=#804040>return</FONT></B> m_dragResult; }
<B><FONT color=#2e8b57>bool</FONT></B> GetShift() <B><FONT color=#2e8b57>const</FONT></B>;
<B><FONT color=#2e8b57>bool</FONT></B> GetControl() <B><FONT color=#2e8b57>const</FONT></B>;
<B><FONT color=#2e8b57>int</FONT></B> m_listType;
<B><FONT color=#2e8b57>int</FONT></B> m_x;
<B><FONT color=#2e8b57>int</FONT></B> m_y;
+
+ wxString m_dragText; <FONT color=#0000ff>// wxEVT_STC_START_DRAG, wxEVT_STC_DO_DROP</FONT>
+ <B><FONT color=#2e8b57>bool</FONT></B> m_dragAllowMove; <FONT color=#0000ff>// wxEVT_STC_START_DRAG</FONT>
+
+ wxDragResult m_dragResult; <FONT color=#0000ff>// wxEVT_STC_DRAG_OVER,wxEVT_STC_DO_DROP</FONT>
<FONT color=#a020f0>#endif</FONT>
};
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_URIDROPPED, <FONT color=#ff00ff>1666</FONT>)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLSTART, <FONT color=#ff00ff>1667</FONT>)
DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLEND, <FONT color=#ff00ff>1668</FONT>)
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_START_DRAG, <FONT color=#ff00ff>1669</FONT>)
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DRAG_OVER, <FONT color=#ff00ff>1670</FONT>)
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DO_DROP, <FONT color=#ff00ff>1671</FONT>)
END_DECLARE_EVENT_TYPES()
<FONT color=#a020f0>#else</FONT>
<B><FONT color=#2e8b57>enum</FONT></B> {
wxEVT_STC_URIDROPPED,
wxEVT_STC_DWELLSTART,
wxEVT_STC_DWELLEND,
+ wxEVT_STC_START_DRAG,
+ wxEVT_STC_DRAG_OVER,
+ wxEVT_STC_DO_DROP,
};
<FONT color=#a020f0>#endif</FONT>
<FONT color=#a020f0>#define EVT_STC_URIDROPPED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_URIDROPPED, id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
<FONT color=#a020f0>#define EVT_STC_DWELLSTART(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLSTART, id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
<FONT color=#a020f0>#define EVT_STC_DWELLEND(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLEND, id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
-
+<FONT color=#a020f0>#define EVT_STC_START_DRAG(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_START_DRAG, id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
+<FONT color=#a020f0>#define EVT_STC_DRAG_OVER(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER, id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
+<FONT color=#a020f0>#define EVT_STC_DO_DROP(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP, id, -</FONT><FONT color=#ff00ff>1</FONT><FONT color=#a020f0>, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) </FONT><FONT color=#ff00ff>NULL</FONT><FONT color=#a020f0> ),</FONT>
<FONT color=#a020f0>#endif</FONT>
#----------------------------------------------------------------------
+debug = 1
+
+
demoText = """\
This editor is provided by a class named wxStyledTextCtrl. As
wxStyledTextCtrl.__init__(self, parent, ID)
self.log = log
+ EVT_STC_DO_DROP(self, ID, self.OnDoDrop)
+ EVT_STC_DRAG_OVER(self, ID, self.OnDragOver)
+ EVT_STC_START_DRAG(self, ID, self.OnStartDrag)
EVT_STC_MODIFIED(self, ID, self.OnModified)
+ def OnStartDrag(self, evt):
+ self.log.write("OnStartDrag: %d, %s\n"
+ % (evt.GetDragAllowMove(), evt.GetDragText()))
+
+ if debug and evt.GetPosition() < 250:
+ evt.SetDragAllowMove(false) # you can prevent moving of text (only copy)
+ evt.SetDragText("DRAGGED TEXT") # you can change what is dragged
+ #evt.SetDragText("") # or prevent the drag with empty text
+
+
+ def OnDragOver(self, evt):
+ self.log.write("OnDragOver: x,y=(%d, %d) pos: %d DragResult: %d\n"
+ % (evt.GetX(), evt.GetY(), evt.GetPosition(), evt.GetDragResult()))
+
+ if debug and evt.GetPosition() < 250:
+ evt.SetDragResult(wxDragNone) # prevent dropping at the begining of the buffer
+
+
+ def OnDoDrop(self, evt):
+ self.log.write("OnDoDrop: x,y=(%d, %d) pos: %d DragResult: %d\n"
+ "\ttext: %s\n"
+ % (evt.GetX(), evt.GetY(), evt.GetPosition(), evt.GetDragResult(),
+ evt.GetDragText()))
+
+ if debug and evt.GetPosition() < 500:
+ evt.SetDragText("DROPPED TEXT") # Can change text if needed
+ ##evt.SetDragResult(wxDragNone) # Can also change the drag operation, but it
+ # is probably better to do it in OnDragOver so
+ # there is visual feedback
+
+ ##evt.SetPosition(25) # Can also change position, but I'm not sure why
+ # you would want to...
+
+
+
+
def OnModified(self, evt):
self.log.write("""OnModified
Mod type: %s
evt.GetLength(),
evt.GetText() ))
+
def transModType(self, modType):
st = ""
table = [(wxSTC_MOD_INSERTTEXT, "InsertText"),
+
#----------------------------------------------------------------------
_USE_PANEL = 1
ed.SetStyling(10, wxSTC_INDIC2_MASK | wxSTC_INDIC1_MASK)
# some test stuff...
- if 1:
+ if debug:
print "GetTextLength(): ", ed.GetTextLength(), len(ed.GetText())
print "GetText(): ", repr(ed.GetText())
print
self.SetCaretForeground("BLUE")
- EVT_KEY_UP(self, self.OnKeyPressed)
+ EVT_KEY_DOWN(self, self.OnKeyPressed)
def OnKeyPressed(self, event):