xref: /haiku/headers/os/interface/SplitView.h (revision 1214ef1b2100f2b3299fc9d8d6142e46f70a4c3f)
1 /*
2  * Copyright 2006, Haiku Inc.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef	_SPLIT_VIEW_H
6 #define	_SPLIT_VIEW_H
7 
8 #include <View.h>
9 
10 class BSplitLayout;
11 
12 
13 class BSplitView : public BView {
14 public:
15 								BSplitView(
16 									enum orientation orientation = B_HORIZONTAL,
17 									float spacing = 0.0f);
18 	virtual						~BSplitView();
19 
20 			float				Spacing() const;
21 			void				SetSpacing(float spacing);
22 
23 			orientation			Orientation() const;
24 			void				SetOrientation(enum orientation orientation);
25 
26 			float				SplitterSize() const;
27 			void				SetSplitterSize(float size);
28 
29 
30 			void				SetCollapsible(bool collapsible);
31 			void				SetCollapsible(int32 index, bool collapsible);
32 			void				SetCollapsible(int32 first, int32 last,
33 									bool collapsible);
34 
35 //			void				AddChild(BView* child);
36 			void				AddChild(BView* child, BView* sibling = NULL);
37 			bool				AddChild(BView* child, float weight);
38 			bool				AddChild(int32 index, BView* child,
39 									float weight);
40 
41 			bool				AddChild(BLayoutItem* child);
42 			bool				AddChild(BLayoutItem* child, float weight);
43 			bool				AddChild(int32 index, BLayoutItem* child,
44 									float weight);
45 
46 	virtual	void				Draw(BRect updateRect);
47 	virtual	void				MouseDown(BPoint where);
48 	virtual	void				MouseUp(BPoint where);
49 	virtual	void				MouseMoved(BPoint where, uint32 transit,
50 									const BMessage* message);
51 
52 
53 	virtual	void				SetLayout(BLayout* layout);
54 									// overridden to avoid use
55 
56 protected:
57 	virtual	void				DrawSplitter(BRect frame,
58 									enum orientation orientation, bool pressed);
59 
60 private:
61 	static	void				_DrawDefaultSplitter(BView* view, BRect frame,
62 									enum orientation orientation, bool pressed);
63 
64 private:
65 			BSplitLayout*		fSplitLayout;
66 };
67 
68 
69 #endif	// _SPLIT_VIEW_H
70