-- $Date: 2004/03/08 10:42:42 $
-- $Revision: 1.6 $
-- $Author: jcrocholl $
-- $Hash: e5e0ee4e3d1e3e28cfdb3447fe4d2542 $

-- This file was automatically created with ado.php.
-- Manual changes will be lost when it is updated.

with Ada.Tags; use Ada.Tags;
with Font_Loaders; use Font_Loaders;
with Choices; use Choices;
with Glyphs; use Glyphs;
with Keys; use Keys;

package Boxes.Keys is

   subtype Accidentals is Positive range 1 .. 7;
   type Glyph_Array is array(Accidentals) of Glyph_Access;
   type Integer_Array is array(Accidentals) of Integer;

   -- Public representation.
   type Key_Box is new Box with private;

   -- Work-around for GNAT bug.
   Key_Box_Tag : constant String;

   -- Pointer to representation data.
   type Key_Box_Access is access all Key_Box;

   -- Constructor for instances.
   function Create
     (Key      : in Key_Access-- The initial key.
      Middle_C : in Integer)    -- The initial middle c.
     return Key_Box_Access;     -- The newly created key box.

   -- Accessor to read the key of a key box.
   function Get_Key
     (This : access Key_Box-- The key box to read from.
     return Key_Access;      -- The key of that key box.

   -- Accessor to read the middle c of a key box.
   function Get_Middle_C
     (This : access Key_Box-- The key box to read from.
     return Integer;         -- The middle c of that key box.

   function Get_Center
     (This  : access Key_Box-- The key box object instance.
      Index : in Accidentals-- Which accidental position?
     return Vector;           -- Display offset for proper placement.

   procedure Layout
     (This : access Key_Box;      -- The key box object instance.
      Font : access Font_Loader); -- Use this font loader.

   procedure Print
     (This   : access Key_Box;            -- The key box object instance.
      To     : access Printer'Class-- Render to this printer.
      Center : in Vector);                -- Center of container.

private

   -- Private representation.
   type Key_Box is
     new Box with
      record
         Key      : Key_Access;    -- The key signature in this box.
         Middle_C : Integer;       -- Relative to middle staff line.
         Glyphs   : Glyph_Array;   -- The glyphs for the accidentals.
         Offsets  : Integer_Array-- Vertical offsets for accidentals.
      end record;

   -- Work-around for GNAT bug.
   Key_Box_Tag : constant String := "boxes.keys.key_box";

end Boxes.Keys;