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

Side by Side Diff: ui/views/examples/widget_example.cc

Issue 1963563002: Views: Flip default value of CustomButton::request_focus_on_press_ to false. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 7 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
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/examples/widget_example.h" 5 #include "ui/views/examples/widget_example.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "ui/views/background.h" 10 #include "ui/views/background.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // Windows does not support TYPE_CONTROL top-level widgets. 81 // Windows does not support TYPE_CONTROL top-level widgets.
82 BuildButton(container, "Child widget", CHILD); 82 BuildButton(container, "Child widget", CHILD);
83 #endif 83 #endif
84 } 84 }
85 85
86 void WidgetExample::BuildButton(View* container, 86 void WidgetExample::BuildButton(View* container,
87 const std::string& label, 87 const std::string& label,
88 int tag) { 88 int tag) {
89 LabelButton* button = new LabelButton(this, ASCIIToUTF16(label)); 89 LabelButton* button = new LabelButton(this, ASCIIToUTF16(label));
90 Button::ConfigureDefaultFocus(button); 90 Button::ConfigureDefaultFocus(button);
91 button->set_request_focus_on_press(true);
91 button->set_tag(tag); 92 button->set_tag(tag);
92 container->AddChildView(button); 93 container->AddChildView(button);
93 } 94 }
94 95
95 void WidgetExample::ShowWidget(View* sender, Widget::InitParams params) { 96 void WidgetExample::ShowWidget(View* sender, Widget::InitParams params) {
96 // Setup shared Widget heirarchy and bounds parameters. 97 // Setup shared Widget heirarchy and bounds parameters.
97 params.parent = sender->GetWidget()->GetNativeView(); 98 params.parent = sender->GetWidget()->GetNativeView();
98 params.bounds = gfx::Rect(sender->GetBoundsInScreen().CenterPoint(), 99 params.bounds = gfx::Rect(sender->GetBoundsInScreen().CenterPoint(),
99 gfx::Size(300, 200)); 100 gfx::Size(300, 200));
100 101
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 ShowWidget(sender, Widget::InitParams(Widget::InitParams::TYPE_CONTROL)); 133 ShowWidget(sender, Widget::InitParams(Widget::InitParams::TYPE_CONTROL));
133 break; 134 break;
134 case CLOSE_WIDGET: 135 case CLOSE_WIDGET:
135 sender->GetWidget()->Close(); 136 sender->GetWidget()->Close();
136 break; 137 break;
137 } 138 }
138 } 139 }
139 140
140 } // namespace examples 141 } // namespace examples
141 } // namespace views 142 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/examples/tree_view_example.cc ('k') | ui/views/touchui/touch_selection_menu_runner_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698