Window Framework for UI Toolkit v2.0.x
GWG.WindowFramework.Editor.ThemeManagerWindow Class Reference

Represents a custom editor window in Unity, used for managing themes within the Window Framework. More...

Inheritance diagram for GWG.WindowFramework.Editor.ThemeManagerWindow:
Collaboration diagram for GWG.WindowFramework.Editor.ThemeManagerWindow:

Static Public Member Functions

static void ShowWindow ()
 Opens or focuses the Theme Manager through its registered editor menu.

Private Member Functions

void BuildAssetsBrowserModal ()
void BuildDefaultsModal ()
void BuildSharedStylesheetsPanel ()
 Builds the shared-style editor with immutable essential roles and a separate application list.
void CloseAssetsModal ()
void CloseDefaultsModal ()
void CloseRepositorySetup ()
 Closes idle setup, or requests safe cancellation when an operation is still active.
VisualElement CreateDataFileItem (WindowFrameThemeData dataFile)
VisualElement CreateDataFilesList ()
void CreateGUI ()
HelpBox CreateRepositoryOwnershipNotice ()
 Builds the selected collection's ownership notice using Unity-skin-aware HelpBox UI.
VisualElement CreateRepositorySection (string elementName, string title, string description, List< WindowFrameThemeData > dataFiles, bool shipped)
 Wraps unchanged collection rows in a themed, labelled origin section.
void CreateSetupScreen ()
void CreateThemeData ()
 Creates a new instance of the WindowFrameThemeData scriptable object,
saves it as an asset in the project, and updates the PlayerPrefs for reloading functionality.
Toolbar CreateToolbar ()
ToolbarButton CreateToolbarButton (string iconName, string labelText, System.Action onClick, string tooltip=null)
 Creates and returns a new Toolbar instance for the theme management window.
.
void DescribeRepository (WindowFrameThemeData data, out string title, out string message, out bool warning)
 Describes repository source/path without scanning its contents or certifying its setup.
List< WindowFrameThemeData > FindThemeDataFiles ()
string GetInstalledPackageRoot ()
 Derives this installed package's boundary from the manager script, without selecting theme data.
void LoadStyles ()
 Loads and applies the specified StyleSheet resource to the current EditorWindow's rootVisualElement. Attempts to load a StyleSheet named "ThemeManagerEditor". If the StyleSheet is found, it is added to the styleSheets collection of the rootVisualElement. If the StyleSheet is not found, no changes are made.
bool LoadThemeData ()
 Loads the WindowFrameThemeData asset from the PlayerPrefs path. If the path is valid, loads the asset and returns true. If the path is invalid, returns false.
void OnDestroy ()
void OnDisable ()
 Releases the ownership refresh callback when the editor window is disabled.
void OnEnable ()
 Restores the window title and subscribes read-only ownership presentation to project asset changes.
void OnGUI ()
void OpenAssetsModal ()
 Opens Browse Assets above the shared backdrop, including after repository setup has closed.
void OpenCreatedRepository (ThemeRepositoryCreateResult result)
 Opens the validated production result without instantiating UI into a scene.
void OpenDefaultsModal ()
void OpenRepositorySetup ()
 Opens setup from the canonical asset default regardless of the Manager's open collection.
void PopulateRepositorySections (ScrollView scrollView, List< WindowFrameThemeData > dataFiles)
 Groups existing collection rows by their inspected origin within the existing browser.
void RefreshDataFilesList (ScrollView scrollView)
void RefreshRepositoryOwnershipPresentation ()
 Refreshes source notices after asset changes without changing selection.
void SelectDataFile (WindowFrameThemeData dataFile)
void SetActiveAddressablesButton (Button button)
DropdownMenuAction.Status SetAddressableLabelMenuActiveStatus (DropdownMenuAction arg)
DropdownMenuAction.Status SetAddressablesMenuActiveStatus (DropdownMenuAction arg)
void SetRepositoryUiBusy (bool busy)
 Suspends Manager serialization during copying without disabling progress or cancellation.
void SetupAddressableLabels (DropdownMenuAction obj)
void ToggleAddressables (DropdownMenuAction dropdownMenuAction)
void ToggleAssetsModal ()
void ToggleDefaultsModal ()
void ToggleSharedStylesheetsPanel ()

Private Attributes

WindowFrameThemeData _activeAddressablesThemeData
VisualElement _assetsModalBackdrop
VisualElement _assetsModalContainer
VisualElement _defaultsModalContainer
System.IDisposable _interactionTelemetry
 Initializes and configures the visual elements of the theme manager window.
Clears existing UI components, loads necessary styles, and builds the window's layout.
.
ThemeRepositorySetupView _repositorySetupView
bool _repositoryUiSuspended
SerializedObject _serializedObject
ObjectField _settingsField
WindowFrameThemeData _themeData
ThemeStudioView _themeStudioView

Detailed Description

Represents a custom editor window in Unity, used for managing themes within the Window Framework.

This class provides a user interface for creating, editing, and managing themes within the Window Framework. It allows users to select a theme data file, create new themes, and view and edit existing themes along with their settings. It also allows for managing the Unity Addressable integration options. The window is designed to be easily accessible and user-friendly, with features such as theme creation, editing, and deletion. The window also supports theme switching, allowing users to switch between different themes in real-time. The window is designed to be easily integrated into Unity's editor environment, making it a valuable tool for developers.

Member Function Documentation

◆ BuildAssetsBrowserModal()

void GWG.WindowFramework.Editor.ThemeManagerWindow.BuildAssetsBrowserModal ( )
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ BuildDefaultsModal()

void GWG.WindowFramework.Editor.ThemeManagerWindow.BuildDefaultsModal ( )
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ BuildSharedStylesheetsPanel()

void GWG.WindowFramework.Editor.ThemeManagerWindow.BuildSharedStylesheetsPanel ( )
inlineprivate

Builds the shared-style editor with immutable essential roles and a separate application list.

Essential identities come from recorded repository role references, or trusted canonical default assets for the canonical collection only. Missing project roles block edits rather than guess files or reconnect shipped originals. Opening this panel never saves/reorders a source. Only explicit valid application-row edits use the existing Undo/save/refresh workflow.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CloseAssetsModal()

void GWG.WindowFramework.Editor.ThemeManagerWindow.CloseAssetsModal ( )
inlineprivate
Here is the caller graph for this function:

◆ CloseDefaultsModal()

void GWG.WindowFramework.Editor.ThemeManagerWindow.CloseDefaultsModal ( )
inlineprivate
Here is the caller graph for this function:

◆ CloseRepositorySetup()

void GWG.WindowFramework.Editor.ThemeManagerWindow.CloseRepositorySetup ( )
inlineprivate

Closes idle setup, or requests safe cancellation when an operation is still active.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateDataFileItem()

VisualElement GWG.WindowFramework.Editor.ThemeManagerWindow.CreateDataFileItem ( WindowFrameThemeData dataFile)
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateDataFilesList()

VisualElement GWG.WindowFramework.Editor.ThemeManagerWindow.CreateDataFilesList ( )
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateGUI()

void GWG.WindowFramework.Editor.ThemeManagerWindow.CreateGUI ( )
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateRepositoryOwnershipNotice()

HelpBox GWG.WindowFramework.Editor.ThemeManagerWindow.CreateRepositoryOwnershipNotice ( )
inlineprivate

Builds the selected collection's ownership notice using Unity-skin-aware HelpBox UI.

Does not replace the existing collection selector or change the open collection.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateRepositorySection()

VisualElement GWG.WindowFramework.Editor.ThemeManagerWindow.CreateRepositorySection ( string elementName,
string title,
string description,
List< WindowFrameThemeData > dataFiles,
bool shipped )
inlineprivate

Wraps unchanged collection rows in a themed, labelled origin section.

Reuses CreateDataFileItem, including its ownership badge, Open/Ping actions and current-file marker. The project section remains visible when empty. Its action opens the guided form; the form's valid explicit Create action runs the production operation and opens validated output.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateSetupScreen()

void GWG.WindowFramework.Editor.ThemeManagerWindow.CreateSetupScreen ( )
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateThemeData()

void GWG.WindowFramework.Editor.ThemeManagerWindow.CreateThemeData ( )
inlineprivate

Creates a new instance of the WindowFrameThemeData scriptable object,
saves it as an asset in the project, and updates the PlayerPrefs for reloading functionality.

This method is called when the user clicks the "Create New" button in the toolbar.
Creates a new instance of the WindowFrameThemeData scriptable object,
saves it as an asset in the project, and updates the PlayerPrefs for reloading functionality.
Opens a save file panel to specify the location and name of the saved theme data file.
If the file path is selected and valid:

  • Creates and saves the asset in the specified path.
  • Refreshes the asset database.
  • Logs the creation of the theme data file.
  • Updates PlayerPrefs with the path of the newly created theme data.
  • Calls CreateGUI to reload the window.
    If no file path is selected, no actions are taken.
Here is the call graph for this function:

◆ CreateToolbar()

Toolbar GWG.WindowFramework.Editor.ThemeManagerWindow.CreateToolbar ( )
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateToolbarButton()

ToolbarButton GWG.WindowFramework.Editor.ThemeManagerWindow.CreateToolbarButton ( string iconName,
string labelText,
System.Action onClick,
string tooltip = null )
inlineprivate

Creates and returns a new Toolbar instance for the theme management window.
.

Returns
A configured Toolbar instance containing interactive buttons for management.

This method is called when the window is first displayed or when the user refreshes the window.
It creates a new Toolbar instance with a set of interactive buttons for theme management.
The buttons include:

  • "Create New": Opens a file save dialog to create a new WindowFrameThemeData asset.
  • "Clear Current": Clears the currently loaded WindowFrameThemeData instance and resets the PlayerPrefs path.
  • "Refresh": Refreshes the window by reloading the WindowFrameThemeData asset.
    When Addressesables is enabled, the toolbar also includes a dropdown menu for setting up Addressables labels.
    The dropdown menu allows the user to toggle the use of Addressables and setup labels for the current theme data.
    The dropdown menu is only enabled if Addressables is installed and the WFW_ADDRESSABLES directive is defined.
    The dropdown menu is initially disabled and only enabled if Addressables is installed and the WFW_ADDRESSABLES directive is defined.
    The dropdown menu contains two actions:
  • "Use Addressables": Toggles the use of Addressables by setting the WFW_ADDRESSABLES directive.
  • "Setup Labels": Opens a file save dialog to setup Addressables labels for the current theme data.
Here is the caller graph for this function:

◆ DescribeRepository()

void GWG.WindowFramework.Editor.ThemeManagerWindow.DescribeRepository ( WindowFrameThemeData data,
out string title,
out string message,
out bool warning )
inlineprivate

Describes repository source/path without scanning its contents or certifying its setup.

Parameters
dataThe collection selected by the manager or listed in its browser.
titleThe concise source label displayed beside the collection.
messageThe asset path and source-ownership explanation.
warningWhether shipped/missing source information needs warning treatment.

Opening, listing and refreshing do not run full repository verification. Actual copy/relink validation remains in the production copy operation. These labels make no setup-independence or visual-correctness claim and do not modify files or preferences.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindThemeDataFiles()

List< WindowFrameThemeData > GWG.WindowFramework.Editor.ThemeManagerWindow.FindThemeDataFiles ( )
inlineprivate
Here is the caller graph for this function:

◆ GetInstalledPackageRoot()

string GWG.WindowFramework.Editor.ThemeManagerWindow.GetInstalledPackageRoot ( )
inlineprivate

Derives this installed package's boundary from the manager script, without selecting theme data.

Returns
Project-relative package root, or null when the expected script boundary is unavailable.
Here is the caller graph for this function:

◆ LoadStyles()

void GWG.WindowFramework.Editor.ThemeManagerWindow.LoadStyles ( )
inlineprivate

Loads and applies the specified StyleSheet resource to the current EditorWindow's rootVisualElement. Attempts to load a StyleSheet named "ThemeManagerEditor". If the StyleSheet is found, it is added to the styleSheets collection of the rootVisualElement. If the StyleSheet is not found, no changes are made.

Parameters
styleSheetThe StyleSheet resource to be applied to the rootVisualElement.

This method is called when the window is first displayed or when the user refreshes the window.
It attempts to load a StyleSheet named "ThemeManagerEditor" from the project.
If the StyleSheet is found, it is added to the styleSheets collection of the rootVisualElement.
If the StyleSheet is not found, no changes are made.

Here is the caller graph for this function:

◆ LoadThemeData()

bool GWG.WindowFramework.Editor.ThemeManagerWindow.LoadThemeData ( )
inlineprivate

Loads the WindowFrameThemeData asset from the PlayerPrefs path. If the path is valid, loads the asset and returns true. If the path is invalid, returns false.

Returns
Returns true if the asset was loaded successfully, false otherwise.

This method is called when the window is first displayed or when the user refreshes the window.
It checks if a path is saved in PlayerPrefs for the theme data file.
If a path is found, it attempts to load the asset from the specified path.
If the asset is successfully loaded, it sets the WindowFrameThemeData instance and SerializedObject for later use.
Returns true if the asset was loaded successfully, false otherwise.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnDestroy()

void GWG.WindowFramework.Editor.ThemeManagerWindow.OnDestroy ( )
inlineprivate

◆ OnDisable()

void GWG.WindowFramework.Editor.ThemeManagerWindow.OnDisable ( )
inlineprivate

Releases the ownership refresh callback when the editor window is disabled.

Here is the call graph for this function:

◆ OnEnable()

void GWG.WindowFramework.Editor.ThemeManagerWindow.OnEnable ( )
inlineprivate

Restores the window title and subscribes read-only ownership presentation to project asset changes.

Deduplicates the callback across enable cycles; does not select or alter a repository.

Here is the call graph for this function:

◆ OnGUI()

void GWG.WindowFramework.Editor.ThemeManagerWindow.OnGUI ( )
inlineprivate

◆ OpenAssetsModal()

void GWG.WindowFramework.Editor.ThemeManagerWindow.OpenAssetsModal ( )
inlineprivate

Opens Browse Assets above the shared backdrop, including after repository setup has closed.

The setup form brings the backdrop forward. Restore both sibling order and display here so that the backdrop cannot intercept clicks over the reopened asset list.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OpenCreatedRepository()

void GWG.WindowFramework.Editor.ThemeManagerWindow.OpenCreatedRepository ( ThemeRepositoryCreateResult result)
inlineprivate

Opens the validated production result without instantiating UI into a scene.

Called only after the copy/wiring service returns success. The existing SelectDataFile path remembers and rebuilds the Manager for the new repository. No shipped/source selection is overwritten on failure; completed output is preserved if a later UI handoff fails.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OpenDefaultsModal()

void GWG.WindowFramework.Editor.ThemeManagerWindow.OpenDefaultsModal ( )
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ OpenRepositorySetup()

void GWG.WindowFramework.Editor.ThemeManagerWindow.OpenRepositorySetup ( )
inlineprivate

Opens setup from the canonical asset default regardless of the Manager's open collection.

The local chooser offers project repositories only; Demo-folder data is never a source. Opening setup preserves Manager selection; explicit successful creation opens the validated new repository.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PopulateRepositorySections()

void GWG.WindowFramework.Editor.ThemeManagerWindow.PopulateRepositorySections ( ScrollView scrollView,
List< WindowFrameThemeData > dataFiles )
inlineprivate

Groups existing collection rows by their inspected origin within the existing browser.

Parameters
scrollViewThe existing asset-list scroll view to populate.
dataFilesCollections already discovered by the existing asset search.

Project collections appear first; installed examples are visibly separated as demos/defaults. Neither group certifies independence, changes asset order within that group, hides a repository, nor replaces its Open/Ping/active-data controls. No collection or persisted selection is changed.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RefreshDataFilesList()

void GWG.WindowFramework.Editor.ThemeManagerWindow.RefreshDataFilesList ( ScrollView scrollView)
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RefreshRepositoryOwnershipPresentation()

void GWG.WindowFramework.Editor.ThemeManagerWindow.RefreshRepositoryOwnershipPresentation ( )
inlineprivate

Refreshes source notices after asset changes without changing selection.

No full repository audit is run; hidden browser lists are left alone.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SelectDataFile()

void GWG.WindowFramework.Editor.ThemeManagerWindow.SelectDataFile ( WindowFrameThemeData dataFile)
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetActiveAddressablesButton()

void GWG.WindowFramework.Editor.ThemeManagerWindow.SetActiveAddressablesButton ( Button button)
inlineprivate
Here is the caller graph for this function:

◆ SetAddressableLabelMenuActiveStatus()

DropdownMenuAction.Status GWG.WindowFramework.Editor.ThemeManagerWindow.SetAddressableLabelMenuActiveStatus ( DropdownMenuAction arg)
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetAddressablesMenuActiveStatus()

DropdownMenuAction.Status GWG.WindowFramework.Editor.ThemeManagerWindow.SetAddressablesMenuActiveStatus ( DropdownMenuAction arg)
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetRepositoryUiBusy()

void GWG.WindowFramework.Editor.ThemeManagerWindow.SetRepositoryUiBusy ( bool busy)
inlineprivate

Suspends Manager serialization during copying without disabling progress or cancellation.

Disabled visual controls alone do not stop OnGUI or serialized bindings. On completion, failure or cancellation, rebuilds the idle Manager through its existing initialization path and retains the same setup view so its cancellation/failure/result message is not lost. Successful creation then follows the existing OpenCreatedRepository handoff.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetupAddressableLabels()

void GWG.WindowFramework.Editor.ThemeManagerWindow.SetupAddressableLabels ( DropdownMenuAction obj)
inlineprivate
Here is the caller graph for this function:

◆ ShowWindow()

void GWG.WindowFramework.Editor.ThemeManagerWindow.ShowWindow ( )
inlinestatic

Opens or focuses the Theme Manager through its registered editor menu.

Uses the window's existing remembered/configured asset selection. It does not automatically choose the inspected controller's asset, hydrate runtime themes or save source.

Here is the caller graph for this function:

◆ ToggleAddressables()

void GWG.WindowFramework.Editor.ThemeManagerWindow.ToggleAddressables ( DropdownMenuAction dropdownMenuAction)
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ToggleAssetsModal()

void GWG.WindowFramework.Editor.ThemeManagerWindow.ToggleAssetsModal ( )
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ToggleDefaultsModal()

void GWG.WindowFramework.Editor.ThemeManagerWindow.ToggleDefaultsModal ( )
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ToggleSharedStylesheetsPanel()

void GWG.WindowFramework.Editor.ThemeManagerWindow.ToggleSharedStylesheetsPanel ( )
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ _activeAddressablesThemeData

WindowFrameThemeData GWG.WindowFramework.Editor.ThemeManagerWindow._activeAddressablesThemeData
private

◆ _assetsModalBackdrop

VisualElement GWG.WindowFramework.Editor.ThemeManagerWindow._assetsModalBackdrop
private

◆ _assetsModalContainer

VisualElement GWG.WindowFramework.Editor.ThemeManagerWindow._assetsModalContainer
private

◆ _defaultsModalContainer

VisualElement GWG.WindowFramework.Editor.ThemeManagerWindow._defaultsModalContainer
private

◆ _interactionTelemetry

System.IDisposable GWG.WindowFramework.Editor.ThemeManagerWindow._interactionTelemetry
private

Initializes and configures the visual elements of the theme manager window.
Clears existing UI components, loads necessary styles, and builds the window's layout.
.

  • Adds a toolbar with options to create, clear, and refresh themes.
  • Checks for existing theme data and displays a setup screen if no data is found.
  • Creates and displays global settings and a list of themes if data exists.

This method is called when the window is first displayed or when the user refreshes the window.
It performs the following steps:

  1. Clears the window's visual elements.
  2. Loads the necessary styles for the window.
  3. Creates a toolbar with options to create, clear, and refresh themes.
  4. Checks if there is existing theme data and displays a setup screen if not.
  5. If theme data exists, creates a list view to display the available themes.

◆ _repositorySetupView

ThemeRepositorySetupView GWG.WindowFramework.Editor.ThemeManagerWindow._repositorySetupView
private

◆ _repositoryUiSuspended

bool GWG.WindowFramework.Editor.ThemeManagerWindow._repositoryUiSuspended
private

◆ _serializedObject

SerializedObject GWG.WindowFramework.Editor.ThemeManagerWindow._serializedObject
private

◆ _settingsField

ObjectField GWG.WindowFramework.Editor.ThemeManagerWindow._settingsField
private

◆ _themeData

WindowFrameThemeData GWG.WindowFramework.Editor.ThemeManagerWindow._themeData
private

◆ _themeStudioView

ThemeStudioView GWG.WindowFramework.Editor.ThemeManagerWindow._themeStudioView
private