Hosted by
 |
package body Boxes is
procedure Set_Center
(This : access Box;
Center : in Vector := (0.0, 0.0)) is
begin
This.Center := Center;
end Set_Center;
function Get_Center
(This : access Box)
return Vector is
begin
return This.Center;
end Get_Center;
function Get_Bounds
(This : access Box)
return Rectangle is
begin
return This.Bounds;
end Get_Bounds;
function Get_Minimum_Width
(This : access Box)
return Real is
begin
return This.Minimum_Width;
end Get_Minimum_Width;
function Get_Optimum_Width
(This : access Box)
return Real is
begin
return This.Optimum_Width;
end Get_Optimum_Width;
procedure Print_Bounds
(This : access Box;
To : access Printer'Class;
Center : in Vector) is
begin
Frame_Box(To, This.Bounds + Center + This.Center, 240);
end Print_Bounds;
procedure Add_Width
(This : access Box;
Inner : access Box'Class) is
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;
Inner : access Box'Class) is
begin
This.Bounds := Max(This.Bounds, Get_Bounds(Inner) + Get_Center(Inner));
end Max_Bounds;
procedure Estimate_Width
(This : access Box) is
begin
This.Minimum_Width := Get_Width(This.Bounds);
This.Optimum_Width := Get_Width(This.Bounds);
end Estimate_Width;
function Get_Left
(This : access Box)
return Real is
begin
return This.Bounds.Left;
end Get_Left;
function Get_Top
(This : access Box)
return Real is
begin
return This.Bounds.Top;
end Get_Top;
function Get_Right
(This : access Box)
return Real is
begin
return This.Bounds.Right;
end Get_Right;
function Get_Bottom
(This : access Box)
return Real is
begin
return This.Bounds.Bottom;
end Get_Bottom;
end Boxes;
|