--------------------------------------------------------------------------------
--                                                                            --
-- Copyright (C) 2004, RISC OS Ada Library (RASCAL) developers.               --
--                                                                            --
-- This library is free software; you can redistribute it and/or              --
-- modify it under the terms of the GNU Lesser General Public                 --
-- License as published by the Free Software Foundation; either               --
-- version 2.1 of the License, or (at your option) any later version.         --
--                                                                            --
-- This library is distributed in the hope that it will be useful,            --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of             --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           --
-- Lesser General Public License for more details.                            --
--                                                                            --
-- You should have received a copy of the GNU Lesser General Public           --
-- License along with this library; if not, write to the Free Software        --
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA    --
--                                                                            --
--------------------------------------------------------------------------------

-- @brief Toolbox PopUpMenu related types and methods.
-- $Author$
-- $Date$
-- $Revision$

with System;                     use System;
with System.Unsigned_Types;      use System.Unsigned_Types;

with RASCAL.Toolbox;             use RASCAL.Toolbox;
with RASCAL.OS;                  use RASCAL.OS;

package RASCAL.ToolboxPopUpMenu is

   -- Flags
   PopUp_Generate_About_To_Be_Shown : constant := 16#1#;

   --
   -- This event is raised when the user clicks on the pop-up button.
   --
   type Toolbox_PopUpMenu_AboutToBeShown is
   record
   Header    : Toolbox_Event_Header;
   Menu_ID   : Object_ID;
   Show_Type : Integer;
   Position  : OS_Coordinate;
   end record;
   pragma Convention (C, Toolbox_PopUpMenu_AboutToBeShown);

   type Toolbox_PopUpMenu_AboutToBeShown_Pointer is
        access Toolbox_PopUpMenu_AboutToBeShown;

   type ATEL_Toolbox_PopUpMenu_AboutToBeShown is abstract
        new Toolbox_EventListener(Toolbox_Event_PopUp_AboutToBeShown,-1,-1) with

   record
   Event : Toolbox_PopUpMenu_AboutToBeShown_Pointer;
   end record;

   --
   -- Returns the objectid of the menu to be shown when the pop-up button is clicked.
   --
   function Get_Menu (Window    : in Object_ID;
                      Component : in Component_ID;
                      Flags     : in System.Unsigned_Types.Unsigned := 0) return Object_ID;

   --
   -- Sets the objectid of the menu to be shown when the pop-p button is clicked.
   --
   procedure Set_Menu (Window    : in Object_ID;
                       Component : in Component_ID;
                       Menu      : in Object_ID;
                       Flags     : in System.Unsigned_Types.Unsigned := 0);

end RASCAL.ToolboxPopUpMenu;
