19ecf9d1cSIngo Weinhold /* 23fb74eb7SIngo Weinhold * Copyright 2006-2010, Haiku, Inc. All rights reserved. 39ecf9d1cSIngo Weinhold * Distributed under the terms of the MIT License. 49ecf9d1cSIngo Weinhold */ 59ecf9d1cSIngo Weinhold #ifndef _GROUP_LAYOUT_H 69ecf9d1cSIngo Weinhold #define _GROUP_LAYOUT_H 79ecf9d1cSIngo Weinhold 89ecf9d1cSIngo Weinhold #include <TwoDimensionalLayout.h> 99ecf9d1cSIngo Weinhold 109ecf9d1cSIngo Weinhold class BGroupLayout : public BTwoDimensionalLayout { 119ecf9d1cSIngo Weinhold public: 12*e724b26fSJohn Scipione BGroupLayout(orientation orientation, 1382ab3167SAlex Wilson float spacing = B_USE_DEFAULT_SPACING); 143fb74eb7SIngo Weinhold BGroupLayout(BMessage* from); 159ecf9d1cSIngo Weinhold virtual ~BGroupLayout(); 169ecf9d1cSIngo Weinhold 179ecf9d1cSIngo Weinhold float Spacing() const; 189ecf9d1cSIngo Weinhold void SetSpacing(float spacing); 199ecf9d1cSIngo Weinhold 209ecf9d1cSIngo Weinhold orientation Orientation() const; 21*e724b26fSJohn Scipione void SetOrientation(orientation orientation); 229ecf9d1cSIngo Weinhold 239ecf9d1cSIngo Weinhold float ItemWeight(int32 index) const; 249ecf9d1cSIngo Weinhold void SetItemWeight(int32 index, float weight); 259ecf9d1cSIngo Weinhold 269ecf9d1cSIngo Weinhold virtual BLayoutItem* AddView(BView* child); 279ecf9d1cSIngo Weinhold virtual BLayoutItem* AddView(int32 index, BView* child); 289ecf9d1cSIngo Weinhold virtual BLayoutItem* AddView(BView* child, float weight); 299ecf9d1cSIngo Weinhold virtual BLayoutItem* AddView(int32 index, BView* child, 309ecf9d1cSIngo Weinhold float weight); 319ecf9d1cSIngo Weinhold 329ecf9d1cSIngo Weinhold virtual bool AddItem(BLayoutItem* item); 339ecf9d1cSIngo Weinhold virtual bool AddItem(int32 index, BLayoutItem* item); 349ecf9d1cSIngo Weinhold virtual bool AddItem(BLayoutItem* item, float weight); 359ecf9d1cSIngo Weinhold virtual bool AddItem(int32 index, BLayoutItem* item, 369ecf9d1cSIngo Weinhold float weight); 379ecf9d1cSIngo Weinhold 383fb74eb7SIngo Weinhold virtual status_t Archive(BMessage* into, bool deep = true) const; 393fb74eb7SIngo Weinhold static BArchivable* Instantiate(BMessage* from); 403fb74eb7SIngo Weinhold 41d56e7bd6SAlex Wilson virtual status_t Perform(perform_code d, void* arg); 42d56e7bd6SAlex Wilson 43d56e7bd6SAlex Wilson protected: 44d56e7bd6SAlex Wilson virtual status_t AllArchived(BMessage* into) const; 45d56e7bd6SAlex Wilson virtual status_t AllUnarchived(const BMessage* from); 463fb74eb7SIngo Weinhold virtual status_t ItemArchived(BMessage* into, BLayoutItem* item, 473fb74eb7SIngo Weinhold int32 index) const; 483fb74eb7SIngo Weinhold virtual status_t ItemUnarchived(const BMessage* from, 493fb74eb7SIngo Weinhold BLayoutItem* item, int32 index); 503fb74eb7SIngo Weinhold 516829d417SAlex Wilson virtual bool ItemAdded(BLayoutItem* item, int32 atIndex); 526829d417SAlex Wilson virtual void ItemRemoved(BLayoutItem* item, int32 fromIndex); 539ecf9d1cSIngo Weinhold 54*e724b26fSJohn Scipione virtual void PrepareItems(orientation orientation); 559ecf9d1cSIngo Weinhold 569ecf9d1cSIngo Weinhold virtual int32 InternalCountColumns(); 579ecf9d1cSIngo Weinhold virtual int32 InternalCountRows(); 589ecf9d1cSIngo Weinhold virtual void GetColumnRowConstraints( 59*e724b26fSJohn Scipione orientation orientation, 609ecf9d1cSIngo Weinhold int32 index, 619ecf9d1cSIngo Weinhold ColumnRowConstraints* constraints); 629ecf9d1cSIngo Weinhold virtual void GetItemDimensions(BLayoutItem* item, 639ecf9d1cSIngo Weinhold Dimensions* dimensions); 649ecf9d1cSIngo Weinhold 659ecf9d1cSIngo Weinhold private: 668151838eSAlex Wilson 678151838eSAlex Wilson // FBC padding 688151838eSAlex Wilson virtual void _ReservedGroupLayout1(); 698151838eSAlex Wilson virtual void _ReservedGroupLayout2(); 708151838eSAlex Wilson virtual void _ReservedGroupLayout3(); 718151838eSAlex Wilson virtual void _ReservedGroupLayout4(); 728151838eSAlex Wilson virtual void _ReservedGroupLayout5(); 738151838eSAlex Wilson virtual void _ReservedGroupLayout6(); 748151838eSAlex Wilson virtual void _ReservedGroupLayout7(); 758151838eSAlex Wilson virtual void _ReservedGroupLayout8(); 768151838eSAlex Wilson virtual void _ReservedGroupLayout9(); 778151838eSAlex Wilson virtual void _ReservedGroupLayout10(); 788151838eSAlex Wilson 79e044d51aSAlex Wilson // forbidden methods 80e044d51aSAlex Wilson BGroupLayout(const BGroupLayout&); 81e044d51aSAlex Wilson void operator =(const BGroupLayout&); 82e044d51aSAlex Wilson 839ecf9d1cSIngo Weinhold struct ItemLayoutData; 849ecf9d1cSIngo Weinhold 859ecf9d1cSIngo Weinhold ItemLayoutData* _LayoutDataForItem(BLayoutItem* item) const; 869ecf9d1cSIngo Weinhold 879ecf9d1cSIngo Weinhold orientation fOrientation; 889ecf9d1cSIngo Weinhold BList fVisibleItems; 898151838eSAlex Wilson 908151838eSAlex Wilson uint32 _reserved[5]; 919ecf9d1cSIngo Weinhold }; 929ecf9d1cSIngo Weinhold 939ecf9d1cSIngo Weinhold #endif // _GROUP_LAYOUT_H 94