with Window_Io;
generic
    type Element is private;
    with function Line_Image (E : Element) return String;

    with procedure Unknown_Key (Key : Window_Io.Raw.Key; E : in out Element);

package Single_Selection_Line_Menus is

    subtype Window_Type is Window_Io.File_Type;

    type Menu_Definition is private;

    function Make return Menu_Definition;

    procedure Add (E : Element; To : in out Menu_Definition);

    procedure Highlight_Element (Menu_Output : Window_Type;
                                 E : Element;
                                 Def : Menu_Definition;
                                 Font : Window_Io.Font);

    type Layout is (Vertical, Horizontal);

    procedure Display (Menu_Output : Window_Type;
                       Def : Menu_Definition;
                       Title : String := "";
                       Column_Offset : Natural := 0;
                       Line_Offset : Natural := 0;
                       Presentation : Layout := Vertical);

    function Get_Response (Menu_Input : Window_Type;
                           Menu_Output : Window_Type;
                           Def : Menu_Definition) return Element;

private
    type Node;

    type Menu_Access is access Node;

    type Menu_Definition is access Node;

    type Node is
        record
            Elem : Element;
            Elem_Number : Positive;
            First_Char : Character;
            Line : Positive;
            Column : Positive;
            Next : Menu_Definition;
            Previous : Menu_Definition;
            Current_Node : Menu_Definition;
        end record;
end Single_Selection_Line_Menus;