예제 #1
0
        public static Rectangle CalculateSectionLayout(Graphics graphics, BaseSection section)
        {
            ILayouter layouter         = (ILayouter)ServiceContainer.GetService(typeof(ILayouter));
            var       desiredRectangle = layouter.Layout(graphics, section);

            return(desiredRectangle);
        }
예제 #2
0
		public static void SetLayoutForRow (Graphics graphics, ILayouter layouter,ISimpleContainer row)
		{
			Rectangle textRect = layouter.Layout(graphics,row);
			if (textRect.Height > row.Size.Height) {
				row.Size = new Size(row.Size.Width,textRect.Height);
			}
		}
예제 #3
0
		public static void SetLayoutForRow (Graphics graphics, ILayouter layouter,ISimpleContainer row)
		{
			BaseReportItem item = row as BaseReportItem;
			int extend = item.Size.Height - row.Items[0].Size.Height;
			Rectangle textRect = layouter.Layout(graphics,row);
			if (textRect.Height > item.Size.Height) {
				item.Size = new Size(item.Size.Width,textRect.Height + extend );
			}
		}
예제 #4
0
        public static void SetLayoutForRow(Graphics graphics, ILayouter layouter, ISimpleContainer row)
        {
            Rectangle textRect = layouter.Layout(graphics, row);

            if (textRect.Height > row.Size.Height)
            {
                row.Size = new Size(row.Size.Width, textRect.Height + 5);
            }
        }
예제 #5
0
        protected ExporterCollection ConvertSection(BaseSection section, int dataRow)
        {
//			bool debugItemadded = false;

            FireSectionRenderEvent(section, dataRow);

            PrintHelper.AdjustParent((BaseSection)section, section.Items);

            ExporterCollection list = new ExporterCollection();

            if (section.DrawBorder == true)
            {
                section.Items.Insert(0, CreateDebugItem(section));
//				debugItemadded = true;
            }

            if (section.Items.Count > 0)
            {
                Point offset = new Point(section.Location.X, section.SectionOffset);
                foreach (IReportItem item in section.Items)
                {
                    ISimpleContainer container = item as ISimpleContainer;
                    if (container != null)
                    {
                        ExportContainer exportContainer = this.exportItemsConverter.ConvertToContainer(offset, container);

                        AdjustBackColor(container);

                        ExporterCollection clist = this.exportItemsConverter.ConvertSimpleItems(offset, container.Items);
                        exportContainer.Items.AddRange(clist);
                        list.Add(exportContainer);
                    }
                    else
                    {
                        this.exportItemsConverter.ParentRectangle = new Rectangle(section.Location, section.Size);

                        Rectangle desiredRectangle = layouter.Layout(this.graphics, section);
                        Rectangle sectionRectangle = new Rectangle(0, 0, section.Size.Width, section.Size.Height);

                        if (!sectionRectangle.Contains(desiredRectangle))
                        {
                            section.Size = new Size(section.Size.Width, desiredRectangle.Size.Height);
                        }

                        list = this.exportItemsConverter.ConvertSimpleItems(offset, section.Items);

//						if (debugItemadded) {
//							BaseExportColumn debugColumn = list[0];
//							debugColumn.StyleDecorator.Location = section.Location;
//							debugColumn.StyleDecorator.Size = section.Size;
//						}
                    }
                }
            }
            return(list);
        }
예제 #6
0
        public static void SetLayoutForRow(Graphics graphics, ILayouter layouter, ISimpleContainer row)
        {
            BaseReportItem item     = row as BaseReportItem;
            int            extend   = item.Size.Height - row.Items[0].Size.Height;
            Rectangle      textRect = layouter.Layout(graphics, row);

            if (textRect.Height > item.Size.Height)
            {
                item.Size = new Size(item.Size.Width, textRect.Height + extend);
            }
        }
예제 #7
0
        public static T RelayoutWithUpdate <T>(Vector2 size, T rootElement, Dictionary <LTElementType, object> updateValues, ILayouter layouter) where T : LTRootElement
        {
            var originX = 0f;
            var originY = 0f;

            var rootObject = rootElement.gameObject;
            var elements   = rootElement.GetLTElements();

            foreach (var element in elements)
            {
                if (element is ILayoutableText)
                {
                    if (0 < element.transform.childCount)
                    {
                        var count = element.transform.childCount;
                        for (var i = 0; i < count; i++)
                        {
                            // get first child.
                            var child = element.transform.GetChild(0);
                            child.gameObject.SetActive(false);
                            child.transform.SetParent(null);
                            GameObject.Destroy(child.gameObject);
                        }
                    }
                }

                var rectTrans = element.GetComponent <RectTransform>();
                rectTrans.anchoredPosition = Vector2.zero;
            }

            layouter.UpdateValues(elements, updateValues);

            var lineContents         = new List <RectTransform>();// 同じ行に入っている要素を整列させるために使用するリスト
            var currentLineMaxHeight = 0f;

            var wrappedSize = Vector2.zero;

            layouter.Layout(size, out originX, out originY, rootObject, rootElement, elements, ref currentLineMaxHeight, ref lineContents, ref wrappedSize);

            lineContents.Clear();

            return(rootElement);
        }
예제 #8
0
        public static T Layout <T>(Transform parent, Vector2 size, T rootElement, ILayouter layouter) where T : LTRootElement
        {
            Debug.Assert(parent.GetComponent <Canvas>() != null, "should set parent transform which contains Canvas. this limitation is caused by spec of TextMesh Pro.");
            var originX = 0f;
            var originY = 0f;

            var rootObject = rootElement.gameObject;
            var elements   = rootElement.GetLTElements();

            var rootRect = rootObject.GetComponent <RectTransform>();

            // 親の基礎サイズをセット
            rootRect.sizeDelta = size;

            // set parent.
            foreach (var element in elements)
            {
                element.gameObject.transform.SetParent(rootObject.transform);
            }

            // ここでCanvas要素にセットしちゃう(でないとTMProのinfoが取れない。)
            rootObject.transform.SetParent(parent);

            var lineContents         = new List <RectTransform>();// 同じ行に入っている要素を整列させるために使用するリスト
            var currentLineMaxHeight = 0f;

            var wrappedSize = Vector2.zero;

            layouter.Layout(size, out originX, out originY, rootObject, rootElement, elements, ref currentLineMaxHeight, ref lineContents, ref wrappedSize);

            lineContents.Clear();

            // var lastHeight = originY + elements[elements.Length - 1].GetComponent<RectTransform>().sizeDelta.y;

            return(rootElement);
        }