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/submenu_view.h" | 5 #include "ui/views/controls/menu/submenu_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "ui/base/accessibility/accessible_view_state.h" | 10 #include "ui/base/accessibility/accessible_view_state.h" |
| 11 #include "ui/base/event.h" |
11 #include "ui/gfx/canvas.h" | 12 #include "ui/gfx/canvas.h" |
12 #include "ui/views/controls/menu/menu_config.h" | 13 #include "ui/views/controls/menu/menu_config.h" |
13 #include "ui/views/controls/menu/menu_controller.h" | 14 #include "ui/views/controls/menu/menu_controller.h" |
14 #include "ui/views/controls/menu/menu_host.h" | 15 #include "ui/views/controls/menu/menu_host.h" |
15 #include "ui/views/controls/menu/menu_scroll_view_container.h" | 16 #include "ui/views/controls/menu/menu_scroll_view_container.h" |
16 #include "ui/views/widget/root_view.h" | 17 #include "ui/views/widget/root_view.h" |
17 #include "ui/views/widget/widget.h" | 18 #include "ui/views/widget/widget.h" |
18 | 19 |
19 namespace { | 20 namespace { |
20 | 21 |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 void SubmenuView::Hide() { | 323 void SubmenuView::Hide() { |
323 if (host_) | 324 if (host_) |
324 host_->HideMenuHost(); | 325 host_->HideMenuHost(); |
325 } | 326 } |
326 | 327 |
327 void SubmenuView::ReleaseCapture() { | 328 void SubmenuView::ReleaseCapture() { |
328 if (host_) | 329 if (host_) |
329 host_->ReleaseMenuHostCapture(); | 330 host_->ReleaseMenuHostCapture(); |
330 } | 331 } |
331 | 332 |
332 bool SubmenuView::SkipDefaultKeyEventProcessing(const views::KeyEvent& e) { | 333 bool SubmenuView::SkipDefaultKeyEventProcessing(const ui::KeyEvent& e) { |
333 return views::FocusManager::IsTabTraversalKeyEvent(e); | 334 return views::FocusManager::IsTabTraversalKeyEvent(e); |
334 } | 335 } |
335 | 336 |
336 MenuItemView* SubmenuView::GetMenuItem() const { | 337 MenuItemView* SubmenuView::GetMenuItem() const { |
337 return parent_menu_item_; | 338 return parent_menu_item_; |
338 } | 339 } |
339 | 340 |
340 void SubmenuView::SetDropMenuItem(MenuItemView* item, | 341 void SubmenuView::SetDropMenuItem(MenuItemView* item, |
341 MenuDelegate::DropPosition position) { | 342 MenuDelegate::DropPosition position) { |
342 if (drop_item_ == item && drop_position_ == position) | 343 if (drop_item_ == item && drop_position_ == position) |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 int y = vis_bounds.y() - static_cast<int>(dy); | 431 int y = vis_bounds.y() - static_cast<int>(dy); |
431 // clamp y to [0, full_height - vis_height) | 432 // clamp y to [0, full_height - vis_height) |
432 y = std::max(y, 0); | 433 y = std::max(y, 0); |
433 y = std::min(y, full_bounds.height() - vis_bounds.height() - 1); | 434 y = std::min(y, full_bounds.height() - vis_bounds.height() - 1); |
434 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height()); | 435 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height()); |
435 if (new_vis_bounds != vis_bounds) | 436 if (new_vis_bounds != vis_bounds) |
436 ScrollRectToVisible(new_vis_bounds); | 437 ScrollRectToVisible(new_vis_bounds); |
437 } | 438 } |
438 | 439 |
439 } // namespace views | 440 } // namespace views |
OLD | NEW |