List.hpp
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <etk/types.hpp>
9 #include <etk/Color.hpp>
10 #include <ewol/debug.hpp>
13 
14 namespace ewol {
15  namespace widget {
16  class List;
17  using ListShared = ememory::SharedPtr<ewol::widget::List>;
18  using ListWeak = ememory::WeakPtr<ewol::widget::List>;
23  protected:
24  List();
25  public:
26  virtual ~List();
27  void calculateMinMaxSize() override;
28  void setLabel(std::string _newLabel);
29  // drawing capabilities ....
30  private:
31  std::vector<ewol::Compositing*> m_listOObject;
32  std::vector<ivec2 > m_lineSize;
33  public:
34  void addOObject(ewol::Compositing* _newObject, int32_t _pos=-1);
35  void clearOObjectList();
36  // list properties ...
37  private:
38  int32_t m_paddingSizeX;
39  int32_t m_paddingSizeY;
40  int32_t m_displayStartRaw;
41  int32_t m_displayCurrentNbLine;
42  int32_t m_nbVisibleRaw; // set the number of visible raw (calculate don display)
43  protected:
44  // function call to display the list :
45  virtual etk::Color<> getBasicBG() {
46  return etk::Color<>(0xFF, 0xFF, 0xFF, 0xFF);
47  }
48  virtual uint32_t getNuberOfColomn() {
49  return 1;
50  };
51  virtual bool getTitle(int32_t _colomn, std::string& _myTitle, etk::Color<> &_fg, etk::Color<> &_bg) {
52  _myTitle = "";
53  return false;
54  };
55  virtual uint32_t getNuberOfRaw() {
56  return 0;
57  };
58  virtual bool getElement(int32_t _colomn, int32_t _raw, std::string &_myTextToWrite, etk::Color<> &_fg, etk::Color<> &_bg) {
59  _myTextToWrite = "";
60  _bg = etk::Color<>(0xFF, 0xFF, 0xFF, 0xFF);
61  _fg = etk::Color<>(0x00, 0x00, 0x00, 0xFF);
62  if (_raw % 2) {
63  _bg = etk::Color<>(0xFF, 0xFF, 0xFF, 0xFF);
64  } else {
65  _bg = etk::Color<>(0x7F, 0x7F, 0x7F, 0xFF);
66  }
67  return false;
68  };
69  virtual bool onItemEvent(int32_t _IdInput, enum gale::key::status _typeEvent, int32_t _colomn, int32_t _raw, float _x, float _y) {
70  return false;
71  }
76  void setRawVisible(int32_t _id);
77  protected:
78  void onGetFocus() override;
79  void onLostFocus() override;
80  void onDraw() override;
81  public:
82  void onRegenerateDisplay() override;
83  bool onEventInput(const ewol::event::Input& _event) override;
84  };
85  };
86 };
87 
void calculateMinMaxSize() override
calculate the minimum and maximum size (need to estimate expend properties of the widget) ...
Definition: List.hpp:22
void onLostFocus() override
Event of the focus has been lost by the current widget.
void onGetFocus() override
Event of the focus has been grep by the current widget.
Definition: Input.hpp:12
Widget to integrate a scrool bar in a widget. This is not a stadalone widget.
Definition: WidgetScrolled.hpp:24
Definition: Area.hpp:16
void setRawVisible(int32_t _id)
set a raw visible in the main display
Definition: Compositing.hpp:13
void onRegenerateDisplay() override
Event generated when a redraw is needed.
void onDraw() override
Common widget drawing function (called by the drawing thread [Android, X11, ...]) ...
bool onEventInput(const ewol::event::Input &_event) override
Event on an input of this Widget (finger, mouse, stilet)