#include <basiccontainer.hpp>
Inheritance diagram for gcn::BasicContainer:
Contains basic container functions every container should have. Containers should inherit from this class and implement it's functions.
Definition at line 74 of file basiccontainer.hpp.
Public Types | |
NEVER | |
ALWAYS | |
NOT_ON_CHILD | |
NOT_IN_CHILDREN_AREA | |
enum | { NEVER, ALWAYS, NOT_ON_CHILD, NOT_IN_CHILDREN_AREA } |
Public Member Functions | |
BasicContainer () | |
Constructor. | |
virtual | ~BasicContainer () |
Destructor. | |
virtual void | moveToTop (Widget *widget) |
Moves a Widget to the top of the BasicContainer. | |
virtual void | moveToBottom (Widget *widget) |
Moves a widget to the bottom of the BasicContainer. | |
virtual void | _announceDeath (Widget *widget) |
Called when a child of the BasicContainer gets destroyed. | |
virtual Rectangle | getChildrenArea () |
Gets the subarea of the BasicContainer that the children occupy. | |
virtual void | focusNext () |
Focuses the next Widget in the BasicContainer. | |
virtual void | focusPrevious () |
Focuses the previous Widge in the BasicContainer. | |
virtual Widget * | getWidgetAt (int x, int y) |
Gets a widget from a certain position in the container. | |
virtual void | showWidgetPart (Widget *widget, Rectangle area) |
Tries to show a specific part of a Widget by moving it. | |
virtual void | logic () |
Called for all Widgets in the gui each time Gui::logic is called. | |
virtual void | _setFocusHandler (FocusHandler *focusHandler) |
Sets the FocusHandler to be used. | |
virtual void | _mouseInputMessage (const MouseInput &mouseInput) |
Called when a Widget recieves a MouseInput. | |
virtual void | _mouseOutMessage () |
Called when the mouse leaves the Widget area. | |
virtual void | _keyInputMessage (const KeyInput &keyInput) |
Called when a Widget recieves a KeyInput. | |
Protected Types | |
typedef std::list< Widget * > | WidgetList |
typedef WidgetList::iterator | WidgetListIterator |
typedef WidgetList::reverse_iterator | WidgetListReverseIterator |
Protected Member Functions | |
virtual void | add (Widget *widget) |
Adds a widget. | |
virtual void | remove (Widget *widget) |
Removes a widget. | |
virtual void | clear () |
Clears the BasicContainer of widgets. | |
virtual void | drawChildren (Graphics *graphics) |
Draws children widgets. | |
virtual void | logicChildren () |
Calls logic for children widgets. | |
virtual void | setMouseInputPolicy (unsigned int policy) |
Sets the mouse input policy. | |
virtual unsigned int | getMouseInputPolicy () |
Gets the mouse input policy. | |
virtual FocusHandler * | getInternalFocusHandler () |
Gets the internal FocusHandler used. | |
virtual void | setInternalFocusHandler (FocusHandler *focusHandler) |
Sets the internal FocusHandler. | |
Protected Attributes | |
WidgetList | mWidgets |
Widget * | mWidgetWithMouse |
unsigned int | mMouseInputPolicy |
FocusHandler * | mInternalFocusHandler |
void gcn::BasicContainer::_announceDeath | ( | Widget * | widget | ) | [virtual] |
Called when a child of the BasicContainer gets destroyed.
widget | the destroyed Widget. |
Reimplemented in gcn::DropDown.
Definition at line 113 of file basiccontainer.cpp.
References mWidgets, and mWidgetWithMouse.
Referenced by gcn::DropDown::_announceDeath(), and gcn::Widget::~Widget().
void gcn::BasicContainer::_keyInputMessage | ( | const KeyInput & | keyInput | ) | [virtual] |
Called when a Widget recieves a KeyInput.
WARNING: This function is used internally to handle all key messages. Don't call or overload it unless you know what you are doing.
keyInput | the KeyInput message. |
Reimplemented from gcn::Widget.
Definition at line 528 of file basiccontainer.cpp.
References gcn::Widget::_keyInputMessage(), gcn::FocusHandler::getFocused(), and mInternalFocusHandler.
void gcn::BasicContainer::_mouseInputMessage | ( | const MouseInput & | mouseInput | ) | [virtual] |
Called when a Widget recieves a MouseInput.
WARNING: This function is used internally to handle all mouse messages. Don't call or overload it unless you know what you are doing.
mouseInput | the MouseInput message. |
Reimplemented from gcn::Widget.
Definition at line 254 of file basiccontainer.cpp.
References gcn::Widget::_mouseInMessage(), gcn::Widget::_mouseInputMessage(), gcn::Widget::_mouseOutMessage(), getChildrenArea(), gcn::FocusHandler::getDragged(), gcn::FocusHandler::getFocused(), gcn::Widget::getHeight(), getWidgetAt(), gcn::Widget::getWidth(), gcn::Widget::getX(), gcn::Widget::getY(), gcn::Widget::hasMouse(), gcn::Widget::isDragged(), gcn::Widget::isFocused(), mInternalFocusHandler, mMouseInputPolicy, mWidgetWithMouse, gcn::Rectangle::x, gcn::MouseInput::x, gcn::Rectangle::y, and gcn::MouseInput::y.
void gcn::BasicContainer::_mouseOutMessage | ( | ) | [virtual] |
Called when the mouse leaves the Widget area.
WARNING: This function is used internally be to handle mouse out messages. Don't call or overload this function unless you know what you are doing.
Reimplemented from gcn::Widget.
Definition at line 362 of file basiccontainer.cpp.
References gcn::Widget::_mouseOutMessage(), and mWidgetWithMouse.
void gcn::BasicContainer::_setFocusHandler | ( | FocusHandler * | focusHandler | ) | [virtual] |
Sets the FocusHandler 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 FocusHandler to use. |
Reimplemented from gcn::Widget.
Definition at line 237 of file basiccontainer.cpp.
References gcn::Widget::_setFocusHandler(), mInternalFocusHandler, and mWidgets.
void gcn::BasicContainer::add | ( | Widget * | widget | ) | [protected, virtual] |
Adds a widget.
widget | the Widget to add. |
Reimplemented in gcn::Container.
Definition at line 373 of file basiccontainer.cpp.
References gcn::Widget::_getFocusHandler(), gcn::Widget::_setFocusHandler(), gcn::Widget::_setParent(), mInternalFocusHandler, and mWidgets.
Referenced by gcn::Container::add(), gcn::DropDown::DropDown(), and gcn::ScrollArea::setContent().
void gcn::BasicContainer::drawChildren | ( | Graphics * | graphics | ) | [protected, virtual] |
Draws children widgets.
graphics | a Graphics object to draw with. |
Definition at line 427 of file basiccontainer.cpp.
References getChildrenArea(), mWidgets, gcn::Graphics::popClipArea(), and gcn::Graphics::pushClipArea().
Referenced by gcn::Window::draw(), gcn::ScrollArea::draw(), gcn::DropDown::draw(), and gcn::Container::draw().
Rectangle gcn::BasicContainer::getChildrenArea | ( | ) | [virtual] |
Gets the subarea of the BasicContainer that the children occupy.
Reimplemented in gcn::DropDown, gcn::ScrollArea, and gcn::Window.
Definition at line 131 of file basiccontainer.cpp.
References gcn::Widget::getHeight(), and gcn::Widget::getWidth().
Referenced by _mouseInputMessage(), gcn::DropDown::adjustHeight(), drawChildren(), gcn::Widget::getAbsolutePosition(), getWidgetAt(), gcn::TextBox::keyPress(), and showWidgetPart().
FocusHandler * gcn::BasicContainer::getInternalFocusHandler | ( | ) | [protected, virtual] |
Gets the internal FocusHandler used.
Definition at line 505 of file basiccontainer.cpp.
References gcn::Widget::mFocusHandler.
unsigned int gcn::BasicContainer::getMouseInputPolicy | ( | ) | [protected, virtual] |
Gets the mouse input policy.
Definition at line 473 of file basiccontainer.cpp.
References mMouseInputPolicy.
Widget * gcn::BasicContainer::getWidgetAt | ( | int | x, | |
int | y | |||
) | [virtual] |
Gets a widget from a certain position in the container.
This function is used to decide which gets mouse input, thus it can be overloaded to change that behaviour.
x | the x coordinate. | |
y | the y coordinate. |
Reimplemented in gcn::ScrollArea.
Definition at line 208 of file basiccontainer.cpp.
References getChildrenArea(), gcn::Rectangle::isPointInRect(), mWidgets, gcn::Rectangle::x, and gcn::Rectangle::y.
Referenced by _mouseInputMessage().
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::DropDown, and gcn::ScrollArea.
Definition at line 232 of file basiccontainer.cpp.
References logicChildren().
Referenced by gcn::DropDown::logic().
void gcn::BasicContainer::moveToBottom | ( | Widget * | widget | ) | [virtual] |
Moves a widget to the bottom of the BasicContainer.
The Widget will be drawn below all other Widgets in the BasicContainer.
widget | the Widget to move. |
Definition at line 100 of file basiccontainer.cpp.
References mWidgets.
Referenced by gcn::Widget::requestMoveToBottom().
void gcn::BasicContainer::moveToTop | ( | Widget * | widget | ) | [virtual] |
Moves a Widget to the top of the BasicContainer.
The widget will be drawn above all other Widgets in the BasicContainer.
widget | the Widget to move. |
Definition at line 84 of file basiccontainer.cpp.
References mWidgets.
Referenced by gcn::DropDown::dropDown(), gcn::Window::mousePress(), and gcn::Widget::requestMoveToTop().
void gcn::BasicContainer::remove | ( | Widget * | widget | ) | [protected, virtual] |
Removes a widget.
widget | the Widget to remove. |
Reimplemented in gcn::Container.
Definition at line 390 of file basiccontainer.cpp.
References gcn::Widget::_setFocusHandler(), gcn::Widget::_setParent(), mWidgets, and mWidgetWithMouse.
Referenced by gcn::Container::remove().
void gcn::BasicContainer::setInternalFocusHandler | ( | FocusHandler * | focusHandler | ) | [protected, virtual] |
Sets the internal FocusHandler.
An internal focushandler is needed if both a widget in the container and the container should be foucsed at once.
focusHandler | the FocusHandler to be used. |
Definition at line 510 of file basiccontainer.cpp.
References gcn::Widget::_getFocusHandler(), mInternalFocusHandler, and mWidgets.
Referenced by gcn::DropDown::DropDown().
void gcn::BasicContainer::setMouseInputPolicy | ( | unsigned int | policy | ) | [protected, virtual] |
Sets the mouse input policy.
policy | the mouse input policy. See enum. |
Definition at line 468 of file basiccontainer.cpp.
References mMouseInputPolicy.
Tries to show a specific part of a Widget by moving it.
widget | the target Widget. | |
area | the area to show. |
Reimplemented in gcn::ScrollArea.
Definition at line 478 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::TextBox::scrollToCaret(), gcn::ListBox::setSelected(), and gcn::ScrollArea::showWidgetPart().