//---------------------------------------------------------------------- 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) ); } }
//---------------------------------------------------------------------- public override void DoLayout(Rectangle _rect) { base.DoLayout(_rect); HitBox = LayoutRect; Point pCenter = LayoutRect.Center; switch (mAnchor) { case UI.Anchor.Start: if (mIcon.Texture != null) { mIcon.DoLayout(new Rectangle(LayoutRect.X + Padding.Left + Margin.Left, pCenter.Y - mIcon.ContentHeight / 2, mIcon.ContentWidth, mIcon.ContentHeight)); } mLabel.DoLayout( new Rectangle( LayoutRect.X + Padding.Left + Margin.Left + (mIcon.Texture != null ? mIcon.ContentWidth : 0), pCenter.Y - mLabel.ContentHeight / 2, mLabel.ContentWidth, mLabel.ContentHeight ) ); break; case UI.Anchor.Center: { int iLabelWidth = mLabel.ContentWidth; int iLabelOffset = ContentWidth; if (mIcon.Texture != null) { mIcon.DoLayout(new Rectangle(pCenter.X - ContentWidth / 2 + Padding.Left + Margin.Left, pCenter.Y - mIcon.ContentHeight / 2, mIcon.ContentWidth, mIcon.ContentHeight)); } else { iLabelWidth = Math.Min(mLabel.ContentWidth - mLabel.Padding.Horizontal, LayoutRect.Width) + mLabel.Padding.Horizontal; iLabelOffset += iLabelWidth - mLabel.ContentWidth; } mLabel.DoLayout( new Rectangle( pCenter.X - iLabelOffset / 2 + Padding.Left + Margin.Left + (mIcon.Texture != null ? mIcon.ContentWidth : 0), pCenter.Y - mLabel.ContentHeight / 2, iLabelWidth, mLabel.ContentHeight ) ); break; } } }
//---------------------------------------------------------------------- public override void DoLayout(Rectangle _rect) { base.DoLayout(_rect); mCheckBoxRect = new Rectangle(LayoutRect.X + Padding.Left, LayoutRect.Center.Y - Screen.Style.CheckBoxSize / 2, Screen.Style.CheckBoxSize, Screen.Style.CheckBoxSize); mLabel.DoLayout(new Rectangle(LayoutRect.X + Padding.Left + Screen.Style.CheckBoxSize, LayoutRect.Y + Padding.Top, LayoutRect.Width - Padding.Horizontal - Screen.Style.CheckBoxSize, LayoutRect.Height - Padding.Vertical)); UpdateContentSize(); }
public override void DoLayout(Rectangle _rect) { base.DoLayout(_rect); int iLabelX = 0; if (mImage.Texture != null) { mImage.DoLayout(new Rectangle(_rect.X, _rect.Y, mImage.ContentWidth, _rect.Height)); iLabelX += mImage.ContentWidth; } mLabel.DoLayout(new Rectangle(_rect.X + iLabelX, _rect.Y, _rect.Width - iLabelX, _rect.Height)); }
//---------------------------------------------------------------------- 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)); } } }
internal void DoLayout(Rectangle _rect) { mLabel.DoLayout(_rect); }