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

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

Issue 14230018: Handle dialog acclerators explicitly; nix default button switching. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Limit the focused view handling to LabelButton; update tests. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/views/view_unittest.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.h" 10 #include "base/message_loop.h"
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 } 346 }
347 SetBounds(x(), y(), width, height); 347 SetBounds(x(), y(), width, height);
348 LayoutEditor(); 348 LayoutEditor();
349 } 349 }
350 350
351 gfx::Size TreeView::GetPreferredSize() { 351 gfx::Size TreeView::GetPreferredSize() {
352 return preferred_size_; 352 return preferred_size_;
353 } 353 }
354 354
355 bool TreeView::AcceleratorPressed(const ui::Accelerator& accelerator) { 355 bool TreeView::AcceleratorPressed(const ui::Accelerator& accelerator) {
356 if (accelerator.key_code() == ui::VKEY_RETURN) { 356 if (accelerator.key_code() == ui::VKEY_RETURN && editing_) {
357 CommitEdit(); 357 CommitEdit();
358 } else { 358 return true;
359 DCHECK_EQ(ui::VKEY_ESCAPE, accelerator.key_code()); 359 } else if (accelerator.key_code() == ui::VKEY_ESCAPE) {
360 CancelEdit(); 360 CancelEdit();
361 RequestFocus(); 361 RequestFocus();
362 return true;
362 } 363 }
363 return true; 364 return false;
364 } 365 }
365 366
366 bool TreeView::OnMousePressed(const ui::MouseEvent& event) { 367 bool TreeView::OnMousePressed(const ui::MouseEvent& event) {
367 return OnClickOrTap(event); 368 return OnClickOrTap(event);
368 } 369 }
369 370
370 ui::TextInputClient* TreeView::GetTextInputClient() { 371 ui::TextInputClient* TreeView::GetTextInputClient() {
371 if (!selector_) 372 if (!selector_)
372 selector_.reset(new TreeViewSelector(this)); 373 selector_.reset(new TreeViewSelector(this));
373 return selector_.get(); 374 return selector_.get();
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 if (!is_expanded_) 999 if (!is_expanded_)
999 return max_width; 1000 return max_width;
1000 for (int i = 0; i < child_count(); ++i) { 1001 for (int i = 0; i < child_count(); ++i) {
1001 max_width = std::max(max_width, 1002 max_width = std::max(max_width,
1002 GetChild(i)->GetMaxWidth(indent, depth + 1)); 1003 GetChild(i)->GetMaxWidth(indent, depth + 1));
1003 } 1004 }
1004 return max_width; 1005 return max_width;
1005 } 1006 }
1006 1007
1007 } // namespace views 1008 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698