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

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

Issue 1894383002: MacViews: Implement Full Keyboard Access. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@SetFocusBehavior
Patch Set: Rebased 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 #if defined(OS_LINUX) 80 #if defined(OS_LINUX)
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->SetFocusBehavior(View::FocusBehavior::ALWAYS); 90 Button::ConfigureDefaultFocus(button);
91 button->set_tag(tag); 91 button->set_tag(tag);
92 container->AddChildView(button); 92 container->AddChildView(button);
93 } 93 }
94 94
95 void WidgetExample::ShowWidget(View* sender, Widget::InitParams params) { 95 void WidgetExample::ShowWidget(View* sender, Widget::InitParams params) {
96 // Setup shared Widget heirarchy and bounds parameters. 96 // Setup shared Widget heirarchy and bounds parameters.
97 params.parent = sender->GetWidget()->GetNativeView(); 97 params.parent = sender->GetWidget()->GetNativeView();
98 params.bounds = gfx::Rect(sender->GetBoundsInScreen().CenterPoint(), 98 params.bounds = gfx::Rect(sender->GetBoundsInScreen().CenterPoint(),
99 gfx::Size(300, 200)); 99 gfx::Size(300, 200));
100 100
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 ShowWidget(sender, Widget::InitParams(Widget::InitParams::TYPE_CONTROL)); 132 ShowWidget(sender, Widget::InitParams(Widget::InitParams::TYPE_CONTROL));
133 break; 133 break;
134 case CLOSE_WIDGET: 134 case CLOSE_WIDGET:
135 sender->GetWidget()->Close(); 135 sender->GetWidget()->Close();
136 break; 136 break;
137 } 137 }
138 } 138 }
139 139
140 } // namespace examples 140 } // namespace examples
141 } // namespace views 141 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698