Blame view

build6/epsilon-master/apps/shared/function_expression_cell.cpp 1.22 KB
6663b6c9   adorian   projet complet av...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  #include "function_expression_cell.h"
  
  namespace Shared {
  
  FunctionExpressionCell::FunctionExpressionCell() :
    EvenOddExpressionCell()
  {
  }
  
  KDSize FunctionExpressionCell::minimalSizeForOptimalDisplay() const {
    KDSize expressionSize = m_expressionView.minimalSizeForOptimalDisplay();
    return KDSize(m_leftMargin + expressionSize.width() + m_rightMargin, expressionSize.height()+k_separatorThickness);
  }
  
  void FunctionExpressionCell::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 left margin
    ctx->fillRect(KDRect(0, 0, m_leftMargin, bounds().height()-k_separatorThickness), backgroundColor());
    // Color the right margin
    ctx->fillRect(KDRect(0, bounds().width() - m_rightMargin, m_rightMargin, bounds().height()-k_separatorThickness), backgroundColor());
  
  }
  
  void FunctionExpressionCell::layoutSubviews() {
    KDRect expressionFrame(m_leftMargin, 0, bounds().width() - m_leftMargin - m_rightMargin, bounds().height()-k_separatorThickness);
    m_expressionView.setFrame(expressionFrame);
  }
  
  }