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/tree/tree_view.h" | 5 #include "ui/views/controls/tree/tree_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 | 591 |
592 int min_row = std::max(0, (min_y - kVerticalInset) / row_height_); | 592 int min_row = std::max(0, (min_y - kVerticalInset) / row_height_); |
593 int max_row = (max_y - kVerticalInset) / row_height_; | 593 int max_row = (max_y - kVerticalInset) / row_height_; |
594 if ((max_y - kVerticalInset) % row_height_ != 0) | 594 if ((max_y - kVerticalInset) % row_height_ != 0) |
595 max_row++; | 595 max_row++; |
596 int current_row = root_row(); | 596 int current_row = root_row(); |
597 PaintRows(canvas, min_row, max_row, &root_, root_depth(), ¤t_row); | 597 PaintRows(canvas, min_row, max_row, &root_, root_depth(), ¤t_row); |
598 } | 598 } |
599 | 599 |
600 void TreeView::OnFocus() { | 600 void TreeView::OnFocus() { |
| 601 GetInputMethod()->OnFocus(); |
601 View::OnFocus(); | 602 View::OnFocus(); |
602 SchedulePaintForNode(selected_node_); | 603 SchedulePaintForNode(selected_node_); |
603 | 604 |
604 // Notify the InputMethod so that it knows to query the TextInputClient. | 605 // Notify the InputMethod so that it knows to query the TextInputClient. |
605 if (GetInputMethod()) | 606 if (GetInputMethod()) |
606 GetInputMethod()->OnCaretBoundsChanged(this); | 607 GetInputMethod()->OnCaretBoundsChanged(this); |
607 } | 608 } |
608 | 609 |
609 void TreeView::OnBlur() { | 610 void TreeView::OnBlur() { |
| 611 GetInputMethod()->OnBlur(); |
610 SchedulePaintForNode(selected_node_); | 612 SchedulePaintForNode(selected_node_); |
611 if (selector_) | 613 if (selector_) |
612 selector_->OnViewBlur(); | 614 selector_->OnViewBlur(); |
613 } | 615 } |
614 | 616 |
615 bool TreeView::OnClickOrTap(const ui::LocatedEvent& event) { | 617 bool TreeView::OnClickOrTap(const ui::LocatedEvent& event) { |
616 CommitEdit(); | 618 CommitEdit(); |
617 RequestFocus(); | 619 RequestFocus(); |
618 | 620 |
619 int row = (event.y() - kVerticalInset) / row_height_; | 621 int row = (event.y() - kVerticalInset) / row_height_; |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 if (!is_expanded_) | 1014 if (!is_expanded_) |
1013 return max_width; | 1015 return max_width; |
1014 for (int i = 0; i < child_count(); ++i) { | 1016 for (int i = 0; i < child_count(); ++i) { |
1015 max_width = std::max(max_width, | 1017 max_width = std::max(max_width, |
1016 GetChild(i)->GetMaxWidth(indent, depth + 1)); | 1018 GetChild(i)->GetMaxWidth(indent, depth + 1)); |
1017 } | 1019 } |
1018 return max_width; | 1020 return max_width; |
1019 } | 1021 } |
1020 | 1022 |
1021 } // namespace views | 1023 } // namespace views |
OLD | NEW |