implement wxWindow::DragAcceptFiles() on all platforms
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@56758 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -104,6 +104,7 @@ All (GUI):
|
|||||||
single-cell paragraphs.
|
single-cell paragraphs.
|
||||||
- Fixed wxHTML's line breaks handling in <pre> blocks broken in 2.8.8 (#10120).
|
- Fixed wxHTML's line breaks handling in <pre> blocks broken in 2.8.8 (#10120).
|
||||||
- wxHTML: don't include extra whitespace in table cells.
|
- wxHTML: don't include extra whitespace in table cells.
|
||||||
|
- Implemented wxWindow::DragAcceptFiles() on all platforms.
|
||||||
|
|
||||||
All (Unix):
|
All (Unix):
|
||||||
|
|
||||||
|
@@ -567,7 +567,9 @@ will not accept drop file events.}
|
|||||||
|
|
||||||
\wxheading{Remarks}
|
\wxheading{Remarks}
|
||||||
|
|
||||||
Windows only.
|
Windows only until version 2.8.9, available on all platforms since 2.8.10.
|
||||||
|
Cannot be used together with \helpref{SetDropTarget}{wxwindowsetdroptarget} on
|
||||||
|
non-Windows platforms.
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxWindow::Enable}\label{wxwindowenable}
|
\membersection{wxWindow::Enable}\label{wxwindowenable}
|
||||||
|
@@ -364,6 +364,11 @@ public:
|
|||||||
m_strings[i] = m_array[i];
|
m_strings[i] = m_array[i];
|
||||||
return m_strings;
|
return m_strings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if wxABI_VERSION >= 20810
|
||||||
|
wxString* Release();
|
||||||
|
#endif // wxABI_VERSION >= 20810
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const wxArrayString& m_array;
|
const wxArrayString& m_array;
|
||||||
wxString* m_strings;
|
wxString* m_strings;
|
||||||
|
@@ -1027,6 +1027,14 @@ public:
|
|||||||
// NULL; it's owned by the window and will be deleted by it)
|
// NULL; it's owned by the window and will be deleted by it)
|
||||||
virtual void SetDropTarget( wxDropTarget *dropTarget ) = 0;
|
virtual void SetDropTarget( wxDropTarget *dropTarget ) = 0;
|
||||||
virtual wxDropTarget *GetDropTarget() const { return m_dropTarget; }
|
virtual wxDropTarget *GetDropTarget() const { return m_dropTarget; }
|
||||||
|
|
||||||
|
#ifndef __WXMSW__ // MSW version is in msw/window.h
|
||||||
|
#if wxABI_VERSION >= 20810
|
||||||
|
// Accept files for dragging
|
||||||
|
void DragAcceptFiles(bool accept);
|
||||||
|
#endif // wxABI_VERSION >= 20810
|
||||||
|
#endif // !__WXMSW__
|
||||||
|
|
||||||
#endif // wxUSE_DRAG_AND_DROP
|
#endif // wxUSE_DRAG_AND_DROP
|
||||||
|
|
||||||
// constraints and sizers
|
// constraints and sizers
|
||||||
|
@@ -2645,3 +2645,10 @@ int wxCMPFUNC_CONV wxStringSortDescending(wxString* s1, wxString* s2)
|
|||||||
{
|
{
|
||||||
return -s1->Cmp(*s2);
|
return -s1->Cmp(*s2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxString* wxCArrayString::Release()
|
||||||
|
{
|
||||||
|
wxString *r = GetStrings();
|
||||||
|
m_strings = NULL;
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
@@ -2749,6 +2749,56 @@ void wxWindowBase::DoMoveInTabOrder(wxWindow *win, MoveKind move)
|
|||||||
return win ? win->GetMainWindowOfCompositeControl() : NULL;
|
return win ? win->GetMainWindowOfCompositeControl() : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// drag and drop
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#if wxUSE_DRAG_AND_DROP && !defined(__WXMSW__)
|
||||||
|
|
||||||
|
class wxDragAcceptFilesImplTarget : public wxFileDropTarget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxDragAcceptFilesImplTarget(wxWindowBase *win) : m_win(win) {}
|
||||||
|
|
||||||
|
virtual bool OnDropFiles(wxCoord x, wxCoord y,
|
||||||
|
const wxArrayString& filenames)
|
||||||
|
{
|
||||||
|
wxDropFilesEvent event(wxEVT_DROP_FILES,
|
||||||
|
filenames.size(),
|
||||||
|
wxCArrayString(filenames).Release());
|
||||||
|
event.SetEventObject(m_win);
|
||||||
|
event.m_pos.x = x;
|
||||||
|
event.m_pos.y = y;
|
||||||
|
|
||||||
|
return m_win->GetEventHandler()->ProcessEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
wxWindowBase * const m_win;
|
||||||
|
|
||||||
|
DECLARE_NO_COPY_CLASS(wxDragAcceptFilesImplTarget)
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Generic version of DragAcceptFiles(). It works by installing a simple
|
||||||
|
// wxFileDropTarget-to-EVT_DROP_FILES adaptor and therefore cannot be used
|
||||||
|
// together with explicit SetDropTarget() calls.
|
||||||
|
void wxWindowBase::DragAcceptFiles(bool accept)
|
||||||
|
{
|
||||||
|
if ( accept )
|
||||||
|
{
|
||||||
|
wxASSERT_MSG( !GetDropTarget(),
|
||||||
|
_T("cannot use DragAcceptFiles() and SetDropTarget() together") );
|
||||||
|
SetDropTarget(new wxDragAcceptFilesImplTarget(this));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetDropTarget(NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // wxUSE_DRAG_AND_DROP && !defined(__WXMSW__)
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// global functions
|
// global functions
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -25,7 +25,9 @@
|
|||||||
|
|
||||||
# public symbols added in 2.8.10 (please keep in alphabetical order):
|
# public symbols added in 2.8.10 (please keep in alphabetical order):
|
||||||
@WX_VERSION_TAG@.10 {
|
@WX_VERSION_TAG@.10 {
|
||||||
|
*wxCArrayString*Release*;
|
||||||
*wxDCBase*GetFontPointSizeAdjustment*;
|
*wxDCBase*GetFontPointSizeAdjustment*;
|
||||||
|
*wxWindowBase*DragAcceptFiles*;
|
||||||
};
|
};
|
||||||
|
|
||||||
# public symbols added in 2.8.9 (please keep in alphabetical order):
|
# public symbols added in 2.8.9 (please keep in alphabetical order):
|
||||||
|
Reference in New Issue
Block a user