summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/color_rect.cpp36
-rw-r--r--scene/gui/color_rect.h22
-rw-r--r--scene/gui/control.cpp2
-rw-r--r--scene/gui/panel.h2
-rw-r--r--scene/gui/text_edit.cpp3
5 files changed, 63 insertions, 2 deletions
diff --git a/scene/gui/color_rect.cpp b/scene/gui/color_rect.cpp
new file mode 100644
index 0000000000..a0e4df66b5
--- /dev/null
+++ b/scene/gui/color_rect.cpp
@@ -0,0 +1,36 @@
+#include "color_rect.h"
+
+
+
+
+void ColorFrame::set_frame_color(const Color& p_color) {
+
+ color=p_color;
+ update();
+}
+
+Color ColorFrame::get_frame_color() const{
+
+ return color;
+}
+
+void ColorFrame::_notification(int p_what) {
+
+ if (p_what==NOTIFICATION_DRAW) {
+ draw_rect(Rect2(Point2(),get_size()),color);
+ }
+}
+
+void ColorFrame::_bind_methods() {
+
+ ObjectTypeDB::bind_method(_MD("set_frame_color","color"),&ColorFrame::set_frame_color);
+ ObjectTypeDB::bind_method(_MD("get_frame_color"),&ColorFrame::get_frame_color);
+
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR,"color"),_SCS("set_frame_color"),_SCS("get_frame_color") );
+}
+
+ColorFrame::ColorFrame() {
+
+ color=Color(1,1,1);
+}
+
diff --git a/scene/gui/color_rect.h b/scene/gui/color_rect.h
new file mode 100644
index 0000000000..3816d44052
--- /dev/null
+++ b/scene/gui/color_rect.h
@@ -0,0 +1,22 @@
+#ifndef COLORRECT_H
+#define COLORRECT_H
+
+#include "scene/gui/control.h"
+
+class ColorFrame : public Control {
+ OBJ_TYPE(ColorFrame,Control)
+
+ Color color;
+protected:
+
+ void _notification(int p_what);
+ static void _bind_methods();
+public:
+
+ void set_frame_color(const Color& p_color);
+ Color get_frame_color() const;
+
+ ColorFrame();
+};
+
+#endif // COLORRECT_H
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index c120be65d0..269bd09b17 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -1924,7 +1924,7 @@ void Control::_propagate_theme_changed(CanvasItem *p_at,Control *p_owner,bool p_
if (p_assign) {
c->data.theme_owner=p_owner;
}
- c->_notification(NOTIFICATION_THEME_CHANGED);
+ c->notification(NOTIFICATION_THEME_CHANGED);
c->update();
}
}
diff --git a/scene/gui/panel.h b/scene/gui/panel.h
index efa9ebcaa0..9e2e7df7f0 100644
--- a/scene/gui/panel.h
+++ b/scene/gui/panel.h
@@ -45,4 +45,6 @@ public:
};
+
+
#endif
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 4756fdee26..87df8c076e 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -34,6 +34,7 @@
#include "globals.h"
#include "message_queue.h"
+#include "scene/main/viewport.h"
#define TAB_PIXELS
@@ -1651,7 +1652,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) {
const InputEventMouseMotion &mm=p_input_event.mouse_motion;
- if (mm.button_mask&BUTTON_MASK_LEFT) {
+ if (mm.button_mask&BUTTON_MASK_LEFT && get_viewport()->gui_get_drag_data()==Variant()) { //ignore if dragging
if (selection.selecting_mode!=Selection::MODE_NONE) {