xref: /haiku/headers/libs/alm/ALMGroup.h (revision 25a7b01d15612846f332751841da3579db313082)
1 /*
2  * Copyright 2012, Haiku, Inc. All rights reserved.
3  * Copyright 2010, Clemens Zeidler <haiku@clemens-zeidler.de>
4  * Distributed under the terms of the MIT License.
5  */
6 #ifndef	ALMGROUP_H
7 #define ALMGROUP_H
8 
9 
10 #include <vector>
11 
12 #include <InterfaceDefs.h> // for enum orientation
13 #include <Referenceable.h>
14 
15 #include "Tab.h"
16 
17 
18 class BLayoutItem;
19 class BView;
20 
21 
22 namespace BALM {
23 
24 class BALMLayout;
25 
26 
27 class ALMGroup {
28 public:
29 								ALMGroup(BLayoutItem* item);
30 								ALMGroup(BView* view);
31 
32 			BLayoutItem*		LayoutItem() const;
33 			BView*				View() const;
34 
35 			const std::vector<ALMGroup>& Groups() const;
36 			enum orientation	Orientation() const;
37 
38 			ALMGroup& 			operator|(const ALMGroup& right);
39 			ALMGroup& 			operator/(const ALMGroup& bottom);
40 
41 			void				BuildLayout(BALMLayout* layout,
42 									XTab* left = NULL, YTab* top = NULL,
43 									XTab* right = NULL, YTab* bottom = NULL);
44 
45 private:
46 								ALMGroup();
47 
48 			void				_Init(BLayoutItem* item, BView* view,
49 									  enum orientation orien = B_HORIZONTAL);
50 			ALMGroup& 			_AddItem(const ALMGroup& item,
51 									enum orientation orien);
52 
53 			void				_Build(BALMLayout* layout,
54 									BReference<XTab> left, BReference<YTab> top,
55 									BReference<XTab> right,
56 									BReference<YTab> bottom) const;
57 
58 
59 			BLayoutItem*		fLayoutItem;
60 			BView*				fView;
61 
62 			std::vector<ALMGroup> fGroups;
63 			enum orientation	fOrientation;
64 
65 			uint32				_reserved[4];
66 };
67 
68 
69 };
70 
71 
72 using BALM::ALMGroup;
73 
74 #endif
75