Ejemplo n.º 1
0
        /// <summary>
        /// Initialize a new instance of the KryptonContextMenuCheckButton class.
        /// </summary>
        /// <param name="initialText">Initial text for display.</param>
        public KryptonContextMenuCheckButton(string initialText)
        {
            // Default fields
            _enabled               = true;
            _autoClose             = false;
            _text                  = initialText;
            _extraText             = string.Empty;
            _image                 = null;
            _imageTransparentColor = Color.Empty;
            _checked               = false;
            _autoCheck             = false;
            _style                 = ButtonStyle.Standalone;

            // Create the redirectors
            StateCommon   = new PaletteTripleRedirect(PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone);
            OverrideFocus = new PaletteTripleRedirect(PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone);

            // Create the palette storage
            StateDisabled        = new PaletteTriple(StateCommon);
            StateNormal          = new PaletteTriple(StateCommon);
            StateTracking        = new PaletteTriple(StateCommon);
            StatePressed         = new PaletteTriple(StateCommon);
            StateCheckedNormal   = new PaletteTriple(StateCommon);
            StateCheckedTracking = new PaletteTriple(StateCommon);
            StateCheckedPressed  = new PaletteTriple(StateCommon);

            // Create the override handling classes
            OverrideDisabled        = new PaletteTripleOverride(OverrideFocus, StateDisabled, PaletteState.FocusOverride);
            OverrideNormal          = new PaletteTripleOverride(OverrideFocus, StateNormal, PaletteState.FocusOverride);
            OverrideTracking        = new PaletteTripleOverride(OverrideFocus, StateTracking, PaletteState.FocusOverride);
            OverridePressed         = new PaletteTripleOverride(OverrideFocus, StatePressed, PaletteState.FocusOverride);
            OverrideCheckedNormal   = new PaletteTripleOverride(OverrideFocus, StateCheckedNormal, PaletteState.FocusOverride);
            OverrideCheckedTracking = new PaletteTripleOverride(OverrideFocus, StateCheckedTracking, PaletteState.FocusOverride);
            OverrideCheckedPressed  = new PaletteTripleOverride(OverrideFocus, StateCheckedPressed, PaletteState.FocusOverride);
        }
Ejemplo n.º 2
0
        private void ChangeOnButtonState(IPaletteTriple state, Color color1, Color color2, Color borderColor, Image image)
        {
            if (state is PaletteTriple)
            {
                PaletteTriple _state = (PaletteTriple)state;

                _state.Back.Color1   = color1;
                _state.Back.Color2   = color2;
                _state.Border.Color1 = borderColor;

                if (image != null)
                {
                    _state.Back.Image = image;
                }
            }
            if (state is PaletteTripleRedirect)
            {
                PaletteTripleRedirect _state = (PaletteTripleRedirect)state;

                _state.Back.Color1   = color1;
                _state.Back.Color2   = color2;
                _state.Border.Color1 = borderColor;

                if (image != null)
                {
                    _state.Back.Image = image;
                }
            }
        }
 /// <summary>
 /// Initialize a new instance of the PaletteMonthCalendarDoubleState class.
 /// </summary>
 /// <param name="redirect">inheritance redirection instance.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public PaletteMonthCalendarDoubleState(PaletteMonthCalendarRedirect redirect,
                                        NeedPaintHandler needPaint)
     : base(redirect, needPaint)
 {
     Header    = new PaletteTriple(redirect.Header, needPaint);
     Day       = new PaletteTriple(redirect.Day, needPaint);
     DayOfWeek = new PaletteTriple(redirect.DayOfWeek, needPaint);
 }
 /// <summary>
 /// Initialize a new instance of the PaletteNavigatorOther class.
 /// </summary>
 /// <param name="redirect">Inheritence redirection instance.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public PaletteNavigatorOther(PaletteNavigatorRedirect redirect,
                              NeedPaintHandler needPaint)
 {
     // Create the palette storage
     CheckButton    = new PaletteTriple(redirect.CheckButton, needPaint);
     OverflowButton = new PaletteTriple(redirect.OverflowButton, needPaint);
     MiniButton     = new PaletteTriple(redirect.MiniButton, needPaint);
     Tab            = new PaletteTabTriple(redirect.Tab, needPaint);
     RibbonTab      = new PaletteRibbonTabContent(redirect.RibbonTab.TabDraw, redirect.RibbonTab.TabDraw, redirect.RibbonTab.Content, needPaint);
 }
        /// <summary>
        /// Initialize a new instance of the KryptonPaletteCommon class.
        /// </summary>
        /// <param name="redirector">Palette redirector for sourcing inherited values.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        internal KryptonPaletteCommon(PaletteRedirect redirector,
                                      NeedPaintHandler needPaint)
        {
            Debug.Assert(redirector != null);

            // Create the common palettes
            StateCommon   = new PaletteTripleRedirect(redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, needPaint);
            StateDisabled = new PaletteTriple(StateCommon, needPaint);
            StateOthers   = new PaletteTriple(StateCommon, needPaint);
        }
        /// <summary>
        /// Initialize a new instance of the PaletteTreeNodeTriple class.
        /// </summary>
        /// <param name="inherit">Source for inheriting values.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public PaletteTreeNodeTriple(PaletteTripleRedirect inherit,
                                     NeedPaintHandler needPaint)
        {
            Debug.Assert(inherit != null);

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

            // Create storage that maps onto the inherit instances
            _paletteNode = new PaletteTriple(inherit, needPaint);
        }
        /// <summary>
        /// Initialize a new instance of the PaletteComboBoxJustItemStates class.
        /// </summary>
        /// <param name="inheritItem">Source for inheriting item values.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public PaletteComboBoxJustItemStates(IPaletteTriple inheritItem,
                                             NeedPaintHandler needPaint)
        {
            Debug.Assert(inheritItem != null);

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

            // Create storage that maps onto the inherit instances
            Item = new PaletteTriple(inheritItem, needPaint);
        }
 /// <summary>
 /// Initialize a new instance of the KryptonPaletteInputControl class.
 /// </summary>
 /// <param name="redirect">Redirector to inherit values from.</param>
 /// <param name="backStyle">Background style.</param>
 /// <param name="borderStyle">Border style.</param>
 /// <param name="contentStyle">Content style.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public KryptonPaletteInputControl(PaletteRedirect redirect,
                                   PaletteBackStyle backStyle,
                                   PaletteBorderStyle borderStyle,
                                   PaletteContentStyle contentStyle,
                                   NeedPaintHandler needPaint)
 {
     // Create the storage objects
     _stateCommon   = new PaletteTripleRedirect(redirect, backStyle, borderStyle, contentStyle, needPaint);
     _stateDisabled = new PaletteTriple(_stateCommon, needPaint);
     _stateNormal   = new PaletteTriple(_stateCommon, needPaint);
     _stateActive   = new PaletteTriple(_stateCommon, needPaint);
 }
 /// <summary>
 /// Initialize a new instance of the PaletteNavigatorNormabled class.
 /// </summary>
 /// <param name="redirect">Inheritence redirection instance.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public PaletteNavigator(PaletteNavigatorRedirect redirect,
                         NeedPaintHandler needPaint)
     : base(redirect, needPaint)
 {
     // Create the palette storage
     PalettePage    = new PalettePage(redirect.PalettePage, needPaint);
     HeaderGroup    = new PaletteNavigatorHeaderGroup(redirect.HeaderGroup, redirect.HeaderGroup.HeaderPrimary, redirect.HeaderGroup.HeaderSecondary, redirect.HeaderGroup.HeaderBar, redirect.HeaderGroup.HeaderOverflow, needPaint);
     CheckButton    = new PaletteTriple(redirect.CheckButton, needPaint);
     OverflowButton = new PaletteTriple(redirect.OverflowButton, needPaint);
     MiniButton     = new PaletteTriple(redirect.MiniButton, needPaint);
     BorderEdge     = new PaletteBorderEdge(redirect.BorderEdge, needPaint);
     Separator      = new PaletteSeparatorPadding(redirect.Separator, redirect.Separator, needPaint);
     Tab            = new PaletteTabTriple(redirect.Tab, needPaint);
     RibbonTab      = new PaletteRibbonTabContent(redirect.RibbonTab.TabDraw, redirect.RibbonTab.TabDraw, redirect.RibbonTab.Content, needPaint);
 }
 /// <summary>
 /// Initialize a new instance of the KryptonPaletteCalendarDay class.
 /// </summary>
 /// <param name="redirect">Redirector to inherit values from.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public KryptonPaletteCalendarDay(PaletteRedirect redirect,
                                  NeedPaintHandler needPaint)
 {
     // Create the storage objects
     OverrideFocus        = new PaletteTripleRedirect(redirect, PaletteBackStyle.ButtonCalendarDay, PaletteBorderStyle.ButtonCalendarDay, PaletteContentStyle.ButtonCalendarDay, needPaint);
     OverrideBolded       = new PaletteTripleRedirect(redirect, PaletteBackStyle.ButtonCalendarDay, PaletteBorderStyle.ButtonCalendarDay, PaletteContentStyle.ButtonCalendarDay, needPaint);
     OverrideToday        = new PaletteTripleRedirect(redirect, PaletteBackStyle.ButtonCalendarDay, PaletteBorderStyle.ButtonCalendarDay, PaletteContentStyle.ButtonCalendarDay, needPaint);
     StateCommon          = new PaletteTripleRedirect(redirect, PaletteBackStyle.ButtonCalendarDay, PaletteBorderStyle.ButtonCalendarDay, PaletteContentStyle.ButtonCalendarDay, needPaint);
     StateDisabled        = new PaletteTriple(StateCommon, needPaint);
     StateNormal          = new PaletteTriple(StateCommon, needPaint);
     StateTracking        = new PaletteTriple(StateCommon, needPaint);
     StatePressed         = new PaletteTriple(StateCommon, needPaint);
     StateCheckedNormal   = new PaletteTriple(StateCommon, needPaint);
     StateCheckedTracking = new PaletteTriple(StateCommon, needPaint);
     StateCheckedPressed  = new PaletteTriple(StateCommon, needPaint);
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Initialize a new instance of the KryptonPaletteButtonBase class.
 /// </summary>
 /// <param name="redirect">Redirector to inherit values from.</param>
 /// <param name="backStyle">Background style.</param>
 /// <param name="borderStyle">Border style.</param>
 /// <param name="contentStyle">Content style.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public KryptonPaletteCheckButton(PaletteRedirect redirect,
                                  PaletteBackStyle backStyle,
                                  PaletteBorderStyle borderStyle,
                                  PaletteContentStyle contentStyle,
                                  NeedPaintHandler needPaint)
 {
     // Create the storage objects
     OverrideDefault      = new PaletteTripleRedirect(redirect, backStyle, borderStyle, contentStyle, needPaint);
     OverrideFocus        = new PaletteTripleRedirect(redirect, backStyle, borderStyle, contentStyle, needPaint);
     StateCommon          = new PaletteTripleRedirect(redirect, backStyle, borderStyle, contentStyle, needPaint);
     StateDisabled        = new PaletteTriple(StateCommon, needPaint);
     StateNormal          = new PaletteTriple(StateCommon, needPaint);
     StateTracking        = new PaletteTriple(StateCommon, needPaint);
     StatePressed         = new PaletteTriple(StateCommon, needPaint);
     StateCheckedNormal   = new PaletteTriple(StateCommon, needPaint);
     StateCheckedTracking = new PaletteTriple(StateCommon, needPaint);
     StateCheckedPressed  = new PaletteTriple(StateCommon, needPaint);
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Initialize a new instance of the KryptonCheckButton class.
        /// </summary>
        public KryptonCheckButton()
        {
            // Create the extra state needed for the checked additions the the base button
            StateCheckedNormal   = new PaletteTriple(StateCommon, NeedPaintDelegate);
            StateCheckedTracking = new PaletteTriple(StateCommon, NeedPaintDelegate);
            StateCheckedPressed  = new PaletteTriple(StateCommon, NeedPaintDelegate);

            // Create the override handling classes
            _overrideCheckedFocus    = new PaletteTripleOverride(OverrideFocus, StateCheckedNormal, PaletteState.FocusOverride);
            _overrideCheckedNormal   = new PaletteTripleOverride(OverrideDefault, _overrideCheckedFocus, PaletteState.NormalDefaultOverride);
            _overrideCheckedTracking = new PaletteTripleOverride(OverrideFocus, StateCheckedTracking, PaletteState.FocusOverride);
            _overrideCheckedPressed  = new PaletteTripleOverride(OverrideFocus, StateCheckedPressed, PaletteState.FocusOverride);

            // Add the checked specific palettes to the existing view button
            ViewDrawButton.SetCheckedPalettes(_overrideCheckedNormal,
                                              _overrideCheckedTracking,
                                              _overrideCheckedPressed);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Initialize a new instance of the KryptonButton class.
        /// </summary>
        public KryptonCommandLinkButton()
        {
            // We generate click events manually, suppress default
            // production of them by the base Control class
            SetStyle(ControlStyles.StandardClick |
                     ControlStyles.StandardDoubleClick, false);

            // Set default button properties
            base.AutoSize = false;
            DialogResult  = DialogResult.None;
            _orientation  = VisualOrientation.Top;
            _useMnemonic  = true;

            // Create content storage
            CommandLinkImageValue = new ImageValue(NeedPaintDelegate);
            CommandLinkTextValues = new CommandLinkTextValues(NeedPaintDelegate);

            // Create the palette storage
            StateCommon = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonCommand, PaletteBorderStyle.ButtonCommand, PaletteContentStyle.ButtonCommand, NeedPaintDelegate);
            PaletteContentText contentShortText = StateCommon.Content.ShortText;

            contentShortText.Font              = new Font(@"Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 0);
            contentShortText.TextH             = PaletteRelativeAlign.Near;
            contentShortText.TextV             = PaletteRelativeAlign.Center;
            StateCommon.Content.LongText.TextH = PaletteRelativeAlign.Near;
            StateCommon.Content.LongText.TextV = PaletteRelativeAlign.Far;

            StateDisabled                     = new PaletteTriple(StateCommon, NeedPaintDelegate);
            StateNormal                       = new PaletteTriple(StateCommon, NeedPaintDelegate);
            StateTracking                     = new PaletteTriple(StateCommon, NeedPaintDelegate);
            StatePressed                      = new PaletteTriple(StateCommon, NeedPaintDelegate);
            OverrideDefault                   = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonCommand, PaletteBorderStyle.ButtonCommand, PaletteContentStyle.ButtonCommand, NeedPaintDelegate);
            OverrideFocus                     = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonCommand, PaletteBorderStyle.ButtonCommand, PaletteContentStyle.ButtonCommand, NeedPaintDelegate);
            OverrideFocus.Border.Draw         = InheritBool.True;
            OverrideFocus.Border.DrawBorders  = PaletteDrawBorders.All;
            OverrideFocus.Border.GraphicsHint = PaletteGraphicsHint.AntiAlias;
            // Force style update
            ButtonStyle = ButtonStyle.Command;

            // Create the override handling classes
            _overrideFocus    = new PaletteTripleOverride(OverrideFocus, StateNormal, PaletteState.FocusOverride);
            _overrideNormal   = new PaletteTripleOverride(OverrideDefault, _overrideFocus, PaletteState.NormalDefaultOverride);
            _overrideTracking = new PaletteTripleOverride(OverrideFocus, StateTracking, PaletteState.FocusOverride);
            _overridePressed  = new PaletteTripleOverride(OverrideFocus, StatePressed, PaletteState.FocusOverride);

            // Create the view button instance
            drawButton = new ViewDrawCommandLinkButton(StateDisabled,
                                                       _overrideNormal,
                                                       _overrideTracking,
                                                       _overridePressed,
                                                       new PaletteMetricRedirect(Redirector),
                                                       CommandLinkImageValue, CommandLinkTextValues,
                                                       Orientation,
                                                       UseMnemonic)
            {
                // Only draw a focus rectangle when focus cues are needed in the top level form
                TestForFocusCues = true
            };

            // Create a button controller to handle button style behaviour
            _buttonController = new ButtonController(drawButton, NeedPaintDelegate);

            // Assign the controller to the view element to treat as a button
            drawButton.MouseController  = _buttonController;
            drawButton.KeyController    = _buttonController;
            drawButton.SourceController = _buttonController;

            // Need to know when user clicks the button view or mouse selects it
            _buttonController.Click       += OnButtonClick;
            _buttonController.MouseSelect += OnButtonSelect;

            // Create the view manager instance
            ViewManager = new ViewManager(this, drawButton);
        }
        /// <summary>
        /// Initialize a new instance of the KryptonDropButton class.
        /// </summary>
        public KryptonDropButton()
        {
            // We generate click events manually, suppress default
            // production of them by the base Control class
            SetStyle(ControlStyles.StandardClick |
                     ControlStyles.StandardDoubleClick, false);

            // Set default button properties
            _style       = ButtonStyle.Standalone;
            DialogResult = DialogResult.None;
            _useMnemonic = true;

            // Create content storage
            Values              = CreateButtonValues(NeedPaintDelegate);
            Values.TextChanged += OnButtonTextChanged;
            Images              = new DropDownButtonImages(NeedPaintDelegate);

            // Image need an extra redirector to check the local images first
            _paletteDropDownButtonImages = new PaletteRedirectDropDownButton(Redirector, Images);

            // Create the palette storage
            StateCommon     = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate);
            StateDisabled   = new PaletteTriple(StateCommon, NeedPaintDelegate);
            StateNormal     = new PaletteTriple(StateCommon, NeedPaintDelegate);
            StateTracking   = new PaletteTriple(StateCommon, NeedPaintDelegate);
            StatePressed    = new PaletteTriple(StateCommon, NeedPaintDelegate);
            OverrideDefault = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate);
            OverrideFocus   = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate);

            // Create the override handling classes
            _overrideFocus    = new PaletteTripleOverride(OverrideFocus, StateNormal, PaletteState.FocusOverride);
            _overrideNormal   = new PaletteTripleOverride(OverrideDefault, _overrideFocus, PaletteState.NormalDefaultOverride);
            _overrideTracking = new PaletteTripleOverride(OverrideFocus, StateTracking, PaletteState.FocusOverride);
            _overridePressed  = new PaletteTripleOverride(OverrideFocus, StatePressed, PaletteState.FocusOverride);

            // Create the view button instance
            _drawButton = new ViewDrawButton(StateDisabled,
                                             _overrideNormal,
                                             _overrideTracking,
                                             _overridePressed,
                                             new PaletteMetricRedirect(Redirector),
                                             this,
                                             VisualOrientation.Top,
                                             UseMnemonic)
            {
                // Set default button state
                DropDown         = true,
                Splitter         = true,
                TestForFocusCues = true,
                DropDownPalette  = _paletteDropDownButtonImages
            };

            // Create a button controller to handle button style behaviour
            _buttonController = new ButtonController(_drawButton, NeedPaintDelegate)
            {
                BecomesFixed = true
            };

            // Assign the controller to the view element to treat as a button
            _drawButton.MouseController  = _buttonController;
            _drawButton.KeyController    = _buttonController;
            _drawButton.SourceController = _buttonController;

            // Need to know when user clicks the button view or mouse selects it
            _buttonController.Click       += OnButtonClick;
            _buttonController.MouseSelect += OnButtonSelect;

            // Create the view manager instance
            ViewManager = new ViewManager(this, _drawButton);
        }