Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Side by Side Diff: ui/views/controls/tree/tree_view.cc

Issue 1870573003: Full Keyboard Access: Second Approach (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/controls/textfield/textfield.cc ('k') | ui/views/controls/webview/webview.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "ui/accessibility/ax_view_state.h" 11 #include "ui/accessibility/ax_view_state.h"
12 #include "ui/base/ime/input_method.h" 12 #include "ui/base/ime/input_method.h"
13 #include "ui/base/resource/resource_bundle.h" 13 #include "ui/base/resource/resource_bundle.h"
14 #include "ui/events/event.h" 14 #include "ui/events/event.h"
15 #include "ui/events/keycodes/keyboard_codes.h" 15 #include "ui/events/keycodes/keyboard_codes.h"
16 #include "ui/gfx/canvas.h" 16 #include "ui/gfx/canvas.h"
17 #include "ui/gfx/geometry/rect.h" 17 #include "ui/gfx/geometry/rect.h"
18 #include "ui/gfx/geometry/rect_conversions.h" 18 #include "ui/gfx/geometry/rect_conversions.h"
19 #include "ui/gfx/image/image.h" 19 #include "ui/gfx/image/image.h"
20 #include "ui/gfx/skia_util.h" 20 #include "ui/gfx/skia_util.h"
21 #include "ui/native_theme/native_theme.h" 21 #include "ui/native_theme/native_theme.h"
22 #include "ui/resources/grit/ui_resources.h" 22 #include "ui/resources/grit/ui_resources.h"
23 #include "ui/views/controls/prefix_selector.h" 23 #include "ui/views/controls/prefix_selector.h"
24 #include "ui/views/controls/scroll_view.h" 24 #include "ui/views/controls/scroll_view.h"
25 #include "ui/views/controls/textfield/textfield.h" 25 #include "ui/views/controls/textfield/textfield.h"
26 #include "ui/views/controls/tree/tree_view_controller.h" 26 #include "ui/views/controls/tree/tree_view_controller.h"
27 #include "ui/views/resources/grit/views_resources.h" 27 #include "ui/views/resources/grit/views_resources.h"
28 #include "ui/views/style/platform_style.h"
28 29
29 using ui::TreeModel; 30 using ui::TreeModel;
30 using ui::TreeModelNode; 31 using ui::TreeModelNode;
31 32
32 namespace views { 33 namespace views {
33 34
34 // Insets around the view. 35 // Insets around the view.
35 static const int kHorizontalInset = 2; 36 static const int kHorizontalInset = 2;
36 static const int kVerticalInset = 2; 37 static const int kVerticalInset = 2;
37 // Padding before/after the image. 38 // Padding before/after the image.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 : model_(NULL), 75 : model_(NULL),
75 selected_node_(NULL), 76 selected_node_(NULL),
76 editing_(false), 77 editing_(false),
77 editor_(NULL), 78 editor_(NULL),
78 focus_manager_(NULL), 79 focus_manager_(NULL),
79 auto_expand_children_(false), 80 auto_expand_children_(false),
80 editable_(true), 81 editable_(true),
81 controller_(NULL), 82 controller_(NULL),
82 root_shown_(true), 83 root_shown_(true),
83 row_height_(font_list_.GetHeight() + kTextVerticalPadding * 2) { 84 row_height_(font_list_.GetHeight() + kTextVerticalPadding * 2) {
84 SetFocusable(true); 85 PlatformStyle::ConfigureFocus(PlatformStyle::CONTROL::TREE_VIEW, this);
85 closed_icon_ = *ui::ResourceBundle::GetSharedInstance().GetImageNamed( 86 closed_icon_ = *ui::ResourceBundle::GetSharedInstance().GetImageNamed(
86 (base::i18n::IsRTL() ? IDR_FOLDER_CLOSED_RTL 87 (base::i18n::IsRTL() ? IDR_FOLDER_CLOSED_RTL
87 : IDR_FOLDER_CLOSED)).ToImageSkia(); 88 : IDR_FOLDER_CLOSED)).ToImageSkia();
88 open_icon_ = *ui::ResourceBundle::GetSharedInstance().GetImageNamed( 89 open_icon_ = *ui::ResourceBundle::GetSharedInstance().GetImageNamed(
89 (base::i18n::IsRTL() ? IDR_FOLDER_OPEN_RTL 90 (base::i18n::IsRTL() ? IDR_FOLDER_OPEN_RTL
90 : IDR_FOLDER_OPEN)).ToImageSkia(); 91 : IDR_FOLDER_OPEN)).ToImageSkia();
91 text_offset_ = closed_icon_.width() + kImagePadding + kImagePadding + 92 text_offset_ = closed_icon_.width() + kImagePadding + kImagePadding +
92 kArrowRegionSize; 93 kArrowRegionSize;
93 } 94 }
94 95
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 if (!is_expanded_) 1044 if (!is_expanded_)
1044 return max_width; 1045 return max_width;
1045 for (int i = 0; i < child_count(); ++i) { 1046 for (int i = 0; i < child_count(); ++i) {
1046 max_width = std::max(max_width, 1047 max_width = std::max(max_width,
1047 GetChild(i)->GetMaxWidth(indent, depth + 1)); 1048 GetChild(i)->GetMaxWidth(indent, depth + 1));
1048 } 1049 }
1049 return max_width; 1050 return max_width;
1050 } 1051 }
1051 1052
1052 } // namespace views 1053 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/textfield.cc ('k') | ui/views/controls/webview/webview.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698