| 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_view.h" | 5 #include "ui/views/controls/table/table_view.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 visible_columns_[j].column.alignment)); | 593 visible_columns_[j].column.alignment)); |
| 594 } | 594 } |
| 595 } | 595 } |
| 596 } | 596 } |
| 597 | 597 |
| 598 if (!grouper_ || region.min_column > 0) | 598 if (!grouper_ || region.min_column > 0) |
| 599 return; | 599 return; |
| 600 | 600 |
| 601 const SkColor grouping_color = GetNativeTheme()->GetSystemColor( | 601 const SkColor grouping_color = GetNativeTheme()->GetSystemColor( |
| 602 ui::NativeTheme::kColorId_TableGroupingIndicatorColor); | 602 ui::NativeTheme::kColorId_TableGroupingIndicatorColor); |
| 603 cc::PaintFlags grouping_paint; | 603 cc::PaintFlags grouping_flags; |
| 604 grouping_paint.setColor(grouping_color); | 604 grouping_flags.setColor(grouping_color); |
| 605 grouping_paint.setStyle(cc::PaintFlags::kFill_Style); | 605 grouping_flags.setStyle(cc::PaintFlags::kFill_Style); |
| 606 grouping_paint.setAntiAlias(true); | 606 grouping_flags.setAntiAlias(true); |
| 607 const int group_indicator_x = GetMirroredXInView(GetCellBounds(0, 0).x() + | 607 const int group_indicator_x = GetMirroredXInView(GetCellBounds(0, 0).x() + |
| 608 kTextHorizontalPadding + kGroupingIndicatorSize / 2); | 608 kTextHorizontalPadding + kGroupingIndicatorSize / 2); |
| 609 for (int i = region.min_row; i < region.max_row; ) { | 609 for (int i = region.min_row; i < region.max_row; ) { |
| 610 const int model_index = ViewToModel(i); | 610 const int model_index = ViewToModel(i); |
| 611 GroupRange range; | 611 GroupRange range; |
| 612 grouper_->GetGroupRange(model_index, &range); | 612 grouper_->GetGroupRange(model_index, &range); |
| 613 DCHECK_GT(range.length, 0); | 613 DCHECK_GT(range.length, 0); |
| 614 // The order of rows in a group is consistent regardless of sort, so it's ok | 614 // The order of rows in a group is consistent regardless of sort, so it's ok |
| 615 // to do this calculation. | 615 // to do this calculation. |
| 616 const int start = i - (model_index - range.start); | 616 const int start = i - (model_index - range.start); |
| 617 const int last = start + range.length - 1; | 617 const int last = start + range.length - 1; |
| 618 const gfx::Rect start_cell_bounds(GetCellBounds(start, 0)); | 618 const gfx::Rect start_cell_bounds(GetCellBounds(start, 0)); |
| 619 if (start != last) { | 619 if (start != last) { |
| 620 const gfx::Rect last_cell_bounds(GetCellBounds(last, 0)); | 620 const gfx::Rect last_cell_bounds(GetCellBounds(last, 0)); |
| 621 canvas->FillRect(gfx::Rect( | 621 canvas->FillRect(gfx::Rect( |
| 622 group_indicator_x - kGroupingIndicatorSize / 2, | 622 group_indicator_x - kGroupingIndicatorSize / 2, |
| 623 start_cell_bounds.CenterPoint().y(), | 623 start_cell_bounds.CenterPoint().y(), |
| 624 kGroupingIndicatorSize, | 624 kGroupingIndicatorSize, |
| 625 last_cell_bounds.y() - start_cell_bounds.y()), | 625 last_cell_bounds.y() - start_cell_bounds.y()), |
| 626 grouping_color); | 626 grouping_color); |
| 627 canvas->DrawCircle(gfx::Point(group_indicator_x, | 627 canvas->DrawCircle( |
| 628 last_cell_bounds.CenterPoint().y()), | 628 gfx::Point(group_indicator_x, last_cell_bounds.CenterPoint().y()), |
| 629 kGroupingIndicatorSize / 2, grouping_paint); | 629 kGroupingIndicatorSize / 2, grouping_flags); |
| 630 } | 630 } |
| 631 canvas->DrawCircle(gfx::Point(group_indicator_x, | 631 canvas->DrawCircle( |
| 632 start_cell_bounds.CenterPoint().y()), | 632 gfx::Point(group_indicator_x, start_cell_bounds.CenterPoint().y()), |
| 633 kGroupingIndicatorSize / 2, grouping_paint); | 633 kGroupingIndicatorSize / 2, grouping_flags); |
| 634 i = last + 1; | 634 i = last + 1; |
| 635 } | 635 } |
| 636 } | 636 } |
| 637 | 637 |
| 638 void TableView::OnFocus() { | 638 void TableView::OnFocus() { |
| 639 SchedulePaintForSelection(); | 639 SchedulePaintForSelection(); |
| 640 NotifyAccessibilityEvent(ui::AX_EVENT_FOCUS, true); | 640 NotifyAccessibilityEvent(ui::AX_EVENT_FOCUS, true); |
| 641 } | 641 } |
| 642 | 642 |
| 643 void TableView::OnBlur() { | 643 void TableView::OnBlur() { |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 if (tooltip) | 955 if (tooltip) |
| 956 *tooltip = text; | 956 *tooltip = text; |
| 957 if (tooltip_origin) { | 957 if (tooltip_origin) { |
| 958 tooltip_origin->SetPoint(cell_bounds.x(), | 958 tooltip_origin->SetPoint(cell_bounds.x(), |
| 959 cell_bounds.y() + kTextVerticalPadding); | 959 cell_bounds.y() + kTextVerticalPadding); |
| 960 } | 960 } |
| 961 return true; | 961 return true; |
| 962 } | 962 } |
| 963 | 963 |
| 964 } // namespace views | 964 } // namespace views |
| OLD | NEW |