Implement storage for palette border edge details.
Inheritance: PaletteBack, IPaletteBorder
Esempio n. 1
0
        /// <summary>
        /// Initialize a new instance of the KryptonBorderEdge class.
        /// </summary>
        public KryptonBorderEdge()
        {
            // The label cannot take the focus
            SetStyle(ControlStyles.Selectable, false);

            // Set default label style
            _orientation = Orientation.Horizontal;

            // Create the palette storage
            _borderRedirect = new PaletteBorderInheritRedirect(Redirector, PaletteBorderStyle.ControlClient);
            _stateCommon = new PaletteBorderEdgeRedirect(_borderRedirect, NeedPaintDelegate);
            _stateDisabled = new PaletteBorderEdge(_stateCommon, NeedPaintDelegate);
            _stateNormal = new PaletteBorderEdge(_stateCommon, NeedPaintDelegate);
            _stateCurrent = _stateNormal;
            _state = PaletteState.Normal;

            // Our view contains just a simple canvas that covers entire client area
            _drawPanel = new ViewDrawPanel(_stateNormal);

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

            // We want to be auto sized by default, but not the property default!
            AutoSize = true;
            AutoSizeMode = AutoSizeMode.GrowAndShrink;
        }
Esempio n. 2
0
        /// <summary>
        /// Initialize a new instance of the PaletteBorderEdge class.
        /// </summary>
        /// <param name="inherit">Source for inheriting defaulted values.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public PaletteBorderEdge(PaletteBorderEdgeRedirect inherit,
                                 NeedPaintHandler needPaint)
            : base(inherit, needPaint)
        {
            Debug.Assert(inherit != null);

            // Remember inheritance
            _inherit = inherit;

            // Default properties
            _borderWidth = -1;
        }
Esempio n. 3
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);
        }
Esempio n. 4
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawMonth class.
        /// </summary>
        /// <param name="calendar">Reference to calendar provider.</param>
        /// <param name="months">Reference to months instance.</param>
        /// <param name="redirector">Redirector for getting values.</param>
        /// <param name="needPaintDelegate">Delegate for requesting paint changes.</param>
        public ViewDrawMonth(IKryptonMonthCalendar calendar,
                             ViewLayoutMonths months,
                             PaletteRedirect redirector,
                             NeedPaintHandler needPaintDelegate)
            : base(false)
        {
            _calendar = calendar;
            _months   = months;

            // Add a header for showing the month/year value
            _drawContent  = new ViewDrawContent(_calendar.StateNormal.Header.Content, this, VisualOrientation.Top);
            _borderForced = new PaletteBorderInheritForced(_calendar.StateNormal.Header.Border);
            _borderForced.ForceBorderEdges(PaletteDrawBorders.None);
            _drawHeader = new ViewDrawDocker(_calendar.StateNormal.Header.Back, _borderForced, null)
            {
                { _drawContent, ViewDockStyle.Fill }
            };
            Add(_drawHeader);

            // Create the left/right arrows for moving the months
            _arrowPrev        = new ButtonSpecCalendar(this, PaletteButtonSpecStyle.Previous, RelativeEdgeAlign.Near);
            _arrowNext        = new ButtonSpecCalendar(this, PaletteButtonSpecStyle.Next, RelativeEdgeAlign.Far);
            _arrowPrev.Click += OnPrevMonth;
            _arrowNext.Click += OnNextMonth;
            _buttonSpecs      = new CalendarButtonSpecCollection(this)
            {
                _arrowPrev,
                _arrowNext
            };

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

            // Create stacks for holding display items
            ViewLayoutStack namesStack = new ViewLayoutStack(true);
            ViewLayoutStack weeksStack = new ViewLayoutStack(true);
            ViewLayoutStack daysStack  = new ViewLayoutStack(false);

            _numberStack = new ViewLayoutStack(false);
            weeksStack.Add(_numberStack);
            weeksStack.Add(daysStack);

            // Add day names
            _drawMonthDayNames = new ViewDrawMonthDayNames(_calendar, _months);
            _drawWeekCorner    = new ViewLayoutWeekCorner(_calendar, _months, _calendar.StateNormal.Header.Border);
            namesStack.Add(_drawWeekCorner);
            namesStack.Add(_drawMonthDayNames);
            Add(namesStack);
            Add(weeksStack);

            // Add border between week numbers and days area
            _borderEdgeRedirect = new PaletteBorderEdgeRedirect(_calendar.StateNormal.Header.Border, null);
            _borderEdge         = new PaletteBorderEdge(_borderEdgeRedirect, null);
            _drawBorderEdge     = new ViewDrawBorderEdge(_borderEdge, Orientation.Vertical);
            _drawWeekNumbers    = new ViewDrawWeekNumbers(_calendar, _months);
            ViewLayoutDocker borderLeftDock = new ViewLayoutDocker
            {
                { _drawWeekNumbers, ViewDockStyle.Left },
                { new ViewLayoutSeparator(0, 4), ViewDockStyle.Top },
                { _drawBorderEdge, ViewDockStyle.Fill },
                { new ViewLayoutSeparator(0, 4), ViewDockStyle.Bottom }
            };

            _numberStack.Add(borderLeftDock);

            // Add border between day names and individual days
            PaletteBorderEdgeRedirect borderEdgeRedirect = new PaletteBorderEdgeRedirect(_calendar.StateNormal.Header.Border, null);
            PaletteBorderEdge         borderEdge         = new PaletteBorderEdge(borderEdgeRedirect, null);
            ViewDrawBorderEdge        drawBorderEdge     = new ViewDrawBorderEdge(borderEdge, Orientation.Horizontal);
            ViewLayoutDocker          borderTopDock      = new ViewLayoutDocker
            {
                { new ViewLayoutSeparator(4, 1), ViewDockStyle.Left },
                { drawBorderEdge, ViewDockStyle.Fill },
                { new ViewLayoutSeparator(4, 1), ViewDockStyle.Right },
                { new ViewLayoutSeparator(1, 3), ViewDockStyle.Bottom }
            };

            daysStack.Add(borderTopDock);

            // Add the actual individual days
            ViewDrawMonthDays = new ViewDrawMonthDays(_calendar, _months);
            daysStack.Add(ViewDrawMonthDays);

            // Adding buttons manually means we have to ask for buttons to be created
            _buttonManager.RecreateButtons();
        }
        /// <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;
            CurrentPalette          = _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
            {
                { _drawContent, ViewDockStyle.Fill },
                { _drawSplitBorder, ViewDockStyle.Right },
                { _drawDropDown, ViewDockStyle.Right },
                { _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 PaletteNavigatorNormabled class.
 /// </summary>
 /// <param name="navigator">Reference to owning navigator.</param>
 /// <param name="redirectNavigator">Inheritence redirection for navigator level.</param>
 /// <param name="redirectNavigatorPage">Inheritence redirection for page level.</param>
 /// <param name="redirectNavigatorHeaderGroup">Inheritence redirection for header groups level.</param>
 /// <param name="redirectNavigatorHeaderPrimary">Inheritence redirection for primary header.</param>
 /// <param name="redirectNavigatorHeaderSecondary">Inheritence redirection for secondary header.</param>
 /// <param name="redirectNavigatorHeaderBar">Inheritence redirection for bar header.</param>
 /// <param name="redirectNavigatorHeaderOverflow">Inheritence redirection for bar header.</param>
 /// <param name="redirectNavigatorCheckButton">Inheritence redirection for check button.</param>
 /// <param name="redirectNavigatorOverflowButton">Inheritence redirection for overflow button.</param>
 /// <param name="redirectNavigatorMiniButton">Inheritence redirection for check button.</param>
 /// <param name="redirectNavigatorBar">Inheritence redirection for bar.</param>
 /// <param name="redirectNavigatorBorderEdge">Inheritence redirection for border edge.</param>
 /// <param name="redirectNavigatorSeparator">Inheritence redirection for separator.</param>
 /// <param name="redirectNavigatorTab">Inheritence redirection for tab.</param>
 /// <param name="redirectNavigatorRibbonTab">Inheritence redirection for ribbon tab.</param>
 /// <param name="redirectNavigatorRibbonGeneral">Inheritence redirection for ribbon general.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public PaletteNavigatorRedirect(KryptonNavigator navigator,
                                 PaletteRedirect redirectNavigator,
                                 PaletteRedirect redirectNavigatorPage,
                                 PaletteRedirect redirectNavigatorHeaderGroup,
                                 PaletteRedirect redirectNavigatorHeaderPrimary,
                                 PaletteRedirect redirectNavigatorHeaderSecondary,
                                 PaletteRedirect redirectNavigatorHeaderBar,
                                 PaletteRedirect redirectNavigatorHeaderOverflow,
                                 PaletteRedirect redirectNavigatorCheckButton,
                                 PaletteRedirect redirectNavigatorOverflowButton,
                                 PaletteRedirect redirectNavigatorMiniButton,
                                 PaletteRedirect redirectNavigatorBar,
                                 PaletteRedirect redirectNavigatorBorderEdge,
                                 PaletteRedirect redirectNavigatorSeparator,
                                 PaletteRedirect redirectNavigatorTab,
                                 PaletteRedirect redirectNavigatorRibbonTab,
                                 PaletteRedirect redirectNavigatorRibbonGeneral,
                                 NeedPaintHandler needPaint)
     : base(redirectNavigator, PaletteBackStyle.PanelClient,
            PaletteBorderStyle.ControlClient, needPaint)
 {
     // Create the palette storage
     _palettePageRedirect = new PalettePageRedirect(redirectNavigatorPage, needPaint);
     _paletteHeaderGroupRedirect = new PaletteNavigatorHeaderGroupRedirect(redirectNavigatorHeaderGroup, redirectNavigatorHeaderPrimary, redirectNavigatorHeaderSecondary, redirectNavigatorHeaderBar, redirectNavigatorHeaderOverflow, needPaint);
     _paletteCheckButton = new PaletteTripleRedirect(redirectNavigatorCheckButton, PaletteBackStyle.ButtonStandalone, PaletteBorderStyle.ButtonStandalone, PaletteContentStyle.ButtonStandalone, needPaint);
     _paletteOverflowButton = new PaletteTripleRedirect(redirectNavigatorOverflowButton, PaletteBackStyle.ButtonNavigatorOverflow, PaletteBorderStyle.ButtonNavigatorOverflow, PaletteContentStyle.ButtonNavigatorOverflow, needPaint);
     _paletteMiniButton = new PaletteTripleRedirect(redirectNavigatorMiniButton, PaletteBackStyle.ButtonNavigatorMini, PaletteBorderStyle.ButtonNavigatorMini, PaletteContentStyle.ButtonNavigatorMini, needPaint);
     _paletteBarRedirect = new PaletteBarRedirect(redirectNavigatorBar, needPaint);
     _paletteBorderEdgeInheritRedirect = new PaletteBorderInheritRedirect(redirectNavigatorBorderEdge, PaletteBorderStyle.ControlClient);
     _paletteBorderEdgeRedirect = new PaletteBorderEdgeRedirect(_paletteBorderEdgeInheritRedirect, needPaint);
     _paletteSeparator = new PaletteSeparatorPaddingRedirect(redirectNavigatorSeparator, PaletteBackStyle.SeparatorHighInternalProfile, PaletteBorderStyle.SeparatorHighInternalProfile, needPaint);
     _paletteTab = new PaletteTabTripleRedirect(redirectNavigatorTab, PaletteBackStyle.TabHighProfile, PaletteBorderStyle.TabHighProfile, PaletteContentStyle.TabHighProfile, needPaint);
     _paletteRibbonTab = new PaletteRibbonTabContentRedirect(redirectNavigatorRibbonTab, needPaint);
     _paletteRibbonGeneral = new PaletteRibbonGeneralNavRedirect(redirectNavigatorRibbonGeneral, needPaint);
     _paletteMetrics = new PaletteMetrics(navigator, needPaint);
 }