Blame view

build1/epsilon-master/apps/shared/buffer_function_title_cell.cpp 1.44 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
  #include "buffer_function_title_cell.h"
  #include <assert.h>
  
  namespace Shared {
  
  BufferFunctionTitleCell::BufferFunctionTitleCell(Orientation orientation, KDText::FontSize size) :
    FunctionTitleCell(orientation),
    m_bufferTextView(size, 0.5f, 0.5f)
  {
  }
  
  void BufferFunctionTitleCell::setHighlighted(bool highlight) {
    EvenOddCell::setHighlighted(highlight);
    m_bufferTextView.setHighlighted(highlight);
  }
  
  void BufferFunctionTitleCell::setEven(bool even) {
    EvenOddCell::setEven(even);
    m_bufferTextView.setEven(even);
  }
  
  void BufferFunctionTitleCell::setColor(KDColor color) {
    FunctionTitleCell::setColor(color);
    m_bufferTextView.setTextColor(color);
  }
  
  void BufferFunctionTitleCell::setText(const char * title) {
    m_bufferTextView.setText(title);
  }
  
  int BufferFunctionTitleCell::numberOfSubviews() const {
    return 1;
  }
  
  View * BufferFunctionTitleCell::subviewAtIndex(int index) {
    assert(index == 0);
    return &m_bufferTextView;
  }
  
  void BufferFunctionTitleCell::layoutSubviews() {
    m_bufferTextView.setFrame(bufferTextViewFrame());
  }
  
  KDRect BufferFunctionTitleCell::bufferTextViewFrame() const {
    KDRect textFrame(0, k_colorIndicatorThickness, bounds().width(), bounds().height() - k_colorIndicatorThickness);
    if (m_orientation == Orientation::VerticalIndicator){
      textFrame = KDRect(k_colorIndicatorThickness, 0, bounds().width() - k_colorIndicatorThickness-k_separatorThickness, bounds().height()-k_separatorThickness);
    }
    return textFrame;
  }
  
  }