Beispiel #1
0
        //----------------------------------------------------------------------
        public override void DoLayout(Rectangle _rect)
        {
            base.DoLayout(_rect);

            HitBox = _rect;

            Point pCenter = LayoutRect.Center;

            if (mIcon.Texture != null)
            {
                mIcon.DoLayout(new Rectangle(LayoutRect.X + Padding.Left, pCenter.Y - mIcon.ContentHeight / 2, mIcon.ContentWidth, mIcon.ContentHeight));
            }

            int iLabelWidth = LayoutRect.Width - Padding.Horizontal - (mIcon.Texture != null ? mIcon.ContentWidth : 0) - (IsClosable ? mCloseButton.ContentWidth : 0);

            mLabel.DoLayout(
                new Rectangle(
                    LayoutRect.X + Padding.Left + (mIcon.Texture != null ? mIcon.ContentWidth : 0), pCenter.Y - mLabel.ContentHeight / 2,
                    iLabelWidth, mLabel.ContentHeight
                    )
                );

            if (IsClosable)
            {
                mCloseButton.DoLayout(new Rectangle(
                                          LayoutRect.Right - 10 - mCloseButton.ContentWidth,
                                          pCenter.Y - mNotebook.Style.TabClose.Height / 2,
                                          mCloseButton.ContentWidth, mCloseButton.ContentHeight)
                                      );
            }
        }