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

Side by Side Diff: ui/views/examples/table_example.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) 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/examples/table_example.h" 5 #include "ui/views/examples/table_example.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "third_party/skia/include/core/SkBitmap.h"
11 #include "third_party/skia/include/core/SkCanvas.h" 12 #include "third_party/skia/include/core/SkCanvas.h"
13 #include "ui/gfx/image/image_skia.h"
12 #include "ui/views/controls/button/checkbox.h" 14 #include "ui/views/controls/button/checkbox.h"
13 #include "ui/views/layout/grid_layout.h" 15 #include "ui/views/layout/grid_layout.h"
14 16
15 namespace views { 17 namespace views {
16 namespace examples { 18 namespace examples {
17 19
18 TableExample::TableExample() : ExampleBase("Table") , table_(NULL) { 20 TableExample::TableExample() : ExampleBase("Table") , table_(NULL) {
19 } 21 }
20 22
21 TableExample::~TableExample() { 23 TableExample::~TableExample() {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 const char* const cells[5][4] = { 106 const char* const cells[5][4] = {
105 { "Orange", "Orange", "South america", "$5" }, 107 { "Orange", "Orange", "South america", "$5" },
106 { "Apple", "Green", "Canada", "$3" }, 108 { "Apple", "Green", "Canada", "$3" },
107 { "Blue berries", "Blue", "Mexico", "$10.3" }, 109 { "Blue berries", "Blue", "Mexico", "$10.3" },
108 { "Strawberries", "Red", "California", "$7" }, 110 { "Strawberries", "Red", "California", "$7" },
109 { "Cantaloupe", "Orange", "South america", "$5" }, 111 { "Cantaloupe", "Orange", "South america", "$5" },
110 }; 112 };
111 return ASCIIToUTF16(cells[row % 5][column_id]); 113 return ASCIIToUTF16(cells[row % 5][column_id]);
112 } 114 }
113 115
114 SkBitmap TableExample::GetIcon(int row) { 116 gfx::ImageSkia TableExample::GetIcon(int row) {
115 return row % 2 ? icon1_ : icon2_; 117 return row % 2 ? icon1_ : icon2_;
116 } 118 }
117 119
118 void TableExample::SetObserver(ui::TableModelObserver* observer) {} 120 void TableExample::SetObserver(ui::TableModelObserver* observer) {}
119 121
120 void TableExample::OnSelectionChanged() { 122 void TableExample::OnSelectionChanged() {
121 PrintStatus("Selected: %s", 123 PrintStatus("Selected: %s",
122 UTF16ToASCII(GetText(table_->FirstSelectedRow(), 0)).c_str()); 124 UTF16ToASCII(GetText(table_->FirstSelectedRow(), 0)).c_str());
123 } 125 }
124 126
(...skipping 26 matching lines...) Expand all
151 } else if (sender == column4_visible_checkbox_) { 153 } else if (sender == column4_visible_checkbox_) {
152 index = 3; 154 index = 3;
153 show = column4_visible_checkbox_->checked(); 155 show = column4_visible_checkbox_->checked();
154 } 156 }
155 table_->SetColumnVisibility(index, show); 157 table_->SetColumnVisibility(index, show);
156 #endif 158 #endif
157 } 159 }
158 160
159 } // namespace examples 161 } // namespace examples
160 } // namespace views 162 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698