OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006 Apple Computer, 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 class PLATFORM_EXPORT Scrollbar : public Widget, | 46 class PLATFORM_EXPORT Scrollbar : public Widget, |
47 public ScrollbarThemeClient { | 47 public ScrollbarThemeClient { |
48 | 48 |
49 public: | 49 public: |
50 static PassRefPtr<Scrollbar> create(ScrollableArea*, ScrollbarOrientation, S
crollbarControlSize); | 50 static PassRefPtr<Scrollbar> create(ScrollableArea*, ScrollbarOrientation, S
crollbarControlSize); |
51 | 51 |
52 virtual ~Scrollbar(); | 52 virtual ~Scrollbar(); |
53 | 53 |
54 // ScrollbarThemeClient implementation. | 54 // ScrollbarThemeClient implementation. |
55 virtual int x() const { return Widget::x(); } | 55 virtual int x() const OVERRIDE { return Widget::x(); } |
56 virtual int y() const { return Widget::y(); } | 56 virtual int y() const OVERRIDE { return Widget::y(); } |
57 virtual int width() const { return Widget::width(); } | 57 virtual int width() const OVERRIDE { return Widget::width(); } |
58 virtual int height() const { return Widget::height(); } | 58 virtual int height() const OVERRIDE { return Widget::height(); } |
59 virtual IntSize size() const { return Widget::size(); } | 59 virtual IntSize size() const OVERRIDE { return Widget::size(); } |
60 virtual IntPoint location() const { return Widget::location(); } | 60 virtual IntPoint location() const OVERRIDE { return Widget::location(); } |
61 | 61 |
62 virtual Widget* parent() const { return Widget::parent(); } | 62 virtual Widget* parent() const OVERRIDE { return Widget::parent(); } |
63 virtual Widget* root() const { return Widget::root(); } | 63 virtual Widget* root() const OVERRIDE { return Widget::root(); } |
64 | 64 |
65 void removeFromParent(); | 65 void removeFromParent(); |
66 ScrollView* parentScrollView() const; | 66 ScrollView* parentScrollView() const; |
67 ScrollView* rootScrollView() const; | 67 ScrollView* rootScrollView() const; |
68 | 68 |
69 virtual void setFrameRect(const IntRect&); | 69 virtual void setFrameRect(const IntRect&) OVERRIDE; |
70 virtual IntRect frameRect() const { return Widget::frameRect(); } | 70 virtual IntRect frameRect() const OVERRIDE { return Widget::frameRect(); } |
71 | 71 |
72 virtual void invalidate() { Widget::invalidate(); } | 72 virtual void invalidate() OVERRIDE { Widget::invalidate(); } |
73 virtual void invalidateRect(const IntRect&); | 73 virtual void invalidateRect(const IntRect&) OVERRIDE; |
74 | 74 |
75 virtual ScrollbarOverlayStyle scrollbarOverlayStyle() const; | 75 virtual ScrollbarOverlayStyle scrollbarOverlayStyle() const OVERRIDE; |
76 virtual void getTickmarks(Vector<IntRect>&) const; | 76 virtual void getTickmarks(Vector<IntRect>&) const OVERRIDE; |
77 virtual bool isScrollableAreaActive() const; | 77 virtual bool isScrollableAreaActive() const OVERRIDE; |
78 virtual bool isScrollViewScrollbar() const; | 78 virtual bool isScrollViewScrollbar() const OVERRIDE; |
79 | 79 |
80 virtual IntPoint convertFromContainingWindow(const IntPoint& windowPoint) {
return Widget::convertFromContainingWindow(windowPoint); } | 80 virtual IntPoint convertFromContainingWindow(const IntPoint& windowPoint) OV
ERRIDE { return Widget::convertFromContainingWindow(windowPoint); } |
81 | 81 |
82 virtual bool isCustomScrollbar() const { return false; } | 82 virtual bool isCustomScrollbar() const OVERRIDE { return false; } |
83 virtual ScrollbarOrientation orientation() const { return m_orientation; } | 83 virtual ScrollbarOrientation orientation() const OVERRIDE { return m_orienta
tion; } |
84 virtual bool isLeftSideVerticalScrollbar() const; | 84 virtual bool isLeftSideVerticalScrollbar() const OVERRIDE; |
85 | 85 |
86 virtual int value() const { return lroundf(m_currentPos); } | 86 virtual int value() const OVERRIDE { return lroundf(m_currentPos); } |
87 virtual float currentPos() const { return m_currentPos; } | 87 virtual float currentPos() const OVERRIDE { return m_currentPos; } |
88 virtual int visibleSize() const { return m_visibleSize; } | 88 virtual int visibleSize() const OVERRIDE { return m_visibleSize; } |
89 virtual int totalSize() const { return m_totalSize; } | 89 virtual int totalSize() const OVERRIDE { return m_totalSize; } |
90 virtual int maximum() const { return m_totalSize - m_visibleSize; } | 90 virtual int maximum() const OVERRIDE { return m_totalSize - m_visibleSize; } |
91 virtual ScrollbarControlSize controlSize() const { return m_controlSize; } | 91 virtual ScrollbarControlSize controlSize() const OVERRIDE { return m_control
Size; } |
92 | 92 |
93 virtual ScrollbarPart pressedPart() const { return m_pressedPart; } | 93 virtual ScrollbarPart pressedPart() const OVERRIDE { return m_pressedPart; } |
94 virtual ScrollbarPart hoveredPart() const { return m_hoveredPart; } | 94 virtual ScrollbarPart hoveredPart() const OVERRIDE { return m_hoveredPart; } |
95 | 95 |
96 virtual void styleChanged() { } | 96 virtual void styleChanged() OVERRIDE { } |
97 | 97 |
98 virtual bool enabled() const { return m_enabled; } | 98 virtual bool enabled() const OVERRIDE { return m_enabled; } |
99 virtual void setEnabled(bool); | 99 virtual void setEnabled(bool) OVERRIDE; |
100 | 100 |
101 // Called by the ScrollableArea when the scroll offset changes. | 101 // Called by the ScrollableArea when the scroll offset changes. |
102 void offsetDidChange(); | 102 void offsetDidChange(); |
103 | 103 |
104 void disconnectFromScrollableArea() { m_scrollableArea = 0; } | 104 void disconnectFromScrollableArea() { m_scrollableArea = 0; } |
105 ScrollableArea* scrollableArea() const { return m_scrollableArea; } | 105 ScrollableArea* scrollableArea() const { return m_scrollableArea; } |
106 | 106 |
107 int pressedPos() const { return m_pressedPos; } | 107 int pressedPos() const { return m_pressedPos; } |
108 | 108 |
109 virtual void setHoveredPart(ScrollbarPart); | 109 virtual void setHoveredPart(ScrollbarPart); |
110 virtual void setPressedPart(ScrollbarPart); | 110 virtual void setPressedPart(ScrollbarPart); |
111 | 111 |
112 void setProportion(int visibleSize, int totalSize); | 112 void setProportion(int visibleSize, int totalSize); |
113 void setPressedPos(int p) { m_pressedPos = p; } | 113 void setPressedPos(int p) { m_pressedPos = p; } |
114 | 114 |
115 virtual void paint(GraphicsContext*, const IntRect& damageRect); | 115 virtual void paint(GraphicsContext*, const IntRect& damageRect) OVERRIDE; |
116 | 116 |
117 virtual bool isOverlayScrollbar() const; | 117 virtual bool isOverlayScrollbar() const OVERRIDE; |
118 bool shouldParticipateInHitTesting(); | 118 bool shouldParticipateInHitTesting(); |
119 | 119 |
120 bool isWindowActive() const; | 120 bool isWindowActive() const; |
121 | 121 |
122 bool gestureEvent(const PlatformGestureEvent&); | 122 bool gestureEvent(const PlatformGestureEvent&); |
123 | 123 |
124 // These methods are used for platform scrollbars to give :hover feedback.
They will not get called | 124 // These methods are used for platform scrollbars to give :hover feedback.
They will not get called |
125 // when the mouse went down in a scrollbar, since it is assumed the scrollba
r will start | 125 // when the mouse went down in a scrollbar, since it is assumed the scrollba
r will start |
126 // grabbing all events in that case anyway. | 126 // grabbing all events in that case anyway. |
127 void mouseMoved(const PlatformMouseEvent&); | 127 void mouseMoved(const PlatformMouseEvent&); |
128 void mouseEntered(); | 128 void mouseEntered(); |
129 void mouseExited(); | 129 void mouseExited(); |
130 | 130 |
131 // Used by some platform scrollbars to know when they've been released from
capture. | 131 // Used by some platform scrollbars to know when they've been released from
capture. |
132 void mouseUp(const PlatformMouseEvent&); | 132 void mouseUp(const PlatformMouseEvent&); |
133 void mouseDown(const PlatformMouseEvent&); | 133 void mouseDown(const PlatformMouseEvent&); |
134 | 134 |
135 ScrollbarTheme* theme() const { return m_theme; } | 135 ScrollbarTheme* theme() const { return m_theme; } |
136 | 136 |
137 virtual void setParent(Widget*) OVERRIDE; | 137 virtual void setParent(Widget*) OVERRIDE; |
138 | 138 |
139 bool suppressInvalidation() const { return m_suppressInvalidation; } | 139 bool suppressInvalidation() const { return m_suppressInvalidation; } |
140 void setSuppressInvalidation(bool s) { m_suppressInvalidation = s; } | 140 void setSuppressInvalidation(bool s) { m_suppressInvalidation = s; } |
141 | 141 |
142 virtual IntRect convertToContainingView(const IntRect&) const; | 142 virtual IntRect convertToContainingView(const IntRect&) const OVERRIDE; |
143 virtual IntRect convertFromContainingView(const IntRect&) const; | 143 virtual IntRect convertFromContainingView(const IntRect&) const OVERRIDE; |
144 | 144 |
145 virtual IntPoint convertToContainingView(const IntPoint&) const; | 145 virtual IntPoint convertToContainingView(const IntPoint&) const OVERRIDE; |
146 virtual IntPoint convertFromContainingView(const IntPoint&) const; | 146 virtual IntPoint convertFromContainingView(const IntPoint&) const OVERRIDE; |
147 | 147 |
148 void moveThumb(int pos, bool draggingDocument = false); | 148 void moveThumb(int pos, bool draggingDocument = false); |
149 | 149 |
150 virtual bool isAlphaLocked() const { return m_isAlphaLocked; } | 150 virtual bool isAlphaLocked() const OVERRIDE { return m_isAlphaLocked; } |
151 virtual void setIsAlphaLocked(bool flag) { m_isAlphaLocked = flag; } | 151 virtual void setIsAlphaLocked(bool flag) OVERRIDE { m_isAlphaLocked = flag;
} |
152 | 152 |
153 protected: | 153 protected: |
154 Scrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize, Scrol
lbarTheme* = 0); | 154 Scrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize, Scrol
lbarTheme* = 0); |
155 | 155 |
156 void updateThumb(); | 156 void updateThumb(); |
157 virtual void updateThumbPosition(); | 157 virtual void updateThumbPosition(); |
158 virtual void updateThumbProportion(); | 158 virtual void updateThumbProportion(); |
159 | 159 |
160 void autoscrollTimerFired(Timer<Scrollbar>*); | 160 void autoscrollTimerFired(Timer<Scrollbar>*); |
161 void startTimerIfNeeded(double delay); | 161 void startTimerIfNeeded(double delay); |
(...skipping 22 matching lines...) Expand all Loading... |
184 bool m_enabled; | 184 bool m_enabled; |
185 | 185 |
186 Timer<Scrollbar> m_scrollTimer; | 186 Timer<Scrollbar> m_scrollTimer; |
187 bool m_overlapsResizer; | 187 bool m_overlapsResizer; |
188 | 188 |
189 bool m_suppressInvalidation; | 189 bool m_suppressInvalidation; |
190 | 190 |
191 bool m_isAlphaLocked; | 191 bool m_isAlphaLocked; |
192 | 192 |
193 private: | 193 private: |
194 virtual bool isScrollbar() const { return true; } | 194 virtual bool isScrollbar() const OVERRIDE { return true; } |
195 | 195 |
196 float scrollableAreaCurrentPos() const; | 196 float scrollableAreaCurrentPos() const; |
197 }; | 197 }; |
198 | 198 |
199 DEFINE_TYPE_CASTS(Scrollbar, Widget, widget, widget->isScrollbar(), widget.isScr
ollbar()); | 199 DEFINE_TYPE_CASTS(Scrollbar, Widget, widget, widget->isScrollbar(), widget.isScr
ollbar()); |
200 | 200 |
201 } // namespace WebCore | 201 } // namespace WebCore |
202 | 202 |
203 #endif // Scrollbar_h | 203 #endif // Scrollbar_h |
OLD | NEW |