/// <summary> /// Creates a new title bar. /// </summary> /// <param name="capi">The Client API.</param> /// <param name="text">The text on the title bar.</param> /// <param name="composer">The GuiComposer for the title bar.</param> /// <param name="OnClose">The event fired when the title bar is closed.</param> /// <param name="font">The font of the title bar.</param> /// <param name="bounds">The bounds of the title bar.</param> public GuiElementDialogTitleBar(ICoreClientAPI capi, string text, GuiComposer composer, Action OnClose = null, CairoFont font = null, ElementBounds bounds = null) : base(capi, text, font, bounds) { closeIconHoverTexture = new LoadedTexture(capi); menuIconHoverTexture = new LoadedTexture(capi); if (bounds == null) { this.Bounds = ElementStdBounds.TitleBar(); } if (font == null) { this.Font = CairoFont.WhiteSmallText(); } this.OnClose = OnClose; ElementBounds dropDownBounds = ElementBounds.Fixed(0, 0, 100, 25); this.Bounds.WithChild(dropDownBounds); listMenu = new GuiElementListMenu(capi, new string[] { "auto", "manual" }, new string[] { Lang.Get("Fixed"), Lang.Get("Movable") }, 0, onSelectionChanged, dropDownBounds, CairoFont.WhiteSmallText(), false) { HoveredIndex = 0 }; baseComposer = composer; }
// Single rectangle shape /// <summary> /// Adds a dialog title bar to the GUI with a background. /// </summary> /// <param name="text">The text of the title bar.</param> /// <param name="OnClose">The event fired when the title bar is closed.</param> /// <param name="font">The font of the title bar.</param> /// <param name="bounds">The bounds of the title bar.</param> public static GuiComposer AddDialogTitleBarWithBg(this GuiComposer composer, string text, Action OnClose = null, CairoFont font = null, ElementBounds bounds = null) { if (!composer.composed) { GuiElementDialogTitleBar elem = new GuiElementDialogTitleBar(composer.Api, text, composer, OnClose, font, bounds); elem.drawBg = true; composer.AddInteractiveElement(elem); } return(composer); }
// Single rectangle shape /// <summary> /// Adds a dialog title bar to the GUI. /// </summary> /// <param name="text">The text of the title bar.</param> /// <param name="OnClose">The event fired when the title bar is closed.</param> /// <param name="font">The font of the title bar.</param> /// <param name="bounds">The bounds of the title bar.</param> public static GuiComposer AddDialogTitleBar(this GuiComposer composer, string text, Action OnClose = null, CairoFont font = null, ElementBounds bounds = null) { if (!composer.composed) { composer.AddInteractiveElement(new GuiElementDialogTitleBar(composer.Api, text, composer, OnClose, font, bounds)); } return(composer); }