| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "ui/base/models/menu_model.h" | 10 #include "ui/base/models/menu_model.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // ActivatedAt is never invoked. | 26 // ActivatedAt is never invoked. |
| 27 class Menu2 { | 27 class Menu2 { |
| 28 public: | 28 public: |
| 29 // Creates a new menu populated with the contents of |model|. | 29 // Creates a new menu populated with the contents of |model|. |
| 30 // WARNING: this populates the menu on construction by invoking methods on | 30 // WARNING: this populates the menu on construction by invoking methods on |
| 31 // the model. As such, it is typically not safe to use this as the model | 31 // the model. As such, it is typically not safe to use this as the model |
| 32 // from the constructor. EG: | 32 // from the constructor. EG: |
| 33 // MyClass : menu_(this) {} | 33 // MyClass : menu_(this) {} |
| 34 // is likely to have problems. | 34 // is likely to have problems. |
| 35 explicit Menu2(ui::MenuModel* model); | 35 explicit Menu2(ui::MenuModel* model); |
| 36 virtual ~Menu2() {} | 36 virtual ~Menu2(); |
| 37 | 37 |
| 38 // How the menu is aligned relative to the point it is shown at. | 38 // How the menu is aligned relative to the point it is shown at. |
| 39 // The alignment is reversed by menu if text direction is right to left. | 39 // The alignment is reversed by menu if text direction is right to left. |
| 40 enum Alignment { | 40 enum Alignment { |
| 41 ALIGN_TOPLEFT, | 41 ALIGN_TOPLEFT, |
| 42 ALIGN_TOPRIGHT | 42 ALIGN_TOPRIGHT |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 // Runs the menu at the specified point. This method blocks until done. | 45 // Runs the menu at the specified point. This method blocks until done. |
| 46 // RunContextMenuAt is the same, but the alignment is the default for a | 46 // RunContextMenuAt is the same, but the alignment is the default for a |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 // The object that actually implements the menu. | 87 // The object that actually implements the menu. |
| 88 scoped_ptr<MenuWrapper> wrapper_; | 88 scoped_ptr<MenuWrapper> wrapper_; |
| 89 | 89 |
| 90 DISALLOW_COPY_AND_ASSIGN(Menu2); | 90 DISALLOW_COPY_AND_ASSIGN(Menu2); |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 } // namespace views | 93 } // namespace views |
| 94 | 94 |
| 95 #endif // VIEWS_CONTROLS_MENU_MENU_2_H_ | 95 #endif // VIEWS_CONTROLS_MENU_MENU_2_H_ |
| OLD | NEW |