1 /* 2 * Copyright 2011, Haiku, Inc. All rights reserved. 3 * Copyright 2011, Clemens Zeidler <haiku@clemens-zeidler.de> 4 * Distributed under the terms of the MIT License. 5 */ 6 #ifndef ROW_COLUMN_MANAGER_H 7 #define ROW_COLUMN_MANAGER_H 8 9 10 #include "Area.h" 11 #include "Column.h" 12 #include "LinearSpec.h" 13 #include "Row.h" 14 #include "Tab.h" 15 16 17 namespace BALM { 18 19 class RowColumnManager { 20 public: 21 RowColumnManager(LinearSpec* spec); 22 ~RowColumnManager(); 23 24 void AddArea(Area* area); 25 void RemoveArea(Area* area); 26 27 void UpdateConstraints(); 28 void TabsChanged(Area* area); 29 30 Row* CreateRow(YTab* top, YTab* bottom); 31 Column* CreateColumn(XTab* left, XTab* right); 32 private: 33 Row* _FindRowFor(Area* area); 34 Column* _FindColumnFor(Area* area); 35 36 double _PreferredHeight(Row* row, 37 double& weight); 38 double _PreferredWidth(Column* column, 39 double& weight); 40 41 void _UpdateConstraints(Row* row); 42 void _UpdateConstraints(Column* column); 43 44 BObjectList<Row> fRows; 45 BObjectList<Column> fColumns; 46 47 LinearSpec* fLinearSpec; 48 }; 49 50 51 } // namespace BALM 52 53 54 #endif // ROW_COLUMN_MANAGER_H 55 56