public static void AddListener(this Button value, Component component, UnityAction unityAction) { value.onClick.AddListener(unityAction); #if UNITY_EDITOR EditorButtonHelper editorButtonHelper = value.gameObject.AddComponent <EditorButtonHelper>(); editorButtonHelper.Init(component, unityAction); #endif }
public static void AddListener(this InputField value, Component component, UnityAction <string> unityAction) { value.onEndEdit.AddListener(unityAction); #if UNITY_EDITOR EditorButtonHelper editorButtonHelper = value.gameObject.AddComponent <EditorButtonHelper>(); editorButtonHelper.Init(component, unityAction); #endif }
protected virtual void DrawButton(GridViewDrawArgs e) { EditorButtonObjectInfoArgs info = (e.ViewInfo as MyGridViewInfo).ButtonInfo; if (info != null) { EditorButtonPainter painter = EditorButtonHelper.GetPainter(BorderStyles.Default); info.Cache = e.Cache; painter.DrawObject(info); } }
private EditorButtonPainter GetCustomButtonPainter() { if (this.OwnerButton.DropDownArrowStyle != DropDownArrowStyle.Default && this.OwnerButton.DropDownArrowStyle != DropDownArrowStyle.SplitButton) { return(new CustomSkinEditorButtonPainter(this.LookAndFeel)); } if (OwnerButton.LookAndFeel.ActiveStyle == ActiveLookAndFeelStyle.Skin && OwnerButton.ButtonStyle == BorderStyles.Default) { return(new DropDownButtonPainter(new CustomSkinDropDownButtonPainter(OwnerButton.LookAndFeel))); } return(new DropDownButtonPainter(EditorButtonHelper.GetPainter(OwnerButton.ButtonStyle, OwnerButton.LookAndFeel))); }
public ButtonsPanelInfo Init() { var viewInfo = new ButtonsPanelInfo(); viewInfo.Painter = EditorButtonHelper.GetPainter(BorderStyles.Default, LookAndFeel); foreach (var button in Buttons) { var bi = new EditorButtonObjectInfoArgs(button, Appearance.Clone() as AppearanceObject, true); bi.BuiltIn = false; bi.FillBackground = true; viewInfo.ButtonsInfo.Add(bi); } return(viewInfo); }
protected void DrawButton(BaseViewInfo vi) { if (((PropertyGridControlDescendant)vi.Grid).ButtonInfoList != null) { foreach (EditorButtonObjectInfoArgs info in ((PropertyGridControlDescendant)vi.Grid).ButtonInfoList) { if (info != null) { EditorButtonPainter painter = EditorButtonHelper.GetPainter(BorderStyles.Default); info.Cache = this.DrawInfo.Cache; painter.DrawObject(info); } } } }
void DrawButtons(GraphicsCache cache, EditorButtonObjectCollection collection) { CustomGridControlView view = viewInfo.View as CustomGridControlView; foreach (EditorButtonObjectInfoArgs button in collection) { if (view.CustomFilterPanelButtons.IndexOf(button.Button) < viewInfo.CustomButtonsCountToDraw) { if (button.Cache == null) { button.Cache = cache; } EditorButtonHelper.GetPainter(BorderStyles.Default).DrawObject(button); } else { break; } } }
private void OnCustomDrawBandHeader(object sender, BandHeaderCustomDrawEventArgs e) { if (e.Band == null) { return; } //... DrawElementInfo buttonElementInfo = null; for (int i = 0; i < e.Info.InnerElements.Count; i++) { if (e.Info.InnerElements[i].ElementInfo is EditorButtonObjectInfoArgs) { buttonElementInfo = e.Info.InnerElements[i]; break; } } if (buttonElementInfo == null) { ButtonPredefines buttonKind = ButtonPredefines.Minus; if (GetBandColumnsDefaultOnlyVisibility(e.Band)) { buttonKind = ButtonPredefines.Plus; } EditorButton button = new EditorButton(buttonKind); EditorButtonPainter buttonPainter = EditorButtonHelper.GetPainter(BorderStyles.Default); EditorButtonObjectInfoArgs buttonInfoArgs = new EditorButtonObjectInfoArgs(e.Cache, button, e.Info.Appearance); buttonElementInfo = new DrawElementInfo(buttonPainter, buttonInfoArgs); buttonElementInfo.ElementInfo.Bounds = CalcButtonBounds(e.Bounds); buttonElementInfo.ElementInfo.State = ObjectState.Normal; e.Info.InnerElements.Add(buttonElementInfo); e.Info.CaptionRect = CalcCaptionRectWithButton(e, true); } e.Painter.DrawObject(e.Info); e.Handled = true; }