From 1bc32508684ff0b49fcf0f03ef27e31669fc2eae Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sat, 27 Oct 2001 00:15:09 +0000 Subject: [PATCH] First pass at wxPython for Mac (darwin only so far). It builds but doesn't run yet. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12178 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/include/wx/stc/stc.h | 13 +++++++++++- contrib/src/stc/ScintillaWX.cpp | 10 +++++++-- contrib/src/stc/ScintillaWX.h | 7 ++++++- contrib/src/stc/scintilla/include/Platform.h | 22 ++++++++++++++++++++ contrib/src/stc/stc.cpp | 6 ++++++ contrib/src/stc/stc.cpp.in | 6 ++++++ contrib/src/stc/stc.h.in | 13 +++++++++++- include/wx/stc/stc.h | 13 +++++++++++- src/stc/ScintillaWX.cpp | 10 +++++++-- src/stc/ScintillaWX.h | 7 ++++++- src/stc/scintilla/include/Platform.h | 22 ++++++++++++++++++++ src/stc/stc.cpp | 6 ++++++ src/stc/stc.cpp.in | 6 ++++++ src/stc/stc.h.in | 13 +++++++++++- 14 files changed, 144 insertions(+), 10 deletions(-) diff --git a/contrib/include/wx/stc/stc.h b/contrib/include/wx/stc/stc.h index a5586bdfc5..e52252ac7e 100644 --- a/contrib/include/wx/stc/stc.h +++ b/contrib/include/wx/stc/stc.h @@ -1661,9 +1661,11 @@ public: void SetListType(int val) { m_listType = val; } void SetX(int val) { m_x = val; } void SetY(int val) { m_y = val; } +#ifndef __WXMAC__ // #if wxUSE_DRAG_AND_DROP void SetDragText(const wxString& val) { m_dragText = val; } void SetDragAllowMove(bool val) { m_dragAllowMove = val; } void SetDragResult(wxDragResult val) { m_dragResult = val; } +#endif int GetPosition() const { return m_position; } int GetKey() const { return m_key; } @@ -1682,9 +1684,11 @@ public: int GetListType() const { return m_listType; } int GetX() const { return m_x; } int GetY() const { return m_y; } +#ifndef __WXMAC__ // #if wxUSE_DRAG_AND_DROP wxString GetDragText() { return m_dragText; } bool GetDragAllowMove() { return m_dragAllowMove; } wxDragResult GetDragResult() { return m_dragResult; } +#endif bool GetShift() const; bool GetControl() const; @@ -1718,11 +1722,13 @@ private: int m_x; int m_y; +#ifndef __WXMAC__ // #if wxUSE_DRAG_AND_DROP 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 +#endif }; #ifndef SWIG @@ -1746,9 +1752,11 @@ BEGIN_DECLARE_EVENT_TYPES() DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_URIDROPPED, 1666) DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLSTART, 1667) DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLEND, 1668) +#if wxUSE_DRAG_AND_DROP 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) +#endif END_DECLARE_EVENT_TYPES() #else enum { @@ -1771,9 +1779,11 @@ END_DECLARE_EVENT_TYPES() wxEVT_STC_URIDROPPED, wxEVT_STC_DWELLSTART, wxEVT_STC_DWELLEND, +#ifndef __WXMAC__ // #if wxUSE_DRAG_AND_DROP wxEVT_STC_START_DRAG, wxEVT_STC_DRAG_OVER, wxEVT_STC_DO_DROP, +#endif }; #endif @@ -1801,10 +1811,11 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&); #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 ), +#if wxUSE_DRAG_AND_DROP #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 #endif //---------------------------------------------------------------------- diff --git a/contrib/src/stc/ScintillaWX.cpp b/contrib/src/stc/ScintillaWX.cpp index 1dfc0184a7..1effa1fe99 100644 --- a/contrib/src/stc/ScintillaWX.cpp +++ b/contrib/src/stc/ScintillaWX.cpp @@ -44,7 +44,7 @@ private: }; - +#if wxUSE_DRAG_AND_DROP bool wxSTCDropTarget::OnDropText(wxCoord x, wxCoord y, const wxString& data) { return swx->DoDropText(x, y, data); } @@ -60,6 +60,7 @@ wxDragResult wxSTCDropTarget::OnDragOver(wxCoord x, wxCoord y, wxDragResult def void wxSTCDropTarget::OnLeave() { swx->DoDragLeave(); } +#endif class wxSTCCallTip : public wxWindow { @@ -109,9 +110,11 @@ ScintillaWX::~ScintillaWX() { void ScintillaWX::Initialise() { //ScintillaBase::Initialise(); +#if wxUSE_DRAG_AND_DROP dropTarget = new wxSTCDropTarget; dropTarget->SetScintilla(this); stc->SetDropTarget(dropTarget); +#endif } @@ -121,6 +124,7 @@ void ScintillaWX::Finalise() { void ScintillaWX::StartDrag() { +#if wxUSE_DRAG_AND_DROP wxString dragText(drag.s, drag.len); // Send an event to allow the drag text to be changed @@ -146,6 +150,7 @@ void ScintillaWX::StartDrag() { inDragDrop = FALSE; SetDragPosition(invalidPosition); } +#endif } @@ -500,6 +505,7 @@ void ScintillaWX::DoOnListBox() { //---------------------------------------------------------------------- +#if wxUSE_DRAG_AND_DROP bool ScintillaWX::DoDropText(long x, long y, const wxString& data) { SetDragPosition(invalidPosition); @@ -551,7 +557,7 @@ wxDragResult ScintillaWX::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) { void ScintillaWX::DoDragLeave() { SetDragPosition(invalidPosition); } - +#endif //---------------------------------------------------------------------- // Redraw all of text area. This paint will not be abandoned. diff --git a/contrib/src/stc/ScintillaWX.h b/contrib/src/stc/ScintillaWX.h index 00528bcd0a..ffc229f538 100644 --- a/contrib/src/stc/ScintillaWX.h +++ b/contrib/src/stc/ScintillaWX.h @@ -56,6 +56,7 @@ class ScintillaWX; //---------------------------------------------------------------------- // Helper classes +#if wxUSE_DRAG_AND_DROP class wxSTCDropTarget : public wxTextDropTarget { public: void SetScintilla(ScintillaWX* swx) { @@ -70,7 +71,7 @@ public: private: ScintillaWX* swx; }; - +#endif //---------------------------------------------------------------------- @@ -124,10 +125,12 @@ public: int DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* consumed); void DoTick() { Tick(); } +#if wxUSE_DRAG_AND_DROP bool DoDropText(long x, long y, const wxString& data); wxDragResult DoDragEnter(wxCoord x, wxCoord y, wxDragResult def); wxDragResult DoDragOver(wxCoord x, wxCoord y, wxDragResult def); void DoDragLeave(); +#endif void DoCommand(int ID); void DoContextMenu(Point pt); @@ -145,8 +148,10 @@ private: bool capturedMouse; wxStyledTextCtrl* stc; +#if wxUSE_DRAG_AND_DROP wxSTCDropTarget* dropTarget; wxDragResult dragResult; +#endif int wheelRotation; }; diff --git a/contrib/src/stc/scintilla/include/Platform.h b/contrib/src/stc/scintilla/include/Platform.h index 74de63174f..48f337a16a 100644 --- a/contrib/src/stc/scintilla/include/Platform.h +++ b/contrib/src/stc/scintilla/include/Platform.h @@ -64,6 +64,28 @@ #include #endif +#define ColourID scColourID +#define FontID scFontID +#define SurfaceID scSurfaceID +#define WindowID scWindowID +#define MenuID scMenuID +#define Point scPoint +#define PRectangle scPRectangle +#define Colour scColour +#define ColourPair scColourPair +#define Window scWindow +#define Palette scPalette +#define Font scFont +#define Surface scSurface +#define Window scWindow +#define ListBox scListBox +#define Menu scMenu +#define Platform scPlatform +#define TextRange scTextRange +#define KeyMap scKeyMap +#define Style scStyle + + // Underlying the implementation of the platform classes are platform specific types. // Sometimes these need to be passed around by client code so they are defined here diff --git a/contrib/src/stc/stc.cpp b/contrib/src/stc/stc.cpp index 10e29c82ef..9e417842af 100644 --- a/contrib/src/stc/stc.cpp +++ b/contrib/src/stc/stc.cpp @@ -93,9 +93,11 @@ DEFINE_EVENT_TYPE( wxEVT_STC_USERLISTSELECTION ) DEFINE_EVENT_TYPE( wxEVT_STC_URIDROPPED ) DEFINE_EVENT_TYPE( wxEVT_STC_DWELLSTART ) DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND ) +#if wxUSE_DRAG_AND_DROP DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG ) DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER ) DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP ) +#endif BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl) @@ -2052,8 +2054,10 @@ wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType, int id) m_listType = 0; m_x = 0; m_y = 0; +#if wxUSE_DRAG_AND_DROP m_dragAllowMove = FALSE; m_dragResult = wxDragNone; +#endif } bool wxStyledTextEvent::GetShift() const { return (m_modifiers & SCI_SHIFT) != 0; } @@ -2085,9 +2089,11 @@ void wxStyledTextEvent::CopyObject(wxObject& obj) const { o->m_x = m_x; o->m_y = m_y; +#if wxUSE_DRAG_AND_DROP o->m_dragText = m_dragText; o->m_dragAllowMove =m_dragAllowMove; o->m_dragResult = m_dragResult; +#endif } //---------------------------------------------------------------------- diff --git a/contrib/src/stc/stc.cpp.in b/contrib/src/stc/stc.cpp.in index 77ecc6b3c6..b05ddaf347 100644 --- a/contrib/src/stc/stc.cpp.in +++ b/contrib/src/stc/stc.cpp.in @@ -93,9 +93,11 @@ DEFINE_EVENT_TYPE( wxEVT_STC_USERLISTSELECTION ) DEFINE_EVENT_TYPE( wxEVT_STC_URIDROPPED ) DEFINE_EVENT_TYPE( wxEVT_STC_DWELLSTART ) DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND ) +#if wxUSE_DRAG_AND_DROP DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG ) DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER ) DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP ) +#endif BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl) @@ -596,8 +598,10 @@ wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType, int id) m_listType = 0; m_x = 0; m_y = 0; +#if wxUSE_DRAG_AND_DROP m_dragAllowMove = FALSE; m_dragResult = wxDragNone; +#endif } bool wxStyledTextEvent::GetShift() const { return (m_modifiers & SCI_SHIFT) != 0; } @@ -629,9 +633,11 @@ void wxStyledTextEvent::CopyObject(wxObject& obj) const { o->m_x = m_x; o->m_y = m_y; +#if wxUSE_DRAG_AND_DROP o->m_dragText = m_dragText; o->m_dragAllowMove =m_dragAllowMove; o->m_dragResult = m_dragResult; +#endif } //---------------------------------------------------------------------- diff --git a/contrib/src/stc/stc.h.in b/contrib/src/stc/stc.h.in index 13ca81ae90..cf6d811049 100644 --- a/contrib/src/stc/stc.h.in +++ b/contrib/src/stc/stc.h.in @@ -215,9 +215,11 @@ public: void SetListType(int val) { m_listType = val; } void SetX(int val) { m_x = val; } void SetY(int val) { m_y = val; } +#ifndef __WXMAC__ // #if wxUSE_DRAG_AND_DROP void SetDragText(const wxString& val) { m_dragText = val; } void SetDragAllowMove(bool val) { m_dragAllowMove = val; } void SetDragResult(wxDragResult val) { m_dragResult = val; } +#endif int GetPosition() const { return m_position; } int GetKey() const { return m_key; } @@ -236,9 +238,11 @@ public: int GetListType() const { return m_listType; } int GetX() const { return m_x; } int GetY() const { return m_y; } +#ifndef __WXMAC__ // #if wxUSE_DRAG_AND_DROP wxString GetDragText() { return m_dragText; } bool GetDragAllowMove() { return m_dragAllowMove; } wxDragResult GetDragResult() { return m_dragResult; } +#endif bool GetShift() const; bool GetControl() const; @@ -272,11 +276,13 @@ private: int m_x; int m_y; +#ifndef __WXMAC__ // #if wxUSE_DRAG_AND_DROP 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 +#endif }; #ifndef SWIG @@ -300,9 +306,11 @@ BEGIN_DECLARE_EVENT_TYPES() DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_URIDROPPED, 1666) DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLSTART, 1667) DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLEND, 1668) +#if wxUSE_DRAG_AND_DROP 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) +#endif END_DECLARE_EVENT_TYPES() #else enum { @@ -325,9 +333,11 @@ END_DECLARE_EVENT_TYPES() wxEVT_STC_URIDROPPED, wxEVT_STC_DWELLSTART, wxEVT_STC_DWELLEND, +#ifndef __WXMAC__ // #if wxUSE_DRAG_AND_DROP wxEVT_STC_START_DRAG, wxEVT_STC_DRAG_OVER, wxEVT_STC_DO_DROP, +#endif }; #endif @@ -355,10 +365,11 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&); #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 ), +#if wxUSE_DRAG_AND_DROP #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 #endif //---------------------------------------------------------------------- diff --git a/include/wx/stc/stc.h b/include/wx/stc/stc.h index a5586bdfc5..e52252ac7e 100644 --- a/include/wx/stc/stc.h +++ b/include/wx/stc/stc.h @@ -1661,9 +1661,11 @@ public: void SetListType(int val) { m_listType = val; } void SetX(int val) { m_x = val; } void SetY(int val) { m_y = val; } +#ifndef __WXMAC__ // #if wxUSE_DRAG_AND_DROP void SetDragText(const wxString& val) { m_dragText = val; } void SetDragAllowMove(bool val) { m_dragAllowMove = val; } void SetDragResult(wxDragResult val) { m_dragResult = val; } +#endif int GetPosition() const { return m_position; } int GetKey() const { return m_key; } @@ -1682,9 +1684,11 @@ public: int GetListType() const { return m_listType; } int GetX() const { return m_x; } int GetY() const { return m_y; } +#ifndef __WXMAC__ // #if wxUSE_DRAG_AND_DROP wxString GetDragText() { return m_dragText; } bool GetDragAllowMove() { return m_dragAllowMove; } wxDragResult GetDragResult() { return m_dragResult; } +#endif bool GetShift() const; bool GetControl() const; @@ -1718,11 +1722,13 @@ private: int m_x; int m_y; +#ifndef __WXMAC__ // #if wxUSE_DRAG_AND_DROP 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 +#endif }; #ifndef SWIG @@ -1746,9 +1752,11 @@ BEGIN_DECLARE_EVENT_TYPES() DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_URIDROPPED, 1666) DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLSTART, 1667) DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLEND, 1668) +#if wxUSE_DRAG_AND_DROP 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) +#endif END_DECLARE_EVENT_TYPES() #else enum { @@ -1771,9 +1779,11 @@ END_DECLARE_EVENT_TYPES() wxEVT_STC_URIDROPPED, wxEVT_STC_DWELLSTART, wxEVT_STC_DWELLEND, +#ifndef __WXMAC__ // #if wxUSE_DRAG_AND_DROP wxEVT_STC_START_DRAG, wxEVT_STC_DRAG_OVER, wxEVT_STC_DO_DROP, +#endif }; #endif @@ -1801,10 +1811,11 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&); #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 ), +#if wxUSE_DRAG_AND_DROP #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 #endif //---------------------------------------------------------------------- diff --git a/src/stc/ScintillaWX.cpp b/src/stc/ScintillaWX.cpp index 1dfc0184a7..1effa1fe99 100644 --- a/src/stc/ScintillaWX.cpp +++ b/src/stc/ScintillaWX.cpp @@ -44,7 +44,7 @@ private: }; - +#if wxUSE_DRAG_AND_DROP bool wxSTCDropTarget::OnDropText(wxCoord x, wxCoord y, const wxString& data) { return swx->DoDropText(x, y, data); } @@ -60,6 +60,7 @@ wxDragResult wxSTCDropTarget::OnDragOver(wxCoord x, wxCoord y, wxDragResult def void wxSTCDropTarget::OnLeave() { swx->DoDragLeave(); } +#endif class wxSTCCallTip : public wxWindow { @@ -109,9 +110,11 @@ ScintillaWX::~ScintillaWX() { void ScintillaWX::Initialise() { //ScintillaBase::Initialise(); +#if wxUSE_DRAG_AND_DROP dropTarget = new wxSTCDropTarget; dropTarget->SetScintilla(this); stc->SetDropTarget(dropTarget); +#endif } @@ -121,6 +124,7 @@ void ScintillaWX::Finalise() { void ScintillaWX::StartDrag() { +#if wxUSE_DRAG_AND_DROP wxString dragText(drag.s, drag.len); // Send an event to allow the drag text to be changed @@ -146,6 +150,7 @@ void ScintillaWX::StartDrag() { inDragDrop = FALSE; SetDragPosition(invalidPosition); } +#endif } @@ -500,6 +505,7 @@ void ScintillaWX::DoOnListBox() { //---------------------------------------------------------------------- +#if wxUSE_DRAG_AND_DROP bool ScintillaWX::DoDropText(long x, long y, const wxString& data) { SetDragPosition(invalidPosition); @@ -551,7 +557,7 @@ wxDragResult ScintillaWX::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) { void ScintillaWX::DoDragLeave() { SetDragPosition(invalidPosition); } - +#endif //---------------------------------------------------------------------- // Redraw all of text area. This paint will not be abandoned. diff --git a/src/stc/ScintillaWX.h b/src/stc/ScintillaWX.h index 00528bcd0a..ffc229f538 100644 --- a/src/stc/ScintillaWX.h +++ b/src/stc/ScintillaWX.h @@ -56,6 +56,7 @@ class ScintillaWX; //---------------------------------------------------------------------- // Helper classes +#if wxUSE_DRAG_AND_DROP class wxSTCDropTarget : public wxTextDropTarget { public: void SetScintilla(ScintillaWX* swx) { @@ -70,7 +71,7 @@ public: private: ScintillaWX* swx; }; - +#endif //---------------------------------------------------------------------- @@ -124,10 +125,12 @@ public: int DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* consumed); void DoTick() { Tick(); } +#if wxUSE_DRAG_AND_DROP bool DoDropText(long x, long y, const wxString& data); wxDragResult DoDragEnter(wxCoord x, wxCoord y, wxDragResult def); wxDragResult DoDragOver(wxCoord x, wxCoord y, wxDragResult def); void DoDragLeave(); +#endif void DoCommand(int ID); void DoContextMenu(Point pt); @@ -145,8 +148,10 @@ private: bool capturedMouse; wxStyledTextCtrl* stc; +#if wxUSE_DRAG_AND_DROP wxSTCDropTarget* dropTarget; wxDragResult dragResult; +#endif int wheelRotation; }; diff --git a/src/stc/scintilla/include/Platform.h b/src/stc/scintilla/include/Platform.h index 74de63174f..48f337a16a 100644 --- a/src/stc/scintilla/include/Platform.h +++ b/src/stc/scintilla/include/Platform.h @@ -64,6 +64,28 @@ #include #endif +#define ColourID scColourID +#define FontID scFontID +#define SurfaceID scSurfaceID +#define WindowID scWindowID +#define MenuID scMenuID +#define Point scPoint +#define PRectangle scPRectangle +#define Colour scColour +#define ColourPair scColourPair +#define Window scWindow +#define Palette scPalette +#define Font scFont +#define Surface scSurface +#define Window scWindow +#define ListBox scListBox +#define Menu scMenu +#define Platform scPlatform +#define TextRange scTextRange +#define KeyMap scKeyMap +#define Style scStyle + + // Underlying the implementation of the platform classes are platform specific types. // Sometimes these need to be passed around by client code so they are defined here diff --git a/src/stc/stc.cpp b/src/stc/stc.cpp index 10e29c82ef..9e417842af 100644 --- a/src/stc/stc.cpp +++ b/src/stc/stc.cpp @@ -93,9 +93,11 @@ DEFINE_EVENT_TYPE( wxEVT_STC_USERLISTSELECTION ) DEFINE_EVENT_TYPE( wxEVT_STC_URIDROPPED ) DEFINE_EVENT_TYPE( wxEVT_STC_DWELLSTART ) DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND ) +#if wxUSE_DRAG_AND_DROP DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG ) DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER ) DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP ) +#endif BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl) @@ -2052,8 +2054,10 @@ wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType, int id) m_listType = 0; m_x = 0; m_y = 0; +#if wxUSE_DRAG_AND_DROP m_dragAllowMove = FALSE; m_dragResult = wxDragNone; +#endif } bool wxStyledTextEvent::GetShift() const { return (m_modifiers & SCI_SHIFT) != 0; } @@ -2085,9 +2089,11 @@ void wxStyledTextEvent::CopyObject(wxObject& obj) const { o->m_x = m_x; o->m_y = m_y; +#if wxUSE_DRAG_AND_DROP o->m_dragText = m_dragText; o->m_dragAllowMove =m_dragAllowMove; o->m_dragResult = m_dragResult; +#endif } //---------------------------------------------------------------------- diff --git a/src/stc/stc.cpp.in b/src/stc/stc.cpp.in index 77ecc6b3c6..b05ddaf347 100644 --- a/src/stc/stc.cpp.in +++ b/src/stc/stc.cpp.in @@ -93,9 +93,11 @@ DEFINE_EVENT_TYPE( wxEVT_STC_USERLISTSELECTION ) DEFINE_EVENT_TYPE( wxEVT_STC_URIDROPPED ) DEFINE_EVENT_TYPE( wxEVT_STC_DWELLSTART ) DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND ) +#if wxUSE_DRAG_AND_DROP DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG ) DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER ) DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP ) +#endif BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl) @@ -596,8 +598,10 @@ wxStyledTextEvent::wxStyledTextEvent(wxEventType commandType, int id) m_listType = 0; m_x = 0; m_y = 0; +#if wxUSE_DRAG_AND_DROP m_dragAllowMove = FALSE; m_dragResult = wxDragNone; +#endif } bool wxStyledTextEvent::GetShift() const { return (m_modifiers & SCI_SHIFT) != 0; } @@ -629,9 +633,11 @@ void wxStyledTextEvent::CopyObject(wxObject& obj) const { o->m_x = m_x; o->m_y = m_y; +#if wxUSE_DRAG_AND_DROP o->m_dragText = m_dragText; o->m_dragAllowMove =m_dragAllowMove; o->m_dragResult = m_dragResult; +#endif } //---------------------------------------------------------------------- diff --git a/src/stc/stc.h.in b/src/stc/stc.h.in index 13ca81ae90..cf6d811049 100644 --- a/src/stc/stc.h.in +++ b/src/stc/stc.h.in @@ -215,9 +215,11 @@ public: void SetListType(int val) { m_listType = val; } void SetX(int val) { m_x = val; } void SetY(int val) { m_y = val; } +#ifndef __WXMAC__ // #if wxUSE_DRAG_AND_DROP void SetDragText(const wxString& val) { m_dragText = val; } void SetDragAllowMove(bool val) { m_dragAllowMove = val; } void SetDragResult(wxDragResult val) { m_dragResult = val; } +#endif int GetPosition() const { return m_position; } int GetKey() const { return m_key; } @@ -236,9 +238,11 @@ public: int GetListType() const { return m_listType; } int GetX() const { return m_x; } int GetY() const { return m_y; } +#ifndef __WXMAC__ // #if wxUSE_DRAG_AND_DROP wxString GetDragText() { return m_dragText; } bool GetDragAllowMove() { return m_dragAllowMove; } wxDragResult GetDragResult() { return m_dragResult; } +#endif bool GetShift() const; bool GetControl() const; @@ -272,11 +276,13 @@ private: int m_x; int m_y; +#ifndef __WXMAC__ // #if wxUSE_DRAG_AND_DROP 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 +#endif }; #ifndef SWIG @@ -300,9 +306,11 @@ BEGIN_DECLARE_EVENT_TYPES() DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_URIDROPPED, 1666) DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLSTART, 1667) DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DWELLEND, 1668) +#if wxUSE_DRAG_AND_DROP 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) +#endif END_DECLARE_EVENT_TYPES() #else enum { @@ -325,9 +333,11 @@ END_DECLARE_EVENT_TYPES() wxEVT_STC_URIDROPPED, wxEVT_STC_DWELLSTART, wxEVT_STC_DWELLEND, +#ifndef __WXMAC__ // #if wxUSE_DRAG_AND_DROP wxEVT_STC_START_DRAG, wxEVT_STC_DRAG_OVER, wxEVT_STC_DO_DROP, +#endif }; #endif @@ -355,10 +365,11 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&); #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 ), +#if wxUSE_DRAG_AND_DROP #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 #endif //---------------------------------------------------------------------- -- 2.45.2