Numworks Epsilon  1.4.1
Graphing Calculator Operating System
function_expression_cell.cpp
Go to the documentation of this file.
2 #include <assert.h>
3 
4 using namespace Poincare;
5 
6 namespace Shared {
7 
8 FunctionExpressionCell::FunctionExpressionCell() :
9  EvenOddCell(),
10  m_expressionView()
11 {
12 }
13 
15  m_expressionView.setExpression(expressionLayout);
16 }
17 
19  m_expressionView.setTextColor(textColor);
20 }
21 
24  m_expressionView.setBackgroundColor(backgroundColor());
25 }
26 
28  if (highlight != EvenOddCell::isHighlighted()) {
29  EvenOddCell::setHighlighted(highlight);
30  m_expressionView.setBackgroundColor(backgroundColor());
31  }
32 }
33 
35  return 1;
36 }
37 
39  assert(index == 0);
40  return &m_expressionView;
41 }
42 
44  KDRect expressionFrame(k_separatorThickness+k_margin, 0, bounds().width() - k_separatorThickness-k_margin, bounds().height()-k_separatorThickness);
45  m_expressionView.setFrame(expressionFrame);
46 }
47 
49  KDColor separatorColor = m_even ? Palette::WallScreen : KDColorWhite;
50  // Color the vertical separator
51  ctx->fillRect(KDRect(0, 0, k_separatorThickness, bounds().height()), Palette::GreyBright);
52  // Color the horizontal separator
53  ctx->fillRect(KDRect(k_separatorThickness, bounds().height()-k_separatorThickness, bounds().width()-k_separatorThickness, k_separatorThickness), separatorColor);
54  // Color the margin
55  ctx->fillRect(KDRect(k_separatorThickness, 0, k_margin, bounds().height()-k_separatorThickness), backgroundColor());
56 }
57 
58 }
void setBackgroundColor(KDColor backgroundColor)
#define assert(e)
Definition: assert.h:9
virtual void setEven(bool even)
void setFrame(KDRect frame)
Definition: view.cpp:125
void setExpression(Poincare::ExpressionLayout *expressionLayout)
void drawRect(KDContext *ctx, KDRect rect) const override
virtual KDColor backgroundColor() const
View * subviewAtIndex(int index) override
void setHighlighted(bool highlight) override
constexpr KDColor KDColorWhite
Definition: color.h:42
void setTextColor(KDColor textColor)
bool isHighlighted() const
static constexpr KDColor WallScreen
Definition: palette.h:19
Definition: rect.h:26
void fillRect(KDRect rect, KDColor color)
Definition: context_rect.cpp:8
Definition: color.h:6
Definition: view.h:23
void setExpression(Poincare::ExpressionLayout *expressionLayout)
virtual void setHighlighted(bool highlight)
static constexpr KDColor GreyBright
Definition: palette.h:13
KDRect bounds() const
Definition: view.cpp:157