generic
type Target (<>) is tagged limited private;
package Widgets.Menu_Items.Simple_Listeners is
type A_Handler is access
procedure( object : not null access Target'Class;
action : A_Menu_Action );
function Listener( id : Action_Id;
obj : access Target'Class;
handler : not null A_Handler ) return A_Menu_Listener;
pragma Postcondition( Listener'Result /= null );
function Listener( obj : access Target'Class;
handler : not null A_Handler ) return A_Menu_Listener;
private
type Simple_Menu_Listener is new Simple_Action_Listener and
Menu_Listener with
record
id : Action_Id;
object : access Target'Class := null;
handler : A_Handler := null;
end record;
procedure Handle_Action( this : access Simple_Menu_Listener;
action : A_Menu_Action );
end Widgets.Menu_Items.Simple_Listeners;