| 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 #ifndef VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ | 5 #ifndef VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ |
| 6 #define VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ | 6 #define VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 public: | 36 public: |
| 37 friend class MenuHostRootView; | 37 friend class MenuHostRootView; |
| 38 friend class MenuItemView; | 38 friend class MenuItemView; |
| 39 | 39 |
| 40 // If a menu is currently active, this returns the controller for it. | 40 // If a menu is currently active, this returns the controller for it. |
| 41 static MenuController* GetActiveInstance(); | 41 static MenuController* GetActiveInstance(); |
| 42 | 42 |
| 43 // Runs the menu at the specified location. If the menu was configured to | 43 // Runs the menu at the specified location. If the menu was configured to |
| 44 // block, the selected item is returned. If the menu does not block this | 44 // block, the selected item is returned. If the menu does not block this |
| 45 // returns NULL immediately. | 45 // returns NULL immediately. |
| 46 MenuItemView* Run(gfx::NativeView parent, | 46 MenuItemView* Run(gfx::NativeWindow parent, |
| 47 MenuItemView* root, | 47 MenuItemView* root, |
| 48 const gfx::Rect& bounds, | 48 const gfx::Rect& bounds, |
| 49 MenuItemView::AnchorPosition position, | 49 MenuItemView::AnchorPosition position, |
| 50 int* mouse_event_flags); | 50 int* mouse_event_flags); |
| 51 | 51 |
| 52 // Whether or not Run blocks. | 52 // Whether or not Run blocks. |
| 53 bool IsBlockingRun() const { return blocking_run_; } | 53 bool IsBlockingRun() const { return blocking_run_; } |
| 54 | 54 |
| 55 // Sets the selection to menu_item, a value of NULL unselects everything. | 55 // Sets the selection to menu_item, a value of NULL unselects everything. |
| 56 // If open_submenu is true and menu_item has a submenu, the submenu is shown. | 56 // If open_submenu is true and menu_item has a submenu, the submenu is shown. |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 // menu after the mouse moves out of the of the menu. This is necessitated by | 346 // menu after the mouse moves out of the of the menu. This is necessitated by |
| 347 // the lack of an ability to detect when the drag has completed from the drop | 347 // the lack of an ability to detect when the drag has completed from the drop |
| 348 // side. | 348 // side. |
| 349 base::OneShotTimer<MenuController> cancel_all_timer_; | 349 base::OneShotTimer<MenuController> cancel_all_timer_; |
| 350 | 350 |
| 351 // Drop target. | 351 // Drop target. |
| 352 MenuItemView* drop_target_; | 352 MenuItemView* drop_target_; |
| 353 MenuDelegate::DropPosition drop_position_; | 353 MenuDelegate::DropPosition drop_position_; |
| 354 | 354 |
| 355 // Owner of child windows. | 355 // Owner of child windows. |
| 356 gfx::NativeView owner_; | 356 gfx::NativeWindow owner_; |
| 357 | 357 |
| 358 // Indicates a possible drag operation. | 358 // Indicates a possible drag operation. |
| 359 bool possible_drag_; | 359 bool possible_drag_; |
| 360 | 360 |
| 361 // Location the mouse was pressed at. Used to detect d&d. | 361 // Location the mouse was pressed at. Used to detect d&d. |
| 362 int press_x_; | 362 int press_x_; |
| 363 int press_y_; | 363 int press_y_; |
| 364 | 364 |
| 365 // We get a slew of drag updated messages as the mouse is over us. To avoid | 365 // We get a slew of drag updated messages as the mouse is over us. To avoid |
| 366 // continually processing whether we can drop, we cache the coordinates. | 366 // continually processing whether we can drop, we cache the coordinates. |
| 367 bool valid_drop_coordinates_; | 367 bool valid_drop_coordinates_; |
| 368 int drop_x_; | 368 int drop_x_; |
| 369 int drop_y_; | 369 int drop_y_; |
| 370 int last_drop_operation_; | 370 int last_drop_operation_; |
| 371 | 371 |
| 372 // If true, we're in the middle of invoking ShowAt on a submenu. | 372 // If true, we're in the middle of invoking ShowAt on a submenu. |
| 373 bool showing_submenu_; | 373 bool showing_submenu_; |
| 374 | 374 |
| 375 // Task for scrolling the menu. If non-null indicates a scroll is currently | 375 // Task for scrolling the menu. If non-null indicates a scroll is currently |
| 376 // underway. | 376 // underway. |
| 377 scoped_ptr<MenuScrollTask> scroll_task_; | 377 scoped_ptr<MenuScrollTask> scroll_task_; |
| 378 | 378 |
| 379 DISALLOW_COPY_AND_ASSIGN(MenuController); | 379 DISALLOW_COPY_AND_ASSIGN(MenuController); |
| 380 }; | 380 }; |
| 381 | 381 |
| 382 } // namespace views | 382 } // namespace views |
| 383 | 383 |
| 384 #endif // VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ | 384 #endif // VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ |
| OLD | NEW |