| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 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 | 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 "views/controls/menu/chrome_menu.h" | 5 #include "views/controls/menu/chrome_menu.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <uxtheme.h> | 8 #include <uxtheme.h> |
| 9 #include <Vssym32.h> | 9 #include <Vssym32.h> |
| 10 | 10 |
| (...skipping 1772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1783 // event. | 1783 // event. |
| 1784 RepostEvent(source, event); | 1784 RepostEvent(source, event); |
| 1785 | 1785 |
| 1786 // And close. | 1786 // And close. |
| 1787 Cancel(true); | 1787 Cancel(true); |
| 1788 return; | 1788 return; |
| 1789 } | 1789 } |
| 1790 | 1790 |
| 1791 bool open_submenu = false; | 1791 bool open_submenu = false; |
| 1792 if (!part.menu) { | 1792 if (!part.menu) { |
| 1793 part.menu = source->GetMenuItem(); | 1793 part.menu = part.parent; |
| 1794 open_submenu = true; | 1794 open_submenu = true; |
| 1795 } else { | 1795 } else { |
| 1796 if (part.menu->GetDelegate()->CanDrag(part.menu)) { | 1796 if (part.menu->GetDelegate()->CanDrag(part.menu)) { |
| 1797 possible_drag_ = true; | 1797 possible_drag_ = true; |
| 1798 press_x_ = event.x(); | 1798 press_x_ = event.x(); |
| 1799 press_y_ = event.y(); | 1799 press_y_ = event.y(); |
| 1800 } | 1800 } |
| 1801 if (part.menu->HasSubmenu()) | 1801 if (part.menu->HasSubmenu()) |
| 1802 open_submenu = true; | 1802 open_submenu = true; |
| 1803 } | 1803 } |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2332 part->submenu = menu; | 2332 part->submenu = menu; |
| 2333 return true; | 2333 return true; |
| 2334 } | 2334 } |
| 2335 | 2335 |
| 2336 // Not over the scroll button. Check the actual menu. | 2336 // Not over the scroll button. Check the actual menu. |
| 2337 if (DoesSubmenuContainLocation(menu, screen_loc)) { | 2337 if (DoesSubmenuContainLocation(menu, screen_loc)) { |
| 2338 gfx::Point menu_loc = screen_loc; | 2338 gfx::Point menu_loc = screen_loc; |
| 2339 View::ConvertPointToView(NULL, menu, &menu_loc); | 2339 View::ConvertPointToView(NULL, menu, &menu_loc); |
| 2340 part->menu = GetMenuItemAt(menu, menu_loc.x(), menu_loc.y()); | 2340 part->menu = GetMenuItemAt(menu, menu_loc.x(), menu_loc.y()); |
| 2341 part->type = MenuPart::MENU_ITEM; | 2341 part->type = MenuPart::MENU_ITEM; |
| 2342 if (!part->menu) |
| 2343 part->parent = menu->GetMenuItem(); |
| 2342 return true; | 2344 return true; |
| 2343 } | 2345 } |
| 2344 | 2346 |
| 2345 // While the mouse isn't over a menu item or the scroll buttons of menu, it | 2347 // While the mouse isn't over a menu item or the scroll buttons of menu, it |
| 2346 // is contained by menu and so we return true. If we didn't return true other | 2348 // is contained by menu and so we return true. If we didn't return true other |
| 2347 // menus would be searched, even though they are likely obscured by us. | 2349 // menus would be searched, even though they are likely obscured by us. |
| 2348 return true; | 2350 return true; |
| 2349 } | 2351 } |
| 2350 | 2352 |
| 2351 bool MenuController::DoesSubmenuContainLocation(SubmenuView* submenu, | 2353 bool MenuController::DoesSubmenuContainLocation(SubmenuView* submenu, |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2819 if (!scroll_task_.get()) | 2821 if (!scroll_task_.get()) |
| 2820 scroll_task_.reset(new MenuScrollTask()); | 2822 scroll_task_.reset(new MenuScrollTask()); |
| 2821 scroll_task_->Update(part); | 2823 scroll_task_->Update(part); |
| 2822 } | 2824 } |
| 2823 | 2825 |
| 2824 void MenuController::StopScrolling() { | 2826 void MenuController::StopScrolling() { |
| 2825 scroll_task_.reset(NULL); | 2827 scroll_task_.reset(NULL); |
| 2826 } | 2828 } |
| 2827 | 2829 |
| 2828 } // namespace views | 2830 } // namespace views |
| OLD | NEW |