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 #include "third_party/skia/include/core/SkPaint.h" | 7 #include "third_party/skia/include/core/SkPaint.h" |
8 #include "third_party/skia/include/core/SkPath.h" | 8 #include "third_party/skia/include/core/SkPath.h" |
9 #include "ui/accessibility/ax_view_state.h" | 9 #include "ui/accessibility/ax_view_state.h" |
10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 class MenuScrollButton : public View { | 34 class MenuScrollButton : public View { |
35 public: | 35 public: |
36 MenuScrollButton(SubmenuView* host, bool is_up) | 36 MenuScrollButton(SubmenuView* host, bool is_up) |
37 : host_(host), | 37 : host_(host), |
38 is_up_(is_up), | 38 is_up_(is_up), |
39 // Make our height the same as that of other MenuItemViews. | 39 // Make our height the same as that of other MenuItemViews. |
40 pref_height_(MenuItemView::pref_menu_height()) { | 40 pref_height_(MenuItemView::pref_menu_height()) { |
41 } | 41 } |
42 | 42 |
43 virtual gfx::Size GetPreferredSize() OVERRIDE { | 43 virtual gfx::Size GetPreferredSize() const OVERRIDE { |
44 return gfx::Size( | 44 return gfx::Size( |
45 host_->GetMenuItem()->GetMenuConfig().scroll_arrow_height * 2 - 1, | 45 host_->GetMenuItem()->GetMenuConfig().scroll_arrow_height * 2 - 1, |
46 pref_height_); | 46 pref_height_); |
47 } | 47 } |
48 | 48 |
49 virtual bool CanDrop(const OSExchangeData& data) OVERRIDE { | 49 virtual bool CanDrop(const OSExchangeData& data) OVERRIDE { |
50 DCHECK(host_->GetMenuItem()->GetMenuController()); | 50 DCHECK(host_->GetMenuItem()->GetMenuController()); |
51 return true; // Always return true so that drop events are targeted to us. | 51 return true; // Always return true so that drop events are targeted to us. |
52 } | 52 } |
53 | 53 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 236 |
237 pref = scroll_down_button_->GetPreferredSize(); | 237 pref = scroll_down_button_->GetPreferredSize(); |
238 scroll_down_button_->SetBounds(x, height() - pref.height() - insets.top(), | 238 scroll_down_button_->SetBounds(x, height() - pref.height() - insets.top(), |
239 width, pref.height()); | 239 width, pref.height()); |
240 content_height -= pref.height(); | 240 content_height -= pref.height(); |
241 | 241 |
242 scroll_view_->SetBounds(x, scroll_view_y, width, content_height); | 242 scroll_view_->SetBounds(x, scroll_view_y, width, content_height); |
243 scroll_view_->Layout(); | 243 scroll_view_->Layout(); |
244 } | 244 } |
245 | 245 |
246 gfx::Size MenuScrollViewContainer::GetPreferredSize() { | 246 gfx::Size MenuScrollViewContainer::GetPreferredSize() const { |
247 gfx::Size prefsize = scroll_view_->GetContents()->GetPreferredSize(); | 247 gfx::Size prefsize = scroll_view_->GetContents()->GetPreferredSize(); |
248 gfx::Insets insets = GetInsets(); | 248 gfx::Insets insets = GetInsets(); |
249 prefsize.Enlarge(insets.width(), insets.height()); | 249 prefsize.Enlarge(insets.width(), insets.height()); |
250 return prefsize; | 250 return prefsize; |
251 } | 251 } |
252 | 252 |
253 void MenuScrollViewContainer::GetAccessibleState( | 253 void MenuScrollViewContainer::GetAccessibleState( |
254 ui::AXViewState* state) { | 254 ui::AXViewState* state) { |
255 // Get the name from the submenu view. | 255 // Get the name from the submenu view. |
256 content_view_->GetAccessibleState(state); | 256 content_view_->GetAccessibleState(state); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 case MENU_ANCHOR_BUBBLE_ABOVE: | 325 case MENU_ANCHOR_BUBBLE_ABOVE: |
326 return BubbleBorder::BOTTOM_CENTER; | 326 return BubbleBorder::BOTTOM_CENTER; |
327 case MENU_ANCHOR_BUBBLE_BELOW: | 327 case MENU_ANCHOR_BUBBLE_BELOW: |
328 return BubbleBorder::TOP_CENTER; | 328 return BubbleBorder::TOP_CENTER; |
329 default: | 329 default: |
330 return BubbleBorder::NONE; | 330 return BubbleBorder::NONE; |
331 } | 331 } |
332 } | 332 } |
333 | 333 |
334 } // namespace views | 334 } // namespace views |
OLD | NEW |