OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_2_H_ | 5 #ifndef VIEWS_CONTROLS_MENU_MENU_2_H_ |
6 #define VIEWS_CONTROLS_MENU_MENU_2_H_ | 6 #define VIEWS_CONTROLS_MENU_MENU_2_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "ui/base/models/menu_model.h" | 10 #include "ui/base/models/menu_model.h" |
11 #include "views/controls/menu/menu_wrapper.h" | 11 #include "views/controls/menu/menu_wrapper.h" |
12 #include "views/views_api.h" | 12 #include "views/views_export.h" |
13 | 13 |
14 namespace gfx { | 14 namespace gfx { |
15 class Point; | 15 class Point; |
16 } | 16 } |
17 | 17 |
18 namespace views { | 18 namespace views { |
19 | 19 |
20 class NativeMenuGtk; | 20 class NativeMenuGtk; |
21 class View; | 21 class View; |
22 | 22 |
23 // A menu. Populated from a model, and relies on a delegate to execute commands. | 23 // A menu. Populated from a model, and relies on a delegate to execute commands. |
24 // | 24 // |
25 // WARNING: do NOT create and use Menu2 on the stack. Menu2 notifies the model | 25 // WARNING: do NOT create and use Menu2 on the stack. Menu2 notifies the model |
26 // of selection AFTER a delay. This means that if use a Menu2 on the stack | 26 // of selection AFTER a delay. This means that if use a Menu2 on the stack |
27 // ActivatedAt is never invoked. | 27 // ActivatedAt is never invoked. |
28 class VIEWS_API Menu2 { | 28 class VIEWS_EXPORT Menu2 { |
29 public: | 29 public: |
30 // Creates a new menu populated with the contents of |model|. | 30 // Creates a new menu populated with the contents of |model|. |
31 // WARNING: this populates the menu on construction by invoking methods on | 31 // WARNING: this populates the menu on construction by invoking methods on |
32 // the model. As such, it is typically not safe to use this as the model | 32 // the model. As such, it is typically not safe to use this as the model |
33 // from the constructor. EG: | 33 // from the constructor. EG: |
34 // MyClass : menu_(this) {} | 34 // MyClass : menu_(this) {} |
35 // is likely to have problems. | 35 // is likely to have problems. |
36 explicit Menu2(ui::MenuModel* model); | 36 explicit Menu2(ui::MenuModel* model); |
37 virtual ~Menu2(); | 37 virtual ~Menu2(); |
38 | 38 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 // The object that actually implements the menu. | 88 // The object that actually implements the menu. |
89 scoped_ptr<MenuWrapper> wrapper_; | 89 scoped_ptr<MenuWrapper> wrapper_; |
90 | 90 |
91 DISALLOW_COPY_AND_ASSIGN(Menu2); | 91 DISALLOW_COPY_AND_ASSIGN(Menu2); |
92 }; | 92 }; |
93 | 93 |
94 } // namespace views | 94 } // namespace views |
95 | 95 |
96 #endif // VIEWS_CONTROLS_MENU_MENU_2_H_ | 96 #endif // VIEWS_CONTROLS_MENU_MENU_2_H_ |
OLD | NEW |