ctrl+g kinda working, but login/logout events still need a remake

This commit is contained in:
Eduardo Bart
2011-08-29 11:14:21 -03:00
parent b859f66952
commit 8b2cb410c2
27 changed files with 323 additions and 148 deletions

View File

@@ -188,13 +188,7 @@ UIWidgetPtr UIManager::loadWidgetFromOTML(const OTMLNodePtr& widgetNode, const U
std::string widgetType = styleNode->valueAt("__widgetType");
// call widget creation from lua
//g_lua.getGlobalField(widgetType, "create");
g_lua.getGlobal(widgetType);
g_lua.getField("create");
g_lua.remove(-2);
g_lua.protectedCall(0, 1);
UIWidgetPtr widget = g_lua.polymorphicPop<UIWidgetPtr>();
UIWidgetPtr widget = g_lua.callGlobalField<UIWidgetPtr>(widgetType, "create");
if(parent)
parent->addChild(widget);

View File

@@ -167,6 +167,18 @@ void UIWidget::setRect(const Rect& rect)
m_updateEventScheduled = true;
}
void UIWidget::lock()
{
if(UIWidgetPtr parent = getParent())
parent->lockChild(asUIWidget());
}
void UIWidget::unlock()
{
if(UIWidgetPtr parent = getParent())
parent->unlockChild(asUIWidget());
}
bool UIWidget::isVisible()
{
if(!m_visible)
@@ -365,8 +377,11 @@ void UIWidget::removeChild(const UIWidgetPtr& child)
auto it = std::find(m_children.begin(), m_children.end(), child);
if(it != m_children.end()) {
// defocus if needed
if(m_focusedChild == child)
bool focusAnother = false;
if(m_focusedChild == child) {
focusChild(nullptr, Fw::ActiveFocusReason);
focusAnother = true;
}
// unlock child if it was locked
unlockChild(child);
@@ -381,6 +396,9 @@ void UIWidget::removeChild(const UIWidgetPtr& child)
// update child states
child->updateStates();
if(focusAnother)
focusPreviousChild(Fw::ActiveFocusReason);
} else
logError("attempt to remove an unknown child from a UIWidget");
}

View File

@@ -73,6 +73,8 @@ public:
void show() { setVisible(true); }
void disable() { setEnabled(false); }
void enable() { setEnabled(true); }
void lock();
void unlock();
bool isActive() const { return hasState(Fw::ActiveState); }
bool isEnabled() const { return !hasState(Fw::DisabledState); }
@@ -81,6 +83,7 @@ public:
bool isHovered() const { return hasState(Fw::HoverState); }
bool isPressed() const { return hasState(Fw::PressedState); }
bool isVisible();
bool isHidden() { return !isVisible(); }
bool isExplicitlyEnabled() const { return m_enabled; }
bool isExplicitlyVisible() const { return m_visible; }
bool isFocusable() const { return m_focusable; }
@@ -143,9 +146,6 @@ public:
UIWidgetPtr asUIWidget() { return std::static_pointer_cast<UIWidget>(shared_from_this()); }
private:
void internalDestroy();
void internalDestroyCheck();
bool m_updateEventScheduled;
protected: