Allow the palette to be overriden optionally.
Inheritance: GlobalId, IPaletteTriple
Example #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);
        }
Example #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 PaletteNavigatorOverride class.
        /// </summary>
        /// <param name="checkButtonNormal">Normal palette to use.</param>
        /// <param name="checkButtonOther">Override palette to use.</param>
        /// <param name="overrideState">State used by the override.</param>
        public PaletteNavigatorOverride(IPaletteTriple checkButtonNormal,
                                        IPaletteTriple checkButtonOther,
                                        PaletteState overrideState)
        {
            Debug.Assert(checkButtonNormal != null);
            Debug.Assert(checkButtonOther != null);

            // Create the palette storage
            _overrideCheckButton = new PaletteTripleOverride(checkButtonNormal,
                                                             checkButtonOther,
                                                             overrideState);

            // Do not apply an override by default
            Apply = false;
        }
Example #4
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 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 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);
        }
        /// <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);
        }
        /// <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);
        }
Example #9
0
        public KryptonListBox()
        {
            // Contains another control and needs marking as such for validation to work
            SetStyle(ControlStyles.ContainerControl, true);

            // Cannot select this control, only the child ListBox and does not generate a click event
            SetStyle(ControlStyles.Selectable | ControlStyles.StandardClick, false);

            // Default fields
            _alwaysActive = true;
            _lastSelectedIndex = -1;
            _style = ButtonStyle.ListItem;
            base.Padding = new Padding(1);

            // Create the palette storage
            _stateCommon = new PaletteListStateRedirect(Redirector, PaletteBackStyle.InputControlStandalone, PaletteBorderStyle.InputControlStandalone, NeedPaintDelegate);
            _stateFocus = new PaletteListItemTripleRedirect(Redirector, PaletteBackStyle.ButtonListItem, PaletteBorderStyle.ButtonListItem, PaletteContentStyle.ButtonListItem, NeedPaintDelegate);
            _stateDisabled = new PaletteListState(_stateCommon, NeedPaintDelegate);
            _stateActive = new PaletteDouble(_stateCommon, NeedPaintDelegate);
            _stateNormal = new PaletteListState(_stateCommon, NeedPaintDelegate);
            _stateTracking = new PaletteListItemTriple(_stateCommon.Item, NeedPaintDelegate);
            _statePressed = new PaletteListItemTriple(_stateCommon.Item, NeedPaintDelegate);
            _stateCheckedNormal = new PaletteListItemTriple(_stateCommon.Item, NeedPaintDelegate);
            _stateCheckedTracking = new PaletteListItemTriple(_stateCommon.Item, NeedPaintDelegate);
            _stateCheckedPressed = new PaletteListItemTriple(_stateCommon.Item, NeedPaintDelegate);

            // Create the override handling classes
            _overrideNormal = new PaletteTripleOverride(_stateFocus.Item, _stateNormal.Item, PaletteState.FocusOverride);
            _overrideTracking = new PaletteTripleOverride(_stateFocus.Item, _stateTracking.Item, PaletteState.FocusOverride);
            _overridePressed = new PaletteTripleOverride(_stateFocus.Item, _statePressed.Item, PaletteState.FocusOverride);
            _overrideCheckedNormal = new PaletteTripleOverride(_stateFocus.Item, _stateCheckedNormal.Item, PaletteState.FocusOverride);
            _overrideCheckedTracking = new PaletteTripleOverride(_stateFocus.Item, _stateCheckedTracking.Item, PaletteState.FocusOverride);
            _overrideCheckedPressed = new PaletteTripleOverride(_stateFocus.Item, _stateCheckedPressed.Item, PaletteState.FocusOverride);

            // Create the draw element for owner drawing individual items
            _contentValues = new FixedContentValue();
            _drawButton = new ViewDrawButton(StateDisabled.Item, _overrideNormal,
                                             _overrideTracking, _overridePressed,
                                             _overrideCheckedNormal, _overrideCheckedTracking,
                                             _overrideCheckedPressed,
                                             new PaletteMetricRedirect(Redirector),
                                             _contentValues, VisualOrientation.Top, false);

            // Create the internal list box used for containing content
            _listBox = new InternalListBox(this);
            _listBox.DrawItem += new DrawItemEventHandler(OnListBoxDrawItem);
            _listBox.MeasureItem += new MeasureItemEventHandler(OnListBoxMeasureItem);
            _listBox.TrackMouseEnter += new EventHandler(OnListBoxMouseChange);
            _listBox.TrackMouseLeave += new EventHandler(OnListBoxMouseChange);
            _listBox.DataSourceChanged += new EventHandler(OnListBoxDataSourceChanged);
            _listBox.DisplayMemberChanged += new EventHandler(OnListBoxDisplayMemberChanged);
            _listBox.ValueMemberChanged += new EventHandler(OnListBoxValueMemberChanged);
            _listBox.SelectedIndexChanged += new EventHandler(OnListBoxSelectedIndexChanged);
            _listBox.SelectedValueChanged += new EventHandler(OnListBoxSelectedValueChanged);
            _listBox.DisplayMemberChanged += new EventHandler(OnListBoxDisplayMemberChanged);
            _listBox.Format += new ListControlConvertEventHandler(OnListBoxFormat);
            _listBox.FormatInfoChanged += new EventHandler(OnListBoxFormatInfoChanged);
            _listBox.FormatStringChanged += new EventHandler(OnListBoxFormatStringChanged);
            _listBox.FormattingEnabledChanged += new EventHandler(OnListBoxFormattingEnabledChanged);
            _listBox.GotFocus += new EventHandler(OnListBoxGotFocus);
            _listBox.LostFocus += new EventHandler(OnListBoxLostFocus);
            _listBox.KeyDown += new KeyEventHandler(OnListBoxKeyDown);
            _listBox.KeyUp += new KeyEventHandler(OnListBoxKeyUp);
            _listBox.KeyPress += new KeyPressEventHandler(OnListBoxKeyPress);
            _listBox.PreviewKeyDown += new PreviewKeyDownEventHandler(OnListBoxPreviewKeyDown);
            _listBox.Validating += new CancelEventHandler(OnListBoxValidating);
            _listBox.Validated += new EventHandler(OnListBoxValidated);

            // Create the element that fills the remainder space and remembers fill rectange
            _layoutFill = new ViewLayoutFill(_listBox);
            _layoutFill.DisplayPadding = new Padding(1);

            // Create inner view for placing inside the drawing docker
            _drawDockerInner = new ViewLayoutDocker();
            _drawDockerInner.Add(_layoutFill, ViewDockStyle.Fill);

            // Create view for the control border and background
            _drawDockerOuter = new ViewDrawDocker(_stateNormal.Back, _stateNormal.Border);
            _drawDockerOuter.Add(_drawDockerInner, ViewDockStyle.Fill);

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

            // We need to create and cache a device context compatible with the display
            _screenDC = PI.CreateCompatibleDC(IntPtr.Zero);

            // Add list box to the controls collection
            ((KryptonReadOnlyControls)Controls).AddInternal(_listBox);
        }
        /// <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 ViewDrawNavCheckButtonBase class.
        /// </summary>
        /// <param name="navigator">Owning navigator instance.</param>
        /// <param name="page">Page this check button represents.</param>
        /// <param name="orientation">Orientation for the check button.</param>
        /// <param name="stateDisabled">Source for disabled state values.</param>
        /// <param name="stateNormal">Source for normal state values.</param>
        /// <param name="stateTracking">Source for tracking state values.</param>
        /// <param name="statePressed">Source for pressed state values.</param>
        /// <param name="stateSelected">Source for selected state values.</param>
        /// <param name="stateFocused">Source for focused state values.</param>
        public ViewDrawNavCheckButtonBase(KryptonNavigator navigator,
                                          KryptonPage page,
                                          VisualOrientation orientation,
                                          IPaletteTriple stateDisabled,
                                          IPaletteTriple stateNormal,
                                          IPaletteTriple stateTracking,
                                          IPaletteTriple statePressed,
                                          IPaletteTriple stateSelected,
                                          IPaletteTriple stateFocused)
            : base(stateDisabled, stateNormal, stateTracking, 
                   statePressed, null, null, orientation, true)
        {
            Debug.Assert(navigator != null);

            _navigator = navigator;
            _page = page;
            _lastClick = DateTime.Now.AddDays(-1);

            // Associate the page component with this view element
            Component = page;

            // Prevent user from unchecking the selected check button
            AllowUncheck = false;

            // Set the source for values to ourself
            ButtonValues = this;

            // Create a controller for managing button behavior
            IMouseController controller = CreateMouseController();
            MouseController = controller;

            // Create overrides for getting the focus values
            _overrideDisabled = new PaletteTripleOverride(stateFocused, stateDisabled, PaletteState.FocusOverride);
            _overrideNormal = new PaletteTripleOverride(stateFocused, stateNormal, PaletteState.FocusOverride);
            _overrideTracking = new PaletteTripleOverride(stateFocused, stateTracking, PaletteState.FocusOverride);
            _overridePressed = new PaletteTripleOverride(stateFocused, statePressed, PaletteState.FocusOverride);
            _overrideSelected = new PaletteTripleOverride(stateFocused, stateSelected, PaletteState.FocusOverride);

            // Push values into the base class
            SetPalettes(_overrideDisabled, _overrideNormal, _overrideTracking, _overridePressed);
            SetCheckedPalettes(_overrideSelected, _overrideSelected, _overrideSelected);

            // Are we allowed to add button specs to the button?
            if (AllowButtonSpecs)
            {
                // Create button specification collection manager
                _buttonManager = new ButtonSpecNavManagerLayoutBar(Navigator, Navigator.InternalRedirector, Page.ButtonSpecs, null,
                                                                   new ViewLayoutDocker[] { LayoutDocker },
                                                                   new IPaletteMetric[] { Navigator.StateCommon },
                                                                   new PaletteMetricInt[] { PaletteMetricInt.PageButtonInset },
                                                                   new PaletteMetricInt[] { PaletteMetricInt.PageButtonInset },
                                                                   new PaletteMetricPadding[] { PaletteMetricPadding.PageButtonPadding },
                                                                   new GetToolStripRenderer(Navigator.CreateToolStripRenderer),
                                                                   null);

                // Hook up the tooltip manager so that tooltips can be generated
                _buttonManager.ToolTipManager = Navigator.ToolTipManager;

                // Allow derived classes to update the remapping with different values
                UpdateButtonSpecMapping();
            }
        }
        /// <summary>
        /// Initialize a new instance of the KryptonContextMenuMonthCalendar class.
        /// </summary>
        public KryptonContextMenuMonthCalendar()
        {
            // Default fields
            _autoClose = true;
            _enabled = true;
            _showToday = true;
            _showTodayCircle = true;
            _closeOnTodayClick = false;
            _dimensions = new Size(1, 1);
            _firstDayOfWeek = Day.Default;
            _headerStyle = HeaderStyle.Calendar;
            _dayStyle = ButtonStyle.CalendarDay;
            _dayOfWeekStyle = ButtonStyle.CalendarDay;
            _selectionStart = DateTime.Now.Date;
            _selectionEnd = _selectionStart;
            _todayDate = _selectionStart;
            _minDate = DateTimePicker.MinimumDateTime;
            _maxDate = DateTimePicker.MaximumDateTime;
            _maxSelectionCount = 7;
            _annualDays = new int[12];
            _annualDates = new DateTimeList();
            _monthlyDates = new DateTimeList();
            _dates = new DateTimeList();
            _today = _defaultToday;
            _todayFormat = "d";

            // Create the common/override state storage
            _stateCommon = new PaletteMonthCalendarRedirect();
            _stateFocus = new PaletteMonthCalendarStateRedirect();
            _stateBolded = new PaletteMonthCalendarStateRedirect();
            _stateToday = new PaletteMonthCalendarStateRedirect();

            // Basic state storage
            _stateDisabled = new PaletteMonthCalendarDoubleState(_stateCommon);
            _stateNormal = new PaletteMonthCalendarDoubleState(_stateCommon);
            _stateTracking = new PaletteMonthCalendarState(_stateCommon);
            _statePressed = new PaletteMonthCalendarState(_stateCommon);
            _stateCheckedNormal = new PaletteMonthCalendarState(_stateCommon);
            _stateCheckedTracking = new PaletteMonthCalendarState(_stateCommon);
            _stateCheckedPressed = new PaletteMonthCalendarState(_stateCommon);

            // Bold overrides
            _boldedDisabled = new PaletteTripleOverride(_stateBolded.Day, _stateDisabled.Day, PaletteState.BoldedOverride);
            _boldedNormal = new PaletteTripleOverride(_stateBolded.Day, _stateNormal.Day, PaletteState.BoldedOverride);
            _boldedTracking = new PaletteTripleOverride(_stateBolded.Day, _stateTracking.Day, PaletteState.BoldedOverride);
            _boldedPressed = new PaletteTripleOverride(_stateBolded.Day, _statePressed.Day, PaletteState.BoldedOverride);
            _boldedCheckedNormal = new PaletteTripleOverride(_stateBolded.Day, _stateCheckedNormal.Day, PaletteState.BoldedOverride);
            _boldedCheckedTracking = new PaletteTripleOverride(_stateBolded.Day, _stateCheckedTracking.Day, PaletteState.BoldedOverride);
            _boldedCheckedPressed = new PaletteTripleOverride(_stateBolded.Day, _stateCheckedPressed.Day, PaletteState.BoldedOverride);

            // Today overrides
            _todayDisabled = new PaletteTripleOverride(_stateToday.Day, _boldedDisabled, PaletteState.TodayOverride);
            _todayNormal = new PaletteTripleOverride(_stateToday.Day, _boldedNormal, PaletteState.TodayOverride);
            _todayTracking = new PaletteTripleOverride(_stateToday.Day, _boldedTracking, PaletteState.TodayOverride);
            _todayPressed = new PaletteTripleOverride(_stateToday.Day, _boldedPressed, PaletteState.TodayOverride);
            _todayCheckedNormal = new PaletteTripleOverride(_stateToday.Day, _boldedCheckedNormal, PaletteState.TodayOverride);
            _todayCheckedTracking = new PaletteTripleOverride(_stateToday.Day, _boldedCheckedTracking, PaletteState.TodayOverride);
            _todayCheckedPressed = new PaletteTripleOverride(_stateToday.Day, _boldedCheckedPressed, PaletteState.TodayOverride);

            // Focus overrides added to bold overrides
            _overrideDisabled = new PaletteTripleOverride(_stateFocus.Day, _todayDisabled, PaletteState.FocusOverride);
            _overrideNormal = new PaletteTripleOverride(_stateFocus.Day, _todayNormal, PaletteState.FocusOverride);
            _overrideTracking = new PaletteTripleOverride(_stateFocus.Day, _todayTracking, PaletteState.FocusOverride);
            _overridePressed = new PaletteTripleOverride(_stateFocus.Day, _todayPressed, PaletteState.FocusOverride);
            _overrideCheckedNormal = new PaletteTripleOverride(_stateFocus.Day, _todayCheckedNormal, PaletteState.FocusOverride);
            _overrideCheckedTracking = new PaletteTripleOverride(_stateFocus.Day, _todayCheckedTracking, PaletteState.FocusOverride);
            _overrideCheckedPressed = new PaletteTripleOverride(_stateFocus.Day, _todayCheckedPressed, PaletteState.FocusOverride);
        }
Example #13
0
        public KryptonTreeView()
        {
            // Contains another control and needs marking as such for validation to work
            SetStyle(ControlStyles.ContainerControl, true);

            // Cannot select this control, only the child tree view and does not generate a click event
            SetStyle(ControlStyles.Selectable | ControlStyles.StandardClick, false);

            // Default fields
            _alwaysActive = true;
            _style = ButtonStyle.ListItem;
            _itemHeightDefault = true;
            _plusMinusImages = new TreeViewImages();
            _checkBoxImages = new CheckBoxImages();
            base.Padding = new Padding(1);

            // Create the palette storage
            _redirectImages = new PaletteRedirectTreeView(Redirector, _plusMinusImages, _checkBoxImages);
            PaletteBackInheritRedirect backInherit = new PaletteBackInheritRedirect(Redirector, PaletteBackStyle.InputControlStandalone);
            PaletteBorderInheritRedirect borderInherit = new PaletteBorderInheritRedirect(Redirector, PaletteBorderStyle.InputControlStandalone);
            PaletteBackColor1 commonBack = new PaletteBackColor1(backInherit, NeedPaintDelegate);
            PaletteBorder commonBorder = new PaletteBorder(borderInherit, NeedPaintDelegate);
            _stateCommon = new PaletteTreeStateRedirect(Redirector, commonBack, backInherit, commonBorder, borderInherit, NeedPaintDelegate);

            PaletteBackColor1 disabledBack = new PaletteBackColor1(_stateCommon.PaletteBack, NeedPaintDelegate);
            PaletteBorder disabledBorder = new PaletteBorder(_stateCommon.PaletteBorder, NeedPaintDelegate);
            _stateDisabled = new PaletteTreeState(_stateCommon, disabledBack, disabledBorder, NeedPaintDelegate);

            PaletteBackColor1 normalBack = new PaletteBackColor1(_stateCommon.PaletteBack, NeedPaintDelegate);
            PaletteBorder normalBorder = new PaletteBorder(_stateCommon.PaletteBorder, NeedPaintDelegate);
            _stateNormal = new PaletteTreeState(_stateCommon, normalBack, normalBorder, NeedPaintDelegate);

            PaletteBackColor1 activeBack = new PaletteBackColor1(_stateCommon.PaletteBack, NeedPaintDelegate);
            PaletteBorder activeBorder = new PaletteBorder(_stateCommon.PaletteBorder, NeedPaintDelegate);
            _stateActive = new PaletteDouble(_stateCommon, activeBack, activeBorder, NeedPaintDelegate);

            _stateFocus = new PaletteTreeNodeTripleRedirect(Redirector, PaletteBackStyle.ButtonListItem, PaletteBorderStyle.ButtonListItem, PaletteContentStyle.ButtonListItem, NeedPaintDelegate);
            _stateTracking = new PaletteTreeNodeTriple(_stateCommon.Node, NeedPaintDelegate);
            _statePressed = new PaletteTreeNodeTriple(_stateCommon.Node, NeedPaintDelegate);
            _stateCheckedNormal = new PaletteTreeNodeTriple(_stateCommon.Node, NeedPaintDelegate);
            _stateCheckedTracking = new PaletteTreeNodeTriple(_stateCommon.Node, NeedPaintDelegate);
            _stateCheckedPressed = new PaletteTreeNodeTriple(_stateCommon.Node, NeedPaintDelegate);

            // Create the override handling classes
            _overrideNormal = new PaletteTripleOverride(_stateFocus.Node, _stateNormal.Node, PaletteState.FocusOverride);
            _overrideTracking = new PaletteTripleOverride(_stateFocus.Node, _stateTracking.Node, PaletteState.FocusOverride);
            _overridePressed = new PaletteTripleOverride(_stateFocus.Node, _statePressed.Node, PaletteState.FocusOverride);
            _overrideCheckedNormal = new PaletteTripleOverride(_stateFocus.Node, _stateCheckedNormal.Node, PaletteState.FocusOverride);
            _overrideCheckedTracking = new PaletteTripleOverride(_stateFocus.Node, _stateCheckedTracking.Node, PaletteState.FocusOverride);
            _overrideCheckedPressed = new PaletteTripleOverride(_stateFocus.Node, _stateCheckedPressed.Node, PaletteState.FocusOverride);
            _overrideNormalNode = new PaletteNodeOverride(_overrideNormal);

            // Create the check box image drawer and place inside element so it is always centered
            _drawCheckBox = new ViewDrawCheckBox(_redirectImages);
            _layoutCheckBox = new ViewLayoutCenter();
            _layoutCheckBox.Add(_drawCheckBox);

            // Stack used to layout the location of the node image
            _layoutImage = new ViewLayoutSeparator(0, 0);
            _layoutImageAfter = new ViewLayoutSeparator(3, 0);
            _layoutImageCenter = new ViewLayoutCenter(_layoutImage);
            _layoutImageStack = new ViewLayoutStack(true);
            _layoutImageStack.Add(_layoutImageCenter);
            _layoutImageStack.Add(_layoutImageAfter);
            _layoutImageState = new ViewLayoutSeparator(16, 16);
            _layoutImageCenterState = new ViewLayoutCenter(_layoutImageState);

            // Create the draw element for owner drawing individual items
            _contentValues = new FixedContentValue();
            _drawButton = new ViewDrawButton(StateDisabled.Node, _overrideNormalNode,
                                             _overrideTracking, _overridePressed,
                                             _overrideCheckedNormal, _overrideCheckedTracking,
                                             _overrideCheckedPressed,
                                             new PaletteMetricRedirect(Redirector),
                                             _contentValues, VisualOrientation.Top, false);

            // Place check box on the left and the label in the remainder
            _layoutDocker = new ViewLayoutDocker();
            _layoutDocker.Add(_layoutImageStack, ViewDockStyle.Left);
            _layoutDocker.Add(_layoutImageCenterState, ViewDockStyle.Left);
            _layoutDocker.Add(_layoutCheckBox, ViewDockStyle.Left);
            _layoutDocker.Add(_drawButton, ViewDockStyle.Fill);

            // Create the internal tree view used for containing content
            _treeView = new InternalTreeView(this);
            _treeView.TrackMouseEnter += new EventHandler(OnTreeViewMouseChange);
            _treeView.TrackMouseLeave += new EventHandler(OnTreeViewMouseChange);
            _treeView.GotFocus += new EventHandler(OnTreeViewGotFocus);
            _treeView.LostFocus += new EventHandler(OnTreeViewLostFocus);
            _treeView.KeyDown += new KeyEventHandler(OnTreeViewKeyDown);
            _treeView.KeyUp += new KeyEventHandler(OnTreeViewKeyUp);
            _treeView.KeyPress += new KeyPressEventHandler(OnTreeViewKeyPress);
            _treeView.PreviewKeyDown += new PreviewKeyDownEventHandler(OnTreeViewPreviewKeyDown);
            _treeView.Validating += new CancelEventHandler(OnTreeViewValidating);
            _treeView.Validated += new EventHandler(OnTreeViewValidated);
            _treeView.AfterCheck += new TreeViewEventHandler(OnTreeViewAfterCheck);
            _treeView.AfterCollapse += new TreeViewEventHandler(OnTreeViewAfterCollapse);
            _treeView.AfterExpand += new TreeViewEventHandler(OnTreeViewAfterExpand);
            _treeView.AfterLabelEdit += new NodeLabelEditEventHandler(OnTreeViewAfterLabelEdit);
            _treeView.AfterSelect += new TreeViewEventHandler(OnTreeViewAfterSelect);
            _treeView.BeforeCheck += new TreeViewCancelEventHandler(OnTreeViewBeforeCheck);
            _treeView.BeforeCollapse += new TreeViewCancelEventHandler(OnTreeViewBeforeCollapse);
            _treeView.BeforeExpand += new TreeViewCancelEventHandler(OnTreeViewBeforeExpand);
            _treeView.BeforeLabelEdit += new NodeLabelEditEventHandler(OnTreeViewBeforeLabelEdit);
            _treeView.BeforeSelect += new TreeViewCancelEventHandler(OnTreeViewBeforeSelect);
            _treeView.ItemDrag += new ItemDragEventHandler(OnTreeViewItemDrag);
            _treeView.NodeMouseClick += new TreeNodeMouseClickEventHandler(OnTreeViewNodeMouseClick);
            _treeView.NodeMouseDoubleClick += new TreeNodeMouseClickEventHandler(OnTreeViewNodeMouseDoubleClick);
            _treeView.NodeMouseHover += new TreeNodeMouseHoverEventHandler(OnTreeViewNodeMouseHover);
            _treeView.DrawNode += new DrawTreeNodeEventHandler(OnTreeViewDrawNode);
            _treeView.DrawMode = TreeViewDrawMode.OwnerDrawAll;

            // Create the element that fills the remainder space and remembers fill rectange
            _layoutFill = new ViewLayoutFill(_treeView);
            _layoutFill.DisplayPadding = new Padding(1);

            // Create inner view for placing inside the drawing docker
            _drawDockerInner = new ViewLayoutDocker();
            _drawDockerInner.Add(_layoutFill, ViewDockStyle.Fill);

            // Create view for the control border and background
            _drawDockerOuter = new ViewDrawDocker(_stateNormal.Back, _stateNormal.Border);
            _drawDockerOuter.Add(_drawDockerInner, ViewDockStyle.Fill);

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

            // We need to create and cache a device context compatible with the display
            _screenDC = PI.CreateCompatibleDC(IntPtr.Zero);

            // Add tree view to the controls collection
            ((KryptonReadOnlyControls)Controls).AddInternal(_treeView);
        }
        /// <summary>
        /// Initialize a new instance of the KryptonMonthCalendar class.
        /// </summary>
        public KryptonMonthCalendar()
        {
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);

            // Create the palette storage
            _stateCommon = new PaletteMonthCalendarRedirect(Redirector, NeedPaintDelegate);
            _stateFocus = new PaletteMonthCalendarStateRedirect(Redirector, NeedPaintDelegate);
            _stateBolded = new PaletteMonthCalendarStateRedirect(Redirector, NeedPaintDelegate);
            _stateToday = new PaletteMonthCalendarStateRedirect(Redirector, NeedPaintDelegate);

            // Basic state storage
            _stateDisabled = new PaletteMonthCalendarDoubleState(_stateCommon, NeedPaintDelegate);
            _stateNormal = new PaletteMonthCalendarDoubleState(_stateCommon, NeedPaintDelegate);
            _stateTracking = new PaletteMonthCalendarState(_stateCommon, NeedPaintDelegate);
            _statePressed = new PaletteMonthCalendarState(_stateCommon, NeedPaintDelegate);
            _stateCheckedNormal = new PaletteMonthCalendarState(_stateCommon, NeedPaintDelegate);
            _stateCheckedTracking = new PaletteMonthCalendarState(_stateCommon, NeedPaintDelegate);
            _stateCheckedPressed = new PaletteMonthCalendarState(_stateCommon, NeedPaintDelegate);

            // Bold overrides
            _boldedDisabled = new PaletteTripleOverride(_stateBolded.Day, _stateDisabled.Day, PaletteState.BoldedOverride);
            _boldedNormal = new PaletteTripleOverride(_stateBolded.Day, _stateNormal.Day, PaletteState.BoldedOverride);
            _boldedTracking = new PaletteTripleOverride(_stateBolded.Day, _stateTracking.Day, PaletteState.BoldedOverride);
            _boldedPressed = new PaletteTripleOverride(_stateBolded.Day, _statePressed.Day, PaletteState.BoldedOverride);
            _boldedCheckedNormal = new PaletteTripleOverride(_stateBolded.Day, _stateCheckedNormal.Day, PaletteState.BoldedOverride);
            _boldedCheckedTracking = new PaletteTripleOverride(_stateBolded.Day, _stateCheckedTracking.Day, PaletteState.BoldedOverride);
            _boldedCheckedPressed = new PaletteTripleOverride(_stateBolded.Day, _stateCheckedPressed.Day, PaletteState.BoldedOverride);

            // Today overrides
            _todayDisabled = new PaletteTripleOverride(_stateToday.Day, _boldedDisabled, PaletteState.TodayOverride);
            _todayNormal = new PaletteTripleOverride(_stateToday.Day, _boldedNormal, PaletteState.TodayOverride);
            _todayTracking = new PaletteTripleOverride(_stateToday.Day, _boldedTracking, PaletteState.TodayOverride);
            _todayPressed = new PaletteTripleOverride(_stateToday.Day, _boldedPressed, PaletteState.TodayOverride);
            _todayCheckedNormal = new PaletteTripleOverride(_stateToday.Day, _boldedCheckedNormal, PaletteState.TodayOverride);
            _todayCheckedTracking = new PaletteTripleOverride(_stateToday.Day, _boldedCheckedTracking, PaletteState.TodayOverride);
            _todayCheckedPressed = new PaletteTripleOverride(_stateToday.Day, _boldedCheckedPressed, PaletteState.TodayOverride);

            // Focus overrides added to bold overrides
            _overrideDisabled = new PaletteTripleOverride(_stateFocus.Day, _todayDisabled, PaletteState.FocusOverride);
            _overrideNormal = new PaletteTripleOverride(_stateFocus.Day, _todayNormal, PaletteState.FocusOverride);
            _overrideTracking = new PaletteTripleOverride(_stateFocus.Day, _todayTracking, PaletteState.FocusOverride);
            _overridePressed = new PaletteTripleOverride(_stateFocus.Day, _todayPressed, PaletteState.FocusOverride);
            _overrideCheckedNormal = new PaletteTripleOverride(_stateFocus.Day, _todayCheckedNormal, PaletteState.FocusOverride);
            _overrideCheckedTracking = new PaletteTripleOverride(_stateFocus.Day, _todayCheckedTracking, PaletteState.FocusOverride);
            _overrideCheckedPressed = new PaletteTripleOverride(_stateFocus.Day, _todayCheckedPressed, PaletteState.FocusOverride);

            // Create view that is used by standalone control as well as this context menu element
            _drawMonths = new ViewLayoutMonths(null, null, null, this, Redirector, NeedPaintDelegate);

            // Place the months layout view inside a standard docker which provides the control border
            _drawDocker = new ViewDrawDocker(_stateNormal.Back, _stateNormal.Border, null);
            _drawDocker.Add(_drawMonths, ViewDockStyle.Fill);

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

            // Set default property values
            _dimensions = new Size(1, 1);
            _firstDayOfWeek = Day.Default;
            _headerStyle = HeaderStyle.Calendar;
            _dayStyle = ButtonStyle.CalendarDay;
            _dayOfWeekStyle = ButtonStyle.CalendarDay;
            _selectionStart = DateTime.Now.Date;
            _selectionEnd = _selectionStart;
            _todayDate = _selectionStart;
            _minDate = DateTimePicker.MinimumDateTime;
            _maxDate = DateTimePicker.MaximumDateTime;
            _maxSelectionCount = 7;
            _annualDays = new int[12];
            _annualDates = new DateTimeList();
            _monthlyDates = new DateTimeList();
            _dates = new DateTimeList();
            _scrollChange = 0;
            _todayFormat = "d";
        }