diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-25 23:20:01 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-25 23:20:01 +0000 |
commit | d6d0cbd98411bed026ff36862b3f8075d9f028ec (patch) | |
tree | 88d7d3dd807bb330c9b82ced45644c1ea3e1aa01 /views/aura_desktop | |
parent | 5e19e6be8418668ad8f120dd3452eaf3ac32431a (diff) | |
download | chromium_src-d6d0cbd98411bed026ff36862b3f8075d9f028ec.zip chromium_src-d6d0cbd98411bed026ff36862b3f8075d9f028ec.tar.gz chromium_src-d6d0cbd98411bed026ff36862b3f8075d9f028ec.tar.bz2 |
Show a Window in the aura views demo.
http://crbug.com/93944
TEST=none
Review URL: http://codereview.chromium.org/7744045
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98349 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/aura_desktop')
-rw-r--r-- | views/aura_desktop/aura_desktop_main.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/views/aura_desktop/aura_desktop_main.cc b/views/aura_desktop/aura_desktop_main.cc index ce6f3a7..eabf9fe 100644 --- a/views/aura_desktop/aura_desktop_main.cc +++ b/views/aura_desktop/aura_desktop_main.cc @@ -18,6 +18,7 @@ #include "ui/gfx/canvas_skia.h" #include "ui/gfx/rect.h" #include "views/widget/widget.h" +#include "views/widget/widget_delegate.h" namespace { @@ -50,6 +51,28 @@ class TestView : public views::View { DISALLOW_COPY_AND_ASSIGN(TestView); }; +class TestWindowContents : public views::WidgetDelegateView { + public: + TestWindowContents() {} + virtual ~TestWindowContents() {} + + private: + // Overridden from views::View: + virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { + canvas->FillRectInt(SK_ColorGRAY, 0, 0, width(), height()); + } + + // Overridden from views::WidgetDelegateView: + virtual std::wstring GetWindowTitle() const OVERRIDE { + return L"Test Window!"; + } + virtual View* GetContentsView() OVERRIDE { + return this; + } + + DISALLOW_COPY_AND_ASSIGN(TestWindowContents); +}; + } // namespace int main(int argc, char** argv) { @@ -100,6 +123,11 @@ int main(int argc, char** argv) { widget.Init(params); widget.SetContentsView(new TestView); + TestWindowContents* contents = new TestWindowContents; + views::Widget* views_window = views::Widget::CreateWindowWithParentAndBounds( + contents, &window2, gfx::Rect(120, 150, 200, 200)); + views_window->Show(); + aura::Desktop::GetInstance()->Run(); return 0; } |