Пример #1
0
        /// <summary>
        /// Initialize a new instance of the ImageSelectController class.
        /// </summary>
        /// <param name="viewManager">Owning view manager instance.</param>
        /// <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 MenuImageSelectController(ViewContextMenuManager viewManager,
                                         ViewDrawMenuImageSelectItem target,
                                         ViewLayoutMenuItemSelect layout,
                                         NeedPaintHandler needPaint)
        {
            Debug.Assert(viewManager != null);
            Debug.Assert(target != null);
            Debug.Assert(layout != null);
            Debug.Assert(needPaint != null);

            MousePoint   = CommonHelper.NullPoint;
            _viewManager = viewManager;
            _target      = target;
            _layout      = layout;
            NeedPaint    = needPaint;
        }
Пример #2
0
        /// <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 += OnItemClick;
            MouseController    = _controller;
            SourceController   = _controller;
            KeyController      = _controller;
        }