mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-04-18 05:17:53 -04:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
44 lines
919 B
C#
44 lines
919 B
C#
namespace Sandbox.UI
|
|
{
|
|
/// <summary>
|
|
/// A panel containing an icon, typically a <a href="https://fonts.google.com/icons">material icon</a>.
|
|
/// </summary>
|
|
[Library( "IconPanel" ), Alias( "icon", "i" ),]
|
|
public class IconPanel : Label
|
|
{
|
|
public IconPanel()
|
|
{
|
|
AddClass( "iconpanel" );
|
|
}
|
|
|
|
public IconPanel( string icon, string classes = null ) : base()
|
|
{
|
|
Text = icon;
|
|
AddClass( classes );
|
|
}
|
|
}
|
|
|
|
namespace Construct
|
|
{
|
|
public static class IconPanelConstructor
|
|
{
|
|
/// <summary>
|
|
/// Create and return an icon (panel) with given icon and optionally given CSS classes.
|
|
/// </summary>
|
|
public static IconPanel Icon( this PanelCreator self, string icon, string classes = null )
|
|
{
|
|
var control = self.panel.AddChild<IconPanel>();
|
|
|
|
if ( icon != null )
|
|
control.Text = icon;
|
|
|
|
if ( classes != null )
|
|
control.AddClass( classes );
|
|
|
|
return control;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|