Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / ui / base / theme_provider.h
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
3 // found in the LICENSE file.
4
5 #ifndef UI_BASE_THEME_PROVIDER_H_
6 #define UI_BASE_THEME_PROVIDER_H_
7
8 #include "base/basictypes.h"
9 #include "third_party/skia/include/core/SkColor.h"
10 #include "ui/base/layout.h"
11 #include "ui/base/ui_base_export.h"
12
13 #if defined(OS_MACOSX)
14 #ifdef __OBJC__
15 @class NSColor;
16 @class NSGradient;
17 @class NSImage;
18 #else
19 class NSColor;
20 class NSGradient;
21 class NSImage;
22 #endif  // __OBJC__
23 #endif  // OS_*
24
25 class SkBitmap;
26
27 namespace base {
28 class RefCountedMemory;
29 }
30
31 namespace gfx {
32 class ImageSkia;
33 }
34
35 namespace ui {
36
37 ////////////////////////////////////////////////////////////////////////////////
38 //
39 // ThemeProvider
40 //
41 //   ThemeProvider is an abstract class that defines the API that should be
42 //   implemented to provide bitmaps and color information for a given theme.
43 //
44 ////////////////////////////////////////////////////////////////////////////////
45
46 class UI_BASE_EXPORT ThemeProvider {
47  public:
48   virtual ~ThemeProvider();
49
50   // Whether we're using the native theme (which may or may not be the
51   // same as the default theme).
52   virtual bool UsingNativeTheme() const = 0;
53
54   // Get the image specified by |id|. An implementation of ThemeProvider should
55   // have its own source of ids (e.g. an enum, or external resource bundle).
56   virtual gfx::ImageSkia* GetImageSkiaNamed(int id) const = 0;
57
58   // Get the color specified by |id|.
59   virtual SkColor GetColor(int id) const = 0;
60
61   // Get the property (e.g. an alignment expressed in an enum, or a width or
62   // height) specified by |id|.
63   virtual int GetDisplayProperty(int id) const = 0;
64
65   // Whether we should use the native system frame (typically Aero glass) or
66   // a custom frame.
67   virtual bool ShouldUseNativeFrame() const = 0;
68
69   // Whether or not we have a certain image. Used for when the default theme
70   // doesn't provide a certain image, but custom themes might (badges, etc).
71   virtual bool HasCustomImage(int id) const = 0;
72
73   // Reads the image data from the theme file into the specified vector. Only
74   // valid for un-themed resources and the themed IDR_THEME_NTP_* in most
75   // implementations of ThemeProvider. Returns NULL on error.
76   virtual base::RefCountedMemory* GetRawData(
77       int id,
78       ui::ScaleFactor scale_factor) const = 0;
79
80 #if defined(OS_MACOSX) && !defined(TOOLKIT_VIEWS)
81   // Gets the NSImage with the specified |id|.
82   virtual NSImage* GetNSImageNamed(int id) const = 0;
83
84   // Gets the NSImage that GetNSImageNamed (above) would return, but returns it
85   // as a pattern color.
86   virtual NSColor* GetNSImageColorNamed(int id) const = 0;
87
88   // Gets the NSColor with the specified |id|.
89   virtual NSColor* GetNSColor(int id) const = 0;
90
91   // Gets the NSColor for tinting with the specified |id|.
92   virtual NSColor* GetNSColorTint(int id) const = 0;
93
94   // Gets the NSGradient with the specified |id|.
95   virtual NSGradient* GetNSGradient(int id) const = 0;
96 #endif
97 };
98
99 }  // namespace ui
100
101 #endif  // UI_BASE_THEME_PROVIDER_H_