create in game interface panels and renable about and options windows

This commit is contained in:
Eduardo Bart
2011-11-03 07:59:11 -02:00
parent b05bb7818d
commit b345a6d783
30 changed files with 400 additions and 70 deletions

View File

@@ -82,13 +82,22 @@ void UIWidget::destroy()
}
void UIWidget::render()
{
renderSelf();
renderChildren();
}
void UIWidget::renderSelf()
{
// draw background
if(m_image) {
g_graphics.bindColor(m_backgroundColor);
m_image->draw(m_rect);
}
}
void UIWidget::renderChildren()
{
// draw children
for(const UIWidgetPtr& child : m_children) {
// render only visible children with a valid rect
@@ -191,6 +200,12 @@ void UIWidget::unlock()
parent->unlockChild(asUIWidget());
}
void UIWidget::focus()
{
if(UIWidgetPtr parent = getParent())
parent->focusChild(asUIWidget(), Fw::ActiveFocusReason);
}
bool UIWidget::isVisible()
{
if(!m_visible)

View File

@@ -40,6 +40,8 @@ public:
virtual void setup();
virtual void render();
void renderSelf();
void renderChildren();
void setVisible(bool visible);
void setEnabled(bool enabled) { m_enabled = enabled; updateState(Fw::DisabledState); }
@@ -76,6 +78,7 @@ public:
void enable() { setEnabled(true); }
void lock();
void unlock();
void focus();
bool isActive() const { return hasState(Fw::ActiveState); }
bool isEnabled() const { return !hasState(Fw::DisabledState); }