Пример #1
0
        /// <summary>
        /// Initialize a new instance of the PaletteListItemTriple class.
        /// </summary>
        /// <param name="inherit">Source for inheriting values.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public PaletteListItemTriple(PaletteTripleRedirect inherit,
                                     NeedPaintHandler needPaint)
        {
            Debug.Assert(inherit != null);

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

            // Create storage that maps onto the inherit instances
            _paletteItem = new PaletteTriple(inherit, needPaint);
        }
Пример #2
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 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 PaletteListStateRedirect class.
        /// </summary>
        /// <param name="redirect">Inheritence redirection instance.</param>
        /// <param name="backStyle">Initial background style.</param>
        /// <param name="borderStyle">Initial border style.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public PaletteListStateRedirect(PaletteRedirect redirect,
                                        PaletteBackStyle backStyle,
                                        PaletteBorderStyle borderStyle,
                                        NeedPaintHandler needPaint)
            : base(redirect, backStyle, borderStyle, needPaint)
        {
            Debug.Assert(redirect != null);

            // Remember the redirect reference
            _redirect = redirect;

            // Create the item redirector
            _itemRedirect = new PaletteTripleRedirect(redirect,
                                                      PaletteBackStyle.ButtonListItem,
                                                      PaletteBorderStyle.ButtonListItem,
                                                      PaletteContentStyle.ButtonListItem);
        }
Пример #5
0
        /// <summary>
        /// Initialize a new instance of the KryptonContextMenuHeading class.
        /// </summary>
        /// <param name="initialText">Initial text for display.</param>
        public KryptonContextMenuHeading(string initialText)
        {
            // Default fields
            _text                  = initialText;
            _extraText             = string.Empty;
            _image                 = null;
            _imageTransparentColor = Color.Empty;

            // Create the redirector that can get values from the krypton context menu
            _redirectHeading = new PaletteRedirectTriple();

            // Create the header storage for overriding specific values
            _stateNormal = new PaletteTripleRedirect(_redirectHeading,
                                                     PaletteBackStyle.ContextMenuHeading,
                                                     PaletteBorderStyle.ContextMenuHeading,
                                                     PaletteContentStyle.ContextMenuHeading);
        }
Пример #6
0
 /// <summary>
 /// Initialize a new instance of the KryptonPaletteButtonBase class.
 /// </summary>
 /// <param name="redirect">Redirector to inherit values from.</param>
 /// <param name="backStyle">Background style.</param>
 /// <param name="borderStyle">Border style.</param>
 /// <param name="contentStyle">Content style.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public KryptonPaletteCheckButton(PaletteRedirect redirect,
                                  PaletteBackStyle backStyle,
                                  PaletteBorderStyle borderStyle,
                                  PaletteContentStyle contentStyle,
                                  NeedPaintHandler needPaint)
 {
     // Create the storage objects
     _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);
 }
Пример #7
0
        /// <summary>
        /// Initialize a new instance of the PaletteContextMenuRedirect class.
        /// </summary>
        /// <param name="redirect">Inheritence redirection.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public PaletteContextMenuRedirect(PaletteRedirect redirect,
                                          NeedPaintHandler needPaint)
        {
            Debug.Assert(redirect != null);

            // Create the palette storage
            _paletteControlInner              = new PaletteDoubleRedirect(redirect, PaletteBackStyle.ContextMenuInner, PaletteBorderStyle.ContextMenuInner, needPaint);
            _paletteControlOuter              = new PaletteDoubleRedirect(redirect, PaletteBackStyle.ContextMenuOuter, PaletteBorderStyle.ContextMenuOuter, needPaint);
            _paletteHeading                   = new PaletteTripleRedirect(redirect, PaletteBackStyle.ContextMenuHeading, PaletteBorderStyle.ContextMenuHeading, PaletteContentStyle.ContextMenuHeading, needPaint);
            _paletteItemHighlight             = new PaletteDoubleMetricRedirect(redirect, PaletteBackStyle.ContextMenuItemHighlight, PaletteBorderStyle.ContextMenuItemHighlight, needPaint);
            _paletteItemImage                 = new PaletteTripleJustImageRedirect(redirect, PaletteBackStyle.ContextMenuItemImage, PaletteBorderStyle.ContextMenuItemImage, PaletteContentStyle.ContextMenuItemImage, needPaint);
            _paletteItemImageColumn           = new PaletteDoubleRedirect(redirect, PaletteBackStyle.ContextMenuItemImageColumn, PaletteBorderStyle.ContextMenuItemImageColumn, needPaint);
            _paletteItemShortcutTextRedirect  = new PaletteContentInheritRedirect(redirect, PaletteContentStyle.ContextMenuItemShortcutText);
            _paletteItemShortcutText          = new PaletteContentJustShortText(_paletteItemShortcutTextRedirect, needPaint);
            _paletteItemSplit                 = new PaletteDoubleRedirect(redirect, PaletteBackStyle.ContextMenuItemSplit, PaletteBorderStyle.ContextMenuItemSplit, needPaint);
            _paletteItemTextAlternateRedirect = new PaletteContentInheritRedirect(redirect, PaletteContentStyle.ContextMenuItemTextAlternate);
            _paletteItemTextAlternate         = new PaletteContentJustText(_paletteItemTextAlternateRedirect, needPaint);
            _paletteItemTextStandardRedirect  = new PaletteContentInheritRedirect(redirect, PaletteContentStyle.ContextMenuItemTextStandard);
            _paletteItemTextStandard          = new PaletteContentJustText(_paletteItemTextStandardRedirect, needPaint);
            _paletteSeparator                 = new PaletteDoubleRedirect(redirect, PaletteBackStyle.ContextMenuSeparator, PaletteBorderStyle.ContextMenuSeparator, needPaint);
        }
Пример #8
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawMenuHeading class.
        /// </summary>
        /// <param name="heading">Reference to owning heading entry.</param>
        /// <param name="palette">Reference to palette source.</param>
        public ViewDrawMenuHeading(KryptonContextMenuHeading heading,
                                   PaletteTripleRedirect palette)
        {
            // Create fixed storage of the content values
            _contentValues = new FixedContentValue(heading.Text,
                                                   heading.ExtraText,
                                                   heading.Image,
                                                   heading.ImageTransparentColor);

            // Give the heading object the redirector to use when inheriting values
            heading.SetPaletteRedirect(palette);

            // Create the content for the actual heading text/image
            _drawContent = new ViewDrawContent(heading.StateNormal.Content, _contentValues, VisualOrientation.Top);

            // Use the docker to provide the background and border
            _drawDocker = new ViewDrawDocker(heading.StateNormal.Back, heading.StateNormal.Border);
            _drawDocker.Add(_drawContent, ViewDockStyle.Fill);

            // Add docker as the composite content
            Add(_drawDocker);
        }
Пример #9
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);
        }
Пример #10
0
        /// <summary>
        /// Initialize a new instance of the ButtonSpecView class.
        /// </summary>
        /// <param name="redirector">Palette redirector.</param>
        /// <param name="paletteMetric">Source for metric values.</param>
        /// <param name="metricPadding">Padding metric for border padding.</param>
        /// <param name="manager">Reference to owning manager.</param>
        /// <param name="buttonSpec">Access</param>
        public ButtonSpecView(PaletteRedirect redirector,
                              IPaletteMetric paletteMetric,
                              PaletteMetricPadding metricPadding,
                              ButtonSpecManagerBase manager,
                              ButtonSpec buttonSpec)
        {
            Debug.Assert(redirector != null);
            Debug.Assert(manager != null);
            Debug.Assert(buttonSpec != null);

            // Remember references
            _redirector     = redirector;
            _manager        = manager;
            _buttonSpec     = buttonSpec;
            _finishDelegate = new EventHandler(OnFinishDelegate);

            // Create delegate for paint notifications
            NeedPaintHandler needPaint = new NeedPaintHandler(OnNeedPaint);

            // Intercept calls from the button for color remapping and instead use
            // the button spec defined map and the container foreground color
            _remapPalette = _manager.CreateButtonSpecRemap(redirector, buttonSpec);

            // Use a redirector to get button values directly from palette
            _palette = new PaletteTripleRedirect(_remapPalette,
                                                 PaletteBackStyle.ButtonButtonSpec,
                                                 PaletteBorderStyle.ButtonButtonSpec,
                                                 PaletteContentStyle.ButtonButtonSpec,
                                                 needPaint);


            // Create the view for displaying a button
            _viewButton = new ViewDrawButton(_palette, _palette, _palette, _palette,
                                             paletteMetric, this, VisualOrientation.Top, false);

            // Associate the view with the source component (for design time support)
            if (buttonSpec.AllowComponent)
            {
                _viewButton.Component = buttonSpec;
            }

            // Use a view center to place button in centre of given space
            _viewCenter = new ViewLayoutCenter(paletteMetric, metricPadding, VisualOrientation.Top);
            _viewCenter.Add(_viewButton);

            // Create a controller for managing button behavior
            ButtonSpecViewControllers controllers = CreateController(_viewButton, needPaint, new MouseEventHandler(OnClick));

            _viewButton.MouseController  = controllers.MouseController;
            _viewButton.SourceController = controllers.SourceController;
            _viewButton.KeyController    = controllers.KeyController;

            // We need notifying whenever a button specification property changes
            _buttonSpec.ButtonSpecPropertyChanged += new PropertyChangedEventHandler(OnPropertyChanged);

            // Associate the button spec with the view that is drawing it
            _buttonSpec.SetView(_viewButton);

            // Finally update view with current button spec settings
            UpdateButtonStyle();
            UpdateVisible();
            UpdateEnabled();
            UpdateChecked();
        }
Пример #11
0
        /// <summary>
        /// Initialize a new instance of the ViewLayoutMonths class.
        /// </summary>
        /// <param name="provider">Provider of context menu information.</param>
        /// <param name="monthCalendar">Reference to owning month calendar entry.</param>
        /// <param name="viewManager">Owning view manager instance.</param>
        /// <param name="calendar">Reference to calendar provider.</param>
        /// <param name="redirector">Redirector for getting values.</param>
        /// <param name="needPaintDelegate">Delegate for requesting paint changes.</param>
        public ViewLayoutMonths(IContextMenuProvider provider,
                                KryptonContextMenuMonthCalendar monthCalendar,
                                ViewContextMenuManager viewManager,
                                IKryptonMonthCalendar calendar,
                                PaletteRedirect redirector,
                                NeedPaintHandler needPaintDelegate)
        {
            _provider                = provider;
            _calendar                = calendar;
            _oldSelectionStart       = _calendar.SelectionStart;
            _oldSelectionEnd         = _calendar.SelectionEnd;
            _displayMonth            = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            _redirector              = redirector;
            _needPaintDelegate       = needPaintDelegate;
            _showToday               = true;
            _showTodayCircle         = true;
            _closeOnTodayClick       = false;
            _firstTimeSync           = true;
            _allowButtonSpecToolTips = false;

            // Use a controller that can work against all the displayed months
            MonthCalendarController controller = new MonthCalendarController(monthCalendar, viewManager, this, _needPaintDelegate);

            MouseController  = controller;
            SourceController = controller;
            KeyController    = controller;

            _borderForced = new PaletteBorderInheritForced(_calendar.StateNormal.Header.Border);
            _borderForced.ForceBorderEdges(PaletteDrawBorders.None);
            _drawHeader   = new ViewDrawDocker(_calendar.StateNormal.Header.Back, _borderForced, null);
            _emptyContent = new ViewDrawEmptyContent(_calendar.StateDisabled.Header.Content, _calendar.StateNormal.Header.Content);
            _drawHeader.Add(_emptyContent, ViewDockStyle.Fill);
            Add(_drawHeader);

            // Using a button spec manager to add the buttons to the header
            _buttonSpecs   = new MonthCalendarButtonSpecCollection(this);
            _buttonManager = new ButtonSpecManagerDraw(_calendar.CalendarControl, redirector, _buttonSpecs, null,
                                                       new ViewDrawDocker[] { _drawHeader },
                                                       new IPaletteMetric[] { _calendar.StateCommon },
                                                       new PaletteMetricInt[] { PaletteMetricInt.HeaderButtonEdgeInsetCalendar },
                                                       new PaletteMetricPadding[] { PaletteMetricPadding.None },
                                                       _calendar.GetToolStripDelegate, _needPaintDelegate);

            // Create the manager for handling tooltips
            _toolTipManager                = new ToolTipManager();
            _toolTipManager.ShowToolTip   += new EventHandler <ToolTipEventArgs>(OnShowToolTip);
            _toolTipManager.CancelToolTip += new EventHandler(OnCancelToolTip);
            _buttonManager.ToolTipManager  = _toolTipManager;

            // Create the bottom header used for showing 'today' and defined button specs
            _remapPalette            = (ButtonSpecRemapByContentView)_buttonManager.CreateButtonSpecRemap(redirector, new ButtonSpecAny());
            _remapPalette.Foreground = _emptyContent;

            // Use a redirector to get button values directly from palette
            _palette = new PaletteTripleRedirect(_remapPalette,
                                                 PaletteBackStyle.ButtonButtonSpec,
                                                 PaletteBorderStyle.ButtonButtonSpec,
                                                 PaletteContentStyle.ButtonButtonSpec,
                                                 _needPaintDelegate);

            _drawToday        = new ViewDrawToday(_calendar, _palette, _palette, _palette, _palette, _needPaintDelegate);
            _drawToday.Click += new EventHandler(OnTodayClick);
            _drawHeader.Add(_drawToday, ViewDockStyle.Left);
        }
Пример #12
0
 internal void SetPaletteRedirect(PaletteTripleRedirect redirector)
 {
     _redirectHeading.SetRedirectStates(redirector, redirector);
 }
Пример #13
0
 /// <summary>
 /// Sets the inheritence parent.
 /// </summary>
 public virtual void SetInherit(PaletteTripleRedirect inherit)
 {
     _paletteItem.SetInherit(inherit);
 }