summaryrefslogtreecommitdiffstats
path: root/views/widget/root_view_win.cc
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-08 00:34:05 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-08 00:34:05 +0000
commit2362e4fe2905ab75d3230ebc3e307ae53e2b8362 (patch)
treee6d88357a2021811e0e354f618247217be8bb3da /views/widget/root_view_win.cc
parentdb23ac3e713dc17509b2b15d3ee634968da45715 (diff)
downloadchromium_src-2362e4fe2905ab75d3230ebc3e307ae53e2b8362.zip
chromium_src-2362e4fe2905ab75d3230ebc3e307ae53e2b8362.tar.gz
chromium_src-2362e4fe2905ab75d3230ebc3e307ae53e2b8362.tar.bz2
Move src/chrome/views to src/views. RS=darin http://crbug.com/11387
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15604 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/widget/root_view_win.cc')
-rw-r--r--views/widget/root_view_win.cc70
1 files changed, 70 insertions, 0 deletions
diff --git a/views/widget/root_view_win.cc b/views/widget/root_view_win.cc
new file mode 100644
index 0000000..ac4a50d
--- /dev/null
+++ b/views/widget/root_view_win.cc
@@ -0,0 +1,70 @@
+// Copyright (c) 2006-2008 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.
+
+#include "views/widget/root_view.h"
+
+#include "app/drag_drop_types.h"
+#include "app/gfx/chrome_canvas.h"
+#include "base/base_drag_source.h"
+#include "base/logging.h"
+#include "views/widget/root_view_drop_target.h"
+
+namespace views {
+
+void RootView::UpdateCursor(const MouseEvent& e) {
+ View *v = GetViewForPoint(e.location());
+
+ if (v && v != this) {
+ gfx::Point l(e.location());
+ View::ConvertPointToView(this, v, &l);
+ HCURSOR cursor = v->GetCursorForPoint(e.GetType(), l.x(), l.y());
+ if (cursor) {
+ ::SetCursor(cursor);
+ return;
+ }
+ }
+ if (previous_cursor_) {
+ SetCursor(previous_cursor_);
+ }
+}
+
+void RootView::OnPaint(HWND hwnd) {
+ gfx::Rect original_dirty_region = GetScheduledPaintRectConstrainedToSize();
+ if (!original_dirty_region.IsEmpty()) {
+ // Invoke InvalidateRect so that the dirty region of the window includes the
+ // region we need to paint. If we didn't do this and the region didn't
+ // include the dirty region, ProcessPaint would incorrectly mark everything
+ // as clean. This can happen if a WM_PAINT is generated by the system before
+ // the InvokeLater schedule by RootView is processed.
+ RECT win_version = original_dirty_region.ToRECT();
+ InvalidateRect(hwnd, &win_version, FALSE);
+ }
+ ChromeCanvasPaint canvas(hwnd);
+ if (!canvas.isEmpty()) {
+ const PAINTSTRUCT& ps = canvas.paintStruct();
+ SchedulePaint(gfx::Rect(ps.rcPaint), false);
+ if (NeedsPainting(false))
+ ProcessPaint(&canvas);
+ }
+}
+
+void RootView::StartDragForViewFromMouseEvent(
+ View* view,
+ IDataObject* data,
+ int operation) {
+ drag_view_ = view;
+ scoped_refptr<BaseDragSource> drag_source(new BaseDragSource);
+ DWORD effects;
+ DoDragDrop(data, drag_source,
+ DragDropTypes::DragOperationToDropEffect(operation), &effects);
+ // If the view is removed during the drag operation, drag_view_ is set to
+ // NULL.
+ if (drag_view_ == view) {
+ View* drag_view = drag_view_;
+ drag_view_ = NULL;
+ drag_view->OnDragDone();
+ }
+}
+
+}