Esempio n. 1
0
        public void Calc(Rect position, Vector2 contentOffset, Vector2 scroll, float rowHeight, int rowCount, ListViewCalculator.ColumnSetting[] setting)
        {
            this.position = position;
            float Mutl = titleRowOffsetY + 1;

            titleRow = new ListViewCalculator.Row()
            {
                height   = rowHeight,
                rowID    = 0,
                position = new Rect(position.x,
                                    position.y,
                                    position.width,
                                    rowHeight * Mutl)
            };
            ListViewCalculator.ColumnSetting[] Tsetting = new ListViewCalculator.ColumnSetting[setting.Length];
            for (int i = 0; i < Tsetting.Length; i++)
            {
                Tsetting[i] = new ListViewCalculator.ColumnSetting()
                {
                    width           = setting[i].width,
                    name            = setting[i].name,
                    offsetX         = setting[i].titleoffsetX,
                    offSetY         = -titleRowOffsetY * rowHeight,
                    anchorType      = setting[i].titleAnchorType,
                    titleAnchorType = setting[i].titleAnchorType
                };
            }
            titleRow.Calc(Tsetting);
            titleRow.CalacLocal(new Rect(position.x,
                                         position.y,
                                         position.width,
                                         rowHeight * Mutl));

            if (view.width > titleRow.width)
            {
                float offset = view.width - titleRow.width;
                titleRow.width += offset;
                titleRow.localPostion.width += offset;
                titleRow.columns[titleRow.ColumnCount - 1].position.width     += offset;
                titleRow.columns[titleRow.ColumnCount - 1].localPostion.width += offset;
            }

            for (int i = 0; i < titleRow.ColumnCount; i++)
            {
                ListViewCalculator.Column item = titleRow.columns[i];
                item.position.x     -= scroll.x;
                item.localPostion.x -= scroll.x;
            }

            titleRow.position.x     = view.x;
            titleRow.position.width = view.width;

            _listView.Calc(new Rect(position.x,
                                    position.y + rowHeight * Mutl,
                                    position.width,
                                    position.height - rowHeight), contentOffset, scroll,
                           rowHeight,
                           rowCount, setting);

            _listView.view.height -= titleRowOffsetY * rowHeight;
        }
        public void Calc(Rect position, Vector2 contentOffset, Vector2 scroll, float rowHeight, int rowCount, ListViewCalculator.ColumnSetting[] setting)
        {
            this.Position = position;
            float Mutl = TitleRowOffsetY + 1;

            TitleRow = new ListViewCalculator.Row()
            {
                Height   = rowHeight,
                RowID    = 0,
                Position = new Rect(position.x,
                                    position.y,
                                    position.width,
                                    rowHeight * Mutl)
            };
            ListViewCalculator.ColumnSetting[] Tsetting = new ListViewCalculator.ColumnSetting[setting.Length];
            for (int i = 0; i < Tsetting.Length; i++)
            {
                Tsetting[i] = new ListViewCalculator.ColumnSetting()
                {
                    Width           = setting[i].Width,
                    Name            = setting[i].Name,
                    OffsetX         = setting[i].TitleoffsetX,
                    OffSetY         = -TitleRowOffsetY * rowHeight,
                    AnchorType      = setting[i].TitleAnchorType,
                    TitleAnchorType = setting[i].TitleAnchorType
                };
            }
            TitleRow.Calc(Tsetting);
            TitleRow.CalacLocal(new Rect(position.x,
                                         position.y,
                                         position.width,
                                         rowHeight * Mutl));

            if (View.width > TitleRow.Width)
            {
                float offset = View.width - TitleRow.Width;
                TitleRow.Width += offset;
                TitleRow.LocalPostion.width += offset;
                TitleRow.Columns[TitleRow.ColumnCount - 1].Position.width     += offset;
                TitleRow.Columns[TitleRow.ColumnCount - 1].LocalPostion.width += offset;
            }

            for (int i = 0; i < TitleRow.ColumnCount; i++)
            {
                ListViewCalculator.Column item = TitleRow.Columns[i];
                item.Position.x     -= scroll.x;
                item.LocalPostion.x -= scroll.x;
            }

            TitleRow.Position.x     = View.x;
            TitleRow.Position.width = View.width;

            ListView.Calc(new Rect(position.x,
                                   position.y + rowHeight * Mutl,
                                   position.width,
                                   position.height - rowHeight), contentOffset, scroll,
                          rowHeight,
                          rowCount, setting);

            ListView.View.height -= TitleRowOffsetY * rowHeight;
        }