diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-08-14 23:31:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-14 23:31:48 +0200 |
commit | d6058b967d295d20e3ce93de9263d48002971693 (patch) | |
tree | 9beec3cc1f5442b5e211b3926f84db9473abc2c7 /scene/gui | |
parent | 1e49b2d72096720e6afe8634e13427d271e8bf15 (diff) | |
parent | aaf62fcecc7b95825e1843c52c6bd81ee8e5dd40 (diff) |
Merge pull request #20906 from Chaosus/rrect_fix
Fix ReferenceRect border
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/reference_rect.cpp | 18 | ||||
-rw-r--r-- | scene/gui/reference_rect.h | 5 |
2 files changed, 22 insertions, 1 deletions
diff --git a/scene/gui/reference_rect.cpp b/scene/gui/reference_rect.cpp index 5e25f43daf..74e68598f4 100644 --- a/scene/gui/reference_rect.cpp +++ b/scene/gui/reference_rect.cpp @@ -39,9 +39,25 @@ void ReferenceRect::_notification(int p_what) { if (!is_inside_tree()) return; if (Engine::get_singleton()->is_editor_hint()) - draw_style_box(get_stylebox("border"), Rect2(Point2(), get_size())); + draw_rect(Rect2(Point2(), get_size()), border_color, false); } } +void ReferenceRect::set_border_color(const Color &color) { + border_color = color; +} + +Color ReferenceRect::get_border_color() const { + return border_color; +} + +void ReferenceRect::_bind_methods() { + ClassDB::bind_method(D_METHOD("get_border_color"), &ReferenceRect::get_border_color); + ClassDB::bind_method(D_METHOD("set_border_color", "color"), &ReferenceRect::set_border_color); + + ADD_PROPERTY(PropertyInfo(Variant::COLOR, "border_color"), "set_border_color", "get_border_color"); +} + ReferenceRect::ReferenceRect() { + border_color = Color(1, 0, 0); } diff --git a/scene/gui/reference_rect.h b/scene/gui/reference_rect.h index 473e348c85..9fad1a06b0 100644 --- a/scene/gui/reference_rect.h +++ b/scene/gui/reference_rect.h @@ -36,12 +36,17 @@ class ReferenceRect : public Control { GDCLASS(ReferenceRect, Control); + Color border_color; protected: void _notification(int p_what); + static void _bind_methods(); public: ReferenceRect(); + + void set_border_color(const Color &color); + Color get_border_color() const; }; #endif // REFERENCE_RECT_H |