15 for (
int i = 0; i < m_numberOfRows*m_numberOfColumns; i++) {
16 m_entryLayouts[i] = entryLayouts[i];
23 for (
int i=0; i<m_numberOfColumns*m_numberOfRows; i++) {
24 delete m_entryLayouts[i];
26 delete[] m_entryLayouts;
31 for (
int j = 0; j < m_numberOfColumns; j++) {
32 rowBaseline = max(rowBaseline, m_entryLayouts[i*m_numberOfColumns+j]->
baseline());
41 for (
int j = 0; j < m_numberOfColumns; j++) {
42 rowHeight = max(rowHeight, m_entryLayouts[i*m_numberOfColumns+j]->
size().height() - m_entryLayouts[i*m_numberOfColumns+j]->
baseline());
49 for (
int i = 0; i < m_numberOfRows; i++) {
50 totalHeight += rowHeight(i);
52 totalHeight += (m_numberOfRows-1)*k_gridEntryMargin;
58 for (
int i = 0; i < m_numberOfRows; i++) {
59 columnWidth = max(columnWidth, m_entryLayouts[i*m_numberOfColumns+j]->
size().width());
66 for (
int j = 0; j < m_numberOfColumns; j++) {
67 totalWidth += columnWidth(j);
69 totalWidth += (m_numberOfColumns-1)*k_gridEntryMargin;
78 return KDSize(width(), height());
82 if (index < m_numberOfColumns*m_numberOfRows) {
83 return m_entryLayouts[index];
91 for (
int i = 0; i < m_numberOfRows; i++) {
92 for (
int j = 0; j < m_numberOfColumns; j++) {
93 if (
child == m_entryLayouts[i*m_numberOfColumns+j]) {
101 for (
int j = 0; j < columnIndex; j++) {
104 x += (columnWidth(columnIndex) -
child->
size().
width())/2+ columnIndex * k_gridEntryMargin;
106 for (
int i = 0; i < rowIndex; i++) {
109 y += rowBaseline(rowIndex) -
child->
baseline() + rowIndex * k_gridEntryMargin;
KDPoint positionOfChild(ExpressionLayout *child) override
GridLayout(ExpressionLayout **entryLayouts, int numberOfRows, int numberOfColumns)
constexpr KDCoordinate width() const
void render(KDContext *ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) override
ExpressionLayout * child(uint16_t index) override
constexpr uint8_t numberOfColumns
constexpr uint8_t numberOfRows
KDSize computeSize() override
void setParent(ExpressionLayout *parent)