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