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

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

Issue 138363004: Views Textfield fixes and cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync and rebase. Created 6 years, 11 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 | Annotate | Revision Log
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"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 return; // Selection failed for some reason, don't start editing. 154 return; // Selection failed for some reason, don't start editing.
155 DCHECK(!editing_); 155 DCHECK(!editing_);
156 editing_ = true; 156 editing_ = true;
157 if (!editor_) { 157 if (!editor_) {
158 editor_ = new Textfield; 158 editor_ = new Textfield;
159 // Add the editor immediately as GetPreferredSize returns the wrong thing if 159 // Add the editor immediately as GetPreferredSize returns the wrong thing if
160 // not parented. 160 // not parented.
161 AddChildView(editor_); 161 AddChildView(editor_);
162 editor_->SetFontList(font_list_); 162 editor_->SetFontList(font_list_);
163 empty_editor_size_ = editor_->GetPreferredSize(); 163 empty_editor_size_ = editor_->GetPreferredSize();
164 editor_->SetController(this); 164 editor_->set_controller(this);
165 } 165 }
166 editor_->SetText(selected_node_->model_node()->GetTitle()); 166 editor_->SetText(selected_node_->model_node()->GetTitle());
167 LayoutEditor(); 167 LayoutEditor();
168 editor_->SetVisible(true); 168 editor_->SetVisible(true);
169 SchedulePaintForNode(selected_node_); 169 SchedulePaintForNode(selected_node_);
170 editor_->RequestFocus(); 170 editor_->RequestFocus();
171 editor_->SelectAll(false); 171 editor_->SelectAll(false);
172 172
173 // Listen for focus changes so that we can cancel editing. 173 // Listen for focus changes so that we can cancel editing.
174 focus_manager_ = GetFocusManager(); 174 focus_manager_ = GetFocusManager();
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 if (!is_expanded_) 1036 if (!is_expanded_)
1037 return max_width; 1037 return max_width;
1038 for (int i = 0; i < child_count(); ++i) { 1038 for (int i = 0; i < child_count(); ++i) {
1039 max_width = std::max(max_width, 1039 max_width = std::max(max_width,
1040 GetChild(i)->GetMaxWidth(indent, depth + 1)); 1040 GetChild(i)->GetMaxWidth(indent, depth + 1));
1041 } 1041 }
1042 return max_width; 1042 return max_width;
1043 } 1043 }
1044 1044
1045 } // namespace views 1045 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/textfield_unittest.cc ('k') | ui/views/examples/multiline_example.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698