xref: /haiku/headers/os/interface/ScrollBar.h (revision 7120e97489acbf17d86d3f33e3b2e68974fd4b23)
1 /*******************************************************************************
2 /
3 /	File:			ScrollBar.h
4 /
5 /   Description:    BScrollBar displays and controls a scrollbar.
6 /
7 /	Copyright 1992-98, Be Incorporated, All Rights Reserved
8 /
9 *******************************************************************************/
10 
11 #ifndef	_SCROLL_BAR_H
12 #define	_SCROLL_BAR_H
13 
14 #include <BeBuild.h>
15 #include <View.h>
16 
17 /*----------------------------------------------------------------*/
18 /*----- scroll bar defines ---------------------------------------*/
19 
20 #define B_V_SCROLL_BAR_WIDTH	14.0
21 #define B_H_SCROLL_BAR_HEIGHT	14.0
22 
23 /*----------------------------------------------------------------*/
24 /*----- BScrollBar class -----------------------------------------*/
25 
26 class BScrollBar : public BView {
27 
28 public:
29 					BScrollBar(	BRect frame,
30 								const char *name,
31 								BView *target,
32 								float min,
33 								float max,
34 								orientation direction);
35 					BScrollBar(BMessage *data);
36 virtual				~BScrollBar();
37 static	BArchivable	*Instantiate(BMessage *data);
38 virtual	status_t	Archive(BMessage *data, bool deep = true) const;
39 
40 virtual	void		AttachedToWindow();
41 		void		SetValue(float value);
42 		float		Value() const;
43 		void		SetProportion(float);
44 		float		Proportion() const;
45 virtual	void		ValueChanged(float newValue);
46 
47 		void		SetRange(float min, float max);
48 		void		GetRange(float *min, float *max) const;
49 		void		SetSteps(float smallStep, float largeStep);
50 		void		GetSteps(float *smallStep, float *largeStep) const;
51 		void		SetTarget(BView *target);
52 		void		SetTarget(const char *targetName);
53 		BView		*Target() const;
54 		orientation	Orientation() const;
55 
56 virtual void		MessageReceived(BMessage *msg);
57 virtual	void		MouseDown(BPoint pt);
58 virtual	void		MouseUp(BPoint pt);
59 virtual	void		MouseMoved(BPoint pt, uint32 code, const BMessage *msg);
60 virtual	void		DetachedFromWindow();
61 virtual	void		Draw(BRect updateRect);
62 virtual	void		FrameMoved(BPoint new_position);
63 virtual	void		FrameResized(float new_width, float new_height);
64 
65 virtual BHandler	*ResolveSpecifier(BMessage *msg,
66 									int32 index,
67 									BMessage *specifier,
68 									int32 form,
69 									const char *property);
70 
71 virtual void		ResizeToPreferred();
72 virtual void		GetPreferredSize(float *width, float *height);
73 virtual void		MakeFocus(bool state = true);
74 virtual void		AllAttached();
75 virtual void		AllDetached();
76 virtual status_t	GetSupportedSuites(BMessage *data);
77 
78 
79 /*----- Private or reserved -----------------------------------------*/
80 virtual status_t	Perform(perform_code d, void *arg);
81 
82 private:
83 
84 friend class BWindow;
85 friend class BApplication;
86 
87 virtual	void		_ReservedScrollBar1();
88 virtual	void		_ReservedScrollBar2();
89 virtual	void		_ReservedScrollBar3();
90 virtual	void		_ReservedScrollBar4();
91 
92 		BScrollBar	&operator=(const BScrollBar &);
93 
94 		void		InitObject(float min, float max, orientation o, BView *t);
95 		float		fMin;
96 		float		fMax;
97 		float		fSmallStep;
98 		float		fLargeStep;
99 		float		fValue;
100 		float		fProportion;
101 		BView*		fTarget;
102 		orientation	fOrientation;
103 		char		*fTargetName;
104 		uint32		_reserved[4];
105 };
106 
107 /*-------------------------------------------------------------*/
108 /*-------------------------------------------------------------*/
109 
110 #endif /* _SCROLL_BAR_H */
111