OLD | NEW |
---|---|
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/aura_shell/desktop_background_view.h" | 5 #include "ui/aura_shell/desktop_background_view.h" |
6 | 6 |
7 #include "grit/ui_resources.h" | 7 #include "grit/ui_resources.h" |
8 #include "ui/aura/desktop.h" | |
9 #include "ui/aura_shell/sample_window.h" | |
8 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
9 #include "ui/gfx/canvas.h" | 11 #include "ui/gfx/canvas.h" |
12 #include "views/widget/widget.h" | |
13 | |
14 namespace aura_shell { | |
15 namespace internal { | |
10 | 16 |
11 //////////////////////////////////////////////////////////////////////////////// | 17 //////////////////////////////////////////////////////////////////////////////// |
12 // DesktopBackgroundView, public: | 18 // DesktopBackgroundView, public: |
13 | 19 |
14 DesktopBackgroundView::DesktopBackgroundView() { | 20 DesktopBackgroundView::DesktopBackgroundView() { |
15 /* | |
16 wallpaper_ = *ResourceBundle::GetSharedInstance().GetBitmapNamed( | 21 wallpaper_ = *ResourceBundle::GetSharedInstance().GetBitmapNamed( |
17 IDR_AURA_WALLPAPER); | 22 IDR_AURA_WALLPAPER); |
18 */ | |
19 } | 23 } |
20 | 24 |
21 DesktopBackgroundView::~DesktopBackgroundView() { | 25 DesktopBackgroundView::~DesktopBackgroundView() { |
22 } | 26 } |
23 | 27 |
24 //////////////////////////////////////////////////////////////////////////////// | 28 //////////////////////////////////////////////////////////////////////////////// |
25 // DesktopBackgroundView, views::View overrides: | 29 // DesktopBackgroundView, views::View overrides: |
26 | 30 |
27 void DesktopBackgroundView::OnPaint(gfx::Canvas* canvas) { | 31 void DesktopBackgroundView::OnPaint(gfx::Canvas* canvas) { |
28 //canvas->TileImageInt(wallpaper_, 0, 0, width(), height()); | 32 canvas->TileImageInt(wallpaper_, 0, 0, width(), height()); |
29 } | 33 } |
30 | 34 |
31 void DesktopBackgroundView::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 35 void DesktopBackgroundView::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
32 LOG(WARNING) << "Here"; | 36 LOG(WARNING) << "Here"; |
33 } | 37 } |
38 | |
39 bool DesktopBackgroundView::OnMousePressed(const views::MouseEvent& event) { | |
40 SampleWindow::CreateSampleWindow(); | |
41 return true; | |
42 } | |
43 | |
44 views::Widget* CreateDesktopBackground() { | |
tfarina
2011/09/16 16:28:43
Include ui/aura_shell/shell_factory.h for this?
| |
45 views::Widget* desktop_widget = new views::Widget; | |
46 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); | |
47 params.bounds = gfx::Rect(0, 0, 1024, 768); | |
48 params.parent = aura::Desktop::GetInstance()->window(); | |
49 DesktopBackgroundView* view = new DesktopBackgroundView; | |
50 params.delegate = view; | |
51 desktop_widget->Init(params); | |
52 desktop_widget->SetContentsView(view); | |
53 desktop_widget->Show(); | |
54 return desktop_widget; | |
55 } | |
56 | |
57 } // namespace internal | |
58 } // namespace aura_shell | |
OLD | NEW |