OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef VIEWS_EXAMPLES_WIDGET_EXAMPLE_H_ | 5 #ifndef VIEWS_EXAMPLES_WIDGET_EXAMPLE_H_ |
6 #define VIEWS_EXAMPLES_WIDGET_EXAMPLE_H_ | 6 #define VIEWS_EXAMPLES_WIDGET_EXAMPLE_H_ |
7 | 7 |
8 #include "views/background.h" | 8 #include "views/background.h" |
9 #include "views/controls/button/text_button.h" | 9 #include "views/controls/button/text_button.h" |
10 #include "views/examples/box_layout.h" | 10 #include "views/examples/box_layout.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 // Initialize the child widget with the computed bounds. | 138 // Initialize the child widget with the computed bounds. |
139 widget->Init(parent_widget->window_contents(), bounds); | 139 widget->Init(parent_widget->window_contents(), bounds); |
140 InitWidget(widget, transparency); | 140 InitWidget(widget, transparency); |
141 } | 141 } |
142 #endif | 142 #endif |
143 | 143 |
144 void CreatePopup(views::View* parent, | 144 void CreatePopup(views::View* parent, |
145 const Widget::TransparencyParam transparency) { | 145 const Widget::TransparencyParam transparency) { |
146 Widget* widget = Widget::CreatePopupWidget(transparency, | 146 Widget* widget = Widget::CreatePopupWidget(transparency, |
147 Widget::AcceptEvents, | 147 Widget::AcceptEvents, |
148 Widget::DeleteOnDestroy); | 148 Widget::DeleteOnDestroy, |
| 149 Widget::MirrorOriginInRTL); |
149 // Compute where to place the popup widget. | 150 // Compute where to place the popup widget. |
150 // We'll place it right below the create button. | 151 // We'll place it right below the create button. |
151 gfx::Point point = parent->GetPosition(); | 152 gfx::Point point = parent->GetPosition(); |
152 // The position in point is relative to the parent. Make it absolute. | 153 // The position in point is relative to the parent. Make it absolute. |
153 views::View::ConvertPointToScreen(parent, &point); | 154 views::View::ConvertPointToScreen(parent, &point); |
154 // Add the height of create_button_. | 155 // Add the height of create_button_. |
155 point.Offset(0, parent->size().height()); | 156 point.Offset(0, parent->size().height()); |
156 gfx::Rect bounds(point.x(), point.y(), 200, 300); | 157 gfx::Rect bounds(point.x(), point.y(), 200, 300); |
157 // Initialize the popup widget with the computed bounds. | 158 // Initialize the popup widget with the computed bounds. |
158 widget->Init(NULL, bounds); | 159 widget->Init(NULL, bounds); |
(...skipping 22 matching lines...) Expand all Loading... |
181 break; | 182 break; |
182 } | 183 } |
183 } | 184 } |
184 | 185 |
185 DISALLOW_COPY_AND_ASSIGN(WidgetExample); | 186 DISALLOW_COPY_AND_ASSIGN(WidgetExample); |
186 }; | 187 }; |
187 | 188 |
188 } // namespace examples | 189 } // namespace examples |
189 | 190 |
190 #endif // VIEWS_EXAMPLES_WIDGET_EXAMPLE_H_ | 191 #endif // VIEWS_EXAMPLES_WIDGET_EXAMPLE_H_ |
OLD | NEW |