5#ifndef INCLUDE_FIFECHAN_WIDGETS_CONTAINER_HPP_
6#define INCLUDE_FIFECHAN_WIDGETS_CONTAINER_HPP_
12#include "fifechan/containerlistener.hpp"
13#include "fifechan/graphics.hpp"
14#include "fifechan/platform.hpp"
15#include "fifechan/widget.hpp"
96 virtual void addWidget(std::unique_ptr<Widget> widget);
108 virtual void add(
Widget* widget,
int x,
int y);
117 virtual void addWidget(std::unique_ptr<Widget> widget,
int x,
int y);
196 return mLayout != LayoutPolicy::Absolute;
206 virtual void setLayout(LayoutPolicy policy);
215 virtual LayoutPolicy getLayout()
const;
225 virtual void setUniformSize(
bool uniform);
234 virtual bool isUniformSize()
const;
242 virtual void setVerticalSpacing(
unsigned int spacing);
250 virtual unsigned int getVerticalSpacing()
const;
258 virtual void setHorizontalSpacing(
unsigned int spacing);
266 virtual unsigned int getHorizontalSpacing()
const;
273 void setBackgroundWidget(
Widget* widget);
280 Widget* getBackgroundWidget();
289 void distributeWidgetAddedEvent(
Widget* source);
297 void distributeWidgetRemovedEvent(
Widget* source);
Interface for listening to container modification events.
bool isLayouted() override
Helper function to decide if we need to layout.
void remove(Widget *widget) override
Removes a widget from the Container.
void draw(Graphics *graphics) override
Draws the widget.
bool mOpaque
True if the container is opaque, false otherwise.
void addContainerListener(ContainerListener *containerListener)
Adds a container listener to the container.
unsigned int mVerticalSpacing
VerticalSpacing.
LayoutPolicy mLayout
Layout.
unsigned int mHorizontalSpacing
HorizontalSpacing.
Widget * mBackgroundWidget
Optional widget that is rendered behind other children as the container background.
Widget * findWidgetById(std::string const &id) override
Finds a widget given an id.
virtual bool isOpaque() const
Checks if the container is opaque or not.
void expandContent(bool recursion) override
Expand children to occupy available space in this container.
virtual void add(Widget *widget)
Adds a widget to the container.
LayoutPolicy
The layout policy of the container.
void resizeToContent(bool recursion) override
Resize this container to fit its children.
ContainerListenerList::iterator ContainerListenerIterator
Typedef.
void removeAllChildren() override
Removes all widgets from the the container.
Rectangle getChildrenArea() override
Gets the area of the widget occupied by the widget's children.
virtual void addWidget(std::unique_ptr< Widget > widget)
Adds a widget to the container, transferring ownership.
bool mUniform
Indicates if the childs should be expanded to a uniform size.
void removeContainerListener(ContainerListener *containerListener)
Removes a container listener from the container.
void adjustSize() override
Adjust the size of the container after layout computations.
Widget * getChild(unsigned int index) const
Gets child by index.
ContainerListenerList mContainerListeners
The container listeners of the container.
virtual void setOpaque(bool opaque)
Sets the container to be opaque or not.
std::list< ContainerListener * > ContainerListenerList
Typdef.
Abstract interface providing primitive drawing functions (lines, rectangles, etc.).
Represents a rectangular area (X, Y, Width, Height).