Blame view

build6/epsilon-master/apps/shared/float_parameter_controller.h 1.99 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
  #ifndef SHARED_FLOAT_PARAMETER_CONTROLLER_H
  #define SHARED_FLOAT_PARAMETER_CONTROLLER_H
  
  #include <escher.h>
  #include "parameter_text_field_delegate.h"
  #include "button_with_separator.h"
  
  namespace Shared {
  
  /* This controller edits float parameter of any model (given through
   * parameterAtIndex and setParameterAtIndex). */
  
  class FloatParameterController : public DynamicViewController, public ListViewDataSource, public SelectableTableViewDataSource, public ParameterTextFieldDelegate {
  public:
    FloatParameterController(Responder * parentResponder);
    void didBecomeFirstResponder() override;
    void viewWillAppear() override;
    void willExitResponderChain(Responder * nextFirstResponder) override;
    bool handleEvent(Ion::Events::Event event) override;
  
    int typeAtLocation(int i, int j) override;
    int reusableCellCount(int type) override;
    HighlightCell * reusableCell(int index, int type) override;
    KDCoordinate rowHeight(int j) override;
    KDCoordinate cumulatedHeightFromIndex(int j) override;
    int indexFromCumulatedHeight(KDCoordinate offsetY) override;
    void willDisplayCellForIndex(HighlightCell * cell, int index) override;
    bool textFieldShouldFinishEditing(TextField * textField, Ion::Events::Event event) override;
    bool textFieldDidFinishEditing(TextField * textField, const char * text, Ion::Events::Event event) override;
  protected:
    int activeCell();
    StackViewController * stackController();
    virtual double parameterAtIndex(int index) = 0;
    virtual SelectableTableView * selectableTableView();
    View * loadView() override;
    void unloadView(View * view) override;
  private:
    constexpr static int k_buttonMargin = 6;
    virtual void buttonAction();
    virtual I18n::Message okButtonText();
    virtual int reusableParameterCellCount(int type) = 0;
    virtual HighlightCell * reusableParameterCell(int index, int type) = 0;
    TextFieldDelegateApp * textFieldDelegateApp() override;
    virtual bool setParameterAtIndex(int parameterIndex, double f) = 0;
    ButtonWithSeparator * m_okButton;
  };
  
  }
  
  #endif