|
@@ -2206,14 +2206,14 @@ String Control::_get_tooltip() const {
|
|
return data.tooltip;
|
|
return data.tooltip;
|
|
}
|
|
}
|
|
|
|
|
|
-void Control::set_focus_neighbour(Margin p_margin, const NodePath &p_neighbour) {
|
|
|
|
|
|
+void Control::set_focus_neighbor(Margin p_margin, const NodePath &p_neighbor) {
|
|
ERR_FAIL_INDEX((int)p_margin, 4);
|
|
ERR_FAIL_INDEX((int)p_margin, 4);
|
|
- data.focus_neighbour[p_margin] = p_neighbour;
|
|
|
|
|
|
+ data.focus_neighbor[p_margin] = p_neighbor;
|
|
}
|
|
}
|
|
|
|
|
|
-NodePath Control::get_focus_neighbour(Margin p_margin) const {
|
|
|
|
|
|
+NodePath Control::get_focus_neighbor(Margin p_margin) const {
|
|
ERR_FAIL_INDEX_V((int)p_margin, 4, NodePath());
|
|
ERR_FAIL_INDEX_V((int)p_margin, 4, NodePath());
|
|
- return data.focus_neighbour[p_margin];
|
|
|
|
|
|
+ return data.focus_neighbor[p_margin];
|
|
}
|
|
}
|
|
|
|
|
|
void Control::set_focus_next(const NodePath &p_next) {
|
|
void Control::set_focus_next(const NodePath &p_next) {
|
|
@@ -2232,17 +2232,17 @@ NodePath Control::get_focus_previous() const {
|
|
return data.focus_prev;
|
|
return data.focus_prev;
|
|
}
|
|
}
|
|
|
|
|
|
-#define MAX_NEIGHBOUR_SEARCH_COUNT 512
|
|
|
|
|
|
+#define MAX_NEIGHBOR_SEARCH_COUNT 512
|
|
|
|
|
|
-Control *Control::_get_focus_neighbour(Margin p_margin, int p_count) {
|
|
|
|
|
|
+Control *Control::_get_focus_neighbor(Margin p_margin, int p_count) {
|
|
ERR_FAIL_INDEX_V((int)p_margin, 4, nullptr);
|
|
ERR_FAIL_INDEX_V((int)p_margin, 4, nullptr);
|
|
|
|
|
|
- if (p_count >= MAX_NEIGHBOUR_SEARCH_COUNT) {
|
|
|
|
|
|
+ if (p_count >= MAX_NEIGHBOR_SEARCH_COUNT) {
|
|
return nullptr;
|
|
return nullptr;
|
|
}
|
|
}
|
|
- if (!data.focus_neighbour[p_margin].is_empty()) {
|
|
|
|
|
|
+ if (!data.focus_neighbor[p_margin].is_empty()) {
|
|
Control *c = nullptr;
|
|
Control *c = nullptr;
|
|
- Node *n = get_node(data.focus_neighbour[p_margin]);
|
|
|
|
|
|
+ Node *n = get_node(data.focus_neighbor[p_margin]);
|
|
if (n) {
|
|
if (n) {
|
|
c = Object::cast_to<Control>(n);
|
|
c = Object::cast_to<Control>(n);
|
|
ERR_FAIL_COND_V_MSG(!c, nullptr, "Neighbor focus node is not a control: " + n->get_name() + ".");
|
|
ERR_FAIL_COND_V_MSG(!c, nullptr, "Neighbor focus node is not a control: " + n->get_name() + ".");
|
|
@@ -2260,7 +2260,7 @@ Control *Control::_get_focus_neighbour(Margin p_margin, int p_count) {
|
|
return c;
|
|
return c;
|
|
}
|
|
}
|
|
|
|
|
|
- c = c->_get_focus_neighbour(p_margin, p_count + 1);
|
|
|
|
|
|
+ c = c->_get_focus_neighbor(p_margin, p_count + 1);
|
|
return c;
|
|
return c;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2310,12 +2310,12 @@ Control *Control::_get_focus_neighbour(Margin p_margin, int p_count) {
|
|
return nullptr;
|
|
return nullptr;
|
|
}
|
|
}
|
|
|
|
|
|
- _window_find_focus_neighbour(vdir, base, points, maxd, dist, &result);
|
|
|
|
|
|
+ _window_find_focus_neighbor(vdir, base, points, maxd, dist, &result);
|
|
|
|
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
-void Control::_window_find_focus_neighbour(const Vector2 &p_dir, Node *p_at, const Point2 *p_points, float p_min, float &r_closest_dist, Control **r_closest) {
|
|
|
|
|
|
+void Control::_window_find_focus_neighbor(const Vector2 &p_dir, Node *p_at, const Point2 *p_points, float p_min, float &r_closest_dist, Control **r_closest) {
|
|
if (Object::cast_to<Viewport>(p_at)) {
|
|
if (Object::cast_to<Viewport>(p_at)) {
|
|
return; //bye
|
|
return; //bye
|
|
}
|
|
}
|
|
@@ -2368,7 +2368,7 @@ void Control::_window_find_focus_neighbour(const Vector2 &p_dir, Node *p_at, con
|
|
if (childc && childc->data.RI) {
|
|
if (childc && childc->data.RI) {
|
|
continue; //subwindow, ignore
|
|
continue; //subwindow, ignore
|
|
}
|
|
}
|
|
- _window_find_focus_neighbour(p_dir, p_at->get_child(i), p_points, p_min, r_closest_dist, r_closest);
|
|
|
|
|
|
+ _window_find_focus_neighbor(p_dir, p_at->get_child(i), p_points, p_min, r_closest_dist, r_closest);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2843,8 +2843,8 @@ void Control::_bind_methods() {
|
|
ClassDB::bind_method(D_METHOD("get_default_cursor_shape"), &Control::get_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", "position"), &Control::get_cursor_shape, DEFVAL(Point2()));
|
|
|
|
|
|
- ClassDB::bind_method(D_METHOD("set_focus_neighbour", "margin", "neighbour"), &Control::set_focus_neighbour);
|
|
|
|
- ClassDB::bind_method(D_METHOD("get_focus_neighbour", "margin"), &Control::get_focus_neighbour);
|
|
|
|
|
|
+ ClassDB::bind_method(D_METHOD("set_focus_neighbor", "margin", "neighbor"), &Control::set_focus_neighbor);
|
|
|
|
+ ClassDB::bind_method(D_METHOD("get_focus_neighbor", "margin"), &Control::get_focus_neighbor);
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("set_focus_next", "next"), &Control::set_focus_next);
|
|
ClassDB::bind_method(D_METHOD("set_focus_next", "next"), &Control::set_focus_next);
|
|
ClassDB::bind_method(D_METHOD("get_focus_next"), &Control::get_focus_next);
|
|
ClassDB::bind_method(D_METHOD("get_focus_next"), &Control::get_focus_next);
|
|
@@ -2922,10 +2922,10 @@ void Control::_bind_methods() {
|
|
ADD_PROPERTY(PropertyInfo(Variant::STRING, "hint_tooltip", PROPERTY_HINT_MULTILINE_TEXT), "set_tooltip", "_get_tooltip");
|
|
ADD_PROPERTY(PropertyInfo(Variant::STRING, "hint_tooltip", PROPERTY_HINT_MULTILINE_TEXT), "set_tooltip", "_get_tooltip");
|
|
|
|
|
|
ADD_GROUP("Focus", "focus_");
|
|
ADD_GROUP("Focus", "focus_");
|
|
- ADD_PROPERTYI(PropertyInfo(Variant::NODE_PATH, "focus_neighbour_left", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Control"), "set_focus_neighbour", "get_focus_neighbour", MARGIN_LEFT);
|
|
|
|
- ADD_PROPERTYI(PropertyInfo(Variant::NODE_PATH, "focus_neighbour_top", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Control"), "set_focus_neighbour", "get_focus_neighbour", MARGIN_TOP);
|
|
|
|
- ADD_PROPERTYI(PropertyInfo(Variant::NODE_PATH, "focus_neighbour_right", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Control"), "set_focus_neighbour", "get_focus_neighbour", MARGIN_RIGHT);
|
|
|
|
- ADD_PROPERTYI(PropertyInfo(Variant::NODE_PATH, "focus_neighbour_bottom", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Control"), "set_focus_neighbour", "get_focus_neighbour", MARGIN_BOTTOM);
|
|
|
|
|
|
+ ADD_PROPERTYI(PropertyInfo(Variant::NODE_PATH, "focus_neighbor_left", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Control"), "set_focus_neighbor", "get_focus_neighbor", MARGIN_LEFT);
|
|
|
|
+ ADD_PROPERTYI(PropertyInfo(Variant::NODE_PATH, "focus_neighbor_top", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Control"), "set_focus_neighbor", "get_focus_neighbor", MARGIN_TOP);
|
|
|
|
+ ADD_PROPERTYI(PropertyInfo(Variant::NODE_PATH, "focus_neighbor_right", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Control"), "set_focus_neighbor", "get_focus_neighbor", MARGIN_RIGHT);
|
|
|
|
+ ADD_PROPERTYI(PropertyInfo(Variant::NODE_PATH, "focus_neighbor_bottom", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Control"), "set_focus_neighbor", "get_focus_neighbor", MARGIN_BOTTOM);
|
|
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "focus_next", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Control"), "set_focus_next", "get_focus_next");
|
|
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "focus_next", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Control"), "set_focus_next", "get_focus_next");
|
|
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "focus_previous", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Control"), "set_focus_previous", "get_focus_previous");
|
|
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "focus_previous", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Control"), "set_focus_previous", "get_focus_previous");
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "focus_mode", PROPERTY_HINT_ENUM, "None,Click,All"), "set_focus_mode", "get_focus_mode");
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "focus_mode", PROPERTY_HINT_ENUM, "None,Click,All"), "set_focus_mode", "get_focus_mode");
|