summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/color_picker.cpp24
-rw-r--r--scene/gui/color_picker.h8
-rw-r--r--scene/gui/control.cpp256
-rw-r--r--scene/gui/control.h45
-rw-r--r--scene/gui/dialogs.cpp4
-rw-r--r--scene/gui/graph_edit.cpp4
-rw-r--r--scene/gui/input_action.h2
-rw-r--r--scene/gui/item_list.cpp6
-rw-r--r--scene/gui/item_list.h2
-rw-r--r--scene/gui/line_edit.h2
-rw-r--r--scene/gui/option_button.cpp12
-rw-r--r--scene/gui/patch_9_rect.h2
-rw-r--r--scene/gui/popup.cpp26
-rw-r--r--scene/gui/popup_menu.h2
-rw-r--r--scene/gui/rich_text_label.cpp2
-rw-r--r--scene/gui/rich_text_label.h2
-rw-r--r--scene/gui/scroll_bar.cpp9
-rw-r--r--scene/gui/scroll_container.cpp4
-rw-r--r--scene/gui/tab_container.cpp16
-rw-r--r--scene/gui/tab_container.h2
-rw-r--r--scene/gui/text_edit.cpp6
-rw-r--r--scene/gui/text_edit.h12
-rw-r--r--scene/gui/texture_button.cpp4
-rw-r--r--scene/gui/texture_button.h4
-rw-r--r--scene/gui/tree.h4
-rw-r--r--scene/gui/video_player.h2
26 files changed, 299 insertions, 163 deletions
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index dddd53dd95..5e110362c8 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -314,9 +314,9 @@ void ColorPicker::_hsv_draw(int p_which, Control *c) {
}
}
-void ColorPicker::_uv_input(const Ref<InputEvent> &ev) {
+void ColorPicker::_uv_input(const Ref<InputEvent> &p_event) {
- Ref<InputEventMouseButton> bev = ev;
+ Ref<InputEventMouseButton> bev = p_event;
if (bev.is_valid()) {
if (bev->is_pressed() && bev->get_button_index() == BUTTON_LEFT) {
@@ -335,7 +335,7 @@ void ColorPicker::_uv_input(const Ref<InputEvent> &ev) {
}
}
- Ref<InputEventMouseMotion> mev = ev;
+ Ref<InputEventMouseMotion> mev = p_event;
if (mev.is_valid()) {
if (!changing_color)
@@ -352,9 +352,9 @@ void ColorPicker::_uv_input(const Ref<InputEvent> &ev) {
}
}
-void ColorPicker::_w_input(const Ref<InputEvent> &ev) {
+void ColorPicker::_w_input(const Ref<InputEvent> &p_event) {
- Ref<InputEventMouseButton> bev = ev;
+ Ref<InputEventMouseButton> bev = p_event;
if (bev.is_valid()) {
@@ -372,7 +372,7 @@ void ColorPicker::_w_input(const Ref<InputEvent> &ev) {
emit_signal("color_changed", color);
}
- Ref<InputEventMouseMotion> mev = ev;
+ Ref<InputEventMouseMotion> mev = p_event;
if (mev.is_valid()) {
@@ -388,9 +388,9 @@ void ColorPicker::_w_input(const Ref<InputEvent> &ev) {
}
}
-void ColorPicker::_preset_input(const Ref<InputEvent> &ev) {
+void ColorPicker::_preset_input(const Ref<InputEvent> &p_event) {
- Ref<InputEventMouseButton> bev = ev;
+ Ref<InputEventMouseButton> bev = p_event;
if (bev.is_valid()) {
@@ -407,7 +407,7 @@ void ColorPicker::_preset_input(const Ref<InputEvent> &ev) {
emit_signal("color_changed", color);
}
- Ref<InputEventMouseMotion> mev = ev;
+ Ref<InputEventMouseMotion> mev = p_event;
if (mev.is_valid()) {
@@ -423,9 +423,9 @@ void ColorPicker::_preset_input(const Ref<InputEvent> &ev) {
}
}
-void ColorPicker::_screen_input(const Ref<InputEvent> &ev) {
+void ColorPicker::_screen_input(const Ref<InputEvent> &p_event) {
- Ref<InputEventMouseButton> bev = ev;
+ Ref<InputEventMouseButton> bev = p_event;
if (bev.is_valid()) {
@@ -435,7 +435,7 @@ void ColorPicker::_screen_input(const Ref<InputEvent> &ev) {
}
}
- Ref<InputEventMouseMotion> mev = ev;
+ Ref<InputEventMouseMotion> mev = p_event;
if (mev.is_valid()) {
Viewport *r = get_tree()->get_root();
diff --git a/scene/gui/color_picker.h b/scene/gui/color_picker.h
index 1a79266409..d35182e062 100644
--- a/scene/gui/color_picker.h
+++ b/scene/gui/color_picker.h
@@ -81,10 +81,10 @@ private:
void _sample_draw();
void _hsv_draw(int p_which, Control *c);
- void _uv_input(const Ref<InputEvent> &p_input);
- void _w_input(const Ref<InputEvent> &p_input);
- void _preset_input(const Ref<InputEvent> &p_input);
- void _screen_input(const Ref<InputEvent> &p_input);
+ void _uv_input(const Ref<InputEvent> &p_event);
+ void _w_input(const Ref<InputEvent> &p_event);
+ void _preset_input(const Ref<InputEvent> &p_event);
+ void _screen_input(const Ref<InputEvent> &p_event);
void _add_preset_pressed();
void _screen_pick_pressed();
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 01570e28c4..c97426ad42 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -51,6 +51,12 @@ Variant Control::edit_get_state() const {
s["rect"] = get_rect();
s["rot"] = get_rotation();
s["scale"] = get_scale();
+ Array anchors;
+ anchors.push_back(get_anchor(MARGIN_LEFT));
+ anchors.push_back(get_anchor(MARGIN_TOP));
+ anchors.push_back(get_anchor(MARGIN_RIGHT));
+ anchors.push_back(get_anchor(MARGIN_BOTTOM));
+ s["anchors"] = anchors;
return s;
}
void Control::edit_set_state(const Variant &p_state) {
@@ -62,6 +68,11 @@ void Control::edit_set_state(const Variant &p_state) {
set_size(state.size);
set_rotation(s["rot"]);
set_scale(s["scale"]);
+ Array anchors = s["anchors"];
+ set_anchor(MARGIN_LEFT, anchors[0]);
+ set_anchor(MARGIN_TOP, anchors[1]);
+ set_anchor(MARGIN_RIGHT, anchors[2]);
+ set_anchor(MARGIN_BOTTOM, anchors[3]);
}
void Control::set_custom_minimum_size(const Size2 &p_custom) {
@@ -1212,21 +1223,7 @@ void Control::_size_changed() {
for (int i = 0; i < 4; i++) {
float area = parent_size[i & 1];
- switch (data.anchor[i]) {
-
- case ANCHOR_BEGIN: {
-
- margin_pos[i] = data.margin[i];
- } break;
- case ANCHOR_END: {
-
- margin_pos[i] = area - data.margin[i];
- } break;
- case ANCHOR_CENTER: {
-
- margin_pos[i] = (area / 2) - data.margin[i];
- } break;
- }
+ margin_pos[i] = data.margin[i] + (data.anchor[i] * area);
}
Point2 new_pos_cache = Point2(margin_pos[0], margin_pos[1]);
@@ -1299,59 +1296,38 @@ float Control::_get_range(int p_idx) const {
return to - from;
}
-float Control::_s2a(float p_val, AnchorType p_anchor, float p_range) const {
-
- switch (p_anchor) {
-
- case ANCHOR_BEGIN: {
- return p_val;
- } break;
- case ANCHOR_END: {
- return p_range - p_val;
- } break;
- case ANCHOR_CENTER: {
- return (p_range / 2) - p_val;
- } break;
- }
-
- return 0;
+float Control::_s2a(float p_val, float p_anchor, float p_range) const {
+ return p_val - (p_anchor * p_range);
}
-float Control::_a2s(float p_val, AnchorType p_anchor, float p_range) const {
-
- switch (p_anchor) {
-
- case ANCHOR_BEGIN: {
- return Math::floor(p_val);
- } break;
- case ANCHOR_END: {
- return Math::floor(p_range - p_val);
- } break;
- case ANCHOR_CENTER: {
- return Math::floor((p_range / 2) - p_val);
- } break;
- }
- return 0;
+float Control::_a2s(float p_val, float p_anchor, float p_range) const {
+ return Math::floor(p_val + (p_anchor * p_range));
}
-void Control::set_anchor(Margin p_margin, AnchorType p_anchor, bool p_keep_margin) {
+void Control::set_anchor(Margin p_margin, float p_anchor, bool p_keep_margin, bool p_push_opposite_anchor) {
+ bool pushed = false;
+ data.anchor[p_margin] = CLAMP(p_anchor, 0.0, 1.0);
- if (!is_inside_tree()) {
+ if (((p_margin == MARGIN_LEFT || p_margin == MARGIN_TOP) && data.anchor[p_margin] > data.anchor[(p_margin + 2) % 4]) ||
+ ((p_margin == MARGIN_RIGHT || p_margin == MARGIN_BOTTOM) && data.anchor[p_margin] < data.anchor[(p_margin + 2) % 4])) {
+ if (p_push_opposite_anchor) {
+ data.anchor[(p_margin + 2) % 4] = data.anchor[p_margin];
+ pushed = true;
+ } else {
+ data.anchor[p_margin] = data.anchor[(p_margin + 2) % 4];
+ }
+ }
- data.anchor[p_margin] = p_anchor;
- } else if (!p_keep_margin) {
- float pr = _get_parent_range(p_margin);
- float s = _a2s(data.margin[p_margin], data.anchor[p_margin], pr);
- data.anchor[p_margin] = p_anchor;
- data.margin[p_margin] = _s2a(s, p_anchor, pr);
- } else {
- data.anchor[p_margin] = p_anchor;
- _size_changed();
+ if (is_inside_tree()) {
+ if (p_keep_margin) {
+ _size_changed();
+ }
}
+ update();
_change_notify();
}
-void Control::_set_anchor(Margin p_margin, AnchorType p_anchor) {
+void Control::_set_anchor(Margin p_margin, float p_anchor) {
#ifdef TOOLS_ENABLED
if (is_inside_tree() && get_tree()->is_editor_hint()) {
set_anchor(p_margin, p_anchor, EDITOR_DEF("editors/2d/keep_margins_when_changing_anchors", false));
@@ -1363,13 +1339,127 @@ void Control::_set_anchor(Margin p_margin, AnchorType p_anchor) {
#endif
}
-void Control::set_anchor_and_margin(Margin p_margin, AnchorType p_anchor, float p_pos) {
+void Control::set_anchor_and_margin(Margin p_margin, float p_anchor, float p_pos, bool p_push_opposite_anchor) {
- set_anchor(p_margin, p_anchor);
+ set_anchor(p_margin, p_anchor, false, p_push_opposite_anchor);
set_margin(p_margin, p_pos);
}
-Control::AnchorType Control::get_anchor(Margin p_margin) const {
+void Control::set_anchors_preset(LayoutPreset p_preset, bool p_keep_margin) {
+ //Left
+ switch (p_preset) {
+ case PRESET_TOP_LEFT:
+ case PRESET_BOTTOM_LEFT:
+ case PRESET_CENTER_LEFT:
+ case PRESET_TOP_WIDE:
+ case PRESET_BOTTOM_WIDE:
+ case PRESET_LEFT_WIDE:
+ case PRESET_HCENTER_WIDE:
+ case PRESET_WIDE:
+ set_anchor(MARGIN_LEFT, ANCHOR_BEGIN, p_keep_margin);
+ break;
+
+ case PRESET_CENTER_TOP:
+ case PRESET_CENTER_BOTTOM:
+ case PRESET_CENTER:
+ case PRESET_VCENTER_WIDE:
+ set_anchor(MARGIN_LEFT, 0.5, p_keep_margin);
+ break;
+
+ case PRESET_TOP_RIGHT:
+ case PRESET_BOTTOM_RIGHT:
+ case PRESET_CENTER_RIGHT:
+ case PRESET_RIGHT_WIDE:
+ set_anchor(MARGIN_LEFT, ANCHOR_END, p_keep_margin);
+ break;
+ }
+
+ // Top
+ switch (p_preset) {
+ case PRESET_TOP_LEFT:
+ case PRESET_TOP_RIGHT:
+ case PRESET_CENTER_TOP:
+ case PRESET_LEFT_WIDE:
+ case PRESET_RIGHT_WIDE:
+ case PRESET_TOP_WIDE:
+ case PRESET_VCENTER_WIDE:
+ case PRESET_WIDE:
+ set_anchor(MARGIN_TOP, ANCHOR_BEGIN, p_keep_margin);
+ break;
+
+ case PRESET_CENTER_LEFT:
+ case PRESET_CENTER_RIGHT:
+ case PRESET_CENTER:
+ case PRESET_HCENTER_WIDE:
+ set_anchor(MARGIN_TOP, 0.5, p_keep_margin);
+ break;
+
+ case PRESET_BOTTOM_LEFT:
+ case PRESET_BOTTOM_RIGHT:
+ case PRESET_CENTER_BOTTOM:
+ case PRESET_BOTTOM_WIDE:
+ set_anchor(MARGIN_TOP, ANCHOR_END, p_keep_margin);
+ break;
+ }
+
+ // Right
+ switch (p_preset) {
+ case PRESET_TOP_LEFT:
+ case PRESET_BOTTOM_LEFT:
+ case PRESET_CENTER_LEFT:
+ case PRESET_LEFT_WIDE:
+ set_anchor(MARGIN_RIGHT, ANCHOR_BEGIN, p_keep_margin);
+ break;
+
+ case PRESET_CENTER_TOP:
+ case PRESET_CENTER_BOTTOM:
+ case PRESET_CENTER:
+ case PRESET_VCENTER_WIDE:
+ set_anchor(MARGIN_RIGHT, 0.5, p_keep_margin);
+ break;
+
+ case PRESET_TOP_RIGHT:
+ case PRESET_BOTTOM_RIGHT:
+ case PRESET_CENTER_RIGHT:
+ case PRESET_TOP_WIDE:
+ case PRESET_RIGHT_WIDE:
+ case PRESET_BOTTOM_WIDE:
+ case PRESET_HCENTER_WIDE:
+ case PRESET_WIDE:
+ set_anchor(MARGIN_RIGHT, ANCHOR_END, p_keep_margin);
+ break;
+ }
+
+ // Bottom
+ switch (p_preset) {
+ case PRESET_TOP_LEFT:
+ case PRESET_TOP_RIGHT:
+ case PRESET_CENTER_TOP:
+ case PRESET_TOP_WIDE:
+ set_anchor(MARGIN_BOTTOM, ANCHOR_BEGIN, p_keep_margin);
+ break;
+
+ case PRESET_CENTER_LEFT:
+ case PRESET_CENTER_RIGHT:
+ case PRESET_CENTER:
+ case PRESET_HCENTER_WIDE:
+ set_anchor(MARGIN_BOTTOM, 0.5, p_keep_margin);
+ break;
+
+ case PRESET_BOTTOM_LEFT:
+ case PRESET_BOTTOM_RIGHT:
+ case PRESET_CENTER_BOTTOM:
+ case PRESET_LEFT_WIDE:
+ case PRESET_RIGHT_WIDE:
+ case PRESET_BOTTOM_WIDE:
+ case PRESET_VCENTER_WIDE:
+ case PRESET_WIDE:
+ set_anchor(MARGIN_BOTTOM, ANCHOR_END, p_keep_margin);
+ break;
+ }
+}
+
+float Control::get_anchor(Margin p_margin) const {
return data.anchor[p_margin];
}
@@ -1523,11 +1613,13 @@ Rect2 Control::get_item_rect() const {
void Control::set_area_as_parent_rect(int p_margin) {
data.anchor[MARGIN_LEFT] = ANCHOR_BEGIN;
+ data.margin[MARGIN_LEFT] = p_margin;
data.anchor[MARGIN_TOP] = ANCHOR_BEGIN;
+ data.margin[MARGIN_TOP] = p_margin;
data.anchor[MARGIN_RIGHT] = ANCHOR_END;
+ data.margin[MARGIN_RIGHT] = -p_margin;
data.anchor[MARGIN_BOTTOM] = ANCHOR_END;
- for (int i = 0; i < 4; i++)
- data.margin[i] = p_margin;
+ data.margin[MARGIN_BOTTOM] = -p_margin;
_size_changed();
}
@@ -2371,11 +2463,12 @@ void Control::_bind_methods() {
ClassDB::bind_method(D_METHOD("accept_event"), &Control::accept_event);
ClassDB::bind_method(D_METHOD("get_minimum_size"), &Control::get_minimum_size);
ClassDB::bind_method(D_METHOD("get_combined_minimum_size"), &Control::get_combined_minimum_size);
- ClassDB::bind_method(D_METHOD("set_anchor", "margin", "anchor_mode", "keep_margin"), &Control::set_anchor, DEFVAL(false));
- ClassDB::bind_method(D_METHOD("_set_anchor", "margin", "anchor_mode"), &Control::_set_anchor);
+ ClassDB::bind_method(D_METHOD("set_anchor", "margin", "anchor", "keep_margin", "push_opposite_anchor"), &Control::set_anchor, DEFVAL(false), DEFVAL(true));
+ ClassDB::bind_method(D_METHOD("_set_anchor", "margin", "anchor"), &Control::_set_anchor);
+ ClassDB::bind_method(D_METHOD("set_anchors_preset", "preset", "keep_margin"), &Control::set_anchors_preset, DEFVAL(false));
ClassDB::bind_method(D_METHOD("get_anchor", "margin"), &Control::get_anchor);
ClassDB::bind_method(D_METHOD("set_margin", "margin", "offset"), &Control::set_margin);
- ClassDB::bind_method(D_METHOD("set_anchor_and_margin", "margin", "anchor_mode", "offset"), &Control::set_anchor_and_margin);
+ ClassDB::bind_method(D_METHOD("set_anchor_and_margin", "margin", "anchor", "offset", "push_opposite_anchor"), &Control::set_anchor_and_margin, DEFVAL(false));
ClassDB::bind_method(D_METHOD("set_begin", "pos"), &Control::set_begin);
ClassDB::bind_method(D_METHOD("set_end", "pos"), &Control::set_end);
ClassDB::bind_method(D_METHOD("set_position", "pos"), &Control::set_position);
@@ -2497,10 +2590,10 @@ void Control::_bind_methods() {
BIND_VMETHOD(MethodInfo("drop_data", PropertyInfo(Variant::VECTOR2, "pos"), PropertyInfo(Variant::NIL, "data")));
ADD_GROUP("Anchor", "anchor_");
- ADD_PROPERTYINZ(PropertyInfo(Variant::INT, "anchor_left", PROPERTY_HINT_ENUM, "Begin,End,Center"), "_set_anchor", "get_anchor", MARGIN_LEFT);
- ADD_PROPERTYINZ(PropertyInfo(Variant::INT, "anchor_top", PROPERTY_HINT_ENUM, "Begin,End,Center"), "_set_anchor", "get_anchor", MARGIN_TOP);
- ADD_PROPERTYINZ(PropertyInfo(Variant::INT, "anchor_right", PROPERTY_HINT_ENUM, "Begin,End,Center"), "_set_anchor", "get_anchor", MARGIN_RIGHT);
- ADD_PROPERTYINZ(PropertyInfo(Variant::INT, "anchor_bottom", PROPERTY_HINT_ENUM, "Begin,End,Center"), "_set_anchor", "get_anchor", MARGIN_BOTTOM);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anchor_left", PROPERTY_HINT_RANGE, "0,1,0.01"), "_set_anchor", "get_anchor", MARGIN_LEFT);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anchor_top", PROPERTY_HINT_RANGE, "0,1,0.01"), "_set_anchor", "get_anchor", MARGIN_TOP);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anchor_right", PROPERTY_HINT_RANGE, "0,1,0.01"), "_set_anchor", "get_anchor", MARGIN_RIGHT);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "anchor_bottom", PROPERTY_HINT_RANGE, "0,1,0.01"), "_set_anchor", "get_anchor", MARGIN_BOTTOM);
ADD_GROUP("Margin", "margin_");
ADD_PROPERTYINZ(PropertyInfo(Variant::INT, "margin_left", PROPERTY_HINT_RANGE, "-4096,4096"), "set_margin", "get_margin", MARGIN_LEFT);
@@ -2541,9 +2634,6 @@ void Control::_bind_methods() {
ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "theme", PROPERTY_HINT_RESOURCE_TYPE, "Theme"), "set_theme", "get_theme");
ADD_GROUP("", "");
- BIND_CONSTANT(ANCHOR_BEGIN);
- BIND_CONSTANT(ANCHOR_END);
- BIND_CONSTANT(ANCHOR_CENTER);
BIND_CONSTANT(FOCUS_NONE);
BIND_CONSTANT(FOCUS_CLICK);
BIND_CONSTANT(FOCUS_ALL);
@@ -2574,6 +2664,23 @@ void Control::_bind_methods() {
BIND_CONSTANT(CURSOR_HSPLIT);
BIND_CONSTANT(CURSOR_HELP);
+ BIND_CONSTANT(PRESET_TOP_LEFT);
+ BIND_CONSTANT(PRESET_TOP_RIGHT);
+ BIND_CONSTANT(PRESET_BOTTOM_LEFT);
+ BIND_CONSTANT(PRESET_BOTTOM_RIGHT);
+ BIND_CONSTANT(PRESET_CENTER_LEFT);
+ BIND_CONSTANT(PRESET_CENTER_TOP);
+ BIND_CONSTANT(PRESET_CENTER_RIGHT);
+ BIND_CONSTANT(PRESET_CENTER_BOTTOM);
+ BIND_CONSTANT(PRESET_CENTER);
+ BIND_CONSTANT(PRESET_LEFT_WIDE);
+ BIND_CONSTANT(PRESET_TOP_WIDE);
+ BIND_CONSTANT(PRESET_RIGHT_WIDE);
+ BIND_CONSTANT(PRESET_BOTTOM_WIDE);
+ BIND_CONSTANT(PRESET_VCENTER_WIDE);
+ BIND_CONSTANT(PRESET_HCENTER_WIDE);
+ BIND_CONSTANT(PRESET_WIDE);
+
BIND_CONSTANT(SIZE_EXPAND);
BIND_CONSTANT(SIZE_FILL);
BIND_CONSTANT(SIZE_EXPAND_FILL);
@@ -2587,6 +2694,9 @@ void Control::_bind_methods() {
BIND_CONSTANT(GROW_DIRECTION_BEGIN);
BIND_CONSTANT(GROW_DIRECTION_END);
+ BIND_CONSTANT(ANCHOR_BEGIN);
+ BIND_CONSTANT(ANCHOR_END);
+
ADD_SIGNAL(MethodInfo("resized"));
ADD_SIGNAL(MethodInfo("gui_input", PropertyInfo(Variant::OBJECT, "ev", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
ADD_SIGNAL(MethodInfo("mouse_entered"));
diff --git a/scene/gui/control.h b/scene/gui/control.h
index 86cf8f6dbd..d73ca3f7c9 100644
--- a/scene/gui/control.h
+++ b/scene/gui/control.h
@@ -51,10 +51,10 @@ class Control : public CanvasItem {
OBJ_CATEGORY("GUI Nodes");
public:
- enum AnchorType {
- ANCHOR_BEGIN,
- ANCHOR_END,
- ANCHOR_CENTER,
+ enum Anchor {
+
+ ANCHOR_BEGIN = 0,
+ ANCHOR_END = 1
};
enum GrowDirection {
@@ -105,6 +105,25 @@ public:
CURSOR_MAX
};
+ enum LayoutPreset {
+ PRESET_TOP_LEFT,
+ PRESET_TOP_RIGHT,
+ PRESET_BOTTOM_LEFT,
+ PRESET_BOTTOM_RIGHT,
+ PRESET_CENTER_LEFT,
+ PRESET_CENTER_TOP,
+ PRESET_CENTER_RIGHT,
+ PRESET_CENTER_BOTTOM,
+ PRESET_CENTER,
+ PRESET_LEFT_WIDE,
+ PRESET_TOP_WIDE,
+ PRESET_RIGHT_WIDE,
+ PRESET_BOTTOM_WIDE,
+ PRESET_VCENTER_WIDE,
+ PRESET_HCENTER_WIDE,
+ PRESET_WIDE
+ };
+
private:
struct CComparator {
@@ -122,7 +141,7 @@ private:
Size2 size_cache;
float margin[4];
- AnchorType anchor[4];
+ float anchor[4];
FocusMode focus_mode;
GrowDirection h_grow;
GrowDirection v_grow;
@@ -182,12 +201,12 @@ private:
void _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);
Control *_get_focus_neighbour(Margin p_margin, int p_count = 0);
- void _set_anchor(Margin p_margin, AnchorType p_anchor);
+ void _set_anchor(Margin p_margin, float p_anchor);
float _get_parent_range(int p_idx) const;
float _get_range(int p_idx) const;
- float _s2a(float p_val, AnchorType p_anchor, float p_range) const;
- float _a2s(float p_val, AnchorType p_anchor, float p_range) const;
+ float _s2a(float p_val, float p_anchor, float p_range) const;
+ float _a2s(float p_val, float p_anchor, float p_range) const;
void _propagate_theme_changed(CanvasItem *p_at, Control *p_owner, bool p_assign = true);
void _theme_changed();
@@ -275,10 +294,11 @@ public:
/* POSITIONING */
- void set_anchor(Margin p_margin, AnchorType p_anchor, bool p_keep_margin = false);
- void set_anchor_and_margin(Margin p_margin, AnchorType p_anchor, float p_pos);
+ void set_anchor(Margin p_margin, float p_anchor, bool p_keep_margin = false, bool p_push_opposite_anchor = true);
+ void set_anchor_and_margin(Margin p_margin, float p_anchor, float p_pos, bool p_push_opposite_anchor = true);
+ void set_anchors_preset(LayoutPreset p_preset, bool p_keep_margin = false);
- AnchorType get_anchor(Margin p_margin) const;
+ float get_anchor(Margin p_margin) const;
void set_margin(Margin p_margin, float p_value);
@@ -425,11 +445,12 @@ public:
~Control();
};
-VARIANT_ENUM_CAST(Control::AnchorType);
VARIANT_ENUM_CAST(Control::FocusMode);
VARIANT_ENUM_CAST(Control::SizeFlags);
VARIANT_ENUM_CAST(Control::CursorShape);
+VARIANT_ENUM_CAST(Control::LayoutPreset);
VARIANT_ENUM_CAST(Control::MouseFilter);
VARIANT_ENUM_CAST(Control::GrowDirection);
+VARIANT_ENUM_CAST(Control::Anchor);
#endif
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index c1e0be97ee..8232a7a466 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -215,7 +215,7 @@ void WindowDialog::_notification(int p_what) {
close_button->set_pressed_texture(get_icon("close", "WindowDialog"));
close_button->set_hover_texture(get_icon("close_highlight", "WindowDialog"));
close_button->set_anchor(MARGIN_LEFT, ANCHOR_END);
- close_button->set_begin(Point2(get_constant("close_h_ofs", "WindowDialog"), -get_constant("close_v_ofs", "WindowDialog")));
+ close_button->set_begin(Point2(-get_constant("close_h_ofs", "WindowDialog"), -get_constant("close_v_ofs", "WindowDialog")));
} break;
case NOTIFICATION_MOUSE_EXIT: {
@@ -546,7 +546,7 @@ AcceptDialog::AcceptDialog() {
label->set_anchor(MARGIN_RIGHT, ANCHOR_END);
label->set_anchor(MARGIN_BOTTOM, ANCHOR_END);
label->set_begin(Point2(margin, margin));
- label->set_end(Point2(margin, button_margin + 10));
+ label->set_end(Point2(-margin, -button_margin - 10));
//label->set_autowrap(true);
add_child(label);
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index e85ef73f4e..ec1932ed5a 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -269,14 +269,14 @@ void GraphEdit::_notification(int p_what) {
Size2 hmin = h_scroll->get_combined_minimum_size();
Size2 vmin = v_scroll->get_combined_minimum_size();
- v_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, vmin.width);
+ v_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -vmin.width);
v_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0);
v_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 0);
v_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0);
h_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 0);
h_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0);
- h_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, hmin.height);
+ h_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, -hmin.height);
h_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0);
zoom_minus->set_icon(get_icon("minus"));
diff --git a/scene/gui/input_action.h b/scene/gui/input_action.h
index 6d13d8bd40..5c91d2be28 100644
--- a/scene/gui/input_action.h
+++ b/scene/gui/input_action.h
@@ -45,7 +45,7 @@ protected:
public:
void set_shortcut(const Ref<InputEvent> &p_shortcut);
Ref<InputEvent> get_shortcut() const;
- bool is_shortcut(const Ref<InputEvent> &p_Event) const;
+ bool is_shortcut(const Ref<InputEvent> &p_event) const;
bool is_valid() const;
String get_as_text() const;
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index 484051f546..d90f0c7898 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -736,10 +736,10 @@ void ItemList::_notification(int p_what) {
Ref<StyleBox> bg = get_stylebox("bg");
int mw = scroll_bar->get_minimum_size().x;
- scroll_bar->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, mw + bg->get_margin(MARGIN_RIGHT));
- scroll_bar->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, bg->get_margin(MARGIN_RIGHT));
+ scroll_bar->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -mw + bg->get_margin(MARGIN_RIGHT));
+ scroll_bar->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -bg->get_margin(MARGIN_RIGHT));
scroll_bar->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, bg->get_margin(MARGIN_TOP));
- scroll_bar->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, bg->get_margin(MARGIN_BOTTOM));
+ scroll_bar->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -bg->get_margin(MARGIN_BOTTOM));
Size2 size = get_size();
diff --git a/scene/gui/item_list.h b/scene/gui/item_list.h
index 137eff8885..5bf343daa5 100644
--- a/scene/gui/item_list.h
+++ b/scene/gui/item_list.h
@@ -171,7 +171,7 @@ public:
void set_same_column_width(bool p_enable);
int is_same_column_width() const;
- void set_max_text_lines(int p_amount);
+ void set_max_text_lines(int p_lines);
int get_max_text_lines() const;
void set_max_columns(int p_amount);
diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h
index 73c5a46937..fb0eaa9446 100644
--- a/scene/gui/line_edit.h
+++ b/scene/gui/line_edit.h
@@ -177,7 +177,7 @@ public:
virtual Size2 get_minimum_size() const;
- void set_expand_to_text_length(bool p_len);
+ void set_expand_to_text_length(bool p_enabled);
bool get_expand_to_text_length() const;
virtual bool is_text_field() const;
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index 25ac8d5259..00df266a09 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -185,21 +185,21 @@ void OptionButton::clear() {
current = -1;
}
-void OptionButton::_select(int p_idx, bool p_emit) {
+void OptionButton::_select(int p_which, bool p_emit) {
- if (p_idx < 0)
+ if (p_which < 0)
return;
- if (p_idx == current)
+ if (p_which == current)
return;
- ERR_FAIL_INDEX(p_idx, popup->get_item_count());
+ ERR_FAIL_INDEX(p_which, popup->get_item_count());
for (int i = 0; i < popup->get_item_count(); i++) {
- popup->set_item_checked(i, i == p_idx);
+ popup->set_item_checked(i, i == p_which);
}
- current = p_idx;
+ current = p_which;
set_text(popup->get_item_text(current));
set_icon(popup->get_item_icon(current));
diff --git a/scene/gui/patch_9_rect.h b/scene/gui/patch_9_rect.h
index 602a6d22bf..636b9127e7 100644
--- a/scene/gui/patch_9_rect.h
+++ b/scene/gui/patch_9_rect.h
@@ -67,7 +67,7 @@ public:
void set_region_rect(const Rect2 &p_region_rect);
Rect2 get_region_rect() const;
- void set_draw_center(bool p_enable);
+ void set_draw_center(bool p_draw);
bool get_draw_center() const;
void set_h_axis_stretch_mode(AxisStretchMode p_mode);
diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp
index 8979e0f111..f2ba6bfbc4 100644
--- a/scene/gui/popup.cpp
+++ b/scene/gui/popup.cpp
@@ -108,13 +108,10 @@ void Popup::set_as_minsize() {
float margin_begin = c->get_margin(m_beg);
float margin_end = c->get_margin(m_end);
- AnchorType anchor_begin = c->get_anchor(m_beg);
- AnchorType anchor_end = c->get_anchor(m_end);
+ float anchor_begin = c->get_anchor(m_beg);
+ float anchor_end = c->get_anchor(m_end);
- if (anchor_begin == ANCHOR_BEGIN)
- minsize[j] += margin_begin;
- if (anchor_end == ANCHOR_END)
- minsize[j] += margin_end;
+ minsize[j] += margin_begin * (ANCHOR_END - anchor_begin) + margin_end * anchor_end;
}
total_minsize.width = MAX(total_minsize.width, minsize.width);
@@ -145,13 +142,10 @@ void Popup::popup_centered_minsize(const Size2 &p_minsize) {
float margin_begin = c->get_margin(m_beg);
float margin_end = c->get_margin(m_end);
- AnchorType anchor_begin = c->get_anchor(m_beg);
- AnchorType anchor_end = c->get_anchor(m_end);
+ float anchor_begin = c->get_anchor(m_beg);
+ float anchor_end = c->get_anchor(m_end);
- if (anchor_begin == ANCHOR_BEGIN)
- minsize[j] += margin_begin;
- if (anchor_end == ANCHOR_END)
- minsize[j] += margin_end;
+ minsize[j] += margin_begin * (ANCHOR_END - anchor_begin) + margin_end * anchor_end;
}
total_minsize.width = MAX(total_minsize.width, minsize.width);
@@ -209,15 +203,15 @@ void Popup::popup_centered_ratio(float p_screen_ratio) {
popped_up = true;
}
-void Popup::popup(const Rect2 &bounds) {
+void Popup::popup(const Rect2 &p_bounds) {
emit_signal("about_to_show");
show_modal(exclusive);
// Fit the popup into the optionally provided bounds.
- if (!bounds.has_no_area()) {
- set_position(bounds.position);
- set_size(bounds.size);
+ if (!p_bounds.has_no_area()) {
+ set_position(p_bounds.position);
+ set_size(p_bounds.size);
}
_fix_size();
diff --git a/scene/gui/popup_menu.h b/scene/gui/popup_menu.h
index cbfe7873e6..37714ee989 100644
--- a/scene/gui/popup_menu.h
+++ b/scene/gui/popup_menu.h
@@ -140,7 +140,7 @@ public:
uint32_t get_item_accelerator(int p_idx) const;
Variant get_item_metadata(int p_idx) const;
bool is_item_disabled(int p_idx) const;
- String get_item_submenu(int p_ID) const;
+ String get_item_submenu(int p_idx) const;
bool is_item_separator(int p_idx) const;
bool is_item_checkable(int p_idx) const;
String get_item_tooltip(int p_idx) const;
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 0e4004c27b..42084ade25 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -594,7 +594,7 @@ void RichTextLabel::_update_scroll() {
main->first_invalid_line = 0;
scroll_w = vscroll->get_combined_minimum_size().width;
vscroll->show();
- vscroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, scroll_w);
+ vscroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -scroll_w);
_validate_line_caches(main);
} else {
diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h
index 409a8f6b3f..71fa766958 100644
--- a/scene/gui/rich_text_label.h
+++ b/scene/gui/rich_text_label.h
@@ -296,7 +296,7 @@ public:
void push_align(Align p_align);
void push_indent(int p_level);
void push_list(ListType p_list);
- void push_meta(const Variant &p_data);
+ void push_meta(const Variant &p_meta);
void push_table(int p_columns);
void set_table_column_expand(int p_column, bool p_expand, int p_ratio = 1);
int get_current_table_column() const;
diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp
index bd66cd2745..2ccdbb05a9 100644
--- a/scene/gui/scroll_bar.cpp
+++ b/scene/gui/scroll_bar.cpp
@@ -233,7 +233,14 @@ void ScrollBar::_notification(int p_what) {
Ref<Texture> decr = highlight == HIGHLIGHT_DECR ? get_icon("decrement_highlight") : get_icon("decrement");
Ref<Texture> incr = highlight == HIGHLIGHT_INCR ? get_icon("increment_highlight") : get_icon("increment");
Ref<StyleBox> bg = has_focus() ? get_stylebox("scroll_focus") : get_stylebox("scroll");
- Ref<StyleBox> grabber = (drag.active || highlight == HIGHLIGHT_RANGE) ? get_stylebox("grabber_highlight") : get_stylebox("grabber");
+
+ Ref<StyleBox> grabber;
+ if (drag.active)
+ grabber = get_stylebox("grabber_pressed");
+ else if (highlight == HIGHLIGHT_RANGE)
+ grabber = get_stylebox("grabber_highlight");
+ else
+ grabber = get_stylebox("grabber");
Point2 ofs;
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp
index cc1a637d2b..939bdd8d0c 100644
--- a/scene/gui/scroll_container.cpp
+++ b/scene/gui/scroll_container.cpp
@@ -187,14 +187,14 @@ void ScrollContainer::_update_scrollbar_pos() {
Size2 hmin = h_scroll->get_combined_minimum_size();
Size2 vmin = v_scroll->get_combined_minimum_size();
- v_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, vmin.width);
+ v_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_END, -vmin.width);
v_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0);
v_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 0);
v_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0);
h_scroll->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 0);
h_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0);
- h_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, hmin.height);
+ h_scroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_END, -hmin.height);
h_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0);
h_scroll->raise();
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index 4b8b180b0e..1352569f33 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -371,8 +371,10 @@ void TabContainer::add_child_notify(Node *p_child) {
if (tabs_visible)
c->set_margin(MARGIN_TOP, _get_top_margin());
Ref<StyleBox> sb = get_stylebox("panel");
- for (int i = 0; i < 4; i++)
- c->set_margin(Margin(i), c->get_margin(Margin(i)) + sb->get_margin(Margin(i)));
+ c->set_margin(Margin(MARGIN_TOP), c->get_margin(Margin(MARGIN_TOP)) + sb->get_margin(Margin(MARGIN_TOP)));
+ c->set_margin(Margin(MARGIN_LEFT), c->get_margin(Margin(MARGIN_LEFT)) + sb->get_margin(Margin(MARGIN_LEFT)));
+ c->set_margin(Margin(MARGIN_RIGHT), c->get_margin(Margin(MARGIN_RIGHT)) - sb->get_margin(Margin(MARGIN_RIGHT)));
+ c->set_margin(Margin(MARGIN_BOTTOM), c->get_margin(Margin(MARGIN_BOTTOM)) - sb->get_margin(Margin(MARGIN_BOTTOM)));
update();
p_child->connect("renamed", this, "_child_renamed_callback");
@@ -402,8 +404,10 @@ void TabContainer::set_current_tab(int p_current) {
c->set_area_as_parent_rect();
if (tabs_visible)
c->set_margin(MARGIN_TOP, _get_top_margin());
- for (int i = 0; i < 4; i++)
- c->set_margin(Margin(i), c->get_margin(Margin(i)) + sb->get_margin(Margin(i)));
+ c->set_margin(Margin(MARGIN_TOP), c->get_margin(Margin(MARGIN_TOP)) + sb->get_margin(Margin(MARGIN_TOP)));
+ c->set_margin(Margin(MARGIN_LEFT), c->get_margin(Margin(MARGIN_LEFT)) + sb->get_margin(Margin(MARGIN_LEFT)));
+ c->set_margin(Margin(MARGIN_RIGHT), c->get_margin(Margin(MARGIN_RIGHT)) - sb->get_margin(Margin(MARGIN_RIGHT)));
+ c->set_margin(Margin(MARGIN_BOTTOM), c->get_margin(Margin(MARGIN_BOTTOM)) - sb->get_margin(Margin(MARGIN_BOTTOM)));
} else
c->hide();
@@ -544,11 +548,11 @@ Ref<Texture> TabContainer::get_tab_icon(int p_tab) const {
return Ref<Texture>();
}
-void TabContainer::set_tab_disabled(int p_tab, bool p_enabled) {
+void TabContainer::set_tab_disabled(int p_tab, bool p_disabled) {
Control *child = _get_tab(p_tab);
ERR_FAIL_COND(!child);
- child->set_meta("_tab_disabled", p_enabled);
+ child->set_meta("_tab_disabled", p_disabled);
update();
}
diff --git a/scene/gui/tab_container.h b/scene/gui/tab_container.h
index 1105c6b298..3e1a2c1598 100644
--- a/scene/gui/tab_container.h
+++ b/scene/gui/tab_container.h
@@ -54,7 +54,7 @@ private:
bool tabs_visible;
bool buttons_visible_cache;
TabAlign align;
- Control *_get_tab(int idx) const;
+ Control *_get_tab(int p_idx) const;
int _get_top_margin() const;
Popup *popup;
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 7b0d14c1a9..2b47539c42 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -2933,7 +2933,7 @@ void TextEdit::_base_remove_text(int p_from_line, int p_from_column, int p_to_li
}
}
-void TextEdit::_insert_text(int p_line, int p_char, const String &p_text, int *r_end_line, int *r_end_column) {
+void TextEdit::_insert_text(int p_line, int p_char, const String &p_text, int *r_end_line, int *r_end_char) {
if (!setting_text)
idle_detect->start();
@@ -2946,8 +2946,8 @@ void TextEdit::_insert_text(int p_line, int p_char, const String &p_text, int *r
_base_insert_text(p_line, p_char, p_text, retline, retchar);
if (r_end_line)
*r_end_line = retline;
- if (r_end_column)
- *r_end_column = retchar;
+ if (r_end_char)
+ *r_end_char = retchar;
if (!undo_enabled)
return;
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index afb4b1c547..4c17347a5d 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -152,7 +152,7 @@ class TextEdit : public Control {
int get_line_width(int p_line) const;
int get_max_width() const;
const Map<int, ColorRegionInfo> &get_color_region_info(int p_line);
- void set(int p_line, const String &p_string);
+ void set(int p_line, const String &p_text);
void set_marked(int p_line, bool p_marked) { text[p_line].marked = p_marked; }
bool is_marked(int p_line) const { return text[p_line].marked; }
void set_breakpoint(int p_line, bool p_breakpoint) { text[p_line].breakpoint = p_breakpoint; }
@@ -288,8 +288,8 @@ class TextEdit : public Control {
int get_char_count();
- int get_char_pos_for(int p_px, String p_pos) const;
- int get_column_x_offset(int p_column, String p_pos);
+ int get_char_pos_for(int p_px, String p_str) const;
+ int get_column_x_offset(int p_char, String p_str);
void adjust_viewport_to_cursor();
void _scroll_moved(double);
@@ -320,7 +320,7 @@ class TextEdit : public Control {
/* super internal api, undo/redo builds on it */
- void _base_insert_text(int p_line, int p_column, const String &p_text, int &r_end_line, int &r_end_column);
+ void _base_insert_text(int p_line, int p_char, const String &p_text, int &r_end_line, int &r_end_column);
String _base_get_text(int p_from_line, int p_from_column, int p_to_line, int p_to_column) const;
void _base_remove_text(int p_from_line, int p_from_column, int p_to_line, int p_to_column);
@@ -339,10 +339,10 @@ class TextEdit : public Control {
protected:
virtual String get_tooltip(const Point2 &p_pos) const;
- void _insert_text(int p_line, int p_column, const String &p_text, int *r_end_line = NULL, int *r_end_char = NULL);
+ void _insert_text(int p_line, int p_char, const String &p_text, int *r_end_line = NULL, int *r_end_char = NULL);
void _remove_text(int p_from_line, int p_from_column, int p_to_line, int p_to_column);
void _insert_text_at_cursor(const String &p_text);
- void _gui_input(const Ref<InputEvent> &p_input);
+ void _gui_input(const Ref<InputEvent> &p_gui_input);
void _notification(int p_what);
void _consume_pair_symbol(CharType ch);
diff --git a/scene/gui/texture_button.cpp b/scene/gui/texture_button.cpp
index 00849c4e5a..7abf8380ce 100644
--- a/scene/gui/texture_button.cpp
+++ b/scene/gui/texture_button.cpp
@@ -286,8 +286,8 @@ void TextureButton::set_expand(bool p_expand) {
update();
}
-void TextureButton::set_stretch_mode(StretchMode p_mode) {
- stretch_mode = p_mode;
+void TextureButton::set_stretch_mode(StretchMode p_stretch_mode) {
+ stretch_mode = p_stretch_mode;
update();
}
diff --git a/scene/gui/texture_button.h b/scene/gui/texture_button.h
index 9c31912a32..8df30cd35a 100644
--- a/scene/gui/texture_button.h
+++ b/scene/gui/texture_button.h
@@ -69,7 +69,7 @@ public:
void set_hover_texture(const Ref<Texture> &p_hover);
void set_disabled_texture(const Ref<Texture> &p_disabled);
void set_focused_texture(const Ref<Texture> &p_focused);
- void set_click_mask(const Ref<BitMap> &p_image);
+ void set_click_mask(const Ref<BitMap> &p_click_mask);
Ref<Texture> get_normal_texture() const;
Ref<Texture> get_pressed_texture() const;
@@ -81,7 +81,7 @@ public:
bool get_expand() const;
void set_expand(bool p_expand);
- void set_stretch_mode(StretchMode stretch_mode);
+ void set_stretch_mode(StretchMode p_stretch_mode);
StretchMode get_stretch_mode() const;
TextureButton();
diff --git a/scene/gui/tree.h b/scene/gui/tree.h
index d3715c3c43..81880122a9 100644
--- a/scene/gui/tree.h
+++ b/scene/gui/tree.h
@@ -471,7 +471,7 @@ private:
TreeItem *_search_item_text(TreeItem *p_at, const String &p_find, int *r_col, bool p_selectable, bool p_backwards = false);
- TreeItem *_find_item_at_pos(TreeItem *p_current, const Point2 &p_pos, int &r_column, int &h, int &section) const;
+ TreeItem *_find_item_at_pos(TreeItem *p_item, const Point2 &p_pos, int &r_column, int &h, int &section) const;
/* float drag_speed;
float drag_accum;
@@ -524,7 +524,7 @@ public:
void set_column_expand(int p_column, bool p_expand);
int get_column_width(int p_column) const;
- void set_hide_root(bool p_eanbled);
+ void set_hide_root(bool p_enabled);
TreeItem *get_next_selected(TreeItem *p_item);
TreeItem *get_selected() const;
int get_selected_column() const;
diff --git a/scene/gui/video_player.h b/scene/gui/video_player.h
index 1d70718a6a..87c452509b 100644
--- a/scene/gui/video_player.h
+++ b/scene/gui/video_player.h
@@ -105,7 +105,7 @@ public:
String get_stream_name() const;
float get_stream_pos() const;
- void set_autoplay(bool p_vol);
+ void set_autoplay(bool p_enable);
bool has_autoplay() const;
void set_audio_track(int p_track);