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

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

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More compile fix for ToT Created 6 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 | « 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 indicator_path.lineTo( 152 indicator_path.lineTo(
153 SkIntToScalar(indicator_x + kSortIndicatorSize / 2 * scale), 153 SkIntToScalar(indicator_x + kSortIndicatorSize / 2 * scale),
154 SkIntToScalar(indicator_y + kSortIndicatorSize)); 154 SkIntToScalar(indicator_y + kSortIndicatorSize));
155 } 155 }
156 indicator_path.close(); 156 indicator_path.close();
157 canvas->DrawPath(indicator_path, paint); 157 canvas->DrawPath(indicator_path, paint);
158 } 158 }
159 } 159 }
160 } 160 }
161 161
162 gfx::Size TableHeader::GetPreferredSize() { 162 gfx::Size TableHeader::GetPreferredSize() const {
163 return gfx::Size(1, kVerticalPadding * 2 + font_list_.GetHeight()); 163 return gfx::Size(1, kVerticalPadding * 2 + font_list_.GetHeight());
164 } 164 }
165 165
166 gfx::NativeCursor TableHeader::GetCursor(const ui::MouseEvent& event) { 166 gfx::NativeCursor TableHeader::GetCursor(const ui::MouseEvent& event) {
167 return GetResizeColumn(GetMirroredXInView(event.x())) != -1 ? 167 return GetResizeColumn(GetMirroredXInView(event.x())) != -1 ?
168 GetNativeColumnResizeCursor() : View::GetCursor(event); 168 GetNativeColumnResizeCursor() : View::GetCursor(event);
169 } 169 }
170 170
171 bool TableHeader::OnMousePressed(const ui::MouseEvent& event) { 171 bool TableHeader::OnMousePressed(const ui::MouseEvent& event) {
172 if (event.IsOnlyLeftMouseButton()) { 172 if (event.IsOnlyLeftMouseButton()) {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 if (index > 0 && x >= column.x - kResizePadding && 269 if (index > 0 && x >= column.x - kResizePadding &&
270 x <= column.x + kResizePadding) { 270 x <= column.x + kResizePadding) {
271 return index - 1; 271 return index - 1;
272 } 272 }
273 const int max_x = column.x + column.width; 273 const int max_x = column.x + column.width;
274 return (x >= max_x - kResizePadding && x <= max_x + kResizePadding) ? 274 return (x >= max_x - kResizePadding && x <= max_x + kResizePadding) ?
275 index : -1; 275 index : -1;
276 } 276 }
277 277
278 } // namespace views 278 } // 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