1: <?php
2:
3: namespace Charcoal\Ui\Layout;
4:
5: /**
6: * Defines a layout.
7: */
8: interface LayoutInterface
9: {
10: /**
11: * @param integer $position The layout cell position.
12: * @return LayoutInterface Chainable
13: */
14: public function setPosition($position);
15:
16: /**
17: * @return integer
18: */
19: public function position();
20:
21: /**
22: * Prepare the layouts configuration in a simpler, ready, data structure.
23: *
24: * This function goes through the layout options to expand loops into extra layout data...
25: *
26: * @param array $layouts The original layout data, typically from configuration.
27: * @return array Computed layouts, ready for looping
28: */
29: public function setStructure(array $layouts);
30:
31: /**
32: * @return array
33: */
34: public function structure();
35:
36: /**
37: * Get the total number of rows
38: *
39: * @return integer
40: */
41: public function numRows();
42:
43: /**
44: * Get the row index at a certain position
45: *
46: * @param integer $position Optional. Forced position.
47: * @return integer|null
48: */
49: public function rowIndex($position = null);
50:
51: /**
52: * Get the row information
53: *
54: * If no `$position` is specified, then the current position will be used.
55: *
56: * @param integer $position Optional. Forced position.
57: * @return array|null
58: */
59: public function rowData($position = null);
60:
61: /**
62: * Get the number of columns (the colspan) of the row at a certain position
63: *
64: * @param integer $position Optional. Forced position.
65: * @return integer|null
66: */
67: public function rowNumColumns($position = null);
68:
69: /**
70: * Get the number of cells at current position
71: *
72: * This can be different than the number of columns, in case
73: *
74: * @param integer $position Optional. Forced position.
75: * @return integer
76: */
77: public function rowNumCells($position = null);
78:
79: /**
80: * Get the cell index (position) of the first cell of current row.
81: *
82: * @param integer $position Optional. Forced position.
83: * @return integer
84: */
85: public function rowFirstCellIndex($position = null);
86:
87: /**
88: * Get the cell index in the current row.
89: *
90: * @param integer $position Optional. Forced position.
91: * @return integer
92: */
93: public function cellRowIndex($position = null);
94:
95: /**
96: * Get the total number of cells, in all rows.
97: *
98: * @return integer
99: */
100: public function numCellsTotal();
101:
102: /**
103: * Get the span number (in # of columns) of the current cell.
104: *
105: * @param integer $position Optional. Forced position.
106: * @return integer|null
107: */
108: public function cellSpan($position = null);
109:
110: /**
111: * Get the span number as a part of 12 (for bootrap-style grids)
112: *
113: * @param integer $position Optional. Forced position.
114: * @return integer
115: */
116: public function cellSpanBy12($position = null);
117:
118: /**
119: * Get wether or not the current cell starts a row (is the first one on the row).
120: *
121: * @param integer $position Optional. Forced position.
122: * @return boolean
123: */
124: public function cellStartsRow($position = null);
125:
126: /**
127: * Get wether or not the current cell ends a row (is the last one on the row).
128: *
129: * @param integer $position Optional. Forced position.
130: * @return boolean
131: */
132: public function cellEndsRow($position = null);
133:
134: /**
135: * @return string
136: */
137: public function start();
138:
139: /**
140: * @return string
141: */
142: public function end();
143: }
144: