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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 View::OnFocus(); | 601 View::OnFocus(); |
602 SchedulePaintForNode(selected_node_); | 602 SchedulePaintForNode(selected_node_); |
603 | |
604 // Notify the InputMethod so that it knows to query the TextInputClient. | |
605 if (GetInputMethod()) | 603 if (GetInputMethod()) |
606 GetInputMethod()->OnCaretBoundsChanged(this); | 604 GetInputMethod()->OnFocus(); |
sky
2013/08/21 21:57:11
Having to put this in each override is error prone
msw
2013/08/21 22:57:19
Done.
| |
607 } | 605 } |
608 | 606 |
609 void TreeView::OnBlur() { | 607 void TreeView::OnBlur() { |
610 SchedulePaintForNode(selected_node_); | 608 SchedulePaintForNode(selected_node_); |
611 if (selector_) | 609 if (selector_) |
612 selector_->OnViewBlur(); | 610 selector_->OnViewBlur(); |
611 if (GetInputMethod()) | |
612 GetInputMethod()->OnBlur(); | |
613 } | 613 } |
614 | 614 |
615 bool TreeView::OnClickOrTap(const ui::LocatedEvent& event) { | 615 bool TreeView::OnClickOrTap(const ui::LocatedEvent& event) { |
616 CommitEdit(); | 616 CommitEdit(); |
617 RequestFocus(); | 617 RequestFocus(); |
618 | 618 |
619 int row = (event.y() - kVerticalInset) / row_height_; | 619 int row = (event.y() - kVerticalInset) / row_height_; |
620 int depth = 0; | 620 int depth = 0; |
621 InternalNode* node = GetNodeByRow(row, &depth); | 621 InternalNode* node = GetNodeByRow(row, &depth); |
622 if (node) { | 622 if (node) { |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1012 if (!is_expanded_) | 1012 if (!is_expanded_) |
1013 return max_width; | 1013 return max_width; |
1014 for (int i = 0; i < child_count(); ++i) { | 1014 for (int i = 0; i < child_count(); ++i) { |
1015 max_width = std::max(max_width, | 1015 max_width = std::max(max_width, |
1016 GetChild(i)->GetMaxWidth(indent, depth + 1)); | 1016 GetChild(i)->GetMaxWidth(indent, depth + 1)); |
1017 } | 1017 } |
1018 return max_width; | 1018 return max_width; |
1019 } | 1019 } |
1020 | 1020 |
1021 } // namespace views | 1021 } // namespace views |
OLD | NEW |