Blame view

build3/apps/shared/simple_interactive_curve_view_controller.h 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
  #ifndef SHARED_SIMPLE_INTERACTIVE_CURVE_VIEW_CONTROLLER_H
  #define SHARED_SIMPLE_INTERACTIVE_CURVE_VIEW_CONTROLLER_H
  
  #include <escher.h>
  #include "interactive_curve_view_range.h"
  #include "curve_view_cursor.h"
  #include "curve_view.h"
  
  namespace Shared {
  
  /* SimpleInteractiveCurveViewController is a View controller with a cursor that
   * can handles zoom in/out and left and right events. */
  
  class SimpleInteractiveCurveViewController : public ViewController {
  public:
    SimpleInteractiveCurveViewController(Responder * parentResponder, InteractiveCurveViewRange * interactiveRange, CurveView * curveView, CurveViewCursor * cursor);
    View * view() override;
    bool handleEvent(Ion::Events::Event event) override;
    constexpr static float k_cursorRightMarginRatio = 0.04f; // (cursorWidth/2)/graphViewWidth
    constexpr static float k_cursorLeftMarginRatio = 0.04f;  // (cursorWidth/2)/graphViewWidth
    constexpr static float k_numberOfCursorStepsInGradUnit = 5.0f;
  protected:
    virtual bool handleZoom(Ion::Events::Event event);
    virtual bool handleLeftRightEvent(Ion::Events::Event event);
    virtual void reloadBannerView() {};
    /* the result of moveCursorVertically/Horizontally means:
     * false -> the cursor cannot move in this direction
     * true -> the cursor moved */
    virtual bool moveCursorHorizontally(int direction) { return false; };
    virtual InteractiveCurveViewRange * interactiveCurveViewRange() = 0;
    virtual CurveView * curveView() = 0;
    virtual bool handleEnter() = 0;
    CurveViewCursor * m_cursor;
  };
  
  }
  
  #endif