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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 : model_(NULL), | 74 : model_(NULL), |
75 selected_node_(NULL), | 75 selected_node_(NULL), |
76 editing_(false), | 76 editing_(false), |
77 editor_(NULL), | 77 editor_(NULL), |
78 focus_manager_(NULL), | 78 focus_manager_(NULL), |
79 auto_expand_children_(false), | 79 auto_expand_children_(false), |
80 editable_(true), | 80 editable_(true), |
81 controller_(NULL), | 81 controller_(NULL), |
82 root_shown_(true), | 82 root_shown_(true), |
83 row_height_(font_list_.GetHeight() + kTextVerticalPadding * 2) { | 83 row_height_(font_list_.GetHeight() + kTextVerticalPadding * 2) { |
84 // On Mac, only textfields and lists are focusable by default. Since TreeView | |
85 // represents a list, use ALWAYS focus behavior. | |
tapted
2016/04/20 06:05:58
This could be
// Always focusable, even on Mac (c
karandeepb
2016/05/03 02:54:13
Done.
| |
84 SetFocusBehavior(FocusBehavior::ALWAYS); | 86 SetFocusBehavior(FocusBehavior::ALWAYS); |
85 closed_icon_ = *ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 87 closed_icon_ = *ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
86 (base::i18n::IsRTL() ? IDR_FOLDER_CLOSED_RTL | 88 (base::i18n::IsRTL() ? IDR_FOLDER_CLOSED_RTL |
87 : IDR_FOLDER_CLOSED)).ToImageSkia(); | 89 : IDR_FOLDER_CLOSED)).ToImageSkia(); |
88 open_icon_ = *ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 90 open_icon_ = *ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
89 (base::i18n::IsRTL() ? IDR_FOLDER_OPEN_RTL | 91 (base::i18n::IsRTL() ? IDR_FOLDER_OPEN_RTL |
90 : IDR_FOLDER_OPEN)).ToImageSkia(); | 92 : IDR_FOLDER_OPEN)).ToImageSkia(); |
91 text_offset_ = closed_icon_.width() + kImagePadding + kImagePadding + | 93 text_offset_ = closed_icon_.width() + kImagePadding + kImagePadding + |
92 kArrowRegionSize; | 94 kArrowRegionSize; |
93 } | 95 } |
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1043 if (!is_expanded_) | 1045 if (!is_expanded_) |
1044 return max_width; | 1046 return max_width; |
1045 for (int i = 0; i < child_count(); ++i) { | 1047 for (int i = 0; i < child_count(); ++i) { |
1046 max_width = std::max(max_width, | 1048 max_width = std::max(max_width, |
1047 GetChild(i)->GetMaxWidth(indent, depth + 1)); | 1049 GetChild(i)->GetMaxWidth(indent, depth + 1)); |
1048 } | 1050 } |
1049 return max_width; | 1051 return max_width; |
1050 } | 1052 } |
1051 | 1053 |
1052 } // namespace views | 1054 } // namespace views |
OLD | NEW |