コード例 #1
0
        /** ********************************************************************************
        * @summary コンストラクタ
        ***********************************************************************************/
        public TextureTreeView(TextureTreeViewState state, TextureColumnHeaderState headerState)
            : base(new TextureTreeViewState(), new TextureColumnHeader(headerState))
        {
            showAlternatingRowBackgrounds = true; // 背景のシマシマを表示
            showBorder = true;                    // 境界線を表示

            var textureColumnHeader = multiColumnHeader as TextureColumnHeader;

            textureColumnHeader.sortingChanged += OnSortingChanged;  // ソート変化時の処理を登録
            textureColumnHeader.searchChanged  += CallSearchChanged; // 列の検索が変化したときの処理を登録

            foreach (var searchField in headerState.SearchFields)
            {
                //searchField.searchChanged += () => CallSearchChanged("");
                searchField.searchChanged += CallSearchChanged;
            }
        }
コード例 #2
0
        /** ********************************************************************************
        * @summary TreeView の更新 Update
        ***********************************************************************************/
        private void CreateTreeView()
        {
            if (treeView != null)
            {
                return;
            }

            if (isCreatingTreeView)
            {
                return;
            }

            isCreatingTreeView = true;
            Repaint();

            EditorApplication.delayCall += () =>
            {
                if (columnSearchStates == null || columnSearchStates.Length != ToolConfig.HeaderColumnNum)
                {
                    columnSearchStates = new SearchState[ToolConfig.HeaderColumnNum];
                    for (int i = 0; i < ToolConfig.HeaderColumnNum; i++)
                    {
                        columnSearchStates[i] = new SearchState();
                    }
                }


                treeViewState = treeViewState ?? new TextureTreeViewState();
                headerState   = headerState ?? new TextureColumnHeaderState(ToolConfig.HeaderColumns, columnSearchStates);
                headerState.ResetSearch();

                // TreeView作成
                treeView = treeView ?? new TextureTreeView(treeViewState, headerState);
                treeView.searchString = TextureTreeView.defaultSearchString;
                treeView.Reload(); // Reloadを呼ぶとBuildRootが実行され、次にBuildRowsが実行されます。

                // SearchFieldを初期化
                searchField = new SearchField();
                searchField.downOrUpArrowKeyPressed += treeView.SetFocusAndEnsureSelectedItem;

                isCreatingTreeView = false;
            };
        }