Beispiel #1
0
 public TextAlignment(CgmFile container, HorizontalAlignmentType horz, VerticalAlignmentType vert, double continousHorz, double continousVert)
     : this(container)
 {
     HorizontalAlignment           = horz;
     VerticalAlignment             = vert;
     ContinuousHorizontalAlignment = continousHorz;
     ContinuousVerticalAlignment   = continousVert;
 }
Beispiel #2
0
        public Style(HorizontalAlignmentType horizontalAlignment, VerticalAlignmentType verticalAlignment, string bgColor)
        {
            HorizontalAlignment = horizontalAlignment;
            VerticalAlignment   = verticalAlignment;

            BorderColor = "";
            BGColor     = bgColor;
            FontColor   = "";
            FontName    = "";
        }
Beispiel #3
0
        private static double GetYOffset(VerticalAlignmentType verticalAlignment, double height)
        {
            switch (verticalAlignment)
            {
            case VerticalAlignmentType.Top:
                return(0.5 * height);

            case VerticalAlignmentType.Bottom:
                return(-0.5 * height);
            }
            return(0);
        }
Beispiel #4
0
        public Style(HorizontalAlignmentType horizontalAlignment, VerticalAlignmentType verticalAlignment, string bgColor, string borderColor, bool borderTop, bool borderBottom, bool borderLeft, bool borderRight)
        {
            HorizontalAlignment = horizontalAlignment;
            VerticalAlignment   = verticalAlignment;

            BorderColor = borderColor;
            BGColor     = bgColor;
            FontColor   = "";
            FontName    = "";

            BorderTop    = borderTop;
            BorderBottom = borderBottom;
            BorderLeft   = borderLeft;
            BorderRight  = borderRight;

            BorderLine = BorderLineType.Continuous;
        }
 /// <summary>
 /// Creates a 'TextArea' to be displayed. You can specify 
 /// <see cref="withRoundedCorners"/> to make the text area border rounded.
 /// </summary>
 /// <param name="row">row</param>
 /// <param name="textAreaText">textAreaText</param>
 /// <param name="textAreaPadding">textAreaPadding</param>
 /// <param name="verticalAlignment">verticalAlignment</param>
 /// <param name="alignment">alignment</param>
 /// <param name="withRoundedCorners">withRoundedCorners</param>
 /// <param name="withBorder">withBorder</param>
 public Generator.Cell CreateTextAreaCell(
     Generator.Row row,
     string textAreaText,
     Generator.MarginInfo textAreaPadding = null,
     VerticalAlignmentType verticalAlignment = VerticalAlignmentType.Top,
     AlignmentType alignment = AlignmentType.Left,
     bool withRoundedCorners = false,
     bool withBorder = false)
 {
     row.IsBroken = false;
     var cell = row.Cells.Add(textAreaText);
     // Text Area formatting
     cell.Padding = textAreaPadding ?? DefaultTextAreaDescriptionPadding;
     cell.DefaultCellTextInfo.FontName = Properties.Resources.ArialFont;
     cell.DefaultCellTextInfo.FontSize = DefaultInnerBodyFontSize;
     cell.DefaultCellTextInfo.Color = new Generator.Color(Properties.Resources.GreyColor);
     cell.VerticalAlignment = verticalAlignment;
     cell.Alignment = alignment;
     return cell;
 }
        /// <summary>
        /// Creates Inner Table Item Cell(s). Must provide at least ONE <see cref="cellContent"/> 
        /// and an applicable <see cref="row"/>.
        /// </summary>
        /// <param name="row">row</param>
        /// <param name="defaultPadding">defaultPadding</param>
        /// <param name="backgroundColor">backgroundColor</param>
        /// <param name="textColor">textColor</param>
        /// <param name="fontName">fontName</param>
        /// <param name="fontSize">fontSize</param>
        /// <param name="verticalAlignment">verticalAlignment</param>
        /// <param name="alignment">alignment</param>
        /// <param name="fixedRowHeight">fixedRowHeight</param>
        /// <param name="cellContent">cellContent</param>
        public void CreateInnerTableItemCells(
            Generator.Row row,
            Generator.MarginInfo defaultPadding = null,
            string backgroundColor = "",
            string textColor = "",
            string fontName = "",
            int fontSize = 0,
            VerticalAlignmentType verticalAlignment = VerticalAlignmentType.Bottom,
            AlignmentType alignment = AlignmentType.Left,
            float fixedRowHeight = 0,
            params DisplayCell[] cellContent)
        {
            row.IsBroken = false;
            row.BackgroundColor = new Generator.Color(
                !string.IsNullOrEmpty(backgroundColor)
                    ? backgroundColor
                    : Properties.Resources.InnerTableColor);
            row.DefaultCellTextInfo.Color = new Generator.Color(
                !string.IsNullOrEmpty(textColor)
                    ? textColor
                    : Properties.Resources.GreyColor);
            row.DefaultCellTextInfo.FontName = !string.IsNullOrEmpty(fontName)
                ? fontName
                : Properties.Resources.ArialFont;
            row.DefaultCellTextInfo.FontSize = fontSize == 0
                ? DefaultInnerBodyFontSize
                : fontSize;
            row.DefaultCellTextInfo.Alignment = alignment;
            row.VerticalAlignment = verticalAlignment;
            row.DefaultRowCellPadding = defaultPadding ?? DefaultInnerPadding;
            if (fixedRowHeight > 0)
            {
                row.FixedRowHeight = fixedRowHeight;
            }

            // Add content
            if (cellContent.IsAny())
            {
                foreach (var item in cellContent)
                {
                    Generator.Cell cell;
                    if (item.TextAreaInfo != null)
                    {
                        cell = CreateTextAreaCell(row, item.Content, item.TextAreaInfo.Padding,
                            verticalAlignment, alignment, item.TextAreaInfo.WithBorder,
                            item.TextAreaInfo.WithRoundedCorners);
                    }
                    else
                    {
                        cell = row.Cells.Add();
                        if (item.TableInfo != null)
                        {
                            cell.Paragraphs.Add(item.TableInfo);
                        }
                        else if (item.IsCheckBox)
                        {
                            if (item.IsChecked)
                            {
                                var checkbox = CreateCheckBox();
                                cell.Paragraphs.Add(checkbox);
                            }
                            else
                            {
                                CreateCellText(row, cell, Properties.Resources.CrossLabel, Properties.Resources.ArialUnicodeFont); 
                            }
                        }
                        else
                        {
                            // this is a safer way to add in content into a cell without it causing exceptions.
                            CreateCellText(row, cell, item.Content);
                        }
                    }

                    if (item.Border != Generator.BorderSide.None)
                    {
                        cell.Border = new Generator.BorderInfo((int)item.Border, DefaultBorderSize);
                    }
                    if (!string.IsNullOrEmpty(item.Color))
                    {
                        cell.DefaultCellTextInfo.Color = new Generator.Color(item.Color);
                    }
                    if (item.NeedCellBorder)
                    {
                        cell.Border = new Generator.BorderInfo((int)Generator.BorderSide.All, DefaultBorderSize);
                    }
                    if (item.IsDate || item.IsCentralized)
                    {
                        cell.Alignment = AlignmentType.Center;
                    }
                    if (item.IsTotal)
                    {
                        // Bold font
                        cell.DefaultCellTextInfo.FontName = Properties.Resources.ArialFont;
                        row.DefaultCellTextInfo.IsTrueTypeFontBold = true;
                    }
                    if (item.IsCurrency)
                    {
                        cell.Alignment = AlignmentType.Right;
                        cell.VerticalAlignment = VerticalAlignmentType.Center;
                    }
                    if (!string.IsNullOrEmpty(item.BackgroundColor))
                    {
                        cell.BackgroundColor = new Generator.Color(item.BackgroundColor);
                    }
                    if (item.IsHeader)
                    {
                        cell.BackgroundColor = new Generator.Color(Properties.Resources.HeaderTableBackgroundColor);
                        cell.DefaultCellTextInfo.Color = new Generator.Color(Properties.Resources.WhiteColor);
                        cell.DefaultCellTextInfo.FontName = Properties.Resources.ArialFont;
                        cell.DefaultCellTextInfo.FontSize = DefaultHeadingThreeFontSize;
                        cell.DefaultCellTextInfo.IsTrueTypeFontBold = true;
                    }
                    if (item.IsEmpty)
                    {
                        cell.BackgroundColor = new Generator.Color(Properties.Resources.LightGrayColor);
                    }

                    cell.ColumnsSpan = item.ColumnSpan > 0
                        ? item.ColumnSpan
                        : DefaultColumnSpan;

                    cell.RowSpan = item.RowSpan > 0
                        ? item.RowSpan
                        : DefaultRowSpan;
                }
            }
        }
 /// <summary>
 /// Create a standard 'Inner Table Row' for a given <see cref="table"/>.
 /// NOTE: Remember to never put padding on a <see cref="Generator.Table"/> object, 
 /// it messes with the content layout inside <see cref="Generator.Row"/> objects etc.
 /// </summary>
 /// <param name="table">table</param>
 /// <param name="parentPadding">parentPadding</param>
 /// <param name="verticalAlignment">verticalAlignment</param>
 /// <param name="backgroundColor">backgroundColor</param>
 /// <param name="withBorder">withBorder</param>
 /// <returns>row</returns>
 public Generator.Row CreateInnerTableRow(
     Generator.Table table,
     Generator.MarginInfo parentPadding = null,
     VerticalAlignmentType verticalAlignment = VerticalAlignmentType.Top,
     string backgroundColor = "",
     bool withBorder = false)
 {
     var row = table.Rows.Add();
     // Set the default cell padding to parentPadding definition
     row.DefaultRowCellPadding = parentPadding ?? DefaultInnerPadding;
     row.VerticalAlignment = verticalAlignment;
     row.IsBroken = false;
     row.BackgroundColor = new Generator.Color(
         !string.IsNullOrEmpty(backgroundColor)
             ? backgroundColor
             : Properties.Resources.InnerTableColor);
     if (withBorder)
     {
         row.DefaultCellBorder = new Generator.BorderInfo((int)Generator.BorderSide.All, DefaultBorderSize);
     }
     return row;
 }
Beispiel #8
0
 /// <summary>
 /// Sets the alignment on a cell.<br />
 /// Cells without calling this function have the default values of left and top respectively.<br />
 /// </summary>
 /// <param name="position">The cell to set alignment on.</param>
 /// <param name="horizontal">The horizontal alignment.</param>
 /// <param name="vertical">The vertical alignment.</param>
 /// <since_tizen> 3 </since_tizen>
 public void SetCellAlignment(TableView.CellPosition position, HorizontalAlignmentType horizontal, VerticalAlignmentType vertical)
 {
     Interop.TableView.TableView_SetCellAlignment(swigCPtr, TableView.CellPosition.getCPtr(position), (int)horizontal, (int)vertical);
     if (NDalicPINVOKE.SWIGPendingException.Pending)
     {
         throw NDalicPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Beispiel #9
0
 public static void SetScreenPosition(View view, Point screenPosition,
                                      HorizontalAlignmentType horizontalAlignment, VerticalAlignmentType verticalAlignment)
 {
     view.SetX((int)(screenPosition.X - 0.5 * view.Width + GetXOffset(horizontalAlignment, view.Width)));
     view.SetY((int)(screenPosition.Y - 0.5 * view.Height + GetYOffset(verticalAlignment, view.Height)));
 }
        private static void CreateSectionTwoExample001(PdfBuilder pdfBuilder, MarginInfo parentPadding)
        {
            const VerticalAlignmentType parentVerticalAlignment = VerticalAlignmentType.Center;
            const bool   keepContentTogether = false;
            const bool   isKeptTogether      = false;
            const bool   isKeptWithNext      = false;
            const string exampleDocWidths    = "100 250 100";
            var          exampleDocPadding   = new MarginInfo
            {
                Left   = 2,
                Bottom = 2,
                Top    = 2
            };
            var exampleDocs = new List <string[]>
            {
                new[] { "item 1 type", "item 1 desc", "item 1 filename" },
                new[] { "item 2 type", "item 2 desc", "item 2 filename" },
                new[] { "item 3 type", "item 3 desc", "item 3 filename" },
                new[] { "item 4 type", "item 4 desc", "item 4 filename" },
            };

            if (exampleDocs.IsAny())
            {
                // Create an inner table
                var exampleDocumentTable = pdfBuilder.CreateInnerTable(
                    exampleDocWidths,
                    isKeptTogether: isKeptTogether,
                    isKeptWithNext: isKeptWithNext,
                    keepContentTogether: keepContentTogether);

                // Create inner table row
                var docRow = pdfBuilder.CreateInnerTableRow(exampleDocumentTable, exampleDocPadding);

                // Create inner table cells
                pdfBuilder.CreateInnerTableHeaderCells(docRow, new[]
                {
                    new HeaderCell {
                        Content = "Example 001 doc type"
                    },
                    new HeaderCell {
                        Content = "Example 001 doc desc"
                    },
                    new HeaderCell {
                        Content = "Example 001 doc filename"
                    }
                });

                // format rows for each document
                foreach (var document in exampleDocs)
                {
                    var itemRow = exampleDocumentTable.Rows.Add();
                    pdfBuilder.CreateInnerTableItemCells(
                        itemRow,
                        exampleDocPadding,
                        verticalAlignment: parentVerticalAlignment,
                        cellContent: new[]
                    {
                        new DisplayCell {
                            Content = document[0].Trim()
                        },
                        new DisplayCell {
                            Content = document[1].Trim()
                        },
                        new DisplayCell {
                            Content = document[2].Trim()
                        }
                    });
                }
            }
            pdfBuilder.BlankRow();
        }
Beispiel #11
0
 public void SetCellAlignment(Tizen.NUI.BaseComponents.TableView.CellPosition position, HorizontalAlignmentType horizontal, VerticalAlignmentType vertical)
 {
     tableView.SetCellAlignment(position, horizontal, vertical);
 }
 public VerticalPositionType() {
     this.offsetField = 0;
     this.unitField = UnitType.Points;
     this.alignmentField = VerticalAlignmentType.Center;
 }