| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "cc/paint/paint_flags.h" | 9 #include "cc/paint/paint_flags.h" |
| 10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 width -= kSortIndicatorWidth; | 98 width -= kSortIndicatorWidth; |
| 99 } | 99 } |
| 100 | 100 |
| 101 canvas->DrawStringRectWithFlags( | 101 canvas->DrawStringRectWithFlags( |
| 102 columns[i].column.title, font_list_, text_color, | 102 columns[i].column.title, font_list_, text_color, |
| 103 gfx::Rect(GetMirroredXWithWidthInView(x, width), kVerticalPadding, | 103 gfx::Rect(GetMirroredXWithWidthInView(x, width), kVerticalPadding, |
| 104 width, height() - kVerticalPadding * 2), | 104 width, height() - kVerticalPadding * 2), |
| 105 TableColumnAlignmentToCanvasAlignment(columns[i].column.alignment)); | 105 TableColumnAlignmentToCanvasAlignment(columns[i].column.alignment)); |
| 106 | 106 |
| 107 if (paint_sort_indicator) { | 107 if (paint_sort_indicator) { |
| 108 cc::PaintFlags paint; | 108 cc::PaintFlags flags; |
| 109 paint.setColor(text_color); | 109 flags.setColor(text_color); |
| 110 paint.setStyle(cc::PaintFlags::kFill_Style); | 110 flags.setStyle(cc::PaintFlags::kFill_Style); |
| 111 paint.setAntiAlias(true); | 111 flags.setAntiAlias(true); |
| 112 | 112 |
| 113 int indicator_x = 0; | 113 int indicator_x = 0; |
| 114 ui::TableColumn::Alignment alignment = columns[i].column.alignment; | 114 ui::TableColumn::Alignment alignment = columns[i].column.alignment; |
| 115 if (base::i18n::IsRTL()) { | 115 if (base::i18n::IsRTL()) { |
| 116 if (alignment == ui::TableColumn::LEFT) | 116 if (alignment == ui::TableColumn::LEFT) |
| 117 alignment = ui::TableColumn::RIGHT; | 117 alignment = ui::TableColumn::RIGHT; |
| 118 else if (alignment == ui::TableColumn::RIGHT) | 118 else if (alignment == ui::TableColumn::RIGHT) |
| 119 alignment = ui::TableColumn::LEFT; | 119 alignment = ui::TableColumn::LEFT; |
| 120 } | 120 } |
| 121 switch (alignment) { | 121 switch (alignment) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 149 indicator_path.moveTo(SkIntToScalar(indicator_x), | 149 indicator_path.moveTo(SkIntToScalar(indicator_x), |
| 150 SkIntToScalar(indicator_y)); | 150 SkIntToScalar(indicator_y)); |
| 151 indicator_path.lineTo( | 151 indicator_path.lineTo( |
| 152 SkIntToScalar(indicator_x + kSortIndicatorSize * scale), | 152 SkIntToScalar(indicator_x + kSortIndicatorSize * scale), |
| 153 SkIntToScalar(indicator_y)); | 153 SkIntToScalar(indicator_y)); |
| 154 indicator_path.lineTo( | 154 indicator_path.lineTo( |
| 155 SkIntToScalar(indicator_x + kSortIndicatorSize / 2 * scale), | 155 SkIntToScalar(indicator_x + kSortIndicatorSize / 2 * scale), |
| 156 SkIntToScalar(indicator_y + kSortIndicatorSize)); | 156 SkIntToScalar(indicator_y + kSortIndicatorSize)); |
| 157 } | 157 } |
| 158 indicator_path.close(); | 158 indicator_path.close(); |
| 159 canvas->DrawPath(indicator_path, paint); | 159 canvas->DrawPath(indicator_path, flags); |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 } | 162 } |
| 163 | 163 |
| 164 const char* TableHeader::GetClassName() const { | 164 const char* TableHeader::GetClassName() const { |
| 165 return kViewClassName; | 165 return kViewClassName; |
| 166 } | 166 } |
| 167 | 167 |
| 168 gfx::Size TableHeader::GetPreferredSize() const { | 168 gfx::Size TableHeader::GetPreferredSize() const { |
| 169 return gfx::Size(1, kVerticalPadding * 2 + font_list_.GetHeight()); | 169 return gfx::Size(1, kVerticalPadding * 2 + font_list_.GetHeight()); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 if (index > 0 && x >= column.x - kResizePadding && | 280 if (index > 0 && x >= column.x - kResizePadding && |
| 281 x <= column.x + kResizePadding) { | 281 x <= column.x + kResizePadding) { |
| 282 return index - 1; | 282 return index - 1; |
| 283 } | 283 } |
| 284 const int max_x = column.x + column.width; | 284 const int max_x = column.x + column.width; |
| 285 return (x >= max_x - kResizePadding && x <= max_x + kResizePadding) ? | 285 return (x >= max_x - kResizePadding && x <= max_x + kResizePadding) ? |
| 286 index : -1; | 286 index : -1; |
| 287 } | 287 } |
| 288 | 288 |
| 289 } // namespace views | 289 } // namespace views |
| OLD | NEW |