public void RepositionForCell(LayoutCellInfo info)
 {
     if (isLayoutSizeLocked)
     {
         if (info.anchor == AnchorType.Center)
         {
             transform.localPosition = new Vector3(0, transform.localPosition.y, transform.localPosition.z);
         }
         else if (info.anchor == AnchorType.Left)
         {
             transform.localPosition = new Vector3((-info.cellRect.width + _dimensions.x * _scale.x) * 0.5f, transform.localPosition.y, transform.localPosition.z);
         }
         else if (info.anchor == AnchorType.Right)
         {
             transform.localPosition = new Vector3((info.cellRect.width - _dimensions.x * _scale.x) * 0.5f, transform.localPosition.y, transform.localPosition.z);
         }
         else if (info.anchor == AnchorType.Bottom)
         {
             transform.localPosition = new Vector3(transform.localPosition.x, (-info.cellRect.height + _dimensions.x * _scale.y) * 0.5f, transform.localPosition.z);
         }
         else if (info.anchor == AnchorType.Top)
         {
             transform.localPosition = new Vector3(transform.localPosition.x, (info.cellRect.height - _dimensions.x * _scale.y) * 0.5f, transform.localPosition.z);
         }
     }
     else
     {
         this.dimensions = new Vector2(info.cellRect.width / scale.x, info.cellRect.height / scale.y);
     }
 }
예제 #2
0
 public void RepositionForCell(LayoutCellInfo info)
 {
     if (IsSlicedSprite)
     {
         initialDimensions = SlicedSprite.dimensions;
     }
 }
예제 #3
0
    public void RepositionForCell(LayoutCellInfo info)
    {
        if (info.type == GUILayouterType.Horizontal)
        {
            OccupiedPixels = info.cellRect;
        }
        else if (info.type == GUILayouterType.Vertical)
        {
            OccupiedPixels = info.cellRect;
        }

        if (info.anchor == AnchorType.Left)
        {
            CachedTransform.localPosition = new Vector3(-info.cellRect.width * 0.5f, 0, CachedTransform.localPosition.z);
        }
        else if (info.anchor == AnchorType.Right)
        {
            CachedTransform.localPosition = new Vector3(info.cellRect.width * 0.5f, 0, CachedTransform.localPosition.z);
        }
        else if (info.anchor == AnchorType.Top)
        {
            CachedTransform.localPosition = new Vector3(0, info.cellRect.height * 0.5f, CachedTransform.localPosition.z);
        }
        else if (info.anchor == AnchorType.Bottom)
        {
            CachedTransform.localPosition = new Vector3(0, -info.cellRect.height * 0.5f, CachedTransform.localPosition.z);
        }
        else if (info.anchor == AnchorType.Center)
        {
            CachedTransform.localPosition = new Vector3(0, 0, CachedTransform.localPosition.z);;
        }
    }
예제 #4
0
    public void RepositionForCell(LayoutCellInfo info)
    {
        float y = (rePositionPlace.transform.position.y - transform.position.y) / (Vector3.one / ((float)ScreenDimentions.Height / (float)Screen.height)).y;

        ToReposition.center = Vector3.up * y;
        ToReposition.size   = new Vector3(rePositionPlace.RecievedRect.size.x * sizeMultiplier, rePositionPlace.RecievedRect.size.y * sizeMultiplier, 1);
    }
예제 #5
0
    public void RepositionForCell(LayoutCellInfo info)
    {
        directionVector = endTransform.position - beginTransform.position;
        scrollLength    = directionVector.magnitude - barSprite.GetBounds().size.x *barSprite.transform.lossyScale.x;
        directionVector.Normalize();

        barHalfSize = barSprite.GetBounds().size.x * 0.5f * barSprite.transform.lossyScale.x;
        ScrollView_OnContentPositionChanged();
    }
예제 #6
0
    public void RepositionForCell(LayoutCellInfo info)
    {
        if (ButtonCollider == null)
        {
            CustomDebug.LogError("Collider not set !");
            return;
        }

        ButtonCollider.size = new Vector3(info.cellRect.width * xCoof, info.cellRect.height * yCoof, 1f);
    }
예제 #7
0
    public void RepositionForCell(LayoutCellInfo info)
    {
        this.MaxTextLength = info.cellRect.width;

        if (info.anchor == AnchorType.Top)
        {
            this.anchor = TextAnchor.UpperCenter;
        }
        else if (info.anchor == AnchorType.Bottom)
        {
            this.anchor = TextAnchor.LowerCenter;
        }
        else if (info.anchor == AnchorType.Center)
        {
            this.anchor = TextAnchor.MiddleCenter;
        }
        else if (info.anchor == AnchorType.Left)
        {
            this.anchor = TextAnchor.MiddleLeft;
        }
        else if (info.anchor == AnchorType.Right)
        {
            this.anchor = TextAnchor.MiddleRight;
        }
       
        if (info.anchor == AnchorType.Center)
        {
            transform.localPosition = new Vector3(0, transform.localPosition.y, transform.localPosition.z);
        }
        else if (info.anchor == AnchorType.Left)
        {
            transform.localPosition = new Vector3(-info.cellRect.width * 0.5f, transform.localPosition.y, transform.localPosition.z);
        }
        else if (info.anchor == AnchorType.Right)
        {
            transform.localPosition = new Vector3(info.cellRect.width * 0.5f, transform.localPosition.y, transform.localPosition.z);
        }

        if (info.anchor == AnchorType.Center)
        {
            transform.localPosition = new Vector3(transform.localPosition.x, 0, transform.localPosition.z);
        }
        else if (info.anchor == AnchorType.Bottom)
        {
            transform.localPosition = new Vector3(transform.localPosition.x, -info.cellRect.height * 0.5f, transform.localPosition.z);
        }
        else if (info.anchor == AnchorType.Top)
        {
            transform.localPosition = new Vector3(transform.localPosition.x, info.cellRect.height * 0.5f, transform.localPosition.z);
        }    

    }
    public void RepositionForCell(LayoutCellInfo info)
    {
        if (rePositionPlace)
        {
            float y = (rePositionPlace.transform.position.y - transform.position.y) / (Vector3.one / ((float)ScreenDimentions.Height / (float)Screen.height)).y;
            float x = (rePositionPlace.transform.position.x - transform.position.x) / (Vector3.one / ((float)ScreenDimentions.Width / (float)Screen.width)).x;

            Vector3 center = new Vector3(x, y, 0);
            ToReposition.center = center;
            ToReposition.size   = new Vector3(rePositionPlace.RecievedRect.size.x * sizeMultiplier, rePositionPlace.RecievedRect.size.y * sizeMultiplier, 1);
        }
        else
        {
            ToReposition.size = new Vector3(info.cellRect.size.x * sizeMultiplier, info.cellRect.size.y * sizeMultiplier, 1);
        }
    }
예제 #9
0
    public void RepositionForCell(LayoutCellInfo info)
    {
        Vector3 untrimmedBounds = GetUntrimmedBounds().size;

        if (isLayoutSizeLocked)
        {
            if (info.anchor == AnchorType.Center)
            {
                CachedTransform.localPosition = new Vector3(0, CachedTransform.localPosition.y, CachedTransform.localPosition.z);
            }
            else if (info.anchor == AnchorType.Left)
            {
                CachedTransform.localPosition = new Vector3((-info.cellRect.width + untrimmedBounds.x) * 0.5f, CachedTransform.localPosition.y, CachedTransform.localPosition.z);
            }
            else if (info.anchor == AnchorType.Right)
            {
                CachedTransform.localPosition = new Vector3((info.cellRect.width - untrimmedBounds.x) * 0.5f, CachedTransform.localPosition.y, CachedTransform.localPosition.z);
            }
            else if (info.anchor == AnchorType.Center)
            {
                CachedTransform.localPosition = new Vector3(CachedTransform.localPosition.x, 0, CachedTransform.localPosition.z);
            }
            else if (info.anchor == AnchorType.Bottom)
            {
                CachedTransform.localPosition = new Vector3(CachedTransform.localPosition.x, (-info.cellRect.height + untrimmedBounds.y) * 0.5f, CachedTransform.localPosition.z);
            }
            else if (info.anchor == AnchorType.Top)
            {
                CachedTransform.localPosition = new Vector3(CachedTransform.localPosition.x, (info.cellRect.height - untrimmedBounds.y) * 0.5f, CachedTransform.localPosition.z);
            }
        }
        else
        {
            this.scale      = Vector3.one;
            untrimmedBounds = GetUntrimmedBounds().size;

            this.scale = new Vector3(_scale.x * info.cellRect.width / untrimmedBounds.x, _scale.y * info.cellRect.height / untrimmedBounds.y, _scale.z);

            CachedTransform.localPosition = new Vector3(0, 0, CachedTransform.localPosition.z);
        }
    }
예제 #10
0
        protected virtual void LayoutSingleTileCell(LayoutCellInfo info)
        {
            Size textSize = Size.Empty;
            Font font = info.Font;
            int fontHeight = info.FontHeight;
            int height = 0;
            if (info.LayoutStyle.Font != null)
            {
                font = info.LayoutStyle.Font;
                fontHeight = font.Height;
            }

            info.ContextCell.OnLayoutCell();

            if (info.ContextCell.Images.LargestImageSize.IsEmpty && HasImage(info.ContextCell))
                info.ContextCell.Images.RefreshLargestImageSize();

            if (info.ContextCell.HostedControl != null)
            {
                Size controlSize = info.ContextCell.HostedControl.Size;
                if (!info.ContextCell.HostedControlSize.IsEmpty)
                    controlSize = info.ContextCell.HostedControlSize;
                if (info.CellWidth == 0)
                    textSize = new Size(controlSize.Width, controlSize.Height);
                else
                {
                    int availTextWidth = info.CellWidth -
                                       ElementStyleLayout.HorizontalStyleWhiteSpace(info.LayoutStyle);
                    textSize = new Size(availTextWidth, controlSize.Height);
                }
            }
            else if (info.ContextCell.HostedItem != null)
            {
                if (info.CellWidth != 0) info.ContextCell.HostedItem.WidthInternal = info.CellWidth;
                info.ContextCell.HostedItem.RecalcSize();

                Size controlSize = info.ContextCell.HostedItem.Size;
                if (info.CellWidth == 0)
                    textSize = new Size(controlSize.Width, controlSize.Height);
                else
                {
                    int availTextWidth = info.CellWidth -
                                       ElementStyleLayout.HorizontalStyleWhiteSpace(info.LayoutStyle);
                    textSize = new Size(availTextWidth, controlSize.Height);
                    info.ContextCell.HostedItem.WidthInternal = availTextWidth;
                }
            }
            else
            {
                // Calculate Text Width and Height
                if (info.CellWidth == 0)
                {
                    if (info.ContextCell.TextMarkupBody == null)
                    {
                        string text = info.ContextCell.DisplayText;
                        if (text != "")
                        {
                            if (info.LayoutStyle.WordWrap && info.LayoutStyle.MaximumWidth > 0)
                                textSize = TextDrawing.MeasureString(info.Graphics, text, font, info.LayoutStyle.MaximumWidth);
                            else if (info.ContextCell.Parent != null && info.ContextCell.Parent.Style != null && info.ContextCell.Parent.Style.WordWrap && info.ContextCell.Parent.Style.MaximumWidth > 0)
                                textSize = TextDrawing.MeasureString(info.Graphics, text, font, info.ContextCell.Parent.Style.MaximumWidth);
                            else
                                textSize = TextDrawing.MeasureString(info.Graphics, text, font, 0, eTextFormat.Left | eTextFormat.LeftAndRightPadding | eTextFormat.GlyphOverhangPadding | eTextFormat.NoPrefix);
#if (FRAMEWORK20)
                            if (!BarFunctions.IsVista && BarUtilities.UseTextRenderer) textSize.Width += 4;
#endif
                        }
                        else if (info.ContextCell.Images.LargestImageSize.IsEmpty && !info.ContextCell.CheckBoxVisible)
                        {
                            textSize = new Size(5, fontHeight);
                        }
                    }
                    else
                    {
                        Size availSize = new Size(1600, 1);
                        if (info.LayoutStyle.WordWrap && info.LayoutStyle.MaximumWidth > 0)
                            availSize.Width = info.LayoutStyle.MaximumWidth;
                        else if (info.ContextCell.Parent != null && info.ContextCell.Parent.Style != null && info.ContextCell.Parent.Style.WordWrap && info.ContextCell.Parent.Style.MaximumWidth > 0)
                            availSize.Width = info.ContextCell.Parent.Style.MaximumWidth;

                        DevComponents.DotNetBar.TextMarkup.MarkupDrawContext d = new DevComponents.DotNetBar.TextMarkup.MarkupDrawContext(info.Graphics, font, Color.Empty, false);
                        info.ContextCell.TextMarkupBody.Measure(availSize, d);
                        availSize = info.ContextCell.TextMarkupBody.Bounds.Size;
                        d.RightToLeft = !info.LeftToRight;
                        info.ContextCell.TextMarkupBody.Arrange(new Rectangle(0, 0, availSize.Width, availSize.Height), d);

                        textSize = info.ContextCell.TextMarkupBody.Bounds.Size;
                    }
                }
                else
                {
                    int availTextWidth = info.CellWidth -
                                       ElementStyleLayout.HorizontalStyleWhiteSpace(info.LayoutStyle);

                    availTextWidth -= info.ContextCell.Images.LargestImageSize.Width +
                        (info.ContextCell.Images.LargestImageSize.Width > 0 ? ImageTextSpacing * 2 : 0);

                    if (info.ContextCell.CheckBoxVisible)
                        availTextWidth -= CheckBoxSize.Width + ImageTextSpacing * 2;

                    int cellHeight = fontHeight;

                    if (info.LayoutStyle.WordWrap || info.ContextCell.TextMarkupBody != null)
                    {
                        cellHeight = info.LayoutStyle.MaximumHeight - info.LayoutStyle.MarginTop -
                                   info.LayoutStyle.MarginBottom - info.LayoutStyle.PaddingTop - info.LayoutStyle.PaddingBottom;

                        if (info.ContextCell.TextMarkupBody == null)
                        {
                            if (availTextWidth > 0)
                            {
                                if (cellHeight > 0)
                                    textSize = TextDrawing.MeasureString(info.Graphics, info.ContextCell.DisplayText, font, new Size(availTextWidth, cellHeight), info.LayoutStyle.TextFormat);
                                else
                                    textSize = TextDrawing.MeasureString(info.Graphics, info.ContextCell.DisplayText, font, availTextWidth, info.LayoutStyle.TextFormat);
                            }
                        }
                        else
                        {
                            Size availSize = new Size(availTextWidth, 1);
                            DevComponents.DotNetBar.TextMarkup.MarkupDrawContext d = new DevComponents.DotNetBar.TextMarkup.MarkupDrawContext(info.Graphics, font, Color.Empty, false);
                            info.ContextCell.TextMarkupBody.Measure(availSize, d);
                            availSize = info.ContextCell.TextMarkupBody.Bounds.Size;
                            availSize.Width = availTextWidth;
                            d.RightToLeft = !info.LeftToRight;
                            info.ContextCell.TextMarkupBody.Arrange(new Rectangle(0, 0, availSize.Width, availSize.Height), d);

                            textSize = info.ContextCell.TextMarkupBody.Bounds.Size;
                        }
                    }
                    else
                        textSize = new Size(availTextWidth, cellHeight);
                }
            }

            if (info.LayoutStyle.WordWrap)
                info.ContextCell.WordWrap = true;
            else
                info.ContextCell.WordWrap = false;

            height = (int)Math.Max(height, Math.Ceiling((double)textSize.Height));
            if (info.VerticalPartAlignment)
            {
                if (info.ContextCell.Images.LargestImageSize.Height > 0)
                    height += info.ContextCell.Images.LargestImageSize.Height + this.ImageTextSpacing;
                if (info.ContextCell.CheckBoxVisible)
                    height += CheckBoxSize.Height + this.ImageCheckBoxSpacing;
            }
            else
            {
                if (info.ContextCell.Images.LargestImageSize.Height > height)
                    height = info.ContextCell.Images.LargestImageSize.Height;
                if (info.ContextCell.CheckBoxVisible && CheckBoxSize.Height > height)
                    height = CheckBoxSize.Height;
            }

            Rectangle r = new Rectangle(info.Left + ElementStyleLayout.LeftWhiteSpace(info.LayoutStyle),
                                      info.Top + ElementStyleLayout.TopWhiteSpace(info.LayoutStyle)
                                      , info.CellWidth, height);

            if (r.Width == 0)
            {
                if (info.VerticalPartAlignment)
                {
                    r.Width = (int)Math.Ceiling((double)textSize.Width);
                    if (info.ContextCell.Images.LargestImageSize.Width > r.Width)
                        r.Width = (info.ContextCell.Images.LargestImageSize.Width + this.ImageTextSpacing);
                    if (info.ContextCell.CheckBoxVisible && CheckBoxSize.Width > r.Width)
                        r.Width += (CheckBoxSize.Width + this.ImageTextSpacing);
                }
                else
                {
                    r.Width = (int)Math.Ceiling((double)textSize.Width);
                    if (info.ContextCell.Images.LargestImageSize.Width > 0)
                        r.Width += (info.ContextCell.Images.LargestImageSize.Width + this.ImageTextSpacing);
                    if (info.ContextCell.CheckBoxVisible)
                        r.Width += (CheckBoxSize.Width + this.ImageTextSpacing);
                }
            }

            // Now that we have cell bounds store them
            Rectangle rCellBounds = new Rectangle(info.Left, info.Top, info.CellWidth, r.Height + info.LayoutStyle.MarginTop + info.LayoutStyle.MarginBottom + info.LayoutStyle.PaddingTop + info.LayoutStyle.PaddingBottom);
            if (rCellBounds.Width == 0)
                rCellBounds.Width = r.Width + ElementStyleLayout.HorizontalStyleWhiteSpace(info.LayoutStyle);
            info.ContextCell.SetBounds(rCellBounds);

            // Set position of the check box
            if (info.ContextCell.CheckBoxVisible && rCellBounds.Width >= this.CheckBoxSize.Width)
            {
                eVerticalAlign va = GetCheckBoxVerticalAlign(info.ContextCell.CheckBoxAlignment, info.View);
                eHorizontalAlign ha = GetCheckBoxHorizontalAlign(info.ContextCell.CheckBoxAlignment, info.LeftToRight, info.View);
                if (ha == eHorizontalAlign.Center && (!string.IsNullOrEmpty(info.ContextCell.Text) || !info.ContextCell.Images.LargestImageSize.IsEmpty))
                    ha = eHorizontalAlign.Left;

                if (info.VerticalPartAlignment)
                    info.ContextCell.SetCheckBoxBounds(AlignContentVertical(this.CheckBoxSize, ref r, ha, va, this.ImageTextSpacing));
                else
                    info.ContextCell.SetCheckBoxBounds(AlignContent(this.CheckBoxSize, ref r, ha, va, this.ImageTextSpacing));
            }
            else
                info.ContextCell.SetCheckBoxBounds(Rectangle.Empty);

            // Set Position of the image
            if (!info.ContextCell.Images.LargestImageSize.IsEmpty && rCellBounds.Width >= info.ContextCell.Images.LargestImageSize.Width)
            {
                eVerticalAlign va = GetVerticalAlign(info.ContextCell.ImageAlignment, info.View);
                eHorizontalAlign ha = GetHorizontalAlign(info.ContextCell.ImageAlignment, info.LeftToRight, info.View);
                if (ha == eHorizontalAlign.Center && (!string.IsNullOrEmpty(info.ContextCell.Text) || info.ContextCell.CheckBoxVisible))
                    ha = eHorizontalAlign.Left;

                if (info.VerticalPartAlignment)
                    info.ContextCell.SetImageBounds(AlignContentVertical(info.ContextCell.Images.LargestImageSize, ref r, ha, va, this.ImageTextSpacing));
                else
                    info.ContextCell.SetImageBounds(AlignContent(info.ContextCell.Images.LargestImageSize, ref r, ha, va, this.ImageTextSpacing));
            }
            else
                info.ContextCell.SetImageBounds(Rectangle.Empty);

            // Set position of the text
            //info.ContextCell.SetTextBounds(Rectangle.Empty);
            if (!textSize.IsEmpty)
            {
                if (info.CellWidth > 0)
                    r.Width -= 2;
                if (info.View == eView.Tile && info.CellIndex == 0)
                    info.ContextCell.TextContentBounds = new Rectangle(r.X, r.Y, textSize.Width, textSize.Height + 1);
                else
                    info.ContextCell.TextContentBounds = r;
            }
            else
                info.ContextCell.TextContentBounds = Rectangle.Empty;

        }
예제 #11
0
			private LayoutCellInfo GetLayoutCellInfo()
			{
				if(m_LayoutCellInfo==null)
					m_LayoutCellInfo=new LayoutCellInfo();
				return m_LayoutCellInfo;
			}
예제 #12
0
			public void LayoutSingleCell(LayoutCellInfo info)
			{
				Size textSize=Size.Empty;
				Font font=info.Font;
				int height=0;
				if(info.LayoutStyle.Font!=null)
					font=info.LayoutStyle.Font;

				info.ContextCell.OnLayoutCell();

				if(info.ContextCell.HostedControl!=null)
				{
					Size controlSize=info.ContextCell.HostedControl.Size;
					if(!info.ContextCell.HostedControlSize.IsEmpty)
						controlSize = info.ContextCell.HostedControlSize;
					if(info.CellWidth==0)
						textSize=new Size(controlSize.Width,controlSize.Height);
					else
					{
						int availTextWidth=info.CellWidth-
						                   ElementStyleLayout.HorizontalStyleWhiteSpace(info.LayoutStyle);
						textSize=new Size(availTextWidth,controlSize.Height);
					}
				}
				else
				{
					// Calculate Text Width and Height
					if(info.CellWidth==0)
					{
						if (info.ContextCell.TextMarkupBody == null)
						{
							string text=info.ContextCell.Text;
							if(text!="")
							{
								if(info.LayoutStyle.WordWrap && info.LayoutStyle.MaximumWidth>0)
									textSize=TextDrawing.MeasureString(info.Graphics, text, font, info.LayoutStyle.MaximumWidth);
								else if(info.ContextCell.Parent!=null && info.ContextCell.Parent.Style!=null && info.ContextCell.Parent.Style.WordWrap && info.ContextCell.Parent.Style.MaximumWidth>0)
									textSize=TextDrawing.MeasureString(info.Graphics, text, font, info.ContextCell.Parent.Style.MaximumWidth);
								else
									textSize=TextDrawing.MeasureString(info.Graphics, text, font);
							}
						}
						else
						{
							Size availSize = new Size(1600, 1);
							if(info.LayoutStyle.WordWrap && info.LayoutStyle.MaximumWidth>0)
								availSize.Width = info.LayoutStyle.MaximumWidth;
							else if(info.ContextCell.Parent!=null && info.ContextCell.Parent.Style!=null && info.ContextCell.Parent.Style.WordWrap && info.ContextCell.Parent.Style.MaximumWidth>0)
								availSize.Width = info.ContextCell.Parent.Style.MaximumWidth;

							TextMarkup.MarkupDrawContext d = new TextMarkup.MarkupDrawContext(info.Graphics, font, Color.Empty, false);
							info.ContextCell.TextMarkupBody.Measure(availSize, d);
							availSize = info.ContextCell.TextMarkupBody.Bounds.Size;
							d.RightToLeft = !info.LeftToRight;
							info.ContextCell.TextMarkupBody.Arrange(new Rectangle(0, 0, availSize.Width, availSize.Height), d);

							textSize = info.ContextCell.TextMarkupBody.Bounds.Size;
						}
					}
					else
					{
						int availTextWidth=info.CellWidth-
						                   ElementStyleLayout.HorizontalStyleWhiteSpace(info.LayoutStyle);

						availTextWidth-=info.ContextCell.Images.LargestImageSize.Width;
						if(info.ContextCell.CheckBoxVisible)
							availTextWidth-=CheckBoxSize.Width;
						int cellHeight=font.Height;

						if(info.LayoutStyle.WordWrap)
						{
							cellHeight=info.LayoutStyle.MaximumHeight-info.LayoutStyle.MarginTop-
							           info.LayoutStyle.MarginBottom-info.LayoutStyle.PaddingTop-info.LayoutStyle.PaddingBottom;
							
							if (info.ContextCell.TextMarkupBody == null)
							{
								if(availTextWidth>0)
								{
									if(cellHeight>0)
										textSize=TextDrawing.MeasureString(info.Graphics, info.ContextCell.Text,font,new Size(availTextWidth,cellHeight),info.LayoutStyle.TextFormat);
									else
										textSize=TextDrawing.MeasureString(info.Graphics, info.ContextCell.Text, font, availTextWidth, info.LayoutStyle.TextFormat);
								}
							}
							else
							{
								Size availSize = new Size(availTextWidth, 1);
								TextMarkup.MarkupDrawContext d = new TextMarkup.MarkupDrawContext(info.Graphics, font, Color.Empty, false);
								info.ContextCell.TextMarkupBody.Measure(availSize, d);
								availSize = info.ContextCell.TextMarkupBody.Bounds.Size;
								availSize.Width = availTextWidth;
								d.RightToLeft = !info.LeftToRight;
								info.ContextCell.TextMarkupBody.Arrange(new Rectangle(0, 0, availSize.Width, availSize.Height), d);

								textSize = info.ContextCell.TextMarkupBody.Bounds.Size;
							}
						}
						else
							textSize=new Size(availTextWidth,cellHeight);
					}
				}

				if(info.LayoutStyle.WordWrap)
					info.ContextCell.WordWrap=true;
				else
					info.ContextCell.WordWrap=false;

				height=(int)Math.Ceiling((double)textSize.Height);
				if(info.VerticalPartAlignment)
				{
					if(info.ContextCell.Images.LargestImageSize.Height>0)
						height+=info.ContextCell.Images.LargestImageSize.Height;
					if(info.ContextCell.CheckBoxVisible)
						height+=CheckBoxSize.Height;
				}
				else
				{
					if(info.ContextCell.Images.LargestImageSize.Height>height)
						height=info.ContextCell.Images.LargestImageSize.Height;
					if(info.ContextCell.CheckBoxVisible && CheckBoxSize.Height>height)
						height=CheckBoxSize.Height;
				}

				Rectangle r=new Rectangle(info.Left+ElementStyleLayout.LeftWhiteSpace(info.LayoutStyle),
				                          info.Top+ElementStyleLayout.TopWhiteSpace(info.LayoutStyle)
				                          ,info.CellWidth,height);

				if(r.Width==0)
				{
					if(info.VerticalPartAlignment)
					{
						r.Width=(int)Math.Ceiling((double)textSize.Width);
						if(info.ContextCell.Images.LargestImageSize.Width>r.Width)
							r.Width=(info.ContextCell.Images.LargestImageSize.Width+this.ImageTextSpacing);
						if(info.ContextCell.CheckBoxVisible && CheckBoxSize.Width>r.Width)
							r.Width+=(CheckBoxSize.Width+this.ImageTextSpacing);
					}
					else
					{
						r.Width=(int)Math.Ceiling((double)textSize.Width);
						if(info.ContextCell.Images.LargestImageSize.Width>0)
							r.Width+=(info.ContextCell.Images.LargestImageSize.Width+this.ImageTextSpacing);
						if(info.ContextCell.CheckBoxVisible)
							r.Width+=(CheckBoxSize.Width+this.ImageTextSpacing);
					}
				}

				// Now that we have cell bounds store them
				Rectangle rCellBounds=new Rectangle(info.Left,info.Top,info.CellWidth,r.Height+info.LayoutStyle.MarginTop+info.LayoutStyle.MarginBottom+info.LayoutStyle.PaddingTop+info.LayoutStyle.PaddingBottom);
				if(rCellBounds.Width==0)
					rCellBounds.Width=r.Width+ElementStyleLayout.HorizontalStyleWhiteSpace(info.LayoutStyle);
				info.ContextCell.SetBounds(rCellBounds);

				// Set Position of the image
				if(!info.ContextCell.Images.LargestImageSize.IsEmpty)
				{
					eVerticalAlign va=GetVerticalAlign(info.ContextCell.ImageAlignment);
					eHorizontalAlign ha=GetHorizontalAlign(info.ContextCell.ImageAlignment,info.LeftToRight);
					if(info.VerticalPartAlignment)
						info.ContextCell.SetImageBounds(AlignContentVertical(info.ContextCell.Images.LargestImageSize, ref r, ha, va, this.ImageTextSpacing));
					else
						info.ContextCell.SetImageBounds(AlignContent(info.ContextCell.Images.LargestImageSize, ref r, ha, va, this.ImageTextSpacing));
				}
				else
					info.ContextCell.SetImageBounds(Rectangle.Empty);

				// Set position of the check box
				if(info.ContextCell.CheckBoxVisible)
				{
					eVerticalAlign va=GetVerticalAlign(info.ContextCell.CheckBoxAlignment);
					eHorizontalAlign ha=GetHorizontalAlign(info.ContextCell.CheckBoxAlignment,info.LeftToRight);
					if(info.VerticalPartAlignment)
						info.ContextCell.SetCheckBoxBounds(AlignContentVertical(this.CheckBoxSize, ref r, ha, va, this.ImageTextSpacing));
					else
						info.ContextCell.SetCheckBoxBounds(AlignContent(this.CheckBoxSize, ref r, ha, va, this.ImageTextSpacing));
				}
				else
					info.ContextCell.SetCheckBoxBounds(Rectangle.Empty);
			
				// Set position of the text
				//info.ContextCell.SetTextBounds(Rectangle.Empty);
				if(!textSize.IsEmpty)
					info.ContextCell.TextContentBounds=r;
				else
					info.ContextCell.TextContentBounds=Rectangle.Empty;
            
			}
예제 #13
0
 public void RepositionForCell(LayoutCellInfo info)
 {
     size = info.cellRect.size;
     Build();
 }
예제 #14
0
			protected virtual LayoutCellInfo GetLayoutCellInfo()
			{
				if(m_LayoutCellInfo==null)
					m_LayoutCellInfo=new LayoutCellInfo();
				return m_LayoutCellInfo;
			}