2 * Copyright 2006-2011, Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
9 #include <TwoDimensionalLayout.h>
12 class BGridLayout
: public BTwoDimensionalLayout
{
14 BGridLayout(float horizontal
15 = B_USE_DEFAULT_SPACING
,
16 float vertical
= B_USE_DEFAULT_SPACING
);
17 BGridLayout(BMessage
* from
);
18 virtual ~BGridLayout();
20 int32
CountColumns() const;
21 int32
CountRows() const;
23 float HorizontalSpacing() const;
24 float VerticalSpacing() const;
26 void SetHorizontalSpacing(float spacing
);
27 void SetVerticalSpacing(float spacing
);
28 void SetSpacing(float horizontal
, float vertical
);
30 float ColumnWeight(int32 column
) const;
31 void SetColumnWeight(int32 column
, float weight
);
33 float MinColumnWidth(int32 column
) const;
34 void SetMinColumnWidth(int32 column
, float width
);
36 float MaxColumnWidth(int32 column
) const;
37 void SetMaxColumnWidth(int32 column
, float width
);
39 float RowWeight(int32 row
) const;
40 void SetRowWeight(int32 row
, float weight
);
42 float MinRowHeight(int row
) const;
43 void SetMinRowHeight(int32 row
, float height
);
45 float MaxRowHeight(int32 row
) const;
46 void SetMaxRowHeight(int32 row
, float height
);
48 BLayoutItem
* ItemAt(int32 column
, int32 row
) const;
50 virtual BLayoutItem
* AddView(BView
* child
);
51 virtual BLayoutItem
* AddView(int32 index
, BView
* child
);
52 virtual BLayoutItem
* AddView(BView
* child
, int32 column
, int32 row
,
53 int32 columnCount
= 1, int32 rowCount
= 1);
55 virtual bool AddItem(BLayoutItem
* item
);
56 virtual bool AddItem(int32 index
, BLayoutItem
* item
);
57 virtual bool AddItem(BLayoutItem
* item
, int32 column
,
58 int32 row
, int32 columnCount
= 1,
61 virtual status_t
Archive(BMessage
* into
, bool deep
= true) const;
62 static BArchivable
* Instantiate(BMessage
* from
);
64 virtual status_t
Perform(perform_code d
, void* arg
);
67 virtual status_t
AllArchived(BMessage
* into
) const;
68 virtual status_t
AllUnarchived(const BMessage
* from
);
69 virtual status_t
ItemArchived(BMessage
* into
,
70 BLayoutItem
* item
, int32 index
) const;
71 virtual status_t
ItemUnarchived(const BMessage
* from
,
72 BLayoutItem
* item
, int32 index
);
74 virtual bool ItemAdded(BLayoutItem
* item
, int32 atIndex
);
75 virtual void ItemRemoved(BLayoutItem
* item
, int32 fromIndex
);
77 virtual bool HasMultiColumnItems();
78 virtual bool HasMultiRowItems();
80 virtual int32
InternalCountColumns();
81 virtual int32
InternalCountRows();
82 virtual void GetColumnRowConstraints(
83 orientation orientation
,
85 ColumnRowConstraints
* constraints
);
86 virtual void GetItemDimensions(BLayoutItem
* item
,
87 Dimensions
* dimensions
);
89 class DummyLayoutItem
;
91 struct ItemLayoutData
;
93 bool _IsGridCellEmpty(int32 column
, int32 row
);
94 bool _AreGridCellsEmpty(int32 column
, int32 row
,
95 int32 columnCount
, int32 rowCount
);
97 bool _InsertItemIntoGrid(BLayoutItem
* item
);
98 bool _ResizeGrid(int32 columnCount
, int32 rowCount
);
100 ItemLayoutData
* _LayoutDataForItem(BLayoutItem
* item
) const;
105 virtual void _ReservedGridLayout1();
106 virtual void _ReservedGridLayout2();
107 virtual void _ReservedGridLayout3();
108 virtual void _ReservedGridLayout4();
109 virtual void _ReservedGridLayout5();
110 virtual void _ReservedGridLayout6();
111 virtual void _ReservedGridLayout7();
112 virtual void _ReservedGridLayout8();
113 virtual void _ReservedGridLayout9();
114 virtual void _ReservedGridLayout10();
117 BGridLayout(const BGridLayout
&);
118 void operator =(const BGridLayout
&);
120 BLayoutItem
*** fGrid
;
124 RowInfoArray
* fRowInfos
;
125 RowInfoArray
* fColumnInfos
;
127 int32 fMultiColumnItems
;
128 int32 fMultiRowItems
;
134 #endif // _GRID_LAYOUT_H