mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-01-18 11:19:22 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
41 lines
843 B
C#
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;
|
|
}
|
|
}
|
|
|
|
|