Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: ui/views/controls/menu/menu_wrapper.h

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/controls/menu/menu_types.h ('k') | ui/views/controls/menu/native_menu_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_WRAPPER_H_
6 #define UI_VIEWS_CONTROLS_MENU_MENU_WRAPPER_H_
7
8 #include "ui/gfx/native_widget_types.h"
9 #include "ui/views/views_export.h"
10
11 namespace gfx {
12 class Point;
13 }
14
15 namespace ui {
16 class MenuModel;
17 }
18
19 namespace views {
20
21 class MenuInsertionDelegateWin;
22 class MenuListener;
23
24 // An interface that wraps an object that implements a menu.
25 class VIEWS_EXPORT MenuWrapper {
26 public:
27 // All of the possible actions that can result from RunMenuAt.
28 enum MenuAction {
29 MENU_ACTION_NONE, // Menu cancelled, or never opened.
30 MENU_ACTION_SELECTED, // An item was selected.
31 MENU_ACTION_PREVIOUS, // User wants to navigate to the previous menu.
32 MENU_ACTION_NEXT, // User wants to navigate to the next menu.
33 };
34
35 virtual ~MenuWrapper() {}
36
37 // Creates the appropriate instance of this wrapper for the current platform.
38 static MenuWrapper* CreateWrapper(ui::MenuModel* model);
39
40 // Runs the menu at the specified point. This blocks until done.
41 virtual void RunMenuAt(const gfx::Point& point, int alignment) = 0;
42
43 // Cancels the active menu.
44 virtual void CancelMenu() = 0;
45
46 // Called when the model supplying data to this menu has changed, and the menu
47 // must be rebuilt.
48 virtual void Rebuild(MenuInsertionDelegateWin* delegate) = 0;
49
50 // Called when the states of the items in the menu must be updated from the
51 // model.
52 virtual void UpdateStates() = 0;
53
54 // Retrieve a native menu handle.
55 virtual HMENU GetNativeMenu() const = 0;
56
57 // Get the result of the last call to RunMenuAt to determine whether an
58 // item was selected, the user navigated to a next or previous menu, or
59 // nothing.
60 virtual MenuAction GetMenuAction() const = 0;
61
62 // Add a listener to receive a callback when the menu opens.
63 virtual void AddMenuListener(MenuListener* listener) = 0;
64
65 // Remove a menu listener.
66 virtual void RemoveMenuListener(MenuListener* listener) = 0;
67
68 // Sets the minimum width of the menu.
69 virtual void SetMinimumWidth(int width) = 0;
70 };
71
72 } // namespace views
73
74 #endif // UI_VIEWS_CONTROLS_MENU_MENU_WRAPPER_H_
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_types.h ('k') | ui/views/controls/menu/native_menu_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698