| OLD | NEW |
| 1 // Copyright (c) 2012 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_NATIVE_THEME_NATIVE_THEME_WIN_H_ | 5 #ifndef UI_NATIVE_THEME_NATIVE_THEME_WIN_H_ |
| 6 #define UI_NATIVE_THEME_NATIVE_THEME_WIN_H_ | 6 #define UI_NATIVE_THEME_NATIVE_THEME_WIN_H_ |
| 7 | 7 |
| 8 // A wrapper class for working with custom XP/Vista themes provided in | 8 // A wrapper class for working with custom XP/Vista themes provided in |
| 9 // uxtheme.dll. This is a singleton class that can be grabbed using | 9 // uxtheme.dll. This is a singleton class that can be grabbed using |
| 10 // NativeThemeWin::instance(). | 10 // NativeThemeWin::instance(). |
| 11 // For more information on visual style parts and states, see: | 11 // For more information on visual style parts and states, see: |
| 12 // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/plat
form/commctls/userex/topics/partsandstates.asp | 12 // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/plat
form/commctls/userex/topics/partsandstates.asp |
| 13 | 13 |
| 14 #include <map> |
| 14 #include <windows.h> | 15 #include <windows.h> |
| 15 #include <uxtheme.h> | 16 #include <uxtheme.h> |
| 16 | 17 |
| 17 #include "base/basictypes.h" | 18 #include "base/basictypes.h" |
| 18 #include "base/compiler_specific.h" | 19 #include "base/compiler_specific.h" |
| 19 #include "third_party/skia/include/core/SkColor.h" | 20 #include "third_party/skia/include/core/SkColor.h" |
| 20 #include "ui/gfx/size.h" | 21 #include "ui/gfx/size.h" |
| 21 #include "ui/native_theme/native_theme.h" | 22 #include "ui/native_theme/native_theme.h" |
| 22 | 23 |
| 23 class SkCanvas; | 24 class SkCanvas; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 90 |
| 90 HRESULT PaintTextField(HDC hdc, | 91 HRESULT PaintTextField(HDC hdc, |
| 91 int part_id, | 92 int part_id, |
| 92 int state_id, | 93 int state_id, |
| 93 int classic_state, | 94 int classic_state, |
| 94 RECT* rect, | 95 RECT* rect, |
| 95 COLORREF color, | 96 COLORREF color, |
| 96 bool fill_content_area, | 97 bool fill_content_area, |
| 97 bool draw_edges) const; | 98 bool draw_edges) const; |
| 98 | 99 |
| 99 // NativeTheme Implementation: | 100 // NativeTheme implementation: |
| 100 virtual gfx::Size GetPartSize(Part part, | 101 virtual gfx::Size GetPartSize(Part part, |
| 101 State state, | 102 State state, |
| 102 const ExtraParams& extra) const OVERRIDE; | 103 const ExtraParams& extra) const OVERRIDE; |
| 103 virtual void Paint(SkCanvas* canvas, | 104 virtual void Paint(SkCanvas* canvas, |
| 104 Part part, | 105 Part part, |
| 105 State state, | 106 State state, |
| 106 const gfx::Rect& rect, | 107 const gfx::Rect& rect, |
| 107 const ExtraParams& extra) const OVERRIDE; | 108 const ExtraParams& extra) const OVERRIDE; |
| 108 virtual SkColor GetSystemColor(ColorId color_id) const OVERRIDE; | 109 virtual SkColor GetSystemColor(ColorId color_id) const OVERRIDE; |
| 109 | 110 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 typedef HRESULT (WINAPI* CloseThemeDataPtr)(HANDLE theme); | 308 typedef HRESULT (WINAPI* CloseThemeDataPtr)(HANDLE theme); |
| 308 | 309 |
| 309 typedef void (WINAPI* SetThemeAppPropertiesPtr) (DWORD flags); | 310 typedef void (WINAPI* SetThemeAppPropertiesPtr) (DWORD flags); |
| 310 typedef BOOL (WINAPI* IsThemeActivePtr)(); | 311 typedef BOOL (WINAPI* IsThemeActivePtr)(); |
| 311 typedef HRESULT (WINAPI* GetThemeIntPtr)(HANDLE hTheme, | 312 typedef HRESULT (WINAPI* GetThemeIntPtr)(HANDLE hTheme, |
| 312 int part_id, | 313 int part_id, |
| 313 int state_id, | 314 int state_id, |
| 314 int prop_id, | 315 int prop_id, |
| 315 int *value); | 316 int *value); |
| 316 | 317 |
| 318 // gfx::SysColorChangeListener implementation: |
| 319 virtual void OnSysColorChange() OVERRIDE; |
| 320 |
| 317 // Function pointers into uxtheme.dll. | 321 // Function pointers into uxtheme.dll. |
| 318 DrawThemeBackgroundPtr draw_theme_; | 322 DrawThemeBackgroundPtr draw_theme_; |
| 319 DrawThemeBackgroundExPtr draw_theme_ex_; | 323 DrawThemeBackgroundExPtr draw_theme_ex_; |
| 320 GetThemeColorPtr get_theme_color_; | 324 GetThemeColorPtr get_theme_color_; |
| 321 GetThemeContentRectPtr get_theme_content_rect_; | 325 GetThemeContentRectPtr get_theme_content_rect_; |
| 322 GetThemePartSizePtr get_theme_part_size_; | 326 GetThemePartSizePtr get_theme_part_size_; |
| 323 OpenThemeDataPtr open_theme_; | 327 OpenThemeDataPtr open_theme_; |
| 324 CloseThemeDataPtr close_theme_; | 328 CloseThemeDataPtr close_theme_; |
| 325 SetThemeAppPropertiesPtr set_theme_properties_; | 329 SetThemeAppPropertiesPtr set_theme_properties_; |
| 326 IsThemeActivePtr is_theme_active_; | 330 IsThemeActivePtr is_theme_active_; |
| 327 GetThemeIntPtr get_theme_int_; | 331 GetThemeIntPtr get_theme_int_; |
| 328 | 332 |
| 329 // Handle to uxtheme.dll. | 333 // Handle to uxtheme.dll. |
| 330 HMODULE theme_dll_; | 334 HMODULE theme_dll_; |
| 331 | 335 |
| 332 // A cache of open theme handles. | 336 // A cache of open theme handles. |
| 333 mutable HANDLE theme_handles_[LAST]; | 337 mutable HANDLE theme_handles_[LAST]; |
| 334 | 338 |
| 339 // A map of cached and updated system colors. |
| 340 mutable std::map<int, SkColor> system_colors_; |
| 341 |
| 335 DISALLOW_COPY_AND_ASSIGN(NativeThemeWin); | 342 DISALLOW_COPY_AND_ASSIGN(NativeThemeWin); |
| 336 }; | 343 }; |
| 337 | 344 |
| 338 } // namespace ui | 345 } // namespace ui |
| 339 | 346 |
| 340 #endif // UI_NATIVE_THEME_NATIVE_THEME_WIN_H_ | 347 #endif // UI_NATIVE_THEME_NATIVE_THEME_WIN_H_ |
| OLD | NEW |