mirror of
https://github.com/edubart/otclient.git
synced 2025-10-19 05:53:26 +02:00
create in game interface panels and renable about and options windows
This commit is contained in:
@@ -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)
|
||||
|
@@ -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); }
|
||||
|
Reference in New Issue
Block a user