/// <summary> /// Initialize a new instance of the VisualContextMenuDTP class. /// </summary> /// <param name="contextMenu">Originating context menu 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="redirectorImages">Redirector used for obtaining images.</param> /// <param name="items">Collection of context menu items to be displayed.</param> /// <param name="enabled">Enabled state of the context menu.</param> /// <param name="keyboardActivated">Was the context menu activate by a keyboard action.</param> /// <param name="dropScreenRect">Screen rectangle of the drop down button.</param> public VisualContextMenuDTP(KryptonContextMenu contextMenu, IPalette palette, PaletteMode paletteMode, PaletteRedirect redirector, PaletteRedirectContextMenu redirectorImages, KryptonContextMenuCollection items, bool enabled, bool keyboardActivated, Rectangle dropScreenRect) : base(contextMenu, palette, paletteMode, redirector, redirectorImages, items, enabled, keyboardActivated) { _dropScreenRect = dropScreenRect; }
/// <summary> /// Initialize a new instance of the VisualContextMenuDTP class. /// </summary> /// <param name="contextMenu">Originating context menu 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="redirectorImages">Redirector used for obtaining images.</param> /// <param name="items">Collection of context menu items to be displayed.</param> /// <param name="enabled">Enabled state of the context menu.</param> /// <param name="keyboardActivated">Was the context menu activate by a keyboard action.</param> /// <param name="dropScreenRect">Screen rectangle of the drop down button.</param> public VisualContextMenuDTP(KryptonContextMenu contextMenu, IPalette palette, PaletteMode paletteMode, PaletteRedirect redirector, PaletteRedirectContextMenu redirectorImages, KryptonContextMenuCollection items, bool enabled, bool keyboardActivated, Rectangle dropScreenRect) : base(contextMenu, palette, paletteMode, redirector, redirectorImages, items, enabled, keyboardActivated) { _dropScreenRect = dropScreenRect; }
/// <summary> /// Initialize a new instance of the VisualContextMenu class. /// </summary> /// <param name="contextMenu">Originating context menu 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="redirectorImages">Redirector used for obtaining images.</param> /// <param name="items">Collection of context menu items to be displayed.</param> /// <param name="enabled">Enabled state of the context menu.</param> /// <param name="keyboardActivated">Was the context menu activate by a keyboard action.</param> public VisualContextMenu(KryptonContextMenu contextMenu, IPalette palette, PaletteMode paletteMode, PaletteRedirect redirector, PaletteRedirectContextMenu redirectorImages, KryptonContextMenuCollection items, bool enabled, bool keyboardActivated) : base(true) { _contextMenu = contextMenu; _redirector = redirector; // 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 ContextMenuProvider(contextMenu, (ViewContextMenuManager)ViewManager, _viewColumns, palette, paletteMode, redirector, redirectorImages, NeedPaintDelegate, enabled); _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 KryptonContextMenu class. /// </summary> public KryptonContextMenu() { // Setup the need paint delegate _needPaintDelegate = OnNeedPaint; // Set default settings Palette = null; PaletteMode = PaletteMode.Global; Images = new ContextMenuImages(_needPaintDelegate); _redirector = new PaletteRedirect(null); _redirectorImages = new PaletteRedirectContextMenu(_redirector, Images); Enabled = true; // Create the palette storage StateCommon = new PaletteContextMenuRedirect(_redirector, _needPaintDelegate); StateNormal = new PaletteContextMenuItemState(StateCommon); StateDisabled = new PaletteContextMenuItemState(StateCommon); StateHighlight = new PaletteContextMenuItemStateHighlight(StateCommon); StateChecked = new PaletteContextMenuItemStateChecked(StateCommon); // Create the top level collection for menu items Items = new KryptonContextMenuCollection(); }
/// <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 KryptonContextMenu class. /// </summary> public KryptonContextMenu() { // Setup the need paint delegate _needPaintDelegate = new NeedPaintHandler(OnNeedPaint); // Set default settings _localPalette = null; _paletteMode = PaletteMode.Global; _images = new ContextMenuImages(_needPaintDelegate); _redirector = new PaletteRedirect(null); _redirectorImages = new PaletteRedirectContextMenu(_redirector, _images); _enabled = true; // Create the palette storage _stateCommon = new PaletteContextMenuRedirect(_redirector, _needPaintDelegate); _stateNormal = new PaletteContextMenuItemState(_stateCommon); _stateDisabled = new PaletteContextMenuItemState(_stateCommon); _stateHighlight = new PaletteContextMenuItemStateHighlight(_stateCommon); _stateChecked = new PaletteContextMenuItemStateChecked(_stateCommon); // Create the top level collection for menu items _items = new KryptonContextMenuCollection(); }
/// <summary> /// Initialize a new instance of the KryptonContextMenu class. /// </summary> public KryptonContextMenu() { // Setup the need paint delegate _needPaintDelegate = new NeedPaintHandler(OnNeedPaint); // Set default settings _localPalette = null; _paletteMode = PaletteMode.Global; _images = new ContextMenuImages(_needPaintDelegate); _redirector = new PaletteRedirect(null); _redirectorImages = new PaletteRedirectContextMenu(_redirector, _images); _enabled = true; // Create the palette storage _stateCommon = new PaletteContextMenuRedirect(_redirector, _needPaintDelegate); _stateNormal = new PaletteContextMenuItemState(_stateCommon); _stateDisabled = new PaletteContextMenuItemState(_stateCommon); _stateHighlight = new PaletteContextMenuItemStateHighlight(_stateCommon); _stateChecked = new PaletteContextMenuItemStateChecked(_stateCommon); // Create the top level collection for menu items _items = new KryptonContextMenuCollection(); }
/// <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> /// Create a new visual context menu for showing the defined items. /// </summary> /// <param name="kcm">Owning KryptonContextMenu instance.</param> /// <param name="palette">Drawing palette.</param> /// <param name="paletteMode">Drawing palette mode.</param> /// <param name="redirector">Redirector for sourcing base values.</param> /// <param name="redirectorImages">Redirector for sourcing base images.</param> /// <param name="items">Colletion of menu items.</param> /// <param name="enabled">Enabled state of the menu.</param> /// <param name="keyboardActivated">True is menu was keyboard initiated.</param> /// <returns>VisualContextMenu reference.</returns> protected virtual VisualContextMenu CreateContextMenu(KryptonContextMenu kcm, IPalette palette, PaletteMode paletteMode, PaletteRedirect redirector, PaletteRedirectContextMenu redirectorImages, KryptonContextMenuCollection items, Boolean enabled, bool keyboardActivated) { return new VisualContextMenu(kcm, palette, paletteMode, redirector, redirectorImages, items, enabled, keyboardActivated); }
/// <summary> /// Initialize a new instance of the VisualContextMenu class. /// </summary> /// <param name="contextMenu">Originating context menu 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="redirectorImages">Redirector used for obtaining images.</param> /// <param name="items">Collection of context menu items to be displayed.</param> /// <param name="enabled">Enabled state of the context menu.</param> /// <param name="keyboardActivated">Was the context menu activate by a keyboard action.</param> public VisualContextMenu(KryptonContextMenu contextMenu, IPalette palette, PaletteMode paletteMode, PaletteRedirect redirector, PaletteRedirectContextMenu redirectorImages, KryptonContextMenuCollection items, bool enabled, bool keyboardActivated) : base(true) { _contextMenu = contextMenu; _redirector = redirector; // 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 ContextMenuProvider(contextMenu, (ViewContextMenuManager)ViewManager, _viewColumns, palette, paletteMode, redirector, redirectorImages, NeedPaintDelegate, enabled); _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 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 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; }