Exemplo n.º 1
0
        //----------------------------------------------------------------------
        public override void DoLayout(Rectangle _rect)
        {
            base.DoLayout(_rect);

            if (EnableScrolling)
            {
                Scrollbar.DoLayout(LayoutRect, ContentHeight);
            }

            HitBox = LayoutRect;
        }
Exemplo n.º 2
0
        //----------------------------------------------------------------------
        public override void DoLayout(Rectangle _rect)
        {
            base.DoLayout(_rect);
            HitBox = LayoutRect;

            mDropDownHitBox = new Rectangle(
                HitBox.Left, HitBox.Bottom,
                HitBox.Width, Math.Min(siMaxLineDisplayed, Items.Count) * (Screen.Style.MediumFont.LineSpacing + TextPadding.Vertical) + Padding.Vertical);

            mScrollbar.DoLayout(mDropDownHitBox, Items.Count * (Screen.Style.MediumFont.LineSpacing + TextPadding.Vertical));

            mCurrentItemLabel.DoLayout(new Rectangle(LayoutRect.X + TextPadding.Left, LayoutRect.Top + TextPadding.Top, LayoutRect.Width - TextPadding.Horizontal - Screen.Style.DropDownArrow.Width, LayoutRect.Height - TextPadding.Vertical));

            if (IsOpen)
            {
                int iLinesDisplayed = Math.Min(siMaxLineDisplayed, Items.Count);

                int iMaxIndex = Math.Min(Items.Count - 1, ScrollItemOffset + iLinesDisplayed - 1);
                for (int iIndex = ScrollItemOffset; iIndex <= iMaxIndex; iIndex++)
                {
                    Items[iIndex].DoLayout(new Rectangle(LayoutRect.X + TextPadding.Left, LayoutRect.Bottom + (Screen.Style.MediumFont.LineSpacing + TextPadding.Vertical) * (iIndex - ScrollItemOffset) + TextPadding.Top, LayoutRect.Width - TextPadding.Horizontal, Screen.Style.MediumFont.LineSpacing + TextPadding.Vertical + 10));
                }
            }
        }
Exemplo n.º 3
0
        //----------------------------------------------------------------------
        public override void DoLayout(Rectangle _rect)
        {
            base.DoLayout(_rect);
            HitBox = new Rectangle(LayoutRect.X + Padding.Left, LayoutRect.Y + Padding.Top, LayoutRect.Width - Padding.Horizontal, LayoutRect.Height - Padding.Vertical);

            int iColX     = 0;
            int iColIndex = 0;

            foreach (ListViewColumn col in Columns)
            {
                if (col.Label != null)
                {
                    col.Label.DoLayout(new Rectangle(LayoutRect.X + Padding.Left + iColX, LayoutRect.Y + Padding.Top, col.Width, Style.RowHeight));
                }
                else
                {
                    col.Image.DoLayout(new Rectangle(LayoutRect.X + Padding.Left + iColX, LayoutRect.Y + Padding.Top, col.Width, Style.RowHeight));
                }

                int iRowIndex = 0;
                foreach (ListViewRow row in Rows)
                {
                    int iRowY = GetRowY(iRowIndex);
                    row.Cells[iColIndex].DoLayout(new Rectangle(LayoutRect.X + Padding.Left + iColX, LayoutRect.Y + Padding.Top + iRowY, col.Width, Style.RowHeight + Style.RowSpacing), iColIndex, col, row);

                    iRowIndex++;
                }

                iColIndex++;

                iColX += col.Width + ColSpacing;
            }

            //------------------------------------------------------------------
            if (HoveredRow != null)
            {
                int iRight = LayoutRect.Right - Padding.Right - Style.CellHorizontalPadding;
                if (ActionButtonsColumn != -1)
                {
                    iRight = LayoutRect.Left + Padding.Left + Columns.Take(ActionButtonsColumn + 1).Sum(x => x.Width);
                }

                int iButtonX = Style.ActionButtonsRightPadding;
                foreach (Button button in ActionButtons.Reverse <Button>())
                {
                    button.DoLayout(new Rectangle(
                                        iRight - iButtonX - button.ContentWidth,
                                        LayoutRect.Y + Padding.Top + GetRowY(Rows.IndexOf(HoveredRow)) + Style.RowHeight / 2 - button.ContentHeight / 2,
                                        button.ContentWidth, button.ContentHeight)
                                    );

                    iButtonX += button.ContentWidth + Style.CellHorizontalPadding;
                }
            }

            //------------------------------------------------------------------
            ContentHeight = Padding.Vertical + Rows.Count * (Style.RowHeight + Style.RowSpacing) - Style.RowSpacing;
            if (NewRowText != null)
            {
                ContentHeight += Style.RowHeight;
            }

            Scrollbar.DoLayout(LayoutRect, ContentHeight);
        }