/*
    ####             #    #     # #
    #   #            #    #       #          The FreeWare C library for 
    #   #  ##   ###  #  # #     # ###             RISC OS machines
    #   # #  # #     # #  #     # #  #   ___________________________________
    #   # ####  ###  ##   #     # #  #                                      
    #   # #        # # #  #     # #  #    Please refer to the accompanying
    ####   ### ####  #  # ##### # ###    documentation for conditions of use
    ________________________________________________________________________

    File:    Menu.PopUpAuto.c
    Author:  Copyright  1994 Tony Houghton
    Version: 1.00 (25 Sep 1994)
    Purpose: Pop up a menu to the right of a button icon, finding the icon from
             Desk_Event_lastevent
*/

#include "Desk.Menu.h"
#include "Desk.WimpSWIs.h"
#include "Desk.Event.h"

void Desk_Menu_PopUpAuto(Desk_menu_ptr menu)
{
  if (Desk_Event_lastevent.type != Desk_event_CLICK)
    return;
  if (Desk_Event_lastevent.data.mouse.window == -1 ||
      Desk_Event_lastevent.data.mouse.window == Desk_window_ICONBAR)
    return;
  if (Desk_Event_lastevent.data.mouse.icon == -1)
    return;
  Desk_Menu_PopUp(menu, Desk_Event_lastevent.data.mouse.window,
                   Desk_Event_lastevent.data.mouse.icon);
}
