// UIA Framework Note: Used to expand/collapse MenuItems
public void OnMouseUp(MouseEventArgs args)
{
/* mouse down dont comes from menu */
if (!mouse_down)
{
return;
}
mouse_down = false;
/* is not left button */
if ((args.Button & MouseButtons.Left) == 0)
{
return;
}
MenuItem item = GetItemAtXY(args.X, args.Y);
/* the user released the mouse button outside the menu */
if (item == null)
{
Deactivate();
return;
}
if (!item.Enabled)
{
return;
}
/* Deactivate the menu when is topmenu and popdown and */
if (((CurrentMenu == TopMenu) && !(CurrentMenu is ContextMenu) && popdown_menu) || !item.IsPopup)
{
Deactivate();
UpdateCursor();
}
/* Perform click when is not a popup */
if (!item.IsPopup)
{
DeselectItem(item);
// Raise the form's MenuComplete event
if (TopMenu != null && TopMenu.Wnd != null)
{
Form f = TopMenu.Wnd.FindForm();
if (f != null)
{
f.OnMenuComplete(EventArgs.Empty);
}
}
item.PerformClick();
}
}