Ejemplo n.º 1
0
 /// <summary>
 /// Adds a hover text to the GUI.
 /// </summary>
 /// <param name="text">The text of the text.</param>
 /// <param name="font">The font of the text.</param>
 /// <param name="width">The width of the text.</param>
 /// <param name="bounds">The bounds of the text.</param>
 /// <param name="key">The name of this hover text component.</param>
 public static GuiComposer AddHoverText(this GuiComposer composer, string text, CairoFont font, int width, ElementBounds bounds, TextBackground background, string key = null)
 {
     if (!composer.composed)
     {
         GuiElementHoverText elem = new GuiElementHoverText(composer.Api, text, font, width, bounds, background);
         composer.AddInteractiveElement(elem, key);
     }
     return(composer);
 }
Ejemplo n.º 2
0
        public static GuiComposer AddAutoSizeHoverText(this GuiComposer composer, string text, CairoFont font, int width, ElementBounds bounds, string key = null)
        {
            if (!composer.composed)
            {
                GuiElementHoverText elem = new GuiElementHoverText(composer.Api, text, font, width, bounds, null);
                elem.SetAutoWidth(true);

                composer.AddInteractiveElement(elem, key);
            }
            return(composer);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Constructor for the button
        /// </summary>
        /// <param name="capi">The core client API.</param>
        /// <param name="color"></param>
        /// <param name="OnToggled">The action that happens when the button is toggled.</param>
        /// <param name="bounds">The bounding box of the button.</param>
        public GuiElementColorListPicker(ICoreClientAPI capi, int color, Action <bool> OnToggled, ElementBounds bounds) : base(capi, bounds)
        {
            activeTexture = new LoadedTexture(capi);

            this.color = color;
            handler    = OnToggled;

            hoverText = new GuiElementHoverText(capi, "", CairoFont.WhiteSmallText(), 200, Bounds.CopyOnlySize());
            hoverText.Bounds.ParentBounds = bounds;
            hoverText.SetAutoWidth(true);
            bounds.ChildBounds.Add(hoverText.Bounds);
        }