| 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 29 matching lines...) Expand all Loading... |
| 40 class PlatformGestureEvent; | 40 class PlatformGestureEvent; |
| 41 class PlatformMouseEvent; | 41 class PlatformMouseEvent; |
| 42 class ScrollableArea; | 42 class ScrollableArea; |
| 43 | 43 |
| 44 class PLATFORM_EXPORT Scrollbar final : public Widget { | 44 class PLATFORM_EXPORT Scrollbar final : public Widget { |
| 45 public: | 45 public: |
| 46 static PassRefPtr<Scrollbar> create(ScrollableArea*, ScrollbarOrientation); | 46 static PassRefPtr<Scrollbar> create(ScrollableArea*, ScrollbarOrientation); |
| 47 | 47 |
| 48 virtual ~Scrollbar(); | 48 virtual ~Scrollbar(); |
| 49 | 49 |
| 50 void invalidateRect(const IntRect&); | |
| 51 | |
| 52 ScrollbarOverlayStyle scrollbarOverlayStyle() const; | 50 ScrollbarOverlayStyle scrollbarOverlayStyle() const; |
| 53 bool isScrollableAreaActive() const; | 51 bool isScrollableAreaActive() const; |
| 54 | 52 |
| 55 ScrollbarOrientation orientation() const { return m_orientation; } | 53 ScrollbarOrientation orientation() const { return m_orientation; } |
| 56 bool isLeftSideVerticalScrollbar() const; | 54 bool isLeftSideVerticalScrollbar() const; |
| 57 | 55 |
| 58 int value() const { return lroundf(m_currentPos); } | 56 int value() const { return lroundf(m_currentPos); } |
| 59 float currentPos() const { return m_currentPos; } | 57 float currentPos() const { return m_currentPos; } |
| 60 int visibleSize() const { return m_visibleSize; } | 58 int visibleSize() const { return m_visibleSize; } |
| 61 int totalSize() const { return m_totalSize; } | 59 int totalSize() const { return m_totalSize; } |
| 62 int maximum() const { return m_totalSize - m_visibleSize; } | 60 int maximum() const { return m_totalSize - m_visibleSize; } |
| 63 | 61 |
| 64 ScrollbarPart pressedPart() const { return m_pressedPart; } | |
| 65 ScrollbarPart hoveredPart() const { return m_hoveredPart; } | |
| 66 | |
| 67 bool enabled() const { return m_enabled; } | 62 bool enabled() const { return m_enabled; } |
| 68 void setEnabled(bool); | 63 void setEnabled(bool); |
| 69 | 64 |
| 70 // Called by the ScrollableArea when the scroll offset changes. | 65 // Called by the ScrollableArea when the scroll offset changes. |
| 71 void offsetDidChange(); | 66 void offsetDidChange(); |
| 72 | 67 |
| 73 void disconnectFromScrollableArea() { m_scrollableArea = 0; } | 68 void disconnectFromScrollableArea() { m_scrollableArea = 0; } |
| 74 ScrollableArea* scrollableArea() const { return m_scrollableArea; } | 69 ScrollableArea* scrollableArea() const { return m_scrollableArea; } |
| 75 | 70 |
| 76 int pressedPos() const { return m_pressedPos; } | 71 int pressedPos() const { return m_pressedPos; } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 102 virtual IntRect convertToContainingView(const IntRect&) const override; | 97 virtual IntRect convertToContainingView(const IntRect&) const override; |
| 103 virtual IntRect convertFromContainingView(const IntRect&) const override; | 98 virtual IntRect convertFromContainingView(const IntRect&) const override; |
| 104 | 99 |
| 105 virtual IntPoint convertToContainingView(const IntPoint&) const override; | 100 virtual IntPoint convertToContainingView(const IntPoint&) const override; |
| 106 virtual IntPoint convertFromContainingView(const IntPoint&) const override; | 101 virtual IntPoint convertFromContainingView(const IntPoint&) const override; |
| 107 | 102 |
| 108 void moveThumb(int pos); | 103 void moveThumb(int pos); |
| 109 | 104 |
| 110 static int scrollbarThickness(); | 105 static int scrollbarThickness(); |
| 111 | 106 |
| 112 void invalidateParts() | |
| 113 { | |
| 114 invalidatePart(BackTrackPart); | |
| 115 invalidatePart(ThumbPart); | |
| 116 invalidatePart(ForwardTrackPart); | |
| 117 } | |
| 118 | |
| 119 void invalidatePart(ScrollbarPart); | |
| 120 | |
| 121 // The position of the thumb relative to the track. | 107 // The position of the thumb relative to the track. |
| 122 int thumbPosition(); | 108 int thumbPosition(); |
| 123 // The length of the thumb along the axis of the scrollbar. | 109 // The length of the thumb along the axis of the scrollbar. |
| 124 int thumbLength(); | 110 int thumbLength(); |
| 125 // The position of the track relative to the scrollbar. | 111 // The position of the track relative to the scrollbar. |
| 126 int trackPosition(); | 112 int trackPosition(); |
| 127 // The length of the track along the axis of the scrollbar. | 113 // The length of the track along the axis of the scrollbar. |
| 128 int trackLength(); | 114 int trackLength(); |
| 129 | 115 |
| 130 IntRect trackRect(); | 116 IntRect trackRect(); |
| 131 IntRect thumbRect(); | 117 IntRect thumbRect(); |
| 132 int thumbThickness(); | 118 int thumbThickness(); |
| 133 | 119 |
| 134 int minimumThumbLength(); | 120 int minimumThumbLength(); |
| 135 | 121 |
| 136 void splitTrack(const IntRect& track, IntRect& startTrack, IntRect& thumb, I
ntRect& endTrack); | 122 void splitTrack(const IntRect& track, IntRect& startTrack, IntRect& thumb, I
ntRect& endTrack); |
| 137 | 123 |
| 138 void paintThumb(GraphicsContext*, const IntRect&); | 124 void paintThumb(GraphicsContext*, const IntRect&); |
| 139 | 125 |
| 140 double initialAutoscrollTimerDelay() { return 0.25; } | 126 double initialAutoscrollTimerDelay() { return 0.25; } |
| 141 double autoscrollTimerDelay() { return 0.05; } | 127 double autoscrollTimerDelay() { return 0.05; } |
| 142 | 128 |
| 143 protected: | 129 protected: |
| 144 Scrollbar(ScrollableArea*, ScrollbarOrientation); | 130 Scrollbar(ScrollableArea*, ScrollbarOrientation); |
| 145 | 131 |
| 146 void updateThumb(); | |
| 147 | |
| 148 void autoscrollTimerFired(Timer<Scrollbar>*); | 132 void autoscrollTimerFired(Timer<Scrollbar>*); |
| 149 void startTimerIfNeeded(double delay); | 133 void startTimerIfNeeded(double delay); |
| 150 void stopTimerIfNeeded(); | 134 void stopTimerIfNeeded(); |
| 151 void autoscrollPressedPart(double delay); | 135 void autoscrollPressedPart(double delay); |
| 152 ScrollDirection pressedPartScrollDirection(); | 136 ScrollDirection pressedPartScrollDirection(); |
| 153 ScrollGranularity pressedPartScrollGranularity(); | 137 ScrollGranularity pressedPartScrollGranularity(); |
| 154 | 138 |
| 155 ScrollableArea* m_scrollableArea; | 139 ScrollableArea* m_scrollableArea; |
| 156 ScrollbarOrientation m_orientation; | 140 ScrollbarOrientation m_orientation; |
| 157 | 141 |
| 158 int m_visibleSize; | 142 int m_visibleSize; |
| 159 int m_totalSize; | 143 int m_totalSize; |
| 160 float m_currentPos; | 144 float m_currentPos; |
| 161 float m_dragOrigin; | 145 float m_dragOrigin; |
| 162 | 146 |
| 147 // FIXME(sky): Does any of this hovered/pressed tracking do anything |
| 148 // since we only have overlay scrollbars? |
| 163 ScrollbarPart m_hoveredPart; | 149 ScrollbarPart m_hoveredPart; |
| 164 ScrollbarPart m_pressedPart; | 150 ScrollbarPart m_pressedPart; |
| 165 int m_pressedPos; | 151 int m_pressedPos; |
| 166 float m_scrollPos; | 152 float m_scrollPos; |
| 167 int m_documentDragPos; | 153 int m_documentDragPos; |
| 168 | 154 |
| 169 bool m_enabled; | 155 bool m_enabled; |
| 170 | 156 |
| 171 Timer<Scrollbar> m_scrollTimer; | 157 Timer<Scrollbar> m_scrollTimer; |
| 172 bool m_overlapsResizer; | 158 bool m_overlapsResizer; |
| 173 | 159 |
| 174 private: | 160 private: |
| 175 virtual bool isScrollbar() const override { return true; } | 161 virtual bool isScrollbar() const override { return true; } |
| 176 | 162 |
| 177 float scrollableAreaCurrentPos() const; | 163 float scrollableAreaCurrentPos() const; |
| 178 }; | 164 }; |
| 179 | 165 |
| 180 DEFINE_TYPE_CASTS(Scrollbar, Widget, widget, widget->isScrollbar(), widget.isScr
ollbar()); | 166 DEFINE_TYPE_CASTS(Scrollbar, Widget, widget, widget->isScrollbar(), widget.isScr
ollbar()); |
| 181 | 167 |
| 182 } // namespace blink | 168 } // namespace blink |
| 183 | 169 |
| 184 #endif // SKY_ENGINE_PLATFORM_SCROLL_SCROLLBAR_H_ | 170 #endif // SKY_ENGINE_PLATFORM_SCROLL_SCROLLBAR_H_ |
| OLD | NEW |