xref: /haiku/headers/os/interface/SplitView.h (revision 9760dcae2038d47442f4658c2575844c6cf92c40)
1 /*
2  * Copyright 2006, Haiku, Inc. All rights reserved.
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
17 										= B_HORIZONTAL,
18 									float spacing = 0.0f);
19 	virtual						~BSplitView();
20 
21 			void				SetInsets(float left, float top, float right,
22 									float bottom);
23 			void				GetInsets(float* left, float* top,
24 									float* right, float* bottom) const;
25 
26 			float				Spacing() const;
27 			void				SetSpacing(float spacing);
28 
29 			orientation			Orientation() const;
30 			void				SetOrientation(enum orientation orientation);
31 
32 			float				SplitterSize() const;
33 			void				SetSplitterSize(float size);
34 
35 
36 			void				SetCollapsible(bool collapsible);
37 			void				SetCollapsible(int32 index, bool collapsible);
38 			void				SetCollapsible(int32 first, int32 last,
39 									bool collapsible);
40 
41 //			void				AddChild(BView* child);
42 			void				AddChild(BView* child, BView* sibling = NULL);
43 			bool				AddChild(BView* child, float weight);
44 			bool				AddChild(int32 index, BView* child,
45 									float weight);
46 
47 			bool				AddChild(BLayoutItem* child);
48 			bool				AddChild(BLayoutItem* child, float weight);
49 			bool				AddChild(int32 index, BLayoutItem* child,
50 									float weight);
51 
52 	virtual	void				Draw(BRect updateRect);
53 	virtual	void				MouseDown(BPoint where);
54 	virtual	void				MouseUp(BPoint where);
55 	virtual	void				MouseMoved(BPoint where, uint32 transit,
56 									const BMessage* message);
57 
58 
59 	virtual	void				SetLayout(BLayout* layout);
60 									// overridden to avoid use
61 
62 protected:
63 	virtual	void				DrawSplitter(BRect frame,
64 									const BRect& updateRect,
65 									enum orientation orientation,
66 									bool pressed);
67 
68 private:
69 	static	void				_DrawDefaultSplitter(BView* view, BRect frame,
70 									const BRect& updateRect,
71 									enum orientation orientation,
72 									bool pressed);
73 
74 private:
75 			BSplitLayout*		fSplitLayout;
76 };
77 
78 
79 #endif	// _SPLIT_VIEW_H
80