mirror of
https://github.com/edubart/otclient.git
synced 2025-10-19 05:53:26 +02:00
implement button tooltips on top menu
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -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)
|
||||
|
@@ -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; }
|
||||
|
Reference in New Issue
Block a user