1 /* 2 ** Copyright 2004, OpenBeOS. All Rights Reserved. 3 ** Distributed under the terms of the OpenBeOS License. 4 */ 5 #ifndef _SCROLL_VIEW_H 6 #define _SCROLL_VIEW_H 7 8 /** The BScrollView is a convenience class to add a scrolling 9 * mechanism to the target view. 10 */ 11 12 #include <ScrollBar.h> 13 14 15 class BScrollView : public BView { 16 public: 17 BScrollView(const char *name, BView *target, 18 uint32 resizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP, 19 uint32 flags = 0, bool horizontal = false, bool vertical = false, 20 border_style border = B_FANCY_BORDER); 21 BScrollView(BMessage *archive); 22 virtual ~BScrollView(); 23 24 static BArchivable *Instantiate(BMessage *archive); 25 virtual status_t Archive(BMessage *archive, bool deep = true) const; 26 27 virtual void Draw(BRect updateRect); 28 virtual void AttachedToWindow(); 29 30 BScrollBar *ScrollBar(orientation posture) const; 31 32 virtual void SetBorder(border_style border); 33 border_style Border() const; 34 35 virtual status_t SetBorderHighlighted(bool state); 36 bool IsBorderHighlighted() const; 37 38 void SetTarget(BView *target); 39 BView *Target() const; 40 41 virtual void MessageReceived(BMessage *message); 42 virtual void MouseDown(BPoint point); 43 44 virtual void WindowActivated(bool active); 45 virtual void MouseUp(BPoint point); 46 virtual void MouseMoved(BPoint point, uint32 code, const BMessage *msg); 47 48 virtual void DetachedFromWindow(); 49 virtual void AllAttached(); 50 virtual void AllDetached(); 51 52 virtual void FrameMoved(BPoint position); 53 virtual void FrameResized(float width, float height); 54 55 virtual BHandler *ResolveSpecifier(BMessage *message, int32 index, 56 BMessage *specifier, int32 form, const char *property); 57 58 virtual void ResizeToPreferred(); 59 virtual void GetPreferredSize(float *_width, float *_height); 60 virtual void MakeFocus(bool state = true); 61 virtual status_t GetSupportedSuites(BMessage *data); 62 63 // private or reserved methods are following 64 65 virtual status_t Perform(perform_code d, void *arg); 66 67 private: 68 friend class BView; 69 70 virtual void _ReservedScrollView1(); 71 virtual void _ReservedScrollView2(); 72 virtual void _ReservedScrollView3(); 73 virtual void _ReservedScrollView4(); 74 75 BScrollView &operator=(const BScrollView &); 76 77 static BRect CalcFrame(BView *target, bool h, bool v, border_style); 78 static float BorderSize(border_style border); 79 static int32 ModifyFlags(int32 flags, border_style); 80 81 BView *fTarget; 82 BScrollBar *fHorizontalScrollBar; 83 BScrollBar *fVerticalScrollBar; 84 border_style fBorder; 85 uint16 fPreviousWidth; 86 uint16 fPreviousHeight; 87 bool fHighlighted; 88 89 uint32 _reserved[3]; 90 }; 91 92 #endif /* _SCROLL_VIEW_H */ 93