OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 12 matching lines...) Expand all Loading... |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef ScrollbarTheme_h | 26 #ifndef ScrollbarTheme_h |
27 #define ScrollbarTheme_h | 27 #define ScrollbarTheme_h |
28 | 28 |
29 #include "platform/PlatformExport.h" | 29 #include "platform/PlatformExport.h" |
30 #include "platform/geometry/IntRect.h" | 30 #include "platform/geometry/IntRect.h" |
31 #include "platform/graphics/paint/DisplayItem.h" | 31 #include "platform/graphics/paint/DisplayItem.h" |
32 #include "platform/scroll/ScrollTypes.h" | 32 #include "platform/scroll/ScrollTypes.h" |
| 33 #include "platform/scroll/ScrollbarThemeClient.h" |
33 #include "public/platform/WebScrollbarButtonsPlacement.h" | 34 #include "public/platform/WebScrollbarButtonsPlacement.h" |
34 | 35 |
35 namespace blink { | 36 namespace blink { |
36 | 37 |
37 class CullRect; | 38 class CullRect; |
38 class GraphicsContext; | 39 class GraphicsContext; |
39 class PlatformMouseEvent; | 40 class PlatformMouseEvent; |
40 class ScrollbarThemeClient; | |
41 class ScrollbarThemePaintParams; | 41 class ScrollbarThemePaintParams; |
42 | 42 |
43 class PLATFORM_EXPORT ScrollbarTheme { | 43 class PLATFORM_EXPORT ScrollbarTheme { |
44 WTF_MAKE_NONCOPYABLE(ScrollbarTheme); USING_FAST_MALLOC(ScrollbarTheme); | 44 WTF_MAKE_NONCOPYABLE(ScrollbarTheme); USING_FAST_MALLOC(ScrollbarTheme); |
45 public: | 45 public: |
46 ScrollbarTheme() { } | 46 ScrollbarTheme() { } |
47 virtual ~ScrollbarTheme() { } | 47 virtual ~ScrollbarTheme() { } |
48 | 48 |
49 // If true, then scrollbars with this theme will be painted every time | 49 // If true, then scrollbars with this theme will be painted every time |
50 // Scrollbar::setNeedsPaintInvalidation is called. If false, then only parts | 50 // Scrollbar::setNeedsPaintInvalidation is called. If false, then only parts |
(...skipping 27 matching lines...) Expand all Loading... |
78 } | 78 } |
79 | 79 |
80 virtual void paintScrollCorner(GraphicsContext&, const DisplayItemClient&, c
onst IntRect& cornerRect); | 80 virtual void paintScrollCorner(GraphicsContext&, const DisplayItemClient&, c
onst IntRect& cornerRect); |
81 virtual void paintTickmarks(GraphicsContext&, const ScrollbarThemeClient&, c
onst IntRect&) { } | 81 virtual void paintTickmarks(GraphicsContext&, const ScrollbarThemeClient&, c
onst IntRect&) { } |
82 | 82 |
83 virtual bool shouldCenterOnThumb(const ScrollbarThemeClient&, const Platform
MouseEvent&); | 83 virtual bool shouldCenterOnThumb(const ScrollbarThemeClient&, const Platform
MouseEvent&); |
84 virtual bool shouldSnapBackToDragOrigin(const ScrollbarThemeClient&, const P
latformMouseEvent&); | 84 virtual bool shouldSnapBackToDragOrigin(const ScrollbarThemeClient&, const P
latformMouseEvent&); |
85 virtual bool shouldDragDocumentInsteadOfThumb(const ScrollbarThemeClient&, c
onst PlatformMouseEvent&) { return false; } | 85 virtual bool shouldDragDocumentInsteadOfThumb(const ScrollbarThemeClient&, c
onst PlatformMouseEvent&) { return false; } |
86 | 86 |
87 // The position of the thumb relative to the track. | 87 // The position of the thumb relative to the track. |
88 virtual int thumbPosition(const ScrollbarThemeClient&); | 88 int thumbPosition(const ScrollbarThemeClient& scrollbar) { return thumbPosit
ion(scrollbar, scrollbar.currentPos()); } |
| 89 // The position the thumb would have, relative to the track, at the specifie
d scroll position. |
| 90 virtual int thumbPosition(const ScrollbarThemeClient&, float scrollPosition)
; |
89 // The length of the thumb along the axis of the scrollbar. | 91 // The length of the thumb along the axis of the scrollbar. |
90 virtual int thumbLength(const ScrollbarThemeClient&); | 92 virtual int thumbLength(const ScrollbarThemeClient&); |
91 // The position of the track relative to the scrollbar. | 93 // The position of the track relative to the scrollbar. |
92 virtual int trackPosition(const ScrollbarThemeClient&); | 94 virtual int trackPosition(const ScrollbarThemeClient&); |
93 // The length of the track along the axis of the scrollbar. | 95 // The length of the track along the axis of the scrollbar. |
94 virtual int trackLength(const ScrollbarThemeClient&); | 96 virtual int trackLength(const ScrollbarThemeClient&); |
95 // The opacity to be applied to the thumb. | 97 // The opacity to be applied to the thumb. |
96 virtual float thumbOpacity(const ScrollbarThemeClient&) const { return 1.0f;
} | 98 virtual float thumbOpacity(const ScrollbarThemeClient&) const { return 1.0f;
} |
97 | 99 |
98 virtual bool hasButtons(const ScrollbarThemeClient&) = 0; | 100 virtual bool hasButtons(const ScrollbarThemeClient&) = 0; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 static DisplayItem::Type buttonPartToDisplayItemType(ScrollbarPart); | 137 static DisplayItem::Type buttonPartToDisplayItemType(ScrollbarPart); |
136 static DisplayItem::Type trackPiecePartToDisplayItemType(ScrollbarPart); | 138 static DisplayItem::Type trackPiecePartToDisplayItemType(ScrollbarPart); |
137 | 139 |
138 private: | 140 private: |
139 static ScrollbarTheme& nativeTheme(); // Must be implemented to return the c
orrect theme subclass. | 141 static ScrollbarTheme& nativeTheme(); // Must be implemented to return the c
orrect theme subclass. |
140 static bool gMockScrollbarsEnabled; | 142 static bool gMockScrollbarsEnabled; |
141 }; | 143 }; |
142 | 144 |
143 } | 145 } |
144 #endif | 146 #endif |
OLD | NEW |