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 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ | 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ |
6 #define UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ | 6 #define UI_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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 // Sets the selection to menu_item a value of NULL unselects | 237 // Sets the selection to menu_item a value of NULL unselects |
238 // everything. |types| is a bitmask of |SetSelectionTypes|. | 238 // everything. |types| is a bitmask of |SetSelectionTypes|. |
239 // | 239 // |
240 // Internally this updates pending_state_ immediatley. state_ is only updated | 240 // Internally this updates pending_state_ immediatley. state_ is only updated |
241 // immediately if SELECTION_UPDATE_IMMEDIATELY is set. If | 241 // immediately if SELECTION_UPDATE_IMMEDIATELY is set. If |
242 // SELECTION_UPDATE_IMMEDIATELY is not set CommitPendingSelection is invoked | 242 // SELECTION_UPDATE_IMMEDIATELY is not set CommitPendingSelection is invoked |
243 // to show/hide submenus and update state_. | 243 // to show/hide submenus and update state_. |
244 void SetSelection(MenuItemView* menu_item, int types); | 244 void SetSelection(MenuItemView* menu_item, int types); |
245 | 245 |
246 void SetSelectionOnPointerDown(SubmenuView* source, | 246 void SetSelectionOnPointerDown(SubmenuView* source, |
247 const LocatedEvent& event); | 247 const ui::LocatedEvent& event); |
248 void StartDrag(SubmenuView* source, const gfx::Point& location); | 248 void StartDrag(SubmenuView* source, const gfx::Point& location); |
249 | 249 |
250 #if defined(OS_WIN) || defined(USE_AURA) | 250 #if defined(OS_WIN) || defined(USE_AURA) |
251 // Dispatcher method. This returns true if the menu was canceled, or | 251 // Dispatcher method. This returns true if the menu was canceled, or |
252 // if the message is such that the menu should be closed. | 252 // if the message is such that the menu should be closed. |
253 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; | 253 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; |
254 #endif | 254 #endif |
255 | 255 |
256 // Key processing. The return value of this is returned from Dispatch. | 256 // Key processing. The return value of this is returned from Dispatch. |
257 // In other words, if this returns false (which happens if escape was | 257 // In other words, if this returns false (which happens if escape was |
(...skipping 16 matching lines...) Expand all Loading... |
274 // when blocking. This schedules the loop to quit. | 274 // when blocking. This schedules the loop to quit. |
275 void Accept(MenuItemView* item, int mouse_event_flags); | 275 void Accept(MenuItemView* item, int mouse_event_flags); |
276 | 276 |
277 bool ShowSiblingMenu(SubmenuView* source, const gfx::Point& mouse_location); | 277 bool ShowSiblingMenu(SubmenuView* source, const gfx::Point& mouse_location); |
278 | 278 |
279 // Shows a context menu for |menu_item| as a result of a located event if | 279 // Shows a context menu for |menu_item| as a result of a located event if |
280 // appropriate. This is invoked on long press and releasing the right mouse | 280 // appropriate. This is invoked on long press and releasing the right mouse |
281 // button. Returns whether a context menu was shown. | 281 // button. Returns whether a context menu was shown. |
282 bool ShowContextMenu(MenuItemView* menu_item, | 282 bool ShowContextMenu(MenuItemView* menu_item, |
283 SubmenuView* source, | 283 SubmenuView* source, |
284 const LocatedEvent& event); | 284 const ui::LocatedEvent& event); |
285 | 285 |
286 // Closes all menus, including any menus of nested invocations of Run. | 286 // Closes all menus, including any menus of nested invocations of Run. |
287 void CloseAllNestedMenus(); | 287 void CloseAllNestedMenus(); |
288 | 288 |
289 // Gets the enabled menu item at the specified location. | 289 // Gets the enabled menu item at the specified location. |
290 // If over_any_menu is non-null it is set to indicate whether the location | 290 // If over_any_menu is non-null it is set to indicate whether the location |
291 // is over any menu. It is possible for this to return NULL, but | 291 // is over any menu. It is possible for this to return NULL, but |
292 // over_any_menu to be true. For example, the user clicked on a separator. | 292 // over_any_menu to be true. For example, the user clicked on a separator. |
293 MenuItemView* GetMenuItemAt(View* menu, int x, int y); | 293 MenuItemView* GetMenuItemAt(View* menu, int x, int y); |
294 | 294 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 // with the same mnemonic and the item to select does not have a submenu). | 405 // with the same mnemonic and the item to select does not have a submenu). |
406 bool AcceptOrSelect(MenuItemView* parent, const SelectByCharDetails& details); | 406 bool AcceptOrSelect(MenuItemView* parent, const SelectByCharDetails& details); |
407 | 407 |
408 // Selects by mnemonic, and if that doesn't work tries the first character of | 408 // Selects by mnemonic, and if that doesn't work tries the first character of |
409 // the title. Returns true if a match was selected and the menu should exit. | 409 // the title. Returns true if a match was selected and the menu should exit. |
410 bool SelectByChar(char16 key); | 410 bool SelectByChar(char16 key); |
411 | 411 |
412 #if defined(OS_WIN) && !defined(USE_AURA) | 412 #if defined(OS_WIN) && !defined(USE_AURA) |
413 // If there is a window at the location of the event, a new mouse event is | 413 // If there is a window at the location of the event, a new mouse event is |
414 // generated and posted to it at the given location. | 414 // generated and posted to it at the given location. |
415 void RepostEvent(SubmenuView* source, const LocatedEvent& event); | 415 void RepostEvent(SubmenuView* source, const ui::LocatedEvent& event); |
416 #endif | 416 #endif |
417 | 417 |
418 // Sets the drop target to new_item. | 418 // Sets the drop target to new_item. |
419 void SetDropMenuItem(MenuItemView* new_item, | 419 void SetDropMenuItem(MenuItemView* new_item, |
420 MenuDelegate::DropPosition position); | 420 MenuDelegate::DropPosition position); |
421 | 421 |
422 // Starts/stops scrolling as appropriate. part gives the part the mouse is | 422 // Starts/stops scrolling as appropriate. part gives the part the mouse is |
423 // over. | 423 // over. |
424 void UpdateScrolling(const MenuPart& part); | 424 void UpdateScrolling(const MenuPart& part); |
425 | 425 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 // How deep we are in nested message loops. This should be at most 2 (when | 556 // How deep we are in nested message loops. This should be at most 2 (when |
557 // showing a context menu from a menu). | 557 // showing a context menu from a menu). |
558 int message_loop_depth_; | 558 int message_loop_depth_; |
559 | 559 |
560 DISALLOW_COPY_AND_ASSIGN(MenuController); | 560 DISALLOW_COPY_AND_ASSIGN(MenuController); |
561 }; | 561 }; |
562 | 562 |
563 } // namespace views | 563 } // namespace views |
564 | 564 |
565 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ | 565 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ |
OLD | NEW |