Game.UI.Widgets.IExpandable
Assembly: Assembly-CSharp
Namespace: Game.UI.Widgets
Type: interface
Base: —
Summary:
Interface for UI widgets that support an expanded/collapsed state. Implement this on widgets that can be shown or hidden (or that change layout/size) when toggled; the simple boolean property allows UI layout code and other systems to read or set the expansion state.
Fields
- None.
{{ The interface defines no fields. }}
Properties
public System.Boolean expanded { get; set; }
Controls whether the widget is in its expanded (true) or collapsed (false) state. Implementors should update visual/layout changes when this property is changed (for example, trigger animations or call layout invalidation).
Constructors
- None.
{{ Interfaces do not define constructors. Implementing types supply their own constructors or lifecycle methods. }}
Methods
- None.
{{ The interface exposes no methods; behavior is driven via the expanded property. }}
Usage Example
// Example implementation of IExpandable on a widget
public class MyExpandableWidget : UIComponent, IExpandable
{
private bool _expanded;
public bool expanded
{
get => _expanded;
set
{
if (_expanded == value) return;
_expanded = value;
UpdateExpansionState();
}
}
private void UpdateExpansionState()
{
if (_expanded)
{
// expand: enable content, play animation, update layout, etc.
}
else
{
// collapse: hide content, play animation, update layout, etc.
}
// If using a layout system, notify it to re-layout:
// InvalidateLayout();
}
}
Notes: - Implementors should ensure changing expanded leads to appropriate visual and layout updates. - Consider persisting the expanded state if the widget's visibility should be remembered across sessions.