OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 16 matching lines...) Expand all Loading... | |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef WebScrollbar_h | 31 #ifndef WebScrollbar_h |
32 #define WebScrollbar_h | 32 #define WebScrollbar_h |
33 | 33 |
34 #include "WebCanvas.h" | 34 #include "WebCanvas.h" |
35 #include "WebCommon.h" | 35 #include "WebCommon.h" |
36 | 36 |
37 // TODO(jam): take this out once Chrome rolls this revision of WebKit. | |
38 #define WEBSCROLLBAR_SUPPORTS_OVERLAY | |
39 | |
37 namespace WebKit { | 40 namespace WebKit { |
38 | 41 |
39 class WebInputEvent; | 42 class WebInputEvent; |
43 class WebPluginContainer; | |
40 class WebScrollbarClient; | 44 class WebScrollbarClient; |
41 struct WebRect; | 45 struct WebRect; |
42 | 46 |
43 class WebScrollbar { | 47 class WebScrollbar { |
44 public: | 48 public: |
45 enum Orientation { | 49 enum Orientation { |
46 Horizontal, | 50 Horizontal, |
47 Vertical | 51 Vertical |
48 }; | 52 }; |
49 | 53 |
50 enum ScrollDirection { | 54 enum ScrollDirection { |
51 ScrollBackward, | 55 ScrollBackward, |
52 ScrollForward | 56 ScrollForward |
53 }; | 57 }; |
54 | 58 |
55 enum ScrollGranularity { | 59 enum ScrollGranularity { |
56 ScrollByLine, | 60 ScrollByLine, |
57 ScrollByPage, | 61 ScrollByPage, |
58 ScrollByDocument, | 62 ScrollByDocument, |
59 ScrollByPixel | 63 ScrollByPixel |
60 }; | 64 }; |
61 | 65 |
62 // Creates a WebScrollbar. | 66 // Creates a WebScrollbar for use by a plugin. The plugin container and |
63 WEBKIT_EXPORT static WebScrollbar* create(WebScrollbarClient*, Orientation); | 67 // client are guaranteed to outlive this object. |
68 WEBKIT_EXPORT static WebScrollbar* create(Orientation, | |
darin (slow to review)
2011/08/10 18:00:34
nit: Let's call this createForPlugin just to be a
| |
69 WebPluginContainer*, | |
70 WebScrollbarClient*); | |
64 | 71 |
65 virtual ~WebScrollbar() {} | 72 virtual ~WebScrollbar() {} |
66 | 73 |
67 // Gets the thickness of the scrollbar in pixels. | 74 // Gets the thickness of the scrollbar in pixels. |
68 WEBKIT_EXPORT static int defaultThickness(); | 75 WEBKIT_EXPORT static int defaultThickness(); |
69 | 76 |
77 // Return true if this is an overlay scrollbar. | |
78 virtual bool isOverlay() = 0; | |
darin (slow to review)
2011/08/10 18:00:34
can this be a const method? (like value())
| |
79 | |
70 // Sets the rectangle of the scrollbar. | 80 // Sets the rectangle of the scrollbar. |
71 virtual void setLocation(const WebRect&) = 0; | 81 virtual void setLocation(const WebRect&) = 0; |
72 | 82 |
73 // Gets the current value (i.e. position inside the region). | 83 // Gets the current value (i.e. position inside the region). |
74 virtual int value() const = 0; | 84 virtual int value() const = 0; |
75 | 85 |
76 // Sets the current value. | 86 // Sets the current value. |
77 virtual void setValue(int position) = 0; | 87 virtual void setValue(int position) = 0; |
78 | 88 |
79 // Sets the size of the scrollable region in pixels. i.e. if a document is | 89 // Sets the size of the scrollable region in pixels. i.e. if a document is |
80 // 800x10000 pixels and the viewport is 1000x1000 pixels, then setLocation | 90 // 800x10000 pixels and the viewport is 1000x1000 pixels, then setLocation |
81 // for the vertical scrollbar would have passed in a rectangle like: | 91 // for the vertical scrollbar would have passed in a rectangle like: |
82 // (800 - defaultThickness(), 0) (defaultThickness() x 10000) | 92 // (800 - defaultThickness(), 0) (defaultThickness() x 10000) |
83 // and setDocumentSize(10000) | 93 // and setDocumentSize(10000) |
84 virtual void setDocumentSize(int size) = 0; | 94 virtual void setDocumentSize(int size) = 0; |
85 | 95 |
86 // Scroll back or forward with the given granularity. | 96 // Scroll back or forward with the given granularity. |
87 virtual void scroll(ScrollDirection, ScrollGranularity, float multiplier) = 0; | 97 virtual void scroll(ScrollDirection, ScrollGranularity, float multiplier) = 0; |
88 | 98 |
89 // Paint the given rectangle. | 99 // Paint the given rectangle. |
90 virtual void paint(WebCanvas*, const WebRect&) = 0; | 100 virtual void paint(WebCanvas*, const WebRect&) = 0; |
91 | 101 |
92 // Returns true iff the given event was used. | 102 // Returns true iff the given event was used. |
93 virtual bool handleInputEvent(const WebInputEvent&) = 0; | 103 virtual bool handleInputEvent(const WebInputEvent&) = 0; |
94 }; | 104 }; |
95 | 105 |
96 } // namespace WebKit | 106 } // namespace WebKit |
97 | 107 |
98 #endif | 108 #endif |
OLD | NEW |