| OLD | NEW |
| (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 #include "ui/views/controls/menu/menu_2.h" | |
| 6 | |
| 7 #include "ui/base/models/menu_model.h" | |
| 8 #include "ui/views/controls/menu/menu_listener.h" | |
| 9 | |
| 10 namespace views { | |
| 11 | |
| 12 Menu2::Menu2(ui::MenuModel* model) | |
| 13 : model_(model), | |
| 14 ALLOW_THIS_IN_INITIALIZER_LIST( | |
| 15 wrapper_(MenuWrapper::CreateWrapper(model))) { | |
| 16 Rebuild(); | |
| 17 } | |
| 18 | |
| 19 Menu2::~Menu2() {} | |
| 20 | |
| 21 HMENU Menu2::GetNativeMenu() const { | |
| 22 return wrapper_->GetNativeMenu(); | |
| 23 } | |
| 24 | |
| 25 void Menu2::RunMenuAt(const gfx::Point& point, Alignment alignment) { | |
| 26 wrapper_->RunMenuAt(point, alignment); | |
| 27 } | |
| 28 | |
| 29 void Menu2::RunContextMenuAt(const gfx::Point& point) { | |
| 30 RunMenuAt(point, ALIGN_TOPLEFT); | |
| 31 } | |
| 32 | |
| 33 void Menu2::CancelMenu() { | |
| 34 wrapper_->CancelMenu(); | |
| 35 } | |
| 36 | |
| 37 void Menu2::Rebuild() { | |
| 38 wrapper_->Rebuild(NULL); | |
| 39 } | |
| 40 | |
| 41 void Menu2::UpdateStates() { | |
| 42 wrapper_->UpdateStates(); | |
| 43 } | |
| 44 | |
| 45 MenuWrapper::MenuAction Menu2::GetMenuAction() const { | |
| 46 return wrapper_->GetMenuAction(); | |
| 47 } | |
| 48 | |
| 49 void Menu2::AddMenuListener(MenuListener* listener) { | |
| 50 wrapper_->AddMenuListener(listener); | |
| 51 } | |
| 52 | |
| 53 void Menu2::RemoveMenuListener(MenuListener* listener) { | |
| 54 wrapper_->RemoveMenuListener(listener); | |
| 55 } | |
| 56 | |
| 57 void Menu2::SetMinimumWidth(int width) { | |
| 58 wrapper_->SetMinimumWidth(width); | |
| 59 } | |
| 60 | |
| 61 } // namespace | |
| OLD | NEW |