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

Side by Side Diff: ui/views/controls/table/table_header.cc

Issue 863223002: Add missing views class names (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: table Created 5 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 unified diff | Download patch
« no previous file with comments | « ui/views/controls/table/table_header.h ('k') | ui/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) 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/controls/table/table_header.h" 5 #include "ui/views/controls/table/table_header.h"
6 6
7 #include "third_party/skia/include/core/SkColor.h" 7 #include "third_party/skia/include/core/SkColor.h"
8 #include "ui/base/cursor/cursor.h" 8 #include "ui/base/cursor/cursor.h"
9 #include "ui/gfx/canvas.h" 9 #include "ui/gfx/canvas.h"
10 #include "ui/gfx/text_utils.h" 10 #include "ui/gfx/text_utils.h"
(...skipping 22 matching lines...) Expand all
33 const SkColor kBackgroundColor1 = SkColorSetRGB(0xF9, 0xF9, 0xF9); 33 const SkColor kBackgroundColor1 = SkColorSetRGB(0xF9, 0xF9, 0xF9);
34 const SkColor kBackgroundColor2 = SkColorSetRGB(0xE8, 0xE8, 0xE8); 34 const SkColor kBackgroundColor2 = SkColorSetRGB(0xE8, 0xE8, 0xE8);
35 const SkColor kSeparatorColor = SkColorSetRGB(0xAA, 0xAA, 0xAA); 35 const SkColor kSeparatorColor = SkColorSetRGB(0xAA, 0xAA, 0xAA);
36 36
37 // Size of the sort indicator (doesn't include padding). 37 // Size of the sort indicator (doesn't include padding).
38 const int kSortIndicatorSize = 8; 38 const int kSortIndicatorSize = 8;
39 39
40 } // namespace 40 } // namespace
41 41
42 // static 42 // static
43 const char TableHeader::kViewClassName[] = "TableHeader";
44 // static
43 const int TableHeader::kHorizontalPadding = 7; 45 const int TableHeader::kHorizontalPadding = 7;
44 // static 46 // static
45 const int TableHeader::kSortIndicatorWidth = kSortIndicatorSize + 47 const int TableHeader::kSortIndicatorWidth = kSortIndicatorSize +
46 TableHeader::kHorizontalPadding * 2; 48 TableHeader::kHorizontalPadding * 2;
47 49
48 typedef std::vector<TableView::VisibleColumn> Columns; 50 typedef std::vector<TableView::VisibleColumn> Columns;
49 51
50 TableHeader::TableHeader(TableView* table) : table_(table) { 52 TableHeader::TableHeader(TableView* table) : table_(table) {
51 set_background(Background::CreateVerticalGradientBackground( 53 set_background(Background::CreateVerticalGradientBackground(
52 kBackgroundColor1, kBackgroundColor2)); 54 kBackgroundColor1, kBackgroundColor2));
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 indicator_path.lineTo( 154 indicator_path.lineTo(
153 SkIntToScalar(indicator_x + kSortIndicatorSize / 2 * scale), 155 SkIntToScalar(indicator_x + kSortIndicatorSize / 2 * scale),
154 SkIntToScalar(indicator_y + kSortIndicatorSize)); 156 SkIntToScalar(indicator_y + kSortIndicatorSize));
155 } 157 }
156 indicator_path.close(); 158 indicator_path.close();
157 canvas->DrawPath(indicator_path, paint); 159 canvas->DrawPath(indicator_path, paint);
158 } 160 }
159 } 161 }
160 } 162 }
161 163
164 const char* TableHeader::GetClassName() const {
165 return kViewClassName;
166 }
167
162 gfx::Size TableHeader::GetPreferredSize() const { 168 gfx::Size TableHeader::GetPreferredSize() const {
163 return gfx::Size(1, kVerticalPadding * 2 + font_list_.GetHeight()); 169 return gfx::Size(1, kVerticalPadding * 2 + font_list_.GetHeight());
164 } 170 }
165 171
166 gfx::NativeCursor TableHeader::GetCursor(const ui::MouseEvent& event) { 172 gfx::NativeCursor TableHeader::GetCursor(const ui::MouseEvent& event) {
167 return GetResizeColumn(GetMirroredXInView(event.x())) != -1 ? 173 return GetResizeColumn(GetMirroredXInView(event.x())) != -1 ?
168 GetNativeColumnResizeCursor() : View::GetCursor(event); 174 GetNativeColumnResizeCursor() : View::GetCursor(event);
169 } 175 }
170 176
171 bool TableHeader::OnMousePressed(const ui::MouseEvent& event) { 177 bool TableHeader::OnMousePressed(const ui::MouseEvent& event) {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 if (index > 0 && x >= column.x - kResizePadding && 275 if (index > 0 && x >= column.x - kResizePadding &&
270 x <= column.x + kResizePadding) { 276 x <= column.x + kResizePadding) {
271 return index - 1; 277 return index - 1;
272 } 278 }
273 const int max_x = column.x + column.width; 279 const int max_x = column.x + column.width;
274 return (x >= max_x - kResizePadding && x <= max_x + kResizePadding) ? 280 return (x >= max_x - kResizePadding && x <= max_x + kResizePadding) ?
275 index : -1; 281 index : -1;
276 } 282 }
277 283
278 } // namespace views 284 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/table/table_header.h ('k') | ui/views/controls/table/table_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698