mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-29 19:49:58 +02:00
[apps/graph/values] Add a class function title cell inheriting from
title cell Change-Id: I2c88477a1508a102c7d469f35bef4a811cbc93b7
This commit is contained in:
21
apps/graph/values/function_title_cell.cpp
Normal file
21
apps/graph/values/function_title_cell.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "function_title_cell.h"
|
||||
#include "../function.h"
|
||||
|
||||
namespace Graph {
|
||||
|
||||
void FunctionTitleCell::setColor(KDColor color) {
|
||||
m_functionColor = color;
|
||||
}
|
||||
|
||||
void FunctionTitleCell::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
EvenOddCell::drawRect(ctx, rect);
|
||||
// Write the "(x)"
|
||||
KDColor background = backgroundColor();
|
||||
KDSize textSize = KDText::stringSize("f");
|
||||
KDPoint origin(0.5f*(m_frame.width() - textSize.width()), 0.5f*(m_frame.height() - textSize.height()));
|
||||
ctx->drawString(Function::Parameter, origin.translatedBy(KDPoint(textSize.width(), 0)), m_functionColor , background);
|
||||
// Color the color indicator
|
||||
ctx->fillRect(KDRect(0, 0, bounds().width(), k_colorIndicatorThickness), m_functionColor);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user