Math: renamed Rect to Rectf, implemented Vector2u32 and Rectu32. Scenegraph: implemen...
[fail.git] / gui / Widget.cpp
blob25f9d3f8c27cba0b821411bcb3b08599b2a17c28
1 #include "Widget.h"
2 #include "ContainerWidget.h"
3 #include "Theme.h"
5 using namespace awful;
6 using namespace awful::gui;
8 Widget::Widget( Pointer< Theme > pTheme_ )
10 m_Rect.width() = 50;
11 m_Rect.height() = 25;
13 m_pParent = 0;
14 m_Theme = pTheme_;
17 Widget::Widget( ContainerWidget* pParent_ ) :
18 Widget( pParent_->getTheme() )
20 m_pParent = pParent_;
21 pParent_->addChild( this );
24 void Widget::setRect( const math::Rectf& r )
26 m_Rect = r;
27 m_AbsPos = m_Rect.position();
29 if( m_pParent )
30 m_AbsPos += m_pParent->getAbsPos();
33 void Widget::setAbsPos( const math::Vector2f& p )
35 m_Rect.position() = p;
36 m_AbsPos = p;
38 if( m_pParent )
39 m_Rect.position() -= m_pParent->getAbsPos();