implement button tooltips on top menu

This commit is contained in:
Eduardo Bart
2011-11-03 17:07:07 -02:00
parent 5988867787
commit 1b9f9bbc7d
12 changed files with 123 additions and 5 deletions

View File

@@ -53,9 +53,6 @@ void UIButton::onStyleApply(const OTMLNodePtr& styleNode)
m_textTranslate = node->value<Point>();
} else if(node->tag() == "text") {
m_text = node->value();
} else if(node->tag() == "onClick") {
g_lua.loadFunction(node->value(), "@" + node->source() + "[" + node->tag() + "]");
luaSetField(node->tag());
}
}
}

View File

@@ -57,7 +57,7 @@ void UIVerticalLayout::update()
void UIVerticalLayout::addWidget(const UIWidgetPtr& widget)
{
// needed to be correcly sorted on update
// needed to be correctly sorted on the following update
widget->setY(9999);
update();
}

View File

@@ -841,6 +841,11 @@ void UIWidget::onStyleApply(const OTMLNodePtr& styleNode)
anchorLayout->addAnchor(asUIWidget(), anchoredEdge, hookedWidgetId, hookedEdge);
}
} else if(node->tag() == "onClick" ||
node->tag() == "onHoverChange") {
dump << node->tag();
g_lua.loadFunction(node->value(), "@" + node->source() + "[" + node->tag() + "]");
luaSetField(node->tag());
}
}
}
@@ -858,6 +863,10 @@ void UIWidget::onFocusChange(bool focused, Fw::FocusReason reason)
void UIWidget::onHoverChange(bool hovered)
{
callLuaField("onHoverChange", hovered);
// check for new hovered elements when the current widget is removed
if(!hovered && !getParent())
g_ui.getRootWidget()->updateState(Fw::HoverState);
}
bool UIWidget::onKeyPress(uchar keyCode, char keyChar, int keyboardModifiers)

View File

@@ -119,6 +119,7 @@ public:
int getMarginTop() const { return m_marginTop; }
int getMarginBottom() const { return m_marginBottom; }
Fw::FocusReason getLastFocusReason() const { return m_lastFocusReason; }
OTMLNodePtr getStyle() const { return m_style; }
UIWidgetList getChildren() const { return m_children; }
UIWidgetPtr getFocusedChild() const { return m_focusedChild; }