public void OnGUI()
    {
        if (!isShowing)
        {
            isShowing = true;
            window    = this;
            wPosition = window.position;

            EditorApplication.update -= refreshGUI;
            EditorApplication.update += refreshGUI;
        }

        //Debug.Log(Event.current + ":" + window.position);

        using (GuiX.hzLayout) {
            GUILayout.Label(wtitle ?? "", GUILayout.Width(50f));
            this.xInvoke("SearchFieldGUI", typeof(SearchableEditorWindow));
            GUILayout.Space(20f);

            var r = GUILayoutUtility.GetLastRect().dx(2f).dy(1f).wh(18f, 18f);
            //if (r.Contains(Event.current.mousePosition)) GUI.Box(r, " ");
            GUI.Label(r, "X");

            if (r.xLMB_isUp().noModifier)
            {
                isShowing = false;
                window    = null;
                Close();
            }
        }

        if (guiList == null)
        {
            return;
        }
        //GUILayout.Label(title + "[" + guiList.CacheList.Count + "]");

        guiList.Draw((r, info, idx) => {
            if (r.xLMB_isDown())
            {
                info.go.xPing();
            }
            GUI.Label(r, info.Name);
            return(20);
        });

        GUILayout.Space(20f);
    }
    public void Draw(Action <int, int, string> onReorder   = null,
                     Action <string, string, int> onRename = null,
                     Action <string, int, vlbGUIList <string> > OnRightClick = null,
                     Rect?drawRect = null)
    {
        _needRepaint = false;
        //isExpand = GuiX.xDrawTitleBar(title, 5f, null, isExpand);

        GDrawX.Bar().xDrawL_Arrow(ref isExpand)
        .xDrawL_BoldLabel(title)
        .xDrawSub(subRect => {
            using (GuiX.DisableGroup(editIndex != -1)) {
                if (subRect.dy(2f).xMiniButton("+", false))
                {
                    list.Add("");
                    editIndex    = drawer.CacheList.Count - 1;
                    editName     = "";
                    isExpand     = true;
                    _needRepaint = true;
                }
            }
        }, 16f, false, new Vector2(-2f, 0f));

        //var rAdd = GUILayoutUtility.GetLastRect().xAdjustTL(16).dy(2f).dw(-2f);
        //if (rAdd.xMiniButton("+", false)) {
        //    list.Add("");
        //    editIndex = drawer.CacheList.Count - 1;
        //    editName = "";
        //    isExpand = true;
        //    _needRepaint = true;
        //}

        if (isExpand)
        {
            drawer.Draw((r, v, idx) => {
                //if (idx == 0) Debug.Log("d2StringGUI " + idx + ":" + r);

                if (idx == editIndex)
                {
                    RenameGUI(r);
                }
                else
                {
                    var v1 = EditorGUI.TextField(r.dw(-20f).dt(2f), v);
                    if (v1 != v)
                    {
                        list[idx] = v1;
                        if (onRename != null)
                        {
                            onRename(v, v1, idx);
                        }
                    }

                    //Debug.Log(Event.current + ":" + r.Contains(Event.current.mousePosition) + ":" + GUI.GetNameOfFocusedControl
                    //remove focus when click outside
                    if (GUI.GetNameOfFocusedControl() == focusName && !r.Contains(Event.current.mousePosition) && Event.current.type == EventType.mouseDown)
                    {
                        GUI.FocusControl(null);
                        _needRepaint = true;
                    }

                    /*EditorGUI.LabelField(r.dl(r.width - 80f).dw(-10f).dt(2f).db(-2f), "" + depth * idx,
                     *  GuiX.miniLabelGrayStyle);*/
                }

                //if (v != "Default") { // Can not remove group / Stacks Default
                var remRect = r.xSubRectRight(16f).dx(-4f);
                GUI.DrawTexture(remRect, EditorResource.GetTexture2D("remove"));

                if (remRect.xLMB_isDown().noModifier)
                {
                    //updateComponent(v, null);
                    if (editIndex == idx)
                    {
                        editIndex = -1;
                    }
                    list.RemoveAt(idx);
                    _needRepaint = true;
                }
                //}

                return(18);
            }, onReorder, OnRightClick, null, drawRect);
        }
    }