summaryrefslogtreecommitdiffstats
path: root/ui/base
diff options
context:
space:
mode:
Diffstat (limited to 'ui/base')
-rw-r--r--ui/base/models/menu_model.h5
-rw-r--r--ui/base/models/simple_menu_model.cc40
-rw-r--r--ui/base/models/simple_menu_model.h11
-rw-r--r--ui/base/models/table_model.cc8
-rw-r--r--ui/base/models/table_model.h12
-rw-r--r--ui/base/models/tree_model.h8
6 files changed, 50 insertions, 34 deletions
diff --git a/ui/base/models/menu_model.h b/ui/base/models/menu_model.h
index 7ca33bd..f7acb16 100644
--- a/ui/base/models/menu_model.h
+++ b/ui/base/models/menu_model.h
@@ -9,12 +9,13 @@
#include "base/string16.h"
#include "ui/base/models/menu_model_delegate.h"
#include "ui/base/ui_export.h"
+#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/native_widget_types.h"
-class SkBitmap;
namespace gfx {
class Font;
+class ImageSkia;
}
namespace ui {
@@ -87,7 +88,7 @@ class UI_EXPORT MenuModel {
// Gets the icon for the item at the specified index, returning true if there
// is an icon, false otherwise.
- virtual bool GetIconAt(int index, SkBitmap* icon) = 0;
+ virtual bool GetIconAt(int index, gfx::ImageSkia* icon) = 0;
// Returns the model for a menu item with a line of buttons at |index|.
virtual ButtonMenuItemModel* GetButtonMenuItemAt(int index) const = 0;
diff --git a/ui/base/models/simple_menu_model.cc b/ui/base/models/simple_menu_model.cc
index be84356..3a38b0d 100644
--- a/ui/base/models/simple_menu_model.cc
+++ b/ui/base/models/simple_menu_model.cc
@@ -6,8 +6,8 @@
#include "base/bind.h"
#include "base/message_loop.h"
-#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/l10n/l10n_util.h"
+#include "ui/gfx/image/image_skia.h"
namespace ui {
@@ -16,7 +16,7 @@ const int kSeparatorId = -1;
struct SimpleMenuModel::Item {
int command_id;
string16 label;
- SkBitmap icon;
+ gfx::ImageSkia icon;
ItemType type;
int group_id;
MenuModel* submenu;
@@ -40,7 +40,7 @@ string16 SimpleMenuModel::Delegate::GetLabelForCommandId(int command_id) const {
}
bool SimpleMenuModel::Delegate::GetIconForCommandId(
- int command_id, SkBitmap* bitmap) const {
+ int command_id, gfx::ImageSkia* image_skia) const {
return false;
}
@@ -71,7 +71,8 @@ SimpleMenuModel::~SimpleMenuModel() {
}
void SimpleMenuModel::AddItem(int command_id, const string16& label) {
- Item item = { command_id, label, SkBitmap(), TYPE_COMMAND, -1, NULL, NULL };
+ Item item = { command_id, label, gfx::ImageSkia(), TYPE_COMMAND, -1, NULL,
+ NULL };
AppendItem(item);
}
@@ -80,13 +81,14 @@ void SimpleMenuModel::AddItemWithStringId(int command_id, int string_id) {
}
void SimpleMenuModel::AddSeparator() {
- Item item = { kSeparatorId, string16(), SkBitmap(), TYPE_SEPARATOR, -1,
+ Item item = { kSeparatorId, string16(), gfx::ImageSkia(), TYPE_SEPARATOR, -1,
NULL, NULL };
AppendItem(item);
}
void SimpleMenuModel::AddCheckItem(int command_id, const string16& label) {
- Item item = { command_id, label, SkBitmap(), TYPE_CHECK, -1, NULL, NULL };
+ Item item = { command_id, label, gfx::ImageSkia(), TYPE_CHECK, -1, NULL,
+ NULL };
AppendItem(item);
}
@@ -96,7 +98,7 @@ void SimpleMenuModel::AddCheckItemWithStringId(int command_id, int string_id) {
void SimpleMenuModel::AddRadioItem(int command_id, const string16& label,
int group_id) {
- Item item = { command_id, label, SkBitmap(), TYPE_RADIO, group_id, NULL,
+ Item item = { command_id, label, gfx::ImageSkia(), TYPE_RADIO, group_id, NULL,
NULL };
AppendItem(item);
}
@@ -108,14 +110,15 @@ void SimpleMenuModel::AddRadioItemWithStringId(int command_id, int string_id,
void SimpleMenuModel::AddButtonItem(int command_id,
ButtonMenuItemModel* model) {
- Item item = { command_id, string16(), SkBitmap(), TYPE_BUTTON_ITEM, -1, NULL,
- model };
+ Item item = { command_id, string16(), gfx::ImageSkia(), TYPE_BUTTON_ITEM, -1,
+ NULL, model };
AppendItem(item);
}
void SimpleMenuModel::AddSubMenu(int command_id, const string16& label,
MenuModel* model) {
- Item item = { command_id, label, SkBitmap(), TYPE_SUBMENU, -1, model, NULL };
+ Item item = { command_id, label, gfx::ImageSkia(), TYPE_SUBMENU, -1, model,
+ NULL };
AppendItem(item);
}
@@ -126,7 +129,8 @@ void SimpleMenuModel::AddSubMenuWithStringId(int command_id,
void SimpleMenuModel::InsertItemAt(
int index, int command_id, const string16& label) {
- Item item = { command_id, label, SkBitmap(), TYPE_COMMAND, -1, NULL, NULL };
+ Item item = { command_id, label, gfx::ImageSkia(), TYPE_COMMAND, -1, NULL,
+ NULL };
InsertItemAtIndex(item, index);
}
@@ -136,14 +140,15 @@ void SimpleMenuModel::InsertItemWithStringIdAt(
}
void SimpleMenuModel::InsertSeparatorAt(int index) {
- Item item = { kSeparatorId, string16(), SkBitmap(), TYPE_SEPARATOR, -1,
+ Item item = { kSeparatorId, string16(), gfx::ImageSkia(), TYPE_SEPARATOR, -1,
NULL, NULL };
InsertItemAtIndex(item, index);
}
void SimpleMenuModel::InsertCheckItemAt(
int index, int command_id, const string16& label) {
- Item item = { command_id, label, SkBitmap(), TYPE_CHECK, -1, NULL, NULL };
+ Item item = { command_id, label, gfx::ImageSkia(), TYPE_CHECK, -1, NULL,
+ NULL };
InsertItemAtIndex(item, index);
}
@@ -155,7 +160,7 @@ void SimpleMenuModel::InsertCheckItemWithStringIdAt(
void SimpleMenuModel::InsertRadioItemAt(
int index, int command_id, const string16& label, int group_id) {
- Item item = { command_id, label, SkBitmap(), TYPE_RADIO, group_id, NULL,
+ Item item = { command_id, label, gfx::ImageSkia(), TYPE_RADIO, group_id, NULL,
NULL };
InsertItemAtIndex(item, index);
}
@@ -168,7 +173,8 @@ void SimpleMenuModel::InsertRadioItemWithStringIdAt(
void SimpleMenuModel::InsertSubMenuAt(
int index, int command_id, const string16& label, MenuModel* model) {
- Item item = { command_id, label, SkBitmap(), TYPE_SUBMENU, -1, model, NULL };
+ Item item = { command_id, label, gfx::ImageSkia(), TYPE_SUBMENU, -1, model,
+ NULL };
InsertItemAtIndex(item, index);
}
@@ -178,7 +184,7 @@ void SimpleMenuModel::InsertSubMenuWithStringIdAt(
model);
}
-void SimpleMenuModel::SetIcon(int index, const SkBitmap& icon) {
+void SimpleMenuModel::SetIcon(int index, const gfx::ImageSkia& icon) {
items_[index].icon = icon;
}
@@ -253,7 +259,7 @@ int SimpleMenuModel::GetGroupIdAt(int index) const {
return items_.at(FlipIndex(index)).group_id;
}
-bool SimpleMenuModel::GetIconAt(int index, SkBitmap* icon) {
+bool SimpleMenuModel::GetIconAt(int index, gfx::ImageSkia* icon) {
if (IsItemDynamicAt(index))
return delegate_->GetIconForCommandId(GetCommandIdAt(index), icon);
diff --git a/ui/base/models/simple_menu_model.h b/ui/base/models/simple_menu_model.h
index c8da021..217a0cf 100644
--- a/ui/base/models/simple_menu_model.h
+++ b/ui/base/models/simple_menu_model.h
@@ -12,6 +12,10 @@
#include "base/string16.h"
#include "ui/base/models/menu_model.h"
+namespace gfx {
+class ImageSkia;
+}
+
namespace ui {
class ButtonMenuItemModel;
@@ -40,7 +44,8 @@ class UI_EXPORT SimpleMenuModel : public MenuModel {
virtual string16 GetLabelForCommandId(int command_id) const;
// Gets the icon for the item with the specified id, returning true if there
// is an icon, false otherwise.
- virtual bool GetIconForCommandId(int command_id, SkBitmap* icon) const;
+ virtual bool GetIconForCommandId(int command_id,
+ gfx::ImageSkia* icon) const;
// Notifies the delegate that the item with the specified command id was
// visually highlighted within the menu.
@@ -98,7 +103,7 @@ class UI_EXPORT SimpleMenuModel : public MenuModel {
int index, int command_id, int string_id, MenuModel* model);
// Sets the icon for the item at |index|.
- void SetIcon(int index, const SkBitmap& icon);
+ void SetIcon(int index, const gfx::ImageSkia& icon);
// Clears all items. Note that it does not free MenuModel of submenu.
void Clear();
@@ -118,7 +123,7 @@ class UI_EXPORT SimpleMenuModel : public MenuModel {
ui::Accelerator* accelerator) const OVERRIDE;
virtual bool IsItemCheckedAt(int index) const OVERRIDE;
virtual int GetGroupIdAt(int index) const OVERRIDE;
- virtual bool GetIconAt(int index, SkBitmap* icon) OVERRIDE;
+ virtual bool GetIconAt(int index, gfx::ImageSkia* icon) OVERRIDE;
virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt(
int index) const OVERRIDE;
virtual bool IsEnabledAt(int index) const OVERRIDE;
diff --git a/ui/base/models/table_model.cc b/ui/base/models/table_model.cc
index 921ca89..c73466f 100644
--- a/ui/base/models/table_model.cc
+++ b/ui/base/models/table_model.cc
@@ -1,11 +1,11 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/base/models/table_model.h"
#include "base/logging.h"
-#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/gfx/image/image_skia.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/l10n/l10n_util_collator.h"
@@ -74,8 +74,8 @@ TableColumn::TableColumn(int id, Alignment alignment, int width, float percent)
// Used for sorting.
static icu::Collator* collator = NULL;
-SkBitmap TableModel::GetIcon(int row) {
- return SkBitmap();
+gfx::ImageSkia TableModel::GetIcon(int row) {
+ return gfx::ImageSkia();
}
string16 TableModel::GetTooltip(int row) {
diff --git a/ui/base/models/table_model.h b/ui/base/models/table_model.h
index a6dbbb3..0565cd8 100644
--- a/ui/base/models/table_model.h
+++ b/ui/base/models/table_model.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,7 +12,9 @@
#include "ui/base/ui_export.h"
#include "unicode/coll.h"
-class SkBitmap;
+namespace gfx {
+class ImageSkia;
+}
namespace ui {
@@ -39,9 +41,9 @@ class UI_EXPORT TableModel {
// Returns the small icon (16x16) that should be displayed in the first
// column before the text. This is only used when the TableView was created
- // with the ICON_AND_TEXT table type. Returns an isNull() bitmap if there is
- // no bitmap.
- virtual SkBitmap GetIcon(int row);
+ // with the ICON_AND_TEXT table type. Returns an isNull() image if there is
+ // no image.
+ virtual gfx::ImageSkia GetIcon(int row);
// Returns the tooltip, if any, to show for a particular row. If there are
// multiple columns in the row, this will only be shown when hovering over
diff --git a/ui/base/models/tree_model.h b/ui/base/models/tree_model.h
index 5dfa8f9..11ea193 100644
--- a/ui/base/models/tree_model.h
+++ b/ui/base/models/tree_model.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,7 +11,9 @@
#include "base/string16.h"
#include "ui/base/ui_export.h"
-class SkBitmap;
+namespace gfx {
+class ImageSkia;
+}
namespace ui {
@@ -84,7 +86,7 @@ class UI_EXPORT TreeModel {
// Returns the set of icons for the nodes in the tree. You only need override
// this if you don't want to use the default folder icons.
- virtual void GetIcons(std::vector<SkBitmap>* icons) {}
+ virtual void GetIcons(std::vector<gfx::ImageSkia>* icons) {}
// Returns the index of the icon to use for |node|. Return -1 to use the
// default icon. The index is relative to the list of icons returned from