summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-09-17 12:41:36 +0200
committerGitHub <noreply@github.com>2017-09-17 12:41:36 +0200
commitc24ca2c7a8b5471e9175f8ec1a84fd69a24bbbcf (patch)
treec351a28af785833a4a7938752e6f0cb578bf0a1c
parent2115935f46528bf5545531c9c9003b0eb8321651 (diff)
parent10c400c456e85bfcb988bc8a27657d044306ab10 (diff)
Merge pull request #10900 from toger5/theme_tab_border
Added border for tabs + container.
-rw-r--r--editor/editor_node.cpp2
-rw-r--r--editor/editor_themes.cpp31
-rw-r--r--scene/gui/tab_container.cpp6
3 files changed, 22 insertions, 17 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 3f0520379a..6424e03aea 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -4854,7 +4854,7 @@ EditorNode::EditorNode() {
scene_root_parent = memnew(PanelContainer);
scene_root_parent->set_custom_minimum_size(Size2(0, 80) * EDSCALE);
scene_root_parent->add_style_override("panel", gui_base->get_stylebox("Content", "EditorStyles"));
-
+ scene_root_parent->set_draw_behind_parent(true);
srt->add_child(scene_root_parent);
scene_root_parent->set_v_size_flags(Control::SIZE_EXPAND_FILL);
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index a03eee4687..0cba024595 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -369,6 +369,10 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// Tabs
Ref<StyleBoxFlat> style_tab_selected = style_default->duplicate();
+ style_tab_selected->set_border_width_all(border_width);
+ style_tab_selected->set_border_width(MARGIN_BOTTOM, 0);
+ style_tab_selected->set_border_color_all(dark_color_3);
+ style_tab_selected->set_expand_margin_size(MARGIN_BOTTOM, border_width);
style_tab_selected->set_default_margin(MARGIN_LEFT, 10 * EDSCALE);
style_tab_selected->set_default_margin(MARGIN_RIGHT, 10 * EDSCALE);
style_tab_selected->set_bg_color(tab_color);
@@ -435,19 +439,6 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("MenuHover", "EditorStyles", style_menu_hover_border);
- // Content of each tab
- Ref<StyleBoxFlat> style_content_panel = style_default->duplicate();
- style_content_panel->set_border_color_all(base_color);
-
- // this is the stylebox used in 3d and 2d viewports (no borders)
- Ref<StyleBoxFlat> style_content_panel_vp = style_content_panel->duplicate();
- style_content_panel_vp->set_default_margin(MARGIN_LEFT, border_width);
- style_content_panel_vp->set_default_margin(MARGIN_TOP, default_margin_size);
- style_content_panel_vp->set_default_margin(MARGIN_RIGHT, border_width);
- style_content_panel_vp->set_default_margin(MARGIN_BOTTOM, border_width);
- theme->set_stylebox("panel", "TabContainer", style_content_panel);
- theme->set_stylebox("Content", "EditorStyles", style_content_panel_vp);
-
// Buttons
theme->set_stylebox("normal", "Button", style_widget);
theme->set_stylebox("hover", "Button", style_widget_hover);
@@ -608,6 +599,20 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("button_pressed", "Tabs", style_menu);
theme->set_stylebox("button", "Tabs", style_menu);
+ // Content of each tab
+ Ref<StyleBoxFlat> style_content_panel = style_default->duplicate();
+ style_content_panel->set_border_color_all(dark_color_3);
+ style_content_panel->set_border_width_all(border_width);
+
+ // this is the stylebox used in 3d and 2d viewports (no borders)
+ Ref<StyleBoxFlat> style_content_panel_vp = style_content_panel->duplicate();
+ style_content_panel_vp->set_default_margin(MARGIN_LEFT, border_width);
+ style_content_panel_vp->set_default_margin(MARGIN_TOP, default_margin_size);
+ style_content_panel_vp->set_default_margin(MARGIN_LEFT, border_width);
+ style_content_panel_vp->set_default_margin(MARGIN_BOTTOM, border_width);
+ theme->set_stylebox("panel", "TabContainer", style_content_panel);
+ theme->set_stylebox("Content", "EditorStyles", style_content_panel_vp);
+
// Separators (no separators)
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));
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index 657e8590d4..98a8db336e 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -208,6 +208,9 @@ void TabContainer::_notification(int p_what) {
break;
}
+ // Draw the tab area.
+ panel->draw(canvas, Rect2(0, header_height, size.width, size.height - header_height));
+
// Draw all visible tabs.
int x = 0;
for (int i = 0; i < tab_widths.size(); i++) {
@@ -280,9 +283,6 @@ void TabContainer::_notification(int p_what) {
Point2(x, y_center - (decrement->get_height() / 2)),
Color(1, 1, 1, first_tab_cache > 0 ? 1.0 : 0.5));
}
-
- // Draw the tab area.
- panel->draw(canvas, Rect2(0, header_height, size.width, size.height - header_height));
} break;
case NOTIFICATION_THEME_CHANGED: {
if (get_tab_count() > 0) {