Example #1
0
/*************************************************************************
Perform actual update processing for this Window.
*************************************************************************/
void MenuItem::updateSelf(float elapsed)
{
    ItemEntry::updateSelf(elapsed);

    //handle delayed popup closing/opening when hovering with the mouse
    if (d_autoPopupTimeout != 0.0f && (d_popupOpening || d_popupClosing))
    {
        // stop timer if the hovering state isn't set appropriately anymore
        if (d_hovering)
        {
            d_popupClosing = false;
        }
        else
        {
            d_popupOpening = false;
        }

        //check if the timer elapsed and take action appropriately
        d_autoPopupTimeElapsed += elapsed;

        if (d_autoPopupTimeElapsed > d_autoPopupTimeout)
        {
            if (d_popupOpening)
            {
                d_popupOpening = false;
                openPopupMenu(true);
            }
            else if (d_popupClosing)
            {
                d_popupClosing = false;
                closePopupMenu(true);
            }
        }
    }
}
Example #2
0
/*************************************************************************
    Toggles the PopupMenu.
*************************************************************************/
bool MenuItem::togglePopupMenu(void)
{
    if (d_opened)
    {
        closePopupMenu();
        return false;
    }

    openPopupMenu();
    return true;
}
Example #3
0
void PowerWinApp::onContextMenu(Windows::Point pt)
{
  ::SetForegroundWindow(getHWND());
  openPopupMenu(popup_menu_, pt, getHWND());
}