예제 #1
0
        /// <summary>
        /// Gets the rendering hint for the long text.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>PaletteTextHint value.</returns>
        public override PaletteTextHint GetContentLongTextHint(PaletteState state)
        {
            if (_apply)
            {
                PaletteTextHint ret = _primary.GetContentLongTextHint(_override ? _state : state);

                if (ret == PaletteTextHint.Inherit)
                {
                    ret = _backup.GetContentLongTextHint(state);
                }

                return(ret);
            }
            else
            {
                return(_backup.GetContentLongTextHint(state));
            }
        }
예제 #2
0
        /// <summary>
        /// Gets the rendering hint for the long text.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>PaletteTextHint value.</returns>
        public virtual PaletteTextHint GetContentLongTextHint(PaletteState state)
        {
            if (Apply)
            {
                PaletteTextHint ret = _primaryContent.GetContentLongTextHint(Override ? OverrideState : state);

                if (ret == PaletteTextHint.Inherit)
                {
                    ret = _backupContent.GetContentLongTextHint(state);
                }

                return(ret);
            }
            else
            {
                return(_backupContent.GetContentLongTextHint(state));
            }
        }
예제 #3
0
 /// <summary>
 /// Gets the actual text rendering hint for long text.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <returns>PaletteTextHint value.</returns>
 public PaletteTextHint GetContentLongTextHint(PaletteState state)
 {
     if (_longText.Hint != PaletteTextHint.Inherit)
     {
         return(_longText.Hint);
     }
     else
     {
         return(_inherit.GetContentLongTextHint(state));
     }
 }
        /// <summary>
        /// Gets the rendering hint for the long text.
        /// </summary>
        /// <param name="style">Content style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>PaletteTextHint value.</returns>
        public override PaletteTextHint GetContentLongTextHint(PaletteContentStyle style, PaletteState state)
        {
            IPaletteContent inherit = GetInherit(state);

            if (inherit != null)
            {
                return(inherit.GetContentLongTextHint(state));
            }
            else
            {
                return(Target.GetContentLongTextHint(style, state));
            }
        }
예제 #5
0
 /// <summary>
 /// Gets the rendering hint for the long text.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <returns>PaletteTextHint value.</returns>
 public override PaletteTextHint GetContentLongTextHint(PaletteState state)
 {
     return(_inherit.GetContentLongTextHint(state));
 }
예제 #6
0
        /// <summary>
        /// Gets the rendering hint for the long text.
        /// </summary>
        /// <param name="style">Content style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>PaletteTextHint value.</returns>
        public override PaletteTextHint GetContentLongTextHint(PaletteContentStyle style, PaletteState state)
        {
            IPaletteContent inherit = GetInherit(state);

            return(inherit?.GetContentLongTextHint(state) ?? Target.GetContentLongTextHint(style, state));
        }
예제 #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;
                }
            }
        }
예제 #8
0
 /// <summary>
 /// Gets the rendering hint for the long text.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <returns>PaletteTextHint value.</returns>
 public override PaletteTextHint GetContentLongTextHint(PaletteState state) => _inherit.GetContentLongTextHint(state);