Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Teddy::PhysicalComponents::Area Class Reference

Base class for physical userinterface components. More...

#include <Area.h>

Inheritance diagram for Teddy::PhysicalComponents::Area:

Inheritance graph
[legend]
Collaboration diagram for Teddy::PhysicalComponents::Area:

Collaboration graph
[legend]
List of all members.

Public Types

enum  e_ordering { pre_self, post_self, separate_self }

Public Methods

 Area ()
 Area (std::string &name)
 Constructor. More...

 Area (const std::string &name)
virtual ~Area ()
 Destructor. More...

virtual Area * getHit (const Vector2 &pos)
 Area Input Interface - Get Hit Area, NULL if none. More...

virtual void insert (Area *area)
 Area Layout interface - Insert Area to Layer. More...

virtual bool remove (Area *area)
 Remove child from Area. More...

virtual void setParent (Area *parent, View *view=NULL)
 Set parent Area. More...

Area * getParent ()
 Parent accessor. More...

View * getView () const
 Return View of Area. More...

const Rect & getRect () const
const Vector2 & getSize () const
virtual void draw ()
 Draw area recursively - draw all areas in layer. More...

virtual void drawSelf ()
 Draw area - draw area self component. More...

virtual void drawString (const Vector2 &pos, const char *str, Font *font)
 Area Graphics interface - Draw string - no formatting. More...

virtual void drawRect (const float x1, const float y1, const float x2, const float y2)
 Area Graphics interface - Draw non-filled rectangle. More...

virtual void drawFillRect (const float x1, const float y1, const float x2, const float y2)
 Area Graphics interface - Draw filled rectangle. More...

virtual void drawBiColRect (const float x1, const float y1, const float x2, const float y2, const Color &top_left, const Color &bottom_right)
 Area Graphics interface - Draw twocolor rectangle. More...

virtual void drawVertex (const float x1, const float y1)
virtual const Vector2 & doSize (const Vector2 &ref)
virtual void beginSize (const Vector2 &ref)
virtual void callSize (Area *a)
virtual void endSize ()
virtual const Vector2 & doPlace (const Rect &ref)
virtual void beginPlace (const Rect &ref)
virtual void callPlace (Area *a)
virtual void endPlace ()

Static Public Methods

void setDefaultWindowManager (WindowManager *wm)

Public Attributes

Vector2 offset_pixels
 offset in pixels. More...

Vector2 offset_self_size_relative
 offset relative to self size. More...

Vector2 offset_free_size_relative
 offset relative to remaining free size. More...

Vector2 fill_base_pixels
Vector2 fill_free_size_relative

Static Public Attributes

const unsigned long CLIP_LAYOUT = (1L<<0L)
 Area::. More...

const unsigned long CLIP_RENDERING = (1L<<1L)
 Area::. More...

const unsigned long CLEAR = (1L<<2L)
 Projecti. More...

const unsigned long PICK = (1L<<3L)
 Projecti. More...

const unsigned long USE_OFFSET_SELF_SIZE_RELATIVE = (1L<<8L)
const unsigned long USE_OFFSET_FREE_SIZE_RELATIVE = (1L<<9L)
const unsigned long USE_FILL_MAX_PIXELS = (1L<<10L)
const unsigned long USE_FILL_FREE_SIZE_RELATIVE = (1L<<11L)
const unsigned long USE_CLIP_TO_REFERENCE = (1L<<12L)

Protected Attributes

WindowManagerwindow_manager
 Window manager. More...

Stylestyle
 Style spesification object. More...

Area * parent
 Parent Area hosting this Area. More...

list< Area * > areas
 Child Areas. More...

e_ordering drawing_ordering
 Draw before or after children? More...

e_ordering event_ordering
 Consume event before or after children? More...

Vector2 size
Rect rect
Rect in_rect

Static Protected Attributes

WindowManagerdefault_window_manager = NULL

Detailed Description

Base class for physical userinterface components.

Area is the basic base class for all Physical Components.

Area provides a drawing context. Drawing is not currently clipped.

Area can contain subareas, thus areas can be hierarchial. When Area is drawn, all subareas are also drawn.

Area knows how to determine size and position for itself. This is called layout. The layout is determined through LayoutConstraints when place method is called.

setPos() and setSize() methods are protected low level methods; to actually set position or size of area you must use LayoutConstraint of that Area. At the moment it is public member, but that will change later.

Notice that you should use drawSelf() method for drawing in subclasses and leave draw() method as it is. The draw() method will take care of rendering children as well.

Area can also be interactive such that they can be operated with input device. Area is not interactive by default. To make Area interactive, it must be registered (as potential focus area) to WindowManager. See WindowManager for details on this.

Visual Area properties link font, color and size should be stored in Style.

Definition at line 89 of file Area.h.


Member Enumeration Documentation

enum Teddy::PhysicalComponents::Area::e_ordering
 

Enumeration values:
pre_self  Draw self first, before children.
post_self  Draw self last, after children.
separate_self  Separate drawSelf() invovation.

Definition at line 111 of file Area.h.


Constructor & Destructor Documentation

Teddy::PhysicalComponents::Area::Area  
 

Definition at line 108 of file Area.cpp.

References default_window_manager, drawing_ordering, event_ordering, fill_base_pixels, fill_free_size_relative, offset_free_size_relative, offset_pixels, offset_self_size_relative, parent, post_self, pre_self, style, Vector2, and window_manager.

Referenced by Area, draw, Teddy::PhysicalComponents::Layer::drawLayer, Teddy::PhysicalComponents::Layer::getHit, and getHit.

Teddy::PhysicalComponents::Area::Area std::string &    name
 

Constructor.

Definition at line 66 of file Area.cpp.

References Area, default_window_manager, drawing_ordering, event_ordering, fill_base_pixels, fill_free_size_relative, Teddy::MixIn::Named::Named, offset_free_size_relative, offset_pixels, offset_self_size_relative, parent, post_self, pre_self, style, Vector2, and window_manager.

Teddy::PhysicalComponents::Area::Area const std::string &    name
 

Definition at line 89 of file Area.cpp.

References default_window_manager, drawing_ordering, event_ordering, fill_base_pixels, fill_free_size_relative, offset_free_size_relative, offset_pixels, offset_self_size_relative, parent, post_self, pre_self, style, Vector2, and window_manager.

Teddy::PhysicalComponents::Area::~Area   [virtual]
 

Destructor.

Definition at line 128 of file Area.cpp.


Member Function Documentation

void Teddy::PhysicalComponents::Area::beginPlace const Rect &    ref [virtual]
 

Reimplemented in Teddy::PhysicalComponents::Dock.

Definition at line 89 of file AreaLayout.cpp.

References Teddy::SysSupport::dmsg, in_rect, Teddy::MixIn::Options::isEnabled, Teddy::SysSupport::M_WML, offset_free_size_relative, offset_pixels, offset_self_size_relative, rect, size, and style.

Referenced by doPlace.

void Teddy::PhysicalComponents::Area::beginSize const Vector2 &    ref [virtual]
 

Reimplemented in Teddy::PhysicalComponents::Dock.

Definition at line 54 of file AreaLayout.cpp.

References Teddy::SysSupport::dmsg, fill_base_pixels, fill_free_size_relative, Teddy::SysSupport::M_WML, and size.

Referenced by doSize.

void Teddy::PhysicalComponents::Area::callPlace Area *    a [virtual]
 

Reimplemented in Teddy::PhysicalComponents::Dock.

Definition at line 105 of file AreaLayout.cpp.

References Teddy::SysSupport::dmsg, Teddy::SysSupport::M_WML, and rect.

Referenced by doPlace.

void Teddy::PhysicalComponents::Area::callSize Area *    a [virtual]
 

Reimplemented in Teddy::PhysicalComponents::Dock.

Definition at line 64 of file AreaLayout.cpp.

References Teddy::SysSupport::dmsg, Teddy::SysSupport::M_WML, and size.

Referenced by doSize.

const Vector2 & Teddy::PhysicalComponents::Area::doPlace const Rect &    ref [virtual]
 

Definition at line 75 of file AreaLayout.cpp.

References areas, beginPlace, callPlace, Teddy::SysSupport::dmsg, endPlace, Teddy::SysSupport::M_WML, and size.

const Vector2 & Teddy::PhysicalComponents::Area::doSize const Vector2 &    ref [virtual]
 

Definition at line 40 of file AreaLayout.cpp.

References areas, beginSize, callSize, Teddy::SysSupport::dmsg, endSize, Teddy::SysSupport::M_WML, and size.

void Teddy::PhysicalComponents::Area::draw   [virtual]
 

Draw area recursively - draw all areas in layer.

Definition at line 44 of file AreaDraw.cpp.

References Area, areas, Teddy::SysSupport::dmsg, drawing_ordering, drawSelf, Teddy::SysSupport::M_WM, Teddy::MixIn::Named::name, post_self, pre_self, and rect.

void Teddy::PhysicalComponents::Area::drawBiColRect const float    x1,
const float    y1,
const float    x2,
const float    y2,
const Color &    top_left,
const Color &    bottom_right
[virtual]
 

Area Graphics interface - Draw twocolor rectangle.

Definition at line 97 of file AreaDraw.cpp.

References rect, and Teddy::Graphics::ViewClient::view.

Referenced by Teddy::PhysicalComponents::MenuList::drawSelf, Teddy::PhysicalComponents::Frame::drawSelf, and Teddy::PhysicalComponents::ActionButton::drawSelf.

void Teddy::PhysicalComponents::Area::drawFillRect const float    x1,
const float    y1,
const float    x2,
const float    y2
[virtual]
 

Area Graphics interface - Draw filled rectangle.

Definition at line 88 of file AreaDraw.cpp.

References Teddy::MixIn::Named::getName, Teddy::SysSupport::M_GL, Teddy::SysSupport::msg, Teddy::MixIn::Named::name, rect, and Teddy::Graphics::ViewClient::view.

Referenced by Teddy::PhysicalComponents::MenuList::drawSelf, and Teddy::PhysicalComponents::ActionButton::drawSelf.

void Teddy::PhysicalComponents::Area::drawRect const float    x1,
const float    y1,
const float    x2,
const float    y2
[virtual]
 

Area Graphics interface - Draw non-filled rectangle.

Definition at line 82 of file AreaDraw.cpp.

References rect, and Teddy::Graphics::ViewClient::view.

Referenced by Teddy::PhysicalComponents::Frame::drawSelf.

void Teddy::PhysicalComponents::Area::drawSelf   [virtual]
 

Draw area - draw area self component.

Reimplemented in Teddy::PhysicalComponents::ActionButton.

Definition at line 67 of file AreaDraw.cpp.

Referenced by draw.

void Teddy::PhysicalComponents::Area::drawString const Vector2 &    pos,
const char *    str,
Font *    font
[virtual]
 

Area Graphics interface - Draw string - no formatting.

Definition at line 103 of file AreaDraw.cpp.

References rect, and Teddy::Graphics::ViewClient::view.

Referenced by Teddy::PhysicalComponents::Label::drawSelf, Teddy::PhysicalComponents::Console::drawSelf, Teddy::PhysicalComponents::Button::drawSelf, and Teddy::PhysicalComponents::ActionButton::drawSelf.

void Teddy::PhysicalComponents::Area::drawVertex const float    x1,
const float    y1
[virtual]
 

Definition at line 76 of file AreaDraw.cpp.

References rect, and Teddy::Graphics::ViewClient::view.

Referenced by Teddy::PhysicalComponents::GradientFill::drawSelf.

void Teddy::PhysicalComponents::Area::endPlace   [virtual]
 

Definition at line 111 of file AreaLayout.cpp.

Referenced by doPlace.

void Teddy::PhysicalComponents::Area::endSize   [virtual]
 

Reimplemented in Teddy::PhysicalComponents::Dock.

Definition at line 70 of file AreaLayout.cpp.

References Teddy::SysSupport::dmsg, Teddy::SysSupport::M_WML, and size.

Referenced by doSize.

Area * Teddy::PhysicalComponents::Area::getHit const Vector2 &    pos [virtual]
 

Area Input Interface - Get Hit Area, NULL if none.

Reimplemented in Teddy::PhysicalComponents::Layer.

Definition at line 133 of file Area.cpp.

References Area, areas, Teddy::SysSupport::dmsg, event_ordering, Teddy::MixIn::Named::getName, Teddy::SysSupport::M_WME, Teddy::MixIn::Named::name, post_self, pre_self, and rect.

Area * Teddy::PhysicalComponents::Area::getParent  
 

Parent accessor.

Definition at line 193 of file Area.cpp.

References parent.

const Rect & Teddy::PhysicalComponents::Area::getRect   const
 

Definition at line 198 of file Area.cpp.

References rect.

const Vector2 & Teddy::PhysicalComponents::Area::getSize   const
 

Definition at line 203 of file Area.cpp.

References size.

View * Teddy::PhysicalComponents::Area::getView   const
 

Return View of Area.

Reimplemented from Teddy::Graphics::ViewClient.

Definition at line 71 of file AreaDraw.cpp.

References Teddy::Graphics::ViewClient::view.

void Teddy::PhysicalComponents::Area::insert Area *    area [virtual]
 

Area Layout interface - Insert Area to Layer.

Definition at line 209 of file Area.cpp.

References areas, Teddy::SysSupport::dmsg, and Teddy::SysSupport::M_WM.

Referenced by Teddy::PhysicalComponents::Layer::addProjection, Teddy::PhysicalComponents::Popup::close, Teddy::PhysicalComponents::Console::Console, Teddy::PhysicalComponents::Popup::open, and Teddy::PhysicalComponents::Popup::Popup.

bool Teddy::PhysicalComponents::Area::remove Area *    area [virtual]
 

Remove child from Area.

Definition at line 220 of file Area.cpp.

References areas, Teddy::SysSupport::dmsg, and Teddy::SysSupport::M_WM.

Referenced by Teddy::PhysicalComponents::Popup::close, and Teddy::PhysicalComponents::Popup::open.

void Teddy::PhysicalComponents::Area::setDefaultWindowManager WindowManager   wm [static]
 

Definition at line 60 of file Area.cpp.

void Teddy::PhysicalComponents::Area::setParent Area *    parent,
View *    view = NULL
[virtual]
 

Set parent Area.

Definition at line 177 of file Area.cpp.

References areas, parent, Teddy::Graphics::ViewClient::setView, and Teddy::Graphics::ViewClient::view.


Member Data Documentation

list<Area*> Teddy::PhysicalComponents::Area::areas [protected]
 

Child Areas.

Definition at line 161 of file Area.h.

Referenced by doPlace, doSize, draw, Teddy::PhysicalComponents::Layer::drawLayer, Teddy::PhysicalComponents::Layer::getHit, getHit, insert, Teddy::PhysicalComponents::Layer::place, remove, and setParent.

const unsigned long Teddy::PhysicalComponents::Area::CLEAR = (1L<<2L) [static]
 

Projecti.

Definition at line 47 of file Area.cpp.

const unsigned long Teddy::PhysicalComponents::Area::CLIP_LAYOUT = (1L<<0L) [static]
 

Area::.

Definition at line 45 of file Area.cpp.

const unsigned long Teddy::PhysicalComponents::Area::CLIP_RENDERING = (1L<<1L) [static]
 

Area::.

Definition at line 46 of file Area.cpp.

WindowManager * Teddy::PhysicalComponents::Area::default_window_manager = NULL [static, protected]
 

Definition at line 57 of file Area.cpp.

Referenced by Area.

e_ordering Teddy::PhysicalComponents::Area::drawing_ordering [protected]
 

Draw before or after children?

Definition at line 162 of file Area.h.

Referenced by Teddy::PhysicalComponents::ActionButton::ActionButton, Area, Teddy::PhysicalComponents::Button::Button, Teddy::PhysicalComponents::Console::Console, draw, Teddy::PhysicalComponents::Label::Label, Teddy::PhysicalComponents::Layer::Layer, and Teddy::PhysicalComponents::Projection::Projection.

e_ordering Teddy::PhysicalComponents::Area::event_ordering [protected]
 

Consume event before or after children?

Definition at line 163 of file Area.h.

Referenced by Teddy::PhysicalComponents::ActionButton::ActionButton, Area, Teddy::PhysicalComponents::Button::Button, Teddy::PhysicalComponents::Dock::Dock, Teddy::PhysicalComponents::Frame::Frame, Teddy::PhysicalComponents::Layer::getHit, and getHit.

Vector2 Teddy::PhysicalComponents::Area::fill_base_pixels
 

Definition at line 154 of file Area.h.

Referenced by Teddy::PhysicalComponents::ActionButton::ActionButton, Area, beginSize, Teddy::PhysicalComponents::Button::Button, Teddy::PhysicalComponents::Console::Console, Teddy::PhysicalComponents::Frame::Frame, and Teddy::PhysicalComponents::Label::Label.

Vector2 Teddy::PhysicalComponents::Area::fill_free_size_relative
 

Definition at line 155 of file Area.h.

Referenced by Area, beginSize, Teddy::PhysicalComponents::Fill::Fill, Teddy::PhysicalComponents::Frame::Frame, and Teddy::PhysicalComponents::Projection::Projection.

Rect Teddy::PhysicalComponents::Area::in_rect [protected]
 

Definition at line 168 of file Area.h.

Referenced by Teddy::PhysicalComponents::Dock::beginPlace, and beginPlace.

Vector2 Teddy::PhysicalComponents::Area::offset_free_size_relative
 

offset relative to remaining free size.

Definition at line 153 of file Area.h.

Referenced by Area, Teddy::PhysicalComponents::Dock::beginPlace, and beginPlace.

Vector2 Teddy::PhysicalComponents::Area::offset_pixels
 

offset in pixels.

Definition at line 151 of file Area.h.

Referenced by Area, Teddy::PhysicalComponents::Dock::beginPlace, beginPlace, and Teddy::PhysicalComponents::Frame::Frame.

Vector2 Teddy::PhysicalComponents::Area::offset_self_size_relative
 

offset relative to self size.

Definition at line 152 of file Area.h.

Referenced by Area, Teddy::PhysicalComponents::Dock::beginPlace, and beginPlace.

Area* Teddy::PhysicalComponents::Area::parent [protected]
 

Parent Area hosting this Area.

Definition at line 160 of file Area.h.

Referenced by Area, Teddy::PhysicalComponents::Popup::close, getParent, Teddy::PhysicalComponents::Layer::Layer, Teddy::PhysicalComponents::Popup::open, and setParent.

const unsigned long Teddy::PhysicalComponents::Area::PICK = (1L<<3L) [static]
 

Projecti.

Definition at line 48 of file Area.cpp.

Rect Teddy::PhysicalComponents::Area::rect [protected]
 

Definition at line 167 of file Area.h.

Referenced by Teddy::PhysicalComponents::Dock::beginPlace, beginPlace, callPlace, draw, drawBiColRect, drawFillRect, drawRect, Teddy::PhysicalComponents::Projection::drawSelf, drawString, drawVertex, Teddy::PhysicalComponents::Projection::getHit, Teddy::PhysicalComponents::Layer::getHit, getHit, getRect, Teddy::PhysicalComponents::Layer::Layer, Teddy::PhysicalComponents::Layer::place, and Teddy::PhysicalComponents::Layer::update.

Vector2 Teddy::PhysicalComponents::Area::size [protected]
 

Definition at line 166 of file Area.h.

Referenced by Teddy::PhysicalComponents::Dock::beginPlace, beginPlace, Teddy::PhysicalComponents::Dock::beginSize, beginSize, Teddy::PhysicalComponents::Dock::callSize, callSize, doPlace, doSize, Teddy::PhysicalComponents::Layer::drawLayer, Teddy::PhysicalComponents::Projection::drawSelf, Teddy::PhysicalComponents::MenuList::drawSelf, Teddy::PhysicalComponents::GradientFill::drawSelf, Teddy::PhysicalComponents::Frame::drawSelf, Teddy::PhysicalComponents::ActionButton::drawSelf, Teddy::PhysicalComponents::Dock::endSize, endSize, Teddy::PhysicalComponents::Projection::getRatio, getSize, Teddy::PhysicalComponents::Layer::Layer, and Teddy::PhysicalComponents::Layer::update.

Style* Teddy::PhysicalComponents::Area::style [protected]
 

Style spesification object.

Definition at line 159 of file Area.h.

Referenced by Teddy::PhysicalComponents::ActionButton::ActionButton, Area, Teddy::PhysicalComponents::Dock::beginPlace, beginPlace, Teddy::PhysicalComponents::Dock::beginSize, Teddy::PhysicalComponents::Button::Button, Teddy::PhysicalComponents::Dock::callPlace, Teddy::PhysicalComponents::Dock::callSize, Teddy::PhysicalComponents::Console::Console, Teddy::PhysicalComponents::Label::drawSelf, Teddy::PhysicalComponents::Frame::drawSelf, Teddy::PhysicalComponents::Console::drawSelf, Teddy::PhysicalComponents::Button::drawSelf, Teddy::PhysicalComponents::ActionButton::drawSelf, Teddy::PhysicalComponents::Dock::endSize, and Teddy::PhysicalComponents::Label::Label.

const unsigned long Teddy::PhysicalComponents::Area::USE_CLIP_TO_REFERENCE = (1L<<12L) [static]
 

Definition at line 54 of file Area.cpp.

const unsigned long Teddy::PhysicalComponents::Area::USE_FILL_FREE_SIZE_RELATIVE = (1L<<11L) [static]
 

Definition at line 53 of file Area.cpp.

const unsigned long Teddy::PhysicalComponents::Area::USE_FILL_MAX_PIXELS = (1L<<10L) [static]
 

Definition at line 52 of file Area.cpp.

const unsigned long Teddy::PhysicalComponents::Area::USE_OFFSET_FREE_SIZE_RELATIVE = (1L<<9L) [static]
 

Definition at line 51 of file Area.cpp.

const unsigned long Teddy::PhysicalComponents::Area::USE_OFFSET_SELF_SIZE_RELATIVE = (1L<<8L) [static]
 

Definition at line 50 of file Area.cpp.

WindowManager* Teddy::PhysicalComponents::Area::window_manager [protected]
 

Window manager.

Definition at line 158 of file Area.h.

Referenced by Area, Teddy::PhysicalComponents::Popup::close, and Teddy::PhysicalComponents::Popup::open.


The documentation for this class was generated from the following files: