xref: /haiku/headers/os/interface/CardLayout.h (revision e277f0be5755a37e30f098deb6fb7542ac850a47)
1 /*
2  * Copyright 2006-2010, Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef	_CARD_LAYOUT_H
6 #define	_CARD_LAYOUT_H
7 
8 #include <Layout.h>
9 
10 
11 class BCardLayout : public BLayout {
12 public:
13 								BCardLayout();
14 								BCardLayout(BMessage* from);
15 	virtual						~BCardLayout();
16 
17 			BLayoutItem*		VisibleItem() const;
18 			int32				VisibleIndex() const;
19 			void				SetVisibleItem(int32 index);
20 			void				SetVisibleItem(BLayoutItem* item);
21 
22 	virtual	BSize				MinSize();
23 	virtual	BSize				MaxSize();
24 	virtual	BSize				PreferredSize();
25 	virtual	BAlignment			Alignment();
26 
27 	virtual	bool				HasHeightForWidth();
28 	virtual	void				GetHeightForWidth(float width, float* min,
29 									float* max, float* preferred);
30 
31 	virtual	void				InvalidateLayout();
32 	virtual	void				LayoutView();
33 
34 	virtual status_t			Archive(BMessage* into, bool deep = true) const;
35 	virtual status_t			AllUnarchived(const BMessage* from);
36 	static	BArchivable*		Instantiate(BMessage* from);
37 
38 protected:
39 	virtual	bool				ItemAdded(BLayoutItem* item, int32 atIndex);
40 	virtual	void				ItemRemoved(BLayoutItem* item, int32 fromIndex);
41 
42 private:
43 			BSize				fMin;
44 			BSize				fMax;
45 			BSize				fPreferred;
46 			BLayoutItem*		fVisibleItem;
47 			bool				fMinMaxValid;
48 
49 			void				_ValidateMinMax();
50 };
51 
52 #endif	// _CARD_LAYOUT_H
53