Browse Source

Tabs and panels in tab sets will no longer set the `display` property to `inline-block`, thus making it possible to customize the display property.

Michael Ragazzon 5 years ago
parent
commit
7f8230f5a7

+ 1 - 0
Samples/basic/databinding/data/databinding.rml

@@ -36,6 +36,7 @@ tabs
 }
 tab
 {
+	display: inline-block;
     width: 100px;
 	padding: 0px 20px;
 	line-height: 40px;

+ 7 - 2
Samples/basic/demo/data/demo.rml

@@ -40,7 +40,7 @@ body.window
 {
 	width: 1300px;
 	height: 750px;
-	min-width: 1090px;
+	min-width: 1030px;
 	min-height: 300px;
 	max-width: -1px;
 	max-height: -1px;
@@ -70,9 +70,10 @@ tabs
 }
 tab
 {
-    width: 100px;
+    width: 90px;
 	padding: 0px 20px;
 	line-height: 40px;
+	display: inline-block;
 	
 	font-size: 16px;
 	color: #ddd;
@@ -103,6 +104,10 @@ panel
 	margin-right: auto;
 	max-width: 500px;
 }
+panel#welcome
+{
+	display: inline-block;
+}
 h1
 {
 	margin: 1.4em 0 0.7em;

+ 3 - 3
Source/Core/Elements/ElementTabSet.cpp

@@ -124,7 +124,7 @@ void ElementTabSet::SetActiveTab(int tab_index)
 		if (old_window)
 			old_window->SetProperty(PropertyId::Display, Property(Style::Display::None));
 		if (new_window)
-			new_window->SetProperty(PropertyId::Display, Property(Style::Display::InlineBlock));
+			new_window->RemoveProperty(PropertyId::Display);
 
 		active_tab = tab_index;
 
@@ -177,7 +177,7 @@ void ElementTabSet::OnChildAdd(Element* child)
 	if (child->GetParentNode() == GetChildByTag("tabs"))
 	{
 		// Set up the new button and append it
-		child->SetProperty(PropertyId::Display, Property(Style::Display::InlineBlock));
+		child->RemoveProperty(PropertyId::Display);
 
 		if (child->GetParentNode()->GetChild(active_tab) == child)
 			child->SetPseudoClass("selected", true);
@@ -190,7 +190,7 @@ void ElementTabSet::OnChildAdd(Element* child)
 		
 		// Make the new element visible if its the active tab
 		if (child->GetParentNode()->GetChild(active_tab) == child)
-			child->SetProperty(PropertyId::Display, Property(Style::Display::InlineBlock));
+			child->RemoveProperty(PropertyId::Display);
 	}
 }
 

+ 2 - 0
changelog.md

@@ -87,6 +87,7 @@ These changes may result in a differently rendered layout when upgrading to RmlU
 - Fixed building with MinGW, and added it to the CI to avoid future breaks. [#108](https://github.com/mikke89/RmlUi/pull/108) (thanks @cloudwu).
 - Fixed several compilation issues and warnings. [#118](https://github.com/mikke89/RmlUi/issues/118) [#97](https://github.com/mikke89/RmlUi/pull/97) (thanks @SpaceCat-Chan).
 - Debugger improvements: Sort property names alphabetically. Fix a bug where the outlines would draw underneath the document.
+- Tabs and panels in tab sets will no longer set the `display` property to `inline-block`, thus it is now possible to customize the display property.
 
 ### Breaking changes
 
@@ -95,6 +96,7 @@ These changes may result in a differently rendered layout when upgrading to RmlU
 - Attributes starting with `data-` are now reserved for RmlUi.
 - The changes to the layout engine may result in changes to the rendered layout in some situations, see above for more details.
 - The `BaseXMLParser` class has some minor interface changes.
+- Tab set elements `tab` and `panel` should now have their `display` property set in the RCSS document, use `display: inline-block` for the same behavior as before.