summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/base/classes.xml18
-rw-r--r--editor/animation_editor.cpp1
-rw-r--r--editor/editor_node.cpp4
-rw-r--r--editor/editor_themes.cpp22
-rw-r--r--editor/icons/2x/icon_variant.pngbin0 -> 398 bytes
-rw-r--r--editor/icons/icon_variant.pngbin240 -> 237 bytes
-rw-r--r--editor/icons/source/icon_variant.svg146
-rw-r--r--editor/script_editor_debugger.cpp19
-rw-r--r--scene/gui/dialogs.cpp1
-rw-r--r--scene/gui/option_button.cpp17
-rw-r--r--scene/gui/slider.cpp7
-rw-r--r--scene/gui/tabs.cpp18
-rw-r--r--scene/gui/tabs.h2
-rw-r--r--scene/resources/style_box.cpp78
-rw-r--r--scene/resources/style_box.h34
15 files changed, 349 insertions, 18 deletions
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index e0255c279e..a137f9be7d 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -44923,6 +44923,15 @@
<description>
</description>
</method>
+ <method name="get_tab_rect">
+ <return type="Rect2">
+ </return>
+ <argument index="0" name="tab_idx" type="int">
+ </argument>
+ <description>
+ Returns tab [Rect2] with local position and size.
+ </description>
+ </method>
<method name="get_tab_title" qualifiers="const">
<return type="String">
</return>
@@ -44931,6 +44940,15 @@
<description>
</description>
</method>
+ <method name="move_tab">
+ <argument index="0" name="from" type="int">
+ </argument>
+ <argument index="1" name="to" type="int">
+ </argument>
+ <description>
+ Rearrange tab.
+ </description>
+ </method>
<method name="remove_tab">
<argument index="0" name="tab_idx" type="int">
</argument>
diff --git a/editor/animation_editor.cpp b/editor/animation_editor.cpp
index 1798e66e8a..45da365695 100644
--- a/editor/animation_editor.cpp
+++ b/editor/animation_editor.cpp
@@ -3774,6 +3774,7 @@ AnimationKeyEditor::AnimationKeyEditor() {
zoom->set_max(2.0);
zoom->set_value(1.0);
zoom->set_h_size_flags(SIZE_EXPAND_FILL);
+ zoom->set_v_size_flags(SIZE_EXPAND_FILL);
zoom->set_stretch_ratio(2);
hb->add_child(zoom);
zoom->connect("value_changed", this, "_scroll_changed");
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index fba9e6cde0..f6a7aeff06 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -1628,7 +1628,7 @@ void EditorNode::_edit_current() {
p->add_separator();
p->add_shortcut(ED_SHORTCUT("property_editor/make_subresources_unique", TTR("Make Sub-Resources Unique")), OBJECT_UNIQUE_RESOURCES);
p->add_separator();
- p->add_icon_shortcut(gui_base->get_icon("Help", "EditorIcons"), ED_SHORTCUT("property_editor/open_help", TTR("Open in Help")), OBJECT_REQUEST_HELP);
+ p->add_icon_shortcut(gui_base->get_icon("HelpSearch", "EditorIcons"), ED_SHORTCUT("property_editor/open_help", TTR("Open in Help")), OBJECT_REQUEST_HELP);
}
List<MethodInfo> methods;
@@ -5578,7 +5578,7 @@ EditorNode::EditorNode() {
p = help_menu->get_popup();
p->connect("id_pressed", this, "_menu_option");
p->add_icon_item(gui_base->get_icon("ClassList", "EditorIcons"), TTR("Classes"), HELP_CLASSES);
- p->add_icon_item(gui_base->get_icon("Help", "EditorIcons"), TTR("Search"), HELP_SEARCH);
+ p->add_icon_item(gui_base->get_icon("HelpSearch", "EditorIcons"), TTR("Search"), HELP_SEARCH);
p->add_separator();
p->add_icon_item(gui_base->get_icon("Instance", "EditorIcons"), TTR("Online Docs"), HELP_DOCS);
p->add_icon_item(gui_base->get_icon("Instance", "EditorIcons"), TTR("Q&A"), HELP_QA);
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index ce9b004ce1..4e8f7029ff 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -69,6 +69,15 @@ static Ref<StyleBoxFlat> make_flat_stylebox(Color color, float p_margin_left = -
return style;
}
+static Ref<StyleBoxLine> make_line_stylebox(Color color, int thickness = 1, float grow = 1, bool vertical = false) {
+ Ref<StyleBoxLine> style(memnew(StyleBoxLine));
+ style->set_color(color);
+ style->set_grow(grow);
+ style->set_thickness(thickness);
+ style->set_vertical(vertical);
+ return style;
+}
+
static Ref<StyleBoxFlat> change_border_color(Ref<StyleBoxFlat> p_style, Color p_color) {
Ref<StyleBoxFlat> style = p_style->duplicate();
style->set_light_color(p_color);
@@ -143,6 +152,9 @@ Ref<Theme> create_editor_theme() {
Color title_color_hl_text_color = dark_bg ? Color(1, 1, 1, 0.9) : Color(0, 0, 0, 0.9);
Ref<Texture> title_hl_close_icon = theme->get_icon((dark_bg ? "GuiCloseLight" : "GuiCloseDark"), "EditorIcons");
+ bool dark_base = ((base_color.r + base_color.g + base_color.b) / 3.0) < 0.5;
+ Color separator_color = dark_base ? Color(1, 1, 1, 0.1) : Color(0, 0, 0, 0.1);
+
theme->set_color("highlight_color", "Editor", highlight_color);
theme->set_color("base_color", "Editor", base_color);
theme->set_color("dark_color_1", "Editor", dark_color_1);
@@ -244,7 +256,7 @@ Ref<Theme> create_editor_theme() {
theme->set_color("icon_color_pressed", "Button", Color(highlight_color.r * 1.15, highlight_color.g * 1.15, highlight_color.b * 1.15, highlight_color.a));
// OptionButton
- Ref<StyleBoxFlat> style_option_button = make_flat_stylebox(dark_color_1, 4, 4, 4, 4);
+ Ref<StyleBoxFlat> style_option_button = make_flat_stylebox(dark_color_1, 4, 4, 8, 4);
style_option_button->set_border_size(border_width);
style_option_button->set_light_color(light_color_1);
style_option_button->set_dark_color(light_color_1);
@@ -259,6 +271,8 @@ Ref<Theme> create_editor_theme() {
theme->set_color("font_color_pressed", "OptionButton", highlight_color);
theme->set_color("icon_color_hover", "OptionButton", HIGHLIGHT_COLOR_LIGHT);
theme->set_icon("arrow", "OptionButton", theme->get_icon("GuiOptionArrow", "EditorIcons"));
+ theme->set_constant("arrow_margin", "OptionButton", 4);
+ theme->set_constant("modulate_arrow", "OptionButton", true);
// CheckButton
theme->set_icon("on", "CheckButton", theme->get_icon("GuiToggleOn", "EditorIcons"));
@@ -271,7 +285,7 @@ Ref<Theme> create_editor_theme() {
style_popup_menu->set_dark_color(light_color_1);
style_popup_menu->set_border_blend(false);
theme->set_stylebox("panel", "PopupMenu", style_popup_menu);
- theme->set_stylebox("separator", "PopupMenu", make_empty_stylebox());
+ theme->set_stylebox("separator", "PopupMenu", make_line_stylebox(separator_color, border_width, 8 - border_width));
// Tree & ItemList background
Ref<StyleBoxFlat> style_tree_bg = make_flat_stylebox(dark_color_1, 2, 4, 2, 4);
@@ -362,8 +376,8 @@ Ref<Theme> create_editor_theme() {
theme->set_icon("close", "Tabs", title_hl_close_icon);
// Separatos (no separatos)
- theme->set_stylebox("separator", "HSeparator", make_empty_stylebox());
- theme->set_stylebox("separator", "VSeparator", make_empty_stylebox());
+ theme->set_stylebox("separator", "HSeparator", make_line_stylebox(separator_color, border_width));
+ theme->set_stylebox("separator", "VSeparator", make_line_stylebox(separator_color, border_width, 0, true));
// Debugger
Ref<StyleBoxFlat> style_panel_debugger = make_flat_stylebox(dark_color_2, 0, 4, 0, 0);
diff --git a/editor/icons/2x/icon_variant.png b/editor/icons/2x/icon_variant.png
new file mode 100644
index 0000000000..bb8075a069
--- /dev/null
+++ b/editor/icons/2x/icon_variant.png
Binary files differ
diff --git a/editor/icons/icon_variant.png b/editor/icons/icon_variant.png
index 1ae2812ff7..af7590345e 100644
--- a/editor/icons/icon_variant.png
+++ b/editor/icons/icon_variant.png
Binary files differ
diff --git a/editor/icons/source/icon_variant.svg b/editor/icons/source/icon_variant.svg
new file mode 100644
index 0000000000..d966190ab0
--- /dev/null
+++ b/editor/icons/source/icon_variant.svg
@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ viewBox="0 0 16 16"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.92+devel unknown"
+ inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_add_track.png"
+ inkscape:export-xdpi="45"
+ inkscape:export-ydpi="45"
+ sodipodi:docname="icon_variant.svg">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="22.627418"
+ inkscape:cx="12.635414"
+ inkscape:cy="11.860443"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ inkscape:snap-bbox="true"
+ inkscape:bbox-paths="true"
+ inkscape:bbox-nodes="true"
+ inkscape:snap-bbox-edge-midpoints="true"
+ inkscape:snap-bbox-midpoints="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:snap-center="true"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:snap-midpoints="true"
+ inkscape:snap-smooth-nodes="true"
+ inkscape:object-nodes="true"
+ inkscape:document-rotation="0">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3336" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1036.3622)">
+ <g
+ transform="translate(0,-3)"
+ id="layer1-5"
+ inkscape:label="Layer 1"
+ style="fill:#e0e0e0;fill-opacity:1">
+ <rect
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4320"
+ width="2"
+ height="5.9999666"
+ x="3"
+ y="1044.3622" />
+ <rect
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4324"
+ width="2"
+ height="5.9999843"
+ x="6"
+ y="1044.3622" />
+ <rect
+ y="1044.3622"
+ x="3"
+ height="2.0000174"
+ width="1"
+ id="rect4326"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 3,1044.3622 a 3,3 0 0 0 -3,3 h 2 a 1.0000174,1.0000174 0 0 1 1,-1 z"
+ id="path4328"
+ inkscape:connector-curvature="0" />
+ <path
+ id="path4330"
+ d="m 14,1050.3622 a 3,3 0 0 1 -3,-3 h 2 a 1.0000174,1.0000174 0 0 0 1,1 z"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ inkscape:connector-curvature="0" />
+ <rect
+ transform="scale(1,-1)"
+ y="-1052.3622"
+ x="14"
+ height="7.9999843"
+ width="2"
+ id="rect4334"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ transform="scale(1,-1)"
+ y="-1047.3622"
+ x="11"
+ height="2.9999826"
+ width="2"
+ id="rect4338"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4340"
+ d="m 3,1050.3622 a 3,3 0 0 1 -3,-3 h 2 a 1.0000174,1.0000174 0 0 0 1,1 z"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4342"
+ d="m 8,1044.3622 a 3,3 0 0 1 3,3 H 9 a 1.0000174,1.0000174 0 0 0 -1,-1 z"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ y="1047.3622"
+ x="9"
+ height="3.0000174"
+ width="2"
+ id="rect4344"
+ style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </g>
+ </g>
+</svg>
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index 9dce48937c..4b3ebf5643 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -1849,30 +1849,31 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
}
{ // misc
- VBoxContainer *info_left = memnew(VBoxContainer);
- info_left->set_h_size_flags(SIZE_EXPAND_FILL);
+ GridContainer *info_left = memnew(GridContainer);
+ info_left->set_columns(2);
info_left->set_name(TTR("Misc"));
tabs->add_child(info_left);
clicked_ctrl = memnew(LineEdit);
- info_left->add_margin_child(TTR("Clicked Control:"), clicked_ctrl);
+ clicked_ctrl->set_h_size_flags(SIZE_EXPAND_FILL);
+ info_left->add_child(memnew(Label(TTR("Clicked Control:"))));
+ info_left->add_child(clicked_ctrl);
clicked_ctrl_type = memnew(LineEdit);
- info_left->add_margin_child(TTR("Clicked Control Type:"), clicked_ctrl_type);
+ info_left->add_child(memnew(Label(TTR("Clicked Control Type:"))));
+ info_left->add_child(clicked_ctrl_type);
live_edit_root = memnew(LineEdit);
+ live_edit_root->set_h_size_flags(SIZE_EXPAND_FILL);
{
HBoxContainer *lehb = memnew(HBoxContainer);
Label *l = memnew(Label(TTR("Live Edit Root:")));
- lehb->add_child(l);
- l->set_h_size_flags(SIZE_EXPAND_FILL);
+ info_left->add_child(l);
+ lehb->add_child(live_edit_root);
le_set = memnew(Button(TTR("Set From Tree")));
lehb->add_child(le_set);
le_clear = memnew(Button(TTR("Clear")));
lehb->add_child(le_clear);
info_left->add_child(lehb);
- MarginContainer *mc = memnew(MarginContainer);
- mc->add_child(live_edit_root);
- info_left->add_child(mc);
le_set->set_disabled(true);
le_clear->set_disabled(true);
}
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index d5e852f840..8885bec03c 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -584,5 +584,6 @@ Button *ConfirmationDialog::get_cancel() {
ConfirmationDialog::ConfirmationDialog() {
set_title(RTR("Please Confirm..."));
+ set_custom_minimum_size(Size2(200, 70));
cancel = add_cancel();
}
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index f75e0986c1..b842419eab 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -52,11 +52,26 @@ void OptionButton::_notification(int p_what) {
RID ci = get_canvas_item();
Ref<Texture> arrow = Control::get_icon("arrow");
Ref<StyleBox> normal = get_stylebox("normal");
+ Color clr = Color(1, 1, 1);
+ if (get_constant("modulate_arrow"))
+ switch (get_draw_mode()) {
+ case DRAW_PRESSED:
+ clr = get_color("font_color_pressed");
+ break;
+ case DRAW_HOVER:
+ clr = get_color("font_color_hover");
+ break;
+ case DRAW_DISABLED:
+ clr = get_color("font_color_disabled");
+ break;
+ default:
+ clr = get_color("font_color");
+ }
Size2 size = get_size();
Point2 ofs(size.width - arrow->get_width() - get_constant("arrow_margin"), int(Math::abs((size.height - arrow->get_height()) / 2)));
- arrow->draw(ci, ofs);
+ arrow->draw(ci, ofs, clr);
} break;
}
diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp
index c84608ef2e..9ba17ce34f 100644
--- a/scene/gui/slider.cpp
+++ b/scene/gui/slider.cpp
@@ -167,7 +167,8 @@ void Slider::_notification(int p_what) {
if (orientation == VERTICAL) {
- style->draw(ci, Rect2i(Point2i(), Size2i(style->get_minimum_size().width + style->get_center_size().width, size.height)));
+ int widget_width = style->get_minimum_size().width + style->get_center_size().width;
+ style->draw(ci, Rect2i(Point2i(size.width / 2 - widget_width / 2, 0), Size2i(widget_width, size.height)));
/*
if (mouse_inside||has_focus())
focus->draw(ci,Rect2i(Point2i(),Size2i(style->get_minimum_size().width+style->get_center_size().width,size.height)));
@@ -183,7 +184,9 @@ void Slider::_notification(int p_what) {
}
grabber->draw(ci, Point2i(size.width / 2 - grabber->get_size().width / 2, size.height - get_as_ratio() * areasize - grabber->get_size().height));
} else {
- style->draw(ci, Rect2i(Point2i(), Size2i(size.width, style->get_minimum_size().height + style->get_center_size().height)));
+
+ int widget_height = style->get_minimum_size().height + style->get_center_size().height;
+ style->draw(ci, Rect2i(Point2i(0, size.height / 2 - widget_height / 2), Size2i(size.width, widget_height)));
/*
if (mouse_inside||has_focus())
focus->draw(ci,Rect2i(Point2i(),Size2i(size.width,style->get_minimum_size().height+style->get_center_size().height)));
diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp
index 4316f06a53..ee0ae1fb41 100644
--- a/scene/gui/tabs.cpp
+++ b/scene/gui/tabs.cpp
@@ -639,6 +639,22 @@ Tabs::TabAlign Tabs::get_tab_align() const {
return tab_align;
}
+void Tabs::move_tab(int from, int to) {
+
+ if (from == to)
+ return;
+
+ ERR_FAIL_INDEX(from, tabs.size());
+ ERR_FAIL_INDEX(to, tabs.size());
+
+ Tab tab_from = tabs[from];
+ tabs.remove(from);
+ tabs.insert(to, tab_from);
+
+ _update_cache();
+ update();
+}
+
int Tabs::get_tab_width(int p_idx) const {
ERR_FAIL_INDEX_V(p_idx, tabs.size(), 0);
@@ -773,6 +789,8 @@ void Tabs::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_tab_align", "align"), &Tabs::set_tab_align);
ClassDB::bind_method(D_METHOD("get_tab_align"), &Tabs::get_tab_align);
ClassDB::bind_method(D_METHOD("ensure_tab_visible", "idx"), &Tabs::ensure_tab_visible);
+ ClassDB::bind_method(D_METHOD("get_tab_rect", "tab_idx"), &Tabs::get_tab_rect);
+ ClassDB::bind_method(D_METHOD("move_tab", "from", "to"), &Tabs::move_tab);
ADD_SIGNAL(MethodInfo("tab_changed", PropertyInfo(Variant::INT, "tab")));
ADD_SIGNAL(MethodInfo("right_button_pressed", PropertyInfo(Variant::INT, "tab")));
diff --git a/scene/gui/tabs.h b/scene/gui/tabs.h
index 613c604b12..a9dd6bddd7 100644
--- a/scene/gui/tabs.h
+++ b/scene/gui/tabs.h
@@ -119,6 +119,8 @@ public:
void set_tab_align(TabAlign p_align);
TabAlign get_tab_align() const;
+ void move_tab(int from, int to);
+
void set_tab_close_display_policy(CloseButtonDisplayPolicy p_policy);
int get_tab_count() const;
diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp
index 2714ffec10..f108809c83 100644
--- a/scene/resources/style_box.cpp
+++ b/scene/resources/style_box.cpp
@@ -437,3 +437,81 @@ StyleBoxFlat::StyleBoxFlat() {
}
StyleBoxFlat::~StyleBoxFlat() {
}
+
+void StyleBoxLine::set_color(const Color &p_color) {
+ color = p_color;
+ emit_changed();
+}
+Color StyleBoxLine::get_color() const {
+ return color;
+}
+
+void StyleBoxLine::set_thickness(int p_thickness) {
+ thickness = p_thickness;
+ emit_changed();
+}
+int StyleBoxLine::get_thickness() const {
+ return thickness;
+}
+
+void StyleBoxLine::set_vertical(bool p_vertical) {
+ vertical = p_vertical;
+}
+bool StyleBoxLine::is_vertical() const {
+ return vertical;
+}
+
+void StyleBoxLine::set_grow(float p_grow) {
+ grow = p_grow;
+ emit_changed();
+}
+float StyleBoxLine::get_grow() const {
+ return grow;
+}
+
+void StyleBoxLine::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("set_color", "color"), &StyleBoxLine::set_color);
+ ClassDB::bind_method(D_METHOD("get_color"), &StyleBoxLine::get_color);
+ ClassDB::bind_method(D_METHOD("set_thickness", "thickness"), &StyleBoxLine::set_thickness);
+ ClassDB::bind_method(D_METHOD("get_thickness"), &StyleBoxLine::get_thickness);
+ ClassDB::bind_method(D_METHOD("set_grow", "grow"), &StyleBoxLine::set_grow);
+ ClassDB::bind_method(D_METHOD("get_grow"), &StyleBoxLine::get_grow);
+ ClassDB::bind_method(D_METHOD("set_vertical", "vertical"), &StyleBoxLine::set_vertical);
+ ClassDB::bind_method(D_METHOD("is_vertical"), &StyleBoxLine::is_vertical);
+
+ ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "thickness", PROPERTY_HINT_RANGE, "0,10"), "set_thickness", "get_thickness");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "vertical"), "set_vertical", "get_vertical");
+}
+float StyleBoxLine::get_style_margin(Margin p_margin) const {
+ return thickness;
+}
+Size2 StyleBoxLine::get_center_size() const {
+ return Size2();
+}
+
+void StyleBoxLine::draw(RID p_canvas_item, const Rect2 &p_rect) const {
+ VisualServer *vs = VisualServer::get_singleton();
+ Rect2i r = p_rect;
+
+ if (vertical) {
+ r.position.y -= grow;
+ r.size.y += grow * 2;
+ r.size.x = thickness;
+ } else {
+ r.position.x -= grow;
+ r.size.x += grow * 2;
+ r.size.y = thickness;
+ }
+
+ vs->canvas_item_add_rect(p_canvas_item, r, color);
+}
+
+StyleBoxLine::StyleBoxLine() {
+ grow = 1.0;
+ thickness = 1;
+ color = Color(0.0, 0.0, 0.0);
+ vertical = false;
+}
+StyleBoxLine::~StyleBoxLine() {}
diff --git a/scene/resources/style_box.h b/scene/resources/style_box.h
index 7547c2ea81..64ce3528aa 100644
--- a/scene/resources/style_box.h
+++ b/scene/resources/style_box.h
@@ -164,4 +164,38 @@ public:
~StyleBoxFlat();
};
+// just used to draw lines.
+class StyleBoxLine : public StyleBox {
+
+ GDCLASS(StyleBoxLine, StyleBox);
+ Color color;
+ int thickness;
+ bool vertical;
+ float grow;
+
+protected:
+ virtual float get_style_margin(Margin p_margin) const;
+ static void _bind_methods();
+
+public:
+ void set_color(const Color &p_color);
+ Color get_color() const;
+
+ void set_thickness(int p_thickness);
+ int get_thickness() const;
+
+ void set_vertical(bool p_vertical);
+ bool is_vertical() const;
+
+ void set_grow(float p_grow);
+ float get_grow() const;
+
+ virtual Size2 get_center_size() const;
+
+ virtual void draw(RID p_canvas_item, const Rect2 &p_rect) const;
+
+ StyleBoxLine();
+ ~StyleBoxLine();
+};
+
#endif