/// <summary>
 /// Initialize a new instance of the PaletteRedirectTriple class.
 /// </summary>
 /// <param name="target">Initial palette target for redirection.</param>
 /// <param name="disabled">Redirection for disabled state requests.</param>
 /// <param name="normal">Redirection for normal state requests.</param>
 /// <param name="tracking">Redirection for tracking state requests.</param>
 public PaletteRedirectTriple(IPalette target,
                              IPaletteTriple disabled,
                              IPaletteTriple normal,
                              IPaletteTriple tracking)
     : this(target, disabled, normal, null, tracking, null, null, null, null, null)
 {
 }
 /// <summary>
 /// Initialize a new instance of the PaletteRedirectTripleMetric class.
 /// </summary>
 /// <param name="target">Initial palette target for redirection.</param>
 /// <param name="disabled">Redirection for disabled state requests.</param>
 /// <param name="disableMetric">Redirection for disabled metric requests.</param>
 /// <param name="normal">Redirection for normal state requests.</param>
 /// <param name="normalMetric">Redirection for normal metric requests.</param>
 public PaletteRedirectTripleMetric(IPalette target,
                                    IPaletteTriple disabled, IPaletteMetric disableMetric,
                                    IPaletteTriple normal, IPaletteMetric normalMetric)
     : base(target, disabled, normal)
 {
     // Remember state specific inheritance
     _disabled = disableMetric;
     _normal = normalMetric;
 }
        /// <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 PaletteComboBoxJustComboStates class.
        /// </summary>
        /// <param name="inheritComboBox">Source for inheriting combo box values.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public PaletteComboBoxJustComboStates(IPaletteTriple inheritComboBox,
                                              NeedPaintHandler needPaint)
        {
            Debug.Assert(inheritComboBox != null);

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

            // Create storage that maps onto the inherit instances
            _comboBoxState = new PaletteInputControlTripleStates(inheritComboBox, needPaint);
        }
        /// <summary>
        /// Initialize a new instance of the PaletteRedirectCommon class.
        /// </summary>
        /// <param name="target">Initial palette target for redirection.</param>
        /// <param name="disabled">Redirection for disabled state requests.</param>
        /// <param name="others">Redirection for all other state requests.</param>
        public PaletteRedirectCommon(IPalette target,
                                     IPaletteTriple disabled,
                                     IPaletteTriple others)
            : base(target)
        {
            Debug.Assert(disabled != null);
            Debug.Assert(others != null);

            // Remember state specific inheritance
            _disabled = disabled;
            _others = others;
        }
示例#6
0
        /// <summary>
        /// Initialize a new instance of the PaletteNodeOverride class.
        /// </summary>
        /// <param name="triple">Palette to use.</param>
        public PaletteNodeOverride(IPaletteTriple triple)
        {
            Debug.Assert(triple != null);

            // Validate incoming references
            if (triple == null) throw new ArgumentNullException("triple");

            // Create the triple override instances
            _overrideBack = new PaletteBackInheritNode(triple.PaletteBack);
            _overrideBorder = new PaletteBorderInheritOverride(triple.PaletteBorder, triple.PaletteBorder);
            _overrideContent = new PaletteContentInheritNode(triple.PaletteContent);
        }
示例#7
0
 /// <summary>
 /// Initialize a new instance of the ViewDrawButton class.
 /// </summary>
 /// <param name="paletteDisabled">Palette source for the disabled state.</param>
 /// <param name="paletteNormal">Palette source for the normal state.</param>
 /// <param name="paletteTracking">Palette source for the tracking state.</param>
 /// <param name="palettePressed">Palette source for the pressed state.</param>
 /// <param name="paletteMetric">Palette source for metric values.</param>
 /// <param name="buttonValues">Source for content values.</param>
 /// <param name="orientation">Visual orientation of the content.</param>
 /// <param name="useMnemonic">Use mnemonics.</param>
 public ViewDrawButton(IPaletteTriple paletteDisabled,
                       IPaletteTriple paletteNormal,
                       IPaletteTriple paletteTracking,
                       IPaletteTriple palettePressed,
                       IPaletteMetric paletteMetric,
                       IContentValues buttonValues,
                       VisualOrientation orientation,
                       bool useMnemonic)
     : this(paletteDisabled, paletteNormal, paletteTracking, palettePressed,
            paletteNormal, paletteTracking, palettePressed, paletteMetric,
            buttonValues, orientation, useMnemonic)
 {
 }
        /// <summary>
        /// Initialize a new instance of the PaletteDataGridViewTripleStates class.
        /// </summary>
        /// <param name="inherit">Source for inheriting values.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public PaletteDataGridViewTripleStates(IPaletteTriple inherit,
                                               NeedPaintHandler needPaint)
        {
            Debug.Assert(inherit != null);

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

            // Create storage that maps onto the inherit instances
            _back = new PaletteBack(inherit.PaletteBack, needPaint);
            _border = new PaletteBorder(inherit.PaletteBorder, needPaint);
            _content = new PaletteDataGridViewContentStates(inherit.PaletteContent, needPaint);
        }
 /// <summary>
 /// Initialize a new instance of the ViewDrawNavCheckButtonBar 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 ViewDrawNavCheckButtonBar(KryptonNavigator navigator,
                                  KryptonPage page,
                                  VisualOrientation orientation,
                                  IPaletteTriple stateDisabled,
                                  IPaletteTriple stateNormal,
                                  IPaletteTriple stateTracking,
                                  IPaletteTriple statePressed,
                                  IPaletteTriple stateSelected,
                                  IPaletteTriple stateFocused)
     : base(navigator, page, orientation, stateDisabled, 
            stateNormal, stateTracking, statePressed, 
            stateSelected, stateFocused)
 {
 }
        /// <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;
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawMonthUpDown class.
        /// </summary>
        /// <param name="paletteState">Palette source for states.</param>
        /// <param name="paletteMetric">Palette source for metric values.</param>
        /// <param name="buttonValues">Source for content values.</param>
        /// <param name="glyph">Glyph to be drawn.</param>
        /// <param name="needPaintHandler">Delegate for requests repainting.</param>
        public ViewDrawMonthUpDown(IPaletteTriple paletteState,
                                   IPaletteMetric paletteMetric,
                                   IContentValues buttonValues,
                                   DrawMonthCalendarGlyph glyph,
                                   NeedPaintHandler needPaintHandler)
            : base(paletteState, paletteState, paletteState, paletteState, 
                   paletteMetric, buttonValues, VisualOrientation.Top, false)
        {
            _glyph = glyph;

            // Assign a controller to handle visual interaction
            _controller = new ButtonController(this, needPaintHandler);
            _controller.Click += new MouseEventHandler(OnButtonClick);
            _controller.MouseSelect += new MouseEventHandler(OnButtonMouseSelect);
            _controller.Repeat = true;
            _controller.ClickOnDown = true;
            MouseController = _controller;
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawButton class.
        /// </summary>
        /// <param name="gallery">Owning gallery instance.</param>
        /// <param name="palette">Palette used to recover values.</param>
        /// <param name="layout">Reference to item layout.</param>
        /// <param name="needPaint">Delegate for requesting paints.</param>
        public ViewDrawRibbonGalleryItem(KryptonGallery gallery,
                                         IPaletteTriple palette,
                                         ViewLayoutRibbonGalleryItems layout,
                                         NeedPaintHandler needPaint)
            : base(palette, palette, palette, palette, 
                   null, null, VisualOrientation.Top, false)
        {
            _gallery = gallery;

            // We provide the content for the button
            ButtonValues = this;

            // Need controller to handle tracking/pressing etc
            _controller = new GalleryItemController(this, layout, needPaint);
            _controller.Click += new MouseEventHandler(OnItemClick);
            MouseController = _controller;
            SourceController = _controller;
            KeyController = _controller;
        }
示例#13
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawToday class.
        /// </summary>
        /// <param name="calendar">Provider of month calendar values.</param>
        /// <param name="paletteDisabled">Palette source for the disabled state.</param>
        /// <param name="paletteNormal">Palette source for the normal state.</param>
        /// <param name="paletteTracking">Palette source for the tracking state.</param>
        /// <param name="palettePressed">Palette source for the pressed state.</param>
        /// <param name="needPaintHandler">Delegate for requested repainting.</param>
        public ViewDrawToday(IKryptonMonthCalendar calendar,
                             IPaletteTriple paletteDisabled,
                             IPaletteTriple paletteNormal,
                             IPaletteTriple paletteTracking,
                             IPaletteTriple palettePressed,
                             NeedPaintHandler needPaintHandler)
            : base(paletteDisabled, paletteNormal, paletteTracking, palettePressed,
                   paletteNormal, paletteTracking, palettePressed, null,
                   null, VisualOrientation.Top, false)
        {
            _calendar = calendar;

            // We provide the content values for display
            base.ButtonValues = this;

            // Define a controller so the button can be clicked
            ButtonController controller = new ButtonController(this, needPaintHandler);
            controller.Click += new MouseEventHandler(OnClick);
            MouseController = controller;
            SourceController = controller;
            KeyController = controller;
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawMenuImageSelectItem class.
        /// </summary>
        /// <param name="viewManager">Owning view manager instance.</param>
        /// <param name="imageSelect">Owning image select instance.</param>
        /// <param name="palette">Palette used to recover values.</param>
        /// <param name="layout">Reference to item layout.</param>
        /// <param name="needPaint">Delegate for requesting paints.</param>
        public ViewDrawMenuImageSelectItem(ViewContextMenuManager viewManager,
                                           KryptonContextMenuImageSelect imageSelect,
                                           IPaletteTriple palette,
                                           ViewLayoutMenuItemSelect layout,
                                           NeedPaintHandler needPaint)
            : base(palette, palette, palette, palette, 
                   null, null, VisualOrientation.Top, false)
        {
            _imageSelect = imageSelect;
            _layout = layout;
            _needPaint = needPaint;

            // We provide the content for the button
            ButtonValues = this;

            // Need controller to handle tracking/pressing etc
            _controller = new MenuImageSelectController(viewManager, this, layout, needPaint);
            _controller.Click += new MouseEventHandler(OnItemClick);
            MouseController = _controller;
            SourceController = _controller;
            KeyController = _controller;
        }
        /// <summary>
        /// Initialize a new instance of the ViewDrawButton class.
        /// </summary>
        /// <param name="dateTimePicker">Owning control.</param>
        /// <param name="paletteState">Palette source for states.</param>
        /// <param name="paletteMetric">Palette source for metric values.</param>
        /// <param name="buttonValues">Source for content values.</param>
        /// <param name="glyph">Glyph to be drawn.</param>
        /// <param name="needPaintHandler">Delegate for requests repainting.</param>
        /// <param name="repeat">Should button repeat.</param>
        public ViewDrawDateTimeButton(KryptonDateTimePicker dateTimePicker,
                                      IPaletteTriple paletteState,
                                      IPaletteMetric paletteMetric,
                                      IContentValues buttonValues,
                                      DrawDateTimeGlyph glyph,
                                      NeedPaintHandler needPaintHandler,
                                      bool repeat)
            : base(paletteState, paletteState, paletteState, paletteState, 
                   paletteMetric, buttonValues, VisualOrientation.Top, false)
        {
            _dateTimePicker = dateTimePicker;
            _glyph = glyph;

            // Assign a controller to handle visual interaction
            _controller = new ButtonController(this, needPaintHandler);
            _controller.BecomesFixed = !repeat;
            _controller.Click += new MouseEventHandler(OnButtonClick);
            _controller.MouseSelect += new MouseEventHandler(OnButtonMouseSelect);
            _controller.Repeat = repeat;
            _controller.ClickOnDown = true;
            MouseController = _controller;
        }
示例#16
0
        /// <summary>
        /// Initialize a new instance of the PaletteTripleOverride class.
        /// </summary>
        /// <param name="normalTriple">Normal palette to use.</param>
        /// <param name="overrideTriple">Override palette to use.</param>
        /// <param name="overrideState">State used by the override.</param>
        public PaletteTripleOverride(IPaletteTriple normalTriple,
                                     IPaletteTriple overrideTriple,
                                     PaletteState overrideState)
        {
            Debug.Assert(normalTriple != null);
            Debug.Assert(overrideTriple != null);

            // Validate incoming references
            if (normalTriple == null) throw new ArgumentNullException("normalTriple");
            if (overrideTriple == null) throw new ArgumentNullException("overrideTriple");

            // Create the triple override instances
            _overrideBack = new PaletteBackInheritOverride(normalTriple.PaletteBack, overrideTriple.PaletteBack);
            _overrideBorder = new PaletteBorderInheritOverride(normalTriple.PaletteBorder, overrideTriple.PaletteBorder);
            _overrideContent = new PaletteContentInheritOverride(normalTriple.PaletteContent, overrideTriple.PaletteContent);

            // Do not apply an override by default
            Apply = false;

            // Always override the state
            Override = true;
            OverrideState = overrideState;
        }
        /// <summary>
        /// Gets the effect applied to drawing of the image.
        /// </summary>
        /// <param name="style">Content style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>PaletteImageEffect value.</returns>
        public override PaletteImageEffect GetContentImageEffect(PaletteContentStyle style, PaletteState state)
        {
            IPaletteTriple inherit = GetInherit(state);

            return(inherit != null?inherit.PaletteContent.GetContentImageEffect(state) : base.GetContentImageEffect(style, state));
        }
示例#18
0
 /// <summary>
 /// Reset the redirection states to null.
 /// </summary>
 public virtual void ResetRedirectStates()
 {
     _disabled = null;
     _normal = null;
     _pressed = null;
     _tracking = null;
     _checkedNormal = null;
     _checkedPressed = null;
     _checkedTracking = null;
     _focusOverride = null;
     _normalDefaultOverride = null;
 }
示例#19
0
 /// <summary>
 /// Set the redirection states.
 /// </summary>
 /// <param name="disabled">Redirection for disabled state requests.</param>
 /// <param name="normal">Redirection for normal state requests.</param>
 /// <param name="pressed">Redirection for pressed state requests.</param>
 /// <param name="tracking">Redirection for tracking state requests.</param>
 /// <param name="checkedNormal">Redirection for checked normal state requests.</param>
 /// <param name="checkedPressed">Redirection for checked pressed state requests.</param>
 /// <param name="checkedTracking">Redirection for checked tracking state requests.</param>
 /// <param name="focusOverride">Redirection for focus override state requests.</param>
 /// <param name="normalDefaultOverride">Redirection for normal default override state requests.</param>
 public virtual void SetRedirectStates(IPaletteTriple disabled,
                                       IPaletteTriple normal,
                                       IPaletteTriple pressed,
                                       IPaletteTriple tracking,
                                       IPaletteTriple checkedNormal,
                                       IPaletteTriple checkedPressed,
                                       IPaletteTriple checkedTracking,
                                       IPaletteTriple focusOverride,
                                       IPaletteTriple normalDefaultOverride)
 {
     _disabled = disabled;
     _normal = normal;
     _pressed = pressed;
     _tracking = tracking;
     _checkedNormal = checkedNormal;
     _checkedPressed = checkedPressed;
     _checkedTracking = checkedTracking;
     _focusOverride = focusOverride;
     _normalDefaultOverride = normalDefaultOverride;
 }
 /// <summary>
 /// Sets the inheritance parent.
 /// </summary>
 /// <param name="inheritComboBox">Source for inheriting combo box values.</param>
 /// <param name="inheritItem">Source for inheriting item values.</param>
 public void SetInherit(IPaletteTriple inheritComboBox,
                        IPaletteTriple inheritItem)
 {
     ComboBox.SetInherit(inheritComboBox);
     Item.SetInherit(inheritItem);
 }
        /// <summary>
        /// Gets the padding between the border and content drawing.
        /// </summary>
        /// <param name="style">Content style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Padding value.</returns>
        public override Padding GetContentPadding(PaletteContentStyle style, PaletteState state)
        {
            IPaletteTriple inherit = GetInherit(state);

            return(inherit != null?inherit.PaletteContent.GetContentPadding(state) : base.GetContentPadding(style, state));
        }
        /// <summary>
        /// Gets a border image.
        /// </summary>
        /// <param name="style">Border style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Image instance.</returns>
        public override Image GetBorderImage(PaletteBorderStyle style, PaletteState state)
        {
            IPaletteTriple inherit = GetInherit(state);

            return(inherit != null?inherit.PaletteBorder.GetBorderImage(state) : base.GetBorderImage(style, state));
        }
        /// <summary>
        /// Gets a background image for the short text.
        /// </summary>
        /// <param name="style">Content style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Image instance.</returns>
        public override Image GetContentShortTextImage(PaletteContentStyle style, PaletteState state)
        {
            IPaletteTriple inherit = GetInherit(state);

            return(inherit != null?inherit.PaletteContent.GetContentShortTextImage(state) : base.GetContentShortTextImage(style, state));
        }
 /// <summary>
 /// Sets the inheritence parent.
 /// </summary>
 /// <param name="inheritComboBox">Source for inheriting combo box values.</param>
 public void SetInherit(IPaletteTriple inheritComboBox)
 {
     _comboBoxState.SetInherit(inheritComboBox);
 }
 /// <summary>
 /// Sets the inheritence parent.
 /// </summary>
 /// <param name="inheritComboBox">Source for inheriting combo box values.</param>
 public void SetInherit(IPaletteTriple inheritComboBox)
 {
     ComboBox.SetInherit(inheritComboBox);
 }
        /// <summary>
        /// Perform a layout of the elements.
        /// </summary>
        /// <param name="context">Layout context.</param>
        public override void Layout(ViewLayoutContext context)
        {
            Debug.Assert(context != null);

            // Get the current date values
            DateTime minDate     = _calendar.MinDate.Date;
            DateTime maxDate     = _calendar.MaxDate.Date;
            DateTime selectStart = _calendar.SelectionStart.Date;
            DateTime selectEnd   = _calendar.SelectionEnd.Date;

            // We take on all the available display area
            ClientRectangle = context.DisplayRectangle;

            int       layoutXCell    = ClientLocation.X;
            int       layoutXDay     = ClientLocation.X + ((_months.SizeDays.Width - _months.SizeDay.Width) / 2);
            Rectangle layoutRectCell = new Rectangle(layoutXCell, ClientLocation.Y, _months.SizeDays.Width, _months.SizeDays.Height);
            Rectangle layoutRectDay  = new Rectangle(layoutXDay, ClientLocation.Y, _months.SizeDay.Width, _months.SizeDays.Height);

            // Layout each week as a row
            DateTime todayDate   = _calendar.TodayDate;
            DateTime displayDate = _firstDay;

            for (int j = 0; j < WEEKS; j++)
            {
                // Layout each day as a column
                for (int i = 0; i < WEEKDAYS; i++)
                {
                    // Memento index
                    int index = (j * WEEKDAYS) + i;

                    // Define text to be drawn
                    _drawText = displayDate.Day.ToString();

                    if (_dayMementos[index] != null)
                    {
                        _dayMementos[index].Dispose();
                        _dayMementos[index] = null;
                    }

                    bool           skip          = false;
                    PaletteState   paletteState  = PaletteState.Normal;
                    IPaletteTriple paletteTriple = _calendar.OverrideNormal;

                    // If the display date is not within the allowed range, do not draw it
                    if ((displayDate < minDate) || (displayDate > maxDate))
                    {
                        skip = true;
                    }
                    else
                    {
                        _calendar.SetFocusOverride(false);
                        _calendar.SetBoldedOverride(BoldedDate(displayDate));
                        _calendar.SetTodayOverride(_months.ShowTodayCircle && (displayDate == todayDate));

                        // If the day is not actually in the month we are drawing
                        if (displayDate.Month != _month.Month)
                        {
                            // If we need to show this day but disabled
                            if (((j < 3) && _firstMonth) || ((j > 3) && _lastMonth))
                            {
                                paletteState  = PaletteState.Disabled;
                                paletteTriple = _calendar.OverrideDisabled;
                            }
                            else
                            {
                                skip = true;
                            }
                        }
                        else
                        {
                            // Is this day part of the selection?
                            if ((displayDate >= selectStart) && (displayDate <= selectEnd))
                            {
                                _calendar.SetFocusOverride(((_months.FocusDay != null) && (_months.FocusDay.Value == displayDate)));

                                if (_months.TrackingDay.HasValue && (_months.TrackingDay.Value == displayDate))
                                {
                                    paletteState  = PaletteState.CheckedTracking;
                                    paletteTriple = _calendar.OverrideCheckedTracking;
                                }
                                else
                                {
                                    paletteState  = PaletteState.CheckedNormal;
                                    paletteTriple = _calendar.OverrideCheckedNormal;
                                }
                            }
                            else
                            {
                                if (_months.TrackingDay.HasValue && (_months.TrackingDay.Value == displayDate))
                                {
                                    paletteState  = PaletteState.Tracking;
                                    paletteTriple = _calendar.OverrideTracking;
                                }
                            }
                        }
                    }

                    if (!skip)
                    {
                        _dayMementos[index] = context.Renderer.RenderStandardContent.LayoutContent(context, layoutRectDay, paletteTriple.PaletteContent,
                                                                                                   this, VisualOrientation.Top, paletteState, false);

                        // Track the maximum date displayed for this month (exclude disabled days that are shown for
                        // information but cannot actually be selected themselves as part of a multi selection action)
                        if (paletteState != PaletteState.Disabled)
                        {
                            _lastDay = displayDate;
                        }
                    }

                    _dayRects[index] = layoutRectCell;

                    // Move across to next column
                    layoutRectCell.X += _months.SizeDays.Width;
                    layoutRectDay.X  += _months.SizeDays.Width;

                    // Move to next day
                    displayDate += TIMESPAN_1DAY;
                }

                // Move to start of the next row
                layoutRectCell.X  = layoutXCell;
                layoutRectCell.Y += _months.SizeDays.Height;
                layoutRectDay.X   = layoutXDay;
                layoutRectDay.Y  += _months.SizeDays.Height;
            }

            // Put back the original display value now we have finished
            context.DisplayRectangle = ClientRectangle;
        }
        /// <summary>
        /// Perform rendering before child elements are rendered.
        /// </summary>
        /// <param name="context">Rendering context.</param>
        public override void RenderBefore(RenderContext context)
        {
            Debug.Assert(context != null);

            // Get the current date values
            DateTime minDate     = _calendar.MinDate.Date;
            DateTime maxDate     = _calendar.MaxDate.Date;
            DateTime selectStart = _calendar.SelectionStart.Date;
            DateTime selectEnd   = _calendar.SelectionEnd.Date;

            int       layoutXCell  = ClientLocation.X;
            int       layoutXDay   = ClientLocation.X + ((_months.SizeDays.Width - _months.SizeDay.Width) / 2);
            Rectangle drawRectCell = new Rectangle(layoutXCell, ClientLocation.Y, _months.SizeDays.Width, _months.SizeDays.Height);
            Rectangle drawRectDay  = new Rectangle(layoutXDay, ClientLocation.Y, _months.SizeDay.Width, _months.SizeDays.Height);

            // Draw each week as a row
            DateTime todayDate   = _calendar.TodayDate;
            DateTime displayDate = _firstDay;

            for (int j = 0; j < WEEKS; j++)
            {
                // Draw each day as a column
                for (int i = 0; i < WEEKDAYS; i++)
                {
                    // Memento index
                    int index = (j * WEEKDAYS) + i;

                    // Draw using memento cached from the layout call
                    if (_dayMementos[index] != null)
                    {
                        bool           skip          = false;
                        PaletteState   paletteState  = PaletteState.Normal;
                        IPaletteTriple paletteTriple = _calendar.OverrideNormal;

                        // If the display date is not within the allowed range, do not draw it
                        if ((displayDate < minDate) || (displayDate > maxDate))
                        {
                            skip = true;
                        }
                        else
                        {
                            _calendar.SetFocusOverride(false);
                            _calendar.SetBoldedOverride(BoldedDate(displayDate));
                            _calendar.SetTodayOverride(_months.ShowTodayCircle && (displayDate == todayDate));

                            // If the day is not actually in the month we are drawing
                            if (displayDate.Month != _month.Month)
                            {
                                // If we need to show this day but disabled
                                if (((j < 3) && _firstMonth) || ((j > 3) && _lastMonth))
                                {
                                    paletteState  = PaletteState.Disabled;
                                    paletteTriple = _calendar.OverrideDisabled;
                                }
                                else
                                {
                                    skip = true;
                                }
                            }
                            else
                            {
                                // Is this day part of the selection?
                                if ((displayDate >= selectStart) && (displayDate <= selectEnd))
                                {
                                    _calendar.SetFocusOverride(((_months.FocusDay != null) && (_months.FocusDay.Value == displayDate)));

                                    if (_months.TrackingDay.HasValue && (_months.TrackingDay.Value == displayDate))
                                    {
                                        paletteState  = PaletteState.CheckedTracking;
                                        paletteTriple = _calendar.OverrideCheckedTracking;
                                    }
                                    else
                                    {
                                        paletteState  = PaletteState.CheckedNormal;
                                        paletteTriple = _calendar.OverrideCheckedNormal;
                                    }
                                }
                                else
                                {
                                    if (_months.TrackingDay.HasValue && (_months.TrackingDay.Value == displayDate))
                                    {
                                        paletteState  = PaletteState.Tracking;
                                        paletteTriple = _calendar.OverrideTracking;
                                    }
                                }
                            }
                        }

                        if (!skip)
                        {
                            // Do we need to draw the background?
                            if (paletteTriple.PaletteBack.GetBackDraw(paletteState) == InheritBool.True)
                            {
                                using (GraphicsPath path = context.Renderer.RenderStandardBorder.GetBackPath(context, drawRectCell, paletteTriple.PaletteBorder,
                                                                                                             VisualOrientation.Top, paletteState))
                                {
                                    context.Renderer.RenderStandardBack.DrawBack(context, drawRectCell, path, paletteTriple.PaletteBack, VisualOrientation.Top, paletteState, null);
                                }
                            }

                            // Do we need to draw the border?
                            if (paletteTriple.PaletteBorder.GetBorderDraw(paletteState) == InheritBool.True)
                            {
                                context.Renderer.RenderStandardBorder.DrawBorder(context, drawRectCell, paletteTriple.PaletteBorder, VisualOrientation.Top, paletteState);
                            }

                            // Do we need to draw the content?
                            if (paletteTriple.PaletteContent.GetContentDraw(paletteState) == InheritBool.True)
                            {
                                context.Renderer.RenderStandardContent.DrawContent(context, drawRectDay, paletteTriple.PaletteContent, _dayMementos[index],
                                                                                   VisualOrientation.Top, paletteState, false, true);
                            }
                        }
                    }

                    // Move across to next column
                    drawRectCell.X += _months.SizeDays.Width;
                    drawRectDay.X  += _months.SizeDays.Width;

                    // Move to next day
                    displayDate += TIMESPAN_1DAY;
                }

                // Move to start of the next row
                drawRectCell.X  = layoutXCell;
                drawRectCell.Y += _months.SizeDays.Height;
                drawRectDay.X   = layoutXDay;
                drawRectDay.Y  += _months.SizeDays.Height;
            }
        }
示例#28
0
 /// <summary>
 /// Sets the inheritence parent.
 /// </summary>
 /// <param name="inheritComboBox">Source for inheriting combo box values.</param>
 /// <param name="inheritItem">Source for inheriting item values.</param>
 public void SetInherit(IPaletteTriple inheritComboBox,
                        IPaletteTriple inheritItem)
 {
     _comboBoxState.SetInherit(inheritComboBox);
     _itemState.SetInherit(inheritItem);
 }
 /// <summary>
 /// Sets the inheritence parent.
 /// </summary>
 /// <param name="inheritItem">Source for inheriting item values.</param>
 public void SetInherit(IPaletteTriple inheritItem)
 {
     _itemState.SetInherit(inheritItem);
 }
        /// <summary>
        /// Gets the horizontal relative alignment of multiline long text.
        /// </summary>
        /// <param name="style">Content style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>RelativeAlignment value.</returns>
        public override PaletteRelativeAlign GetContentLongTextMultiLineH(PaletteContentStyle style, PaletteState state)
        {
            IPaletteTriple inherit = GetInherit(state);

            return(inherit != null?inherit.PaletteContent.GetContentLongTextMultiLineH(state) : base.GetContentLongTextMultiLineH(style, state));
        }
        /// <summary>
        /// Gets a value indicating if content should be drawn with focus indication.
        /// </summary>
        /// <param name="style">Content style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>InheritBool value.</returns>
        public override InheritBool GetContentDrawFocus(PaletteContentStyle style, PaletteState state)
        {
            IPaletteTriple inherit = GetInherit(state);

            return(inherit != null?inherit.PaletteContent.GetContentDrawFocus(state) : base.GetContentDrawFocus(style, state));
        }
        /// <summary>
        /// Gets the padding between adjacent content items.
        /// </summary>
        /// <param name="style">Content style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Integer value.</returns>
        public override int GetContentAdjacentGap(PaletteContentStyle style, PaletteState state)
        {
            IPaletteTriple inherit = GetInherit(state);

            return(inherit != null?inherit.PaletteContent.GetContentAdjacentGap(state) : base.GetContentAdjacentGap(style, state));
        }
 /// <summary>
 /// Sets the inheritence parent.
 /// </summary>
 public void SetInherit(IPaletteTriple inherit)
 {
     _back.SetInherit(inherit.PaletteBack);
     _border.SetInherit(inherit.PaletteBorder);
     _content.SetInherit(inherit.PaletteContent);
 }
示例#34
0
        /// <summary>
        /// Check that the palette and state are correct.
        /// </summary>
        /// <param name="context">Reference to the view context.</param>
        protected virtual void CheckPaletteState(ViewContext context)
        {
            // Default to using this element calculated state
            PaletteState buttonState = State;

            // If the actual control is not enabled, force to disabled state
            if (!IsFixed && !context.Control.Enabled)
                buttonState = PaletteState.Disabled;

            // Apply the checked state if not fixed
            if (!IsFixed && Checked)
            {
                // Is the checked button allowed to become unchecked
                if (AllowUncheck)
                {
                    // Show feedback on tracking and presssed
                    switch (buttonState)
                    {
                        case PaletteState.Normal:
                            buttonState = PaletteState.CheckedNormal;
                            break;
                        case PaletteState.Tracking:
                            buttonState = PaletteState.CheckedTracking;
                            break;
                        case PaletteState.Pressed:
                            buttonState = PaletteState.CheckedPressed;
                            break;
                    }
                }
                else
                {
                    // Always use the normal state as user cannot uncheck the button
                    buttonState = PaletteState.CheckedNormal;
                }
            }

            // If the child elements are not in correct state
            if (_forcePaletteUpdate || (_drawCanvas.ElementState != buttonState))
            {
                // No longer need to force the palettes to be updated
                _forcePaletteUpdate = false;

                // Switch the child elements over to correct state
                _drawCanvas.ElementState = buttonState;
                _drawContent.ElementState = buttonState;
                _drawSplitBorder.ElementState = buttonState;
                _drawDropDownButton.ElementState = buttonState;

                // Push the correct palettes into them
                switch (buttonState)
                {
                    case PaletteState.Disabled:
                        _paletteCurrent = _paletteDisabled;
                        break;
                    case PaletteState.Normal:
                        _paletteCurrent = _paletteNormal;
                        break;
                    case PaletteState.CheckedNormal:
                        _paletteCurrent = _paletteCheckedNormal;
                        break;
                    case PaletteState.Pressed:
                        _paletteCurrent = _palettePressed;
                        break;
                    case PaletteState.CheckedPressed:
                        _paletteCurrent = _paletteCheckedPressed;
                        break;
                    case PaletteState.Tracking:
                        _paletteCurrent = _paletteTracking;
                        break;
                    case PaletteState.CheckedTracking:
                        _paletteCurrent = _paletteCheckedTracking;
                        break;
                    default:
                        // Should never happen!
                        Debug.Assert(false);
                        break;
                }

                // Update with the correct palettes
                _drawCanvas.SetPalettes(_paletteCurrent.PaletteBack, _paletteCurrent.PaletteBorder);
                _drawContent.SetPalette(_paletteCurrent.PaletteContent);
                _edgeRedirect.SetPalette(_paletteCurrent.PaletteBorder);
            }
        }
        /// <summary>
        /// Gets the image alignment for the long text.
        /// </summary>
        /// <param name="style">Content style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Image alignment style.</returns>
        public override PaletteRectangleAlign GetContentLongTextImageAlign(PaletteContentStyle style, PaletteState state)
        {
            IPaletteTriple inherit = GetInherit(state);

            return(inherit != null?inherit.PaletteContent.GetContentLongTextImageAlign(state) : base.GetContentLongTextImageAlign(style, state));
        }
示例#36
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawButton class.
        /// </summary>
        /// <param name="paletteDisabled">Palette source for the disabled state.</param>
        /// <param name="paletteNormal">Palette source for the normal state.</param>
        /// <param name="paletteTracking">Palette source for the tracking state.</param>
        /// <param name="palettePressed">Palette source for the pressed state.</param>
        /// <param name="paletteCheckedNormal">Palette source for the normal checked state.</param>
        /// <param name="paletteCheckedTracking">Palette source for the tracking checked state.</param>
        /// <param name="paletteCheckedPressed">Palette source for the pressed checked state.</param>
        /// <param name="paletteMetric">Palette source for metric values.</param>
        /// <param name="buttonValues">Source for content values.</param>
        /// <param name="orientation">Visual orientation of the content.</param>
        /// <param name="useMnemonic">Use mnemonics.</param>
        public ViewDrawButton(IPaletteTriple paletteDisabled,
							  IPaletteTriple paletteNormal,
							  IPaletteTriple paletteTracking,
							  IPaletteTriple palettePressed,
                              IPaletteTriple paletteCheckedNormal,
                              IPaletteTriple paletteCheckedTracking,
                              IPaletteTriple paletteCheckedPressed,
                              IPaletteMetric paletteMetric,
                              IContentValues buttonValues,
							  VisualOrientation orientation,
							  bool useMnemonic)
        {
            // Remember the source information
            _paletteDisabled = paletteDisabled;
            _paletteNormal = paletteNormal;
            _paletteTracking = paletteTracking;
            _palettePressed = palettePressed;
            _paletteCheckedNormal = paletteCheckedNormal;
            _paletteCheckedTracking = paletteCheckedTracking;
            _paletteCheckedPressed = paletteCheckedPressed;
            _paletteCurrent = _paletteNormal;

            // Default to not being checked
            _checked = false;
            _allowUncheck = true;
            _dropDown = false;
            _splitter = false;
            _dropDownPosition = VisualOrientation.Right;

            // Create the drop down view
            _drawDropDown = new ViewLayoutCenter(1);
            _drawDropDownButton = new ViewDrawDropDownButton();
            _drawDropDown.Add(_drawDropDownButton);
            _drawOuterSeparator = new ViewLayoutSeparator(1);

            // Create the view used to draw the split edge
            _edgeRedirect = new PaletteBorderEdgeRedirect(_paletteNormal.PaletteBorder, null);
            _drawSplitBorder = new ViewDrawBorderEdge(new PaletteBorderEdge(_edgeRedirect, null), CommonHelper.VisualToOrientation(orientation));

            // Our view contains background and border with content inside
            _drawContent = new ViewDrawContent(_paletteNormal.PaletteContent, buttonValues, orientation);
            _drawCanvas = new ViewDrawSplitCanvas(_paletteNormal.PaletteBack, _paletteNormal.PaletteBorder, paletteMetric, PaletteMetricPadding.None, orientation);

            // Use a docker layout to organize the contents of the canvas
            _layoutDocker = new ViewLayoutDocker();
            _layoutDocker.Add(_drawContent, ViewDockStyle.Fill);
            _layoutDocker.Add(_drawSplitBorder, ViewDockStyle.Right);
            _layoutDocker.Add(_drawDropDown, ViewDockStyle.Right);
            _layoutDocker.Add(_drawOuterSeparator, ViewDockStyle.Right);
            _layoutDocker.Tag = this;

            // Pass the mnemonic default to the content view
            _drawContent.UseMnemonic = useMnemonic;

            // Place the content inside the canvas
            _drawCanvas.Add(_layoutDocker);

            // Set initial view element visible states
            UpdateDropDown();

            // Place the canvas inside ourself
            Add(_drawCanvas);
        }
示例#37
0
 /// <summary>
 /// Initialize a new instance of the PaletteTripleJustImage class.
 /// </summary>
 /// <param name="inherit">Source for inheriting values.</param>
 public PaletteTripleJustImage(IPaletteTriple inherit)
     : this(inherit, null)
 {
 }
        /// <summary>
        /// Gets the second back color.
        /// </summary>
        /// <param name="style">Background style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Color value.</returns>
        public override Color GetBackColor2(PaletteBackStyle style, PaletteState state)
        {
            IPaletteTriple inherit = GetInherit(state);

            return(inherit != null?inherit.PaletteBack.GetBackColor2(state) : base.GetBackColor2(style, state));
        }
示例#39
0
        /// <summary>
        /// Update the source palettes for non-checked drawing.
        /// </summary>
        /// <param name="paletteDisabled">Palette source for the disabled state.</param>
        /// <param name="paletteNormal">Palette source for the normal state.</param>
        /// <param name="paletteTracking">Palette source for the tracking state.</param>
        /// <param name="palettePressed">Palette source for the pressed state.</param>
        public void SetPalettes(IPaletteTriple paletteDisabled,
                                IPaletteTriple paletteNormal,
                                IPaletteTriple paletteTracking,
                                IPaletteTriple palettePressed)
        {
            Debug.Assert(paletteDisabled != null);
            Debug.Assert(paletteNormal != null);
            Debug.Assert(paletteTracking != null);
            Debug.Assert(palettePressed != null);

            // Remember the new palette settings
            _paletteDisabled = paletteDisabled;
            _paletteNormal = paletteNormal;
            _paletteTracking = paletteTracking;
            _palettePressed = palettePressed;

            // Must force update of palettes to use latest ones provided
            _forcePaletteUpdate = true;
        }
示例#40
0
        /// <summary>
        /// Check that the palette and state are correct.
        /// </summary>
        /// <param name="context">Reference to the view context.</param>
        protected virtual void CheckPaletteState(ViewContext context)
        {
            // Default to using this element calculated state
            PaletteState buttonState = State;

            // If the actual control is not enabled, force to disabled state
            if (!IsFixed && !context.Control.Enabled)
            {
                buttonState = PaletteState.Disabled;
            }

            // Apply the checked state if not fixed
            if (!IsFixed && Checked)
            {
                // Is the checked button allowed to become unchecked
                if (AllowUncheck)
                {
                    // Show feedback on tracking and presssed
                    switch (buttonState)
                    {
                    case PaletteState.Normal:
                        buttonState = PaletteState.CheckedNormal;
                        break;

                    case PaletteState.Tracking:
                        buttonState = PaletteState.CheckedTracking;
                        break;

                    case PaletteState.Pressed:
                        buttonState = PaletteState.CheckedPressed;
                        break;
                    }
                }
                else
                {
                    // Always use the normal state as user cannot uncheck the button
                    buttonState = PaletteState.CheckedNormal;
                }
            }

            // If the child elements are not in correct state
            if (_forcePaletteUpdate || (_drawCanvas.ElementState != buttonState))
            {
                // No longer need to force the palettes to be updated
                _forcePaletteUpdate = false;

                // Switch the child elements over to correct state
                _drawCanvas.ElementState         = buttonState;
                _drawContent.ElementState        = buttonState;
                _drawSplitBorder.ElementState    = buttonState;
                _drawDropDownButton.ElementState = buttonState;

                // Push the correct palettes into them
                switch (buttonState)
                {
                case PaletteState.Disabled:
                    _paletteCurrent = _paletteDisabled;
                    break;

                case PaletteState.Normal:
                    _paletteCurrent = _paletteNormal;
                    break;

                case PaletteState.CheckedNormal:
                    _paletteCurrent = _paletteCheckedNormal;
                    break;

                case PaletteState.Pressed:
                    _paletteCurrent = _palettePressed;
                    break;

                case PaletteState.CheckedPressed:
                    _paletteCurrent = _paletteCheckedPressed;
                    break;

                case PaletteState.Tracking:
                    _paletteCurrent = _paletteTracking;
                    break;

                case PaletteState.CheckedTracking:
                    _paletteCurrent = _paletteCheckedTracking;
                    break;

                default:
                    // Should never happen!
                    Debug.Assert(false);
                    break;
                }

                // Update with the correct palettes
                _drawCanvas.SetPalettes(_paletteCurrent.PaletteBack, _paletteCurrent.PaletteBorder);
                _drawContent.SetPalette(_paletteCurrent.PaletteContent);
                _edgeRedirect.SetPalette(_paletteCurrent.PaletteBorder);
            }
        }
        /// <summary>
        /// Gets a value indicating if background should be drawn.
        /// </summary>
        /// <param name="style">Background style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>InheritBool value.</returns>
        public override InheritBool GetBackDraw(PaletteBackStyle style, PaletteState state)
        {
            IPaletteTriple inherit = GetInherit(state);

            return(inherit != null?inherit.PaletteBack.GetBackDraw(state) : base.GetBackDraw(style, state));
        }
示例#42
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawButton class.
        /// </summary>
        /// <param name="paletteDisabled">Palette source for the disabled state.</param>
        /// <param name="paletteNormal">Palette source for the normal state.</param>
        /// <param name="paletteTracking">Palette source for the tracking state.</param>
        /// <param name="palettePressed">Palette source for the pressed state.</param>
        /// <param name="paletteCheckedNormal">Palette source for the normal checked state.</param>
        /// <param name="paletteCheckedTracking">Palette source for the tracking checked state.</param>
        /// <param name="paletteCheckedPressed">Palette source for the pressed checked state.</param>
        /// <param name="paletteMetric">Palette source for metric values.</param>
        /// <param name="buttonValues">Source for content values.</param>
        /// <param name="orientation">Visual orientation of the content.</param>
        /// <param name="useMnemonic">Use mnemonics.</param>
        public ViewDrawButton(IPaletteTriple paletteDisabled,
                              IPaletteTriple paletteNormal,
                              IPaletteTriple paletteTracking,
                              IPaletteTriple palettePressed,
                              IPaletteTriple paletteCheckedNormal,
                              IPaletteTriple paletteCheckedTracking,
                              IPaletteTriple paletteCheckedPressed,
                              IPaletteMetric paletteMetric,
                              IContentValues buttonValues,
                              VisualOrientation orientation,
                              bool useMnemonic)
        {
            // Remember the source information
            _paletteDisabled        = paletteDisabled;
            _paletteNormal          = paletteNormal;
            _paletteTracking        = paletteTracking;
            _palettePressed         = palettePressed;
            _paletteCheckedNormal   = paletteCheckedNormal;
            _paletteCheckedTracking = paletteCheckedTracking;
            _paletteCheckedPressed  = paletteCheckedPressed;
            _paletteCurrent         = _paletteNormal;

            // Default to not being checked
            _checked          = false;
            _allowUncheck     = true;
            _dropDown         = false;
            _splitter         = false;
            _dropDownPosition = VisualOrientation.Right;

            // Create the drop down view
            _drawDropDown       = new ViewLayoutCenter(1);
            _drawDropDownButton = new ViewDrawDropDownButton();
            _drawDropDown.Add(_drawDropDownButton);
            _drawOuterSeparator = new ViewLayoutSeparator(1);

            // Create the view used to draw the split edge
            _edgeRedirect    = new PaletteBorderEdgeRedirect(_paletteNormal.PaletteBorder, null);
            _drawSplitBorder = new ViewDrawBorderEdge(new PaletteBorderEdge(_edgeRedirect, null), CommonHelper.VisualToOrientation(orientation));

            // Our view contains background and border with content inside
            _drawContent = new ViewDrawContent(_paletteNormal.PaletteContent, buttonValues, orientation);
            _drawCanvas  = new ViewDrawSplitCanvas(_paletteNormal.PaletteBack, _paletteNormal.PaletteBorder, paletteMetric, PaletteMetricPadding.None, orientation);

            // Use a docker layout to organize the contents of the canvas
            _layoutDocker = new ViewLayoutDocker();
            _layoutDocker.Add(_drawContent, ViewDockStyle.Fill);
            _layoutDocker.Add(_drawSplitBorder, ViewDockStyle.Right);
            _layoutDocker.Add(_drawDropDown, ViewDockStyle.Right);
            _layoutDocker.Add(_drawOuterSeparator, ViewDockStyle.Right);
            _layoutDocker.Tag = this;

            // Pass the mnemonic default to the content view
            _drawContent.UseMnemonic = useMnemonic;

            // Place the content inside the canvas
            _drawCanvas.Add(_layoutDocker);

            // Set initial view element visible states
            UpdateDropDown();

            // Place the canvas inside ourself
            Add(_drawCanvas);
        }
        /// <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();
            }
        }
示例#44
0
        /// <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
                ButtonSpecManager = 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 },
                                                                      Navigator.CreateToolStripRenderer,
                                                                      null)
                {
                    // Hook up the tooltip manager so that tooltips can be generated
                    ToolTipManager = Navigator.ToolTipManager
                };

                // Allow derived classes to update the remapping with different values
                UpdateButtonSpecMapping();
            }
        }
示例#45
0
 /// <summary>
 /// Initialize a new instance of the PaletteRedirectTriple class.
 /// </summary>
 /// <param name="target">Initial palette target for redirection.</param>
 /// <param name="disabled">Redirection for disabled state requests.</param>
 /// <param name="normal">Redirection for normal state requests.</param>
 /// <param name="pressed">Redirection for pressed state requests.</param>
 /// <param name="tracking">Redirection for tracking state requests.</param>
 /// <param name="selected">Redirection for all checked states.</param>
 /// <param name="focusOverride">Redirection for focus override state requests.</param>
 public PaletteRedirectTriple(IPalette target,
                              IPaletteTriple disabled,
                              IPaletteTriple normal,
                              IPaletteTriple pressed,
                              IPaletteTriple tracking,
                              IPaletteTriple selected,
                              IPaletteTriple focusOverride)
     : this(target, disabled, normal, pressed, tracking, selected, 
            selected, selected, focusOverride, null)
 {
 }
 /// <summary>
 /// Sets the inheritence parent.
 /// </summary>
 /// <param name="inheritComboBox">Source for inheriting combo box values.</param>
 public void SetInherit(IPaletteTriple inheritComboBox)
 {
     _comboBoxState.SetInherit(inheritComboBox);
 }
示例#47
0
 /// <summary>
 /// Set the redirection states.
 /// </summary>
 /// <param name="disabled">Redirection for disabled state requests.</param>
 /// <param name="normal">Redirection for normal state requests.</param>
 public virtual void SetRedirectStates(IPaletteTriple disabled,
                                       IPaletteTriple normal)
 {
     _disabled = disabled;
     _normal = normal;
 }
        /// <summary>
        /// Gets the border corner rounding.
        /// </summary>
        /// <param name="style">Border style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Float rounding.</returns>
        public override float GetBorderRounding(PaletteBorderStyle style, PaletteState state)
        {
            IPaletteTriple inherit = GetInherit(state);

            return(inherit != null?inherit.PaletteBorder.GetBorderRounding(state) : base.GetBorderRounding(style, state));
        }
示例#49
0
 /// <summary>
 /// Initialize a new instance of the PaletteRedirectTriple class.
 /// </summary>
 /// <param name="target">Initial palette target for redirection.</param>
 /// <param name="disabled">Redirection for disabled state requests.</param>
 /// <param name="normal">Redirection for normal state requests.</param>
 /// <param name="pressed">Redirection for pressed state requests.</param>
 /// <param name="tracking">Redirection for tracking state requests.</param>
 /// <param name="checkedNormal">Redirection for checked normal state requests.</param>
 /// <param name="checkedPressed">Redirection for checked pressed state requests.</param>
 /// <param name="checkedTracking">Redirection for checked tracking state requests.</param>
 /// <param name="focusOverride">Redirection for focus override state requests.</param>
 /// <param name="normalDefaultOverride">Redirection for normal default override state requests.</param>
 public PaletteRedirectTriple(IPalette target,
                              IPaletteTriple disabled,
                              IPaletteTriple normal,
                              IPaletteTriple pressed,
                              IPaletteTriple tracking,
                              IPaletteTriple checkedNormal,
                              IPaletteTriple checkedPressed,
                              IPaletteTriple checkedTracking,
                              IPaletteTriple focusOverride,
                              IPaletteTriple normalDefaultOverride)
     : base(target)
 {
     // Remember state specific inheritance
     _disabled = disabled;
     _normal = normal;
     _pressed = pressed;
     _tracking = tracking;
     _checkedNormal = checkedNormal;
     _checkedPressed = checkedPressed;
     _checkedTracking = checkedTracking;
     _focusOverride = focusOverride;
     _normalDefaultOverride = normalDefaultOverride;
 }
        /// <summary>
        /// Gets the prefix drawing setting for long text.
        /// </summary>
        /// <param name="style">Content style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>PaletteTextPrefix value.</returns>
        public override PaletteTextHotkeyPrefix GetContentLongTextPrefix(PaletteContentStyle style, PaletteState state)
        {
            IPaletteTriple inherit = GetInherit(state);

            return(inherit != null?inherit.PaletteContent.GetContentLongTextPrefix(state) : base.GetContentLongTextPrefix(style, state));
        }
        /// <summary>
        /// Set the redirection states.
        /// </summary>
        /// <param name="disabled">Redirection for disabled state requests.</param>
        /// <param name="disableMetric">Redirection for disabled metric requests.</param>
        /// <param name="normal">Redirection for normal state requests.</param>
        /// <param name="normalMetric">Redirection for normal metric requests.</param>
        public void SetRedirectStates(IPaletteTriple disabled,
                                      IPaletteMetric disableMetric,
                                      IPaletteTriple normal,
                                      IPaletteMetric normalMetric)
        {
            base.SetRedirectStates(disabled, normal);

            _disabled = disableMetric;
            _normal = normalMetric;
        }
        /// <summary>
        /// Gets the graphics drawing hint for the background.
        /// </summary>
        /// <param name="style">Border style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>PaletteGraphicsHint value.</returns>
        public override PaletteGraphicsHint GetBackGraphicsHint(PaletteBackStyle style, PaletteState state)
        {
            IPaletteTriple inherit = GetInherit(state);

            return(inherit != null?inherit.PaletteBack.GetBackGraphicsHint(state) : base.GetBackGraphicsHint(style, state));
        }
示例#53
0
 /// <summary>
 /// Initialize a new instance of the PaletteTriple class.
 /// </summary>
 /// <param name="inherit">Source for inheriting values.</param>
 public PaletteTriple(IPaletteTriple inherit)
     : this(inherit, null)
 {
 }
        /// <summary>
        /// Gets the flag indicating if multiline text is allowed for long text.
        /// </summary>
        /// <param name="style">Content style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>InheritBool value.</returns>
        public override InheritBool GetContentLongTextMultiLine(PaletteContentStyle style, PaletteState state)
        {
            IPaletteTriple inherit = GetInherit(state);

            return(inherit != null?inherit.PaletteContent.GetContentLongTextMultiLine(state) : base.GetContentLongTextMultiLine(style, state));
        }
        /// <summary>
        /// Gets the image border alignment.
        /// </summary>
        /// <param name="style">Border style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Image alignment style.</returns>
        public override PaletteRectangleAlign GetBorderImageAlign(PaletteBorderStyle style, PaletteState state)
        {
            IPaletteTriple inherit = GetInherit(state);

            return(inherit != null?inherit.PaletteBorder.GetBorderImageAlign(state) : base.GetBorderImageAlign(style, state));
        }
 /// <summary>
 /// Sets the inheritence parent.
 /// </summary>
 /// <param name="inheritItem">Source for inheriting item values.</param>
 public void SetInherit(IPaletteTriple inheritItem)
 {
     _itemState.SetInherit(inheritItem);
 }
 /// <summary>
 /// Sets the inheritence parent.
 /// </summary>
 /// <param name="inheritItem">Source for inheriting item values.</param>
 public void SetInherit(IPaletteTriple inheritItem)
 {
     Item.SetInherit(inheritItem);
 }
        /// <summary>
        /// Gets the color background angle for the long text.
        /// </summary>
        /// <param name="style">Content style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Angle used for color drawing.</returns>
        public override float GetContentLongTextColorAngle(PaletteContentStyle style, PaletteState state)
        {
            IPaletteTriple inherit = GetInherit(state);

            return(inherit != null?inherit.PaletteContent.GetContentLongTextColorAngle(state) : base.GetContentLongTextColorAngle(style, state));
        }
 /// <summary>
 /// Sets the inheritence parent.
 /// </summary>
 public void SetInherit(IPaletteTriple inherit)
 {
     Back.SetInherit(inherit.PaletteBack);
     Border.SetInherit(inherit.PaletteBorder);
     Content.SetInherit(inherit.PaletteContent);
 }
        /// <summary>
        /// Gets a value indicating which borders to draw.
        /// </summary>
        /// <param name="style">Border style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>PaletteDrawBorders value.</returns>
        public override PaletteDrawBorders GetBorderDrawBorders(PaletteBorderStyle style, PaletteState state)
        {
            IPaletteTriple inherit = GetInherit(state);

            return(inherit != null?inherit.PaletteBorder.GetBorderDrawBorders(state) : base.GetBorderDrawBorders(style, state));
        }