Blame view

emulateur/epsilon-nofrendo/apps/shared/go_to_parameter_controller.cpp 1.45 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
  #include "go_to_parameter_controller.h"
  #include "text_field_delegate_app.h"
  #include <assert.h>
  
  namespace Shared {
  
  GoToParameterController::GoToParameterController(Responder * parentResponder, InteractiveCurveViewRange * graphRange, CurveViewCursor * cursor, I18n::Message symbol) :
    FloatParameterController(parentResponder),
    m_cursor(cursor),
    m_graphRange(graphRange),
    m_abscisseCell(nullptr),
    m_abscissaSymbol(symbol)
  {
  }
  
  int GoToParameterController::numberOfRows() {
    return 2;
  }
  
  HighlightCell * GoToParameterController::reusableParameterCell(int index, int type) {
    assert(index == 0);
    return m_abscisseCell;
  }
  
  int GoToParameterController::reusableParameterCellCount(int type) {
    return 1;
  }
  
  bool GoToParameterController::handleEvent(Ion::Events::Event event) {
    if (event == Ion::Events::Left) {
      stackController()->pop();
      return true;
    }
    return false;
  }
  
  void GoToParameterController::buttonAction() {
    StackViewController * stack = (StackViewController *)parentResponder();
    stack->pop();
    stack->pop();
  }
  
  View * GoToParameterController::loadView() {
    SelectableTableView * tableView = (SelectableTableView *)FloatParameterController::loadView();
    m_abscisseCell = new MessageTableCellWithEditableText(tableView, this, m_draftTextBuffer, m_abscissaSymbol);
    return tableView;
  }
  
  void GoToParameterController::unloadView(View * view) {
    delete m_abscisseCell;
    m_abscisseCell = nullptr;
    FloatParameterController::unloadView(view);
  }
  
  }