Merge pull request #111819 from MewPurPur/democratize-cursor-shape

Add virtual `_get_cursor_shape()` method in Control
This commit is contained in:
Rémi Verschelde
2026-03-16 23:41:08 +01:00
3 changed files with 25 additions and 8 deletions
+7 -1
View File
@@ -3183,6 +3183,10 @@ Control::CursorShape Control::get_default_cursor_shape() const {
Control::CursorShape Control::get_cursor_shape(const Point2 &p_pos) const {
ERR_READ_THREAD_GUARD_V(CURSOR_ARROW);
int ret;
if (GDVIRTUAL_CALL(_get_cursor_shape, p_pos, ret)) {
return (CursorShape)ret;
}
return data.default_cursor;
}
@@ -4443,7 +4447,7 @@ void Control::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_default_cursor_shape", "shape"), &Control::set_default_cursor_shape);
ClassDB::bind_method(D_METHOD("get_default_cursor_shape"), &Control::get_default_cursor_shape);
ClassDB::bind_method(D_METHOD("get_cursor_shape", "position"), &Control::get_cursor_shape, DEFVAL(Point2()));
ClassDB::bind_method(D_METHOD("get_cursor_shape", "at_position"), &Control::get_cursor_shape, DEFVAL(Point2()));
ClassDB::bind_method(D_METHOD("set_focus_neighbor", "side", "neighbor"), &Control::set_focus_neighbor);
ClassDB::bind_method(D_METHOD("get_focus_neighbor", "side"), &Control::get_focus_neighbor);
@@ -4758,6 +4762,8 @@ void Control::_bind_methods() {
GDVIRTUAL_BIND(_drop_data, "at_position", "data");
GDVIRTUAL_BIND(_make_custom_tooltip, "for_text");
GDVIRTUAL_BIND(_get_cursor_shape, "at_position");
GDVIRTUAL_BIND(_accessibility_get_contextual_info);
GDVIRTUAL_BIND(_get_accessibility_container_name, "node");