diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-11 14:04:00 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-11 14:04:00 +0000 |
commit | c476652ae760b3dd16d26f4375d9f28fee42238d (patch) | |
tree | 46882f8a7b13e61052918b6dfbaac827cd515187 /views/widget/drop_target_win.h | |
parent | 73704c8719ee45cbf0a92c16d2450952799dccac (diff) | |
download | chromium_src-c476652ae760b3dd16d26f4375d9f28fee42238d.zip chromium_src-c476652ae760b3dd16d26f4375d9f28fee42238d.tar.gz chromium_src-c476652ae760b3dd16d26f4375d9f28fee42238d.tar.bz2 |
Refactors RootViewDropTarget into a platform independent part,
DropHelper, and the platform specific part DropTarget. I've also moved
ownership/creation of the DropTarget to Widget. This makes it alot
easier for the windows side, in which DropTarget must implement
IDataObject.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/165155
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23020 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/widget/drop_target_win.h')
-rw-r--r-- | views/widget/drop_target_win.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/views/widget/drop_target_win.h b/views/widget/drop_target_win.h new file mode 100644 index 0000000..d771c07 --- /dev/null +++ b/views/widget/drop_target_win.h @@ -0,0 +1,53 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef VIEWS_WIDGET_DROP_TARGET_WIN_H_ +#define VIEWS_WIDGET_DROP_TARGET_WIN_H_ + +#include "base/base_drop_target.h" +#include "views/widget/drop_helper.h" + +namespace views { + +class RootView; +class View; + +// DropTargetWin takes care of managing drag and drop for WidgetWin. It +// converts Windows OLE drop messages into Views drop messages. +// +// DropTargetWin uses DropHelper to manage the appropriate view to target +// drop messages at. +class DropTargetWin : public BaseDropTarget { + public: + explicit DropTargetWin(RootView* root_view); + virtual ~DropTargetWin(); + + // If a drag and drop is underway and view is the current drop target, the + // drop target is set to null. + // This is invoked when a View is removed from the RootView to make sure + // we don't target a view that was removed during dnd. + void ResetTargetViewIfEquals(View* view); + + protected: + virtual DWORD OnDragOver(IDataObject* data_object, + DWORD key_state, + POINT cursor_position, + DWORD effect); + + virtual void OnDragLeave(IDataObject* data_object); + + virtual DWORD OnDrop(IDataObject* data_object, + DWORD key_state, + POINT cursor_position, + DWORD effect); + + private: + views::DropHelper helper_; + + DISALLOW_COPY_AND_ASSIGN(DropTargetWin); +}; + +} // namespace views + +#endif // VIEWS_WIDGET_DROP_TARGET_WIN_H_ |