#include <basiccontainer.hpp>
Inheritance diagram for gcn::BasicContainer:

The class implements the most common things for a container. If you are implementing a container, consider inheriting from this class.
Definition at line 76 of file basiccontainer.hpp.
Public Member Functions | |
| virtual void | _setFocusHandler (FocusHandler *focusHandler) |
| Sets the focus handler to be used. | |
| virtual void | death (const Event &event) |
| Called when a widget dies. | |
| virtual void | focusNext () |
| Focuses the next widget in the widget. | |
| virtual void | focusPrevious () |
| Focuses the previous widget in the widget. | |
| virtual Rectangle | getChildrenArea () |
| Gets the area of the widget that the widget's children occupy. | |
| virtual Widget * | getWidgetAt (int x, int y) |
| Gets a widget from a certain position in the widget. | |
| virtual void | logic () |
| Called for all widgets in the gui each time Gui::logic is called. | |
| virtual void | moveToBottom (Widget *widget) |
| Moves a widget in this widget to the bottom of this widget. | |
| virtual void | moveToTop (Widget *widget) |
| Moves a widget to the top of this widget. | |
| void | setInternalFocusHandler (FocusHandler *focusHandler) |
| Sets the internal focus handler. | |
| virtual void | showWidgetPart (Widget *widget, Rectangle area) |
| Shows a certain part of a widget in the basic container. | |
| virtual | ~BasicContainer () |
| Destructor. | |
Protected Types | |
| typedef std::list< Widget * > | WidgetList |
| Typedef. | |
| typedef WidgetList::iterator | WidgetListIterator |
| Typedef. | |
| typedef WidgetList::reverse_iterator | WidgetListReverseIterator |
| Typedef. | |
Protected Member Functions | |
| void | add (Widget *widget) |
| Adds a widget to the basic container. | |
| virtual void | clear () |
| Clears the basic container from all widgets. | |
| virtual void | drawChildren (Graphics *graphics) |
| Draws the children widgets of the basic container. | |
| virtual Widget * | findWidgetById (const std::string &id) |
| Finds a widget given an id. | |
| virtual void | logicChildren () |
| Calls logic for the children widgets of the basic container. | |
| virtual void | remove (Widget *widget) |
| Removes a widget from the basic container. | |
Protected Attributes | |
| WidgetList | mWidgets |
| Holds all widgets of the basic container. | |
| void gcn::BasicContainer::_setFocusHandler | ( | FocusHandler * | focusHandler | ) | [virtual] |
Sets the focus handler to be used.
WARNING: This function is used internally and should not be called or overloaded unless you know what you are doing.
| focusHandler | The focus handler to use. |
Reimplemented from gcn::Widget.
Definition at line 225 of file basiccontainer.cpp.
References gcn::Widget::_setFocusHandler(), gcn::Widget::mInternalFocusHandler, and mWidgets.
| void gcn::BasicContainer::add | ( | Widget * | widget | ) | [protected] |
Adds a widget to the basic container.
| widget | The widget to add. |
Reimplemented in gcn::Container.
Definition at line 241 of file basiccontainer.cpp.
References gcn::Widget::_getFocusHandler(), gcn::Widget::_setFocusHandler(), gcn::Widget::_setParent(), gcn::Widget::addDeathListener(), gcn::Widget::mInternalFocusHandler, and mWidgets.
Referenced by gcn::Container::add().
| void gcn::BasicContainer::clear | ( | ) | [protected, virtual] |
Clears the basic container from all widgets.
Reimplemented in gcn::Container.
Definition at line 276 of file basiccontainer.cpp.
References mWidgets.
Referenced by gcn::Container::clear(), gcn::ScrollArea::setContent(), and ~BasicContainer().
| void gcn::BasicContainer::death | ( | const Event & | event | ) | [virtual] |
Called when a widget dies.
It is used to be able to recieve a notification when a death of a widget occurs.
| event | The event of the death. |
Implements gcn::DeathListener.
Reimplemented in gcn::DropDown, and gcn::TabbedArea.
Definition at line 106 of file basiccontainer.cpp.
References mWidgets.
Referenced by gcn::TabbedArea::death(), and gcn::DropDown::death().
| void gcn::BasicContainer::drawChildren | ( | Graphics * | graphics | ) | [protected, virtual] |
Draws the children widgets of the basic container.
| graphics | A graphics object to draw with. |
Definition at line 290 of file basiccontainer.cpp.
References getChildrenArea(), mWidgets, gcn::Graphics::popClipArea(), and gcn::Graphics::pushClipArea().
Referenced by gcn::Window::draw(), gcn::TabbedArea::draw(), gcn::Tab::draw(), gcn::ScrollArea::draw(), gcn::DropDown::draw(), and gcn::Container::draw().
| Widget * gcn::BasicContainer::findWidgetById | ( | const std::string & | id | ) | [protected, virtual] |
Finds a widget given an id.
This function can be useful when implementing a GUI generator for Guichan, such as the ability to create a Guichan GUI from an XML file.
| id | The id to find a widget by. |
Reimplemented in gcn::Container.
Definition at line 378 of file basiccontainer.cpp.
References findWidgetById(), and mWidgets.
Referenced by gcn::Container::findWidgetById(), and findWidgetById().
| void gcn::BasicContainer::focusNext | ( | ) | [virtual] |
Focuses the next widget in the widget.
Reimplemented from gcn::Widget.
Definition at line 124 of file basiccontainer.cpp.
References mWidgets.
| void gcn::BasicContainer::focusPrevious | ( | ) | [virtual] |
Focuses the previous widget in the widget.
Reimplemented from gcn::Widget.
Definition at line 160 of file basiccontainer.cpp.
References mWidgets.
| Rectangle gcn::BasicContainer::getChildrenArea | ( | ) | [virtual] |
Gets the area of the widget that the widget's children occupy.
Reimplemented from gcn::Widget.
Reimplemented in gcn::DropDown, gcn::ScrollArea, and gcn::Window.
Definition at line 119 of file basiccontainer.cpp.
References gcn::Widget::getHeight(), and gcn::Widget::getWidth().
Referenced by drawChildren(), getWidgetAt(), and showWidgetPart().
| Widget * gcn::BasicContainer::getWidgetAt | ( | int | x, | |
| int | y | |||
| ) | [virtual] |
Gets a widget from a certain position in the widget.
This function is used to decide which gets mouse input, thus it can be overloaded to change that behaviour.
NOTE: This always returns NULL if the widget is not a container.
| x | The x coordinate of the widget to get. | |
| y | The y coordinate of the widget to get. |
Reimplemented from gcn::Widget.
Reimplemented in gcn::ScrollArea.
Definition at line 196 of file basiccontainer.cpp.
References getChildrenArea(), gcn::Rectangle::isPointInRect(), mWidgets, gcn::Rectangle::x, and gcn::Rectangle::y.
Referenced by gcn::TabbedArea::mousePressed().
| void gcn::BasicContainer::logic | ( | ) | [virtual] |
Called for all widgets in the gui each time Gui::logic is called.
You can do logic stuff here like playing an animation.
Reimplemented from gcn::Widget.
Reimplemented in gcn::ScrollArea, and gcn::TabbedArea.
Definition at line 220 of file basiccontainer.cpp.
References logicChildren().
| void gcn::BasicContainer::moveToBottom | ( | Widget * | widget | ) | [virtual] |
Moves a widget in this widget to the bottom of this widget.
The moved widget will be drawn below all other widgets in this widget.
| widget | The widget to move to the bottom. |
Reimplemented from gcn::Widget.
Definition at line 93 of file basiccontainer.cpp.
References mWidgets.
| void gcn::BasicContainer::moveToTop | ( | Widget * | widget | ) | [virtual] |
Moves a widget to the top of this widget.
The moved widget will be drawn above all other widgets in this widget.
| widget | The widget to move to the top. |
Reimplemented from gcn::Widget.
Definition at line 77 of file basiccontainer.cpp.
References mWidgets.
| void gcn::BasicContainer::remove | ( | Widget * | widget | ) | [protected, virtual] |
Removes a widget from the basic container.
| widget | The widget to remove. |
Reimplemented in gcn::Container.
Definition at line 258 of file basiccontainer.cpp.
References gcn::Widget::_setFocusHandler(), gcn::Widget::_setParent(), mWidgets, and gcn::Widget::removeDeathListener().
Referenced by gcn::Container::remove().
| void gcn::BasicContainer::setInternalFocusHandler | ( | FocusHandler * | internalFocusHandler | ) |
Sets the internal focus handler.
An internal focus handler is needed if both a widget in the widget and the widget itself should be foucsed at the same time.
| focusHandler | The internal focus handler to be used. |
Reimplemented from gcn::Widget.
Definition at line 360 of file basiccontainer.cpp.
References gcn::Widget::_getFocusHandler(), gcn::Widget::mInternalFocusHandler, mWidgets, and gcn::Widget::setInternalFocusHandler().
Referenced by gcn::DropDown::DropDown(), and gcn::DropDown::~DropDown().
Shows a certain part of a widget in the basic container.
Used when widgets want a specific part to be visible in its parent. An example is a TextArea that wants a specific part of its text to be visible when a TextArea is a child of a ScrollArea.
| widget | The widget whom wants a specific part of itself to be visible. | |
| rectangle | The rectangle to be visible. |
Reimplemented from gcn::Widget.
Reimplemented in gcn::ScrollArea.
Definition at line 331 of file basiccontainer.cpp.
References getChildrenArea(), gcn::Widget::getX(), gcn::Widget::getY(), gcn::Rectangle::height, gcn::Widget::setX(), gcn::Widget::setY(), gcn::Rectangle::width, gcn::Rectangle::x, and gcn::Rectangle::y.
Referenced by gcn::ScrollArea::showWidgetPart().
1.5.2