summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/color_rect.cpp14
-rw-r--r--scene/gui/color_rect.h8
-rw-r--r--scene/gui/graph_edit.cpp16
-rw-r--r--scene/gui/graph_edit.h1
-rw-r--r--scene/gui/graph_node.cpp2
-rw-r--r--scene/gui/nine_patch_rect.h1
-rw-r--r--scene/gui/text_edit.cpp2
-rw-r--r--scene/gui/texture_rect.h7
8 files changed, 26 insertions, 25 deletions
diff --git a/scene/gui/color_rect.cpp b/scene/gui/color_rect.cpp
index 627e589c02..0c38b93c60 100644
--- a/scene/gui/color_rect.cpp
+++ b/scene/gui/color_rect.cpp
@@ -30,12 +30,12 @@
#include "color_rect.h"
-void ColorRect::set_frame_color(const Color &p_color) {
+void ColorRect::set_color(const Color &p_color) {
color = p_color;
update();
}
-Color ColorRect::get_frame_color() const {
+Color ColorRect::get_color() const {
return color;
}
@@ -46,12 +46,8 @@ void ColorRect::_notification(int p_what) {
}
void ColorRect::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_frame_color", "color"), &ColorRect::set_frame_color);
- ClassDB::bind_method(D_METHOD("get_frame_color"), &ColorRect::get_frame_color);
+ ClassDB::bind_method(D_METHOD("set_color", "color"), &ColorRect::set_color);
+ ClassDB::bind_method(D_METHOD("get_color"), &ColorRect::get_color);
- ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_frame_color", "get_frame_color");
-}
-
-ColorRect::ColorRect() {
- color = Color(1, 1, 1);
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color");
}
diff --git a/scene/gui/color_rect.h b/scene/gui/color_rect.h
index 3df44b9334..61d57f7cca 100644
--- a/scene/gui/color_rect.h
+++ b/scene/gui/color_rect.h
@@ -36,17 +36,15 @@
class ColorRect : public Control {
GDCLASS(ColorRect, Control);
- Color color;
+ Color color = Color(1, 1, 1);
protected:
void _notification(int p_what);
static void _bind_methods();
public:
- void set_frame_color(const Color &p_color);
- Color get_frame_color() const;
-
- ColorRect();
+ void set_color(const Color &p_color);
+ Color get_color() const;
};
#endif // COLOR_RECT_H
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index a7c15e7027..ad02aaade5 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -775,6 +775,11 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
}
if (mm.is_valid() && dragging) {
+ if (!moving_selection) {
+ emit_signal("begin_node_move");
+ moving_selection = true;
+ }
+
just_selected = true;
drag_accum += mm->get_relative();
for (int i = get_child_count() - 1; i >= 0; i--) {
@@ -881,16 +886,17 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
}
if (drag_accum != Vector2()) {
- emit_signal("_begin_node_move");
-
for (int i = get_child_count() - 1; i >= 0; i--) {
GraphNode *gn = Object::cast_to<GraphNode>(get_child(i));
if (gn && gn->is_selected()) {
gn->set_drag(false);
}
}
+ }
- emit_signal("_end_node_move");
+ if (moving_selection) {
+ emit_signal("end_node_move");
+ moving_selection = false;
}
dragging = false;
@@ -1281,8 +1287,8 @@ void GraphEdit::_bind_methods() {
ADD_SIGNAL(MethodInfo("connection_to_empty", PropertyInfo(Variant::STRING_NAME, "from"), PropertyInfo(Variant::INT, "from_slot"), PropertyInfo(Variant::VECTOR2, "release_position")));
ADD_SIGNAL(MethodInfo("connection_from_empty", PropertyInfo(Variant::STRING_NAME, "to"), PropertyInfo(Variant::INT, "to_slot"), PropertyInfo(Variant::VECTOR2, "release_position")));
ADD_SIGNAL(MethodInfo("delete_nodes_request"));
- ADD_SIGNAL(MethodInfo("_begin_node_move"));
- ADD_SIGNAL(MethodInfo("_end_node_move"));
+ ADD_SIGNAL(MethodInfo("begin_node_move"));
+ ADD_SIGNAL(MethodInfo("end_node_move"));
ADD_SIGNAL(MethodInfo("scroll_offset_changed", PropertyInfo(Variant::VECTOR2, "ofs")));
}
diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h
index 37cb5989e9..d87bd41f27 100644
--- a/scene/gui/graph_edit.h
+++ b/scene/gui/graph_edit.h
@@ -98,6 +98,7 @@ private:
bool dragging;
bool just_selected;
+ bool moving_selection;
Vector2 drag_accum;
float zoom;
diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp
index 38bf31830f..4454e87017 100644
--- a/scene/gui/graph_node.cpp
+++ b/scene/gui/graph_node.cpp
@@ -30,8 +30,6 @@
#include "graph_node.h"
-#include "core/method_bind_ext.gen.inc"
-
bool GraphNode::_set(const StringName &p_name, const Variant &p_value) {
if (!p_name.operator String().begins_with("slot/")) {
return false;
diff --git a/scene/gui/nine_patch_rect.h b/scene/gui/nine_patch_rect.h
index 487fe4c860..a539ad43c0 100644
--- a/scene/gui/nine_patch_rect.h
+++ b/scene/gui/nine_patch_rect.h
@@ -79,4 +79,5 @@ public:
};
VARIANT_ENUM_CAST(NinePatchRect::AxisStretchMode)
+
#endif // NINE_PATCH_RECT_H
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 957e1c11c7..dc21980473 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -6406,7 +6406,7 @@ void TextEdit::set_tooltip_request_func(Object *p_obj, const StringName &p_funct
}
void TextEdit::set_line(int line, String new_text) {
- if (line < 0 || line > text.size()) {
+ if (line < 0 || line >= text.size()) {
return;
}
_remove_text(line, 0, line, text[line].length());
diff --git a/scene/gui/texture_rect.h b/scene/gui/texture_rect.h
index efd3f0698a..e39545f679 100644
--- a/scene/gui/texture_rect.h
+++ b/scene/gui/texture_rect.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef TEXTURE_FRAME_H
-#define TEXTURE_FRAME_H
+#ifndef TEXTURE_RECT_H
+#define TEXTURE_RECT_H
#include "scene/gui/control.h"
@@ -83,4 +83,5 @@ public:
};
VARIANT_ENUM_CAST(TextureRect::StretchMode);
-#endif // TEXTURE_FRAME_H
+
+#endif // TEXTURE_RECT_H