with Claw.Fonts;
package Claw.Attributes is
--
-- CLAW - Class Library for Ada and Windows.
--
-- This package contains properties for drawing classes.
--
-- Copyright 1996, 1997 R.R. Software, Inc.
-- P.O. Box 1512, Madison WI 53701
-- All rights reserved.
--
pragma Elaborate_Body; -- Insure that the body is elaborated before anyone
-- can call CLAW.
-- Background routines:
type Background_Mode_Type is (Error, Transparent, Opaque);
function Get_Background_Mode(Easel : in Claw.Root_Canvas_Type'Class)
return Background_Mode_Type;
-- Get the background mode for the canvas object.
-- Raises:
-- Not_Valid_Error if the canvas object is not open.
-- Constraint_Error if Windows returns an illegal value
procedure Set_Background_Mode(Easel : in Claw.Root_Canvas_Type'Class;
Mode : in Background_Mode_Type);
-- Set the background mode for the canvas object.
-- Raises:
-- Not_Valid_Error if the canvas object is not open.
function Get_Background_Color(Easel : in Claw.Root_Canvas_Type'Class)
return Claw.Colors.Color_Type;
-- Get the background color for the canvas object.
-- Raises:
-- Not_Valid_Error if the canvas object is not open.
procedure Set_Background_Color(Easel : in Claw.Root_Canvas_Type'Class;
Color : in Claw.Colors.Color_Type);
-- Set the background color for the canvas object.
-- Raises:
-- Not_Valid_Error if the canvas object is not open.
-- Note: Background colors must be a solid color. The nearest solid
-- color will be used.
-- Text routines:
function Get_Text_Color (Easel : in Claw.Root_Canvas_Type'Class)
return Claw.Colors.Color_Type;
-- Get the Text color for the canvas object.
-- Raises:
-- Not_Valid_Error if the canvas object is not open.
procedure Set_Text_Color (Easel : in Claw.Root_Canvas_Type'Class;
Color : in Claw.Colors.Color_Type);
-- Set the Text color for the canvas object.
-- Raises:
-- Not_Valid_Error if the canvas object is not open.
-- Note: Text colors must be a solid color. The nearest solid color
-- will be used.
type Horizontal_Alignment_Type is (Left, Right, Center);
type Vertical_Alignment_Type is (Top, Bottom, Baseline);
procedure Get_Text_Alignment (Easel : in Claw.Root_Canvas_Type'Class;
HAlign : out Horizontal_Alignment_Type;
VAlign : out Vertical_Alignment_Type;
Update_Position : out Boolean;
Right_to_Left : out Boolean);
-- Returns the current Text Alignment values.
-- Raises:
-- Not_Valid_Error if the canvas object is not open.
-- Windows_Error if Windows returns an error.
procedure Set_Text_Alignment (Easel : in Claw.Root_Canvas_Type'Class;
HAlign : in Horizontal_Alignment_Type := Left;
VAlign : in Vertical_Alignment_Type := Top;
Update_Position : in Boolean := FALSE;
Right_to_Left : in Boolean := FALSE);
-- Set the current text Alignment values.
-- These determine where the text starts writing from.
-- If Update_Position it True, the ending position of each write
-- is remembered, and used for the next Put. (The specified position
-- is ignored in this case). Right_to_Left is true for text which
-- reads in that direction.
-- Raises:
-- Not_Valid_Error if the canvas object is not valid.
-- Windows_Error if Windows returns an error.
-- Not_Supported_Error if Right_to_Left reading is set on
-- a version of Windows prior to 4.0.
procedure Set_Text_Justification (Easel : in Claw.Root_Canvas_Type'Class;
Extra_Space : in Claw.Int;
Break_Count : in Claw.Int);
-- Set the extra space for justification for the current line.
-- Extra_Space is the number of extra units (usually pixels) to
-- insert; Break_Count is the number of breaks in the line.
-- Raises:
-- Not_Valid_Error if the canvas object is not valid.
-- Windows_Error if Windows returns an error.
-- Text size routines:
function Size (Canvas : in Claw.Root_Canvas_Type'Class;
Character_Count : in Natural) return Claw.Size_Type;
-- Estimate the size of Character_Count characters in the font
-- currently selected into Canvas.
-- Raises:
-- Not_Valid_Error if the canvas object is not valid.
-- Windows_Error if Windows returns an error.
function Size (Canvas : in Claw.Root_Canvas_Type'Class;
Text : in String) return Claw.Size_Type;
-- Return the size of Text in the font currently selected into Canvas.
-- Raises:
-- Not_Valid_Error if the canvas object is not valid.
-- Windows_Error if Windows returns an error.
function Size (Window : in CLAW.Root_Window_Type'Class;
Character_Count : in Natural) return Claw.Size_Type;
-- Estimate the size of Character_Count characters for the
-- default font for Window.
-- Raises:
-- Not_Valid_Error if the window object is not valid.
-- Windows_Error if Windows returns an error.
function Size (Window : in CLAW.Root_Window_Type'Class;
Text : in String) return Claw.Size_Type;
-- Return the size of Text in the default font for Window.
-- Raises:
-- Not_Valid_Error if the window object is not valid.
-- Windows_Error if Windows returns an error.
function Size (Window : in CLAW.Root_Window_Type'Class;
Font : in Claw.Fonts.Font_Type'Class;
Character_Count : in Natural) return Claw.Size_Type;
-- Estimate the size of Character_Count characters for the
-- specified font for Window.
-- Raises:
-- Not_Valid_Error if the window or Font is not valid.
-- Windows_Error if Windows returns an error.
function Size (Window : in CLAW.Root_Window_Type'Class;
Font : in Claw.Fonts.Font_Type'Class;
Text : in String) return Claw.Size_Type;
-- Return the size of Text in the specified font for Window.
-- Raises:
-- Not_Valid_Error if the window or font is not valid.
-- Windows_Error if Windows returns an error.
function Points_to_Pixels (Canvas : in Claw.Root_Canvas_Type'Class;
Point_Size : in Claw.Int) return Claw.Int;
-- Calculate the pixel size of a given Point_Size for Canvas.
-- The result can be used directly in a logical font record.
-- Note: The result of this function is only reliable if Canvas is in
-- the standard mapping mode.
-- Raises:
-- Not_Valid_Error if Canvas is not valid.
function Points_to_Pixels (Window : in Claw.Root_Window_Type'Class;
Point_Size : in Claw.Int) return Claw.Int;
-- Calculate the pixel size of a given Point_Size for Window.
-- The result can be used directly in a logical font record.
-- Note: The result of this function is only reliable if Window is in
-- the standard mapping mode.
-- Raises:
-- Not_Valid_Error if Window is not valid.
-- Utility routines:
function Nearest_Solid_Color (Easel : in Claw.Root_Canvas_Type'Class;
Color : in Claw.Colors.Color_Type)
return Claw.Colors.Color_Type;
-- Returns the nearest solid color for Easel to the color passed in.
-- Raises:
-- Not_Valid_Error if the canvas object is not open.
-- Windows_Error if Windows returns an error.
function Nearest_Solid_Color (Window : in Claw.Root_Window_Type'Class;
Color : in Claw.Colors.Color_Type)
return Claw.Colors.Color_Type;
-- Returns the nearest solid color for Window to the color passed in.
-- Raises:
-- Not_Valid_Error if the window object is not open.
-- Windows_Error if Windows returns an error.
end Claw.Attributes;