/// <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 ContextMenuProvider class.
 /// </summary>
 /// <param name="provider">Original provider.</param>
 /// <param name="needPaintDelegate">Delegate for requesting paint changes.</param>
 /// <param name="viewManager">Reference to view manager.</param>
 /// <param name="viewColumns">Columns view element.</param>
 public ContextMenuProvider(IContextMenuProvider provider,
                            ViewContextMenuManager viewManager,
                            ViewLayoutStack viewColumns,
                            NeedPaintHandler needPaintDelegate)
 {
     _parent            = provider;
     _enabled           = provider.ProviderEnabled;
     _canCloseMenu      = provider.ProviderCanCloseMenu;
     _viewManager       = viewManager;
     _viewColumns       = viewColumns;
     _stateCommon       = provider.ProviderStateCommon;
     _stateDisabled     = provider.ProviderStateDisabled;
     _stateNormal       = provider.ProviderStateNormal;
     _stateHighlight    = provider.ProviderStateHighlight;
     _stateChecked      = provider.ProviderStateChecked;
     _redirectorImages  = provider.ProviderImages;
     _palette           = provider.ProviderPalette;
     _paletteMode       = provider.ProviderPaletteMode;
     _redirector        = provider.ProviderRedirector;
     _needPaintDelegate = needPaintDelegate;
     _showHorz          = provider.ProviderShowHorz;
     _showVert          = provider.ProviderShowVert;
 }
Пример #3
0
        /// <summary>
        /// Initialize a new instance of the ViewLayoutMonths class.
        /// </summary>
        /// <param name="provider">Provider of context menu information.</param>
        /// <param name="monthCalendar">Reference to owning month calendar entry.</param>
        /// <param name="viewManager">Owning view manager instance.</param>
        /// <param name="calendar">Reference to calendar provider.</param>
        /// <param name="redirector">Redirector for getting values.</param>
        /// <param name="needPaintDelegate">Delegate for requesting paint changes.</param>
        public ViewLayoutMonths(IContextMenuProvider provider,
                                KryptonContextMenuMonthCalendar monthCalendar,
                                ViewContextMenuManager viewManager,
                                IKryptonMonthCalendar calendar,
                                PaletteRedirect redirector,
                                NeedPaintHandler needPaintDelegate)
        {
            _provider                = provider;
            _calendar                = calendar;
            _oldSelectionStart       = _calendar.SelectionStart;
            _oldSelectionEnd         = _calendar.SelectionEnd;
            _displayMonth            = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            _redirector              = redirector;
            _needPaintDelegate       = needPaintDelegate;
            _showToday               = true;
            _showTodayCircle         = true;
            _closeOnTodayClick       = false;
            _firstTimeSync           = true;
            _allowButtonSpecToolTips = false;

            // Use a controller that can work against all the displayed months
            MonthCalendarController controller = new MonthCalendarController(monthCalendar, viewManager, this, _needPaintDelegate);

            MouseController  = controller;
            SourceController = controller;
            KeyController    = controller;

            _borderForced = new PaletteBorderInheritForced(_calendar.StateNormal.Header.Border);
            _borderForced.ForceBorderEdges(PaletteDrawBorders.None);
            _drawHeader   = new ViewDrawDocker(_calendar.StateNormal.Header.Back, _borderForced, null);
            _emptyContent = new ViewDrawEmptyContent(_calendar.StateDisabled.Header.Content, _calendar.StateNormal.Header.Content);
            _drawHeader.Add(_emptyContent, ViewDockStyle.Fill);
            Add(_drawHeader);

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

            // Create the manager for handling tooltips
            _toolTipManager                = new ToolTipManager();
            _toolTipManager.ShowToolTip   += new EventHandler <ToolTipEventArgs>(OnShowToolTip);
            _toolTipManager.CancelToolTip += new EventHandler(OnCancelToolTip);
            _buttonManager.ToolTipManager  = _toolTipManager;

            // Create the bottom header used for showing 'today' and defined button specs
            _remapPalette            = (ButtonSpecRemapByContentView)_buttonManager.CreateButtonSpecRemap(redirector, new ButtonSpecAny());
            _remapPalette.Foreground = _emptyContent;

            // Use a redirector to get button values directly from palette
            _palette = new PaletteTripleRedirect(_remapPalette,
                                                 PaletteBackStyle.ButtonButtonSpec,
                                                 PaletteBorderStyle.ButtonButtonSpec,
                                                 PaletteContentStyle.ButtonButtonSpec,
                                                 _needPaintDelegate);

            _drawToday        = new ViewDrawToday(_calendar, _palette, _palette, _palette, _palette, _needPaintDelegate);
            _drawToday.Click += new EventHandler(OnTodayClick);
            _drawHeader.Add(_drawToday, ViewDockStyle.Left);
        }
Пример #4
0
 /// <summary>
 /// Initialize a new instance of the ContextMenuController class.
 /// </summary>
 /// <param name="viewManager">Owning view manager instance.</param>
 public ContextMenuController(ViewContextMenuManager viewManager)
 {
     _viewManager = viewManager;
 }