xref: /haiku/headers/os/interface/LayoutItem.h (revision 508f54795f39c3e7552d87c95aae9dd8ec6f505b)
1 /*
2  * Copyright 2006, Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef	_LAYOUT_ITEM_H
6 #define	_LAYOUT_ITEM_H
7 
8 #include <Alignment.h>
9 #include <Rect.h>
10 #include <Size.h>
11 
12 class BLayout;
13 class BView;
14 
15 class BLayoutItem {
16 public:
17 								BLayoutItem();
18 	virtual						~BLayoutItem();
19 
20 			BLayout*			Layout() const;
21 
22 	virtual	BSize				MinSize() = 0;
23 	virtual	BSize				MaxSize() = 0;
24 	virtual	BSize				PreferredSize() = 0;
25 	virtual	BAlignment			Alignment() = 0;
26 
27 	virtual	void				SetExplicitMinSize(BSize size) = 0;
28 	virtual	void				SetExplicitMaxSize(BSize size) = 0;
29 	virtual	void				SetExplicitPreferredSize(BSize size) = 0;
30 	virtual	void				SetExplicitAlignment(BAlignment alignment) = 0;
31 
32 	virtual	bool				IsVisible() = 0;
33 	virtual	void				SetVisible(bool visible) = 0;
34 
35 	virtual	BRect				Frame() = 0;
36 	virtual	void				SetFrame(BRect frame) = 0;
37 
38 	virtual	bool				HasHeightForWidth();
39 	virtual	void				GetHeightForWidth(float width, float* min,
40 									float* max, float* preferred);
41 
42 	virtual	BView*				View();
43 
44 	virtual	void				InvalidateLayout();
45 
46 			void*				LayoutData() const;
47 			void				SetLayoutData(void* data);
48 
49 			void				AlignInFrame(BRect frame);
50 
51 private:
52 			friend class BLayout;
53 
54 			void				SetLayout(BLayout* layout);
55 
56 			BLayout*			fLayout;
57 			void*				fLayoutData;
58 };
59 
60 #endif	// _LAYOUT_ITEM_H
61