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

ONE::gui::Frame Class Reference

Inheritance diagram for ONE::gui::Frame:

Inheritance graph
[legend]
List of all members.

Detailed Description

A decorated Window.

Frames may be moved, resized and closed via user input.

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
enum  CloseAction { DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE, SELF_DELETE_ON_CLOSE }
 reactions to a press of the close button or a call to close More...

Public Member Functions

void add (Component *comp, const LayoutConstraint *cons)
 adds a child
void clear ()
 removes all children
void close ()
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.
 Frame (const std::string &t="", bool autoReg=true)
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
 accesses this object's children
ChildItrSP getChildren ()
 accesses this object's children
CloseAction getCloseAction () const
PanelgetContent ()
 provides access to the window's content panel
const PanelgetContent () const
 provides access to the window's content panel
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
const FntSPgetFont () const
Color getForeground () const
 accesses the color that should be used to render the object's foreground.
const IMSPgetInputMap () const
WidgetgetParent () const
 returns 0 - Window s have no parents
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
const std::string & getTitle () const
bool hasChildren () const
bool hasFocus () const
 checks if this object has the keyboard focus
bool isCloseable () const
bool isEnabled () const
 checks if this widget is enabled
bool isModal () const
 checks if this window is modal
bool isMoveable () const
bool isOpaque () const
 checks this object's opacity
bool isResizable () const
virtual bool isUnder (const Point &) const
virtual bool isVisible () const
 acesses the visibility property
void layout ()
 lays out this component's internal elements
void processKeyEvent (KeyEvent &)
 notifies the widget of a key event
void processMouseMotion (MouseEvent &)
 notifies the widget of a mouse motion
void processMousePress (MouseEvent &)
 notifies the widget of a pressed mouse button
void processMouseRelease (MouseEvent &)
 notifies the widget of a released mouse button
void releaseFocus () const
 drops the input focus
void remove (Component *comp)
 removes a child
bool requestFocus ()
 attempts to get the input focus for this object
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 setCloseable (bool c)
void setCloseAction (CloseAction a)
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
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 setFont (const FntSP &f, bool laf=true)
void setForeground (const Color &c, bool laf=true)
 changes this object's foreground color
void setInputMap (const IMSP &im, bool laf=true)
void setModal (bool modal)
 changes the modality of this window
void setMoveable (bool m)
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 setResizable (bool r)
void setSize (const int &w, const int &h)
void setSize (const Size &s)
 changes this object's size
void setTitle (const std::string &t)
virtual void setVisible (bool vis)
void updateUI ()
 ~Frame ()

Protected Types

typedef unsigned int bits

Protected Member Functions

void doDraw (Renderer2D *, const int &, const int &, const int &, const int &)
 performs subclass-specific drawing
bool getBit (const bits &bit) const
void layout (const Bounds &b)
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]
 


Member Enumeration Documentation

enum ONE::gui::Frame::CloseAction
 

reactions to a press of the close button or a call to close

Enumerator:
DO_NOTHING_ON_CLOSE  does nothing
HIDE_ON_CLOSE  makes the Frame invisible
SELF_DELETE_ON_CLOSE  deletes this Frame

Note that this option is extremely dangerous when the frame is managed by other instances than the GuiManager


Constructor & Destructor Documentation

ONE::gui::Frame::Frame const std::string &  t = "",
bool  autoReg = true
 

ONE::gui::Frame::~Frame  ) 
 


Member Function Documentation

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

adds a child

Implements ONE::gui::Widget.

void ONE::gui::Window::clear  )  [virtual, inherited]
 

removes all children

Implements ONE::gui::Widget.

void ONE::gui::Frame::close  ) 
 

void ONE::gui::Frame::doDraw Renderer2D ,
const int &  ,
const int &  ,
const int &  ,
const int & 
[protected, 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

Reimplemented from ONE::gui::Window.

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::Frame::getChildCount  )  const [virtual]
 

Returns:
the number of child Widget s

Reimplemented from ONE::gui::Window.

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

accesses this object's children

If this object has no children, this function must return 0. If children overlap, the returned iterator must traverse them in front to back order. The returned children may not be modified.

Returns:
an iterator that goes through all of this widget's children in front to back order or 0 if this widget has no children

Reimplemented from ONE::gui::Window.

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

accesses this object's children

If this object has no children, this function must return 0. If children overlap, the returned iterator must traverse them in front to back order. The returned children may be modified.

Returns:
an iterator that goes through all of this widget's children in front to back order or 0 if this widget has no children

Reimplemented from ONE::gui::Window.

CloseAction ONE::gui::Frame::getCloseAction  )  const
 

Panel * ONE::gui::Window::getContent  )  [inline, inherited]
 

provides access to the window's content panel

Returns:
the content panel

const Panel * ONE::gui::Window::getContent  )  const [inline, inherited]
 

provides access to the window's content panel

Returns:
the content panel

const IMSP& ONE::gui::Frame::getDefaultInputMap  )  const [virtual]
 

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 from ONE::gui::Widget.

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

DelegateID ONE::gui::Frame::getDelegateID  )  const [virtual]
 

Reimplemented from ONE::gui::Window.

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

const FntSP& ONE::gui::Frame::getFont  )  const
 

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]
 

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

returns 0 - Window s have no parents

Returns:
0

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

Reimplemented from ONE::gui::Window.

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

accesses this object's size

Returns:
the size of this object's bounding rectangle

const std::string& ONE::gui::Frame::getTitle  )  const
 

bool ONE::gui::Frame::hasChildren  )  const [virtual]
 

Returns:
if this object has children

Reimplemented from ONE::gui::Window.

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

checks if this object has the keyboard focus

Returns:
true if this object has the input focus, false otherwise

Implements ONE::gui::Control.

bool ONE::gui::Frame::isCloseable  )  const
 

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::TopLevel::isModal  )  const [inherited]
 

checks if this window is modal

Modal windows cannot lose the input focus to another window.

Returns:
true if this window is modal, false otherwise

bool ONE::gui::Frame::isMoveable  )  const
 

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

bool ONE::gui::Frame::isResizable  )  const
 

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::Window::layout const Bounds b  )  [protected, inherited]
 

lays out the content inside the given bounds. For compatibility reasons this function ignores any border set to this window.

void ONE::gui::Frame::layout  )  [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.

Reimplemented from ONE::gui::Window.

void ONE::gui::Frame::processKeyEvent KeyEvent  )  [virtual]
 

notifies the widget of a key event

If this is not a top level container and the widget processes the event, it must call the events consume function. Otherwise evt will also be passed to this object's top level parent.

Reimplemented from ONE::gui::Window.

void ONE::gui::Frame::processMouseMotion MouseEvent  )  [virtual]
 

notifies the widget of a mouse motion

This event may occur both inside and outside of this object's bounds.

Reimplemented from ONE::gui::Window.

void ONE::gui::Frame::processMousePress MouseEvent  )  [virtual]
 

notifies the widget of a pressed mouse button

Implementations may assume that the mouse position is on this widget (i.e. isUnder returned true).

Reimplemented from ONE::gui::Window.

void ONE::gui::Frame::processMouseRelease MouseEvent  )  [virtual]
 

notifies the widget of a released mouse button

This event may occur both inside and outside of this object's bounds.

Reimplemented from ONE::gui::Window.

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

drops the input focus

Implements ONE::gui::Control.

void ONE::gui::Window::remove Component comp  )  [virtual, inherited]
 

removes a child

Implements ONE::gui::Widget.

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

attempts to get the input focus for this object

The function may not succeed in acquiring the focus in some situations. For example, calling this function on a top level container while a modal Frame is visible will fail.

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::Frame::setCloseable bool  c  ) 
 

void ONE::gui::Frame::setCloseAction CloseAction  a  ) 
 

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

void ONE::gui::Frame::setEnabled bool   )  [virtual]
 

enables or disables this component

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

Reimplemented from ONE::gui::Widget.

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::Frame::setFont const FntSP f,
bool  laf = true
 

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::TopLevel::setModal bool  modal  )  [inherited]
 

changes the modality of this window

If another window is already set to modal, that window will lose its status, as there can obviously only be one modal window.

Parameters:
modal the new status

void ONE::gui::Frame::setMoveable bool  m  ) 
 

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::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::Frame::setResizable bool  r  ) 
 

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::Frame::setTitle const std::string &  t  ) 
 

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::Frame::updateUI  )  [virtual]
 

Reimplemented from ONE::gui::Window.


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:17 2005 for ONEngine by  doxygen 1.4.3