Files
sbox-public/engine/Sandbox.Engine/Systems/UI/Utility/PanelCreator.cs
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

41 lines
843 B
C#

namespace Sandbox.UI.Construct;
/// <summary>
/// Used for <see cref="Panel.Add"/> for quick panel creation with certain settings. Other panels types are added via extension methods.
/// </summary>
public ref struct PanelCreator
{
/// <summary>
/// The panel to add children to.
/// </summary>
public Panel panel;
internal PanelCreator( Panel panel )
{
this.panel = panel;
}
/// <summary>
/// Add a new blank panel as a child.
/// </summary>
/// <returns>The crated panel.</returns>
public Panel Panel()
{
return panel.AddChild<Panel>();
}
/// <summary>
/// Add a new blank panel with given CSS classes as a child.
/// </summary>
/// <returns>The crated panel.</returns>
public Panel Panel( string classname )
{
var control = panel.AddChild<Panel>();
control.AddClass( classname );
return control;
}
}