Files
funnygame/fgui/widget.cpp

56 lines
899 B
C++

#include "fgui/widget.h"
#include "fgui/fgui.h"
CFGUI_Widget::CFGUI_Widget()
{
IFGUI::AppendWidget(this);
}
CFGUI_Widget::~CFGUI_Widget()
{
}
void CFGUI_Widget::SetPosition( int32_t nX, int32_t nY )
{
m_iPosition[0] = nX;
m_iPosition[1] = nY;
}
void CFGUI_Widget::SetSize( uint32_t nX, uint32_t nY )
{
m_iSize[0] = nX;
m_iSize[1] = nY;
}
void CFGUI_Widget::SetParent( CFGUI_Widget *pParent )
{
m_pParent = pParent;
}
void CFGUI_Widget::ComputeOffset( void )
{
CFGUI_Widget *pParent = m_pParent;
while (pParent)
{
IFGUI::AddOffset(pParent->m_iPosition[0], pParent->m_iPosition[1]);
pParent = pParent->m_pParent;
};
}
bool CFGUI_Widget::IsVisible( )
{
CFGUI_Widget *pWidget = this;
while (pWidget)
{
if (!pWidget->m_bIsVisible)
return false;
pWidget = pWidget->m_pParent;
};
return true;
};
void CFGUI_Widget::SetVisibility( bool bValue )
{
m_bIsVisible = bValue;
}