Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

VBox Class Reference

Inheritance diagram for VBox:

Inheritance graph
[legend]
Collaboration diagram for VBox:

Collaboration graph
[legend]

Detailed Description

Vertical box.

Definition at line 9 of file VBox.h.

Public Member Functions

 VBox ()
 Starts as empty box.
void enableCentered ()
void recenter ()
virtual int getW () const
virtual int getH () const
virtual void addWidget (IWidget *new_widget)
 Place widget to the lowest vertical place.
virtual void setShift (const V2 &shift)
 Update shift for all subwidgets.


Constructor & Destructor Documentation

VBox::VBox  ) 
 

Starts as empty box.

Definition at line 17 of file VBox.cpp.

00018 {
00019     m_w = 0;
00020     m_h = 0;
00021     m_centered = false;
00022 }


Member Function Documentation

void VBox::addWidget IWidget new_widget  )  [virtual]
 

Place widget to the lowest vertical place.

Implements WiBox.

Definition at line 28 of file VBox.cpp.

00029 {
00030     m_widgets.push_back(new_widget);
00031     m_w = max(m_w, new_widget->getW());
00032     int shiftX = 0;
00033     if (m_centered) {
00034         shiftX = (m_w - new_widget->getW()) / 2;
00035     }
00036     new_widget->setShift(m_shift.plus(V2(shiftX, m_h)));
00037     m_h += new_widget->getH();
00038 }

void VBox::enableCentered  )  [inline]
 

Definition at line 16 of file VBox.h.

00016 { m_centered = true; }

virtual int VBox::getH  )  const [inline, virtual]
 

Implements IWidget.

Definition at line 20 of file VBox.h.

00020 { return m_h; }

virtual int VBox::getW  )  const [inline, virtual]
 

Implements IWidget.

Definition at line 19 of file VBox.h.

00019 { return m_w; }

void VBox::recenter  )  [inline]
 

Definition at line 17 of file VBox.h.

00017 { setShift(m_shift); }

void VBox::setShift const V2 shift  )  [virtual]
 

Update shift for all subwidgets.

Reimplemented from IWidget.

Definition at line 44 of file VBox.cpp.

00045 {
00046     m_shift = shift;
00047     int height = 0;
00048     t_widgets::iterator end = m_widgets.end();
00049     for (t_widgets::iterator i = m_widgets.begin(); i != end; ++i) {
00050         int shiftX = 0;
00051         if (m_centered) {
00052             shiftX = (m_w - (*i)->getW()) / 2;
00053         }
00054         (*i)->setShift(m_shift.plus(V2(shiftX, height)));
00055         height += (*i)->getH();
00056     }
00057 }


The documentation for this class was generated from the following files:
Generated on Wed Jun 1 09:57:09 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2