Gondwana Game Engine Development (master) - 2.6.1
Gondwana is a cross-platform 2.5D game and rendering engine written in C#/.NET 8. It provides fine-grained control over rendering, timing, and scene composition, with built-in support for parallax, z-ordering, pixel overhang, collision detection, and particle effects. Gondwana targets desktop and web platforms using SkiaSharp for graphics and pluggable audio backends for desktop and browser targets.
Loading...
Searching...
No Matches
Gondwana.Widgets.Controls.TabControlWidget Class Referencesealed

Provides a tabbed container whose pages own ordinary Gondwana widgets. More...

Inheritance diagram for Gondwana.Widgets.Controls.TabControlWidget:
Gondwana.Widgets.ContainerWidget Gondwana.Widgets.WidgetBase Gondwana.Drawing.Direct.DirectComposite Gondwana.Drawing.Direct.IDirectCompositeChild Gondwana.Drawing.Direct.IDirectCompositeContainer Gondwana.Drawing.Direct.IDirectDrawable Gondwana.Physics.Movement.IMovable Gondwana.Drawing.IDrawable

Public Member Functions

 TabControlWidget (RenderSurfaceHostBase renderSurfaceHost, View view, Rectangle bounds, string? nickname=null)
 Creates a view-level tab control.
 TabControlWidget (RenderSurfaceHostBase renderSurfaceHost, SceneLayer sceneLayer, Rectangle bounds, string? nickname=null)
 Creates a scene-layer tab control.
TabPageWidget AddTab (string title, char? mnemonic=null, string? nickname=null)
 Adds a page to the end of the tab strip.
bool RemoveTab (TabPageWidget page, bool dispose=false)
 Removes a page from the tab control.
TabControlWidget SelectTab (int index)
 Selects the page at the supplied tab index.
TabControlWidget SelectTab (TabPageWidget page)
 Selects the supplied page.
TabControlWidget MoveTab (int fromIndex, int toIndex)
 Moves one page to a different tab index.
TabControlWidget MoveTab (TabPageWidget page, int toIndex)
 Moves the supplied page to a different tab index.
TabControlWidget Relayout ()
 Recomputes header and page layout after changing a size or tab-layout setting.
TabControlWidget SetTabColors (Color normal, Color hover, Color pressed, Color selected)
 Sets the tab header colors.
TabControlWidget SetTabTextColor (Color color)
 Sets the color used by tab-header labels.
TabControlWidget SetTabControlZOrder (int zOrder)
 Sets the base Z-order for all page and header visuals.
override void Dispose ()
 Disposes the composite and every child it owns.
Public Member Functions inherited from Gondwana.Widgets.ContainerWidget
override DirectComposite Add (IDirectCompositeChild child, bool keepCurrentOffset=true, Vector2? explicitLocalOffsetPx=null)
 Adds a composite-compatible direct drawable as a child.
Parameters
childThe child to add.
keepCurrentOffsettrue to preserve the child's current offset from the composite anchor.
explicitLocalOffsetPxThe offset to use when keepCurrentOffset is false.
Returns
The current composite.
Exceptions
ArgumentExceptionThrown when the child uses another render surface, mode, view, or scene layer.
InvalidOperationExceptionThrown when the child already has another parent or would create a cycle.

override DirectComposite Remove (IDirectCompositeChild child)
 Removes a child without disposing it.
Parameters
childThe child to detach.
Returns
The current composite.

override DirectComposite Clear ()
 Removes every child without disposing them.
Returns
The current composite.

Public Member Functions inherited from Gondwana.Widgets.WidgetBase
virtual bool HitTest (View view, Point screenPositionPx)
 Determines whether the widget can be hit at the specified screen position within the specified view.
virtual bool HitTest (Point screenPositionPx)
 Determines whether the widget can be hit at the specified screen position.
WidgetBase Show ()
 Shows the widget and registers it for input routing.
WidgetBase Hide ()
 Hides the widget and releases any routed input state.
WidgetBase Activate ()
 Activates the widget and brings it to the front of the input order.
WidgetBase Cancel ()
 Cancels the widget.
Public Member Functions inherited from Gondwana.Drawing.Direct.DirectComposite
 DirectComposite (RenderSurfaceHostBase renderSurfaceHost, DirectDrawingMode mode, PointF anchor=default, string? nickname=null)
 Initializes a new instance of the DirectComposite class.
Vector2 GetPosition ()
 Gets the current composite anchor.
void SetPosition (Vector2 position)
 Sets the composite anchor and repositions all children from their stored offsets.
DirectComposite SetPosition (float x, float y)
 Sets the composite anchor and repositions all children from their stored offsets.
DirectComposite SetLocalOffset (IDirectCompositeChild child, Vector2 newLocalOffsetPx)
 Changes one child's local offset and reapplies its position.
DirectComposite SetZOrder (int zOrder)
 Applies one Z-order to every descendant.
DirectComposite SetOpacity (float opacity)
 Applies one opacity to every descendant.
DirectComposite SetIsVisible (bool visible)
 Applies one visibility value to every descendant.
DirectComposite FadeTo (float targetOpacity, float durationSec)
 Fades every descendant to the requested opacity.
DirectComposite FadeIn (float durationSec)
 Fades every descendant to full opacity.
DirectComposite FadeOut (float durationSec)
 Fades every descendant to zero opacity.
RectangleF GetDrawLocationScreen (View view)
 Gets the union of all visible descendants as projected through a view.
void Draw (BackbufferBase backbuffer, RectangleF destRectScreen)
 Performs no direct rendering because descendants render independently.
virtual void Update (long tick)
 Advances composite movement.

Protected Member Functions

override void ProcessShown ()
 Performs processing when the widget is shown before notification callbacks are invoked.
override void ProcessHidden ()
 Performs processing when the widget is hidden before notification callbacks are invoked.
override void ProcessActivated ()
 Performs processing when the widget is activated before notification callbacks are invoked.
override void OnKeyboardInput (WidgetKeyboardEventArgs args)
 Called when keyboard input is routed to the widget.
Parameters
argsThe keyboard event data.

Protected Member Functions inherited from Gondwana.Widgets.ContainerWidget
 ContainerWidget (RenderSurfaceHostBase renderSurfaceHost, DirectDrawingMode mode, PointF anchor=default, string? nickname=null)
 Initializes a new instance of the ContainerWidget class.
TWidget Add< TWidget > (TWidget widget, Vector2 localOffsetPx)
 Adds a child widget at a local offset from this container's anchor.
bool RemoveChild (WidgetBase widget, bool dispose=false)
 Removes a child widget from the container.
override void OnChildAdded (IDirectCompositeChild child)
 Called after a child has been successfully added.
Parameters
childThe child that was added.
Overrides should perform only non-throwing bookkeeping. Derived types that need additional validation should override Add, perform that validation before calling the base implementation, and then allow this callback to perform the resulting bookkeeping.
override void OnChildRemoved (IDirectCompositeChild child)
 Called after a child has been removed from the composite.
Parameters
childThe child that was removed.

override void ProcessCancelled ()
 Performs processing when the widget is cancelled before notification callbacks are invoked.
Protected Member Functions inherited from Gondwana.Widgets.WidgetBase
 WidgetBase (RenderSurfaceHostBase renderSurfaceHost, DirectDrawingMode mode, PointF anchor=default, string? nickname=null)
 Initializes a new instance of the WidgetBase class.
virtual void ProcessPointerEnter (WidgetPointerEventArgs args)
 Performs processing when a pointer enters the widget before notification callbacks are invoked.
virtual void ProcessPointerLeave (WidgetPointerEventArgs args)
 Performs processing when a pointer leaves the widget before notification callbacks are invoked.
virtual void ProcessPointerDown (WidgetPointerEventArgs args)
 Performs processing when a pointer press begins on the widget before notification callbacks are invoked.
virtual void ProcessPointerMove (WidgetPointerEventArgs args)
 Performs processing when pointer movement is routed to the widget before notification callbacks are invoked.
virtual void ProcessPointerUp (WidgetPointerEventArgs args)
 Performs processing when a pointer press is released for the widget before notification callbacks are invoked.
virtual void ProcessFocusGained ()
 Performs processing when the widget gains focus before notification callbacks are invoked.
virtual void ProcessFocusLost ()
 Performs processing when the widget loses focus before notification callbacks are invoked.
virtual void ProcessKeyboardInput (WidgetKeyboardEventArgs args)
 Performs processing when keyboard input is routed to the widget before notification callbacks are invoked.
virtual bool ShouldDispatchPointerClick (WidgetPointerEventArgs args)
 Determines whether a pointer-click event should be dispatched for the specified pointer event data.
virtual void OnShown ()
 Called when the widget is shown.
virtual void OnHidden ()
 Called when the widget is hidden.
virtual void OnActivated ()
 Called when the widget is activated.
virtual void OnCancelled ()
 Called when the widget is cancelled.
virtual void OnPointerEnter (WidgetPointerEventArgs args)
 Called when a pointer enters the widget bounds.
virtual void OnPointerLeave (WidgetPointerEventArgs args)
 Called when a pointer leaves the widget bounds.
virtual void OnPointerDown (WidgetPointerEventArgs args)
 Called when a pointer press begins on the widget.
virtual void OnPointerMove (WidgetPointerEventArgs args)
 Called when pointer movement is routed to the widget.
virtual void OnPointerUp (WidgetPointerEventArgs args)
 Called when a pointer press is released for the widget.
virtual void OnMouseWheel (WidgetMouseWheelEventArgs args)
 Called when mouse-wheel input is routed to the widget.
virtual void OnPointerClick (WidgetPointerEventArgs args)
 Called when a pointer click is dispatched to the widget.
virtual void OnFocusGained ()
 Called when the widget gains focus.
virtual void OnFocusLost ()
 Called when the widget loses focus.

Properties

Rectangle Bounds [get]
 Gets the current control bounds in its native coordinate space.
Size Size [get, set]
 Gets or sets the overall control size while preserving its anchor position.
IReadOnlyList< TabPageWidget > Tabs [get]
 Gets the pages in their visible tab order.
int SelectedIndex [get]
 Gets the selected tab index, or -1 when the control has no pages.
TabPageWidget? SelectedTab [get]
 Gets the selected page, or null when the control has no pages.
int TabHeight [get, set]
 Gets or sets the height of one tab header row in native pixels.
int TabRowCount [get, set]
 Gets or sets the number of header rows reserved when AutoExpandRows is disabled.
bool AutoExpandRows [get, set]
 Gets or sets whether the control adds rows as more tabs are added.
int PreferredTabWidth [get, set]
 Gets or sets the preferred header width used when rows expand automatically.
int DisplayedTabRowCount [get]
 Gets the number of header rows currently occupied or reserved by the control.
int DisplayedTabColumnCount [get]
 Gets the number of tab cells displayed across each header row.
bool IsTabReorderingEnabled [get, set]
 Gets or sets whether headers can be drag-reordered with a primary pointer.
float TabReorderDragThresholdPx [get, set]
 Gets or sets the pointer movement required to begin a tab reordering drag.
Properties inherited from Gondwana.Widgets.ContainerWidget
IReadOnlyList< WidgetBase > ChildWidgets [get]
 Gets a snapshot of the child widgets directly owned by this container.
Properties inherited from Gondwana.Widgets.WidgetBase
bool IsInputEnabled [get, set]
 Gets or sets a value indicating whether the widget can participate in input routing.
bool IsPointerInputEnabled [get, set]
 Gets or sets a value indicating whether the widget can receive pointer input.
bool IsKeyboardInputEnabled [get, set]
 Gets or sets a value indicating whether the widget can receive keyboard input.
bool CanReceiveFocus [get, set]
 Gets or sets a value indicating whether the widget can receive keyboard focus.
bool IsFocused [get, set]
 Gets a value indicating whether the widget currently has keyboard focus.
Properties inherited from Gondwana.Drawing.Direct.DirectComposite
Guid Id = Guid.NewGuid() [get]
 Gets the unique identifier of the composite.
string? Nickname [get]
 Gets the optional diagnostic nickname of the composite.
RenderSurfaceHostBase RenderSurfaceHost [get]
 Gets the render surface host shared by the composite and its children.
DirectDrawingMode Mode [get]
 Gets the coordinate mode shared by the composite and its children.
SceneLayer? SceneLayer [get]
 Gets the scene layer shared by all children in scene-layer mode.
View? View [get]
 Gets the view shared by all children in view mode.
ReadOnlyCollection< IDirectCompositeChild > Children [get]
 Gets the children owned by the composite.
MovementController Movement [get]
 Gets the movement controller used to move the composite anchor.
MovementSpace PositionSpace [get]
 Gets the coordinate space used by the movement controller.
bool Visible [get, set]
 Gets or sets the visibility of all descendants.
int ZOrder [get]
 Gets the composite Z-order.
Rectangle ScreenBounds [get]
 Gets the union of all visible descendants' screen-space bounds.
Rectangle WorldBounds [get]
 Gets the union of all visible descendants' world-space bounds.

Events

Action< TabPageWidget >? SelectedTabChanged
 Occurs after the selected page changes.
Action< TabPageWidget, int, int >? TabReordered
 Occurs after a page moves to a different tab index.
Events inherited from Gondwana.Widgets.WidgetBase
Action? Shown
 Occurs when the widget is shown.
Action? Hidden
 Occurs when the widget is hidden.
Action? Activated
 Occurs when the widget is activated.
Action? Cancelled
 Occurs when the widget is cancelled.
Action< WidgetPointerEventArgs >? PointerEnter
 Occurs when a pointer enters the widget bounds.
Action< WidgetPointerEventArgs >? PointerLeave
 Occurs when a pointer leaves the widget bounds.
Action< WidgetPointerEventArgs >? PointerDown
 Occurs when a pointer button or touch press begins on the widget.
Action< WidgetPointerEventArgs >? PointerMove
 Occurs when a pointer moves while routed to the widget.
Action< WidgetPointerEventArgs >? PointerUp
 Occurs when a pointer button or touch press is released for the widget.
Action< WidgetPointerEventArgs >? PointerClick
 Occurs when a pointer press and release completes as a click on the widget.
Action< WidgetMouseWheelEventArgs >? MouseWheel
 Occurs when mouse-wheel input is routed to the widget while the pointer is over it.
Action? FocusGained
 Occurs when the widget gains keyboard focus.
Action? FocusLost
 Occurs when the widget loses keyboard focus.
Action< WidgetKeyboardEventArgs >? KeyboardInput
 Occurs when keyboard input is routed to the widget.
Events inherited from Gondwana.Drawing.Direct.DirectComposite
EventHandler< IDirectDrawable >? Disposing
 Occurs when the composite is being disposed.
Events inherited from Gondwana.Drawing.Direct.IDirectDrawable
EventHandler< IDirectDrawable >? Disposing
 Occurs when the object is being disposed.

Detailed Description

Provides a tabbed container whose pages own ordinary Gondwana widgets.

Add pages with AddTab(string,char?,string?). By default, all tab headers share one row and resize to fit the control width. Set AutoExpandRows to retain a preferred header width by adding rows as more tabs are added, or set TabRowCount to reserve a fixed number of rows. Pages can be selected with their headers or with an Alt mnemonic.

Definition at line 23 of file TabControlWidget.cs.

Constructor & Destructor Documentation

◆ TabControlWidget() [1/2]

Gondwana.Widgets.Controls.TabControlWidget.TabControlWidget ( RenderSurfaceHostBase renderSurfaceHost,
View view,
Rectangle bounds,
string? nickname = null )

Creates a view-level tab control.

Parameters
renderSurfaceHostThe render surface host that owns the control.
viewThe view that renders the control.
boundsThe control bounds in view pixels.
nicknameThe optional diagnostic nickname.

Definition at line 72 of file TabControlWidget.cs.

◆ TabControlWidget() [2/2]

Gondwana.Widgets.Controls.TabControlWidget.TabControlWidget ( RenderSurfaceHostBase renderSurfaceHost,
SceneLayer sceneLayer,
Rectangle bounds,
string? nickname = null )

Creates a scene-layer tab control.

Parameters
renderSurfaceHostThe render surface host that owns the control.
sceneLayerThe scene layer that renders the control.
boundsThe control bounds in world pixels.
nicknameThe optional diagnostic nickname.

Definition at line 93 of file TabControlWidget.cs.

Member Function Documentation

◆ AddTab()

TabPageWidget Gondwana.Widgets.Controls.TabControlWidget.AddTab ( string title,
char? mnemonic = null,
string? nickname = null )

Adds a page to the end of the tab strip.

Parameters
titleThe text displayed in the new tab header.
mnemonicThe optional Alt-key mnemonic that selects the new page.
nicknameThe optional diagnostic nickname for the page.
Returns
The newly created page, which can own other widgets.

Definition at line 296 of file TabControlWidget.cs.

◆ Dispose()

override void Gondwana.Widgets.Controls.TabControlWidget.Dispose ( )
virtual

Disposes the composite and every child it owns.

Reimplemented from Gondwana.Drawing.Direct.DirectComposite.

Definition at line 528 of file TabControlWidget.cs.

◆ MoveTab() [1/2]

TabControlWidget Gondwana.Widgets.Controls.TabControlWidget.MoveTab ( int fromIndex,
int toIndex )

Moves one page to a different tab index.

Parameters
fromIndexThe zero-based index of the page to move.
toIndexThe zero-based destination index.
Returns
The current tab control.

Definition at line 402 of file TabControlWidget.cs.

◆ MoveTab() [2/2]

TabControlWidget Gondwana.Widgets.Controls.TabControlWidget.MoveTab ( TabPageWidget page,
int toIndex )

Moves the supplied page to a different tab index.

Parameters
pageThe page to move.
toIndexThe zero-based destination index.
Returns
The current tab control.

Definition at line 435 of file TabControlWidget.cs.

◆ OnKeyboardInput()

override void Gondwana.Widgets.Controls.TabControlWidget.OnKeyboardInput ( WidgetKeyboardEventArgs args)
protectedvirtual

Called when keyboard input is routed to the widget.

Parameters
argsThe keyboard event data.

Reimplemented from Gondwana.Widgets.WidgetBase.

Definition at line 579 of file TabControlWidget.cs.

◆ ProcessActivated()

override void Gondwana.Widgets.Controls.TabControlWidget.ProcessActivated ( )
protectedvirtual

Performs processing when the widget is activated before notification callbacks are invoked.

Reimplemented from Gondwana.Widgets.ContainerWidget.

Definition at line 571 of file TabControlWidget.cs.

◆ ProcessHidden()

override void Gondwana.Widgets.Controls.TabControlWidget.ProcessHidden ( )
protectedvirtual

Performs processing when the widget is hidden before notification callbacks are invoked.

Reimplemented from Gondwana.Widgets.ContainerWidget.

Definition at line 564 of file TabControlWidget.cs.

◆ ProcessShown()

override void Gondwana.Widgets.Controls.TabControlWidget.ProcessShown ( )
protectedvirtual

Performs processing when the widget is shown before notification callbacks are invoked.

Reimplemented from Gondwana.Widgets.ContainerWidget.

Definition at line 556 of file TabControlWidget.cs.

◆ Relayout()

TabControlWidget Gondwana.Widgets.Controls.TabControlWidget.Relayout ( )

Recomputes header and page layout after changing a size or tab-layout setting.

Returns
The current tab control.

Definition at line 451 of file TabControlWidget.cs.

◆ RemoveTab()

bool Gondwana.Widgets.Controls.TabControlWidget.RemoveTab ( TabPageWidget page,
bool dispose = false )

Removes a page from the tab control.

Parameters
pageThe page to remove.
disposeWhether to dispose the page and its header after removal.
Returns
true when the page was owned by this control; otherwise, false.

Definition at line 350 of file TabControlWidget.cs.

◆ SelectTab() [1/2]

TabControlWidget Gondwana.Widgets.Controls.TabControlWidget.SelectTab ( int index)

Selects the page at the supplied tab index.

Parameters
indexThe zero-based tab index to select.
Returns
The current tab control.

Definition at line 362 of file TabControlWidget.cs.

◆ SelectTab() [2/2]

TabControlWidget Gondwana.Widgets.Controls.TabControlWidget.SelectTab ( TabPageWidget page)

Selects the supplied page.

Parameters
pageThe page to select.
Returns
The current tab control.

Definition at line 385 of file TabControlWidget.cs.

◆ SetTabColors()

TabControlWidget Gondwana.Widgets.Controls.TabControlWidget.SetTabColors ( Color normal,
Color hover,
Color pressed,
Color selected )

Sets the tab header colors.

Parameters
normalThe normal unselected color.
hoverThe unselected hover color.
pressedThe unselected pressed color.
selectedThe selected tab color.
Returns
The current tab control.

Definition at line 485 of file TabControlWidget.cs.

◆ SetTabControlZOrder()

TabControlWidget Gondwana.Widgets.Controls.TabControlWidget.SetTabControlZOrder ( int zOrder)

Sets the base Z-order for all page and header visuals.

Parameters
zOrderThe Z-order applied to page backgrounds.
Returns
The current tab control.

Definition at line 519 of file TabControlWidget.cs.

◆ SetTabTextColor()

TabControlWidget Gondwana.Widgets.Controls.TabControlWidget.SetTabTextColor ( Color color)

Sets the color used by tab-header labels.

Parameters
colorThe new label color.
Returns
The current tab control.

Definition at line 504 of file TabControlWidget.cs.

Property Documentation

◆ AutoExpandRows

bool Gondwana.Widgets.Controls.TabControlWidget.AutoExpandRows
getset

Gets or sets whether the control adds rows as more tabs are added.

When enabled, PreferredTabWidth determines how many tabs fit in one row. When disabled, TabRowCount controls the number of rows.

Definition at line 208 of file TabControlWidget.cs.

◆ Bounds

Rectangle Gondwana.Widgets.Controls.TabControlWidget.Bounds
get

Gets the current control bounds in its native coordinate space.

Definition at line 110 of file TabControlWidget.cs.

◆ DisplayedTabColumnCount

int Gondwana.Widgets.Controls.TabControlWidget.DisplayedTabColumnCount
get

Gets the number of tab cells displayed across each header row.

Definition at line 248 of file TabControlWidget.cs.

◆ DisplayedTabRowCount

int Gondwana.Widgets.Controls.TabControlWidget.DisplayedTabRowCount
get

Gets the number of header rows currently occupied or reserved by the control.

Definition at line 243 of file TabControlWidget.cs.

◆ IsTabReorderingEnabled

bool Gondwana.Widgets.Controls.TabControlWidget.IsTabReorderingEnabled
getset

Gets or sets whether headers can be drag-reordered with a primary pointer.

Definition at line 253 of file TabControlWidget.cs.

◆ PreferredTabWidth

int Gondwana.Widgets.Controls.TabControlWidget.PreferredTabWidth
getset

Gets or sets the preferred header width used when rows expand automatically.

Definition at line 224 of file TabControlWidget.cs.

◆ SelectedIndex

int Gondwana.Widgets.Controls.TabControlWidget.SelectedIndex
get

Gets the selected tab index, or -1 when the control has no pages.

Definition at line 149 of file TabControlWidget.cs.

◆ SelectedTab

TabPageWidget? Gondwana.Widgets.Controls.TabControlWidget.SelectedTab
get

Gets the selected page, or null when the control has no pages.

Definition at line 154 of file TabControlWidget.cs.

◆ Size

Size Gondwana.Widgets.Controls.TabControlWidget.Size
getset

Gets or sets the overall control size while preserving its anchor position.

Definition at line 126 of file TabControlWidget.cs.

◆ TabHeight

int Gondwana.Widgets.Controls.TabControlWidget.TabHeight
getset

Gets or sets the height of one tab header row in native pixels.

Definition at line 161 of file TabControlWidget.cs.

◆ TabReorderDragThresholdPx

float Gondwana.Widgets.Controls.TabControlWidget.TabReorderDragThresholdPx
getset

Gets or sets the pointer movement required to begin a tab reordering drag.

Definition at line 271 of file TabControlWidget.cs.

◆ TabRowCount

int Gondwana.Widgets.Controls.TabControlWidget.TabRowCount
getset

Gets or sets the number of header rows reserved when AutoExpandRows is disabled.

The default is one row. A fixed row count distributes tabs across that many rows and leaves unused cells empty when fewer tabs are present.

Definition at line 184 of file TabControlWidget.cs.

◆ Tabs

IReadOnlyList<TabPageWidget> Gondwana.Widgets.Controls.TabControlWidget.Tabs
get

Gets the pages in their visible tab order.

Definition at line 144 of file TabControlWidget.cs.

Event Documentation

◆ SelectedTabChanged

Action<TabPageWidget>? Gondwana.Widgets.Controls.TabControlWidget.SelectedTabChanged

Occurs after the selected page changes.

Definition at line 58 of file TabControlWidget.cs.

◆ TabReordered

Action<TabPageWidget, int, int>? Gondwana.Widgets.Controls.TabControlWidget.TabReordered

Occurs after a page moves to a different tab index.

Definition at line 63 of file TabControlWidget.cs.