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 void InvalidateLayout(bool children = false); 32 33 virtual status_t Archive(BMessage* into, bool deep = true) const; 34 virtual status_t AllUnarchived(const BMessage* from); 35 static BArchivable* Instantiate(BMessage* from); 36 37 protected: 38 virtual void DerivedLayoutItems(); 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