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. |
|
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 }
|
|
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 }
|
|
Definition at line 16 of file VBox.h. 00016 { m_centered = true; }
|
|
Implements IWidget. Definition at line 20 of file VBox.h. 00020 { return m_h; }
|
|
Implements IWidget. Definition at line 19 of file VBox.h. 00019 { return m_w; }
|
|
Definition at line 17 of file VBox.h.
|
|
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 }
|