public TButton Button <TButton>(UIComponent parent,
                                        string text,
                                        [CanBeNull]
                                        string tooltip,
                                        Vector2 size,
                                        UStackMode stack = UStackMode.ToTheRight)
            where TButton : UIButton, ISmartSizableControl
        {
            TButton b = this.Button <TButton>(parent);

            b.text = text;

            if (tooltip != null)
            {
                b.tooltip = tooltip;
            }

            if (stack != UStackMode.None)
            {
                b.SetStacking(stack);
            }

            b.SetFixedSize(size);
            return(b);
        }
 /// <summary>Calls <see cref="Label{TLabel,TParent}"/> with default type arguments:
 /// ULabel, and parent type to UIComponent.
 /// </summary>
 public ULabel Label_(UIComponent parent,
                      string t,
                      UStackMode stack   = UStackMode.ToTheRight,
                      bool processMarkup = false)
 {
     return(Label <ULabel>(parent, t, stack, processMarkup));
 }
Exemple #3
0
        /// <summary>Instruct the <see cref="UResizer"/> to always use this stacking for the control.</summary>
        /// <param name="mode">The stacking mode to always use.</param>
        /// <param name="spacing">Spacing to use in the call to automatic predefined spacing.</param>
        public void SetStacking(UStackMode mode, float spacing = 0f)
        {
            UResizerConfig c = Control.GetResizerConfig();

            c.StackingChoice  = UStackingChoice.Predefined;
            c.Stacking        = mode;
            c.StackingSpacing = spacing;
        }
Exemple #4
0
 /// <summary>Quick create a label and stack it. Optionally set markup processing mode.</summary>
 /// <param name="t">Localized text.</param>
 /// <param name="stack">Stacking mode related to previous sibling.</param>
 /// <param name="processMarkup">Whether label text contains C:S color markup.</param>
 /// <returns>New label.</returns>
 public U.ULabel Label(string t, UStackMode stack, bool processMarkup = false)
 {
     using (UiBuilder <ULabel> labelB = this.Label <U.ULabel>(t)) {
         labelB.ResizeFunction(r => r.Stack(mode: stack));
         labelB.Control.processMarkup = processMarkup;
         return(labelB.Control);
     }
 }
        /// <summary>Instruct the <see cref="UResizer"/> to always use this stacking for the control.</summary>
        /// <param name="mode">The stacking mode to always use.</param>
        /// <param name="spacing">Spacing to use in the call to automatic predefined spacing.</param>
        public static void SetStacking(this ISmartSizableControl ctrl,
                                       UStackMode mode,
                                       float spacing = 0f)
        {
            UResizerConfig c = ctrl.GetResizerConfig();

            c.StackingChoice  = UStackingChoice.Predefined;
            c.Stacking        = mode;
            c.StackingSpacing = spacing;
        }
        public TPanel Panel <TPanel>(UIComponent parent,
                                     UStackMode stack = UStackMode.None)
            where TPanel : UIPanel, ISmartSizableControl
        {
            var p = parent.AddUIComponent(typeof(TPanel)) as TPanel;

            if (stack != UStackMode.None)
            {
                p.SetStacking(stack);
            }

            return(p);
        }
Exemple #7
0
        public UiBuilder <TButton> FixedSizeButton <TButton>(string text,
                                                             string tooltip,
                                                             Vector2 size,
                                                             UStackMode stack)
            where TButton : UIButton, ISmartSizableControl
        {
            UiBuilder <TButton> builder = this.Button <TButton>();

            builder.Control.text    = text;
            builder.Control.tooltip = tooltip;
            builder.SetStacking(stack);
            builder.SetFixedSize(size);
            return(builder);
        }
        /// <summary>Quick create a label and stack it. Optionally set markup processing mode.</summary>
        /// <param name="t">Localized text.</param>
        /// <param name="stack">Stacking mode related to previous sibling.</param>
        /// <param name="processMarkup">Whether label text contains C:S color markup.</param>
        /// <returns>New label.</returns>
        public TLabel Label <TLabel>(UIComponent parent,
                                     string t,
                                     UStackMode stack   = UStackMode.ToTheRight,
                                     bool processMarkup = false)
            where TLabel : UILabel, ISmartSizableControl
        {
            var label = parent.AddUIComponent(typeof(TLabel)) as TLabel;

            label.text = t;

            if (stack != UStackMode.None)
            {
                label.SetStacking(stack);
            }

            label.processMarkup = processMarkup;

            return(label);
        }
 public UPanel Panel_(UIComponent parent,
                      UStackMode stack = UStackMode.None)
 {
     return(Panel <UPanel>(parent, stack));
 }