1 /* 2 * Copyright 2006, Haiku. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Ingo Weinhold <bonefish@cs.tu-berlin.de> 7 */ 8 9 #ifndef SCROLLER_H 10 #define SCROLLER_H 11 12 #include <Rect.h> 13 14 class Scrollable; 15 16 class Scroller { 17 public: 18 Scroller(); 19 virtual ~Scroller(); 20 21 void SetScrollTarget(Scrollable* target); 22 Scrollable* ScrollTarget() const; 23 24 void SetDataRect(BRect dataRect); 25 BRect DataRect() const; 26 27 void SetScrollOffset(BPoint offset); 28 BPoint ScrollOffset() const; 29 30 void SetVisibleSize(float width, float height); 31 BRect VisibleBounds() const; 32 BRect VisibleRect() const; 33 34 protected: 35 virtual void DataRectChanged(BRect oldDataRect, 36 BRect newDataRect); 37 virtual void ScrollOffsetChanged(BPoint oldOffset, 38 BPoint newOffset); 39 virtual void VisibleSizeChanged(float oldWidth, 40 float oldHeight, 41 float newWidth, 42 float newHeight); 43 virtual void ScrollTargetChanged(Scrollable* oldTarget, 44 Scrollable* newTarget); 45 46 protected: 47 Scrollable* fScrollTarget; 48 49 friend class Scrollable; 50 }; 51 52 53 #endif // SCROLLER_H 54