/// <summary>
 /// Initialize a new instance of the PaletteGalleryState class.
 /// </summary>
 /// <param name="inherit">Source for inheriting values.</param>
 /// <param name="needPaint">Delegate for notifying paint requests.</param>
 public PaletteGalleryState(PaletteGalleryRedirect inherit,
                            NeedPaintHandler needPaint)
 {
     // Create storage that maps onto the inherit instances
     _ribbonBack   = new PaletteRibbonBack(inherit.RibbonGalleryBack, needPaint);
     _ribbonBorder = new PaletteRibbonBack(inherit.RibbonGalleryBorder, needPaint);
 }
Esempio n. 2
0
        /// <summary>
        /// Initialize a new instance of the KryptonGallery class.
        /// </summary>
        public KryptonGallery()
        {
            // Defaults
            _mouseOver          = false;
            _alwaysActive       = true;
            _selectedIndex      = -1;
            _trackingIndex      = -1;
            _eventTrackingIndex = -1;
            _preferredItemSize  = new Size(5, 1);
            _dropMaxItemWidth   = 128;
            _dropMinItemWidth   = 3;

            // Timer used to generate tracking change event
            _trackingEventTimer = new Timer
            {
                Interval = 120
            };
            _trackingEventTimer.Tick += OnTrackingTick;

            // Create content storage
            Images           = new GalleryImages(NeedPaintDelegate);
            DropButtonRanges = new KryptonGalleryRangeCollection();

            // Create the palette storage
            StateCommon   = new PaletteGalleryRedirect(Redirector, NeedPaintDelegate);
            StateNormal   = new PaletteGalleryState(StateCommon, NeedPaintDelegate);
            StateDisabled = new PaletteGalleryState(StateCommon, NeedPaintDelegate);
            StateActive   = new PaletteGalleryState(StateCommon, NeedPaintDelegate);

            // Create and organize the buttons
            _buttonUp      = new ViewDrawRibbonGalleryButton(Redirector, PaletteRelativeAlign.Near, PaletteRibbonGalleryButton.Up, Images, NeedPaintDelegate);
            _buttonDown    = new ViewDrawRibbonGalleryButton(Redirector, PaletteRelativeAlign.Center, PaletteRibbonGalleryButton.Down, Images, NeedPaintDelegate);
            _buttonContext = new ViewDrawRibbonGalleryButton(Redirector, PaletteRelativeAlign.Far, PaletteRibbonGalleryButton.DropDown, Images, NeedPaintDelegate);
            _buttonsLayout = new ViewLayoutRibbonGalleryButtons
            {
                _buttonUp,
                _buttonDown,
                _buttonContext
            };

            // The draw layout that contains the actual selection images
            _backBorder = new PaletteGalleryBackBorder(StateNormal);
            _drawDocker = new ViewDrawDocker(_backBorder, _backBorder);
            _drawItems  = new ViewLayoutRibbonGalleryItems(Redirector, this, NeedPaintDelegate, _buttonUp, _buttonDown, _buttonContext);
            _drawDocker.Add(_drawItems, ViewDockStyle.Fill);

            // Top level layout view
            _layoutDocker = new ViewLayoutDocker
            {
                { _drawDocker, ViewDockStyle.Fill },
                { _buttonsLayout, ViewDockStyle.Right }
            };

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

            // Set the default padding value
            base.Padding = new Padding(3);
        }
 /// <summary>
 /// Sets the inheritence parent.
 /// </summary>
 public virtual void SetInherit(PaletteGalleryRedirect inherit)
 {
     _ribbonBack.SetInherit(inherit.RibbonGalleryBack);
     _ribbonBorder.SetInherit(inherit.RibbonGalleryBorder);
 }