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

Side by Side Diff: app/table_model.cc

Issue 126184: Move TableModel out of views/ and into app/.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: addressed comments, build fixes Created 11 years, 6 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 | « app/table_model.h ('k') | app/table_model_observer.h » ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/controls/table/table_model.h" 5 #include "app/table_model.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "third_party/skia/include/core/SkBitmap.h"
8 9
9 namespace views { 10 // TableColumn -----------------------------------------------------------------
10 11
11 TableColumn::TableColumn() 12 TableColumn::TableColumn()
12 : id(0), 13 : id(0),
13 title(), 14 title(),
14 alignment(LEFT), 15 alignment(LEFT),
15 width(-1), 16 width(-1),
16 percent(), 17 percent(),
17 min_visible_width(0), 18 min_visible_width(0),
18 sortable(false) { 19 sortable(false) {
19 } 20 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 TableColumn::TableColumn(int id, Alignment alignment, int width, float percent) 58 TableColumn::TableColumn(int id, Alignment alignment, int width, float percent)
58 : id(id), 59 : id(id),
59 alignment(alignment), 60 alignment(alignment),
60 width(width), 61 width(width),
61 percent(percent), 62 percent(percent),
62 min_visible_width(0), 63 min_visible_width(0),
63 sortable(false) { 64 sortable(false) {
64 title = l10n_util::GetString(id); 65 title = l10n_util::GetString(id);
65 } 66 }
66 67
67 } // namespace views 68 // TableModel -----------------------------------------------------------------
68 69
70 // Used for sorting.
71 static Collator* collator = NULL;
72
73 SkBitmap TableModel::GetIcon(int row) {
74 return SkBitmap();
75 }
76
77 int TableModel::CompareValues(int row1, int row2, int column_id) {
78 DCHECK(row1 >= 0 && row1 < RowCount() &&
79 row2 >= 0 && row2 < RowCount());
80 std::wstring value1 = GetText(row1, column_id);
81 std::wstring value2 = GetText(row2, column_id);
82 Collator* collator = GetCollator();
83
84 if (collator)
85 return l10n_util::CompareStringWithCollator(collator, value1, value2);
86
87 NOTREACHED();
88 return 0;
89 }
90
91 Collator* TableModel::GetCollator() {
92 if (!collator) {
93 UErrorCode create_status = U_ZERO_ERROR;
94 collator = Collator::createInstance(create_status);
95 if (!U_SUCCESS(create_status)) {
96 collator = NULL;
97 NOTREACHED();
98 }
99 }
100 return collator;
101 }
102
103 void TableModel::ClearCollator() {
104 delete collator;
105 collator = NULL;
106 }
OLDNEW
« no previous file with comments | « app/table_model.h ('k') | app/table_model_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698