Neo  0.5.0
Developer Documentation
Container.h
Go to the documentation of this file.
1 #ifndef __CONTAINER_H
2 #define __CONTAINER_H
3 
4 #include <Neo2DEngine.h>
5 #include <Widget.h>
6 #include <vector>
7 
8 namespace Neo2D
9 {
10 namespace Gui
11 {
12 using namespace Neo;
13 
20 class NEO2D_EXPORT Container : public Widget
21 {
22  protected:
23  std::vector<Widget*> m_content;
24 
25  public:
26  Container(unsigned int x, unsigned int y, unsigned int width,
27  unsigned int height, const char* label)
28  : Widget(x, y, width, height, label)
29  {
30  }
31 
32  ~Container();
33 
34  DISOWN(Widget* w) void addWidget(Widget* w)
35  {
36  w->setParent(this);
37  m_content.push_back(w);
38  }
39 
40  void draw();
41  void draw(Vector2 offset) { draw(); }
42  void update();
43 };
44 
45 }
46 }
47 
48 #endif
std::vector< Widget * > m_content
Definition: Container.h:23
The Widget class contains all information that is common to all GUI widgets.
Definition: Widget.h:72
A Container organizes multiple Widgets into one to provide layout functionality.
Definition: Container.h:20
Definition: Vector2.h:31
Definition: Button.h:42
void draw(Vector2 offset)
Draws the widget to the canvas it belongs to.
Definition: Container.h:41
Definition: Color.h:29
void setParent(Widget *w)
Definition: Widget.h:132
Container(unsigned int x, unsigned int y, unsigned int width, unsigned int height, const char *label)
Definition: Container.h:26
DISOWN(Widget *w) void addWidget(Widget *w)
Definition: Container.h:34