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

ONE::gui::Displayable Class Reference

Inheritance diagram for ONE::gui::Displayable:

Inheritance graph
[legend]
List of all members.

Detailed Description

The base class for all displayable GUI objects.

This class holds a bit string that may be used to efficiently store boolean properties and status flags. Great care must be taken to ensure that subclasses do not overwrite used bits.

Author:
Daniel Seibert


Public Member Functions

 Displayable (bool vis=true)
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 BoundsgetBounds () const
 accesses this object's bounds
const UIDSPgetDelegate () const
virtual DelegateID getDelegateID () const =0
 accesses the ID that identifies the object's UIDelegate type
Color getForeground () const
 accesses the color that should be used to render the object's foreground.
const PointgetPosition () const
 accesses this object's position
virtual Size getPreferredSize () const =0
 determines this object's preferred size.
const SizegetSize () const
 accesses this object's size
bool isOpaque () const
 checks this object's opacity
virtual bool isVisible () const
 acesses the visibility property
virtual void layout ()=0
 lays out this component's internal elements
void scheduleLayout ()
 schedules a call to layout
void setBackground (const Color &c, bool laf=true)
 changes this object's background color
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 setForeground (const Color &c, bool laf=true)
 changes this object's foreground color
void setOpaque (bool o, bool laf=true)
 changes this object's opacity
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)
 changes this object's visibility
virtual void updateUI ()
 upates the ui according to the active LaF
virtual ~Displayable ()

Protected Types

typedef unsigned int bits

Protected Member Functions

virtual void doDraw (Renderer2D *r, const int &x, const int &y, const int &w, const int &h)=0
 performs subclass-specific drawing
bool getBit (const bits &bit) const
void setBit (const bits &bit, bool val)

Protected Attributes

Size prefSize

Static Protected Attributes

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]
 


Constructor & Destructor Documentation

ONE::gui::Displayable::Displayable bool  vis = true  ) 
 

virtual ONE::gui::Displayable::~Displayable  )  [virtual]
 


Member Function Documentation

virtual void ONE::gui::Displayable::doDraw Renderer2D r,
const int &  x,
const int &  y,
const int &  w,
const int &  h
[protected, pure virtual]
 

performs subclass-specific drawing

Implementations of this function may assume that this object is visible and that r is in 2D mode.

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

Implemented in ONE::gui::Console, ONE::gui::Frame, ONE::gui::Label, ONE::gui::List, ONE::gui::Panel, ONE::gui::Picture, ONE::gui::ScrollBar, ONE::gui::ScrollBarSlider, ONE::gui::TextField, ONE::gui::TitleBar, ONE::gui::Viewport, and ONE::gui::Window.

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

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]
 

draws this object.

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

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

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]
 

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

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

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

virtual DelegateID ONE::gui::Displayable::getDelegateID  )  const [pure virtual]
 

accesses the ID that identifies the object's UIDelegate type

Subclasses of this class must override this function in order to receive a proper delegate. See LookAndFeel for details.

Returns:
the delegate id

Implemented in ONE::gui::Button, ONE::gui::CheckBox, ONE::gui::Console, ONE::gui::Frame, ONE::gui::Label, ONE::gui::List, ONE::gui::Panel, ONE::gui::Picture, ONE::gui::RadioButton, ONE::gui::ScrollBar, ONE::gui::ScrollBarSlider, ONE::gui::TextField, ONE::gui::TitleBar, ONE::gui::ToggleButton, ONE::gui::Viewport, and ONE::gui::Window.

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

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

Returns:
a color

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

accesses this object's position

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

virtual Size ONE::gui::Displayable::getPreferredSize  )  const [pure 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.

Implemented in ONE::gui::Console, ONE::gui::Frame, ONE::gui::Label, ONE::gui::List, ONE::gui::Panel, ONE::gui::Picture, ONE::gui::ScrollBar, ONE::gui::ScrollBarSlider, ONE::gui::TextField, ONE::gui::TitleBar, ONE::gui::Viewport, and ONE::gui::Window.

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

accesses this object's size

Returns:
the size of this object's bounding rectangle

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

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

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

acesses the visibility property

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

Returns:
true if the object is visible

virtual void ONE::gui::Displayable::layout  )  [pure virtual]
 

lays out this component's internal elements

This function may not change this object's bounds. Implementations should lay out their internal elements according to the currently set bounds.
The provided implementation de-schedules layouting for this object. Overriding classes must make sure they call Displayable::layout if not the layout function of their immediate superclass.

Implemented in ONE::gui::Console, ONE::gui::Frame, ONE::gui::Label, ONE::gui::List, ONE::gui::Panel, ONE::gui::Picture, ONE::gui::ScrollBar, ONE::gui::ScrollBarSlider, ONE::gui::TextField, ONE::gui::TitleBar, ONE::gui::Viewport, and ONE::gui::Window.

void ONE::gui::Displayable::scheduleLayout  ) 
 

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
 

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]
 

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

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

changes this object's bounds

See setSize and setPosition

Parameters:
b the new bounds

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

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::Displayable::setOpaque bool  o,
bool  laf = true
 

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::Displayable::setPosition const int &  x,
const int &  y
[inline]
 

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

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]
 

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]
 

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

changes this object's size

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

Parameters:
s the new size

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

changes this object's visibility

objects that are set to invisible will not be drawn. Note that although this does not explicitly disable user input, invisible objects are usually excluded from event multicasts.

Parameters:
vis the new visibility

Reimplemented in ONE::gui::Widget.

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

upates the ui according to the active LaF

The default implementation updates the delegate field as well as the colors, visibility and opacity with the values provided by the look and feel. Subclasses should override this function to suit their needs.

Reimplemented in ONE::gui::AbstractButton, ONE::gui::CheckBox, ONE::gui::CommandField, ONE::gui::Console, ONE::gui::Frame, ONE::gui::Label, ONE::gui::List, ONE::gui::Panel, ONE::gui::RadioButton, ONE::gui::ScrollBar, ONE::gui::TextField, ONE::gui::TitleBar, ONE::gui::Viewport, ONE::gui::Widget, and ONE::gui::Window.


Member Data Documentation

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

set when this object is scheduled to be laid out

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

opacity bit

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

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

visibility bit


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