diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-18 21:24:34 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-18 21:24:34 +0000 |
commit | 493ba6474eb990b53cb34f57370d4660b2b6aa55 (patch) | |
tree | c53f8ea803354c4d4006024dda3e39abe6fc9cc0 /views/view.h | |
parent | bbe8521434be58c20cb2a41167bb947e95fc6b4e (diff) | |
download | chromium_src-493ba6474eb990b53cb34f57370d4660b2b6aa55.zip chromium_src-493ba6474eb990b53cb34f57370d4660b2b6aa55.tar.gz chromium_src-493ba6474eb990b53cb34f57370d4660b2b6aa55.tar.bz2 |
Adds drop support for views on gtk. As X lazily provides drop data I
needed to tweak the views API a bit.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/165407
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23653 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/view.h')
-rw-r--r-- | views/view.h | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/views/view.h b/views/view.h index ba892c1..66ef76f 100644 --- a/views/view.h +++ b/views/view.h @@ -9,9 +9,11 @@ #include <algorithm> #include <map> +#include <set> #include <string> #include <vector> +#include "app/os_exchange_data.h" #include "base/gfx/native_widget_types.h" #include "base/gfx/rect.h" #include "base/scoped_ptr.h" @@ -20,17 +22,12 @@ #include "views/background.h" #include "views/border.h" -#if defined(OS_WIN) -struct IDataObject; -#endif // defined(OS_WIN) - namespace gfx { class Canvas; class Insets; class Path; } -class OSExchangeData; class ViewAccessibilityWrapper; class ThemeProvider; @@ -742,9 +739,12 @@ class View : public AcceleratorTarget { DragController* GetDragController(); // During a drag and drop session when the mouse moves the view under the - // mouse is queried to see if it should be a target for the drag and drop - // session. A view indicates it is a valid target by returning true from - // CanDrop. If a view returns true from CanDrop, + // mouse is queried for the drop types it supports by way of the + // GetDropFormats methods. If the view returns true and the drag site can + // provide data in one of the formats, the view is asked if the drop data + // is required before any other drop events are sent. Once the + // data is available the view is asked if it supports the drop (by way of + // the CanDrop method). If a view returns true from CanDrop, // OnDragEntered is sent to the view when the mouse first enters the view, // as the mouse moves around within the view OnDragUpdated is invoked. // If the user releases the mouse over the view and OnDragUpdated returns a @@ -756,6 +756,18 @@ class View : public AcceleratorTarget { // the mouse does not support the drop, the ancestors are walked until one // is found that supports the drop. + // Override and return the set of formats that can be dropped on this view. + // |formats| is a bitmask of the formats defined bye OSExchangeData::Format. + // The default implementation returns false, which means the view doesn't + // support dropping. + virtual bool GetDropFormats( + int* formats, + std::set<OSExchangeData::CustomFormat>* custom_formats); + + // Override and return true if the data must be available before any drop + // methods should be invoked. The default is false. + virtual bool AreDropTypesRequired(); + // A view that supports drag and drop must override this and return true if // data contains a type that may be dropped on this view. virtual bool CanDrop(const OSExchangeData& data); |