Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(518)

Side by Side Diff: ui/views/controls/menu/menu.cc

Issue 10437006: Converts ui/views/controls, ui/views/examples, ui/base/models to ImageSkia (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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/menu.h" 5 #include "ui/views/controls/menu/menu.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "third_party/skia/include/core/SkBitmap.h" 8 #include "ui/gfx/image/image_skia.h"
9 9
10 namespace views { 10 namespace views {
11 11
12 bool Menu::Delegate::IsRightToLeftUILayout() const { 12 bool Menu::Delegate::IsRightToLeftUILayout() const {
13 return base::i18n::IsRTL(); 13 return base::i18n::IsRTL();
14 } 14 }
15 15
16 const SkBitmap& Menu::Delegate::GetEmptyIcon() const { 16 const gfx::ImageSkia& Menu::Delegate::GetEmptyIcon() const {
17 static const SkBitmap* empty_icon = new SkBitmap(); 17 static const gfx::ImageSkia* empty_icon = new gfx::ImageSkia();
18 return *empty_icon; 18 return *empty_icon;
19 } 19 }
20 20
21 Menu::Menu(Delegate* delegate, AnchorPoint anchor) 21 Menu::Menu(Delegate* delegate, AnchorPoint anchor)
22 : delegate_(delegate), 22 : delegate_(delegate),
23 anchor_(anchor) { 23 anchor_(anchor) {
24 } 24 }
25 25
26 Menu::Menu(Menu* parent) 26 Menu::Menu(Menu* parent)
27 : delegate_(parent->delegate_), 27 : delegate_(parent->delegate_),
28 anchor_(parent->anchor_) { 28 anchor_(parent->anchor_) {
29 } 29 }
30 30
31 Menu::~Menu() { 31 Menu::~Menu() {
32 } 32 }
33 33
34 void Menu::AppendMenuItem(int item_id, 34 void Menu::AppendMenuItem(int item_id,
35 const string16& label, 35 const string16& label,
36 MenuItemType type) { 36 MenuItemType type) {
37 AddMenuItem(-1, item_id, label, type); 37 AddMenuItem(-1, item_id, label, type);
38 } 38 }
39 39
40 void Menu::AddMenuItem(int index, 40 void Menu::AddMenuItem(int index,
41 int item_id, 41 int item_id,
42 const string16& label, 42 const string16& label,
43 MenuItemType type) { 43 MenuItemType type) {
44 if (type == SEPARATOR) 44 if (type == SEPARATOR)
45 AddSeparator(index); 45 AddSeparator(index);
46 else 46 else
47 AddMenuItemInternal(index, item_id, label, SkBitmap(), type); 47 AddMenuItemInternal(index, item_id, label, gfx::ImageSkia(), type);
48 } 48 }
49 49
50 Menu* Menu::AppendSubMenu(int item_id, const string16& label) { 50 Menu* Menu::AppendSubMenu(int item_id, const string16& label) {
51 return AddSubMenu(-1, item_id, label); 51 return AddSubMenu(-1, item_id, label);
52 } 52 }
53 53
54 Menu* Menu::AddSubMenu(int index, int item_id, const string16& label) { 54 Menu* Menu::AddSubMenu(int index, int item_id, const string16& label) {
55 return AddSubMenuWithIcon(index, item_id, label, SkBitmap()); 55 return AddSubMenuWithIcon(index, item_id, label, gfx::ImageSkia());
56 } 56 }
57 57
58 Menu* Menu::AppendSubMenuWithIcon(int item_id, 58 Menu* Menu::AppendSubMenuWithIcon(int item_id,
59 const string16& label, 59 const string16& label,
60 const SkBitmap& icon) { 60 const gfx::ImageSkia& icon) {
61 return AddSubMenuWithIcon(-1, item_id, label, icon); 61 return AddSubMenuWithIcon(-1, item_id, label, icon);
62 } 62 }
63 63
64 void Menu::AppendMenuItemWithLabel(int item_id, const string16& label) { 64 void Menu::AppendMenuItemWithLabel(int item_id, const string16& label) {
65 AddMenuItemWithLabel(-1, item_id, label); 65 AddMenuItemWithLabel(-1, item_id, label);
66 } 66 }
67 67
68 void Menu::AddMenuItemWithLabel(int index, 68 void Menu::AddMenuItemWithLabel(int index,
69 int item_id, 69 int item_id,
70 const string16& label) { 70 const string16& label) {
71 AddMenuItem(index, item_id, label, Menu::NORMAL); 71 AddMenuItem(index, item_id, label, Menu::NORMAL);
72 } 72 }
73 73
74 void Menu::AppendDelegateMenuItem(int item_id) { 74 void Menu::AppendDelegateMenuItem(int item_id) {
75 AddDelegateMenuItem(-1, item_id); 75 AddDelegateMenuItem(-1, item_id);
76 } 76 }
77 77
78 void Menu::AddDelegateMenuItem(int index, int item_id) { 78 void Menu::AddDelegateMenuItem(int index, int item_id) {
79 AddMenuItem(index, item_id, string16(), Menu::NORMAL); 79 AddMenuItem(index, item_id, string16(), Menu::NORMAL);
80 } 80 }
81 81
82 void Menu::AppendSeparator() { 82 void Menu::AppendSeparator() {
83 AddSeparator(-1); 83 AddSeparator(-1);
84 } 84 }
85 85
86 void Menu::AppendMenuItemWithIcon(int item_id, 86 void Menu::AppendMenuItemWithIcon(int item_id,
87 const string16& label, 87 const string16& label,
88 const SkBitmap& icon) { 88 const gfx::ImageSkia& icon) {
89 AddMenuItemWithIcon(-1, item_id, label, icon); 89 AddMenuItemWithIcon(-1, item_id, label, icon);
90 } 90 }
91 91
92 void Menu::AddMenuItemWithIcon(int index, 92 void Menu::AddMenuItemWithIcon(int index,
93 int item_id, 93 int item_id,
94 const string16& label, 94 const string16& label,
95 const SkBitmap& icon) { 95 const gfx::ImageSkia& icon) {
96 AddMenuItemInternal(index, item_id, label, icon, Menu::NORMAL); 96 AddMenuItemInternal(index, item_id, label, icon, Menu::NORMAL);
97 } 97 }
98 98
99 Menu::Menu() : delegate_(NULL), anchor_(TOPLEFT) { 99 Menu::Menu() : delegate_(NULL), anchor_(TOPLEFT) {
100 } 100 }
101 101
102 } // namespace views 102 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698