OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |