Fix ReferenceRect border
This commit is contained in:
parent
0fc1c4eda8
commit
aaf62fcecc
4 changed files with 27 additions and 7 deletions
|
@ -14,8 +14,8 @@
|
||||||
</methods>
|
</methods>
|
||||||
<constants>
|
<constants>
|
||||||
</constants>
|
</constants>
|
||||||
<theme_items>
|
<members>
|
||||||
<theme_item name="border" type="StyleBox">
|
<member name="border_color" type="Color" setter="set_border_color" getter="get_border_color">
|
||||||
</theme_item>
|
</member>
|
||||||
</theme_items>
|
</members>
|
||||||
</class>
|
</class>
|
||||||
|
|
|
@ -39,9 +39,25 @@ void ReferenceRect::_notification(int p_what) {
|
||||||
if (!is_inside_tree())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
if (Engine::get_singleton()->is_editor_hint())
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReferenceRect::ReferenceRect() {
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,12 +36,17 @@
|
||||||
class ReferenceRect : public Control {
|
class ReferenceRect : public Control {
|
||||||
|
|
||||||
GDCLASS(ReferenceRect, Control);
|
GDCLASS(ReferenceRect, Control);
|
||||||
|
Color border_color;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _notification(int p_what);
|
void _notification(int p_what);
|
||||||
|
static void _bind_methods();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ReferenceRect();
|
ReferenceRect();
|
||||||
|
|
||||||
|
void set_border_color(const Color &color);
|
||||||
|
Color get_border_color() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // REFERENCE_RECT_H
|
#endif // REFERENCE_RECT_H
|
||||||
|
|
|
@ -863,7 +863,6 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
|
||||||
Ref<StyleBoxTexture> ttnc = make_stylebox(full_panel_bg_png, 8, 8, 8, 8);
|
Ref<StyleBoxTexture> ttnc = make_stylebox(full_panel_bg_png, 8, 8, 8, 8);
|
||||||
ttnc->set_draw_center(false);
|
ttnc->set_draw_center(false);
|
||||||
|
|
||||||
theme->set_stylebox("border", "ReferenceRect", make_stylebox(reference_border_png, 4, 4, 4, 4));
|
|
||||||
theme->set_stylebox("panelnc", "Panel", ttnc);
|
theme->set_stylebox("panelnc", "Panel", ttnc);
|
||||||
theme->set_stylebox("panelf", "Panel", tc_sb);
|
theme->set_stylebox("panelf", "Panel", tc_sb);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue