/// <summary> /// Gets the prefix drawing setting for short text. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>PaletteTextPrefix value.</returns> public override PaletteTextHotkeyPrefix GetContentShortTextPrefix(PaletteState state) { if (_apply) { PaletteTextHotkeyPrefix ret = _primary.GetContentShortTextPrefix(_override ? _state : state); if (ret == PaletteTextHotkeyPrefix.Inherit) { ret = _backup.GetContentShortTextPrefix(state); } return(ret); } else { return(_backup.GetContentShortTextPrefix(state)); } }
/// <summary> /// Gets the prefix drawing setting for short text. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>PaletteTextPrefix value.</returns> public virtual PaletteTextHotkeyPrefix GetContentShortTextPrefix(PaletteState state) { if (Apply) { PaletteTextHotkeyPrefix ret = _primaryContent.GetContentShortTextPrefix(Override ? OverrideState : state); if (ret == PaletteTextHotkeyPrefix.Inherit) { ret = _backupContent.GetContentShortTextPrefix(state); } return(ret); } else { return(_backupContent.GetContentShortTextPrefix(state)); } }
/// <summary> /// Gets the prefix drawing setting for short text. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>PaletteTextPrefix value.</returns> public PaletteTextHotkeyPrefix GetContentShortTextPrefix(PaletteState state) { if (_shortText.Prefix != PaletteTextHotkeyPrefix.Inherit) { return(_shortText.Prefix); } else { return(_inherit.GetContentShortTextPrefix(state)); } }
/// <summary> /// Gets the prefix drawing setting for short text. /// </summary> /// <param name="style">Content style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>PaletteTextPrefix value.</returns> public override PaletteTextHotkeyPrefix GetContentShortTextPrefix(PaletteContentStyle style, PaletteState state) { IPaletteContent inherit = GetInherit(state); if (inherit != null) { return(inherit.GetContentShortTextPrefix(state)); } else { return(Target.GetContentShortTextPrefix(style, state)); } }
/// <summary> /// Gets the prefix drawing setting for short text. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>PaletteTextPrefix value.</returns> public override PaletteTextHotkeyPrefix GetContentShortTextPrefix(PaletteState state) { return(_inherit.GetContentShortTextPrefix(state)); }
/// <summary> /// Gets the prefix drawing setting for short text. /// </summary> /// <param name="style">Content style.</param> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>PaletteTextPrefix value.</returns> public override PaletteTextHotkeyPrefix GetContentShortTextPrefix(PaletteContentStyle style, PaletteState state) { IPaletteContent inherit = GetInherit(state); return(inherit?.GetContentShortTextPrefix(state) ?? Target.GetContentShortTextPrefix(style, state)); }
private static void AllocateShortTextSpace(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.DrawShortText = false; // Get the defined text for display string shortText = contentValues.GetShortText(); // Is there any text to be drawn? if ((shortText != null) && (shortText.Length > 0)) { // If the text is not allowed to span multiple lines if (paletteContent.GetContentShortTextMultiLine(state) == InheritBool.False) { // Replace any carriage returns and newlines with just spaces shortText = shortText.Replace("\r\n", " "); shortText = shortText.Replace("\n", " "); shortText = shortText.Replace("\r", " "); } // Convert from alignment enums to integers int alignHIndex = RightToLeftIndex(rtl, paletteContent.GetContentShortTextH(state)); int alignVIndex = (int)paletteContent.GetContentShortTextV(state); // Cache the rendering hint used memento.ShortTextHint = CommonHelper.PaletteTextHintToRenderingHint(paletteContent.GetContentShortTextHint(state)); memento.ShortTextTrimming = paletteContent.GetContentShortTextTrim(state); bool fontChanged = false; Font textFont = paletteContent.GetContentShortTextFont(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.ShortTextMemento = AccurateText.MeasureString(g, rtl, shortText, textFont, memento.ShortTextTrimming, paletteContent.GetContentShortTextMultiLineH(state), paletteContent.GetContentShortTextPrefix(state), memento.ShortTextHint, composition, glowing, fontChanged); // Space required for short text starts with the text width itself Size requiredSpace = memento.ShortTextMemento.Size; // Find the space available given our required alignment if (AllocateAlignmentSpace(alignHIndex, alignVIndex, allocation, displayRect, spacingGap, memento.ShortTextTrimming, ref requiredSpace)) { // Allocate the actual space used up // Cache the actual draw size of the text memento.ShortTextRect.Size = requiredSpace; // Mark the memento to draw the short text memento.DrawShortText = true; } } }
/// <summary> /// Gets the prefix drawing setting for short text. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>PaletteTextPrefix value.</returns> public PaletteTextHotkeyPrefix GetContentShortTextPrefix(PaletteState state) { return(_content.GetContentShortTextPrefix(state)); }