gcn::Container Class Reference

#include <container.hpp>

Inheritance diagram for gcn::Container:

gcn::BasicContainer gcn::Widget gcn::Window List of all members.

Detailed Description

A container able to contain other Widgets.

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


Constructor & Destructor Documentation

gcn::Container::Container (  ) 

Constructor.

A container is opauqe as default.

See also:
setOpaque, isOpaque

Definition at line 69 of file container.cpp.

References mOpaque.


Member Function Documentation

void gcn::Container::add ( Widget widget,
int  x,
int  y 
) [virtual]

Adds a Widget to the container and also specifices it's postion.

Parameters:
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.
See also:
remove

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.

Parameters:
widget the Widget to add.
See also:
remove

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.

See also:
add, remove

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.

Parameters:
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.

Parameters:
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]

Checks if the Container is opaque.

Returns:
true if the Container is opaque.
See also:
setOpaque

Definition at line 119 of file container.cpp.

References mOpaque.

Referenced by draw().

void gcn::Container::remove ( Widget widget  )  [virtual]

Removes a Widget from the Container.

Parameters:
widget the Widget to remove.
Exceptions:
Exception when the Widget has not been added to the Container.
See also:
add, clear

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.

Parameters:
opaque true if the Container should be opaque.
See also:
isOpaque

Reimplemented in gcn::Window.

Definition at line 114 of file container.cpp.

References mOpaque.


The documentation for this class was generated from the following files:
Generated on Sat Jul 29 19:38:49 2006 for Guichan by  doxygen 1.4.7