Numworks Epsilon  1.4.1
Graphing Calculator Operating System
simple_interactive_curve_view_controller.h
Go to the documentation of this file.
1 #ifndef SHARED_SIMPLE_INTERACTIVE_CURVE_VIEW_CONTROLLER_H
2 #define SHARED_SIMPLE_INTERACTIVE_CURVE_VIEW_CONTROLLER_H
3 
4 #include <escher.h>
6 #include "curve_view_cursor.h"
7 #include "curve_view.h"
8 
9 namespace Shared {
10 
11 /* SimpleInteractiveCurveViewController is a View controller with a cursor that
12  * can handles zoom in/out and left and right events. */
13 
15 public:
17  View * view() override;
18  bool handleEvent(Ion::Events::Event event) override;
19  constexpr static float k_cursorRightMarginRatio = 0.04f; // (cursorWidth/2)/graphViewWidth
20  constexpr static float k_cursorLeftMarginRatio = 0.04f; // (cursorWidth/2)/graphViewWidth
21  constexpr static float k_numberOfCursorStepsInGradUnit = 5.0f;
22 protected:
23  virtual bool handleZoom(Ion::Events::Event event);
24  virtual bool handleLeftRightEvent(Ion::Events::Event event);
25  virtual void reloadBannerView() {};
26  /* the result of moveCursorVertically/Horizontally means:
27  * false -> the cursor cannot move in this direction
28  * true -> the cursor moved */
29  virtual bool moveCursorHorizontally(int direction) { return false; };
31  virtual CurveView * curveView() = 0;
32  virtual bool handleEnter() = 0;
34 };
35 
36 }
37 
38 #endif
Responder * parentResponder() const
Definition: responder.cpp:12
SimpleInteractiveCurveViewController(Responder *parentResponder, InteractiveCurveViewRange *interactiveRange, CurveView *curveView, CurveViewCursor *cursor)
Definition: view.h:23
virtual InteractiveCurveViewRange * interactiveCurveViewRange()=0