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

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

Issue 10795013: Rename bounds accessors to be intuitive and consistent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "ui/views/controls/button/text_button.h" 8 #include "ui/views/controls/button/text_button.h"
9 #include "ui/views/layout/box_layout.h" 9 #include "ui/views/layout/box_layout.h"
10 #include "ui/views/layout/layout_manager.h" 10 #include "ui/views/layout/layout_manager.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // Show the widget. 102 // Show the widget.
103 widget->Show(); 103 widget->Show();
104 } 104 }
105 105
106 #if defined(OS_LINUX) 106 #if defined(OS_LINUX)
107 void WidgetExample::CreateChild(View* parent, bool transparent) { 107 void WidgetExample::CreateChild(View* parent, bool transparent) {
108 Widget* widget = new Widget; 108 Widget* widget = new Widget;
109 // Compute where to place the child widget. 109 // Compute where to place the child widget.
110 // We'll place it at the center of the root widget. 110 // We'll place it at the center of the root widget.
111 Widget* parent_widget = parent->GetWidget(); 111 Widget* parent_widget = parent->GetWidget();
112 gfx::Rect bounds = parent_widget->GetClientAreaScreenBounds(); 112 gfx::Rect bounds = parent_widget->GetClientAreaBoundsInScreen();
113 // Child widget is 200x200 square. 113 // Child widget is 200x200 square.
114 bounds.SetRect((bounds.width() - 200) / 2, (bounds.height() - 200) / 2, 114 bounds.SetRect((bounds.width() - 200) / 2, (bounds.height() - 200) / 2,
115 200, 200); 115 200, 200);
116 // Initialize the child widget with the computed bounds. 116 // Initialize the child widget with the computed bounds.
117 Widget::InitParams params(Widget::InitParams::TYPE_CONTROL); 117 Widget::InitParams params(Widget::InitParams::TYPE_CONTROL);
118 params.transparent = transparent; 118 params.transparent = transparent;
119 params.parent_widget = parent_widget; 119 params.parent_widget = parent_widget;
120 widget->Init(params); 120 widget->Init(params);
121 InitWidget(widget, transparent); 121 InitWidget(widget, transparent);
122 } 122 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 break; 159 break;
160 #endif 160 #endif
161 case CLOSE_WIDGET: 161 case CLOSE_WIDGET:
162 sender->GetWidget()->Close(); 162 sender->GetWidget()->Close();
163 break; 163 break;
164 } 164 }
165 } 165 }
166 166
167 } // namespace examples 167 } // namespace examples
168 } // namespace views 168 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/scrollbar/base_scroll_bar.cc ('k') | ui/views/touchui/touch_selection_controller_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698