Refactor: Makes menus use gfx::FontList instead of gfx::Font.
[chromium-blink-merge.git] / ui / base / models / menu_model.cc
blob1b5f6ab0bca072ca7da1cefbbd4b87b9db8d4d2d
1 // Copyright (c) 2011 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/base/models/menu_model.h"
7 namespace ui {
9 bool MenuModel::IsVisibleAt(int index) const {
10 return true;
13 // static
14 bool MenuModel::GetModelAndIndexForCommandId(int command_id,
15 MenuModel** model,
16 int* index) {
17 const int item_count = (*model)->GetItemCount();
18 for (int i = 0; i < item_count; ++i) {
19 const int candidate_index = i;
20 if ((*model)->GetTypeAt(candidate_index) == TYPE_SUBMENU) {
21 MenuModel* submenu_model = (*model)->GetSubmenuModelAt(candidate_index);
22 if (GetModelAndIndexForCommandId(command_id, &submenu_model, index)) {
23 *model = submenu_model;
24 return true;
27 if ((*model)->GetCommandIdAt(candidate_index) == command_id) {
28 *index = candidate_index;
29 return true;
32 return false;
35 base::string16 MenuModel::GetSublabelAt(int index) const {
36 return base::string16();
39 base::string16 MenuModel::GetMinorTextAt(int index) const {
40 return base::string16();
43 const gfx::FontList* MenuModel::GetLabelFontListAt(int index) const {
44 return NULL;
47 // Default implementation ignores the event flags.
48 void MenuModel::ActivatedAt(int index, int event_flags) {
49 ActivatedAt(index);
52 } // namespace ui