/// <summary> /// Initialize a new instance of the ContextMenuProvider class. /// </summary> /// <param name="viewManager">View manager used to organize keyboard events.</param> /// <param name="menuCollection">Top level set of menu items.</param> /// <param name="viewColumns">Stack used for adding new columns.</param> /// <param name="palette">Local palette setting to use initially.</param> /// <param name="paletteMode">Palette mode setting to use initially.</param> /// <param name="redirector">Redirector used for obtaining palette values.</param> /// <param name="needPaintDelegate">Delegate used to when paint changes occur.</param> public AppButtonMenuProvider(ViewContextMenuManager viewManager, KryptonContextMenuItemCollection menuCollection, ViewLayoutStack viewColumns, IPalette palette, PaletteMode paletteMode, PaletteRedirect redirector, NeedPaintHandler needPaintDelegate) { // Store incoming state _viewManager = viewManager; _menuCollection = menuCollection; _viewColumns = viewColumns; _palette = palette; _paletteMode = paletteMode; _redirector = redirector; _needPaintDelegate = needPaintDelegate; // Create all other state _parent = null; _enabled = true; _canCloseMenu = true; _showHorz = KryptonContextMenuPositionH.After; _showVert = KryptonContextMenuPositionV.Top; _stateCommon = new PaletteContextMenuRedirect(redirector, needPaintDelegate); _stateNormal = new PaletteContextMenuItemState(_stateCommon); _stateDisabled = new PaletteContextMenuItemState(_stateCommon); _stateHighlight = new PaletteContextMenuItemStateHighlight(_stateCommon); _stateChecked = new PaletteContextMenuItemStateChecked(_stateCommon); _redirectorImages = new PaletteRedirectContextMenu(redirector, new ContextMenuImages(needPaintDelegate)); }
/// <summary> /// Initialize a new instance of the VisualContextMenu class. /// </summary> /// <param name="provider">Original source of provider details</param> /// <param name="items">Enabled state of the context menu.</param> /// <param name="keyboardActivated">Was the context menu activate by a keyboard action.</param> public VisualContextMenu(IContextMenuProvider provider, KryptonContextMenuCollection items, bool keyboardActivated) : base(true) { _redirector = provider.ProviderRedirector; // Create the view manager instance with root element ViewManager = new ViewContextMenuManager(this, new ViewLayoutNull()); // Set the initial resolved palette to the appropriate setting if (provider.ProviderPalette != null) SetPalette(provider.ProviderPalette); else SetPalette(KryptonManager.GetPaletteForMode(provider.ProviderPaletteMode)); // Set of context menu columns _viewColumns = new ViewLayoutStack(true); // Create provider instance _provider = new ContextMenuProvider(provider, (ViewContextMenuManager)ViewManager, _viewColumns, NeedPaintDelegate); _provider.Closing += new CancelEventHandler(OnProviderClosing); _provider.Close += new EventHandler<CloseReasonEventArgs>(OnProviderClose); _provider.Dispose += new EventHandler(OnProviderClose); Construct(items, keyboardActivated); }
/// <summary> /// Initialize a new instance of the ButtonSpecAppButtonController class. /// </summary> /// <param name="viewManager">Owning view manager instance.</param> /// <param name="target">Target for state changes.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public ButtonSpecAppButtonController(ViewContextMenuManager viewManager, ViewDrawButton target, NeedPaintHandler needPaint) : base(target, needPaint) { _target = target; _viewManager = viewManager; }
/// <summary> /// Initialize a new instance of the VisualPopupAppMenu class. /// </summary> /// <param name="ribbon">Owning ribbon instance.</param> /// <param name="appButton">Originating app button instance.</param> /// <param name="palette">Local palette setting to use initially.</param> /// <param name="paletteMode">Palette mode setting to use initially.</param> /// <param name="redirector">Redirector used for obtaining palette values.</param> /// <param name="rectAppButtonTopHalf">Screen location of the upper half of the app button.</param> /// <param name="rectAppButtonBottomHalf">Screen location of the lower half of the app button.</param> /// <param name="keyboardActivated">Was the context menu activated by a keyboard action.</param> public VisualPopupAppMenu(KryptonRibbon ribbon, RibbonAppButton appButton, IPalette palette, PaletteMode paletteMode, PaletteRedirect redirector, Rectangle rectAppButtonTopHalf, Rectangle rectAppButtonBottomHalf, bool keyboardActivated) : base(true) { // Remember incoming state _redirector = redirector; _ribbon = ribbon; _rectAppButtonTopHalf = rectAppButtonTopHalf; _rectAppButtonBottomHalf = rectAppButtonBottomHalf; // Create the view manager instance with root element ViewManager = new ViewContextMenuManager(this, new ViewLayoutNull()); // Set the initial resolved palette to the appropriate setting if (palette != null) SetPalette(palette); else SetPalette(KryptonManager.GetPaletteForMode(paletteMode)); // Set of context menu columns _viewColumns = new ViewLayoutStack(true); // Create provider instance _provider = new AppButtonMenuProvider((ViewContextMenuManager)ViewManager, _ribbon.RibbonAppButton.AppButtonMenuItems, _viewColumns, palette, paletteMode, redirector, NeedPaintDelegate); _provider.Closing += new CancelEventHandler(OnProviderClosing); _provider.Close += new EventHandler<CloseReasonEventArgs>(OnProviderClose); _provider.Dispose += new EventHandler(OnProviderClose); CreateAppButtonBottom(); CreateButtonSpecView(); CreateContextMenuView(appButton); CreateRecentDocumentsView(); CreateInnerBacking(CreateInsideCanvas()); CreateOuterBacking(); CreateOutsideDocker(); CreateButtonManager(appButton); ViewManager.Root = _drawOutsideDocker; // With keyboard activate we select the first valid item if (keyboardActivated) ((ViewContextMenuManager)ViewManager).KeyDown(); }
/// <summary> /// Initialize a new instance of the MenuItemController class. /// </summary> /// <param name="viewManager">Owning view manager instance.</param> /// <param name="menuItem">Target menu item view element.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public MenuItemController(ViewContextMenuManager viewManager, ViewDrawMenuItem menuItem, NeedPaintHandler needPaint) { Debug.Assert(viewManager != null); Debug.Assert(menuItem != null); Debug.Assert(needPaint != null); _viewManager = viewManager; _menuItem = menuItem; NeedPaint = needPaint; }
/// <summary> /// Initialize a new instance of the RecentDocController class. /// </summary> /// <param name="viewManager">Owning view manager instance.</param> /// <param name="menuItem">Target menu item view element.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public RecentDocController(ViewContextMenuManager viewManager, ViewDrawRibbonAppMenuRecentDec menuItem, NeedPaintHandler needPaint) { Debug.Assert(viewManager != null); Debug.Assert(menuItem != null); Debug.Assert(needPaint != null); _viewManager = viewManager; _menuItem = menuItem; NeedPaint = needPaint; }
/// <summary> /// Initialize a new instance of the MonthCalendarController class. /// </summary> /// <param name="monthCalendar">Reference to owning month calendar entry.</param> /// <param name="viewManager">Owning view manager instance.</param> /// <param name="months">Reference to view that manages the display of months.</param> /// <param name="needPaint">Delegate for handling repainting requests.</param> public MonthCalendarController(KryptonContextMenuMonthCalendar monthCalendar, ViewContextMenuManager viewManager, ViewLayoutMonths months, NeedPaintHandler needPaint) { _monthCalendar = monthCalendar; _viewManager = viewManager; _months = months; _needPaint = needPaint; _mouseOver = false; _captured = false; }
/// <summary> /// Initialize a new instance of the MenuLinkLabelController class. /// </summary> /// <param name="viewManager">Owning view manager instance.</param> /// <param name="target">Target for state changes.</param> /// <param name="linkLabel">Drawing element that owns link label display.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public MenuLinkLabelController(ViewContextMenuManager viewManager, ViewDrawContent target, ViewDrawMenuLinkLabel linkLabel, NeedPaintHandler needPaint) { Debug.Assert(viewManager != null); Debug.Assert(target != null); Debug.Assert(linkLabel != null); Debug.Assert(needPaint != null); _viewManager = viewManager; _target = target; _menuLinkLabel = linkLabel; NeedPaint = needPaint; }
/// <summary> /// Initialize a new instance of the MenuRadioButtonController class. /// </summary> /// <param name="viewManager">Owning view manager instance.</param> /// <param name="target">Target for state changes.</param> /// <param name="radioButton">Drawing element that owns radio button display.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public MenuRadioButtonController(ViewContextMenuManager viewManager, ViewBase target, ViewDrawMenuRadioButton radioButton, NeedPaintHandler needPaint) { Debug.Assert(viewManager != null); Debug.Assert(target != null); Debug.Assert(radioButton != null); Debug.Assert(needPaint != null); _viewManager = viewManager; _target = target; _menuRadioButton = radioButton; NeedPaint = needPaint; }
/// <summary> /// Initialize a new instance of the MenuCheckBoxController class. /// </summary> /// <param name="viewManager">Owning view manager instance.</param> /// <param name="target">Target for state changes.</param> /// <param name="checkBox">Drawing element that owns check box display.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public MenuCheckBoxController(ViewContextMenuManager viewManager, ViewBase target, ViewDrawMenuCheckBox checkBox, NeedPaintHandler needPaint) { Debug.Assert(viewManager != null); Debug.Assert(target != null); Debug.Assert(checkBox != null); Debug.Assert(needPaint != null); _viewManager = viewManager; _target = target; _menuCheckBox = checkBox; NeedPaint = needPaint; }
/// <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; }
/// <summary> /// Initialize a new instance of the ButtonSpecManagerLayoutAppButton class. /// </summary> /// <param name="viewManager">Reference to context menu view manager.</param> /// <param name="control">Control that owns the button manager.</param> /// <param name="redirector">Palette redirector.</param> /// <param name="variableSpecs">Variable set of button specifications.</param> /// <param name="fixedSpecs">Fixed set of button specifications.</param> /// <param name="viewDockers">Array of target view dockers.</param> /// <param name="viewMetrics">Array of target metric providers.</param> /// <param name="viewMetricInt">Array of target metrics for outside/inside spacer size.</param> /// <param name="viewMetricPaddings">Array of target metrics for button padding.</param> /// <param name="getRenderer">Delegate for returning a tool strip renderer.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public ButtonSpecManagerLayoutAppButton(ViewContextMenuManager viewManager, Control control, PaletteRedirect redirector, ButtonSpecCollectionBase variableSpecs, ButtonSpecCollectionBase fixedSpecs, ViewLayoutDocker[] viewDockers, IPaletteMetric[] viewMetrics, PaletteMetricInt[] viewMetricInt, PaletteMetricPadding[] viewMetricPaddings, GetToolStripRenderer getRenderer, NeedPaintHandler needPaint) : base(control, redirector, variableSpecs, fixedSpecs, viewDockers, viewMetrics, viewMetricInt, viewMetricPaddings, getRenderer, needPaint) { _viewManager = viewManager; }
/// <summary> /// Initialize a new instance of the MenuCheckButtonController class. /// </summary> /// <param name="viewManager">Owning view manager instance.</param> /// <param name="target">Target for state changes.</param> /// <param name="checkButton">Drawing element that owns check button display.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public MenuCheckButtonController(ViewContextMenuManager viewManager, ViewBase target, ViewDrawMenuCheckButton checkButton, NeedPaintHandler needPaint) { Debug.Assert(viewManager != null); Debug.Assert(target != null); Debug.Assert(checkButton != null); Debug.Assert(needPaint != null); _viewManager = viewManager; _target = target; _menuCheckButton = checkButton; NeedPaint = needPaint; // Set initial display state UpdateTarget(); }
/// <summary> /// Initialize a new instance of the MenuColorBlockController class. /// </summary> /// <param name="viewManager">Owning view manager instance.</param> /// <param name="target">Target for state changes.</param> /// <param name="colorBlock">Drawing element that owns color block display.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public MenuColorBlockController(ViewContextMenuManager viewManager, ViewBase target, ViewDrawMenuColorBlock colorBlock, NeedPaintHandler needPaint) { Debug.Assert(viewManager != null); Debug.Assert(target != null); Debug.Assert(colorBlock != null); Debug.Assert(needPaint != null); _viewManager = viewManager; _target = target; _menuColorBlock = colorBlock; NeedPaint = needPaint; // Set initial display state UpdateTarget(); }
/// <summary> /// Initialize a new instance of the ViewLayoutMenuItemSelect class. /// </summary> /// <param name="itemSelect">Reference to owning instance.</param> /// <param name="provider">Provider of context menu information.</param> public ViewLayoutMenuItemSelect(KryptonContextMenuImageSelect itemSelect, IContextMenuProvider provider) { Debug.Assert(itemSelect != null); Debug.Assert(provider != null); // Store incoming references _itemSelect = itemSelect; _provider = provider; _itemSelect.TrackingIndex = -1; _enabled = provider.ProviderEnabled; _viewManager = provider.ProviderViewManager; // Cache the values to use when running _imageList = _itemSelect.ImageList; _imageIndexStart = _itemSelect.ImageIndexStart; _imageIndexEnd = _itemSelect.ImageIndexEnd; _lineItems = _itemSelect.LineItems; _needPaint = provider.ProviderNeedPaintDelegate; _padding = _itemSelect.Padding; _imageCount = (_imageList == null ? 0 : _imageList.Images.Count); // Limit check the start and end values _imageIndexStart = Math.Max(0, _imageIndexStart); _imageIndexEnd = Math.Min(_imageIndexEnd, _imageCount - 1); _imageIndexCount = Math.Max(0, (_imageIndexEnd - _imageIndexStart) + 1); IPalette palette = provider.ProviderPalette; if (palette == null) palette = KryptonManager.GetPaletteForMode(provider.ProviderPaletteMode); // Create triple that can be used by the draw button _triple = new PaletteTripleToPalette(palette, PaletteBackStyle.ButtonLowProfile, PaletteBorderStyle.ButtonLowProfile, PaletteContentStyle.ButtonLowProfile); // Update with current button style _triple.SetStyles(itemSelect.ButtonStyle); }
/// <summary> /// Initialize a new instance of the ViewLayoutMenuItemSelect class. /// </summary> /// <param name="itemSelect">Reference to owning instance.</param> /// <param name="provider">Provider of context menu information.</param> public ViewLayoutMenuItemSelect(KryptonContextMenuImageSelect itemSelect, IContextMenuProvider provider) { Debug.Assert(itemSelect != null); Debug.Assert(provider != null); // Store incoming references _itemSelect = itemSelect; _provider = provider; _itemSelect.TrackingIndex = -1; ItemEnabled = provider.ProviderEnabled; _viewManager = provider.ProviderViewManager; // Cache the values to use when running _imageList = _itemSelect.ImageList; _imageIndexStart = _itemSelect.ImageIndexStart; _imageIndexEnd = _itemSelect.ImageIndexEnd; _lineItems = _itemSelect.LineItems; _needPaint = provider.ProviderNeedPaintDelegate; _padding = _itemSelect.Padding; _imageCount = _imageList == null ? 0 : _imageList.Images.Count; // Limit check the start and end values _imageIndexStart = Math.Max(0, _imageIndexStart); _imageIndexEnd = Math.Min(_imageIndexEnd, _imageCount - 1); _imageIndexCount = Math.Max(0, _imageIndexEnd - _imageIndexStart + 1); IPalette palette = provider.ProviderPalette ?? KryptonManager.GetPaletteForMode(provider.ProviderPaletteMode); // Create triple that can be used by the draw button _triple = new PaletteTripleToPalette(palette, PaletteBackStyle.ButtonLowProfile, PaletteBorderStyle.ButtonLowProfile, PaletteContentStyle.ButtonLowProfile); // Update with current button style _triple.SetStyles(itemSelect.ButtonStyle); }
/// <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; ProviderEnabled = provider.ProviderEnabled; ProviderCanCloseMenu = provider.ProviderCanCloseMenu; ProviderViewManager = viewManager; ProviderViewColumns = viewColumns; ProviderStateCommon = provider.ProviderStateCommon; ProviderStateDisabled = provider.ProviderStateDisabled; ProviderStateNormal = provider.ProviderStateNormal; ProviderStateHighlight = provider.ProviderStateHighlight; ProviderStateChecked = provider.ProviderStateChecked; ProviderImages = provider.ProviderImages; ProviderPalette = provider.ProviderPalette; ProviderPaletteMode = provider.ProviderPaletteMode; ProviderRedirector = provider.ProviderRedirector; ProviderNeedPaintDelegate = needPaintDelegate; ProviderShowHorz = provider.ProviderShowHorz; ProviderShowVert = provider.ProviderShowVert; }
/// <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; }
/// <summary> /// Initialize a new instance of the VisualContextMenu class. /// </summary> /// <param name="provider">Original source of provider details</param> /// <param name="items">Enabled state of the context menu.</param> /// <param name="keyboardActivated">Was the context menu activate by a keyboard action.</param> public VisualContextMenu(IContextMenuProvider provider, KryptonContextMenuCollection items, bool keyboardActivated) : base(true) { Redirector = provider.ProviderRedirector; // Create the view manager instance with root element ViewManager = new ViewContextMenuManager(this, new ViewLayoutNull()); // Set the initial resolved palette to the appropriate setting SetPalette(provider.ProviderPalette ?? KryptonManager.GetPaletteForMode(provider.ProviderPaletteMode)); // Set of context menu columns _viewColumns = new ViewLayoutStack(true); // Create provider instance _provider = new ContextMenuProvider(provider, (ViewContextMenuManager)ViewManager, _viewColumns, NeedPaintDelegate); _provider.Closing += OnProviderClosing; _provider.Close += OnProviderClose; _provider.Dispose += OnProviderClose; Construct(items, keyboardActivated); }
/// <summary> /// Initialize a new instance of the ContextMenuController class. /// </summary> /// <param name="viewManager">Owning view manager instance.</param> public ContextMenuController(ViewContextMenuManager viewManager) => _viewManager = viewManager;
/// <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(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[] { _drawHeader }, new IPaletteMetric[] { Calendar.StateCommon }, new[] { PaletteMetricInt.HeaderButtonEdgeInsetCalendar }, new[] { PaletteMetricPadding.None }, Calendar.GetToolStripDelegate, _needPaintDelegate); // Create the manager for handling tooltips _toolTipManager = new ToolTipManager(); _toolTipManager.ShowToolTip += OnShowToolTip; _toolTipManager.CancelToolTip += 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 += OnTodayClick; _drawHeader.Add(_drawToday, ViewDockStyle.Left); }
/// <summary> /// Initialize a new instance of the ContextMenuController class. /// </summary> /// <param name="viewManager">Owning view manager instance.</param> public ContextMenuController(ViewContextMenuManager viewManager) { _viewManager = viewManager; }
/// <summary> /// Initialize a new instance of the ContextMenuProvider class. /// </summary> /// <param name="contextMenu">Originating context menu instance.</param> /// <param name="viewManager">Reference to view manager.</param> /// <param name="viewColumns">Columns view element.</param> /// <param name="palette">Local palette setting to use initially.</param> /// <param name="paletteMode">Palette mode setting to use initially.</param> /// <param name="redirector">Redirector used for obtaining palette values.</param> /// <param name="redirectorImages">Redirector used for obtaining images.</param> /// <param name="needPaintDelegate">Delegate for requesting paint changes.</param> /// <param name="enabled">Enabled state of the context menu.</param> public ContextMenuProvider(KryptonContextMenu contextMenu, ViewContextMenuManager viewManager, ViewLayoutStack viewColumns, IPalette palette, PaletteMode paletteMode, PaletteRedirect redirector, PaletteRedirectContextMenu redirectorImages, NeedPaintHandler needPaintDelegate, bool enabled) { _showHorz = KryptonContextMenuPositionH.Left; _showVert = KryptonContextMenuPositionV.Below; _enabled = enabled; _viewManager = viewManager; _viewColumns = viewColumns; _stateCommon = contextMenu.StateCommon; _stateDisabled = contextMenu.StateDisabled; _stateNormal = contextMenu.StateNormal; _stateHighlight = contextMenu.StateHighlight; _stateChecked = contextMenu.StateChecked; _redirectorImages = redirectorImages; _palette = palette; _paletteMode = paletteMode; _redirector = redirector; _needPaintDelegate = needPaintDelegate; _canCloseMenu = true; }
/// <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); }