mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 13:50:28 +01:00
[apps/graph] make the function title cells consistent
Change-Id: Ib59f3d5f8a679cddd8a88e16711138425a6e9ecb
This commit is contained in:
52
apps/graph/function_title_cell.cpp
Normal file
52
apps/graph/function_title_cell.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
#include "function_title_cell.h"
|
||||
#include <assert.h>
|
||||
|
||||
namespace Graph {
|
||||
|
||||
FunctionTitleCell::FunctionTitleCell() :
|
||||
EvenOddCell(),
|
||||
m_bufferTextView(0.5f, 0.5f)
|
||||
{
|
||||
}
|
||||
|
||||
void FunctionTitleCell::reloadCell() {
|
||||
EvenOddCell::reloadCell();
|
||||
m_bufferTextView.setBackgroundColor(backgroundColor());
|
||||
}
|
||||
|
||||
void FunctionTitleCell::setText(const char * title) {
|
||||
m_bufferTextView.setText(title);
|
||||
}
|
||||
|
||||
void FunctionTitleCell::setColor(KDColor color) {
|
||||
m_functionColor = color;
|
||||
m_bufferTextView.setTextColor(color);
|
||||
}
|
||||
|
||||
void FunctionTitleCell::setOrientation(Orientation orientation) {
|
||||
m_orientation = orientation;
|
||||
}
|
||||
|
||||
int FunctionTitleCell::numberOfSubviews() const {
|
||||
return 1;
|
||||
}
|
||||
|
||||
View * FunctionTitleCell::subviewAtIndex(int index) {
|
||||
assert(index == 0);
|
||||
return &m_bufferTextView;
|
||||
}
|
||||
|
||||
void FunctionTitleCell::layoutSubviews() {
|
||||
m_bufferTextView.setFrame(bounds());
|
||||
}
|
||||
|
||||
void FunctionTitleCell::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
EvenOddCell::drawRect(ctx, rect);
|
||||
if (m_orientation == Orientation::VerticalIndicator){
|
||||
ctx->fillRect(KDRect(0, 0, k_colorIndicatorThickness, bounds().height()), m_functionColor);
|
||||
} else {
|
||||
ctx->fillRect(KDRect(0, 0, bounds().width(), k_colorIndicatorThickness), m_functionColor);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user