/// <summary> /// Creates a new dropdown configuration list. /// </summary> /// <param name="capi">The Client API</param> /// <param name="items">The list of items in the configuration.</param> /// <param name="OnItemClick">The event fired when the particular item is clicked.</param> /// <param name="font">The font of the text.</param> /// <param name="bounds">the bounds of the element.</param> public GuiElementConfigList(ICoreClientAPI capi, List <ConfigItem> items, ConfigItemClickDelegate OnItemClick, CairoFont font, ElementBounds bounds) : base(capi, "", font, bounds) { hoverTexture = new LoadedTexture(capi); this.items = items; this.OnItemClick = OnItemClick; this.errorFont = font.Clone(); this.stdFont = font; this.titleFont = font.Clone().WithWeight(FontWeight.Bold); this.titleFont.Color[3] = 0.6; }
/// <summary> /// Creates a button for the current GUI. /// </summary> /// <param name="text">The text on the button.</param> /// <param name="onClick">The event fired when the button is clicked.</param> /// <param name="bounds">The bounds of the button.</param> /// <param name="buttonFont">The font of the button.</param> /// <param name="style">The style of the button. (Default: Normal)</param> /// <param name="orientation">The orientation of the text. (Default: center)</param> /// <param name="key">The internal name of the button.</param> public static GuiComposer AddButton(this GuiComposer composer, string text, ActionConsumable onClick, ElementBounds bounds, CairoFont buttonFont, EnumButtonStyle style = EnumButtonStyle.Normal, EnumTextOrientation orientation = EnumTextOrientation.Center, string key = null) { if (!composer.composed) { CairoFont hoverFont = buttonFont.Clone().WithColor(GuiStyle.ActiveButtonTextColor); GuiElementTextButton elem = new GuiElementTextButton(composer.Api, text, buttonFont, hoverFont, onClick, bounds, style); elem.SetOrientation(orientation); composer.AddInteractiveElement(elem, key); } return(composer); }