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" |
10 | 13 |
11 //////////////////////////////////////////////////////////////////////////////// | 14 //////////////////////////////////////////////////////////////////////////////// |
12 // DesktopBackgroundView, public: | 15 // DesktopBackgroundView, public: |
13 | 16 |
14 DesktopBackgroundView::DesktopBackgroundView() { | 17 DesktopBackgroundView::DesktopBackgroundView() { |
15 /* | |
16 wallpaper_ = *ResourceBundle::GetSharedInstance().GetBitmapNamed( | 18 wallpaper_ = *ResourceBundle::GetSharedInstance().GetBitmapNamed( |
17 IDR_AURA_WALLPAPER); | 19 IDR_AURA_WALLPAPER); |
18 */ | |
19 } | 20 } |
20 | 21 |
21 DesktopBackgroundView::~DesktopBackgroundView() { | 22 DesktopBackgroundView::~DesktopBackgroundView() { |
22 } | 23 } |
23 | 24 |
24 //////////////////////////////////////////////////////////////////////////////// | 25 //////////////////////////////////////////////////////////////////////////////// |
25 // DesktopBackgroundView, views::View overrides: | 26 // DesktopBackgroundView, views::View overrides: |
26 | 27 |
27 void DesktopBackgroundView::OnPaint(gfx::Canvas* canvas) { | 28 void DesktopBackgroundView::OnPaint(gfx::Canvas* canvas) { |
28 //canvas->TileImageInt(wallpaper_, 0, 0, width(), height()); | 29 canvas->TileImageInt(wallpaper_, 0, 0, width(), height()); |
29 } | 30 } |
30 | 31 |
31 void DesktopBackgroundView::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 32 void DesktopBackgroundView::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
32 LOG(WARNING) << "Here"; | 33 LOG(WARNING) << "Here"; |
33 } | 34 } |
| 35 |
| 36 bool DesktopBackgroundView::OnMousePressed(const views::MouseEvent& event) { |
| 37 SampleWindow::CreateSampleWindow(); |
| 38 return true; |
| 39 } |
| 40 |
| 41 views::Widget* CreateDesktopBackground() { |
| 42 views::Widget* desktop_widget = new views::Widget; |
| 43 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); |
| 44 params.bounds = gfx::Rect(0, 0, 1024, 768); |
| 45 params.parent = aura::Desktop::GetInstance()->window(); |
| 46 DesktopBackgroundView* view = new DesktopBackgroundView; |
| 47 params.delegate = view; |
| 48 desktop_widget->Init(params); |
| 49 desktop_widget->SetContentsView(view); |
| 50 desktop_widget->Show(); |
| 51 return desktop_widget; |
| 52 } |
OLD | NEW |