Entry.hpp
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <etk/types.hpp>
9 #include <regex>
10 #include <ewol/debug.hpp>
14 #include <ewol/widget/Widget.hpp>
15 #include <etk/Color.hpp>
16 #include <ewol/widget/Manager.hpp>
17 #include <esignal/Signal.hpp>
18 
19 namespace ewol {
20  namespace widget {
21  class Entry;
22  using EntryShared = ememory::SharedPtr<ewol::widget::Entry>;
23  using EntryWeak = ememory::WeakPtr<ewol::widget::Entry>;
34  class Entry : public ewol::Widget {
35  public: // Event list
36  esignal::Signal<> signalClick;
37  esignal::Signal<std::string> signalEnter;
38  esignal::Signal<std::string> signalModify;
39  public: // propertie list
40  eproperty::Value<std::string> propertyShape;
45  private:
47  int32_t m_colorIdTextFg;
48  int32_t m_colorIdTextBg;
49  int32_t m_colorIdCursor;
50  int32_t m_colorIdSelection;
52  public:
57  Entry();
58  void init() override;
59  public:
60  DECLARE_WIDGET_FACTORY(Entry, "Entry");
64  virtual ~Entry();
65  protected:
70  void setInternalValue(const std::string& _newData);
71  private:
72  std::regex m_regex;
73  private:
74  bool m_needUpdateTextPos;
75  int32_t m_displayStartPosition;
76  bool m_displayCursor;
77  int32_t m_displayCursorPos;
78  int32_t m_displayCursorPosSelection;
79  protected:
83  virtual void markToUpdateTextPosition();
88  virtual void updateTextPosition();
94  virtual void updateCursorPosition(const vec2& _pos, bool _Selection=false);
95  public:
100  virtual void copySelectionToClipBoard(enum gale::context::clipBoard::clipboardListe _clipboardID);
105  virtual void removeSelected();
106  public:
107  void onRegenerateDisplay() override;
108  bool onEventInput(const ewol::event::Input& _event) override;
109  bool onEventEntry(const ewol::event::Entry& _event) override;
110  void onEventClipboard(enum gale::context::clipBoard::clipboardListe _clipboardID) override;
111  void calculateMinMaxSize() override;
112  protected:
113  void onDraw() override;
114  void onGetFocus() override;
115  void onLostFocus() override;
116  virtual void changeStatusIn(int32_t _newStatusId);
117  protected:
118  esignal::Connection m_PCH;
119 
123  void periodicCall(const ewol::event::Time& _event);
124  private: // callback functions
125  void onCallbackShortCut(const std::string& _value);
126  void onCallbackEntryClean();
127  void onCallbackCut();
128  void onCallbackCopy();
129  void onCallbackPaste();
130  void onCallbackSelect(bool _all);
131  protected:
132  virtual void onChangePropertyShaper();
133  virtual void onChangePropertyValue();
134  virtual void onChangePropertyMaxCharacter();
135  virtual void onChangePropertyRegex();
136  virtual void onChangePropertyTextWhenNothing();
137  };
138  };
139 };
bool onEventEntry(const ewol::event::Entry &_event) override
Entry event. represent the physical event :
void calculateMinMaxSize() override
calculate the minimum and maximum size (need to estimate expend properties of the widget) ...
Definition: Entry.hpp:13
void setInternalValue(const std::string &_newData)
internal check the value with RegExp checking
eproperty::Value< std::string > propertyValue
string that must be displayed
Definition: Entry.hpp:41
Definition: Input.hpp:12
eproperty::Value< std::string > propertyRegex
regular expression value
Definition: Entry.hpp:43
virtual void markToUpdateTextPosition()
informe the system thet the text change and the start position change
esignal::Signal< std::string > signalModify
data change
Definition: Entry.hpp:38
virtual void updateCursorPosition(const vec2 &_pos, bool _Selection=false)
change the cursor position with the curent position requested on the display
Definition: Text.hpp:22
Entry()
Contuctor.
Definition: Time.hpp:14
bool onEventInput(const ewol::event::Input &_event) override
Event on an input of this Widget (finger, mouse, stilet)
Definition: Area.hpp:16
virtual ~Entry()
Destuctor.
esignal::Connection m_PCH
Periodic call handle to remove it when needed.
Definition: Entry.hpp:118
eproperty::Value< std::string > propertyTextWhenNothing
Text to display when nothing in in the entry (decorated text...)
Definition: Entry.hpp:44
Entry box display :
Definition: Entry.hpp:34
virtual void removeSelected()
remove the selected area
esignal::Signal< std::string > signalEnter
Enter key is pressed.
Definition: Entry.hpp:37
void onGetFocus() override
Event of the focus has been grep by the current widget.
void periodicCall(const ewol::event::Time &_event)
Periodic call to update grapgic display.
Widget class is the main widget interface, it hase some generic properties: :** known his parent :** ...
Definition: Widget.hpp:73
virtual void updateTextPosition()
update the display position start == > depending of the position of the Cursor and the size of the Da...
virtual void copySelectionToClipBoard(enum gale::context::clipBoard::clipboardListe _clipboardID)
Copy the selected data on the specify clipboard.
void onRegenerateDisplay() override
Event generated when a redraw is needed.
the Shaper system is a basic theme configuration for every widget, it corespond at a background displ...
Definition: Shaper.hpp:39
esignal::Signal signalClick
bang on click the entry box
Definition: Entry.hpp:36
void onDraw() override
Common widget drawing function (called by the drawing thread [Android, X11, ...]) ...
eproperty::Range< int32_t > propertyMaxCharacter
number max of xharacter in the list
Definition: Entry.hpp:42
void onLostFocus() override
Event of the focus has been lost by the current widget.
void onEventClipboard(enum gale::context::clipBoard::clipboardListe _clipboardID) override
Event on a past event == > this event is asynchronous due to all system does not support direct getti...