| Index: views/controls/menu/native_menu_linux.cc
|
| diff --git a/views/controls/menu/native_menu_x.cc b/views/controls/menu/native_menu_linux.cc
|
| similarity index 75%
|
| rename from views/controls/menu/native_menu_x.cc
|
| rename to views/controls/menu/native_menu_linux.cc
|
| index eb960422d0a9cf4ba07f2340c8b429948a75ca94..98f3f77684d825b6949de9251785d487bfca3cb1 100644
|
| --- a/views/controls/menu/native_menu_x.cc
|
| +++ b/views/controls/menu/native_menu_linux.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "views/controls/menu/native_menu_x.h"
|
| +#include "views/controls/menu/native_menu_linux.h"
|
|
|
| #include "base/logging.h"
|
| #include "base/utf_string_conversions.h"
|
| @@ -13,63 +13,63 @@
|
|
|
| namespace views {
|
|
|
| -NativeMenuX::NativeMenuX(Menu2* menu)
|
| +NativeMenuLinux::NativeMenuLinux(Menu2* menu)
|
| : model_(menu->model()),
|
| ALLOW_THIS_IN_INITIALIZER_LIST(root_(new MenuItemView(this))) {
|
| }
|
|
|
| -NativeMenuX::~NativeMenuX() {
|
| +NativeMenuLinux::~NativeMenuLinux() {
|
| }
|
|
|
| // MenuWrapper implementation:
|
| -void NativeMenuX::RunMenuAt(const gfx::Point& point, int alignment) {
|
| +void NativeMenuLinux::RunMenuAt(const gfx::Point& point, int alignment) {
|
| UpdateStates();
|
| root_->RunMenuAt(NULL, NULL, gfx::Rect(point, gfx::Size()),
|
| alignment == Menu2::ALIGN_TOPLEFT ? MenuItemView::TOPLEFT :
|
| MenuItemView::TOPRIGHT, true);
|
| }
|
|
|
| -void NativeMenuX::CancelMenu() {
|
| +void NativeMenuLinux::CancelMenu() {
|
| NOTIMPLEMENTED();
|
| }
|
|
|
| -void NativeMenuX::Rebuild() {
|
| +void NativeMenuLinux::Rebuild() {
|
| if (SubmenuView* submenu = root_->GetSubmenu()) {
|
| submenu->RemoveAllChildViews(true);
|
| }
|
| AddMenuItemsFromModel(root_.get(), model_);
|
| }
|
|
|
| -void NativeMenuX::UpdateStates() {
|
| +void NativeMenuLinux::UpdateStates() {
|
| SubmenuView* submenu = root_->CreateSubmenu();
|
| UpdateMenuFromModel(submenu, model_);
|
| }
|
|
|
| -gfx::NativeMenu NativeMenuX::GetNativeMenu() const {
|
| +gfx::NativeMenu NativeMenuLinux::GetNativeMenu() const {
|
| NOTIMPLEMENTED();
|
| return NULL;
|
| }
|
|
|
| -MenuWrapper::MenuAction NativeMenuX::GetMenuAction() const {
|
| +MenuWrapper::MenuAction NativeMenuLinux::GetMenuAction() const {
|
| NOTIMPLEMENTED();
|
| return MENU_ACTION_NONE;
|
| }
|
|
|
| -void NativeMenuX::AddMenuListener(MenuListener* listener) {
|
| +void NativeMenuLinux::AddMenuListener(MenuListener* listener) {
|
| NOTIMPLEMENTED();
|
| }
|
|
|
| -void NativeMenuX::RemoveMenuListener(MenuListener* listener) {
|
| +void NativeMenuLinux::RemoveMenuListener(MenuListener* listener) {
|
| NOTIMPLEMENTED();
|
| }
|
|
|
| -void NativeMenuX::SetMinimumWidth(int width) {
|
| +void NativeMenuLinux::SetMinimumWidth(int width) {
|
| NOTIMPLEMENTED();
|
| }
|
|
|
| // MenuDelegate implementation
|
|
|
| -bool NativeMenuX::IsItemChecked(int cmd) const {
|
| +bool NativeMenuLinux::IsItemChecked(int cmd) const {
|
| int index;
|
| ui::MenuModel* model = model_;
|
| if (!ui::MenuModel::GetModelAndIndexForCommandId(cmd, &model, &index))
|
| @@ -77,7 +77,7 @@ bool NativeMenuX::IsItemChecked(int cmd) const {
|
| return model->IsItemCheckedAt(index);
|
| }
|
|
|
| -bool NativeMenuX::IsCommandEnabled(int cmd) const {
|
| +bool NativeMenuLinux::IsCommandEnabled(int cmd) const {
|
| int index;
|
| ui::MenuModel* model = model_;
|
| if (!ui::MenuModel::GetModelAndIndexForCommandId(cmd, &model, &index))
|
| @@ -85,7 +85,7 @@ bool NativeMenuX::IsCommandEnabled(int cmd) const {
|
| return model->IsEnabledAt(index);
|
| }
|
|
|
| -void NativeMenuX::ExecuteCommand(int cmd) {
|
| +void NativeMenuLinux::ExecuteCommand(int cmd) {
|
| int index;
|
| ui::MenuModel* model = model_;
|
| if (!ui::MenuModel::GetModelAndIndexForCommandId(cmd, &model, &index))
|
| @@ -93,7 +93,7 @@ void NativeMenuX::ExecuteCommand(int cmd) {
|
| model->ActivatedAt(index);
|
| }
|
|
|
| -bool NativeMenuX::GetAccelerator(int id, views::Accelerator* accelerator) {
|
| +bool NativeMenuLinux::GetAccelerator(int id, views::Accelerator* accelerator) {
|
| int index;
|
| ui::MenuModel* model = model_;
|
| if (!ui::MenuModel::GetModelAndIndexForCommandId(id, &model, &index))
|
| @@ -109,8 +109,8 @@ bool NativeMenuX::GetAccelerator(int id, views::Accelerator* accelerator) {
|
| }
|
|
|
| // private
|
| -void NativeMenuX::AddMenuItemsFromModel(MenuItemView* parent,
|
| - ui::MenuModel* model) {
|
| +void NativeMenuLinux::AddMenuItemsFromModel(MenuItemView* parent,
|
| + ui::MenuModel* model) {
|
| for (int i = 0; i < model->GetItemCount(); ++i) {
|
| int index = i + model->GetFirstItemIndex(NULL);
|
| MenuItemView* child = parent->AppendMenuItemFromModel(model, index,
|
| @@ -122,8 +122,8 @@ void NativeMenuX::AddMenuItemsFromModel(MenuItemView* parent,
|
| }
|
| }
|
|
|
| -void NativeMenuX::UpdateMenuFromModel(SubmenuView* menu,
|
| - ui::MenuModel* model) {
|
| +void NativeMenuLinux::UpdateMenuFromModel(SubmenuView* menu,
|
| + ui::MenuModel* model) {
|
| for (int i = 0, sep = 0; i < model->GetItemCount(); ++i) {
|
| int index = i + model->GetFirstItemIndex(NULL);
|
| if (model->GetTypeAt(index) == ui::MenuModel::TYPE_SEPARATOR) {
|
| @@ -158,7 +158,7 @@ void NativeMenuX::UpdateMenuFromModel(SubmenuView* menu,
|
|
|
| // static
|
| MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) {
|
| - return new NativeMenuX(menu);
|
| + return new NativeMenuLinux(menu);
|
| }
|
|
|
| } // namespace views
|
|
|