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

Side by Side Diff: views/examples/table2_example.cc

Issue 7790009: views: Fix a couple of other trivial TODOs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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
« no previous file with comments | « views/controls/table/table_view_unittest.cc ('k') | views/examples/table_example.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "views/examples/table2_example.h" 5 #include "views/examples/table2_example.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "third_party/skia/include/core/SkCanvas.h" 8 #include "third_party/skia/include/core/SkCanvas.h"
9 #include "views/controls/button/checkbox.h" 9 #include "views/controls/button/checkbox.h"
10 #include "views/controls/table/table_view2.h" 10 #include "views/controls/table/table_view2.h"
(...skipping 22 matching lines...) Expand all
33 column3_visible_checkbox_ = new views::Checkbox(L"Origin column visible"); 33 column3_visible_checkbox_ = new views::Checkbox(L"Origin column visible");
34 column3_visible_checkbox_->SetChecked(true); 34 column3_visible_checkbox_->SetChecked(true);
35 column3_visible_checkbox_->set_listener(this); 35 column3_visible_checkbox_->set_listener(this);
36 column4_visible_checkbox_ = new views::Checkbox(L"Price column visible"); 36 column4_visible_checkbox_ = new views::Checkbox(L"Price column visible");
37 column4_visible_checkbox_->SetChecked(true); 37 column4_visible_checkbox_->SetChecked(true);
38 column4_visible_checkbox_->set_listener(this); 38 column4_visible_checkbox_->set_listener(this);
39 39
40 views::GridLayout* layout = new views::GridLayout(container); 40 views::GridLayout* layout = new views::GridLayout(container);
41 container->SetLayoutManager(layout); 41 container->SetLayoutManager(layout);
42 42
43 std::vector<TableColumn> columns; 43 std::vector<ui::TableColumn> columns;
44 columns.push_back( 44 columns.push_back(
45 TableColumn(0, ASCIIToUTF16("Fruit"), TableColumn::LEFT, 100)); 45 ui::TableColumn(0, ASCIIToUTF16("Fruit"), ui::TableColumn::LEFT, 100));
46 columns.push_back( 46 columns.push_back(
47 TableColumn(1, ASCIIToUTF16("Color"), TableColumn::LEFT, 100)); 47 ui::TableColumn(1, ASCIIToUTF16("Color"), ui::TableColumn::LEFT, 100));
48 columns.push_back( 48 columns.push_back(
49 TableColumn(2, ASCIIToUTF16("Origin"), TableColumn::LEFT, 100)); 49 ui::TableColumn(2, ASCIIToUTF16("Origin"), ui::TableColumn::LEFT, 100));
50 columns.push_back( 50 columns.push_back(
51 TableColumn(3, ASCIIToUTF16("Price"), TableColumn::LEFT, 100)); 51 ui::TableColumn(3, ASCIIToUTF16("Price"), ui::TableColumn::LEFT, 100));
52 const int options = (views::TableView2::SINGLE_SELECTION | 52 const int options = (views::TableView2::SINGLE_SELECTION |
53 views::TableView2::RESIZABLE_COLUMNS | 53 views::TableView2::RESIZABLE_COLUMNS |
54 views::TableView2::AUTOSIZE_COLUMNS | 54 views::TableView2::AUTOSIZE_COLUMNS |
55 views::TableView2::HORIZONTAL_LINES | 55 views::TableView2::HORIZONTAL_LINES |
56 views::TableView2::VERTICAL_LINES); 56 views::TableView2::VERTICAL_LINES);
57 table_ = new views::TableView2(this, columns, views::ICON_AND_TEXT, options); 57 table_ = new views::TableView2(this, columns, views::ICON_AND_TEXT, options);
58 table_->SetObserver(this); 58 table_->SetObserver(this);
59 icon1_.setConfig(SkBitmap::kARGB_8888_Config, 16, 16); 59 icon1_.setConfig(SkBitmap::kARGB_8888_Config, 16, 16);
60 icon1_.allocPixels(); 60 icon1_.allocPixels();
61 SkCanvas canvas1(icon1_); 61 SkCanvas canvas1(icon1_);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 { "Strawberries", "Red", "California", "$7" }, 102 { "Strawberries", "Red", "California", "$7" },
103 { "Cantaloupe", "Orange", "South america", "$5" } 103 { "Cantaloupe", "Orange", "South america", "$5" }
104 }; 104 };
105 return ASCIIToUTF16(cells[row % 5][column_id]); 105 return ASCIIToUTF16(cells[row % 5][column_id]);
106 } 106 }
107 107
108 SkBitmap Table2Example::GetIcon(int row) { 108 SkBitmap Table2Example::GetIcon(int row) {
109 return row % 2 ? icon1_ : icon2_; 109 return row % 2 ? icon1_ : icon2_;
110 } 110 }
111 111
112 void Table2Example::SetObserver(TableModelObserver* observer) { 112 void Table2Example::SetObserver(ui::TableModelObserver* observer) {
113 } 113 }
114 114
115 void Table2Example::ButtonPressed(views::Button* sender, 115 void Table2Example::ButtonPressed(views::Button* sender,
116 const views::Event& event) { 116 const views::Event& event) {
117 int index = 0; 117 int index = 0;
118 bool show = true; 118 bool show = true;
119 if (sender == column1_visible_checkbox_) { 119 if (sender == column1_visible_checkbox_) {
120 index = 0; 120 index = 0;
121 show = column1_visible_checkbox_->checked(); 121 show = column1_visible_checkbox_->checked();
122 } else if (sender == column2_visible_checkbox_) { 122 } else if (sender == column2_visible_checkbox_) {
(...skipping 22 matching lines...) Expand all
145 void Table2Example::OnKeyDown(ui::KeyboardCode virtual_keycode) { 145 void Table2Example::OnKeyDown(ui::KeyboardCode virtual_keycode) {
146 } 146 }
147 147
148 void Table2Example::OnTableViewDelete(views::TableView* table_view) { 148 void Table2Example::OnTableViewDelete(views::TableView* table_view) {
149 } 149 }
150 150
151 void Table2Example::OnTableView2Delete(views::TableView2* table_view) { 151 void Table2Example::OnTableView2Delete(views::TableView2* table_view) {
152 } 152 }
153 153
154 } // namespace examples 154 } // namespace examples
OLDNEW
« no previous file with comments | « views/controls/table/table_view_unittest.cc ('k') | views/examples/table_example.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698