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.
5 #include "ui/views/controls/menu/menu_2.h"
7 #include "ui/base/models/menu_model.h"
8 #include "ui/views/controls/menu/menu_listener.h"
12 Menu2::Menu2(ui::MenuModel
* model
)
14 wrapper_(MenuWrapper::CreateWrapper(model
)) {
20 HMENU
Menu2::GetNativeMenu() const {
21 return wrapper_
->GetNativeMenu();
24 void Menu2::RunMenuAt(const gfx::Point
& point
, Alignment alignment
) {
25 wrapper_
->RunMenuAt(point
, alignment
);
28 void Menu2::RunContextMenuAt(const gfx::Point
& point
) {
29 RunMenuAt(point
, ALIGN_TOPLEFT
);
32 void Menu2::CancelMenu() {
33 wrapper_
->CancelMenu();
36 void Menu2::Rebuild() {
37 wrapper_
->Rebuild(NULL
);
40 void Menu2::UpdateStates() {
41 wrapper_
->UpdateStates();
44 MenuWrapper::MenuAction
Menu2::GetMenuAction() const {
45 return wrapper_
->GetMenuAction();
48 void Menu2::AddMenuListener(MenuListener
* listener
) {
49 wrapper_
->AddMenuListener(listener
);
52 void Menu2::RemoveMenuListener(MenuListener
* listener
) {
53 wrapper_
->RemoveMenuListener(listener
);
56 void Menu2::SetMinimumWidth(int width
) {
57 wrapper_
->SetMinimumWidth(width
);