Exemplo n.º 1
0
        /// <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;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="capi">The client API</param>
        /// <param name="values">The values of the strings.</param>
        /// <param name="names">The names of the strings.</param>
        /// <param name="selectedIndex">The default selected index.</param>
        /// <param name="onSelectionChanged">The event that occurs when the selection is changed.</param>
        /// <param name="bounds">The bounds of the drop down.</param>
        public GuiElementDropDown(ICoreClientAPI capi, string[] values, string[] names, int selectedIndex, SelectionChangedDelegate onSelectionChanged, ElementBounds bounds, CairoFont font, bool multiSelect) : base(capi, "", font, bounds)
        {
            highlightTexture        = new LoadedTexture(capi);
            currentValueTexture     = new LoadedTexture(capi);
            arrowDownButtonReleased = new LoadedTexture(capi);
            arrowDownButtonPressed  = new LoadedTexture(capi);

            listMenu = new GuiElementListMenu(capi, values, names, selectedIndex, didSelect, bounds, font, multiSelect)
            {
                HoveredIndex = selectedIndex
            };

            ElementBounds textBounds = ElementBounds.Fixed(0, 0, 900, 100).WithEmptyParent();

            richTextElem = new GuiElementRichtext(capi, new RichTextComponentBase[0], textBounds);

            this.onSelectionChanged = onSelectionChanged;
            this.multiSelect        = multiSelect;
        }