Package Name: menubar

Return to: Package List


-- =============================================================================
-- File    : menubar.ads                                                       =
-- Project : AMAF                                                              =
-- Version : 1.1.2                                                             =
-- Author  : M. A. van der Lugt                                                =
--                                                                             =
-- Copyright 1996 Marinus A. van der Lugt                                      =
--                                                                             =
-- History :                                                                   =
-- ----------------------------------------------------------------------------=


-- =============================================================================

-- Standard Ada packages


with Ada.Finalization ;

-- MacOS packages


with Events ;

-- Project packages
with Commands ;


with Constants_And_Types ;
-- =============================================================================
package Menubar is


-- =============================================================================
package CT  renames Constants_And_Types ;


package COM renames Commands ;

type Menu_Entry is tagged limited private ;

type Menu_Entry_Class_Ptr is access Menu_Entry'class ;


type Menu_List is new Ada.Finalization.Limited_Controlled with private ;

procedure Init (This : in out Menu_List) ;
procedure Add_To_Menu_List
  (This               : in out Menu_List ;

   New_Menu_Entry_Ptr : in     Menu_Entry_Class_Ptr) ;
procedure Handle_Menu_Command
  (This     : in out Menu_List ;

   aCommand : in     long_integer) ;
procedure Handle_Menu_Selection
  (This  : in out Menu_List ;


   Event : in     Events.EventRecord) ;


private
type Menu_Entry is tagged limited
   record
      Menu_ID          : short_integer ;
      Menu_Item        : short_integer ;
      Menu_Command_Ptr : COM.Command_Class_Ptr ;

   end record ;
type Menu_Entry_Class_Ptrs_Array

   is array (CT.Natural_16 range <>) of Menu_Entry_Class_Ptr ;

type Menu_Entry_Class_Ptrs_Array_Ptr is access Menu_Entry_Class_Ptrs_Array ;
type Menu_List is new Ada.Finalization.Limited_Controlled with
   record
      Menu_Entry_Ptrs  : Menu_Entry_Class_Ptrs_Array_Ptr ;
      Nof_Menu_Entries : CT.Natural_16 := 0 ;


   end record ;
procedure Get_Command_Or_Handle_It
  (This        : in out Menu_Entry'class ;


   The_Command :    out COM.Command_Class_Ptr) ;
end Menubar ;