Ejemplo n.º 1
0
        /// <summary>
        /// Gets the font for the long text.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Font value.</returns>
        public override Font GetContentLongTextFont(PaletteState state)
        {
            if (_apply)
            {
                Font ret = _primary.GetContentLongTextFont(_override ? _state : state);

                if (ret == null)
                {
                    ret = _backup.GetContentLongTextFont(state);
                }

                return(ret);
            }
            else
            {
                return(_backup.GetContentLongTextFont(state));
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Gets the actual content long text font value.
 /// </summary>
 /// <returns>Font value.</returns>
 /// <param name="state">Palette value should be applicable to this state.</param>
 public Font GetContentLongTextFont(PaletteState state)
 {
     if (_longText.Font != null)
     {
         return(_longText.Font);
     }
     else
     {
         return(_inherit.GetContentLongTextFont(state));
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets the font for the long text.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Font value.</returns>
        public virtual Font GetContentLongTextFont(PaletteState state)
        {
            if (Apply)
            {
                Font ret = _primaryContent.GetContentLongTextFont(Override ? OverrideState : state) ?? _backupContent.GetContentLongTextFont(state);

                return(ret);
            }
            else
            {
                return(_backupContent.GetContentLongTextFont(state));
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Gets the font for the long text.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Font value.</returns>
        public override Font GetContentLongTextFont(PaletteState state)
        {
            KryptonTreeNode kryptonNode = TreeNode as KryptonTreeNode;

            if ((kryptonNode != null) && (kryptonNode.LongNodeFont != null))
            {
                return(kryptonNode.LongNodeFont);
            }
            else
            {
                return(_inherit.GetContentLongTextFont(state));
            }
        }
        /// <summary>
        /// Gets the font for the long text.
        /// </summary>
        /// <param name="style">Content style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Font value.</returns>
        public override Font GetContentLongTextFont(PaletteContentStyle style, PaletteState state)
        {
            IPaletteContent inherit = GetInherit(state);

            if (inherit != null)
            {
                return(inherit.GetContentLongTextFont(state));
            }
            else
            {
                return(Target.GetContentLongTextFont(style, state));
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Gets the font for the long text.
        /// </summary>
        /// <param name="style">Content style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Font value.</returns>
        public override Font GetContentLongTextFont(PaletteContentStyle style, PaletteState state)
        {
            IPaletteContent inherit = GetInherit(state);

            return(inherit?.GetContentLongTextFont(state) ?? Target.GetContentLongTextFont(style, state));
        }
 /// <summary>
 /// Gets the font for the long text.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <returns>Font value.</returns>
 public override Font GetContentLongTextFont(PaletteState state)
 {
     return(_inherit.GetContentLongTextFont(state));
 }
Ejemplo n.º 8
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;
                }
            }
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Gets the font for the long text.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <returns>Font value.</returns>
 public override Font GetContentLongTextFont(PaletteState state) => _inherit.GetContentLongTextFont(state);