Game.UI.Widgets.Row
Assembly: Game (inferred)
Namespace: Game.UI.Widgets
Type: internal class
Base: LayoutContainer
Summary:
Row is a simple layout container widget that arranges child widgets in a horizontal row. It exposes a boolean wrap property to control whether children should wrap onto additional lines when they exceed available width. It includes a convenience static factory WithChildren to create a Row pre-populated with a list of child widgets, and it writes its wrap setting to a JSON writer when serializing properties.
Fields
- None declared in this class.
Note: The class assigns to a children member in WithChildren, which is defined on the base LayoutContainer (inherited).
Properties
-
public bool wrap { get; set; }
Determines whether child widgets should wrap to the next line when they exceed the container width. Serialized by WriteProperties. -
(inherited)
children
(from LayoutContainer)
A collection of IWidget children that this container lays out. Row.WithChildren sets this inherited member.
Constructors
internal Row()
Default (parameterless) constructor. The class does not declare any custom constructors, so the compiler-provided default constructor is used.
Methods
public static Row WithChildren(IList<IWidget> children)
Factory method that creates a new Row instance and assigns the provided IListto the inherited children collection. Returns the new Row for further configuration or immediate use.
Parameters:
- children: IList
Returns: - Row — the newly created Row instance with children assigned.
protected override void WriteProperties(IJsonWriter writer)
Overrides the base implementation to serialize Row-specific properties. Calls base.WriteProperties(writer) then writes the "wrap" property name and its boolean value to the supplied IJsonWriter.
Parameters: - writer: IJsonWriter — writer used to emit JSON properties for this widget.
Usage Example
using System.Collections.Generic;
using Colossal.UI.Binding;
using Game.UI.Widgets;
// Create a row and set wrapping
var row = new Row
{
wrap = true
};
// Or use the helper to create with children
IList<IWidget> myChildren = new List<IWidget> { widget1, widget2, widget3 };
var rowWithChildren = Row.WithChildren(myChildren);
rowWithChildren.wrap = false;