WidgetScrolled.hpp
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <etk/types.hpp>
9 #include <ewol/debug.hpp>
10 #include <ewol/widget/Widget.hpp>
11 #include <ewol/widget/Scroll.hpp>
13 
14 #define CALCULATE_SIMULTANEOUS_FINGER (5)
15 
16 namespace ewol {
17  namespace widget {
18  class WidgetScrolled;
19  using WidgetScrolledShared = ememory::SharedPtr<ewol::widget::WidgetScrolled>;
20  using WidgetScrolledWeak = ememory::WeakPtr<ewol::widget::WidgetScrolled>;
24  class WidgetScrolled : public ewol::Widget {
25  public: // properties:
28  // TODO : All property
29  public:
34  };
35  private:
36  ewol::compositing::Shaper m_shaperH;
37  ewol::compositing::Shaper m_shaperV;
38  protected:
42  private: // Mouse section :
43  enum scrollingMode m_scroollingMode;
44  float m_pixelScrolling;
45  vec2 m_highSpeedStartPos;
46  enum Scroll::highSpeedMode m_highSpeedMode;
47  int32_t m_highSpeedButton;
48  enum gale::key::type m_highSpeedType;
49  private: // finger section:
50  bool m_singleFingerMode;
51  public:
56  void setSingleFinger(bool _status);
62  bool getSingleFinger() {
63  return m_singleFingerMode;
64  }
65  private:
66  bool m_fingerPresent[CALCULATE_SIMULTANEOUS_FINGER];
67  bool m_fingerScoolActivated;
68  vec2 m_fingerMoveStartPos[CALCULATE_SIMULTANEOUS_FINGER];
69  protected:
75  void init() override;
76  public:
77  DECLARE_WIDGET_FACTORY(WidgetScrolled, "WidgetScrolled");
81  virtual ~WidgetScrolled();
82  protected:
83  void onDraw() override;
84  public:
85  void onRegenerateDisplay() override;
86  bool onEventInput(const ewol::event::Input& _event) override;
87  void systemDraw(const ewol::DrawProperty& _displayProp) override;
88  protected:
93  void setScrollingSize(float _nbPixel) {
94  m_pixelScrolling = _nbPixel;
95  };
100  void scroolingMode(enum scrollingMode _newMode);
105  void setMaxSize(const vec2& _localSize) {
106  m_maxSize = _localSize;
107  };
114  void setScrollingPositionDynamic(vec2 _borderWidth, const vec2& _currentPosition, bool _center = false);
119  void setLimitScrolling(float _poucentageLimit) {
120  m_limitScrolling = std::avg(0.1f, _poucentageLimit,0.9f);
121  };
122  protected:
123  virtual void onChangePropertyShapeVert();
124  virtual void onChangePropertyShapeHori();
125  };
126  }
127 }
128 
Definition: DrawProperty.hpp:15
WidgetScrolled()
Scroll Widget main constructor to be herited from an other widget (this is not a stand-alone widget) ...
Definition: Input.hpp:12
No Zoom , can UP and down, left and right.
Definition: WidgetScrolled.hpp:31
void setScrollingPositionDynamic(vec2 _borderWidth, const vec2 &_currentPosition, bool _center=false)
Request a specific position for the scrolling of the current windows.
eproperty::Value< std::string > propertyShapeHori
Horizontal shaper name.
Definition: WidgetScrolled.hpp:27
Zoom enable, no move left and right.
Definition: WidgetScrolled.hpp:33
Widget to integrate a scrool bar in a widget. This is not a stadalone widget.
Definition: WidgetScrolled.hpp:24
bool onEventInput(const ewol::event::Input &_event) override
Event on an input of this Widget (finger, mouse, stilet)
bool getSingleFinger()
Get the single finger capabilities.
Definition: WidgetScrolled.hpp:62
Definition: Area.hpp:16
void setLimitScrolling(float _poucentageLimit)
set the scrolling limit when arriving at he end of the widget
Definition: WidgetScrolled.hpp:119
void setMaxSize(const vec2 &_localSize)
set the specific mawimum size of the widget
Definition: WidgetScrolled.hpp:105
void scroolingMode(enum scrollingMode _newMode)
Specify the mode of scrolling for this windows.
vec2 m_originScrooled
pixel distance from the origin of the display (Bottum left)
Definition: WidgetScrolled.hpp:39
eproperty::Value< std::string > propertyShapeVert
Vertical shaper name.
Definition: WidgetScrolled.hpp:26
void setScrollingSize(float _nbPixel)
For mouse event when we have a scrolling UP and dows, specify the number of pixel that we scrooled...
Definition: WidgetScrolled.hpp:93
void onDraw() override
Common widget drawing function (called by the drawing thread [Android, X11, ...]) ...
void onRegenerateDisplay() override
Event generated when a redraw is needed.
vec2 m_maxSize
Maximum size of the Widget ==> to display scrollbar.
Definition: WidgetScrolled.hpp:40
Widget class is the main widget interface, it hase some generic properties: :** known his parent :** ...
Definition: Widget.hpp:73
float m_limitScrolling
Mimit scrolling represent the propertion of the minimel scrolling activate (0.2 ==> 20% migt all time...
Definition: WidgetScrolled.hpp:41
scrollingMode
Definition: WidgetScrolled.hpp:30
void setSingleFinger(bool _status)
Set the single finger capabilities/.
void systemDraw(const ewol::DrawProperty &_displayProp) override
{SYSTEM} extern interface to request a draw ... (called by the drawing thread [Android, X11, ...]) This function generate a clipping with the viewport openGL system. Like this a widget draw can not draw over an other widget
the Shaper system is a basic theme configuration for every widget, it corespond at a background displ...
Definition: Shaper.hpp:39
Zoom enable, no move left and right.
Definition: WidgetScrolled.hpp:32
virtual ~WidgetScrolled()
Scroll widget destructor.