|
Window Framework for UI Toolkit v2.0.x
|
Represents a customizable window frame for UI elements in Unity. Provides functionality for resizing, moving, locking, and saving window state. Includes support for themes, tooltips, and context menus. More...


Public Member Functions | |
| WindowFrame () | |
| Represents a custom UI element serving as a container for window-based content, including a header, content, and footer, providing event handling and theme adaptability for Unity's UI Toolkit. | |
| void | CloseWindow (bool forceAll=false) |
| Closes the window if allowed. | |
| void | DockTab (WindowFrame incoming) |
| Docks an incoming standalone WindowFrame into this window as a nested tab. | |
| void | DockTo (WindowDockState targetState) |
| Applies the specified programmatic dock geometry, preserving initial floating bounds. | |
| void | ExitFullscreenToCursor (Vector2 cursorPos) |
| Exits fullscreen mode and pre-positions the restored floating window centered horizontally under the cursor. | |
| void | Hide () |
| Hides the window while keeping it in memory. | |
| void | SetOpeningPosition () |
| Sets the opening position of the window based on the selected position. Options include: TopLeft, Top, TopRight, Left, Center, Right, BottomLeft, Bottom, BottomRight. | |
| void | Show () |
| Shows the window by setting its display style to flex and opacity to 1.0f. | |
| void | SwitchToTab (int index) |
| Switches the active view to display the specified nested tab's content. | |
| void | Undock (Vector2? cursorPos=null) |
| Undocks the window frame, restoring its pre-dock floating size and positioning. | |
| WindowFrame | UndockTab (int index, Vector2? mousePos=null) |
| Undocks a nested tab back into an independent standalone WindowFrame. | |
Properties | |
| bool | Active [get, set] |
| Gets or sets whether the window is active. | |
| int | ActiveTabIndex [get] |
| Gets the current tab-selection index; interpret against the current live tab list. | |
| bool | AllowClose = true [get, set] |
| Gets or sets whether the window can be closed. | |
| bool | AllowFullscreen = true [get, set] |
| Determines whether the window frame can toggle to fullscreen mode. | |
| bool | AllowLock [get, set] |
| Gets or sets whether the window can be locked. | |
| bool | AllowMove = true [get, set] |
| Gets or sets whether the window can be moved. | |
| bool | AllowMultipleInstances = true [get, set] |
| Gets or sets whether multiple instances of this window are allowed. | |
| bool | AllowResize [get, set] |
| Gets or sets whether the window can be resized. | |
| bool | AllowTabDocking = true [get, set] |
| Gets or sets whether this window can participate in tabbed window nesting and docking. | |
| VisualElement | Content [get, set] |
| Gets or sets the content area of the window. | |
| override VisualElement | contentContainer [get] |
| Overrides the contentContainer to return the window's content area instead of the root. | |
| ContextMenuConfig | ContextMenuConfig [get, set] |
| Gets or sets the context menu configuration for this window. | |
| float | DefaultHeight [get, set] |
| float | DefaultWidth [get, set] |
| WindowDockState | DockState [get, set] |
| Gets/sets docking metadata; assignment alone does not reposition or resize this window. | |
| WindowFrameDragger | Dragger [get] |
| Gets the installed header dragger, which can be null before scheduled setup. | |
| VisualElement | FooterToolbar [get, set] |
| Gets or sets the toolbar in the footer area of the window. | |
| bool | Fullscreen [get, set] |
| Gets or sets whether the window is in fullscreen mode. | |
| bool | Locked [get, set] |
| Gets or sets whether the window is locked. | |
| bool | LockedFullscreen [get, set] |
| Determines whether the fullscreen mode of the window is locked, preventing the user from toggling fullscreen on or off. | |
| bool | LockedToStartPosition [get, set] |
| Gets or sets whether the window is locked to its start position. | |
| float | MinHeight [get, set] |
| Gets or sets the minimum height of the window. | |
| float | MinWidth [get, set] |
| Gets or sets the minimum width of the window. | |
| IReadOnlyList< WindowTabEntry > | NestedTabs [get] |
| Gets the live nested-tab list through a read-only interface, not an independent snapshot. | |
| string | OptionsMenuTooltip [get, set] |
| Gets or sets the tooltip for the options menu button. | |
| string | ParentObjectId [get, set] |
| Gets or sets the ID of the parent object associated with the window. | |
| Rect | PreDockRect [get, set] |
| Gets/sets floating restore bounds in parent layout coordinates. | |
| string | ResizeAreaTooltip [get, set] |
| Gets or sets the tooltip for the resize area. | |
| bool | ShowFooter [get, set] |
| Gets or sets whether the footer is visible. | |
| bool | ShowHeader [get, set] |
| Gets or sets whether the header is visible. | |
| WindowFramePosition | StartPosition [get, set] |
| Gets or sets the position of the window frame. | |
| List< StyleSheet > | StyleSheet [get, set] |
| Gets or sets the stylesheet applied to the window. | |
| string | Title [get, set] |
| Gets or sets the title of the window. | |
| string | WindowId [get, set] |
| Gets or sets the unique ID of the window. | |
| bool | WindowMemoryEnabled = false [get, set] |
| Gets or sets whether the window memory is enabled. | |
Events | |
| static Action< WindowFrame > | OnWindowFrameAdded |
| Event triggered when a new WindowFrame is added to the panel. | |
| static Action< WindowFrame > | OnWindowFrameRemoved |
| Event triggered when a WindowFrame is removed from the panel. | |
Private Member Functions | |
| void | ApplyControllerTheme (List< StyleSheet > newTheme, List< StyleSheet > oldTheme) |
| Applies controller-owned sheets, or records them until ordinary runtime attachment. | |
| void | ApplyOpeningPosition () |
| Submits the existing nine-position calculation without revealing the window. | |
| void | Close () |
| Performs complete window closure and cleanup. | |
| void | CompleteOpeningGeometry () |
| Applies ordinary runtime restoration/placement after the first styled layout. | |
| ContextMenuConfig | ContextMenuDefaultConfig () |
| Creates the default context menu configuration with standard window operations. | |
| void | CreateLayout () |
| Creates the basic layout structure of the window by adding header, sub-header tab bar, content, and footer. | |
| void | CreatePerimeterResizeHandles () |
| Creates and attaches the 8 perimeter edge and corner resize handles to the window frame. | |
| VisualElement | CreateTabButton (WindowTabEntry entry, int index) |
| void | GeometryChangeCallback (GeometryChangedEvent evt) |
| Called whenever a change in the window geometry occurs. | |
| bool | HandleMultipleInstanceCheck () |
| Checks if multiple instances are allowed and handles singleton behavior. | |
| bool | InitializeWindowGeometry () |
| Dispatches first-layout initialization to the existing ordinary or immediate path. | |
| void | KeepOnScreen () |
| Ensures the window remains within screen boundaries. | |
| WindowFrameData | LoadWindowData () |
| Reads eligible saved state after styling; never initializes or resets geometry. | |
| void | OnAttachToPanel (AttachToPanelEvent evt) |
| Handles the panel attach event. | |
| void | OnClickEvent (ClickEvent evt) |
| Handles click events on the window for activation. | |
| void | OnDetachFromPanel (DetachFromPanelEvent evt) |
| Handles the panel detach event for proper cleanup. | |
| void | OnOnScreenSizeChanged (GeometryChangedEvent evt) |
| Handles screen size changes by repositioning windows as needed. | |
| void | OnWindowMove () |
| Called when the window is moved, starts a resetable timmer watching for idle and then save the window data. | |
| void | RegisterCallbacks () |
| Registers all necessary event callbacks for window functionality. | |
| System.Collections.IEnumerator | RevealAfterOpeningLayout (bool restoredVisible, double startedAt, Rect beforeRestoration) |
| Continues layout after restoration/placement, then reveals the ordinary window. | |
| void | SaveWindowData () |
| Save window data. | |
| void | SaveWindowData (bool isOpen) |
| Saves the window data to the WindowFrameController. | |
| void | SetFullScreenMode (bool value) |
| Toggles the fullscreen mode for the window frame. | |
| void | SetHeaderFade () |
| Updates header visual appearance based on active state. | |
| void | UnregisterCallbacks () |
| Unregisters all event callbacks to prevent memory leaks. | |
| void | UpdatePerimeterResizeHandles (bool visible) |
| Synchronizes the visibility and interactability of all perimeter resize handles. | |
| void | UpdateTheme (List< StyleSheet > newTheme, List< StyleSheet > oldTheme) |
| Updates the theme stylesheet for the windows in the system. | |
| async void | WaitForIdle () |
| Waits for the window to not be moving for 2 seconds before saving the window data. | |
| VisualElement | WindowFrameContent () |
| Creates the content area of the WindowFrame custom control. | |
| VisualElement | WindowFrameFooter () |
| Generates the Footer portion of a WindowFrame custom control. | |
| VisualElement | WindowFrameHeader () |
| Generates the header portion of a WindowFrame custom control. | |
| VisualElement | WindowFrameTabBar () |
| Creates the sub-header tab bar container used when multiple windows are nested together. | |
Static Private Member Functions | |
| static void | ApplyContentStyles (VisualElement newContentContainer) |
| Applies standard content styling to a container element. | |
| static void | BindThemeCursor (VisualElement element, string token) |
Private Attributes | |
| bool | _active = true |
| Indicates whether the window is currently active/focused. | |
| int | _activeTabIndex = 0 |
| Index of the currently active/visible tab. | |
| bool | _allowLock = true |
| Indicates whether the window can be locked. | |
| bool | _allowResize = true |
| Indicates whether the window can be resized. | |
| IPanel | _cachedPanel |
| VisualElement | _content |
| Content area of the window where main UI elements are placed. | |
| ContextMenuConfig | _contextMenuConfig |
| Configuration for the context menu associated with this window. | |
| bool | _controllerThemePending |
| List< StyleSheet > | _controllerThemeSheets |
| float | _defaultHeight = 300 |
| Gets or sets the stored creation-time height of the window. | |
| float | _defaultWidth = 300 |
| Gets or sets the stored creation-time width of the window. | |
| WindowDockState | _dockState = WindowDockState.Floating |
| The current screen dock state of the window. | |
| WindowFrameDragger | _dragger |
| Manipulator handling window drag operations. | |
| VisualElement | _footer |
| Footer area of the window containing toolbar and resize handle. | |
| VisualElement | _footerToolbar |
| Toolbar element in the footer area. | |
| VisualElement | _footerToolbarArea |
| Container for the footer toolbar. | |
| bool | _fullScreen |
| Indicates whether the window is in fullscreen mode. | |
| VisualElement | _header |
| Header area of the window containing title and controls. | |
| float | _lastMoveTime |
| Timestamp of the last window move operation. | |
| Vector2 | _lastPosition |
| Last recorded position of the window for change detection. | |
| Vector2 | _lastSize |
| Last recorded size of the window for change detection. | |
| bool | _locked |
| Indicates whether the window is currently locked. | |
| bool | _lockedFullScreen = false |
| Whether fullscreen mode is locked and cannot be changed. | |
| bool | _lockedToStartPosition = false |
| Whether the window is locked to its start position. | |
| VisualElement | _lockIndicator = new Button() |
| Button indicator for locking/unlocking the window. | |
| float | _minHeight = 50 |
| Minimum height of the window in pixels. | |
| float | _minWidth = 50 |
| Minimum width of the window in pixels. | |
| readonly List< WindowTabEntry > | _nestedTabs = new List<WindowTabEntry>() |
| Ordered list of nested tabs currently docked inside this window frame. | |
| bool | _openingMemoryGeometry |
| Guards ordinary hidden opening geometry until the reveal continuation completes. | |
| bool | _openingStylesApplied |
| VisualElement | _optionsMenu = new Button() |
| Button for opening the options menu. | |
| bool | _origAllowMove |
| Original value of the allow move flag before fullscreen. | |
| bool | _origAllowResize |
| Original value of the allow resize flag before fullscreen. | |
| float | _origBorderBLRadius |
| Original bottom-left border radius value before fullscreen. | |
| float | _origBorderBRRadius |
| Original bottom-right border radius value before fullscreen. | |
| float | _origBorderTLRadius |
| Original top-left border radius value before fullscreen. | |
| float | _origBorderTRRadius |
| Original top-right border radius value before fullscreen. | |
| float | _origHeight |
| Original height before fullscreen mode. | |
| float | _origWidth |
| Original width before fullscreen mode. | |
| float | _origX |
| Original X position before fullscreen mode. | |
| float | _origY |
| Original Y position before fullscreen mode. | |
| bool | _overrideStartPosition |
| Indicates whether to override the default start position. | |
| string | _parentObjectId |
| ID of the parent object associated with the window. | |
| List< StyleSheet > | _pendingControllerTheme |
| List< StyleSheet > | _pendingOldControllerTheme |
| readonly List< VisualElement > | _perimeterResizeHandles = new List<VisualElement>() |
| Collection of perimeter edge and corner resize handles for 8-directional resizing. | |
| Rect | _preDockRect |
| Pre-dock floating bounds preserved for tear-off / undock restoration. | |
| VisualElement | _resizeArea = new VisualElement() |
| Area for resizing the window, typically in the bottom-right corner. | |
| Color | _resolvedHeaderBgColor |
| The resolved background color for the active header state. | |
| Color | _resolvedHeaderBgColorInactive |
| The resolved background color for the inactive header state. | |
| WindowFramePosition | _selectedPosition = WindowFramePosition.TopLeft |
| Initial positioning preference for the window. | |
| bool | _showFooter = true |
| Indicates whether the footer is visible. | |
| bool | _showHeader = true |
| Indicates whether the header is visible. | |
| List< StyleSheet > | _styleSheet |
| List of stylesheets applied to the window. | |
| VisualElement | _tabBar |
| Dedicated sub-header tab bar element shown when multiple windows are nested together. | |
| VisualElement | _tabContainer |
| Container holding the visual tab items inside the tab bar. | |
| string | _title = "Window Title" |
| Title of the window displayed in the header. | |
| Label | _titleLabel = new Label() |
| Label displaying the window title in the header. | |
| bool | _waitingForIdle |
| Indicates whether the window is waiting for idle state before saving data. | |
Static Private Attributes | |
| static readonly CustomStyleProperty< Color > | s_CustomColor = new("--windowFrame__header-background-color") |
| Custom style property for header background color theming. | |
Represents a customizable window frame for UI elements in Unity. Provides functionality for resizing, moving, locking, and saving window state. Includes support for themes, tooltips, and context menus.
WindowFrame is a comprehensive window system that provides desktop-style window functionality including:
Ordinary runtime creation and opening sequence:
While this opening sequence is in progress, the opening-memory guard prevents saving intermediate geometry, bounds correction and public scheduled positioning from revealing or repositioning the initializing window. WindowMemoryEnabled=false performs no per-window saved-state lookup. Later theme changes use the same existing sheet application methods, not another opening initialization or a default-size reset.
Explicit DefaultWidth/DefaultHeight assignments while detached write inline dimensions and retain normal UI Toolkit precedence over USS. Their stored initial values alone do not impose a physical 300-by-300 runtime rectangle. Editor initialization and controller-owned modal presentation are separate paths; modal cards are content, not independently opening ordinary windows.
|
inline |
Represents a custom UI element serving as a container for window-based content, including a header, content, and footer, providing event handling and theme adaptability for Unity's UI Toolkit.
The constructor performs comprehensive initialization including:
Runtime construction is hidden; Editor preview outside Play Mode is visible. The existing inline 20-unit minimum dimensions and absolute positioning are retained. CreateLayout builds the child structure, and RegisterCallbacks publishes the construction notification and registers the one-shot first-layout initializer. Developer constructor or object-initializer settings are supplied before mounting; they must not be reinitialized after styling. A controller theme request here is queued for ordinary runtime attachment. MarkDirtyRepaint requests a repaint; it does not synchronously calculate resolved layout. Attachment, saved-state restoration/placement and reveal are described in the class remarks.


|
inlinestaticprivate |
Applies standard content styling to a container element.
| newContentContainer | The container to apply styling to |
Configures the container for flexible vertical layout with proper overflow handling. Ensures consistent content area behavior across all windows.

|
inlineprivate |
Applies controller-owned sheets, or records them until ordinary runtime attachment.
| newTheme | New controller composition; null removes the tracked local composition. |
| oldTheme | Previously published controller sheets to remove from this window. |
Before ordinary runtime opening styles are ready, copies the supplied lists into the existing pending fields without applying them. OnAttachToPanel marks styles ready before consuming those fields, so the same method performs the actual sheet changes there. Editor and modal-owned calls are not deferred. Subsequent controller notifications remove the published old sheets and the previously tracked local controller sheets, install the new composition and retain its references. This does not clear arbitrary purchaser sheets, write dimensions, restore memory or wait for layout. Panel scopes publish a null local composition because the controller installs their sheets on the panel visual tree.


|
inlineprivate |
Submits the existing nine-position calculation without revealing the window.
Uses Screen.width/height and this window's current calculated layout size to assign left/top, then marks repaint. CompleteOpeningGeometry invokes it only when no eligible record exists and the existing position policy requires it. A restored record is not followed by this calculation. SetOpeningPosition is the separate public scheduled wrapper, with its own modal/opening/explicit-position guards and visibility behavior. No new alignment, docking, coordinate polling or default sizing is performed here.

|
inlinestaticprivate |


|
inlineprivate |
Performs complete window closure and cleanup.
Handles the full window closure process including:


|
inline |
Closes the window if allowed.
| forceAll | Forces closure regardless of permissions when true |
Respects AllowClose and Locked unless forceAll is true, for this instance only. Performs registered framework callback teardown, detaches, requests closed-state saving and clears controller activation. Requires the existing controller; callback teardown is not disposal of every application subscription/resource. Unlike Hide or reparenting, Close removes attach handling, so Show alone does not recreate a closed instance's wiring. Construct a fresh concrete window through the application lifecycle when reopening. No return value certifies persistence, layout or a business operation.


|
inlineprivate |
Applies ordinary runtime restoration/placement after the first styled layout.
Called from InitializeWindowGeometry, not from a repeated geometry polling loop. Reads memory only when enabled and not locked to StartPosition. A record supplies size and opacity; its visibility is retained for reveal rather than exposing the window now. Saved coordinates are applied only when no explicit position override owns them. Without a record, ApplyOpeningPosition runs when no override exists or StartPosition is locked; otherwise the supplied position remains. No default width, height or opacity reset occurs in this path. Finally starts RevealAfterOpeningLayout on the existing controller when available. This method does not create a controller, save a hidden window or perform a second placement after restoring saved coordinates.


|
inlineprivate |
Creates the default context menu configuration with standard window operations.
Provides a standard context menu with common window operations. Each item includes appropriate visibility and enabled logic based on window permissions. Serves as an example for creating custom context menu configurations.

|
inlineprivate |
Creates the basic layout structure of the window by adding header, sub-header tab bar, content, and footer.
Establishes the window structure in the correct hierarchical Order. Each section is created and configured for its specific purpose.


|
inlineprivate |
Creates and attaches the 8 perimeter edge and corner resize handles to the window frame.
Enables 8-directional edge and corner resizing (Left, Right, Top, Bottom, and Corners). Handles are positioned absolutely along the boundary and added directly to VisualElement.hierarchy so they overlay the perimeter without interfering with the internal header, content, and footer flow.


|
inlineprivate |


|
inline |
Docks an incoming standalone WindowFrame into this window as a nested tab.
| incoming | Existing standalone window whose content and footer are transferred, not cloned. |
Null, self and either window's AllowTabDocking=false are rejected without changes. Direct invocation does not consult the global gesture preference or ordinary close permission. First docking wraps the host's existing content as tab zero. Incoming content children are reparented into a new wrapper; its SourceWindow remains retained and is detached from the hierarchy. Detach-driven application resources must tolerate that ownership transition. Updates an existing guest memory record's host key when available, activates the new tab and schedules host saving. Does not construct application content or dispose the guest.


|
inline |
Applies the specified programmatic dock geometry, preserving initial floating bounds.
| targetState | Supported dock enum; Floating delegates to Undock. |
Direct call does not check global gesture preferences, AllowMove or Locked. It uses parent resolved size, falling back to Screen dimensions when unavailable. Call after attached layout for scaled-panel geometry. Half/maximized rectangles are applied inline; this does not set Fullscreen, perform an immediate save or clamp every size against application minimums. Unsupported enum values change metadata without a matching rectangle branch.

|
inline |
Exits fullscreen mode and pre-positions the restored floating window centered horizontally under the cursor.
| cursorPos | Pointer coordinates in the window parent's layout space. |
No-op unless fullscreen and neither LockedFullscreen nor Locked. Restores retained size and places it horizontally under the pointer with a 15-unit header offset. Left/top clamp to zero; this method alone does not fully clamp right/bottom, start mouse capture, save immediately or establish application drag permission. The dragger owns handoff.

|
inlineprivate |
Called whenever a change in the window geometry occurs.
| evt | The geometry change event data |
Handles window geometry changes by tracking position and size changes. Implements idle detection to avoid excessive save operations during continuous movement. Respects LockedToStartPosition setting by resetting position when needed.


|
inlineprivate |
Checks if multiple instances are allowed and handles singleton behavior.
When AllowMultipleInstances is false, searches for existing instances of the same type. If found, activates the existing instance and marks the new one for destruction. Only performs check during runtime to avoid editor issues.


|
inline |
Hides the window while keeping it in memory.
Removes the window from layout while retaining the instance/hierarchy for ordinary windows. When ModalPresentationOwned is true, asks the controller to release that modal presentation before setting display None and visible false. Schedules remembered hidden state; does not dispose application resources or perform the complete CloseWindow callback teardown.

|
inlineprivate |
Dispatches first-layout initialization to the existing ordinary or immediate path.
The one-shot GeometryChangedEvent callback calls this after attachment and initial layout. Ordinary runtime windows call CompleteOpeningGeometry and return before all lower fallback/default/fullscreen writes. The remaining immediate path belongs to Editor or ModalPresentationOwned initialization: it retains eligible memory handling, opacity/fullscreen and default fallback logic plus scheduled activation. Controller-owned modal presentation controls its own launch/reveal; do not treat that path or its card content as ordinary opening.


|
inlineprivate |
Ensures the window remains within screen boundaries.
Adjusts window position to prevent it from moving off-screen. Handles all four screen edges and maintains window visibility. Called automatically during positioning operations.

|
inlineprivate |
Reads eligible saved state after styling; never initializes or resets geometry.
Requires runtime, WindowMemoryEnabled, an unlocked StartPosition, a controller and, for an ordinary window, completed opening stylesheet application. Reads only; size, opacity, coordinates and eventual visibility are applied by the initialization caller. Disabled memory performs no controller lookup. No record is fabricated and no default dimensions are written.


|
inlineprivate |
Handles the panel attach event.
| evt | The attach event data |
Reconnects this instance's controller theme subscription and applies window-local composition when the configured scope requires it. Schedules portable-control refresh and a bounds check. This method does not publish OnWindowFrameAdded; that notification is emitted by RegisterCallbacks during construction, before usable attached geometry.
For initial ordinary runtime attachment, first selects the local controller request: WindowsFramesOnly (or absent theme data) uses CurrentThemeStylesheets; panel scopes use null locally because their sheets are installed by the controller on the panel visual tree. Then sets the opening-memory guard and marks opening styles ready before consuming pending controller lists through ApplyControllerTheme and adding assigned window sheets through UpdateTheme. Setting readiness first prevents those existing calls from requeuing startup application. Inherited ancestor/panel sheets can already affect the window at attachment.
The first geometry callback subsequently handles restoration/placement, followed by the reveal continuation. This method neither restores saved data nor assigns default sizes. Reattachment reconnects themes without repeating the initial guarded stylesheet stage once it is ready. The scheduled KeepOnScreen call respects modal/opening geometry guards.


|
inlineprivate |
Handles click events on the window for activation.
| evt | The click event data |
Sets this window as the active window when clicked (except options menu clicks). Only operates during play mode to avoid editor interference. Uses WindowFrameController to properly manage window activation.


|
inlineprivate |
Handles the panel detach event for proper cleanup.
| evt | The detach event data |
Triggered when this window itself detaches. Removes its controller-theme subscription, publishes OnWindowFrameRemoved and releases cached panel geometry observation. It does not perform full Close teardown: attach callbacks remain for reparenting and theme reconnection. Caller-owned content subscriptions/resources are not disposed here.


|
inlineprivate |
Handles screen size changes by repositioning windows as needed.
| evt | The geometry change event from the screen/panel |
Responds to screen resolution changes or panel size modifications. Updates window position if LockedToStartPosition is true. Ensures windows remain on screen after size changes.


|
inlineprivate |
Called when the window is moved, starts a resetable timmer watching for idle and then save the window data.
Tracks the last move time and initiates idle detection to batch save operations. Prevents excessive saving during continuous window movement operations.


|
inlineprivate |
Registers all necessary event callbacks for window functionality.
Sets up comprehensive event handling including:
The one-shot GeometryChangedEvent callback records the first calculated rectangle and calls InitializeWindowGeometry. This is not a repeating initialization/default-sizing loop. OnWindowFrameAdded is published immediately during this constructor call, before attachment and usable geometry; attachment itself reconnects theme ownership separately. Ongoing geometry, panel-size and interaction callbacks are registered by the existing delayed scheduler. Their save/bounds paths respect the opening guard rather than requiring a save before reveal.


|
inlineprivate |
Continues layout after restoration/placement, then reveals the ordinary window.
| restoredVisible | Saved visibility, or true when no eligible record was found. |
| startedAt | Existing startup telemetry timestamp for this opening stage. |
| beforeRestoration | Earlier layout retained only for diagnostic comparison. |
Two yield-return-null continuations allow subsequent Unity frames to calculate the submitted geometry. They are not wall-clock waits, repeated stable-size checks or an arbitrary render-fence guarantee. If panel is null afterward, exits without revealing or clearing the opening guard. Otherwise applies intended visibility, clears the guard, logs the current layout and requests activation through the existing controller. Does not write dimensions, reposition, save state or restart theme application.


|
inlineprivate |
Save window data.
Convenience method that saves window data with current visibility state. Uses the more detailed SaveWindowData(bool) method internally.


|
inlineprivate |
Saves the window data to the WindowFrameController.
| isOpen | Whether the window is currently open |
Saves comprehensive window state including position, size, visibility, lock state, and other properties. Only saves if WindowMemoryEnabled is true and proper identification is available. Creates a unique data KeyValue combining type, parent ID, and window ID.

|
inlineprivate |
Toggles the fullscreen mode for the window frame.
| value | A boolean indicating whether to enable or disable fullscreen mode. |
Manages fullscreen state by storing original dimensions and settings. Temporarily disables resize and move capabilities in fullscreen mode. Restores original state when exiting fullscreen. Respects AllowFullscreen, Locked, and LockedFullscreen properties.

|
inlineprivate |
Updates header visual appearance based on active state.
Applies different opacity levels to provide visual feedback about window focus:
|
inline |
Sets the opening position of the window based on the selected position. Options include: TopLeft, Top, TopRight, Left, Center, Right, BottomLeft, Bottom, BottomRight.
Calculates window position based on screen dimensions and window size. Respects LockedToStartPosition and _overrideStartPosition settings. Uses scheduled execution to ensure layout calculations are complete.


|
inline |
Shows the window by setting its display style to flex and opacity to 1.0f.
Sets display to Flex, visible to true and opacity to one on this existing instance. It does not mount a detached window or complete opening geometry synchronously. Modal ownership/input gates can still restrict interaction. Read resolved layout after a layout pass, not immediately from this call. Schedules SaveWindowData through the element scheduler.

|
inline |
Switches the active view to display the specified nested tab's content.
| index | Zero-based live tab index; invalid values leave state unchanged. |
Updates active index, title and selected classes; inactive wrappers stay attached with display None. Reparents the active entry's footer into the visible footer toolbar and applies that entry's footer visibility. Hidden tab content is not detached/disposed by this operation. It does not itself invoke SaveWindowData; persistence depends on other save paths.


|
inline |
Undocks the window frame, restoring its pre-dock floating size and positioning.
| cursorPos | Optional cursor position to anchor the restored window. |


|
inline |
Undocks a nested tab back into an independent standalone WindowFrame.
| index | Index of the tab to undock. |
| mousePos | Optional cursor position to place the restored window. |
Undocking does not close or destroy tab content. Guest children/footer move back to their source window. Removing the original host tab promotes another source window to retain the group. An optional pointer position sets opening placement; geometry can settle later and the guest reveal is scheduled. Requires a controller root or usable parent to mount. This direct method does not recheck AllowTabDocking/Locked/AllowClose. The tab's X button calls this operation, so it means detach, not a business cancellation or CloseWindow.


|
inlineprivate |
Unregisters all event callbacks to prevent memory leaks.
Removes all registered event callbacks including:


|
inlineprivate |
Synchronizes the visibility and interactability of all perimeter resize handles.
| visible | True if resizing is allowed and handles should be active. |
|
inlineprivate |
Updates the theme stylesheet for the windows in the system.
| newTheme | The new stylesheet to apply |
| oldTheme | The old stylesheet to remove |
Removes only supplied old references that are present locally, then adds non-null new references in supplied order and marks repaint. It does not clear the entire stylesheet collection, remove inherited panel sheets, write inline dimensions or synchronously wait for layout. Startup calls are ordered by OnAttachToPanel before the first geometry callback; later theme changes reuse this same operation without restarting ordinary opening.


|
inlineprivate |
Waits for the window to not be moving for 2 seconds before saving the window data.
Implements asynchronous idle detection to batch save operations. Waits 1 second of inactivity before saving to avoid excessive file operations. Includes error handling for async operation failures.


|
inlineprivate |
Creates the content area of the WindowFrame custom control.
Creates the main content container with appropriate flex layout settings. This is where application content should be placed.


|
inlineprivate |
Generates the Footer portion of a WindowFrame custom control.
Creates the footer with toolbar area and resize handle. Configured for proper layout and resize functionality.


|
inlineprivate |
Generates the header portion of a WindowFrame custom control.
Creates the header with title label, lock indicator, and options menu. Configured for dragging and proper event handling.


|
inlineprivate |
Creates the sub-header tab bar container used when multiple windows are nested together.

|
private |
Indicates whether the window is currently active/focused.
|
private |
Index of the currently active/visible tab.
|
private |
Indicates whether the window can be locked.
|
private |
Indicates whether the window can be resized.
|
private |
|
private |
Content area of the window where main UI elements are placed.
|
private |
Configuration for the context menu associated with this window.
|
private |
|
private |
|
private |
Gets or sets the stored creation-time height of the window.
An explicit assignment while panel is null also writes the inline height. Assign before attachment when a code-supplied initial height is required; inline sizing retains normal precedence over USS. After attachment the setter only stores the value and does not resize the live window. Ordinary runtime opening never reapplies it when saved data is absent. The initial backing value of 300 does not itself assign an inline height. Other existing geometry paths can read this value as a fallback; it is not a new runtime defaults stage.
|
private |
Gets or sets the stored creation-time width of the window.
An explicit assignment while panel is null also writes the inline width. Assign before attachment when a code-supplied initial width is required; inline sizing retains normal precedence over USS. After attachment the setter only stores the value and does not resize the live window. Ordinary runtime opening never reapplies it when saved data is absent. The initial backing value of 300 does not itself assign an inline width. Other existing geometry paths can read this value as a fallback; it is not a new runtime defaults stage.
|
private |
The current screen dock state of the window.
|
private |
Manipulator handling window drag operations.
|
private |
Footer area of the window containing toolbar and resize handle.
|
private |
Toolbar element in the footer area.
|
private |
Container for the footer toolbar.
|
private |
Indicates whether the window is in fullscreen mode.
|
private |
Header area of the window containing title and controls.
|
private |
Timestamp of the last window move operation.
|
private |
Last recorded position of the window for change detection.
|
private |
Last recorded size of the window for change detection.
|
private |
Indicates whether the window is currently locked.
|
private |
Whether fullscreen mode is locked and cannot be changed.
|
private |
Whether the window is locked to its start position.
|
private |
Button indicator for locking/unlocking the window.
|
private |
Minimum height of the window in pixels.
|
private |
Minimum width of the window in pixels.
|
private |
Ordered list of nested tabs currently docked inside this window frame.
|
private |
Guards ordinary hidden opening geometry until the reveal continuation completes.
Set during initial runtime attachment. Saving, bounds correction and public positioning consult this guard so intermediate layout cannot overwrite remembered state or reveal/reposition the window. It is not a saved-data record or another sizing policy.
|
private |
|
private |
Button for opening the options menu.
|
private |
Original value of the allow move flag before fullscreen.
|
private |
Original value of the allow resize flag before fullscreen.
|
private |
Original bottom-left border radius value before fullscreen.
|
private |
Original bottom-right border radius value before fullscreen.
|
private |
Original top-left border radius value before fullscreen.
|
private |
Original top-right border radius value before fullscreen.
|
private |
Original height before fullscreen mode.
|
private |
Original width before fullscreen mode.
|
private |
Original X position before fullscreen mode.
|
private |
Original Y position before fullscreen mode.
|
private |
Indicates whether to override the default start position.
|
private |
ID of the parent object associated with the window.
|
private |
|
private |
|
private |
Collection of perimeter edge and corner resize handles for 8-directional resizing.
|
private |
Pre-dock floating bounds preserved for tear-off / undock restoration.
|
private |
Area for resizing the window, typically in the bottom-right corner.
|
private |
The resolved background color for the active header state.
|
private |
The resolved background color for the inactive header state.
|
private |
Initial positioning preference for the window.
|
private |
Indicates whether the footer is visible.
|
private |
Indicates whether the header is visible.
|
private |
List of stylesheets applied to the window.
|
private |
Dedicated sub-header tab bar element shown when multiple windows are nested together.
|
private |
Container holding the visual tab items inside the tab bar.
|
private |
Title of the window displayed in the header.
|
private |
Label displaying the window title in the header.
|
private |
Indicates whether the window is waiting for idle state before saving data.
|
staticprivate |
Custom style property for header background color theming.
|
getset |
Gets or sets whether the window is active.
Active state affects visual appearance (inactive windows appear dimmed). Only one window should be active at a time. Managed by WindowFrameController.
|
get |
Gets the current tab-selection index; interpret against the current live tab list.
|
getset |
Gets or sets whether the window can be closed.
When disabled, users cannot close the window through normal means. Can still be closed programmatically with CloseWindow(true).
|
getset |
Determines whether the window frame can toggle to fullscreen mode.
When disabled, users cannot toggle fullscreen through context menu or double-click. The Fullscreen property can still be set programmatically if needed.
|
getset |
Gets or sets whether the window can be locked.
When enabled, users can lock/unlock through context menu or lock indicator. Locked windows cannot be moved, resized, or closed by normal interactions.
|
getset |
Gets or sets whether the window can be moved.
When enabled, users can drag the header to reposition the window. Movement is constrained to keep window within screen bounds. Automatically disabled when locked or in fullscreen mode.
|
getset |
Gets or sets whether multiple instances of this window are allowed.
When false, creating a new instance will activate the existing one instead. Useful for singleton windows like settings or main inventory.
|
getset |
Gets or sets whether the window can be resized.
When enabled, users can drag the resize handle to change dimensions. Subject to MinWidth/MinHeight constraints and disabled when locked.
|
getset |
Gets or sets whether this window can participate in tabbed window nesting and docking.
|
getset |
Gets or sets the content area of the window.
The main container where application UI elements should be placed. When set, existing content is removed and tooltips are automatically applied. This is where forms, data displays, and interactive controls go.
|
get |
Overrides the contentContainer to return the window's content area instead of the root.
This ensures that elements added directly to the WindowFrame are placed in the content area rather than the root, maintaining the window's internal structure while providing intuitive behavior.
|
getset |
Gets or sets the context menu configuration for this window.
If no custom configuration is provided, a default context menu is generated with standard window operations (fullscreen, lock, close). Custom configurations can add application-specific options.
|
getset |
|
getset |
|
getset |
Gets/sets docking metadata; assignment alone does not reposition or resize this window.
Use DockTo/Undock for geometry transitions. Arbitrary enum values are not validated here.
|
get |
Gets the installed header dragger, which can be null before scheduled setup.
Borrowed manipulator; reading it does not initialize a new drag session.
|
getset |
Gets or sets the toolbar in the footer area of the window.
Provides a dedicated area for action buttons and controls at the bottom of the window. Positioned to the left of the resize handle. Setting to null removes toolbar content.
|
getset |
Gets or sets whether the window is in fullscreen mode.
Fullscreen mode expands the window to fill the entire screen and temporarily disables movement and resizing. Original dimensions are preserved for restoration.
|
getset |
Gets or sets whether the window is locked.
When locked, the window cannot be moved, resized, or closed through normal means. Displays lock indicator and adds appropriate CSS classes for styling. Only available if AllowLock is true.
|
getset |
Determines whether the fullscreen mode of the window is locked, preventing the user from toggling fullscreen on or off.
When true, forces the window into fullscreen mode and prevents users from exiting. Creates a kiosk-style interface where the window permanently occupies the screen.
|
getset |
Gets or sets whether the window is locked to its start position.
When true, the window will always return to its StartPosition and ignore saved position data. Useful for windows that should maintain consistent positioning.
|
getset |
Gets or sets the minimum height of the window.
Enforces a lower bound on window resizing to ensure usability. Should account for header, content area, and footer visibility.
|
getset |
Gets or sets the minimum width of the window.
Enforces a lower bound on window resizing to ensure usability. Applied through both CSS styling and drag-resize operations.
|
get |
Gets the live nested-tab list through a read-only interface, not an independent snapshot.
Entry objects and their content/footer references remain mutable and borrowed. Use tab APIs for transitions; changing entries directly does not reconcile hierarchy/memory.
|
getset |
Gets or sets the tooltip for the options menu button.
Supports positioning hints using format "Position:Text" where Position can be T, B, L, or R. Provides users with information about the options menu functionality.
|
getset |
Gets or sets the ID of the parent object associated with the window.
Stable logical owner/container identity distinguishes records for the same window type. Assignment stores a string only; it does not parent UI, subscribe to a GameObject's destruction, hydrate owner data or migrate an existing persistence key. Configure it before attachment and use the same logical owner identifier on reconstruction.
|
getset |
Gets/sets floating restore bounds in parent layout coordinates.
Direct assignment performs no size validation, layout change or persistence write.
|
getset |
Gets or sets the tooltip for the resize area.
Supports positioning hints using format "Position:Text" where Position can be T, B, L, or R. Provides users with instructions for resizing the window.
|
getset |
Gets or sets whether the footer is visible.
The footer contains toolbar area and resize handle. Hiding it removes resize functionality unless handled elsewhere.
|
getset |
Gets or sets whether the header is visible.
The header contains title, options menu, and lock indicator. Hiding it removes the drag handle, so ensure alternative movement methods if needed.
|
getset |
Gets or sets the position of the window frame.
Determines where the window will initially appear on screen. Can be overridden by saved window data if WindowMemoryEnabled is true.
|
getset |
Gets or sets the stylesheet applied to the window.
Allows individual windows to have custom styling beyond the controller composition. Before ordinary runtime opening styles are ready, stores a copied assignment for application by OnAttachToPanel. This does not defer styles already inherited from ancestors or the panel. Editor, modal-owned and subsequent assignments call UpdateTheme directly; calculation of the resulting layout still belongs to UI Toolkit. Null becomes an empty list, clearing only this assignment's managed sheets. On an application exception, removes the attempted sheets and uses the current controller composition when a controller exists. This setter does not reset inline dimensions, load saved state, select another theme or reveal the window.
|
getset |
Gets or sets the title of the window.
The title is displayed in the window header and can be changed dynamically. Changes immediately update the visual title label.
|
getset |
Gets or sets the unique ID of the window.
Assign before attachment and retain it for the same logical window across sessions. Canonical persistence combines concrete type, ParentObjectId and WindowId with vertical bars. This property does not validate/reserve the key, move existing records or control AddElement's separate name-based duplicate policy. Do not use transient timestamp IDs.
|
getset |
Gets or sets whether the window memory is enabled.
Opts this instance into supported layout-record lookup/save paths when controller memory also permits them. Bare WindowFrame is excluded by the current writer; nonempty stable WindowId and a concrete application type are required. This flag does not serialize content/subscriptions, guarantee every DTO field is written or create reconstruction data.
|
static |
Event triggered when a new WindowFrame is added to the panel.
This static event allows other systems to respond to window creation for registration, initialization, or UI management purposes.
|
static |
Event triggered when a WindowFrame is removed from the panel.
This static event allows other systems to respond to window removal for cleanup, deregistration, or UI management purposes.