diff --git a/config/appnavigation.json b/config/appnavigation.json index d7782162..de3b976e 100644 --- a/config/appnavigation.json +++ b/config/appnavigation.json @@ -38,25 +38,39 @@ "Order": "2", "Description": "Use Chocolatey for package management" }, + "WPFCollapseAllCategories": { + "Content": "Collapse All Categories", + "Category": "__Selection", + "Type": "Button", + "Order": "1", + "Description": "Collapse all application categories" + }, + "WPFExpandAllCategories": { + "Content": "Expand All Categories", + "Category": "__Selection", + "Type": "Button", + "Order": "2", + "Description": "Expand all application categories" + }, "WPFClearInstallSelection": { "Content": "Clear Selection", "Category": "__Selection", "Type": "Button", - "Order": "1", + "Order": "3", "Description": "Clear the selection of applications" }, "WPFGetInstalled": { "Content": "Get Installed", "Category": "__Selection", "Type": "Button", - "Order": "2", + "Order": "4", "Description": "Show installed applications" }, "WPFselectedAppsButton": { "Content": "Selected Apps: 0", "Category": "__Selection", "Type": "Button", - "Order": "3", + "Order": "5", "Description": "Show the selected applications" } } diff --git a/config/themes.json b/config/themes.json index 57aeeb92..3797e5db 100644 --- a/config/themes.json +++ b/config/themes.json @@ -91,7 +91,7 @@ "AppInstallOverlayBackgroundColor":"#2E3135", "ComboBoxForegroundColor": "#F7F7F7", "ComboBoxBackgroundColor": "#1E3747", - "LabelboxForegroundColor": "#0567ff", + "LabelboxForegroundColor": "#5bdcff", "MainForegroundColor": "#F7F7F7", "MainBackgroundColor": "#232629", "LabelBackgroundColor": "#232629", diff --git a/functions/private/Initialize-InstallCategoryAppList.ps1 b/functions/private/Initialize-InstallCategoryAppList.ps1 index 6d3c8737..ce78e193 100644 --- a/functions/private/Initialize-InstallCategoryAppList.ps1 +++ b/functions/private/Initialize-InstallCategoryAppList.ps1 @@ -44,6 +44,7 @@ function Initialize-InstallCategoryAppList { $toggleButton.Tag = "CategoryToggleButton" $toggleButton.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "HeaderFontSize") $toggleButton.SetResourceReference([Windows.Controls.Control]::FontFamilyProperty, "HeaderFontFamily") + $toggleButton.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "LabelboxForegroundColor") $toggleButton.Cursor = [System.Windows.Input.Cursors]::Hand $toggleButton.HorizontalAlignment = [Windows.HorizontalAlignment]::Stretch $sync.$Category = $toggleButton diff --git a/functions/public/Invoke-WPFButton.ps1 b/functions/public/Invoke-WPFButton.ps1 index 68f91e2e..1743a671 100644 --- a/functions/public/Invoke-WPFButton.ps1 +++ b/functions/public/Invoke-WPFButton.ps1 @@ -23,6 +23,8 @@ function Invoke-WPFButton { "WPFInstall" {Invoke-WPFInstall} "WPFUninstall" {Invoke-WPFUnInstall} "WPFInstallUpgrade" {Invoke-WPFInstallUpgrade} + "WPFCollapseAllCategories" {Invoke-WPFToggleAllCategories -Action "Collapse"} + "WPFExpandAllCategories" {Invoke-WPFToggleAllCategories -Action "Expand"} "WPFStandard" {Invoke-WPFPresets "Standard" -checkboxfilterpattern "WPFTweak*"} "WPFMinimal" {Invoke-WPFPresets "Minimal" -checkboxfilterpattern "WPFTweak*"} "WPFClearTweaksSelection" {Invoke-WPFPresets -imported $true -checkboxfilterpattern "WPFTweak*"} diff --git a/functions/public/Invoke-WPFToggleAllCategories.ps1 b/functions/public/Invoke-WPFToggleAllCategories.ps1 new file mode 100644 index 00000000..960a265d --- /dev/null +++ b/functions/public/Invoke-WPFToggleAllCategories.ps1 @@ -0,0 +1,51 @@ +function Invoke-WPFToggleAllCategories { + <# + .SYNOPSIS + Expands or collapses all categories in the Install tab + + .PARAMETER Action + The action to perform: "Expand" or "Collapse" + + .DESCRIPTION + This function iterates through all category containers in the Install tab + and expands or collapses their WrapPanels while updating the toggle button labels + #> + + param( + [Parameter(Mandatory=$true)] + [ValidateSet("Expand", "Collapse")] + [string]$Action + ) + + try { + if ($null -eq $sync.ItemsControl) { + Write-Warning "ItemsControl not initialized" + return + } + + $targetVisibility = if ($Action -eq "Expand") { [Windows.Visibility]::Visible } else { [Windows.Visibility]::Collapsed } + $targetPrefix = if ($Action -eq "Expand") { "-" } else { "+" } + $sourcePrefix = if ($Action -eq "Expand") { "+" } else { "-" } + + # Iterate through all items in the ItemsControl + $sync.ItemsControl.Items | ForEach-Object { + $categoryContainer = $_ + + # Check if this is a category container (StackPanel with children) + if ($categoryContainer -is [System.Windows.Controls.StackPanel] -and $categoryContainer.Children.Count -ge 2) { + # Get the WrapPanel (second child) + $wrapPanel = $categoryContainer.Children[1] + $wrapPanel.Visibility = $targetVisibility + + # Update the label to show the correct state + $categoryLabel = $categoryContainer.Children[0] + if ($categoryLabel.Content -like "$sourcePrefix*") { + $categoryLabel.Content = $categoryLabel.Content -replace "^$sourcePrefix ", "$targetPrefix " + } + } + } + } + catch { + Write-Error "Error toggling categories: $_" + } +}