with Claw, Claw.Brushes;
package Claw.Rectangles is
--
-- CLAW - Class Library for Ada and Windows.
--
-- This package holds rectangle-related classwide routines that are usable
-- with windows in the entire class hierarchy of Claw.Root_Window_Type,
-- and other rectangle manipulation routines.
--
--
-- Copyright 1996, 1997 R.R. Software, Inc.
-- P.O. Box 1512, Madison WI 53701
-- All rights reserved.
--
-- Edit History:
--
-- 8/22/96 - taK - Created package.
-- 8/24/96 - taK - Added a bunch of new routines.
-- 9/ 3/96 - RLB - Cleaned up, and renamed some routines.
-- 9/ 4/96 - RLB - Installed Root_Canvas_Type and Brush_Type.
-- 9/24/96 - RLB - Changed exception names.
-- 9/25/96 - taK - Added validity checks for Canvas and Brush parameters.
-- 9/27/96 - RLB - Changed a couple of obnoxious type names as suggested
-- by Do-While.
-- 9/29/96 - RLB - Changed some routine names as suggested by Do-While.
-- 2/ 2/97 - RLB - Added Scroll, moved full window Validate/Invalidate to WOp.
-- 3/ 4/97 - RLB - Updated for package changes.
-- 3/28/97 - RLB - Changed Get_Client_Area to Get_Original_Client_Area.
-- - RLB - Added Workspace_Area.
-- Basic rectangle operations:
-- Note: For assignment use Ada ":="; for equality, use Ada "=";
-- for creation, use an Ada aggregate.
procedure Offset (Rect: in out Claw.Rectangle_Type;
X,
Y: in Integer);
--
-- Moves the specified rectangle Rect by the specified offsets.
-- Raises:
-- Windows_Error if there is a problem.
--
procedure Subtract (Dest: out Claw.Rectangle_Type;
Src1,
Src2: in Claw.Rectangle_Type);
--
-- Obtains the coordinates of a rectangle determined by subtracting
-- one rectangle from another.
-- Raises:
-- Windows_Error if there is a problem.
--
function "-" (Left, Right: in Claw.Rectangle_Type)
return Claw.Rectangle_Type;
--
-- Return the rectangle determined by subtracting one rectangle from
-- another.
-- Raises:
-- Windows_Error if there is a problem.
--
procedure Inflate (Rect: in out Claw.Rectangle_Type;
X,
Y: in Integer);
--
-- Increases or decreases the width and height of the specified
-- rectangle. Adds X units to the left and right ends of the rectangle
-- and Y units to the top and bottom. The X and Y parameters are
-- signed values; positive values increase the width and height, and
-- negative values decrease them.
-- Raises:
-- Windows_Error if there is a problem.
--
procedure Set_To_Empty (Rect: out Claw.Rectangle_Type);
--
-- Creates an empty rectangle in which all coordinates are set to zero.
--
procedure Intersect (Dest: out Claw.Rectangle_Type;
Src1: in Claw.Rectangle_Type;
Src2: in Claw.Rectangle_Type);
--
-- Calculates the intersection of two source rectangles and places the
-- coordinates of the intersection rectangle into the destination
-- rectangle. If the source rectangles do not intersect, an empty
-- rectangle (in which all coordinates are set to zero) is placed into
-- the destination rectangle.
-- Raises:
-- Windows_Error if there is a problem.
--
function "and" (Left, Right: in Claw.Rectangle_Type)
return Claw.Rectangle_Type;
--
-- Calculates the intersection of two source rectangles and places the
-- coordinates of the intersection rectangle into the destination
-- rectangle. If the source rectangles do not intersect, an empty
-- rectangle (in which all coordinates are set to zero) is placed into
-- the destination rectangle.
-- Raises:
-- Windows_Error if there is a problem.
--
procedure Union (Dest: out Claw.Rectangle_Type;
Src1: in Claw.Rectangle_Type;
Src2: in Claw.Rectangle_Type);
--
-- Creates the union of two rectangles. The union is the smallest
-- rectangle that contains both source rectangles.
-- Raises:
-- Windows_Error if there is a problem.
--
function "or" (Left, Right: in Claw.Rectangle_Type)
return Claw.Rectangle_Type;
--
-- Creates the union of two rectangles. The union is the smallest
-- rectangle that contains both source rectangles.
-- Raises:
-- Windows_Error if there is a problem.
--
function Is_Empty (Rect: in Claw.Rectangle_Type) return Boolean;
--
-- Determines whether the specified rectangle is empty. A empty
-- rectangle is one that has no area; that is, the coordinate of the
-- right side is less than or equal to the coordinate of the left
-- side, or the coordinate of the bottom side is less than or equal to
-- the coordinate of the top side.
--
function Is_Point_In (Rect: in Claw.Rectangle_Type;
The_Point: in Claw.Point_Type) return Boolean;
--
-- Determines whether the specified point lies within the specified
-- rectangle. A point is within a rectangle if it lies on the left or
-- top side or is within all four sides. A point on the right or
-- bottom side is considered outside the rectangle.
--
procedure Fill (Canvas: in Claw.Root_Canvas_Type'Class;
Rect: in Claw.Rectangle_Type;
Brush: in Claw.Brushes.Brush_Type'Class);
--
-- Fills a rectangle by using the specified brush. This function
-- includes the left and top borders, but excludes the right and
-- bottom borders of the rectangle.
-- Raises:
-- Not_Valid_Error if Canvas or Brush are not valid.
-- Windows_Error if there is a problem.
--
procedure Frame (Canvas: in Claw.Root_Canvas_Type'Class;
Rect: in Claw.Rectangle_Type;
Brush: in Claw.Brushes.Brush_Type'Class);
--
-- Draws a border around the specified rectangle by using the
-- specified brush. The width and height of the border are always one
-- logical unit.
-- Raises:
-- Not_Valid_Error if Canvas or Brush are not valid.
-- Windows_Error if there is a problem.
--
procedure Invert (Canvas: in Claw.Root_Canvas_Type'Class;
Rect: in Claw.Rectangle_Type);
--
-- Inverts a rectangle in a window by performing a logical NOT
-- operation on the color values for each pixel in the rectangle's
-- interior.
-- Raises:
-- Not_Valid_Error if Canvas is not valid.
-- Windows_Error if there is a problem.
--
function Is_Visible (Canvas: in Claw.Root_Canvas_Type'Class;
Rect: in Claw.Rectangle_Type) return Boolean;
--
-- Determines whether any part of the specified rectangle lies within
-- the clipping region of a Canvas.
-- Raises:
-- Not_Valid_Error if Canvas is not valid.
--
--
-- Window-related rectangle functions:
--
procedure Adjust_For_Style (Rect: in out Claw.Rectangle_Type;
Style: in Claw.Styles.Window_Style_Type;
Has_Menu: in Boolean;
Extended_Style: in Claw.Styles.Extended_Window_Style_Type := Claw.Styles.None);
--
-- Calculates the required size of the rectangle of a window with
-- style and extended style based on the desired client-rectangle size.
-- The window rectangle can then be passed to a window Create
-- function to create a window whose client area is the desired size.
-- Raises:
-- Windows_Error if there is a problem.
--
function Get_Original_Client_Area (Window : in Claw.Root_Window_Type'Class)
return Claw.Rectangle_Type;
--
-- Get the client area (that is, the user area, not including menus,
-- borders, etc.) for the currently open window. This is the actual
-- client area, not a virtual one. Use Get_Client_Area for the size
-- of the virtual (user) client area.
-- Raises:
-- Not_Valid_Error if Window does not have an open (Windows) window.
-- Windows_Error if Windows returns an error.
--
function Get_Entire_Area (Window : in Claw.Root_Window_Type'Class) return Claw.Rectangle_Type;
--
-- Get the entire area (including menus, borders, etc.) for the
-- currently open window. For most uses, use Get_Client_Area instead.
-- Raises:
-- Not_Valid_Error if Window does not have an open (Windows) window.
-- Windows_Error if Windows returns an error.
--
-- Update area manipulation:
procedure Invalidate (Window : in Claw.Root_Window_Type'Class;
Rectangle : in Claw.Rectangle_Type;
Erase_Background : in Boolean := TRUE);
--
-- Invalidate the Rectangle area of the client area of Window,
-- erasing the background if Erase_Background is True.
-- This are will be redrawn on the next call to When_Draw, if it
-- is not validated first.
-- Raises:
-- Not_Valid_Error if Window does not have an open (Windows) window.
-- Windows_Error if Windows returns an error.
--
-- Note: A full window version of thise routine is found in Claw.Window_Operations.
procedure Validate (Window : in Claw.Root_Window_Type'Class;
Rectangle : in Claw.Rectangle_Type);
--
-- Validate the Rectangle area of the client area of Window.
-- This will prevent this area from being redrawn on the next call to
-- When_Draw.
-- Raises:
-- Not_Valid_Error if Window does not have an open (Windows) window.
-- Windows_Error if Windows returns an error.
--
-- Note: A full window version of thise routine is found in Claw.Window_Operations.
procedure Scroll (Window: in out Claw.Root_Window_Type'Class;
X_Amount: in Claw.Int;
Y_Amount: in Claw.Int;
Area: Rectangle_Type;
Clipping_Area: Rectangle_Type);
--
-- Scrolls Area in Window by X_Amount and Y_Amount, clipping as indicated.
-- (These values can be negative to scroll left and up; positive to
-- scroll right and down). The area of the window uncovered by the
-- scroll wil be invalidated, and a call will be made to When_Draw
-- to (re)draw it.
-- Raises:
-- Not_Valid_Error if Window does not have an open (Windows) window.
-- Windows_Error if Windows returns an error.
--
-- Note: A full window version of thise routine is found in Claw.Window_Operations.
--
-- System information routines.
--
function Workspace_Area return Rectangle_Type;
--
-- Returns the area of the workspace in screen coordinates.
-- The workspace is the usable area of the screen; it does not
-- include areas that are permanently covered (by the taskbar,
-- for example).
--
end Claw.Rectangles;