/// <summary>
/// Ask the menu item to show the associated child collection as a menu.
/// </summary>
public void ShowSubMenu(bool keyboardActivated)
{
// Only need to show if not already doing so
if ((_contextMenu == null) || (_contextMenu.IsDisposed))
{
// No need for the sub menu timer anymore, we are showing
_provider.ProviderViewManager.SetTargetSubMenu((IContextMenuTarget)KeyController);
// Only show a sub menu if there is one to be shown!
if (HasSubMenu)
{
// Create the actual control used to show the context menu
_contextMenu = new VisualContextMenu(_provider, KryptonContextMenuItem.Items, keyboardActivated);
// Need to know when the visual control is removed
_contextMenu.Disposed += OnContextMenuDisposed;
// Get the screen rectangle for the drawing element
Rectangle menuDrawRect = OwningControl.RectangleToScreen(ClientRectangle);
// Should this menu item be shown at a fixed screen rectangle?
if (_provider.ProviderShowSubMenuFixed(KryptonContextMenuItem))
{
// Request the menu be shown at fixed screen rectangle
_contextMenu.ShowFixed(_provider.ProviderShowSubMenuFixedRect(KryptonContextMenuItem),
_provider.ProviderShowHorz,
_provider.ProviderShowVert);
}
else
{
// Request the menu be shown immediately
_contextMenu.Show(menuDrawRect,
_provider.ProviderShowHorz,
_provider.ProviderShowVert,
true, false);
}
}
}
}