name,
wlabel,
L"",
- 258 + m_fields.size()
+ 258 + m_fields.size(),
+ 0,
+ ECI_IBEAM
);
spec.send = true;
name,
wlabel,
utf8_to_wide(unescape_string(default_val)),
- 258 + m_fields.size()
+ 258 + m_fields.size(),
+ 0,
+ ECI_IBEAM
);
createTextField(data, spec, rect, false);
name,
wlabel,
utf8_to_wide(unescape_string(default_val)),
- 258 + m_fields.size()
+ 258 + m_fields.size(),
+ 0,
+ ECI_IBEAM
);
createTextField(data, spec, rect, type == "textarea");
#endif
/*
- Draw fields/buttons tooltips
+ Draw fields/buttons tooltips and update the mouse cursor
*/
gui::IGUIElement *hovered =
Environment->getRootGUIElement()->getElementFromPoint(m_pointer);
+#ifndef HAVE_TOUCHSCREENGUI
+ gui::ICursorControl *cursor_control = RenderingEngine::get_raw_device()->
+ getCursorControl();
+ gui::ECURSOR_ICON current_cursor_icon = cursor_control->getActiveIcon();
+#endif
+ bool hovered_element_found = false;
+
if (hovered != NULL) {
s32 id = hovered->getID();
}
}
- // Find and update the current tooltip
- if (id != -1 && delta >= m_tooltip_show_delay) {
+ // Find and update the current tooltip and cursor icon
+ if (id != -1) {
for (const FieldSpec &field : m_fields) {
if (field.fid != id)
continue;
- const std::wstring &text = m_tooltips[field.fname].tooltip;
- if (!text.empty())
- showTooltip(text, m_tooltips[field.fname].color,
- m_tooltips[field.fname].bgcolor);
+ if (delta >= m_tooltip_show_delay) {
+ const std::wstring &text = m_tooltips[field.fname].tooltip;
+ if (!text.empty())
+ showTooltip(text, m_tooltips[field.fname].color,
+ m_tooltips[field.fname].bgcolor);
+ }
+
+#ifndef HAVE_TOUCHSCREENGUI
+ if (current_cursor_icon != field.fcursor_icon)
+ cursor_control->setActiveIcon(field.fcursor_icon);
+#endif
+
+ hovered_element_found = true;
break;
}
}
}
+ if (!hovered_element_found) {
+ // no element is hovered
+#ifndef HAVE_TOUCHSCREENGUI
+ if (current_cursor_icon != ECI_NORMAL)
+ cursor_control->setActiveIcon(ECI_NORMAL);
+#endif
+ }
+
m_tooltip_element->draw();
/*
FieldSpec() = default;
FieldSpec(const std::string &name, const std::wstring &label,
- const std::wstring &default_text, s32 id, int priority = 0) :
+ const std::wstring &default_text, s32 id, int priority = 0,
+ gui::ECURSOR_ICON cursor_icon = ECI_NORMAL) :
fname(name),
flabel(label),
fdefault(unescape_enriched(translate_string(default_text))),
send(false),
ftype(f_Unknown),
is_exit(false),
- priority(priority)
+ priority(priority),
+ fcursor_icon(cursor_icon)
{
}
// Draw priority for formspec version < 3
int priority;
core::rect<s32> rect;
+ gui::ECURSOR_ICON fcursor_icon;
};
struct TooltipSpec