Gird.hpp
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <etk/types.hpp>
9 #include <vector>
10 #include <ewol/debug.hpp>
11 #include <ewol/widget/Widget.hpp>
12 #include <ewol/widget/Manager.hpp>
13 
14 namespace ewol {
15  namespace widget {
16  class Gird;
17  using GirdShared = ememory::SharedPtr<ewol::widget::Gird>;
18  using GirdWeak = ememory::WeakPtr<ewol::widget::Gird>;
22  class Gird :public ewol::Widget {
23  private:
24  class GirdProperties {
25  public:
26  ewol::WidgetShared widget;
27  int32_t row;
28  int32_t col;
29  };
30  int32_t m_sizeRow;
31  int32_t m_uniformSizeRow;
32  std::vector<int32_t> m_sizeCol;
33  std::vector<GirdProperties> m_subWidget;
34  ewol::WidgetShared m_tmpWidget;
35  bool m_gavityButtom;
36  protected:
40  Gird();
41  public:
42  DECLARE_WIDGET_FACTORY(Gird, "Gird");
46  virtual ~Gird();
51  void setColNumber(int32_t _colNumber);
57  void setColSize(int32_t _colId, int32_t _size);
62  void setRowSize(int32_t _size);
68  int32_t getColSize(int32_t _colId);
73  int32_t getRowSize();
78  m_gavityButtom = true;
79  markToRedraw();
80  }
84  void setGravityTop() {
85  m_gavityButtom = false;
86  markToRedraw();
87  }
88  public:
92  virtual void subWidgetRemoveAll();
99  virtual void subWidgetAdd(int32_t _colId, int32_t _rowId, ewol::WidgetShared _newWidget);
104  virtual void subWidgetRemove(ewol::WidgetShared _newWidget);
110  virtual void subWidgetRemove(int32_t _colId, int32_t _rowId);
115  virtual void subWidgetUnLink(ewol::WidgetShared _newWidget);
121  virtual void subWidgetUnLink(int32_t _colId, int32_t _rowId);
122  private:
123  // TODO : property
124  ivec2 m_borderSize;
125  public:
130  void setBorderSize(const ivec2& _newBorderSize);
135  const ivec2& getBorderSize() {
136  return m_borderSize;
137  };
138  public:
139  virtual void systemDraw(const ewol::DrawProperty& _displayProp) override;
140  virtual void onRegenerateDisplay() override;
141  virtual ewol::WidgetShared getWidgetAtPos(const vec2& pos) override;
142  virtual void onChangeSize() override;
143  virtual void calculateMinMaxSize() override;
144  };
145  };
146 };
Definition: DrawProperty.hpp:15
int32_t getRowSize()
get the size view of the lines.
int32_t getColSize(int32_t _colId)
get the size view of a colomn.
void setColNumber(int32_t _colNumber)
set the number of colomn
virtual 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
void setBorderSize(const ivec2 &_newBorderSize)
set the current border size of the current element:
void setRowSize(int32_t _size)
change a size view of a line.
void setColSize(int32_t _colId, int32_t _size)
change a size view of a colomn.
const ivec2 & getBorderSize()
get the current border size of the current element:
Definition: Gird.hpp:135
Definition: Gird.hpp:22
void setGravityButtom()
set the gravity of the widget on the Button (index 0 is on buttom)
Definition: Gird.hpp:77
Definition: Area.hpp:16
virtual ~Gird()
Desstructor.
virtual void subWidgetRemove(ewol::WidgetShared _newWidget)
remove definitly a widget from the system and this Gird.
virtual void subWidgetRemoveAll()
remove all sub element from the widget.
virtual ewol::WidgetShared getWidgetAtPos(const vec2 &pos) override
get the widget at the specific windows absolute position
virtual void calculateMinMaxSize() override
calculate the minimum and maximum size (need to estimate expend properties of the widget) ...
virtual void markToRedraw()
The widget mark itself that it need to regenerate the nest time.
virtual void subWidgetAdd(int32_t _colId, int32_t _rowId, ewol::WidgetShared _newWidget)
add at end position a Widget (note : This system use an inverted phylisophie (button to top...
virtual void onChangeSize() override
Parent have set the size and the origin. the container need to update the subwidget property...
Widget class is the main widget interface, it hase some generic properties: :** known his parent :** ...
Definition: Widget.hpp:73
Gird()
Constructor.
void setGravityTop()
set the gravity of the widget on the Top (index 0 is on top)
Definition: Gird.hpp:84
virtual void subWidgetUnLink(ewol::WidgetShared _newWidget)
Just unlick the specify widget, this function does not remove it from the system (if you can...
virtual void onRegenerateDisplay() override
Event generated when a redraw is needed.