xref: /haiku/src/kits/interface/ViewLayoutItem.h (revision 98057dd02a2411868fd4c35f7a48d20acfd92c23)
1 /*
2  * Copyright 2006-2010, Haiku Inc.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef	_VIEW_LAYOUT_ITEM_H
6 #define	_VIEW_LAYOUT_ITEM_H
7 
8 #include <LayoutItem.h>
9 
10 
11 class BViewLayoutItem : public BLayoutItem {
12 public:
13 								BViewLayoutItem(BView* view);
14 								BViewLayoutItem(BMessage* from);
15 	virtual						~BViewLayoutItem();
16 
17 	virtual	BSize				MinSize();
18 	virtual	BSize				MaxSize();
19 	virtual	BSize				PreferredSize();
20 	virtual	BAlignment			Alignment();
21 
22 	virtual	void				SetExplicitMinSize(BSize size);
23 	virtual	void				SetExplicitMaxSize(BSize size);
24 	virtual	void				SetExplicitPreferredSize(BSize size);
25 	virtual	void				SetExplicitAlignment(BAlignment alignment);
26 
27 	virtual	bool				IsVisible();
28 	virtual	void				SetVisible(bool visible);
29 
30 	virtual	BRect				Frame();
31 	virtual	void				SetFrame(BRect frame);
32 
33 	virtual	bool				HasHeightForWidth();
34 	virtual	void				GetHeightForWidth(float width, float* min,
35 									float* max, float* preferred);
36 
37 	virtual	BView*				View();
38 
39 	virtual	void				Relayout(bool immediate = false);
40 
41 	virtual	status_t			Archive(BMessage* into, bool deep = true) const;
42 	virtual status_t			AllArchived(BMessage* into) const;
43 	virtual status_t			AllUnarchived(const BMessage* from);
44 	static	BArchivable*		Instantiate(BMessage* from);
45 
46 protected:
47 	virtual	void				LayoutInvalidated(bool children);
48 	virtual void				AncestorVisibilityChanged(bool shown);
49 
50 private:
51 			BView*				fView;
52 			int32				fAncestorsVisible;
53 };
54 
55 #endif	//	_VIEW_LAYOUT_ITEM_H
56