| 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 #include "ui/native_theme/native_theme_win.h" | 5 #include "ui/native_theme/native_theme_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <uxtheme.h> | 9 #include <uxtheme.h> |
| 10 #include <vsstyle.h> | 10 #include <vsstyle.h> |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 186 |
| 187 // static | 187 // static |
| 188 NativeThemeWin* NativeThemeWin::instance() { | 188 NativeThemeWin* NativeThemeWin::instance() { |
| 189 CR_DEFINE_STATIC_LOCAL(NativeThemeWin, s_native_theme, ()); | 189 CR_DEFINE_STATIC_LOCAL(NativeThemeWin, s_native_theme, ()); |
| 190 return &s_native_theme; | 190 return &s_native_theme; |
| 191 } | 191 } |
| 192 | 192 |
| 193 gfx::Size NativeThemeWin::GetPartSize(Part part, | 193 gfx::Size NativeThemeWin::GetPartSize(Part part, |
| 194 State state, | 194 State state, |
| 195 const ExtraParams& extra) const { | 195 const ExtraParams& extra) const { |
| 196 gfx::Size part_size = CommonThemeGetPartSize(part, state, extra); | |
| 197 if (!part_size.IsEmpty()) | |
| 198 return part_size; | |
| 199 | |
| 200 // The GetThemePartSize call below returns the default size without | 196 // The GetThemePartSize call below returns the default size without |
| 201 // accounting for user customization (crbug/218291). | 197 // accounting for user customization (crbug/218291). |
| 202 switch (part) { | 198 switch (part) { |
| 203 case kScrollbarDownArrow: | 199 case kScrollbarDownArrow: |
| 204 case kScrollbarLeftArrow: | 200 case kScrollbarLeftArrow: |
| 205 case kScrollbarRightArrow: | 201 case kScrollbarRightArrow: |
| 206 case kScrollbarUpArrow: | 202 case kScrollbarUpArrow: |
| 207 case kScrollbarHorizontalThumb: | 203 case kScrollbarHorizontalThumb: |
| 208 case kScrollbarVerticalThumb: | 204 case kScrollbarVerticalThumb: |
| 209 case kScrollbarHorizontalTrack: | 205 case kScrollbarHorizontalTrack: |
| (...skipping 25 matching lines...) Expand all Loading... |
| 235 | 231 |
| 236 void NativeThemeWin::Paint(SkCanvas* canvas, | 232 void NativeThemeWin::Paint(SkCanvas* canvas, |
| 237 Part part, | 233 Part part, |
| 238 State state, | 234 State state, |
| 239 const gfx::Rect& rect, | 235 const gfx::Rect& rect, |
| 240 const ExtraParams& extra) const { | 236 const ExtraParams& extra) const { |
| 241 if (rect.IsEmpty()) | 237 if (rect.IsEmpty()) |
| 242 return; | 238 return; |
| 243 | 239 |
| 244 switch (part) { | 240 switch (part) { |
| 245 case kComboboxArrow: | |
| 246 CommonThemePaintComboboxArrow(canvas, rect); | |
| 247 return; | |
| 248 case kMenuPopupGutter: | 241 case kMenuPopupGutter: |
| 249 PaintMenuGutter(canvas, rect); | 242 PaintMenuGutter(canvas, rect); |
| 250 return; | 243 return; |
| 251 case kMenuPopupSeparator: | 244 case kMenuPopupSeparator: |
| 252 PaintMenuSeparator(canvas, rect); | 245 PaintMenuSeparator(canvas, rect); |
| 253 return; | 246 return; |
| 254 case kMenuPopupBackground: | 247 case kMenuPopupBackground: |
| 255 PaintMenuBackground(canvas, rect); | 248 PaintMenuBackground(canvas, rect); |
| 256 return; | 249 return; |
| 257 case kMenuItemBackground: | 250 case kMenuItemBackground: |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 case kTextField: | 450 case kTextField: |
| 458 PaintTextField(hdc, part, state, rect, extra.text_field); | 451 PaintTextField(hdc, part, state, rect, extra.text_field); |
| 459 return; | 452 return; |
| 460 case kTrackbarThumb: | 453 case kTrackbarThumb: |
| 461 case kTrackbarTrack: | 454 case kTrackbarTrack: |
| 462 PaintTrackbar(canvas, hdc, part, state, rect, extra.trackbar); | 455 PaintTrackbar(canvas, hdc, part, state, rect, extra.trackbar); |
| 463 return; | 456 return; |
| 464 case kWindowResizeGripper: | 457 case kWindowResizeGripper: |
| 465 PaintWindowResizeGripper(hdc, rect); | 458 PaintWindowResizeGripper(hdc, rect); |
| 466 return; | 459 return; |
| 467 case kComboboxArrow: | |
| 468 case kSliderTrack: | 460 case kSliderTrack: |
| 469 case kSliderThumb: | 461 case kSliderThumb: |
| 470 case kMaxPart: | 462 case kMaxPart: |
| 471 NOTREACHED(); | 463 NOTREACHED(); |
| 472 } | 464 } |
| 473 } | 465 } |
| 474 | 466 |
| 475 SkColor NativeThemeWin::GetSystemColor(ColorId color_id) const { | 467 SkColor NativeThemeWin::GetSystemColor(ColorId color_id) const { |
| 476 // TODO: Obtain the correct colors using GetSysColor. | 468 // TODO: Obtain the correct colors using GetSysColor. |
| 477 const SkColor kUrlTextColor = SkColorSetRGB(0x0b, 0x80, 0x43); | 469 const SkColor kUrlTextColor = SkColorSetRGB(0x0b, 0x80, 0x43); |
| (...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1701 case kScrollbarHorizontalTrack: | 1693 case kScrollbarHorizontalTrack: |
| 1702 case kScrollbarVerticalTrack: | 1694 case kScrollbarVerticalTrack: |
| 1703 return SCROLLBAR; | 1695 return SCROLLBAR; |
| 1704 case kSliderTrack: | 1696 case kSliderTrack: |
| 1705 case kSliderThumb: | 1697 case kSliderThumb: |
| 1706 return TRACKBAR; | 1698 return TRACKBAR; |
| 1707 case kTextField: | 1699 case kTextField: |
| 1708 return TEXTFIELD; | 1700 return TEXTFIELD; |
| 1709 case kWindowResizeGripper: | 1701 case kWindowResizeGripper: |
| 1710 return STATUS; | 1702 return STATUS; |
| 1711 case kComboboxArrow: | |
| 1712 case kMenuCheckBackground: | 1703 case kMenuCheckBackground: |
| 1713 case kMenuPopupBackground: | 1704 case kMenuPopupBackground: |
| 1714 case kMenuItemBackground: | 1705 case kMenuItemBackground: |
| 1715 case kScrollbarHorizontalGripper: | 1706 case kScrollbarHorizontalGripper: |
| 1716 case kScrollbarVerticalGripper: | 1707 case kScrollbarVerticalGripper: |
| 1717 case kScrollbarCorner: | 1708 case kScrollbarCorner: |
| 1718 case kTabPanelBackground: | 1709 case kTabPanelBackground: |
| 1719 case kTrackbarThumb: | 1710 case kTrackbarThumb: |
| 1720 case kTrackbarTrack: | 1711 case kTrackbarTrack: |
| 1721 case kMaxPart: | 1712 case kMaxPart: |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1747 case kScrollbarLeftArrow: | 1738 case kScrollbarLeftArrow: |
| 1748 case kScrollbarRightArrow: | 1739 case kScrollbarRightArrow: |
| 1749 case kScrollbarUpArrow: | 1740 case kScrollbarUpArrow: |
| 1750 return SBP_ARROWBTN; | 1741 return SBP_ARROWBTN; |
| 1751 case kScrollbarHorizontalThumb: | 1742 case kScrollbarHorizontalThumb: |
| 1752 return SBP_THUMBBTNHORZ; | 1743 return SBP_THUMBBTNHORZ; |
| 1753 case kScrollbarVerticalThumb: | 1744 case kScrollbarVerticalThumb: |
| 1754 return SBP_THUMBBTNVERT; | 1745 return SBP_THUMBBTNVERT; |
| 1755 case kWindowResizeGripper: | 1746 case kWindowResizeGripper: |
| 1756 return SP_GRIPPER; | 1747 return SP_GRIPPER; |
| 1757 case kComboboxArrow: | |
| 1758 case kInnerSpinButton: | 1748 case kInnerSpinButton: |
| 1759 case kMenuList: | 1749 case kMenuList: |
| 1760 case kMenuCheckBackground: | 1750 case kMenuCheckBackground: |
| 1761 case kMenuPopupBackground: | 1751 case kMenuPopupBackground: |
| 1762 case kMenuItemBackground: | 1752 case kMenuItemBackground: |
| 1763 case kProgressBar: | 1753 case kProgressBar: |
| 1764 case kScrollbarHorizontalTrack: | 1754 case kScrollbarHorizontalTrack: |
| 1765 case kScrollbarVerticalTrack: | 1755 case kScrollbarVerticalTrack: |
| 1766 case kScrollbarHorizontalGripper: | 1756 case kScrollbarHorizontalGripper: |
| 1767 case kScrollbarVerticalGripper: | 1757 case kScrollbarVerticalGripper: |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1941 switch (state) { | 1931 switch (state) { |
| 1942 case kDisabled: | 1932 case kDisabled: |
| 1943 case kHovered: | 1933 case kHovered: |
| 1944 case kNormal: | 1934 case kNormal: |
| 1945 case kPressed: | 1935 case kPressed: |
| 1946 return 1; // gripper has no windows state | 1936 return 1; // gripper has no windows state |
| 1947 case kNumStates: | 1937 case kNumStates: |
| 1948 NOTREACHED(); | 1938 NOTREACHED(); |
| 1949 return 0; | 1939 return 0; |
| 1950 } | 1940 } |
| 1951 case kComboboxArrow: | |
| 1952 case kInnerSpinButton: | 1941 case kInnerSpinButton: |
| 1953 case kMenuList: | 1942 case kMenuList: |
| 1954 case kMenuCheckBackground: | 1943 case kMenuCheckBackground: |
| 1955 case kMenuPopupBackground: | 1944 case kMenuPopupBackground: |
| 1956 case kMenuItemBackground: | 1945 case kMenuItemBackground: |
| 1957 case kProgressBar: | 1946 case kProgressBar: |
| 1958 case kScrollbarHorizontalTrack: | 1947 case kScrollbarHorizontalTrack: |
| 1959 case kScrollbarVerticalTrack: | 1948 case kScrollbarVerticalTrack: |
| 1960 case kScrollbarHorizontalGripper: | 1949 case kScrollbarHorizontalGripper: |
| 1961 case kScrollbarVerticalGripper: | 1950 case kScrollbarVerticalGripper: |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2083 break; | 2072 break; |
| 2084 case LAST: | 2073 case LAST: |
| 2085 NOTREACHED(); | 2074 NOTREACHED(); |
| 2086 break; | 2075 break; |
| 2087 } | 2076 } |
| 2088 theme_handles_[theme_name] = handle; | 2077 theme_handles_[theme_name] = handle; |
| 2089 return handle; | 2078 return handle; |
| 2090 } | 2079 } |
| 2091 | 2080 |
| 2092 } // namespace ui | 2081 } // namespace ui |
| OLD | NEW |