Aether
SDL2 based UI Framework for NX
Container.hpp
1 #ifndef AETHER_CONTAINER_HPP
2 #define AETHER_CONTAINER_HPP
3 
4 #include "Aether/base/Element.hpp"
5 
6 namespace Aether {
16  class Container : public Element {
17  protected:
18  void addElementAt(Element * e, size_t i);
19 
20  public:
29  Container(int x = 0, int y = 0, int w = 100, int h = 100);
30 
34  void setActive();
35 
39  void setInactive();
40 
41  void addElement(Element * e);
42  bool handleEvent(InputEvent * e);
43  bool removeElement(Element * e);
44  void removeAllElements();
45  bool returnElement(Element * e);
46  void returnAllElements();
47 
57  friend bool moveHighlight(Container * parent, std::function<bool(Element *, Element*)> check, std::function<int(Element *, Element *)> dist);
58  };
59 };
60 
61 #endif
void returnAllElements()
Removes (but does not delete) all children elements.
bool handleEvent(InputEvent *e)
Attempt to handle a given event.
void setInactive()
Removes focus from the focused element.
bool removeElement(Element *e)
Attempt to delete given child element.
A container is an element that contains other elements. It implements the required behaviour to navig...
Definition: Container.hpp:16
friend bool moveHighlight(Container *parent, std::function< bool(Element *, Element *)> check, std::function< int(Element *, Element *)> dist)
Determine which element to move to.
Container(int x=0, int y=0, int w=100, int h=100)
Construct a new Container object.
int w()
Returns width of element.
int x()
Returns x-coordinate of element.
void addElement(Element *e)
Adds new element a child.
Element is the base class to be inherited to form all other types of elements.
Definition: Element.hpp:18
int h()
Returns height of element.
Base namespace for all Aether related classes and functions.
bool returnElement(Element *e)
Attempt to remove the given child element.
A class that represents an Aether input event.
Definition: InputEvent.hpp:25
void setActive()
Re-highlight/focus the focused element.
void removeAllElements()
Deletes all children elements.
Element * parent()
Returns the parent element of this element.
int y()
Returns y-coordinate of element.