/// <summary>
        /// Initialize a new instance of the PaletteDataGridViewContentStates class.
        /// </summary>
        /// <param name="inherit">Source for inheriting defaulted values.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public PaletteDataGridViewContentStates(IPaletteContent inherit,
                                                NeedPaintHandler needPaint)
        {
            Debug.Assert(inherit != null);

            // Remember inheritance
            _inherit = inherit;

            // Store the provided paint notification delegate
            NeedPaint = needPaint;

            // Default the initial values
            _draw = InheritBool.Inherit;
            _hint = PaletteTextHint.Inherit;
            _trim = PaletteTextTrim.Inherit;
            _color1 = Color.Empty;
            _color2 = Color.Empty;
            _colorStyle = PaletteColorStyle.Inherit;
            _colorAlign = PaletteRectangleAlign.Inherit;
            _colorAngle = -1;
            _imageStyle = PaletteImageStyle.Inherit;
            _imageAlign = PaletteRectangleAlign.Inherit;
            _multiLine = InheritBool.Inherit;
            _multiLineH = PaletteRelativeAlign.Inherit;
        }
Пример #2
0
        /// <summary>
        /// Initialize a new instance of the PaletteRibbonGeneral class.
        /// </summary>
        /// <param name="inherit">Source for inheriting general values.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public PaletteRibbonGeneral(IPaletteRibbonGeneral inherit,
                                    NeedPaintHandler needPaint)
        {
            Debug.Assert(inherit != null);

            // Remember inheritance
            _inherit = inherit;

            // Store the provided paint notification delegate
            NeedPaint = needPaint;

            // Set default values
            _contextTextAlign         = PaletteRelativeAlign.Inherit;
            _contextTextColor         = Color.Empty;
            _contextTextFont          = null;
            _disabledDarkColor        = Color.Empty;
            _disabledLightColor       = Color.Empty;
            _dialogDarkColor          = Color.Empty;
            _dialogLightColor         = Color.Empty;
            _dropArrowLightColor      = Color.Empty;
            _dropArrowDarkColor       = Color.Empty;
            _groupSeparatorDark       = Color.Empty;
            _groupSeparatorLight      = Color.Empty;
            _minimizeBarDarkColor     = Color.Empty;
            _minimizeBarLightColor    = Color.Empty;
            _ribbonShape              = PaletteRibbonShape.Inherit;
            _tabSeparatorColor        = Color.Empty;
            _tabSeparatorContextColor = Color.Empty;
            _textFont            = null;
            _textHint            = PaletteTextHint.Inherit;
            _qatButtonDarkColor  = Color.Empty;
            _qatButtonLightColor = Color.Empty;
        }
Пример #3
0
 /// <summary>
 /// Initialize a new instance of the PaletteWrapLabel class.
 /// </summary>
 /// <param name="wrapLabel">Reference to owning control.</param>
 public PaletteWrapLabel(KryptonWrapLabel wrapLabel)
 {
     _wrapLabel = wrapLabel;
     _font = null;
     _textColor = Color.Empty;
     _hint = PaletteTextHint.Inherit;
 }
Пример #4
0
        /// <summary>
        /// Initialize a new instance of the PaletteDataGridViewContentStates class.
        /// </summary>
        /// <param name="inherit">Source for inheriting defaulted values.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public PaletteDataGridViewContentStates(IPaletteContent inherit,
                                                NeedPaintHandler needPaint)
        {
            Debug.Assert(inherit != null);

            // Remember inheritance
            _inherit = inherit;

            // Store the provided paint notification delegate
            NeedPaint = needPaint;

            // Default the initial values
            _draw       = InheritBool.Inherit;
            _hint       = PaletteTextHint.Inherit;
            _trim       = PaletteTextTrim.Inherit;
            _color1     = Color.Empty;
            _color2     = Color.Empty;
            _colorStyle = PaletteColorStyle.Inherit;
            _colorAlign = PaletteRectangleAlign.Inherit;
            _colorAngle = -1;
            _imageStyle = PaletteImageStyle.Inherit;
            _imageAlign = PaletteRectangleAlign.Inherit;
            _multiLine  = InheritBool.Inherit;
            _multiLineH = PaletteRelativeAlign.Inherit;
        }
 /// <summary>
 /// Initialize a new instance of the PaletteWrapLabel class.
 /// </summary>
 /// <param name="wrapLabel">Reference to owning control.</param>
 public PaletteWrapLabel(KryptonWrapLabel wrapLabel)
 {
     _wrapLabel = wrapLabel;
     _font      = null;
     _textColor = Color.Empty;
     _hint      = PaletteTextHint.Inherit;
 }
Пример #6
0
        public void UpdateFont()
        {
            Font            font      = null;
            Color           textColor = Color.Empty;
            PaletteTextHint hint      = PaletteTextHint.Inherit;
            PaletteState    ps        = PaletteState.Normal;

            // Get values from correct enabled/disabled state
            if (Enabled)
            {
                font      = _stateNormal.Font;
                textColor = _stateNormal.TextColor;
                hint      = _stateNormal.Hint;
            }
            else
            {
                font      = _stateDisabled.Font;
                textColor = _stateDisabled.TextColor;
                hint      = _stateDisabled.Hint;
                ps        = PaletteState.Disabled;
            }

            // Recover font from state common or as last resort the inherited palette
            if (font == null)
            {
                font = _stateCommon.Font;
                if (font == null)
                {
                    font = _redirector.GetContentShortTextFont(_labelContentStyle, ps);
                }
            }

            // Recover text color from state common or as last resort the inherited palette
            if (textColor == Color.Empty)
            {
                textColor = _stateCommon.TextColor;
                if (textColor == Color.Empty)
                {
                    textColor = _redirector.GetContentShortTextColor1(_labelContentStyle, ps);
                }
            }

            // Recover text hint from state common or as last resort the inherited palette
            if (hint == PaletteTextHint.Inherit)
            {
                hint = _stateCommon.Hint;
                if (hint == PaletteTextHint.Inherit)
                {
                    hint = _redirector.GetContentShortTextHint(_labelContentStyle, ps);
                }
            }

            // Only update the font when the control is created
            if (Handle != IntPtr.Zero)
            {
                Font = font;
            }
        }
Пример #7
0
        /// <summary>
        /// Raises the Paint event.
        /// </summary>
        /// <param name="e">An EventArgs containing the event data.</param>
        protected override void OnPaint(PaintEventArgs e)
        {
            Font font = null;
            Color textColor = Color.Empty;
            PaletteTextHint hint = PaletteTextHint.Inherit;
            PaletteState ps = PaletteState.Normal;

            // Get values from correct enabled/disabled state
            if (Enabled)
            {
                font = _stateNormal.Font;
                textColor = _stateNormal.TextColor;
                hint = _stateNormal.Hint;
            }
            else
            {
                font = _stateDisabled.Font;
                textColor = _stateDisabled.TextColor;
                hint = _stateDisabled.Hint;
                ps = PaletteState.Disabled;
            }

            // Recover font from state common or as last resort the inherited palette
            if (font == null)
            {
                font = _stateCommon.Font;
                if (font == null)
                    font = _redirector.GetContentShortTextFont(_labelContentStyle, ps);
            }

            // Recover text color from state common or as last resort the inherited palette
            if (textColor == Color.Empty)
            {
                textColor = _stateCommon.TextColor;
                if (textColor == Color.Empty)
                    textColor = _redirector.GetContentShortTextColor1(_labelContentStyle, ps);
            }

            // Recover text hint from state common or as last resort the inherited palette
            if (hint == PaletteTextHint.Inherit)
            {
                hint = _stateCommon.Hint;
                if (hint == PaletteTextHint.Inherit)
                    hint = _redirector.GetContentShortTextHint(_labelContentStyle, ps);
            }

            // Only update the font when the control is created
            if (Handle != IntPtr.Zero)
                Font = font;

            ForeColor = textColor;
            e.Graphics.TextRenderingHint = CommonHelper.PaletteTextHintToRenderingHint(hint);

            base.OnPaint(e);
        }
Пример #8
0
        /// <summary>
        /// Initialize a new instance of the PaletteRibbonGeneralNavRedirect class.
        /// </summary>
        /// <param name="redirect">Inheritence redirection instance.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public PaletteRibbonGeneralNavRedirect(PaletteRedirect redirect,
                                               NeedPaintHandler needPaint)
        {
            Debug.Assert(redirect != null);

            // Store the provided paint notification delegate
            NeedPaint = needPaint;

            // Store the inherit instances
            _inherit = new PaletteRibbonGeneralInheritRedirect(redirect);

            // Set default values
            _textFont = null;
            _textHint = PaletteTextHint.Inherit;
        }
        /// <summary>
        /// Initialize a new instance of the PaletteRibbonGeneralNavRedirect class.
        /// </summary>
        /// <param name="redirect">Inheritence redirection instance.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public PaletteRibbonGeneralNavRedirect(PaletteRedirect redirect,
                                               NeedPaintHandler needPaint)
        {
            Debug.Assert(redirect != null);

            // Store the provided paint notification delegate
            NeedPaint = needPaint;

            // Store the inherit instances
            _inherit = new PaletteRibbonGeneralInheritRedirect(redirect);

            // Set default values
            _textFont = null;
            _textHint = PaletteTextHint.Inherit;
        }
Пример #10
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));
            }
        }
        /// <summary>
        /// Gets the rendering hint for the short text.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>PaletteTextHint value.</returns>
        public override PaletteTextHint GetContentShortTextHint(PaletteState state)
        {
            if (Apply)
            {
                PaletteTextHint ret = _primary.GetContentShortTextHint(Override ? OverrideState : state);

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

                return(ret);
            }
            else
            {
                return(_backup.GetContentShortTextHint(state));
            }
        }
 /// <summary>
 /// Initialize a new instance of the InternalStorage structure.
 /// </summary>
 public InternalStorage()
 {
     // Set to default values
     ContentTextHint       = PaletteTextHint.Inherit;
     ContentTextTrim       = PaletteTextTrim.Inherit;
     ContentTextPrefix     = PaletteTextHotkeyPrefix.Inherit;
     ContentTextH          = PaletteRelativeAlign.Inherit;
     ContentTextV          = PaletteRelativeAlign.Inherit;
     ContentTextMultiLineH = PaletteRelativeAlign.Inherit;
     ContentTextMultiLine  = InheritBool.Inherit;
     ContentTextColor1     = Color.Empty;
     ContentTextColor2     = Color.Empty;
     ContentTextColorStyle = PaletteColorStyle.Inherit;
     ContentTextColorAlign = PaletteRectangleAlign.Inherit;
     ContentTextColorAngle = -1;
     ContentTextImageStyle = PaletteImageStyle.Inherit;
     ContentTextImageAlign = PaletteRectangleAlign.Inherit;
 }
        /// <summary>
        /// Initialize a new instance of the PaletteRibbonGeneral class.
        /// </summary>
        /// <param name="inherit">Source for inheriting general values.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public PaletteRibbonGeneral(IPaletteRibbonGeneral inherit,
                                    NeedPaintHandler needPaint)
        {
            Debug.Assert(inherit != null);

            // Remember inheritance
            _inherit = inherit;

            // Store the provided paint notification delegate
            NeedPaint = needPaint;

            // Set default values
            _contextTextAlign = PaletteRelativeAlign.Inherit;
            _contextTextColor = Color.Empty;
            _contextTextFont = null;
            _disabledDarkColor = Color.Empty;
            _disabledLightColor = Color.Empty;
            _dialogDarkColor = Color.Empty;
            _dialogLightColor = Color.Empty;
            _dropArrowLightColor = Color.Empty;
            _dropArrowDarkColor = Color.Empty;
            _groupSeparatorDark = Color.Empty;
            _groupSeparatorLight = Color.Empty;
            _minimizeBarDarkColor = Color.Empty;
            _minimizeBarLightColor = Color.Empty;
            _ribbonShape = PaletteRibbonShape.Inherit;
            _tabSeparatorColor = Color.Empty;
            _tabSeparatorContextColor = Color.Empty;
            _textFont = null;
            _textHint = PaletteTextHint.Inherit;
            _qatButtonDarkColor = Color.Empty;
            _qatButtonLightColor = Color.Empty;
        }
Пример #14
0
 /// <summary>
 /// Initialize a new instance of the ContextToContent class.
 /// </summary>
 /// <param name="ribbonGeneral">Source for general ribbon settings.</param>
 public ContextToContent(PaletteRibbonGeneral ribbonGeneral)
     : base(ribbonGeneral)
 {
     _overrideTextColor = Color.Empty;
     _overrideTextHint  = PaletteTextHint.Inherit;
 }
Пример #15
0
 /// <summary>
 /// Initialize a new instance of the ContextToContent class.
 /// </summary>
 /// <param name="ribbonGeneral">Source for general ribbon settings.</param>
 public ContextToContent(PaletteRibbonGeneral ribbonGeneral)
     : base(ribbonGeneral)
 {
     _overrideTextColor = Color.Empty;
     _overrideTextHint = PaletteTextHint.Inherit;
 }
Пример #16
0
 /// <summary>
 /// Convert from palette rendering hint to actual rendering hint.
 /// </summary>
 /// <param name="hint">Palette rendering hint.</param>
 /// <returns>Converted value for use with a Graphics instance.</returns>
 public static TextRenderingHint PaletteTextHintToRenderingHint(PaletteTextHint hint)
 {
     switch (hint)
     {
         case PaletteTextHint.AntiAlias:
             return TextRenderingHint.AntiAlias;
         case PaletteTextHint.AntiAliasGridFit:
             return TextRenderingHint.AntiAliasGridFit;
         case PaletteTextHint.ClearTypeGridFit:
             return TextRenderingHint.ClearTypeGridFit;
         case PaletteTextHint.SingleBitPerPixel:
             return TextRenderingHint.SingleBitPerPixel;
         case PaletteTextHint.SingleBitPerPixelGridFit:
             return TextRenderingHint.SingleBitPerPixelGridFit;
         case PaletteTextHint.SystemDefault:
             return TextRenderingHint.SystemDefault;
         default:
             // Should never happen!
             Debug.Assert(false);
             return TextRenderingHint.SystemDefault;
     }
 }
Пример #17
0
 /// <summary>
 /// Reset the TextHint to the default value.
 /// </summary>
 public void ResetTextHint()
 {
     TextHint = PaletteTextHint.Inherit;
 }
 /// <summary>
 /// Reset the TextHint to the default value.
 /// </summary>
 public void ResetTextHint()
 {
     TextHint = PaletteTextHint.Inherit;
 }
Пример #19
0
 /// <summary>
 /// Initialize a new instance of the InternalStorage structure.
 /// </summary>
 public InternalStorage()
 {
     // Set to default values
     ContentTextHint = PaletteTextHint.Inherit;
     ContentTextTrim = PaletteTextTrim.Inherit;
     ContentTextPrefix = PaletteTextHotkeyPrefix.Inherit;
     ContentTextH = PaletteRelativeAlign.Inherit;
     ContentTextV = PaletteRelativeAlign.Inherit;
     ContentTextMultiLineH = PaletteRelativeAlign.Inherit;
     ContentTextMultiLine = InheritBool.Inherit;
     ContentTextColor1 = Color.Empty;
     ContentTextColor2 = Color.Empty;
     ContentTextColorStyle = PaletteColorStyle.Inherit;
     ContentTextColorAlign = PaletteRectangleAlign.Inherit;
     ContentTextColorAngle = -1;
     ContentTextImageStyle = PaletteImageStyle.Inherit;
     ContentTextImageAlign = PaletteRectangleAlign.Inherit;
 }
 /// <summary>
 /// Populate values from the base palette.
 /// </summary>
 public void PopulateFromBase()
 {
     ContextTextAlign = GetRibbonContextTextAlign(PaletteState.Normal);
     ContextTextFont = GetRibbonContextTextFont(PaletteState.Normal);
     ContextTextColor = GetRibbonContextTextColor(PaletteState.Normal);
     DisabledDark = GetRibbonDisabledDark(PaletteState.Normal);
     DisabledLight = GetRibbonDisabledLight(PaletteState.Normal);
     DropArrowDark = GetRibbonDropArrowDark(PaletteState.Normal);
     DropArrowLight = GetRibbonDropArrowLight(PaletteState.Normal);
     GroupDialogDark = GetRibbonGroupDialogDark(PaletteState.Normal);
     GroupDialogLight = GetRibbonGroupDialogLight(PaletteState.Normal);
     GroupSeparatorDark = GetRibbonGroupSeparatorDark(PaletteState.Normal);
     GroupSeparatorLight = GetRibbonGroupSeparatorLight(PaletteState.Normal);
     MinimizeBarDarkColor = GetRibbonMinimizeBarDark(PaletteState.Normal);
     MinimizeBarLightColor = GetRibbonMinimizeBarLight(PaletteState.Normal);
     RibbonShape = GetRibbonShape();
     TabSeparatorColor = GetRibbonTabSeparatorColor(PaletteState.Normal);
     TabSeparatorContextColor = GetRibbonTabSeparatorContextColor(PaletteState.Normal);
     TextFont = GetRibbonTextFont(PaletteState.Normal);
     TextHint = GetRibbonTextHint(PaletteState.Normal);
     QATButtonDarkColor = GetRibbonGroupDialogDark(PaletteState.Normal);
     QATButtonLightColor = GetRibbonGroupDialogLight(PaletteState.Normal);
 }
Пример #21
0
        public static TextRenderingHint PaletteTextHintToRenderingHint(PaletteTextHint hint)
        {
            switch (hint)
            {
                case PaletteTextHint.AntiAlias:
                    return TextRenderingHint.AntiAlias;

                case PaletteTextHint.AntiAliasGridFit:
                    return TextRenderingHint.AntiAliasGridFit;

                case PaletteTextHint.ClearTypeGridFit:
                    return TextRenderingHint.ClearTypeGridFit;

                case PaletteTextHint.SingleBitPerPixel:
                    return TextRenderingHint.SingleBitPerPixel;

                case PaletteTextHint.SingleBitPerPixelGridFit:
                    return TextRenderingHint.SingleBitPerPixelGridFit;

                case PaletteTextHint.SystemDefault:
                    return TextRenderingHint.SystemDefault;
            }
            return TextRenderingHint.SystemDefault;
        }