Exemple #1
0
        public TimelineTreeViewGUI(TimelineWindow sequencerWindow, TimelineAsset timeline, Rect rect)
        {
            m_Timeline = timeline;
            m_Window   = sequencerWindow;

            var treeviewState = new TreeViewState();

            treeviewState.scrollPos = new Vector2(treeviewState.scrollPos.x, TimelineWindowViewPrefs.GetOrCreateViewModel(m_Timeline).verticalScroll);

            m_TreeView = new TreeViewController(sequencerWindow, treeviewState);
            m_TreeView.horizontalScrollbarStyle = GUIStyle.none;
            m_TreeView.scrollViewStyle          = GUI.skin.scrollView;
            m_TreeView.keyboardInputCallback    = sequencerWindow.TreeViewKeyboardCallback;


            m_TimelineTreeView = new TimelineTreeView(sequencerWindow, m_TreeView);
            var dragging = new TimelineDragging(m_TreeView, m_Window, m_Timeline);

            m_DataSource = new TimelineDataSource(this, m_TreeView, sequencerWindow);

            m_DataSource.onVisibleRowsChanged += m_TimelineTreeView.CalculateRowRects;
            m_TreeView.Init(rect, m_DataSource, m_TimelineTreeView, dragging);

            m_DataSource.ExpandItems(m_DataSource.root);
        }
 public void CalculateRowRects()
 {
     if (!this.m_TreeView.get_isSearching())
     {
         IList <TreeViewItem> rows = this.m_TreeView.get_data().GetRows();
         this.m_RowRects = new List <Rect>(rows.Count);
         float num = 6f;
         this.m_MaxWidthOfRows = 1f;
         for (int i = 0; i < rows.Count; i++)
         {
             TreeViewItem item = rows[i];
             if (i != 0)
             {
                 num += TimelineTreeView.GetSpacing(item);
             }
             Vector2 sizeOfRow = this.GetSizeOfRow(item);
             this.m_RowRects.Add(new Rect(0f, num, sizeOfRow.x, sizeOfRow.y));
             num += sizeOfRow.y;
             if (sizeOfRow.x > this.m_MaxWidthOfRows)
             {
                 this.m_MaxWidthOfRows = sizeOfRow.x;
             }
         }
     }
 }