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

Unified Diff: ui/views/examples/table_example.cc

Issue 11827007: Couple of tweaks for tables: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add #ifdef for SetGrouper in example Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/examples/table_example.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/examples/table_example.cc
diff --git a/ui/views/examples/table_example.cc b/ui/views/examples/table_example.cc
index bb553a1dc8c48d24cd538b34b4cf1ed04c00d6c4..18cd1b96149fcc69e89de902fbf96321ab3a40f1 100644
--- a/ui/views/examples/table_example.cc
+++ b/ui/views/examples/table_example.cc
@@ -12,6 +12,7 @@
#include "third_party/skia/include/core/SkCanvas.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/views/controls/button/checkbox.h"
+#include "ui/views/controls/table/group_table_model.h"
#include "ui/views/layout/grid_layout.h"
namespace views {
@@ -67,6 +68,10 @@ void TableExample::CreateExampleView(View* container) {
columns.push_back(TestTableColumn(3, "Price"));
columns.back().alignment = ui::TableColumn::RIGHT;
table_ = new TableView(this, columns, ICON_AND_TEXT, true, true, true);
+ // TODO(sky): remove ifdef once we get rid of win32 table.
+#if defined(USE_AURA)
+ table_->SetGrouper(this);
+#endif
table_->SetObserver(this);
icon1_.setConfig(SkBitmap::kARGB_8888_Config, 16, 16);
icon1_.allocPixels();
@@ -123,6 +128,19 @@ gfx::ImageSkia TableExample::GetIcon(int row) {
void TableExample::SetObserver(ui::TableModelObserver* observer) {}
+void TableExample::GetGroupRange(int model_index, GroupRange* range) {
+ if (model_index < 2) {
+ range->start = 0;
+ range->length = 2;
+ } else if (model_index > 6) {
+ range->start = 7;
+ range->length = 3;
+ } else {
+ range->start = model_index;
+ range->length = 1;
+ }
+}
+
void TableExample::OnSelectionChanged() {
PrintStatus("Selected: %s",
UTF16ToASCII(GetText(table_->FirstSelectedRow(), 0)).c_str());
« no previous file with comments | « ui/views/examples/table_example.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698