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

Unified Diff: views/examples/widget_example.cc

Issue 6881107: Rework the way Widget::Init works: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/controls/textfield/native_textfield_views_unittest.cc ('k') | views/focus/focus_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/examples/widget_example.cc
===================================================================
--- views/examples/widget_example.cc (revision 83020)
+++ views/examples/widget_example.cc (working copy)
@@ -108,9 +108,7 @@
#if defined(OS_LINUX)
void WidgetExample::CreateChild(views::View* parent, bool transparent) {
- views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_CONTROL);
- params.transparent = transparent;
- views::Widget* widget = views::Widget::CreateWidget(params);
+ views::Widget* widget = views::Widget::CreateWidget();
// Compute where to place the child widget.
// We'll place it at the center of the root widget.
views::Widget* parent_widget = parent->GetWidget();
@@ -119,15 +117,16 @@
bounds.SetRect((bounds.width() - 200) / 2, (bounds.height() - 200) / 2,
200, 200);
// Initialize the child widget with the computed bounds.
- widget->InitWithWidget(parent_widget, bounds);
+ views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_CONTROL);
+ params.transparent = transparent;
+ params.parent_widget = parent_widget;
+ widget->Init(params);
InitWidget(widget, transparent);
}
#endif
void WidgetExample::CreatePopup(views::View* parent, bool transparent) {
- views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_POPUP);
- params.transparent = transparent;
- views::Widget* widget = views::Widget::CreateWidget(params);
+ views::Widget* widget = views::Widget::CreateWidget();
// Compute where to place the popup widget.
// We'll place it right below the create button.
@@ -136,9 +135,13 @@
views::View::ConvertPointToScreen(parent, &point);
// Add the height of create_button_.
point.Offset(0, parent->size().height());
- gfx::Rect bounds(point.x(), point.y(), 200, 300);
+
// Initialize the popup widget with the computed bounds.
- widget->InitWithWidget(parent->GetWidget(), bounds);
+ views::Widget::CreateParams params(views::Widget::CreateParams::TYPE_POPUP);
+ params.transparent = transparent;
+ params.parent_widget = parent->GetWidget();
+ params.bounds = gfx::Rect(point.x(), point.y(), 200, 300);
+ widget->Init(params);
InitWidget(widget, transparent);
}
« no previous file with comments | « views/controls/textfield/native_textfield_views_unittest.cc ('k') | views/focus/focus_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698