summaryrefslogtreecommitdiffstats
path: root/views/examples
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-04 19:37:02 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-04 19:37:02 +0000
commitd9852ad26a46e6463191476238e830a1179b084f (patch)
treef1df52fb4c644b02fa6696174b8828c8fe8a9e3a /views/examples
parentd22d873921f2f657b483a01a398ddce3001747a1 (diff)
downloadchromium_src-d9852ad26a46e6463191476238e830a1179b084f.zip
chromium_src-d9852ad26a46e6463191476238e830a1179b084f.tar.gz
chromium_src-d9852ad26a46e6463191476238e830a1179b084f.tar.bz2
Revert "Add transparency to TYPE_CHILD WidgetGtk."
This reverts commit ddbb1a000db9a2e8ea0cb504877c48fd7838da1b. TBR=sky@chromium.org Review URL: http://codereview.chromium.org/1951003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46377 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/examples')
-rw-r--r--views/examples/examples_main.cc9
-rw-r--r--views/examples/widget_example.h38
2 files changed, 17 insertions, 30 deletions
diff --git a/views/examples/examples_main.cc b/views/examples/examples_main.cc
index cb02329..05c4564 100644
--- a/views/examples/examples_main.cc
+++ b/views/examples/examples_main.cc
@@ -18,8 +18,8 @@
#include "views/examples/radio_button_example.h"
#include "views/examples/scroll_view_example.h"
#include "views/examples/single_split_view_example.h"
-// Slider is not yet ported to Windows.
#if defined(OS_LINUX)
+// Slider is not yet ported to Windows.
#include "views/examples/slider_example.h"
#endif
#include "views/examples/tabbed_pane_example.h"
@@ -30,6 +30,9 @@
#include "views/examples/table2_example.h"
#include "views/examples/textfield_example.h"
#include "views/examples/widget_example.h"
+#if defined(OS_LINUX)
+#include "views/examples/widget_anim_example.h"
+#endif
#include "views/focus/accelerator_handler.h"
#include "views/grid_layout.h"
#include "views/window/window.h"
@@ -133,6 +136,10 @@ void ExamplesMain::Run() {
tabbed_pane->AddTab(widget_example.GetExampleTitle(),
widget_example.GetExampleView());
+ examples::WidgetAnimExample widget_anim_example(this);
+ tabbed_pane->AddTab(widget_anim_example.GetExampleTitle(),
+ widget_anim_example.GetExampleView());
+
#if defined(OS_LINUX)
examples::SliderExample slider_example(this);
tabbed_pane->AddTab(slider_example.GetExampleTitle(),
diff --git a/views/examples/widget_example.h b/views/examples/widget_example.h
index b84e8f8..609e6ed 100644
--- a/views/examples/widget_example.h
+++ b/views/examples/widget_example.h
@@ -43,17 +43,7 @@ class BoxLayout : public views::LayoutManager {
}
virtual gfx::Size GetPreferredSize(views::View* host) {
- int count = host->GetChildViewCount();
- gfx::Rect bounds;
- int y = 0;
- for (int i = 0; i < count; i++) {
- views::View* child = host->GetChildViewAt(i);
- gfx::Size size = child->GetPreferredSize();
- gfx::Rect child_bounds(0, y, size.width(), size.height());
- bounds = bounds.Union(child_bounds);
- y += size.height();
- }
- return bounds.size();
+ return host->GetPreferredSize();
}
private:
@@ -133,29 +123,19 @@ class WidgetExample : public ExampleBase, public views::ButtonListener {
void InitWidget(Widget* widget,
const Widget::TransparencyParam transparency) {
- // Add view/native buttons to close the popup widget.
+ // Add a button to close the popup widget.
views::TextButton* close_button = new views::TextButton(this, L"Close");
close_button->set_tag(CLOSE_WIDGET);
- // TODO(oshima): support transparent native view.
- views::NativeButton* native_button
- = new views::NativeButton(this, L"Native Close");
- native_button->set_tag(CLOSE_WIDGET);
-
- views::View* button_container = new views::View();
- button_container->SetLayoutManager(new BoxLayout);
- button_container->AddChildView(close_button);
- button_container->AddChildView(native_button);
-
views::View* widget_container = new views::View();
widget_container->SetLayoutManager(new CenterLayout);
- widget_container->AddChildView(button_container);
-
- widget->SetContentsView(widget_container);
-
- if (transparency != Widget::Transparent) {
+ if (transparency == Widget::Transparent)
+ close_button->set_background(
+ views::Background::CreateStandardPanelBackground());
+ else
widget_container->set_background(
views::Background::CreateStandardPanelBackground());
- }
+ widget_container->AddChildView(close_button);
+ widget->GetRootView()->SetContentsView(widget_container);
// Show the widget.
widget->Show();
@@ -171,7 +151,7 @@ class WidgetExample : public ExampleBase, public views::ButtonListener {
// Compute where to place the child widget.
// We'll place it at the center of the root widget.
views::WidgetGtk* parent_widget =
- static_cast<views::WidgetGtk*>(parent->GetWidget());
+ static_cast<views::WidgetGtk*>(parent->GetWidget()->GetRootWidget());
gfx::Rect bounds;
parent_widget->GetBounds(&bounds, false);
// Child widget is 200x200 square.