Merge pull request #73818 from kilojool/virtual_get_tooltip

Add missing virtual bind for control::get_tooltip
This commit is contained in:
Yuri Sizov 2023-03-25 14:14:10 +01:00 committed by GitHub
commit 8f2c41b4dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 2 deletions

View File

@ -107,6 +107,14 @@
[b]Note:[/b] This method will not be called when the script is attached to a [Control] node that already overrides its minimum size (e.g. [Label], [Button], [PanelContainer] etc.). It can only be used with most basic GUI nodes, like [Control], [Container], [Panel] etc.
</description>
</method>
<method name="_get_tooltip" qualifiers="virtual const">
<return type="String" />
<param index="0" name="at_position" type="Vector2" />
<description>
Virtual method to be implemented by the user. Returns the tooltip text for the position [param at_position] in control's local coordinates, which will typically appear when the cursor is resting over this control. See [method get_tooltip].
[b]Note:[/b] If this method returns an empty [String], no tooltip is displayed.
</description>
</method>
<method name="_gui_input" qualifiers="virtual">
<return type="void" />
<param index="0" name="event" type="InputEvent" />
@ -532,8 +540,9 @@
<return type="String" />
<param index="0" name="at_position" type="Vector2" default="Vector2(0, 0)" />
<description>
Returns the tooltip text [param at_position] in local coordinates, which will typically appear when the cursor is resting over this control. By default, it returns [member tooltip_text].
[b]Note:[/b] This method can be overridden to customize its behavior. If this method returns an empty [String], no tooltip is displayed.
Returns the tooltip text for the position [param at_position] in control's local coordinates, which will typically appear when the cursor is resting over this control. By default, it returns [member tooltip_text].
This method can be overridden to customize its behavior. See [method _get_tooltip].
[b]Note:[/b] If this method returns an empty [String], no tooltip is displayed.
</description>
</method>
<method name="grab_click_focus">

View File

@ -2876,6 +2876,10 @@ String Control::get_tooltip_text() const {
}
String Control::get_tooltip(const Point2 &p_pos) const {
String ret;
if (GDVIRTUAL_CALL(_get_tooltip, p_pos, ret)) {
return ret;
}
return data.tooltip;
}
@ -3417,6 +3421,7 @@ void Control::_bind_methods() {
GDVIRTUAL_BIND(_has_point, "point");
GDVIRTUAL_BIND(_structured_text_parser, "args", "text");
GDVIRTUAL_BIND(_get_minimum_size);
GDVIRTUAL_BIND(_get_tooltip, "at_position");
GDVIRTUAL_BIND(_get_drag_data, "at_position");
GDVIRTUAL_BIND(_can_drop_data, "at_position", "data");

View File

@ -345,6 +345,7 @@ protected:
GDVIRTUAL1RC(bool, _has_point, Vector2)
GDVIRTUAL2RC(TypedArray<Vector3i>, _structured_text_parser, Array, String)
GDVIRTUAL0RC(Vector2, _get_minimum_size)
GDVIRTUAL1RC(String, _get_tooltip, Vector2)
GDVIRTUAL1RC(Variant, _get_drag_data, Vector2)
GDVIRTUAL2RC(bool, _can_drop_data, Vector2, Variant)