Implement storage for palette border, background and content.
Наследование: Storage, IPaletteTriple
Пример #1
0
        /// <summary>
        /// Initialize a new instance of the KryptonButton class.
        /// </summary>
        public KryptonButton()
        {
            // 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;
            _orientation  = VisualOrientation.Top;
            _useMnemonic  = true;

            // Create content storage
            _buttonValues              = CreateButtonValues(NeedPaintDelegate);
            _buttonValues.TextChanged += new EventHandler(OnButtonTextChanged);

            // 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);
            _stateDefault  = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate);
            _stateFocus    = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate);

            // Create the override handling classes
            _overrideFocus    = new PaletteTripleOverride(_stateFocus, _stateNormal, PaletteState.FocusOverride);
            _overrideNormal   = new PaletteTripleOverride(_stateDefault, _overrideFocus, PaletteState.NormalDefaultOverride);
            _overrideTracking = new PaletteTripleOverride(_stateFocus, _stateTracking, PaletteState.FocusOverride);
            _overridePressed  = new PaletteTripleOverride(_stateFocus, _statePressed, PaletteState.FocusOverride);

            // Create the view button instance
            _drawButton = new ViewDrawButton(_stateDisabled,
                                             _overrideNormal,
                                             _overrideTracking,
                                             _overridePressed,
                                             new PaletteMetricRedirect(Redirector),
                                             this,
                                             Orientation,
                                             UseMnemonic);

            // Only draw a focus rectangle when focus cues are needed in the top level form
            _drawButton.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       += new MouseEventHandler(OnButtonClick);
            _buttonController.MouseSelect += new MouseEventHandler(OnButtonSelect);

            // Create the view manager instance
            ViewManager = new ViewManager(this, _drawButton);
        }
Пример #2
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);
            _stateFocus  = 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(_stateFocus, _stateDisabled, PaletteState.FocusOverride);
            _overrideNormal          = new PaletteTripleOverride(_stateFocus, _stateNormal, PaletteState.FocusOverride);
            _overrideTracking        = new PaletteTripleOverride(_stateFocus, _stateTracking, PaletteState.FocusOverride);
            _overridePressed         = new PaletteTripleOverride(_stateFocus, _statePressed, PaletteState.FocusOverride);
            _overrideCheckedNormal   = new PaletteTripleOverride(_stateFocus, _stateCheckedNormal, PaletteState.FocusOverride);
            _overrideCheckedTracking = new PaletteTripleOverride(_stateFocus, _stateCheckedTracking, PaletteState.FocusOverride);
            _overrideCheckedPressed  = new PaletteTripleOverride(_stateFocus, _stateCheckedPressed, PaletteState.FocusOverride);
        }
 /// <summary>
 /// Initialize a new instance of the PaletteMonthCalendarDoubleState class.
 /// </summary>
 /// <param name="redirect">Inheritence redirection instance.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public PaletteMonthCalendarDoubleState(PaletteMonthCalendarRedirect redirect,
                                        NeedPaintHandler needPaint)
     : base(redirect, needPaint)
 {
     _paletteHeader = new PaletteTriple(redirect.Header, needPaint);
     _paletteDay = new PaletteTriple(redirect.Day, needPaint);
     _paletteDayOfWeek = new PaletteTriple(redirect.DayOfWeek, needPaint);
 }
Пример #4
0
 /// <summary>
 /// Initialize a new instance of the PaletteTreeState class.
 /// </summary>
 /// <param name="inherit">Source for inheriting values.</param>
 /// <param name="back">Reference to back storage.</param>
 /// <param name="border">Reference to border storage.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public PaletteTreeState(PaletteTreeStateRedirect inherit,
                         PaletteBack back,
                         PaletteBorder border,
                         NeedPaintHandler needPaint)
     : base(inherit, back, border, needPaint)
 {
     _nodeTriple = new PaletteTriple(inherit.Node, needPaint);
 }
Пример #5
0
 /// <summary>
 /// Initialize a new instance of the PaletteMonthCalendarDoubleState class.
 /// </summary>
 /// <param name="redirect">Inheritence 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 PaletteTreeState class.
 /// </summary>
 /// <param name="inherit">Source for inheriting values.</param>
 /// <param name="back">Reference to back storage.</param>
 /// <param name="border">Reference to border storage.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public PaletteTreeState(PaletteTreeStateRedirect inherit,
                         PaletteBack back,
                         PaletteBorder border,
                         NeedPaintHandler needPaint)
     : base(inherit, back, border, needPaint)
 {
     Node = new PaletteTriple(inherit.Node, needPaint);
 }
Пример #7
0
        /// <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);
        }
Пример #8
0
        /// <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 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
            _itemState = new PaletteTriple(inheritItem, 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);
        }
Пример #11
0
        /// <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);
 }
Пример #14
0
 /// <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 PaletteComboBoxStates class.
        /// </summary>
        /// <param name="inheritComboBox">Source for inheriting combo box values.</param>
        /// <param name="inheritItem">Source for inheriting item values.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public PaletteComboBoxStates(IPaletteTriple inheritComboBox,
                                     IPaletteTriple inheritItem,
                                     NeedPaintHandler needPaint)
        {
            Debug.Assert(inheritComboBox != null);
            Debug.Assert(inheritItem != null);

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

            // Create storage that maps onto the inherit instances
            _itemState     = new PaletteTriple(inheritItem, needPaint);
            _comboBoxState = new PaletteInputControlTripleStates(inheritComboBox, needPaint);
        }
Пример #16
0
 /// <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);
     _paletteHeaderGroup = new PaletteNavigatorHeaderGroup(redirect.HeaderGroup, redirect.HeaderGroup.HeaderPrimary, redirect.HeaderGroup.HeaderSecondary, redirect.HeaderGroup.HeaderBar, redirect.HeaderGroup.HeaderOverflow, needPaint);
     _paletteCheckButton = new PaletteTriple(redirect.CheckButton, needPaint);
     _paletteOverflowButton = new PaletteTriple(redirect.OverflowButton, needPaint);
     _paletteMiniButton = new PaletteTriple(redirect.MiniButton, needPaint);
     _paletteBorderEdge = new PaletteBorderEdge(redirect.BorderEdge, needPaint);
     _paletteSeparator = new PaletteSeparatorPadding(redirect.Separator, redirect.Separator, needPaint);
     _paletteTab = new PaletteTabTriple(redirect.Tab, needPaint);
     _paletteRibbonTab = 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
     _stateFocus           = new PaletteTripleRedirect(redirect, PaletteBackStyle.ButtonCalendarDay, PaletteBorderStyle.ButtonCalendarDay, PaletteContentStyle.ButtonCalendarDay, needPaint);
     _stateBolded          = new PaletteTripleRedirect(redirect, PaletteBackStyle.ButtonCalendarDay, PaletteBorderStyle.ButtonCalendarDay, PaletteContentStyle.ButtonCalendarDay, needPaint);
     _stateToday           = 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);
 }
 /// <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
     _stateFocus = new PaletteTripleRedirect(redirect, PaletteBackStyle.ButtonCalendarDay, PaletteBorderStyle.ButtonCalendarDay, PaletteContentStyle.ButtonCalendarDay, needPaint);
     _stateBolded = new PaletteTripleRedirect(redirect, PaletteBackStyle.ButtonCalendarDay, PaletteBorderStyle.ButtonCalendarDay, PaletteContentStyle.ButtonCalendarDay, needPaint);
     _stateToday = 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);
 }
 /// <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);
 }
 /// <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
     _stateDefault = new PaletteTripleRedirect(redirect, backStyle, borderStyle, contentStyle, needPaint);
     _stateFocus = 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);
 }
Пример #21
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);
        }
Пример #22
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);
        }
        /// <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);
            _stateFocus = 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(_stateFocus, _stateDisabled, PaletteState.FocusOverride);
            _overrideNormal = new PaletteTripleOverride(_stateFocus, _stateNormal, PaletteState.FocusOverride);
            _overrideTracking = new PaletteTripleOverride(_stateFocus, _stateTracking, PaletteState.FocusOverride);
            _overridePressed = new PaletteTripleOverride(_stateFocus, _statePressed, PaletteState.FocusOverride);
            _overrideCheckedNormal = new PaletteTripleOverride(_stateFocus, _stateCheckedNormal, PaletteState.FocusOverride);
            _overrideCheckedTracking = new PaletteTripleOverride(_stateFocus, _stateCheckedTracking, PaletteState.FocusOverride);
            _overrideCheckedPressed = new PaletteTripleOverride(_stateFocus, _stateCheckedPressed, PaletteState.FocusOverride);
        }
Пример #24
0
        /// <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
            _buttonValues = CreateButtonValues(NeedPaintDelegate);
            _buttonValues.TextChanged += new EventHandler(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);
            _stateDefault = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate);
            _stateFocus = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate);

            // Create the override handling classes
            _overrideFocus = new PaletteTripleOverride(_stateFocus, _stateNormal,  PaletteState.FocusOverride);
            _overrideNormal = new PaletteTripleOverride(_stateDefault, _overrideFocus, PaletteState.NormalDefaultOverride);
            _overrideTracking = new PaletteTripleOverride(_stateFocus, _stateTracking, PaletteState.FocusOverride);
            _overridePressed = new PaletteTripleOverride(_stateFocus, _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
            _drawButton.DropDown = true;
            _drawButton.Splitter = true;
            _drawButton.TestForFocusCues = true;
            _drawButton.DropDownPalette = _paletteDropDownButtonImages;

            // Create a button controller to handle button style behaviour
            _buttonController = new ButtonController(_drawButton, NeedPaintDelegate);
            _buttonController.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 += new MouseEventHandler(OnButtonClick);
            _buttonController.MouseSelect += new MouseEventHandler(OnButtonSelect);

            // Create the view manager instance
            ViewManager = new ViewManager(this, _drawButton);
        }
Пример #25
0
 /// <summary>
 /// Initialize a new instance of the PaletteListState class.
 /// </summary>
 /// <param name="inherit">Source for inheriting values.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public PaletteListState(PaletteListStateRedirect inherit,
                         NeedPaintHandler needPaint)
     : base(inherit, needPaint)
 {
     Item = new PaletteTriple(inherit.Item, needPaint);
 }
 /// <summary>
 /// Initialize a new instance of the PaletteBreadCrumbState class.
 /// </summary>
 /// <param name="redirect">Inheritence redirection instance.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public PaletteBreadCrumbState(PaletteBreadCrumbRedirect redirect,
                               NeedPaintHandler needPaint)
 {
     _paletteCrumb = new PaletteTriple(redirect.BreadCrumb, needPaint);
 }
 /// <summary>
 /// Initialize a new instance of the PaletteBreadCrumbDoubleState class.
 /// </summary>
 /// <param name="redirect">Inheritence redirection instance.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public PaletteBreadCrumbDoubleState(PaletteBreadCrumbRedirect redirect,
                                     NeedPaintHandler needPaint)
     : base(redirect, needPaint)
 {
     _paletteCrumb = new PaletteTriple(redirect.BreadCrumb, needPaint);
 }
 /// <summary>
 /// Initialize a new instance of the PaletteBreadCrumbState class.
 /// </summary>
 /// <param name="redirect">Inheritence redirection instance.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public PaletteBreadCrumbState(PaletteBreadCrumbRedirect redirect,
                               NeedPaintHandler needPaint)
 {
     BreadCrumb = new PaletteTriple(redirect.BreadCrumb, needPaint);
 }
Пример #29
0
 /// <summary>
 /// Initialize a new instance of the PaletteMonthCalendarState class.
 /// </summary>
 /// <param name="redirect">Inheritence redirection instance.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public PaletteMonthCalendarState(PaletteMonthCalendarRedirect redirect,
                                  NeedPaintHandler needPaint)
 {
     Day = new PaletteTriple(redirect.Day, needPaint);
 }
Пример #30
0
        /// <summary>
        /// Initialize a new instance of the KryptonColorButton class.
        /// </summary>
        public KryptonColorButton()
        {
            // We generate click events manually, suppress default
            // production of them by the base Control class
            SetStyle(ControlStyles.StandardClick |
                     ControlStyles.StandardDoubleClick, false);

            // Set default color button properties
            _style = ButtonStyle.Standalone;
            _visibleThemes = true;
            _visibleStandard = true;
            _visibleRecent = true;
            _visibleNoColor = true;
            _visibleMoreColors = true;
            _autoRecentColors = true;
            _schemeThemes = ColorScheme.OfficeThemes;
            _schemeStandard = ColorScheme.OfficeStandard;
            _selectedRect = new Rectangle(0, 12, 16, 4);
            _selectedColor = Color.Red;
            _emptyBorderColor = Color.DarkGray;
            _dialogResult = DialogResult.None;
            _useMnemonic = true;
            _maxRecentColors = 10;
            _recentColors = new List<Color>();

            // Create the context menu items
            _kryptonContextMenu = new KryptonContextMenu();
            _separatorTheme = new KryptonContextMenuSeparator();
            _headingTheme = new KryptonContextMenuHeading("Theme Colors");
            _colorsTheme = new KryptonContextMenuColorColumns(ColorScheme.OfficeThemes);
            _separatorStandard = new KryptonContextMenuSeparator();
            _headingStandard = new KryptonContextMenuHeading("Standard Colors");
            _colorsStandard = new KryptonContextMenuColorColumns(ColorScheme.OfficeStandard);
            _separatorRecent = new KryptonContextMenuSeparator();
            _headingRecent = new KryptonContextMenuHeading("Recent Colors");
            _colorsRecent = new KryptonContextMenuColorColumns(ColorScheme.None);
            _separatorNoColor = new KryptonContextMenuSeparator();
            _itemNoColor = new KryptonContextMenuItem("&No Color", Properties.Resources.ButtonNoColor, new EventHandler(OnClickNoColor));
            _itemsNoColor = new KryptonContextMenuItems();
            _itemsNoColor.Items.Add(_itemNoColor);
            _separatorMoreColors = new KryptonContextMenuSeparator();
            _itemMoreColors = new KryptonContextMenuItem("&More Colors...", new EventHandler(OnClickMoreColors));
            _itemsMoreColors = new KryptonContextMenuItems();
            _itemsMoreColors.Items.Add(_itemMoreColors);
            _kryptonContextMenu.Items.AddRange(new KryptonContextMenuItemBase[] { _separatorTheme, _headingTheme, _colorsTheme,
                                                                                  _separatorStandard, _headingStandard, _colorsStandard,
                                                                                  _separatorRecent, _headingRecent, _colorsRecent,
                                                                                  _separatorNoColor, _itemsNoColor,
                                                                                  _separatorMoreColors, _itemsMoreColors});

            // Create content storage
            _buttonValues = CreateButtonValues(NeedPaintDelegate);
            _buttonValues.TextChanged += new EventHandler(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
            _strings = new PaletteColorButtonStrings();
            _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);
            _stateDefault = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate);
            _stateFocus = new PaletteTripleRedirect(Redirector, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, NeedPaintDelegate);

            // Create the override handling classes
            _overrideFocus = new PaletteTripleOverride(_stateFocus, _stateNormal,  PaletteState.FocusOverride);
            _overrideNormal = new PaletteTripleOverride(_stateDefault, _overrideFocus, PaletteState.NormalDefaultOverride);
            _overrideTracking = new PaletteTripleOverride(_stateFocus, _stateTracking, PaletteState.FocusOverride);
            _overridePressed = new PaletteTripleOverride(_stateFocus, _statePressed, PaletteState.FocusOverride);

            // Create the view color button instance
            _drawButton = new ViewDrawButton(_stateDisabled,
                                             _overrideNormal,
                                             _overrideTracking,
                                             _overridePressed,
                                             new PaletteMetricRedirect(Redirector),
                                             this,
                                             VisualOrientation.Top,
                                             UseMnemonic);

            // Set default color button state
            _drawButton.DropDown = true;
            _drawButton.Splitter = true;
            _drawButton.TestForFocusCues = true;
            _drawButton.DropDownPalette = _paletteDropDownButtonImages;

            // Create a color button controller to handle button style behaviour
            _buttonController = new ButtonController(_drawButton, NeedPaintDelegate);
            _buttonController.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 += new MouseEventHandler(OnButtonClick);
            _buttonController.MouseSelect += new MouseEventHandler(OnButtonSelect);

            // Create the view manager instance
            ViewManager = new ViewManager(this, _drawButton);
        }
Пример #31
0
 /// <summary>
 /// Initialize a new instance of the PaletteListState class.
 /// </summary>
 /// <param name="inherit">Source for inheriting values.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public PaletteListState(PaletteListStateRedirect inherit,
                         NeedPaintHandler needPaint)
     : base(inherit, needPaint)
 {
     _itemTriple = new PaletteTriple(inherit.Item, needPaint);
 }
 /// <summary>
 /// Initialize a new instance of the PaletteMonthCalendarState class.
 /// </summary>
 /// <param name="redirect">Inheritence redirection instance.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public PaletteMonthCalendarState(PaletteMonthCalendarRedirect redirect,
                                  NeedPaintHandler needPaint)
 {
     _paletteDay = new PaletteTriple(redirect.Day, needPaint);
 }
        /// <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);
        }