#include <container.hpp>
Inheritance diagram for gcn::Container:
It is in other words a Widget that holds other Widgets. A Widget's position in the container is always relativ to the Container itself, not the screen. Using a Container as the top Widget in Gui is the only way to use more then one Widget in your Gui.
Definition at line 75 of file container.hpp.
Public Member Functions | |
Container () | |
Constructor. | |
virtual | ~Container () |
Destructor. | |
virtual void | setOpaque (bool opaque) |
Sets whether the background should be drawn or not. | |
virtual bool | isOpaque () const |
Checks if the Container is opaque. | |
virtual void | add (Widget *widget) |
Adds a Widget to the Container. | |
virtual void | add (Widget *widget, int x, int y) |
Adds a Widget to the container and also specifices it's postion. | |
virtual void | remove (Widget *widget) |
Removes a Widget from the Container. | |
virtual void | clear () |
Clears the Container of all widgets. | |
virtual void | draw (Graphics *graphics) |
Draws the Widget. | |
virtual void | drawBorder (Graphics *graphics) |
Draws the Widget border. | |
Protected Attributes | |
bool | mOpaque |
gcn::Container::Container | ( | ) |
Constructor.
A container is opauqe as default.
Definition at line 69 of file container.cpp.
References mOpaque.
void gcn::Container::add | ( | Widget * | widget, | |
int | x, | |||
int | y | |||
) | [virtual] |
Adds a Widget to the container and also specifices it's postion.
widget | the Widget to add. | |
x | the x coordinat for the Widget in the Container. | |
y | the y coordinat for the Widget in the Container. |
Definition at line 129 of file container.cpp.
References gcn::BasicContainer::add(), and gcn::Widget::setPosition().
void gcn::Container::add | ( | Widget * | widget | ) | [virtual] |
Adds a Widget to the Container.
widget | the Widget to add. |
Reimplemented from gcn::BasicContainer.
Definition at line 124 of file container.cpp.
References gcn::BasicContainer::add().
void gcn::Container::clear | ( | ) | [virtual] |
Clears the Container of all widgets.
Reimplemented from gcn::BasicContainer.
Definition at line 140 of file container.cpp.
References gcn::BasicContainer::clear().
void gcn::Container::draw | ( | Graphics * | graphics | ) | [virtual] |
Draws the Widget.
It is called by the parent widget when it is time for the Widget to draw itself. The graphics object is set up so that all drawing is relative to the Widget, i.e coordinate (0,0) is the top-left corner of the Widget. It is not possible to draw outside of a Widgets dimension.
graphics | a Graphics object to draw with. |
Implements gcn::Widget.
Reimplemented in gcn::Window.
Definition at line 79 of file container.cpp.
References gcn::BasicContainer::drawChildren(), gcn::Graphics::fillRectangle(), gcn::Widget::getBaseColor(), gcn::Widget::getHeight(), gcn::Widget::getWidth(), isOpaque(), and gcn::Graphics::setColor().
void gcn::Container::drawBorder | ( | Graphics * | graphics | ) | [virtual] |
Draws the Widget border.
A border is drawn around a Widget. The width and height of the border is therefore the Widgets height+2*bordersize. Think of a painting that has a certain size, the border surrounds the painting.
graphics | a Graphics object to draw with. |
Reimplemented from gcn::Widget.
Reimplemented in gcn::Window.
Definition at line 90 of file container.cpp.
References gcn::Color::a, gcn::Graphics::drawLine(), gcn::Widget::getBaseColor(), gcn::Widget::getBorderSize(), gcn::Widget::getHeight(), gcn::Widget::getWidth(), and gcn::Graphics::setColor().
bool gcn::Container::isOpaque | ( | ) | const [virtual] |
void gcn::Container::remove | ( | Widget * | widget | ) | [virtual] |
Removes a Widget from the Container.
widget | the Widget to remove. |
Reimplemented from gcn::BasicContainer.
Definition at line 135 of file container.cpp.
References gcn::BasicContainer::remove().
void gcn::Container::setOpaque | ( | bool | opaque | ) | [virtual] |
Sets whether the background should be drawn or not.
If the Container is not opaque it will be completely transparent.
NOTE: This is not the same as to set visibility. A nonvisible Container will not draw it's content.
opaque | true if the Container should be opaque. |
Reimplemented in gcn::Window.
Definition at line 114 of file container.cpp.
References mOpaque.