xref: /haiku/headers/os/interface/CardLayout.h (revision 1e60bdeab63fa7a57bc9a55b032052e95a18bd2c)
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 <AbstractLayout.h>
9 
10 
11 class BCardLayout : public BAbstractLayout {
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				BaseMinSize();
23 	virtual	BSize				BaseMaxSize();
24 	virtual	BSize				BasePreferredSize();
25 	virtual	BAlignment			BaseAlignment();
26 
27 	virtual	bool				HasHeightForWidth();
28 	virtual	void				GetHeightForWidth(float width, float* min,
29 									float* max, float* preferred);
30 
31 	virtual status_t			Archive(BMessage* into, bool deep = true) const;
32 	static	BArchivable*		Instantiate(BMessage* from);
33 
34 	virtual	status_t			Perform(perform_code d, void* arg);
35 
36 protected:
37 	virtual	status_t			AllArchived(BMessage* archive) const;
38 	virtual status_t			AllUnarchived(const BMessage* from);
39 
40 	virtual status_t			ItemArchived(BMessage* into, BLayoutItem* item,
41 									int32 index) const;
42 	virtual	status_t			ItemUnarchived(const BMessage* from,
43 									BLayoutItem* item, int32 index);
44 
45 	virtual	void				LayoutInvalidated(bool children = false);
46 	virtual	void				DoLayout();
47 	virtual	bool				ItemAdded(BLayoutItem* item, int32 atIndex);
48 	virtual	void				ItemRemoved(BLayoutItem* item, int32 fromIndex);
49 
50 private:
51 
52 			void				_ValidateMinMax();
53 
54 	// FBC padding
55 	virtual	void				_ReservedCardLayout1();
56 	virtual	void				_ReservedCardLayout2();
57 	virtual	void				_ReservedCardLayout3();
58 	virtual	void				_ReservedCardLayout4();
59 	virtual	void				_ReservedCardLayout5();
60 	virtual	void				_ReservedCardLayout6();
61 	virtual	void				_ReservedCardLayout7();
62 	virtual	void				_ReservedCardLayout8();
63 	virtual	void				_ReservedCardLayout9();
64 	virtual	void				_ReservedCardLayout10();
65 
66 	// forbidden methods
67 								BCardLayout(const BCardLayout&);
68 			void				operator =(const BCardLayout&);
69 
70 			BSize				fMin;
71 			BSize				fMax;
72 			BSize				fPreferred;
73 			BLayoutItem*		fVisibleItem;
74 			bool				fMinMaxValid;
75 
76 			uint32				_reserved[5];
77 };
78 
79 #endif	// _CARD_LAYOUT_H
80