Exemplo n.º 1
0
        private static IFrame CreateBorder(DragableButton button)
        {
            var frame = (IFrame)Global.FrameProvider.CreateFrame(FrameType.Frame, null, button.Button);

            frame.SetAllPoints(button.Button);
            SetBackdrop(frame, "");
            return(frame);
        }
Exemplo n.º 2
0
        private static IFontString CreateText(DragableButton button)
        {
            var text = button.Button.CreateFontString(null, Layer.OVERLAY, "SystemFont_Med1");

            text.SetHeight(BarHeight);
            text.SetPoint(FramePoint.CENTER, 0, 0);
            text.SetJustifyH(JustifyH.CENTER);
            return(text);
        }
Exemplo n.º 3
0
        private static ITexture CreateBackground(DragableButton button)
        {
            var texture = button.Button.CreateTexture(null, Layer.BACKGROUND);

            texture.SetTexture(0.2, 0.2, 0.2);
            texture.SetPoint(FramePoint.TOPLEFT, BorderSize, -BorderSize);
            texture.SetPoint(FramePoint.BOTTOMRIGHT, -BorderSize, BorderSize);
            return(texture);
        }
Exemplo n.º 4
0
        private static DragableButton CreateDragableButton(ContentContainer attachedFrame)
        {
            var button = new DragableButton(BarHeight, attachedFrame.GetName() + "TitleBar")
            {
                DragWithoutShift = true
            };

            button.Button.SetWidth(attachedFrame.GetWidth());
            return(button);
        }
Exemplo n.º 5
0
        private static IButton CreateCloseButton(DragableButton button, Action closeAction)
        {
            var closeButton = (IButton)Global.FrameProvider.CreateFrame(FrameType.Button, button.Button.GetName() + "CloseButton", button.Button,
                                                                        "UIPanelCloseButton");

            closeButton.SetPoint(FramePoint.RIGHT, button.Button, FramePoint.RIGHT, 6 - BorderSize, 0);
            closeButton.SetHeight(BarHeight);
            closeButton.SetWidth(BarHeight);
            closeButton.SetScript(ButtonHandler.OnClick, (obj, arg1, arg2) => { closeAction(); });
            return(closeButton);
        }
Exemplo n.º 6
0
 public TitleBar(ContentContainer attachedFrame)
 {
     this.attachedFrame  = attachedFrame;
     this.dragableButton = CreateDragableButton(this.attachedFrame);
     this.textFrame      = CreateText(this.dragableButton);
     this.background     = CreateBackground(this.dragableButton);
     this.closeButton    = CreateCloseButton(this.dragableButton, () => { this.attachedFrame.Hide(); });
     this.attachedFrame.AttachTo(this.dragableButton.Button);
     this.borderFrame = CreateBorder(this.dragableButton);
     this.iconTexture = CreateIconTexture(this.dragableButton);
 }
Exemplo n.º 7
0
        private static ITexture CreateIconTexture(DragableButton button)
        {
            var texture = button.Button.CreateTexture(null, Layer.ARTWORK);

            texture.SetPoint(FramePoint.LEFT, button.Button, FramePoint.LEFT, BorderSize, 0);
            var dim = BarHeight - BorderSize * 2;

            texture.SetHeight(dim);
            texture.SetWidth(dim);
            return(texture);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Returns Related view field control.
        /// </summary>
        /// <param name="field">The related view field to get.</param>
        /// <param name="canvasSize">The size of the view canvas.</param>
        /// <returns>A list of the related view's controls.</returns>
        private List <Control> GetControls(RelatedViewField field, Size canvasSize)
        {
            DragableButton button = new DragableButton();

            SetControlProperties(button, field, canvasSize);
            button.Text        = field.PromptText;
            button.FlatStyle   = flatStyle;
            button.UseMnemonic = false;
            List <Control> controls = new List <Control>();

            controls.Add(button);
            return(controls);
        }