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 CHROME_BROWSER_UI_VIEWS_LIST_BACKGROUND_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_LIST_BACKGROUND_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_LIST_BACKGROUND_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_LIST_BACKGROUND_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "gfx/canvas_skia.h" | 9 #include "ui/gfx/canvas_skia.h" |
10 #include "gfx/native_theme_win.h" | 10 #include "ui/gfx/native_theme_win.h" |
11 #include "views/background.h" | 11 #include "views/background.h" |
12 | 12 |
13 // A background object that paints the scrollable list background, | 13 // A background object that paints the scrollable list background, |
14 // which may be rendered by the system visual styles system. | 14 // which may be rendered by the system visual styles system. |
15 class ListBackground : public views::Background { | 15 class ListBackground : public views::Background { |
16 public: | 16 public: |
17 explicit ListBackground() { | 17 explicit ListBackground() { |
18 SkColor list_color = | 18 SkColor list_color = |
19 gfx::NativeTheme::instance()->GetThemeColorWithDefault( | 19 gfx::NativeTheme::instance()->GetThemeColorWithDefault( |
20 gfx::NativeTheme::LIST, 1, TS_NORMAL, TMT_FILLCOLOR, COLOR_WINDOW); | 20 gfx::NativeTheme::LIST, 1, TS_NORMAL, TMT_FILLCOLOR, COLOR_WINDOW); |
21 SetNativeControlColor(list_color); | 21 SetNativeControlColor(list_color); |
22 } | 22 } |
23 virtual ~ListBackground() {} | 23 virtual ~ListBackground() {} |
24 | 24 |
25 virtual void Paint(gfx::Canvas* canvas, views::View* view) const { | 25 virtual void Paint(gfx::Canvas* canvas, views::View* view) const { |
26 HDC dc = canvas->BeginPlatformPaint(); | 26 HDC dc = canvas->BeginPlatformPaint(); |
27 RECT native_lb = view->GetLocalBounds(true).ToRECT(); | 27 RECT native_lb = view->GetLocalBounds(true).ToRECT(); |
28 gfx::NativeTheme::instance()->PaintListBackground(dc, true, &native_lb); | 28 gfx::NativeTheme::instance()->PaintListBackground(dc, true, &native_lb); |
29 canvas->EndPlatformPaint(); | 29 canvas->EndPlatformPaint(); |
30 } | 30 } |
31 | 31 |
32 private: | 32 private: |
33 DISALLOW_COPY_AND_ASSIGN(ListBackground); | 33 DISALLOW_COPY_AND_ASSIGN(ListBackground); |
34 }; | 34 }; |
35 | 35 |
36 #endif // CHROME_BROWSER_UI_VIEWS_LIST_BACKGROUND_H_ | 36 #endif // CHROME_BROWSER_UI_VIEWS_LIST_BACKGROUND_H_ |
37 | 37 |
OLD | NEW |