| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_VIEWS_BACKGROUND_H_ | 5 #ifndef UI_VIEWS_BACKGROUND_H_ |
| 6 #define UI_VIEWS_BACKGROUND_H_ | 6 #define UI_VIEWS_BACKGROUND_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| 11 #if defined(OS_WIN) | 11 #if defined(OS_WIN) |
| 12 #include <windows.h> | 12 #include <windows.h> |
| 13 #endif // defined(OS_WIN) | 13 #endif // defined(OS_WIN) |
| 14 | 14 |
| 15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
| 16 #include "third_party/skia/include/core/SkColor.h" | 16 #include "third_party/skia/include/core/SkColor.h" |
| 17 #include "ui/views/views_export.h" | 17 #include "ui/views/views_export.h" |
| 18 | 18 |
| 19 namespace gfx { | 19 namespace gfx { |
| 20 class Canvas; | 20 class CanvasSkia; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace views { | 23 namespace views { |
| 24 | 24 |
| 25 class Painter; | 25 class Painter; |
| 26 class View; | 26 class View; |
| 27 | 27 |
| 28 ///////////////////////////////////////////////////////////////////////////// | 28 ///////////////////////////////////////////////////////////////////////////// |
| 29 // | 29 // |
| 30 // Background class | 30 // Background class |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 // Creates Chrome's standard panel background | 63 // Creates Chrome's standard panel background |
| 64 static Background* CreateStandardPanelBackground(); | 64 static Background* CreateStandardPanelBackground(); |
| 65 | 65 |
| 66 // Creates a Background from the specified Painter. If owns_painter is | 66 // Creates a Background from the specified Painter. If owns_painter is |
| 67 // true, the Painter is deleted when the Border is deleted. | 67 // true, the Painter is deleted when the Border is deleted. |
| 68 static Background* CreateBackgroundPainter(bool owns_painter, | 68 static Background* CreateBackgroundPainter(bool owns_painter, |
| 69 Painter* painter); | 69 Painter* painter); |
| 70 | 70 |
| 71 // Render the background for the provided view | 71 // Render the background for the provided view |
| 72 virtual void Paint(gfx::Canvas* canvas, View* view) const = 0; | 72 virtual void Paint(gfx::CanvasSkia* canvas, View* view) const = 0; |
| 73 | 73 |
| 74 // Set a solid, opaque color to be used when drawing backgrounds of native | 74 // Set a solid, opaque color to be used when drawing backgrounds of native |
| 75 // controls. Unfortunately alpha=0 is not an option. | 75 // controls. Unfortunately alpha=0 is not an option. |
| 76 void SetNativeControlColor(SkColor color); | 76 void SetNativeControlColor(SkColor color); |
| 77 | 77 |
| 78 // Returns the "background color". This is equivalent to the color set in | 78 // Returns the "background color". This is equivalent to the color set in |
| 79 // SetNativeControlColor(). For solid backgrounds, this is the color; for | 79 // SetNativeControlColor(). For solid backgrounds, this is the color; for |
| 80 // gradient backgrounds, it's the midpoint of the gradient; for painter | 80 // gradient backgrounds, it's the midpoint of the gradient; for painter |
| 81 // backgrounds, this is not useful (returns a default color). | 81 // backgrounds, this is not useful (returns a default color). |
| 82 SkColor get_color() const { return color_; } | 82 SkColor get_color() const { return color_; } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 94 // TODO(port): Create portable replacement for HBRUSH. | 94 // TODO(port): Create portable replacement for HBRUSH. |
| 95 mutable HBRUSH native_control_brush_; | 95 mutable HBRUSH native_control_brush_; |
| 96 #endif // defined(OS_WIN) | 96 #endif // defined(OS_WIN) |
| 97 | 97 |
| 98 DISALLOW_COPY_AND_ASSIGN(Background); | 98 DISALLOW_COPY_AND_ASSIGN(Background); |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 } // namespace views | 101 } // namespace views |
| 102 | 102 |
| 103 #endif // UI_VIEWS_BACKGROUND_H_ | 103 #endif // UI_VIEWS_BACKGROUND_H_ |
| OLD | NEW |