Euphoria
container.cc
Go to the documentation of this file.
1 #include "gui/container.h"
2 
3 #include "gui/widget.h"
4 
5 
6 namespace eu::gui
7 {
8  Container::Container() = default;
9 
10 
11  Container::~Container() = default;
12 
13 
14  bool
16  {
17  return !widgets.empty();
18  }
19 
20 
21  void
22  Container::add(std::shared_ptr<Widget> widget)
23  {
24  widgets.push_back(widget);
25  }
26 
27 
28  void
30  {
31  for(const auto& w: widgets)
32  {
33  w->update(dt);
34  }
35  }
36 
37 
38  void
40  {
41  for(const std::shared_ptr<Widget>& w: widgets)
42  {
43  w->render(renderer);
44  }
45  }
46 }
bool has_any_widgets() const
Definition: container.cc:15
void add(std::shared_ptr< Widget > widget)
Definition: container.cc:22
void update(float dt)
Definition: container.cc:29
void render(render::SpriteRenderer *renderer) const
Definition: container.cc:39
std::vector< std::shared_ptr< Widget > > widgets
Definition: container.h:21