[escher/view] setFrame and layoutSubviews can be forced

This commit is contained in:
Léa Saviot
2019-10-02 11:22:49 +02:00
parent f85658f5e6
commit 9f018eb9d9
168 changed files with 421 additions and 405 deletions

View File

@@ -42,20 +42,20 @@ View * VariableBoxEmptyController::VariableBoxEmptyView::subviewAtIndex(int inde
return &m_messages[index-1];
}
void VariableBoxEmptyController::VariableBoxEmptyView::layoutSubviews() {
void VariableBoxEmptyController::VariableBoxEmptyView::layoutSubviews(bool force) {
KDCoordinate width = bounds().width();
KDCoordinate height = bounds().height();
KDCoordinate textHeight = k_font->glyphSize().height();
KDCoordinate layoutHeight = m_layoutExample.minimalSizeForOptimalDisplay().height();
KDCoordinate margin = (height - k_numberOfMessages*textHeight-layoutHeight)/2;
m_layoutExample.setFrame(KDRect(0, margin+k_layoutRowIndex*textHeight, width, layoutHeight));
m_layoutExample.setFrame(KDRect(0, margin+k_layoutRowIndex*textHeight, width, layoutHeight), force);
KDCoordinate currentHeight = 0;
for (uint8_t i = 0; i < k_numberOfMessages; i++) {
if (i == k_layoutRowIndex) {
currentHeight += layoutHeight;
}
KDCoordinate h = i == 0 || i == k_numberOfMessages - 1 ? textHeight+margin : textHeight;
m_messages[i].setFrame(KDRect(0, currentHeight, width, h));
m_messages[i].setFrame(KDRect(0, currentHeight, width, h), force);
currentHeight += h;
}
}