| 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 #ifndef UI_GFX_NATIVE_THEME_H_ | 5 #ifndef UI_GFX_NATIVE_THEME_H_ |
| 6 #define UI_GFX_NATIVE_THEME_H_ | 6 #define UI_GFX_NATIVE_THEME_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "third_party/skia/include/core/SkColor.h" | 9 #include "third_party/skia/include/core/SkColor.h" |
| 10 #include "ui/base/ui_export.h" | 10 #include "ui/base/ui_export.h" |
| 11 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
| 12 | 12 |
| 13 class SkCanvas; | 13 class SkCanvas; |
| 14 | 14 |
| 15 namespace gfx { | 15 namespace gfx { |
| 16 | 16 |
| 17 class Rect; | 17 class Rect; |
| 18 class Size; | 18 class Size; |
| 19 | 19 |
| 20 // This class supports drawing UI controls (like buttons, text fields, lists, | 20 // This class supports drawing UI controls (like buttons, text fields, lists, |
| 21 // comboboxes, etc) that look like the native UI controls of the underlying | 21 // comboboxes, etc) that look like the native UI controls of the underlying |
| 22 // platform, such as Windows or Linux. | 22 // platform, such as Windows or Linux. It also supplies default colors for |
| 23 // dialog box backgrounds, etc., which are obtained from the system theme where |
| 24 // possible. |
| 23 // | 25 // |
| 24 // The supported control types are listed in the Part enum. These parts can be | 26 // The supported control types are listed in the Part enum. These parts can be |
| 25 // in any state given by the State enum, where the actual definititon of the | 27 // in any state given by the State enum, where the actual definition of the |
| 26 // state is part-specific. | 28 // state is part-specific. The supported colors are listed in the ColorId enum. |
| 27 // | 29 // |
| 28 // Some parts require more information than simply the state in order to be | 30 // Some parts require more information than simply the state in order to be |
| 29 // drawn correctly, and this information is given to the Paint() method via the | 31 // drawn correctly, and this information is given to the Paint() method via the |
| 30 // ExtraParams union. Each part that requires more information has its own | 32 // ExtraParams union. Each part that requires more information has its own |
| 31 // field in the union. | 33 // field in the union. |
| 32 // | 34 // |
| 33 // NativeTheme also supports getting the default size of a given part with | 35 // NativeTheme also supports getting the default size of a given part with |
| 34 // the GetPartSize() method. | 36 // the GetPartSize() method. |
| 35 class UI_EXPORT NativeTheme { | 37 class UI_EXPORT NativeTheme { |
| 36 public: | 38 public: |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 Part part, | 207 Part part, |
| 206 State state, | 208 State state, |
| 207 const gfx::Rect& rect, | 209 const gfx::Rect& rect, |
| 208 const ExtraParams& extra) const = 0; | 210 const ExtraParams& extra) const = 0; |
| 209 | 211 |
| 210 // Supports theme specific colors. | 212 // Supports theme specific colors. |
| 211 void SetScrollbarColors(unsigned inactive_color, | 213 void SetScrollbarColors(unsigned inactive_color, |
| 212 unsigned active_color, | 214 unsigned active_color, |
| 213 unsigned track_color) const; | 215 unsigned track_color) const; |
| 214 | 216 |
| 217 // Colors for GetSystemColor(). |
| 218 enum ColorId { |
| 219 kColorId_DialogBackground |
| 220 // TODO(benrg): move other hardcoded colors here. |
| 221 }; |
| 222 |
| 223 // Return a color from the system theme. |
| 224 virtual SkColor GetSystemColor(ColorId color_id) const = 0; |
| 225 |
| 215 // Returns a shared instance of the native theme. | 226 // Returns a shared instance of the native theme. |
| 216 // The returned object should not be deleted by the caller. This function | 227 // The returned object should not be deleted by the caller. This function |
| 217 // is not thread safe and should only be called from the UI thread. | 228 // is not thread safe and should only be called from the UI thread. |
| 218 // Each port of NativeTheme should provide its own implementation of this | 229 // Each port of NativeTheme should provide its own implementation of this |
| 219 // function, returning the port's subclass. | 230 // function, returning the port's subclass. |
| 220 static const NativeTheme* instance(); | 231 static const NativeTheme* instance(); |
| 221 | 232 |
| 222 protected: | 233 protected: |
| 223 NativeTheme() {} | 234 NativeTheme() {} |
| 224 virtual ~NativeTheme() {} | 235 virtual ~NativeTheme() {} |
| 225 | 236 |
| 226 static unsigned int thumb_inactive_color_; | 237 static unsigned int thumb_inactive_color_; |
| 227 static unsigned int thumb_active_color_; | 238 static unsigned int thumb_active_color_; |
| 228 static unsigned int track_color_; | 239 static unsigned int track_color_; |
| 229 | 240 |
| 230 DISALLOW_COPY_AND_ASSIGN(NativeTheme); | 241 DISALLOW_COPY_AND_ASSIGN(NativeTheme); |
| 231 }; | 242 }; |
| 232 | 243 |
| 233 } // namespace gfx | 244 } // namespace gfx |
| 234 | 245 |
| 235 #endif // UI_GFX_NATIVE_THEME_H_ | 246 #endif // UI_GFX_NATIVE_THEME_H_ |
| OLD | NEW |