| Index: trunk/src/ui/views/controls/menu/native_menu_win.cc
|
| ===================================================================
|
| --- trunk/src/ui/views/controls/menu/native_menu_win.cc (revision 195258)
|
| +++ trunk/src/ui/views/controls/menu/native_menu_win.cc (working copy)
|
| @@ -25,8 +25,8 @@
|
| #include "ui/gfx/rect.h"
|
| #include "ui/native_theme/native_theme.h"
|
| #include "ui/native_theme/native_theme_win.h"
|
| +#include "ui/views/controls/menu/menu_2.h"
|
| #include "ui/views/controls/menu/menu_config.h"
|
| -#include "ui/views/controls/menu/menu_insertion_delegate.h"
|
| #include "ui/views/controls/menu/menu_listener.h"
|
|
|
| using ui::NativeTheme;
|
| @@ -54,7 +54,7 @@
|
| string16 label;
|
|
|
| // Someone needs to own submenus, it may as well be us.
|
| - scoped_ptr<NativeMenuWin> submenu;
|
| + scoped_ptr<Menu2> submenu;
|
|
|
| // We need a pointer back to the containing menu in various circumstances.
|
| NativeMenuWin* native_menu_win;
|
| @@ -152,7 +152,7 @@
|
|
|
| // Only notify the model if it didn't already send out notification.
|
| // See comment in MenuMessageHook for details.
|
| - if (root_menu->menu_action_ == MENU_ACTION_NONE)
|
| + if (root_menu->menu_action_ == MenuWrapper::MENU_ACTION_NONE)
|
| model->ActivatedAt(position);
|
| }
|
|
|
| @@ -410,6 +410,9 @@
|
| DestroyMenu(menu_);
|
| }
|
|
|
| +////////////////////////////////////////////////////////////////////////////////
|
| +// NativeMenuWin, MenuWrapper implementation:
|
| +
|
| void NativeMenuWin::RunMenuAt(const gfx::Point& point, int alignment) {
|
| CreateHostWindow();
|
| UpdateStates();
|
| @@ -466,7 +469,7 @@
|
| EndMenu();
|
| }
|
|
|
| -void NativeMenuWin::Rebuild(MenuInsertionDelegate* delegate) {
|
| +void NativeMenuWin::Rebuild(InsertionDelegate* delegate) {
|
| ResetNativeMenu();
|
| items_.clear();
|
|
|
| @@ -495,7 +498,7 @@
|
| SetMenuItemLabel(menu_index, model_index,
|
| model_->GetLabelAt(model_index));
|
| }
|
| - NativeMenuWin* submenu = (*it)->submenu.get();
|
| + Menu2* submenu = (*it)->submenu.get();
|
| if (submenu)
|
| submenu->UpdateStates();
|
| }
|
| @@ -626,8 +629,7 @@
|
| item_data->label = string16();
|
| ui::MenuModel::ItemType type = model_->GetTypeAt(model_index);
|
| if (type == ui::MenuModel::TYPE_SUBMENU) {
|
| - item_data->submenu.reset(
|
| - new NativeMenuWin(model_->GetSubmenuModelAt(model_index), NULL));
|
| + item_data->submenu.reset(new Menu2(model_->GetSubmenuModelAt(model_index)));
|
| mii.fMask |= MIIM_SUBMENU;
|
| mii.hSubMenu = item_data->submenu->GetNativeMenu();
|
| GetNativeMenuWinFromHMENU(mii.hSubMenu)->parent_ = this;
|
| @@ -715,9 +717,9 @@
|
|
|
| UINT NativeMenuWin::GetAlignmentFlags(int alignment) const {
|
| UINT alignment_flags = TPM_TOPALIGN;
|
| - if (alignment == ALIGN_TOPLEFT)
|
| + if (alignment == Menu2::ALIGN_TOPLEFT)
|
| alignment_flags |= TPM_LEFTALIGN;
|
| - else if (alignment == ALIGN_TOPRIGHT)
|
| + else if (alignment == Menu2::ALIGN_TOPRIGHT)
|
| alignment_flags |= TPM_RIGHTALIGN;
|
| return alignment_flags;
|
| }
|
| @@ -751,4 +753,12 @@
|
| host_window_.reset(new MenuHostWindow(this));
|
| }
|
|
|
| +////////////////////////////////////////////////////////////////////////////////
|
| +// MenuWrapper, public:
|
| +
|
| +// static
|
| +MenuWrapper* MenuWrapper::CreateWrapper(ui::MenuModel* model) {
|
| + return new NativeMenuWin(model, NULL);
|
| +}
|
| +
|
| } // namespace views
|
|
|