Browse Source

Add pseudo class to active tabset panel (#809)

This allows a trivial way to have transition effects on panels when switching tabs.
Logan McBroom 3 months ago
parent
commit
7366ad1f9f
1 changed files with 10 additions and 1 deletions
  1. 10 1
      Source/Core/Elements/ElementTabSet.cpp

+ 10 - 1
Source/Core/Elements/ElementTabSet.cpp

@@ -113,10 +113,16 @@ void ElementTabSet::SetActiveTab(int tab_index)
 		Element* old_window = windows->GetChild(active_tab);
 		Element* new_window = windows->GetChild(tab_index);
 
-		if (old_window)
+        if (old_window)
+        {
+            old_window->SetPseudoClass("selected", false);
 			old_window->SetProperty(PropertyId::Display, Property(Style::Display::None));
+        }
 		if (new_window)
+        {
+            new_window->SetPseudoClass("selected", true);
 			new_window->RemoveProperty(PropertyId::Display);
+        }
 
 		active_tab = tab_index;
 
@@ -182,7 +188,10 @@ void ElementTabSet::OnChildAdd(Element* child)
 
 		// Make the new element visible if its the active tab
 		if (child->GetParentNode()->GetChild(active_tab) == child)
+        {
+			child->SetPseudoClass("selected", true);
 			child->RemoveProperty(PropertyId::Display);
+        }
 	}
 }