Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1115)

Side by Side Diff: chrome/browser/bookmarks/bookmark_drop_info.h

Issue 9042: Adds support for autoscrolling on drag to bookmark tree/table.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_DROP_INFO_H_
6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_DROP_INFO_H_
7
8 #include <windows.h>
9
10 #include "base/timer.h"
11 #include "chrome/browser/bookmarks/bookmark_drag_data.h"
12
13 namespace views {
14 class DropTargetEvent;
15 }
16
17 // BookmarkDropInfo is a pure virtual class that provides auto-scrolling
18 // behavior and a handful of fields used for managing a bookmark drop.
19 // BookmarkDropInfo is used by both BookmarkTableView and
20 // BookmarksFolderTreeView.
21 class BookmarkDropInfo {
22 public:
23 BookmarkDropInfo(HWND hwnd, int top_margin);
24 virtual ~BookmarkDropInfo() {}
25
26 // Invoke this from OnDragUpdated. It resets source_operations,
27 // is_control_down, last_y and updates the autoscroll timer as necessary.
28 void Update(const views::DropTargetEvent& event);
29
30 // Data from the drag.
31 void SetData(const BookmarkDragData& data) { data_ = data; }
32 BookmarkDragData& data() { return data_; }
33
34 // Value of event.GetSourceOperations when Update was last invoked.
35 int source_operations() const { return source_operations_; }
36
37 // Whether the control key was down last time Update was invoked.
38 bool is_control_down() const { return is_control_down_; }
39
40 // Y position of the event last passed to Update.
41 int last_y() { return last_y_; }
42
43 // The drop operation that should occur. This is not updated by
44 // BookmarkDropInfo, but provided for subclasses.
45 void set_drop_operation(int drop_operation) {
46 drop_operation_ = drop_operation;
47 }
48 int drop_operation() const { return drop_operation_; }
49
50 protected:
51 // Invoked if we autoscroll. When invoked subclasses need to determine
52 // whether the drop is valid again as what is under the mouse has likely
53 // scrolled.
54 virtual void Scrolled() = 0;
55
56 private:
57 // Invoked from the timer. Scrolls up/down a line.
58 void Scroll();
59
60 BookmarkDragData data_;
61
62 int source_operations_;
63
64 bool is_control_down_;
65
66 int last_y_;
67
68 int drop_operation_;
69
70 HWND hwnd_;
71
72 // Margin in addition to views::kAutoscrollSize that the mouse is allowed to
73 // be over before we autoscroll.
74 int top_margin_;
75
76 // When autoscrolling this determines if we're scrolling up or down.
77 bool scroll_up_;
78
79 // Used when autoscrolling.
80 base::RepeatingTimer<BookmarkDropInfo> scroll_timer_;
81
82 DISALLOW_COPY_AND_ASSIGN(BookmarkDropInfo);
83 };
84
85 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_DROP_INFO_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/bookmarks/bookmark_drop_info.cc » ('j') | chrome/browser/views/bookmark_folder_tree_view.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698