mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-20 09:17:23 +01:00
[apps/graph] make the function title cells consistent
Change-Id: Ib59f3d5f8a679cddd8a88e16711138425a6e9ecb
This commit is contained in:
@@ -2,13 +2,27 @@
|
||||
|
||||
namespace Graph {
|
||||
|
||||
constexpr KDColor FunctionExpressionView::k_separatorColor;
|
||||
|
||||
FunctionExpressionView::FunctionExpressionView() :
|
||||
FunctionCell()
|
||||
EvenOddCell(),
|
||||
m_function(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
void FunctionExpressionView::setFunction(Function * f) {
|
||||
m_function = f;
|
||||
markRectAsDirty(bounds());
|
||||
}
|
||||
|
||||
Function * FunctionExpressionView::function() {
|
||||
return m_function;
|
||||
}
|
||||
|
||||
void FunctionExpressionView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
EvenOddCell::drawRect(ctx, rect);
|
||||
// Color the separator
|
||||
ctx->fillRect(KDRect(0, 0, k_separatorThickness, bounds().height()), k_separatorColor);
|
||||
if (m_function->layout() == nullptr) {
|
||||
return;
|
||||
}
|
||||
@@ -16,10 +30,10 @@ void FunctionExpressionView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDColor background = backgroundColor();
|
||||
// Select text color according to the state of the function
|
||||
bool active = m_function->isActive();
|
||||
KDColor text = active ? KDColorBlack : FunctionCell::k_desactiveTextColor;
|
||||
KDColor text = active ? KDColorBlack : Palette::k_desactiveTextColor;
|
||||
//Position the origin of expression
|
||||
KDSize expressionSize = m_function->layout()->size();
|
||||
KDPoint origin(0, 0.5f*(m_frame.height() - expressionSize.height()));
|
||||
KDPoint origin(k_separatorThickness, 0.5f*(m_frame.height() - expressionSize.height()));
|
||||
m_function->layout()->draw(ctx, origin, text, background);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user