コード例 #1
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();
            _trackingEventTimer.Interval = 120;
            _trackingEventTimer.Tick    += new EventHandler(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();
            _buttonsLayout.Add(_buttonUp);
            _buttonsLayout.Add(_buttonDown);
            _buttonsLayout.Add(_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();
            _layoutDocker.Add(_drawDocker, ViewDockStyle.Fill);
            _layoutDocker.Add(_buttonsLayout, ViewDockStyle.Right);

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

            // Check the control is licenced
            KryptonGalleryLicence.PerformLicenceChecking(this);

            // Set the default padding value
            base.Padding = new Padding(3);
        }
コード例 #2
0
        /// <summary>
        /// Initialize a new instance of the GalleryItemController class.
        /// </summary>
        /// <param name="target">Target for state changes.</param>
        /// <param name="layout">Reference to layout of the image items.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public GalleryItemController(ViewDrawRibbonGalleryItem target,
                                     ViewLayoutRibbonGalleryItems layout,
                                     NeedPaintHandler needPaint)
        {
            Debug.Assert(target != null);
            Debug.Assert(layout != null);

            _mousePoint = CommonHelper.NullPoint;
            _target     = target;
            _layout     = layout;
            NeedPaint   = needPaint;
        }
コード例 #3
0
        /// <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;
        }