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); }
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); }
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); }
private static DragableButton CreateDragableButton(ContentContainer attachedFrame) { var button = new DragableButton(BarHeight, attachedFrame.GetName() + "TitleBar") { DragWithoutShift = true }; button.Button.SetWidth(attachedFrame.GetWidth()); return(button); }
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); }
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); }
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); }
/// <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); }