Blame view

build2/epsilon-master/apps/shared/values_function_parameter_controller.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
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
53
54
55
56
57
58
  #include "values_function_parameter_controller.h"
  #include <assert.h>
  
  namespace Shared {
  
  ValuesFunctionParameterController::ValuesFunctionParameterController(char symbol) :
    ViewController(nullptr),
    m_copyColumn(I18n::Message::CopyColumnInList),
    m_selectableTableView(this, this, this),
    m_function(nullptr),
    m_symbol(symbol)
  {
  }
  
  const char * ValuesFunctionParameterController::title() {
    strlcpy(m_pageTitle, I18n::translate(I18n::Message::FunctionColumn), k_maxNumberOfCharsInTitle);
    for (int currentChar = 0; currentChar < k_maxNumberOfCharsInTitle-1; currentChar++) {
      if (m_pageTitle[currentChar] == '(') {
        m_pageTitle[currentChar-1] = *m_function->name();
        m_pageTitle[currentChar+1] = m_symbol;
        break;
      }
    }
    return m_pageTitle;
  }
  
  View * ValuesFunctionParameterController::view() {
    return &m_selectableTableView;
  }
  
  void ValuesFunctionParameterController::setFunction(Function * function) {
    m_function = function;
  }
  
  void ValuesFunctionParameterController::didBecomeFirstResponder() {
    m_selectableTableView.reloadData();
    selectCellAtLocation(0, 0);
    app()->setFirstResponder(&m_selectableTableView);
  }
  
  int ValuesFunctionParameterController::numberOfRows() {
    return 1;
  };
  
  HighlightCell * ValuesFunctionParameterController::reusableCell(int index) {
    assert(index == 0);
    return &m_copyColumn;
  }
  
  int ValuesFunctionParameterController::reusableCellCount() {
    return 1;
  }
  
  KDCoordinate ValuesFunctionParameterController::cellHeight() {
    return Metric::ParameterCellHeight;
  }
  
  }