Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

ONE::gui::Panel Class Reference

Inheritance diagram for ONE::gui::Panel:

Inheritance graph
[legend]
List of all members.

Detailed Description

A container Component.

A Panel holds other Component s and lays them out according to an associated LayoutManager. Since panels are also Component s, they may be stacked. The Panel 's default LayoutManager is the horizontal StackLayout.

Author:
Daniel Seibert


Public Types

typedef ONE::util::ConstIterator<
const Widget * > 
ChildConstItr
typedef ONE::util::SmartPointer<
ChildConstItr, ONE::util::DestructiveCopy
ChildConstItrSP
typedef ONE::util::Iterator<
Widget * > 
ChildItr
typedef ONE::util::SmartPointer<
ChildItr, ONE::util::DestructiveCopy
ChildItrSP

Public Member Functions

void add (Component *comp, const LayoutConstraint *cons)
void clear ()
void draw (Renderer2D *r, const int &x, const int &y, const int &w, const int &h)
 draws a portion of this object
void draw (Renderer2D *)
 draws this object.
Color getBackground () const
 accesses the color that should be used to render the object's background.
const BrdSPgetBorder () const
 accesses the component's border
const BrdDSPgetBorderDelegate () const
const BoundsgetBounds () const
 accesses this object's bounds
int getChildCount () const
ChildConstItrSP getChildren () const
ChildItrSP getChildren ()
virtual const IMSPgetDefaultInputMap () const
 accesses this widget's default input map
const UIDSPgetDelegate () const
DelegateID getDelegateID () const
Color getDisabledBackground () const
 accesses the color that should be used to render the object's background when the object is disabled
Color getDisabledForeground () const
 accesses the color that should be used to render the object's foreground when the object is disabled.
Color getFocus () const
 accesses the color that should be used to render the component focus
Color getForeground () const
 accesses the color that should be used to render the object's foreground.
const IMSPgetInputMap () const
LayoutManagergetLayoutManager () const
 provides access to the current layout manager.
WidgetgetParent () const
const PointgetPosition () const
 accesses this object's position
Size getPreferredSize () const
 determines this object's preferred size.
const SizegetSize () const
 accesses this object's size
bool hasChildren () const
bool hasFocus () const
 checks if this component has the input focus
bool isEnabled () const
 checks if this widget is enabled
bool isOpaque () const
 checks this object's opacity
virtual bool isUnder (const Point &) const
virtual bool isVisible () const
 acesses the visibility property
void layout ()
 delegates the laying out of this component to its LayoutManager
 Panel (LayoutManager *lm=new StackLayout())
 initializes the member variables
void processKeyEvent (KeyEvent &)
 does nothing
void processMouseMotion (MouseEvent &)
 does nothing
void processMousePress (MouseEvent &)
 does nothing
void processMouseRelease (MouseEvent &)
 does nothing
void releaseFocus () const
 drops the input focus
void remove (Component *comp)
bool requestFocus ()
 requests the input focus for this component.
void scheduleLayout ()
 schedules a call to layout
void setBackground (const Color &c, bool laf=true)
 changes this object's background color
void setBorder (const BrdSP &b, bool laf=true)
 changes the component's border
void setBounds (const int &x, const int &y, const int &w, const int &h)
void setBounds (const Bounds &b)
 changes this object's bounds
void setDisabledBackground (const Color &c, bool laf=true)
 changes this object's disabled background color
void setDisabledForeground (const Color &c, bool laf=true)
 changes this object's disabled foreground color
virtual void setEnabled (bool)
 enables or disables this component
void setFocus (const Color &c, bool laf=true)
 changes the color that will be used to draw the component focus marker
void setForeground (const Color &c, bool laf=true)
 changes this object's foreground color
void setInputMap (const IMSP &im, bool laf=true)
void setLayoutManager (LayoutManager *lm)
 changes the layout manager
void setOpaque (bool o, bool laf=true)
 changes this object's opacity
void setParent (Widget *p)
 changes this component's parent
void setPosition (const int &x, const int &y)
void setPosition (const Point &p)
 changes this object's position
void setPreferredSize (const Size &s)
 sets the object's preferred size
void setSize (const int &w, const int &h)
void setSize (const Size &s)
 changes this object's size
virtual void setVisible (bool vis)
void updateUI ()
 ~Panel ()
 destroys the panel

Protected Types

typedef unsigned int bits

Protected Member Functions

void doDraw (Renderer2D *, const int &, const int &, const int &, const int &)
 draws this container and the subcomponents within the given bounds
bool getBit (const bits &bit) const
void setBit (const bits &bit, bool val)

Protected Attributes

Size prefSize

Static Protected Attributes

static const bits ENABLED
static const bits LSCHED
 set when this object is scheduled to be laid out
static const bits OPQ
 opacity bit
static const bits VIS
 visibility bit


Member Typedef Documentation

typedef unsigned int ONE::gui::Displayable::bits [protected, inherited]
 

typedef ONE::util::ConstIterator<const Widget*> ONE::gui::Widget::ChildConstItr [inherited]
 

typedef ONE::util::SmartPointer<ChildConstItr,ONE::util::DestructiveCopy> ONE::gui::Widget::ChildConstItrSP [inherited]
 

typedef ONE::util::Iterator<Widget*> ONE::gui::Widget::ChildItr [inherited]
 

typedef ONE::util::SmartPointer<ChildItr,ONE::util::DestructiveCopy> ONE::gui::Widget::ChildItrSP [inherited]
 


Constructor & Destructor Documentation

ONE::gui::Panel::Panel LayoutManager lm = new StackLayout()  ) 
 

initializes the member variables

ONE::gui::Panel::~Panel  ) 
 

destroys the panel

This dtor delete s the currently active LayoutManager and all added Component s.


Member Function Documentation

void ONE::gui::Panel::add Component comp,
const LayoutConstraint cons
[virtual]
 

Exceptions:
InvalidArgumentException if is equal to or a parent of this container

Reimplemented from ONE::gui::Component.

void ONE::gui::Panel::clear  )  [virtual]
 

the default implementation of this function does nothing

Reimplemented from ONE::gui::Component.

void ONE::gui::Panel::doDraw Renderer2D ,
const int &  ,
const int &  ,
const int &  ,
const int & 
[protected, virtual]
 

draws this container and the subcomponents within the given bounds

Implements ONE::gui::Displayable.

void ONE::gui::Displayable::draw Renderer2D r,
const int &  x,
const int &  y,
const int &  w,
const int &  h
[inherited]
 

draws a portion of this object

This function calls doDraw(Renderer2D*,int,int,int,int) if this object is set to visible. Note that the renderer must be active in 2D mode.

Parameters:
r the renderer used to draw this object
x the left edge of the drawn area
y the top edge of the drawn are
w the width of the drawn area
h the height of the drawn are

void ONE::gui::Displayable::draw Renderer2D  )  [inline, inherited]
 

draws this object.

This function calls draw(Renderer2D*,int,int,int,int) with this object's bounds.

Color ONE::gui::Displayable::getBackground  )  const [inline, inherited]
 

accesses the color that should be used to render the object's background.

Returns:
a color

bool ONE::gui::Displayable::getBit const bits bit  )  const [inline, protected, inherited]
 

const BrdSP & ONE::gui::Bordered::getBorder  )  const [inline, inherited]
 

accesses the component's border

Returns:
the border or 0 if no border is set

const BrdDSP & ONE::gui::Bordered::getBorderDelegate  )  const [inline, inherited]
 

const Bounds & ONE::gui::Displayable::getBounds  )  const [inline, inherited]
 

accesses this object's bounds

The Bounds object represents the position of the top left corner as well as the size of this object's bounding rectangle.

Returns:
this object's bounds

int ONE::gui::Panel::getChildCount  )  const [inline, virtual]
 

the default implementation of this function returns 0

Reimplemented from ONE::gui::Component.

ChildConstItrSP ONE::gui::Panel::getChildren  )  const [virtual]
 

the default implementation of this function returns 0

Reimplemented from ONE::gui::Component.

ChildItrSP ONE::gui::Panel::getChildren  )  [virtual]
 

the default implementation of this function returns 0

Reimplemented from ONE::gui::Component.

virtual const IMSP& ONE::gui::Widget::getDefaultInputMap  )  const [virtual, inherited]
 

accesses this widget's default input map

The default implementation returns an empty map. Subclasses may override this function in order to specify a different default map.

Returns:
the widget's default input map

Reimplemented in ONE::gui::AbstractButton, ONE::gui::CommandField, ONE::gui::Frame, ONE::gui::List, and ONE::gui::ScrollBarSlider.

const UIDSP & ONE::gui::Displayable::getDelegate  )  const [inline, inherited]
 

DelegateID ONE::gui::Panel::getDelegateID  )  const [inline, virtual]
 

Implements ONE::gui::Bordered.

Color ONE::gui::Widget::getDisabledBackground  )  const [inline, inherited]
 

accesses the color that should be used to render the object's background when the object is disabled

Returns:
a color

Color ONE::gui::Widget::getDisabledForeground  )  const [inline, inherited]
 

accesses the color that should be used to render the object's foreground when the object is disabled.

Returns:
a color

Color ONE::gui::Widget::getFocus  )  const [inline, inherited]
 

accesses the color that should be used to render the component focus

Returns:
a color

Color ONE::gui::Displayable::getForeground  )  const [inline, inherited]
 

accesses the color that should be used to render the object's foreground.

Returns:
a color

const IMSP & ONE::gui::Widget::getInputMap  )  const [inline, inherited]
 

LayoutManager * ONE::gui::Panel::getLayoutManager  )  const [inline]
 

provides access to the current layout manager.

Returns:
a pointer to the layout manager

Widget* ONE::gui::Component::getParent  )  const [virtual, inherited]
 

Returns:
this object's parent

Implements ONE::gui::Widget.

const Point & ONE::gui::Displayable::getPosition  )  const [inline, inherited]
 

accesses this object's position

Returns:
the position of this object's top left corner

Size ONE::gui::Panel::getPreferredSize  )  const [virtual]
 

determines this object's preferred size.

If this object has a non-degenerate preferred size (i.e. Size::isZero returns false), that value is returned. Otherwise, this function calculates the optimal size for this object.

Implements ONE::gui::Displayable.

const Size & ONE::gui::Displayable::getSize  )  const [inline, inherited]
 

accesses this object's size

Returns:
the size of this object's bounding rectangle

bool ONE::gui::Panel::hasChildren  )  const [inline, virtual]
 

the default implementation of this function returns false

Reimplemented from ONE::gui::Component.

bool ONE::gui::Component::hasFocus  )  const [virtual, inherited]
 

checks if this component has the input focus

This function queries the FocusManager.

Returns:
true if this component is focused

Implements ONE::gui::Control.

bool ONE::gui::Widget::isEnabled  )  const [inline, virtual, inherited]
 

checks if this widget is enabled

Returns:
true if is enabled, false otherwise

Implements ONE::gui::Control.

bool ONE::gui::Displayable::isOpaque  )  const [inline, inherited]
 

checks this object's opacity

objects that are set to not opaque (i.e. transparent) should not draw their background display.

Returns:
if this object is set to opaque

virtual bool ONE::gui::Widget::isUnder const Point  )  const [virtual, inherited]
 

This implementation checks if the given point is within the widget's bounds and then queries the delegate.

Implements ONE::gui::Control.

Reimplemented in ONE::gui::Picture.

bool ONE::gui::Displayable::isVisible  )  const [inline, virtual, inherited]
 

acesses the visibility property

The default value is true. However, subclasses may choose to change this.

Returns:
true if the object is visible

void ONE::gui::Panel::layout  )  [virtual]
 

delegates the laying out of this component to its LayoutManager

Implements ONE::gui::Displayable.

void ONE::gui::Panel::processKeyEvent KeyEvent  )  [inline, virtual]
 

does nothing

Panels don't react to user input.

Implements ONE::gui::Control.

void ONE::gui::Panel::processMouseMotion MouseEvent  )  [inline, virtual]
 

does nothing

Panels don't react to user input.

Implements ONE::gui::Control.

void ONE::gui::Panel::processMousePress MouseEvent  )  [inline, virtual]
 

does nothing

Panels don't react to user input.

Implements ONE::gui::Control.

void ONE::gui::Panel::processMouseRelease MouseEvent  )  [inline, virtual]
 

does nothing

Panels don't react to user input.

Implements ONE::gui::Control.

void ONE::gui::Component::releaseFocus  )  const [virtual, inherited]
 

drops the input focus

Implements ONE::gui::Control.

void ONE::gui::Panel::remove Component comp  )  [virtual]
 

the default implementation of this function does nothing

Reimplemented from ONE::gui::Component.

bool ONE::gui::Component::requestFocus  )  [virtual, inherited]
 

requests the input focus for this component.

The FocusManager may deny the request, see FocusManager::requestFocus() for details.

Returns:
if the request was granted

Implements ONE::gui::Control.

void ONE::gui::Displayable::scheduleLayout  )  [inherited]
 

schedules a call to layout

This function makes component layout more efficient as several calls to this function within one frame duration result in only one call to layout.

void ONE::gui::Displayable::setBackground const Color c,
bool  laf = true
[inherited]
 

changes this object's background color

The setting is active immediately. If laf is true (the default), the setting is propagated to the GuiManager as an individual setting.

Parameters:
c the new background color
laf if the setting should be propagated to the GuiManager

void ONE::gui::Displayable::setBit const bits bit,
bool  val
[inline, protected, inherited]
 

void ONE::gui::Bordered::setBorder const BrdSP b,
bool  laf = true
[inherited]
 

changes the component's border

If laf is true, the setting is propagated to the GuiManager as an individual setting. Note that this function does not request a re-layout.

Parameters:
b the new border
laf if the setting should be propagated to the GuiManager

void ONE::gui::Displayable::setBounds const int &  x,
const int &  y,
const int &  w,
const int &  h
[inline, inherited]
 

void ONE::gui::Displayable::setBounds const Bounds b  )  [inline, inherited]
 

changes this object's bounds

See setSize and setPosition

Parameters:
b the new bounds

void ONE::gui::Widget::setDisabledBackground const Color c,
bool  laf = true
[inherited]
 

changes this object's disabled background color

The setting is active immediately. If laf is true (the default), the setting is propagated to the GuiManager as an individual setting.

Parameters:
c the new background color
laf if the setting should be propagated to the GuiManager

void ONE::gui::Widget::setDisabledForeground const Color c,
bool  laf = true
[inherited]
 

changes this object's disabled foreground color

The setting is active immediately. If laf is true (the default), the setting is propagated to the GuiManager as an individual setting.

Parameters:
c the new foreground color
laf if the setting should be propagated to the GuiManager

virtual void ONE::gui::Widget::setEnabled bool   )  [virtual, inherited]
 

enables or disables this component

Disabled components no longer react to user input. If this object has children, they are modified accordingly.

Implements ONE::gui::Control.

Reimplemented in ONE::gui::Button, ONE::gui::Console, ONE::gui::Frame, and ONE::gui::TitleBar.

void ONE::gui::Widget::setFocus const Color c,
bool  laf = true
[inherited]
 

changes the color that will be used to draw the component focus marker

The setting is active immediately. If laf is true (the default), the setting is propagated to the GuiManager as an individual setting.

Parameters:
c the new focus color
laf if the setting should be propagated to the GuiManager

void ONE::gui::Displayable::setForeground const Color c,
bool  laf = true
[inherited]
 

changes this object's foreground color

The setting is active immediately. If laf is true (the default), the setting is propagated to the GuiManager as an individual setting.

Parameters:
c the new foreground color
laf if the setting should be propagated to the GuiManager

void ONE::gui::Widget::setInputMap const IMSP im,
bool  laf = true
[inherited]
 

void ONE::gui::Panel::setLayoutManager LayoutManager lm  ) 
 

changes the layout manager

This function delete s the previously active layout manager and removes all of the content from this panel.

Parameters:
lm the new layout manager

void ONE::gui::Displayable::setOpaque bool  o,
bool  laf = true
[inherited]
 

changes this object's opacity

The setting is active immediately. If laf is true (the default), the setting is propagated to the GuiManager as an individual setting.

Parameters:
o the new opacity setting
laf if the setting should be propagated to the GuiManager

void ONE::gui::Component::setParent Widget p  )  [inherited]
 

changes this component's parent

If a previous parent was set, this component will be removed from it.

Parameters:
p the new parent

void ONE::gui::Displayable::setPosition const int &  x,
const int &  y
[inline, inherited]
 

void ONE::gui::Displayable::setPosition const Point p  )  [inline, inherited]
 

changes this object's position

Note that this function does not request a re-layout.

Parameters:
p the new position for the object's top left corner

void ONE::gui::Displayable::setPreferredSize const Size s  )  [inline, inherited]
 

sets the object's preferred size

If the value is set to an empty size object, the component will calculate its preferred size.

Parameters:
s the preferred size or a Size object with either a width or a height of 0

void ONE::gui::Displayable::setSize const int &  w,
const int &  h
[inline, inherited]
 

void ONE::gui::Displayable::setSize const Size s  )  [inline, inherited]
 

changes this object's size

Note that this function does not request a re-layout.

Parameters:
s the new size

void ONE::gui::Widget::setVisible bool  vis  )  [inline, virtual, inherited]
 

This function releases the input focus if the widget is set to invisible.

Reimplemented from ONE::gui::Displayable.

void ONE::gui::Panel::updateUI  )  [virtual]
 

Reimplemented from ONE::gui::Bordered.


Member Data Documentation

const bits ONE::gui::Widget::ENABLED [static, protected, inherited]
 

const bits ONE::gui::Displayable::LSCHED [static, protected, inherited]
 

set when this object is scheduled to be laid out

const bits ONE::gui::Displayable::OPQ [static, protected, inherited]
 

opacity bit

Size ONE::gui::Displayable::prefSize [protected, inherited]
 

const bits ONE::gui::Displayable::VIS [static, protected, inherited]
 

visibility bit


Generated on Wed Sep 7 19:03:19 2005 for ONEngine by  doxygen 1.4.3