Esempio n. 1
0
        /// <summary>
        /// Gets the flag indicating if multiline text is allowed for long text.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>InheritBool value.</returns>
        public override InheritBool GetContentLongTextMultiLine(PaletteState state)
        {
            if (_apply)
            {
                InheritBool ret = _primary.GetContentLongTextMultiLine(_override ? _state : state);

                if (ret == InheritBool.Inherit)
                {
                    ret = _backup.GetContentLongTextMultiLine(state);
                }

                return(ret);
            }
            else
            {
                return(_backup.GetContentLongTextMultiLine(state));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the flag indicating if multiline text is allowed for long text.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>InheritBool value.</returns>
        public virtual InheritBool GetContentLongTextMultiLine(PaletteState state)
        {
            if (Apply)
            {
                InheritBool ret = _primaryContent.GetContentLongTextMultiLine(Override ? OverrideState : state);

                if (ret == InheritBool.Inherit)
                {
                    ret = _backupContent.GetContentLongTextMultiLine(state);
                }

                return(ret);
            }
            else
            {
                return(_backupContent.GetContentLongTextMultiLine(state));
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Gets the flag indicating if multiline text is allowed for long text.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <returns>InheritBool value.</returns>
 public InheritBool GetContentLongTextMultiLine(PaletteState state)
 {
     if (_longText.MultiLine != InheritBool.Inherit)
     {
         return(_longText.MultiLine);
     }
     else
     {
         return(_inherit.GetContentLongTextMultiLine(state));
     }
 }
        /// <summary>
        /// Gets the flag indicating if multiline text is allowed for long text.
        /// </summary>
        /// <param name="style">Content style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>InheritBool value.</returns>
        public override InheritBool GetContentLongTextMultiLine(PaletteContentStyle style, PaletteState state)
        {
            IPaletteContent inherit = GetInherit(state);

            if (inherit != null)
            {
                return(inherit.GetContentLongTextMultiLine(state));
            }
            else
            {
                return(Target.GetContentLongTextMultiLine(style, state));
            }
        }
Esempio n. 5
0
 /// <summary>
 /// Gets the flag indicating if multiline text is allowed for long text.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <returns>InheritBool value.</returns>
 public override InheritBool GetContentLongTextMultiLine(PaletteState state)
 {
     return(_inherit.GetContentLongTextMultiLine(state));
 }
Esempio n. 6
0
        /// <summary>
        /// Gets the flag indicating if multiline text is allowed for long text.
        /// </summary>
        /// <param name="style">Content style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>InheritBool value.</returns>
        public override InheritBool GetContentLongTextMultiLine(PaletteContentStyle style, PaletteState state)
        {
            IPaletteContent inherit = GetInherit(state);

            return(inherit?.GetContentLongTextMultiLine(state) ?? Target.GetContentLongTextMultiLine(style, state));
        }
Esempio n. 7
0
        private static void AllocateLongTextSpace(ViewLayoutContext context,
                                                  Graphics g,
                                                  StandardContentMemento memento,
                                                  IPaletteContent paletteContent,
                                                  IContentValues contentValues,
                                                  PaletteState state,
                                                  Rectangle displayRect,
                                                  RightToLeft rtl,
                                                  int spacingGap,
                                                  ref Size[,] allocation,
                                                  bool composition,
                                                  bool glowing)
        {
            // By default, we cannot draw the text
            memento.DrawLongText = false;

            // Get the defined text for display
            string longText = contentValues.GetLongText();

            // Is there any text to be drawn?
            if ((longText != null) && (longText.Length > 0))
            {
                // If the text is not allowed to span multiple lines
                if (paletteContent.GetContentLongTextMultiLine(state) == InheritBool.False)
                {
                    // Replace any carriage returns and newlines with just spaces
                    longText = longText.Replace("\r\n", " ");
                    longText = longText.Replace("\n", " ");
                    longText = longText.Replace("\r", " ");
                }

                // Convert from alignment enums to integers
                int alignHIndex = RightToLeftIndex(rtl, paletteContent.GetContentLongTextH(state));
                int alignVIndex = (int)paletteContent.GetContentLongTextV(state);

                // Cache the rendering hint used
                memento.LongTextHint = CommonHelper.PaletteTextHintToRenderingHint(paletteContent.GetContentLongTextHint(state));
                memento.LongTextTrimming = paletteContent.GetContentLongTextTrim(state);

                bool fontChanged = false;
                Font textFont = paletteContent.GetContentLongTextFont(state);

                // Get the appropriate font to use in the caption area
                if (paletteContent.GetContentStyle() == PaletteContentStyle.HeaderForm)
                {
                    Font captionFont = ContentFontForButtonForm(context, textFont);
                    fontChanged = (captionFont != textFont);
                    textFont = captionFont;
                }

                // Get a pixel accurate measure of text drawing space needed
                memento.LongTextMemento = AccurateText.MeasureString(g,
                                                                     rtl,
                                                                     longText,
                                                                     textFont,
                                                                     memento.LongTextTrimming,
                                                                     paletteContent.GetContentLongTextMultiLineH(state),
                                                                     paletteContent.GetContentLongTextPrefix(state),
                                                                     memento.LongTextHint,
                                                                     composition,
                                                                     glowing,
                                                                     fontChanged);

                // Space required for long text starts with the text width itself
                Size requiredSpace = memento.LongTextMemento.Size;

                // Find the space available given our required alignment
                if (AllocateAlignmentSpace(alignHIndex, alignVIndex,
                                           allocation, displayRect,
                                           spacingGap, memento.LongTextTrimming,
                                           ref requiredSpace))
                {
                    // Cache the actual draw size of the text
                    memento.LongTextRect.Size = requiredSpace;

                    // Mark the memento to draw the long text
                    memento.DrawLongText = true;
                }
            }
        }
 /// <summary>
 /// Gets the flag indicating if multiline text is allowed for long text.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <returns>InheritBool value.</returns>
 public InheritBool GetContentLongTextMultiLine(PaletteState state)
 {
     return(_content.GetContentLongTextMultiLine(state));
 }