mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-25 16:50:50 +01:00
[escher] Change the function expression cell to inherit from
even odd expression cell
This commit is contained in:
28
apps/shared/model_expression_cell.cpp
Normal file
28
apps/shared/model_expression_cell.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "model_expression_cell.h"
|
||||
|
||||
namespace Shared {
|
||||
|
||||
ModelExpressionCell::ModelExpressionCell() :
|
||||
EvenOddExpressionCell()
|
||||
{
|
||||
}
|
||||
|
||||
KDSize ModelExpressionCell::minimalSizeForOptimalDisplay() const {
|
||||
KDSize expressionSize = m_expressionView.minimalSizeForOptimalDisplay();
|
||||
return KDSize(k_margin+expressionSize.width(), expressionSize.height()+k_separatorThickness);
|
||||
}
|
||||
|
||||
void ModelExpressionCell::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDColor separatorColor = m_even ? Palette::WallScreen : KDColorWhite;
|
||||
// Color the horizontal separator
|
||||
ctx->fillRect(KDRect(0, bounds().height()-k_separatorThickness, bounds().width(), k_separatorThickness), separatorColor);
|
||||
// Color the margin
|
||||
ctx->fillRect(KDRect(0, 0, k_margin, bounds().height()-k_separatorThickness), backgroundColor());
|
||||
}
|
||||
|
||||
void ModelExpressionCell::layoutSubviews() {
|
||||
KDRect expressionFrame(k_margin, 0, bounds().width() - k_margin, bounds().height()-k_separatorThickness);
|
||||
m_expressionView.setFrame(expressionFrame);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user