OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "ui/views/controls/menu/native_menu_win.h" | 5 #include "ui/views/controls/menu/native_menu_win.h" |
6 | 6 |
7 #include <Windowsx.h> | 7 #include <Windowsx.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 if (!owner_draw_) | 620 if (!owner_draw_) |
621 mii.fType = MFT_STRING; | 621 mii.fType = MFT_STRING; |
622 else | 622 else |
623 mii.fType = MFT_OWNERDRAW; | 623 mii.fType = MFT_OWNERDRAW; |
624 | 624 |
625 ItemData* item_data = new ItemData; | 625 ItemData* item_data = new ItemData; |
626 item_data->label = string16(); | 626 item_data->label = string16(); |
627 ui::MenuModel::ItemType type = model_->GetTypeAt(model_index); | 627 ui::MenuModel::ItemType type = model_->GetTypeAt(model_index); |
628 if (type == ui::MenuModel::TYPE_SUBMENU) { | 628 if (type == ui::MenuModel::TYPE_SUBMENU) { |
629 item_data->submenu.reset( | 629 item_data->submenu.reset( |
630 new NativeMenuWin(model_->GetSubmenuModelAt(model_index), | 630 new NativeMenuWin(model_->GetSubmenuModelAt(model_index), NULL)); |
631 system_menu_for_)); | |
632 mii.fMask |= MIIM_SUBMENU; | 631 mii.fMask |= MIIM_SUBMENU; |
633 mii.hSubMenu = item_data->submenu->GetNativeMenu(); | 632 mii.hSubMenu = item_data->submenu->GetNativeMenu(); |
634 GetNativeMenuWinFromHMENU(mii.hSubMenu)->parent_ = this; | 633 GetNativeMenuWinFromHMENU(mii.hSubMenu)->parent_ = this; |
635 } else { | 634 } else { |
636 if (type == ui::MenuModel::TYPE_RADIO) | 635 if (type == ui::MenuModel::TYPE_RADIO) |
637 mii.fType |= MFT_RADIOCHECK; | 636 mii.fType |= MFT_RADIOCHECK; |
638 mii.wID = model_->GetCommandIdAt(model_index); | 637 mii.wID = model_->GetCommandIdAt(model_index); |
639 } | 638 } |
640 item_data->native_menu_win = this; | 639 item_data->native_menu_win = this; |
641 item_data->model_index = model_index; | 640 item_data->model_index = model_index; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 | 745 |
747 void NativeMenuWin::CreateHostWindow() { | 746 void NativeMenuWin::CreateHostWindow() { |
748 // This only gets called from RunMenuAt, and as such there is only ever one | 747 // This only gets called from RunMenuAt, and as such there is only ever one |
749 // host window per menu hierarchy, no matter how many NativeMenuWin objects | 748 // host window per menu hierarchy, no matter how many NativeMenuWin objects |
750 // exist wrapping submenus. | 749 // exist wrapping submenus. |
751 if (!host_window_.get()) | 750 if (!host_window_.get()) |
752 host_window_.reset(new MenuHostWindow(this)); | 751 host_window_.reset(new MenuHostWindow(this)); |
753 } | 752 } |
754 | 753 |
755 } // namespace views | 754 } // namespace views |
OLD | NEW |