Button.hpp
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <etk/types.hpp>
9 #include <ewol/debug.hpp>
14 #include <ewol/widget/Manager.hpp>
15 #include <esignal/Signal.hpp>
16 
17 
18 
19 namespace ewol {
20  namespace widget {
21  class Button;
22  using ButtonShared = ememory::SharedPtr<ewol::widget::Button>;
23  using ButtonWeak = ememory::WeakPtr<ewol::widget::Button>;
29  public:
30  enum buttonLock{
35  };
36  public: // Event list
37  esignal::Signal<> signalPressed;
38  esignal::Signal<> signalDown;
39  esignal::Signal<> signalUp;
40  esignal::Signal<> signalEnter;
41  esignal::Signal<> signalLeave;
42  esignal::Signal<bool> signalValue;
43  public: // propertie list
49  private:
50  ewol::compositing::Shaper m_shaper;
51  protected:
56  Button();
57  void init() override;
58  public:
59  DECLARE_WIDGET_FACTORY(Button, "Button");
63  virtual ~Button();
64  private:
65  bool m_mouseHover;
66  bool m_buttonPressed;
67  // hover area :
68  vec2 m_selectableAreaPos;
69  vec2 m_selectableAreaSize;
70  private:
75  void changeStatusIn(int32_t _newStatusId);
79  void CheckStatus();
80  protected: // Derived function
81  virtual void onDraw() override;
82  public:
83  void calculateMinMaxSize() override;
84  void onChangeSize() override;
85  void onRegenerateDisplay() override;
86  bool onEventInput(const ewol::event::Input& _event) override;
87  bool onEventEntry(const ewol::event::Entry& _event) override;
88  void onDetectPresenceToggleWidget() override {
89  propertyToggleMode.set(true);
90  }
91  protected:
92  esignal::Connection m_PCH;
93 
97  void periodicCall(const ewol::event::Time& _event);
98  void onLostFocus() override;
99  protected:
100  virtual void onChangePropertyShape();
101  virtual void onChangePropertyValue();
102  virtual void onChangePropertyLock();
103  virtual void onChangePropertyToggleMode();
104  virtual void onChangePropertyEnableSingle();
105  };
106  };
107 };
Button()
Constructor.
void onChangeSize() override
Parent have set the size and the origin. the container need to update the subwidget property...
Definition: Entry.hpp:13
all event are trashed == > acctivity of the button is disable
Definition: Button.hpp:34
void calculateMinMaxSize() override
calculate the minimum and maximum size (need to estimate expend properties of the widget) ...
Definition: Input.hpp:12
virtual void onDraw() override
Common widget drawing function (called by the drawing thread [Android, X11, ...]) ...
void onDetectPresenceToggleWidget() override
Called when parsing a XML and detect the presence of a second Widget.
Definition: Button.hpp:88
eproperty::Value< bool > propertyEnableSingle
When a single subwidget is set display all time it.
Definition: Button.hpp:48
bool onEventInput(const ewol::event::Input &_event) override
Event on an input of this Widget (finger, mouse, stilet)
void onLostFocus() override
Event of the focus has been lost by the current widget.
the Cotainer widget is a widget that have an only one subWidget
Definition: Container2.hpp:22
void onRegenerateDisplay() override
Event generated when a redraw is needed.
Definition: Time.hpp:14
eproperty::Value< std::string > propertyShape
shaper name property
Definition: Button.hpp:44
Definition: Area.hpp:16
esignal::Connection m_PCH
Periodic Call Handle to remove it when needed.
Definition: Button.hpp:92
eproperty::List< enum buttonLock > propertyLock
Current lock state of the button.
Definition: Button.hpp:46
bool onEventEntry(const ewol::event::Entry &_event) override
Entry event. represent the physical event :
virtual void set(const TYPE &_newVal)
normal status of the button
Definition: Button.hpp:31
When the state is set in pressed, the status stay in this one.
Definition: Button.hpp:32
virtual ~Button()
Destructor.
the Shaper system is a basic theme configuration for every widget, it corespond at a background displ...
Definition: Shaper.hpp:39
When the state is set in not pressed, the status stay in this one.
Definition: Button.hpp:33
buttonLock
Definition: Button.hpp:30
void periodicCall(const ewol::event::Time &_event)
Periodic call to update grapgic display.
eproperty::Value< bool > propertyToggleMode
The button is able to toggle.
Definition: Button.hpp:47
a composed button is a button with an inside composed with the specify XML element ==> this permit to...
Definition: Button.hpp:28
eproperty::Value< bool > propertyValue
Current state of the button.
Definition: Button.hpp:45