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

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

Issue 231883003: [stash] 20140404-crbug-312961-mac-views-bridge-C-wholegrid Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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_item_view.cc ('k') | ui/views/controls/menu/menu_runner.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_RUNNER_H_ 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_H_
6 #define UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_H_ 6 #define UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "ui/views/controls/menu/menu_item_view.h" 11 #include "ui/base/models/menu_separator_types.h"
12 #include "ui/base/ui_base_types.h"
13 #include "ui/views/views_export.h"
14
15 namespace base {
16 class TimeDelta;
17 }
18
19 namespace gfx {
20 class Rect;
21 }
12 22
13 namespace ui { 23 namespace ui {
14 class MenuModel; 24 class MenuModel;
15 } 25 }
16 26
17 namespace views { 27 namespace views {
18 28
19 class MenuButton; 29 class MenuButton;
30 class MenuItemView;
20 class MenuModelAdapter; 31 class MenuModelAdapter;
21 class MenuRunnerHandler; 32 class MenuRunnerHandler;
22 class Widget; 33 class Widget;
23 34
24 namespace internal { 35 namespace internal {
25 class DisplayChangeListener; 36 class DisplayChangeListener;
26 class MenuRunnerImpl; 37 class MenuRunnerImpl;
27 } 38 }
28 39
29 namespace test { 40 namespace test {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // only need call this if you create additional menus from 104 // only need call this if you create additional menus from
94 // MenuDelegate::GetSiblingMenu. 105 // MenuDelegate::GetSiblingMenu.
95 void OwnMenu(MenuItemView* menu); 106 void OwnMenu(MenuItemView* menu);
96 107
97 // Runs the menu. |types| is a bitmask of RunTypes. If this returns 108 // Runs the menu. |types| is a bitmask of RunTypes. If this returns
98 // MENU_DELETED the method is returning because the MenuRunner was deleted. 109 // MENU_DELETED the method is returning because the MenuRunner was deleted.
99 // Typically callers should NOT do any processing if this returns 110 // Typically callers should NOT do any processing if this returns
100 // MENU_DELETED. 111 // MENU_DELETED.
101 // If |anchor| uses a |BUBBLE_..| type, the bounds will get determined by 112 // If |anchor| uses a |BUBBLE_..| type, the bounds will get determined by
102 // using |bounds| as the thing to point at in screen coordinates. 113 // using |bounds| as the thing to point at in screen coordinates.
114 template <class MENU_ANCHOR_TYPE>
103 RunResult RunMenuAt(Widget* parent, 115 RunResult RunMenuAt(Widget* parent,
104 MenuButton* button, 116 MenuButton* button,
105 const gfx::Rect& bounds, 117 const gfx::Rect& bounds,
106 MenuItemView::AnchorPosition anchor, 118 MENU_ANCHOR_TYPE anchor,
107 ui::MenuSourceType source_type, 119 ui::MenuSourceType source_type,
108 int32 types) WARN_UNUSED_RESULT; 120 int32 types) WARN_UNUSED_RESULT;
109 121
110 // Returns true if we're in a nested message loop running the menu. 122 // Returns true if we're in a nested message loop running the menu.
111 bool IsRunning() const; 123 bool IsRunning() const;
112 124
113 // Hides and cancels the menu. This does nothing if the menu is not open. 125 // Hides and cancels the menu. This does nothing if the menu is not open.
114 void Cancel(); 126 void Cancel();
115 127
116 // Returns the time from the event which closed the menu - or 0. 128 // Returns the time from the event which closed the menu - or 0.
(...skipping 11 matching lines...) Expand all
128 140
129 // An implementation of RunMenuAt. This is usually NULL and ignored. If this 141 // An implementation of RunMenuAt. This is usually NULL and ignored. If this
130 // is not NULL, this implementation will be used. 142 // is not NULL, this implementation will be used.
131 scoped_ptr<MenuRunnerHandler> runner_handler_; 143 scoped_ptr<MenuRunnerHandler> runner_handler_;
132 144
133 scoped_ptr<internal::DisplayChangeListener> display_change_listener_; 145 scoped_ptr<internal::DisplayChangeListener> display_change_listener_;
134 146
135 DISALLOW_COPY_AND_ASSIGN(MenuRunner); 147 DISALLOW_COPY_AND_ASSIGN(MenuRunner);
136 }; 148 };
137 149
150 template<> VIEWS_EXPORT
151 MenuRunner::RunResult MenuRunner::RunMenuAt(Widget* parent,
152 MenuButton* button,
153 const gfx::Rect& bounds,
154 ui::MenuAnchorPosition anchor,
155 ui::MenuSourceType source_type,
156 int32 types) WARN_UNUSED_RESULT;
157
138 namespace internal { 158 namespace internal {
139 159
140 // DisplayChangeListener is intended to listen for changes in the display size 160 // DisplayChangeListener is intended to listen for changes in the display size
141 // and cancel the menu. DisplayChangeListener is created when the menu is 161 // and cancel the menu. DisplayChangeListener is created when the menu is
142 // shown. 162 // shown.
143 class DisplayChangeListener { 163 class DisplayChangeListener {
144 public: 164 public:
145 virtual ~DisplayChangeListener() {} 165 virtual ~DisplayChangeListener() {}
146 166
147 // Creates the platform specified DisplayChangeListener, or NULL if there 167 // Creates the platform specified DisplayChangeListener, or NULL if there
148 // isn't one. Caller owns the returned value. 168 // isn't one. Caller owns the returned value.
149 static DisplayChangeListener* Create(Widget* parent, 169 static DisplayChangeListener* Create(Widget* parent,
150 MenuRunner* runner); 170 MenuRunner* runner);
151 171
152 protected: 172 protected:
153 DisplayChangeListener() {} 173 DisplayChangeListener() {}
154 }; 174 };
155 175
156 } 176 }
157 177
158 } // namespace views 178 } // namespace views
159 179
160 #endif // UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_H_ 180 #endif // UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_H_
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_item_view.cc ('k') | ui/views/controls/menu/menu_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698