-- $Date: 2004/03/08 11:35:39 $
-- $Revision: 1.8 $
-- $Author: jcrocholl $
-- $Hash: a953c5923d8479249673e634437ee11e $

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

package body Boxes is

   -- Mutator to update the center of a box.
   procedure Set_Center
     (This   : access Box;                 -- The box to be updated.
      Center : in Vector := (0.0, 0.0)) is -- The new center of that box.
   begin
      This.Center := Center;
   end Set_Center;

   -- Accessor to read the center of a box.
   function Get_Center
     (This : access Box-- The box to read from.
     return Vector is    -- The center of that box.
   begin
      return This.Center;
   end Get_Center;

   -- Accessor to read the bounds of a box.
   function Get_Bounds
     (This : access Box-- The box to read from.
     return Rectangle is -- The bounds of that box.
   begin
      return This.Bounds;
   end Get_Bounds;

   -- Accessor to read the minimum width of a box.
   function Get_Minimum_Width
     (This : access Box-- The box to read from.
     return Real is      -- The minimum width of that box.
   begin
      return This.Minimum_Width;
   end Get_Minimum_Width;

   -- Accessor to read the optimum width of a box.
   function Get_Optimum_Width
     (This : access Box-- The box to read from.
     return Real is      -- The optimum width of that box.
   begin
      return This.Optimum_Width;
   end Get_Optimum_Width;

   procedure Print_Bounds
     (This   : access Box;                -- The box object instance.
      To     : access Printer'Class-- Use this printer.
      Center : in Vector) is              -- Center of container.
   begin
      Frame_Box(To, This.Bounds + Center + This.Center, 240);
   end Print_Bounds;

   procedure Add_Width
     (This  : access Box;               -- The box object instance.
      Inner : access Box'Class) is -- Add width from this box.
   begin
      This.Minimum_Width := This.Minimum_Width + Get_Minimum_Width(Inner);
      This.Optimum_Width := This.Optimum_Width + Get_Optimum_Width(Inner);
   end Add_Width;

   procedure Max_Bounds
     (This  : access Box;               -- The box object instance.
      Inner : access Box'Class) is -- Add width from this box.
   begin
      This.Bounds := Max(This.Bounds, Get_Bounds(Inner) + Get_Center(Inner));
   end Max_Bounds;

   procedure Estimate_Width
     (This : access Box) is -- The box object instance.
   begin
      This.Minimum_Width := Get_Width(This.Bounds);
      This.Optimum_Width := Get_Width(This.Bounds);
   end Estimate_Width;

   function Get_Left
     (This : access Box-- The box object instance.
     return Real is      -- The horizontal minimum coordinate.
   begin
      return This.Bounds.Left;
   end Get_Left;

   function Get_Top
     (This : access Box-- The box object instance.
     return Real is      -- The vertical minimum coordinate.
   begin
      return This.Bounds.Top;
   end Get_Top;

   function Get_Right
     (This : access Box-- The box object instance.
     return Real is      -- The horizontal maximum coordinate.
   begin
      return This.Bounds.Right;
   end Get_Right;

   function Get_Bottom
     (This : access Box-- The box object instance.
     return Real is      -- The vertical maximum coordinate.
   begin
      return This.Bounds.Bottom;
   end Get_Bottom;

end Boxes;