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

Side by Side Diff: views/controls/table/group_table_view.cc

Issue 115309: Remove even more ATL dependencies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 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
« no previous file with comments | « views/controls/table/group_table_view.h ('k') | views/controls/table/table_view.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/group_table_view.h" 5 #include "views/controls/table/group_table_view.h"
6 6
7 #include "app/gfx/chrome_canvas.h" 7 #include "app/gfx/chrome_canvas.h"
8 #include "base/compiler_specific.h"
8 #include "base/message_loop.h" 9 #include "base/message_loop.h"
9 #include "base/task.h" 10 #include "base/task.h"
10 11
11 namespace views { 12 namespace views {
12 13
13 static const COLORREF kSeparatorLineColor = RGB(208, 208, 208); 14 static const COLORREF kSeparatorLineColor = RGB(208, 208, 208);
14 static const int kSeparatorLineThickness = 1; 15 static const int kSeparatorLineThickness = 1;
15 16
16 const char GroupTableView::kViewClassName[] = "views/GroupTableView"; 17 const char GroupTableView::kViewClassName[] = "views/GroupTableView";
17 18
18 GroupTableView::GroupTableView(GroupTableModel* model, 19 GroupTableView::GroupTableView(GroupTableModel* model,
19 const std::vector<TableColumn>& columns, 20 const std::vector<TableColumn>& columns,
20 TableTypes table_type, 21 TableTypes table_type,
21 bool single_selection, 22 bool single_selection,
22 bool resizable_columns, 23 bool resizable_columns,
23 bool autosize_columns) 24 bool autosize_columns)
24 : TableView(model, columns, table_type, false, resizable_columns, 25 : TableView(model, columns, table_type, false, resizable_columns,
25 autosize_columns), 26 autosize_columns),
26 model_(model), 27 model_(model),
27 sync_selection_factory_(this) { 28 ALLOW_THIS_IN_INITIALIZER_LIST(sync_selection_factory_(this)) {
28 } 29 }
29 30
30 GroupTableView::~GroupTableView() { 31 GroupTableView::~GroupTableView() {
31 } 32 }
32 33
33 void GroupTableView::SyncSelection() { 34 void GroupTableView::SyncSelection() {
34 int index = 0; 35 int index = 0;
35 int row_count = model_->RowCount(); 36 int row_count = model_->RowCount();
36 GroupRange group_range; 37 GroupRange group_range;
37 while (index < row_count) { 38 while (index < row_count) {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 if (sync_selection_factory_.empty()) { 159 if (sync_selection_factory_.empty()) {
159 MessageLoop::current()->PostTask(FROM_HERE, 160 MessageLoop::current()->PostTask(FROM_HERE,
160 sync_selection_factory_.NewRunnableMethod( 161 sync_selection_factory_.NewRunnableMethod(
161 &GroupTableView::SyncSelection)); 162 &GroupTableView::SyncSelection));
162 } 163 }
163 TableView::OnSelectedStateChanged(); 164 TableView::OnSelectedStateChanged();
164 } 165 }
165 166
166 // Draws the line separator betweens the groups. 167 // Draws the line separator betweens the groups.
167 void GroupTableView::PostPaint(int model_row, int column, bool selected, 168 void GroupTableView::PostPaint(int model_row, int column, bool selected,
168 const CRect& bounds, HDC hdc) { 169 const gfx::Rect& bounds, HDC hdc) {
169 GroupRange group_range; 170 GroupRange group_range;
170 model_->GetGroupRangeForItem(model_row, &group_range); 171 model_->GetGroupRangeForItem(model_row, &group_range);
171 172
172 // We always paint a vertical line at the end of the last cell. 173 // We always paint a vertical line at the end of the last cell.
173 HPEN hPen = CreatePen(PS_SOLID, kSeparatorLineThickness, kSeparatorLineColor); 174 HPEN hPen = CreatePen(PS_SOLID, kSeparatorLineThickness, kSeparatorLineColor);
174 HPEN hPenOld = (HPEN) SelectObject(hdc, hPen); 175 HPEN hPenOld = (HPEN) SelectObject(hdc, hPen);
175 int x = static_cast<int>(bounds.right - kSeparatorLineThickness); 176 int x = static_cast<int>(bounds.right() - kSeparatorLineThickness);
176 MoveToEx(hdc, x, bounds.top, NULL); 177 MoveToEx(hdc, x, bounds.y(), NULL);
177 LineTo(hdc, x, bounds.bottom); 178 LineTo(hdc, x, bounds.bottom());
178 179
179 // We paint a separator line after the last item of a group. 180 // We paint a separator line after the last item of a group.
180 if (model_row == (group_range.start + group_range.length - 1)) { 181 if (model_row == (group_range.start + group_range.length - 1)) {
181 int y = static_cast<int>(bounds.bottom - kSeparatorLineThickness); 182 int y = static_cast<int>(bounds.bottom() - kSeparatorLineThickness);
182 MoveToEx(hdc, 0, y, NULL); 183 MoveToEx(hdc, 0, y, NULL);
183 LineTo(hdc, bounds.Width(), y); 184 LineTo(hdc, bounds.width(), y);
184 } 185 }
185 SelectObject(hdc, hPenOld); 186 SelectObject(hdc, hPenOld);
186 DeleteObject(hPen); 187 DeleteObject(hPen);
187 } 188 }
188 189
189 std::string GroupTableView::GetClassName() const { 190 std::string GroupTableView::GetClassName() const {
190 return kViewClassName; 191 return kViewClassName;
191 } 192 }
192 193
193 } // namespace views 194 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/table/group_table_view.h ('k') | views/controls/table/table_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698