Container2.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/Padding.hpp>
12 
13 namespace ewol {
14  namespace widget {
15  class Container2;
16  using Container2Shared = ememory::SharedPtr<ewol::widget::Container2>;
17  using Container2Weak = ememory::WeakPtr<ewol::widget::Container2>;
22  class Container2 : public ewol::Widget {
23  protected:
26  protected:
32  Container2();
33  public:
37  virtual ~Container2();
38  private:
44  void setSubWidget(ewol::WidgetShared _subWidget, int32_t _idWidget);
45  public:
50  void setSubWidget(ewol::WidgetShared _subWidget) {
51  setSubWidget(_subWidget, 0);
52  }
58  setSubWidget(_subWidget, 1);
59  }
60  private:
66  ewol::WidgetShared getSubWidget(int32_t _idWidget) const {
67  return m_subWidget[_idWidget];
68  };
69  public:
75  return getSubWidget(0);
76  };
82  return getSubWidget(1);
83  };
84  private:
89  void subWidgetRemove(int32_t _idWidget);
90  public:
94  void subWidgetRemove() {
95  subWidgetRemove(0);
96  }
101  subWidgetRemove(1);
102  }
103  private:
108  void subWidgetUnLink(int32_t _idWidget);
109  public:
114  subWidgetUnLink(0);
115  }
120  subWidgetUnLink(1);
121  }
122  protected:
129  virtual ewol::Padding onChangeSizePadded(const ewol::Padding& _padding = ewol::Padding(0,0,0,0));
135  virtual void calculateMinMaxSizePadded(const ewol::Padding& _padding = ewol::Padding(0,0,0,0));
145  int32_t convertId(int32_t _id) {
146  if (m_subWidget[_id] == nullptr) {
147  return (_id+1)%2;
148  }
149  return _id;
150  }
156  virtual void subWidgetReplace(const ewol::WidgetShared& _oldWidget,
157  const ewol::WidgetShared& _newWidget);
158  public:
159  void systemDraw(const ewol::DrawProperty& _displayProp) override;
160  void onRegenerateDisplay() override;
161  void onChangeSize() override {
163  }
164  void calculateMinMaxSize() override {
166  }
167  ewol::ObjectShared getSubObjectNamed(const std::string& _objectName) override;
168  bool loadXML(const exml::Element& _node) override;
169  void setOffset(const vec2& _newVal) override;
170  void requestDestroyFromChild(const ewol::ObjectShared& _child) override;
171  };
172  };
173 };
bool loadXML(const exml::Element &_node) override
load properties with an XML node.
void requestDestroyFromChild(const ewol::ObjectShared &_child) override
Called by a whild that want to remove pointer of itself from the current list of his parrent...
Definition: DrawProperty.hpp:15
Container2()
Constructor.
ewol::WidgetShared m_subWidget[2]
2 subwidget possible
Definition: Container2.hpp:24
void setSubWidget(ewol::WidgetShared _subWidget)
Specify the current widget.
Definition: Container2.hpp:50
int32_t m_idWidgetDisplayed
current widget displayed
Definition: Container2.hpp:25
void setOffset(const vec2 &_newVal) override
set the zoom property of the widget.
void subWidgetRemove()
remove the subWidget node (async).
Definition: Container2.hpp:94
ewol::ObjectShared getSubObjectNamed(const std::string &_objectName) override
Retrive an object with his name (in the global list)
the Cotainer widget is a widget that have an only one subWidget
Definition: Container2.hpp:22
void subWidgetRemoveToggle()
remove the subWidget Toggle node (async).
Definition: Container2.hpp:100
Definition: Area.hpp:16
void subWidgetUnLink()
Unlink the subwidget Node.
Definition: Container2.hpp:113
void calculateMinMaxSize() override
calculate the minimum and maximum size (need to estimate expend properties of the widget) ...
Definition: Container2.hpp:164
virtual ~Container2()
Destructor.
virtual void calculateMinMaxSizePadded(const ewol::Padding &_padding=ewol::Padding(0, 0, 0, 0))
calculate the minimum and maximum size (need to estimate expend properties of the widget) ...
virtual void onDetectPresenceToggleWidget()
Called when parsing a XML and detect the presence of a second Widget.
Definition: Container2.hpp:139
void onChangeSize() override
Parent have set the size and the origin. the container need to update the subwidget property...
Definition: Container2.hpp:161
Definition: Padding.hpp:14
virtual void subWidgetReplace(const ewol::WidgetShared &_oldWidget, const ewol::WidgetShared &_newWidget)
Replace a old subwidget with a new one.
int32_t convertId(int32_t _id)
convert ID of the widget if not existed
Definition: Container2.hpp:145
Widget class is the main widget interface, it hase some generic properties: :** known his parent :** ...
Definition: Widget.hpp:73
void setSubWidgetToggle(ewol::WidgetShared _subWidget)
Specify the current toggle widget.
Definition: Container2.hpp:57
ewol::WidgetShared getSubWidget() const
get the current displayed composition
Definition: Container2.hpp:74
ewol::WidgetShared getSubWidgetToggle() const
get the current displayed composition
Definition: Container2.hpp:81
void onRegenerateDisplay() override
Event generated when a redraw is needed.
void subWidgetUnLinkToggle()
Unlink the subwidget Toggle Node.
Definition: Container2.hpp:119
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
virtual ewol::Padding onChangeSizePadded(const ewol::Padding &_padding=ewol::Padding(0, 0, 0, 0))
Parent set the possible diplay size of the current widget whith his own possibilities By default this...