Blame view

epsilon-master/apps/shared/button_with_separator.cpp 1.5 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
  #include "button_with_separator.h"
  
  ButtonWithSeparator::ButtonWithSeparator(Responder * parentResponder, I18n::Message message, Invocation invocation) :
    Button(parentResponder, message, invocation, KDText::FontSize::Large, KDColorBlack)
  {
  }
  
  void ButtonWithSeparator::drawRect(KDContext * ctx, KDRect rect) const {
    KDCoordinate width = bounds().width();
    KDCoordinate height = bounds().height();
    ctx->fillRect(KDRect(0, 0, width, k_lineThickness), Palette::GreyBright);
    ctx->fillRect(KDRect(0, k_lineThickness, width, k_margin-k_lineThickness), Palette::WallScreen);
    // Draw rectangle around cell
    ctx->fillRect(KDRect(0, k_margin, width, k_lineThickness), Palette::GreyBright);
    ctx->fillRect(KDRect(0, k_margin+k_lineThickness, k_lineThickness, height-k_margin), Palette::GreyBright);
    ctx->fillRect(KDRect(width-k_lineThickness, k_lineThickness+k_margin, k_lineThickness, height-k_margin), Palette::GreyBright);
    ctx->fillRect(KDRect(0, height-3*k_lineThickness, width, k_lineThickness), Palette::GreyWhite);
    ctx->fillRect(KDRect(0, height-2*k_lineThickness, width, k_lineThickness), Palette::GreyBright);
    ctx->fillRect(KDRect(k_lineThickness, height-k_lineThickness, width-2*k_lineThickness, k_lineThickness), Palette::GreyMiddle);
  }
  
  
  void ButtonWithSeparator::layoutSubviews() {
    KDCoordinate width = bounds().width();
    KDCoordinate height = bounds().height();
    m_messageTextView.setFrame(KDRect(k_lineThickness, k_margin + k_lineThickness, width-2*k_lineThickness, height - 4*k_lineThickness-k_margin));
  }