Browse Source

Merge pull request #10900 from toger5/theme_tab_border

Added border for tabs + container.
Rémi Verschelde 8 years ago
parent
commit
c24ca2c7a8
3 changed files with 22 additions and 17 deletions
  1. 1 1
      editor/editor_node.cpp
  2. 18 13
      editor/editor_themes.cpp
  3. 3 3
      scene/gui/tab_container.cpp

+ 1 - 1
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);
 

+ 18 - 13
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));

+ 3 - 3
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) {