OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/views/controls/menu/menu_scroll_view_container.h" | 5 #include "ui/views/controls/menu/menu_scroll_view_container.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <uxtheme.h> | 9 #include <uxtheme.h> |
10 #include <Vssym32.h> | 10 #include <Vssym32.h> |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 virtual gfx::Size GetPreferredSize() { | 50 virtual gfx::Size GetPreferredSize() { |
51 return gfx::Size(MenuConfig::instance().scroll_arrow_height * 2 - 1, | 51 return gfx::Size(MenuConfig::instance().scroll_arrow_height * 2 - 1, |
52 pref_height_); | 52 pref_height_); |
53 } | 53 } |
54 | 54 |
55 virtual bool CanDrop(const OSExchangeData& data) { | 55 virtual bool CanDrop(const OSExchangeData& data) { |
56 DCHECK(host_->GetMenuItem()->GetMenuController()); | 56 DCHECK(host_->GetMenuItem()->GetMenuController()); |
57 return true; // Always return true so that drop events are targeted to us. | 57 return true; // Always return true so that drop events are targeted to us. |
58 } | 58 } |
59 | 59 |
60 virtual void OnDragEntered(const DropTargetEvent& event) { | 60 virtual void OnDragEntered(const ui::DropTargetEvent& event) { |
61 DCHECK(host_->GetMenuItem()->GetMenuController()); | 61 DCHECK(host_->GetMenuItem()->GetMenuController()); |
62 host_->GetMenuItem()->GetMenuController()->OnDragEnteredScrollButton( | 62 host_->GetMenuItem()->GetMenuController()->OnDragEnteredScrollButton( |
63 host_, is_up_); | 63 host_, is_up_); |
64 } | 64 } |
65 | 65 |
66 virtual int OnDragUpdated(const DropTargetEvent& event) { | 66 virtual int OnDragUpdated(const ui::DropTargetEvent& event) { |
67 return ui::DragDropTypes::DRAG_NONE; | 67 return ui::DragDropTypes::DRAG_NONE; |
68 } | 68 } |
69 | 69 |
70 virtual void OnDragExited() { | 70 virtual void OnDragExited() { |
71 DCHECK(host_->GetMenuItem()->GetMenuController()); | 71 DCHECK(host_->GetMenuItem()->GetMenuController()); |
72 host_->GetMenuItem()->GetMenuController()->OnDragExitedScrollButton(host_); | 72 host_->GetMenuItem()->GetMenuController()->OnDragExitedScrollButton(host_); |
73 } | 73 } |
74 | 74 |
75 virtual int OnPerformDrop(const DropTargetEvent& event) { | 75 virtual int OnPerformDrop(const ui::DropTargetEvent& event) { |
76 return ui::DragDropTypes::DRAG_NONE; | 76 return ui::DragDropTypes::DRAG_NONE; |
77 } | 77 } |
78 | 78 |
79 virtual void OnPaint(gfx::Canvas* canvas) { | 79 virtual void OnPaint(gfx::Canvas* canvas) { |
80 const MenuConfig& config = MenuConfig::instance(); | 80 const MenuConfig& config = MenuConfig::instance(); |
81 | 81 |
82 // The background. | 82 // The background. |
83 gfx::Rect item_bounds(0, 0, width(), height()); | 83 gfx::Rect item_bounds(0, 0, width(), height()); |
84 NativeTheme::ExtraParams extra; | 84 NativeTheme::ExtraParams extra; |
85 extra.menu_item.is_selected = false; | 85 extra.menu_item.is_selected = false; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 255 |
256 void MenuScrollViewContainer::OnBoundsChanged( | 256 void MenuScrollViewContainer::OnBoundsChanged( |
257 const gfx::Rect& previous_bounds) { | 257 const gfx::Rect& previous_bounds) { |
258 gfx::Size content_pref = scroll_view_->GetContents()->GetPreferredSize(); | 258 gfx::Size content_pref = scroll_view_->GetContents()->GetPreferredSize(); |
259 scroll_up_button_->SetVisible(content_pref.height() > height()); | 259 scroll_up_button_->SetVisible(content_pref.height() > height()); |
260 scroll_down_button_->SetVisible(content_pref.height() > height()); | 260 scroll_down_button_->SetVisible(content_pref.height() > height()); |
261 Layout(); | 261 Layout(); |
262 } | 262 } |
263 | 263 |
264 } // namespace views | 264 } // namespace views |
OLD | NEW |