package Claw.Pens is
--
-- CLAW - Class Library for Ada and Windows.
--
-- This package contains pen objects and operations.
--
-- Copyright 1996, 1997 R.R. Software, Inc.
-- P.O. Box 1512, Madison WI 53701
-- All rights reserved.
--
-- Simplified for Demo.
type Pen_Type is new Claw.Root_Tool_Type with private;
-- Normally one would declare objects like
-- Quill : constant Pen_Type := Create(...);
type Stock_Type is private;
White : constant Stock_Type;
Black : constant Stock_Type;
Null_Pen: constant Stock_Type;
package Styles is
-- Note: Use "=" to compare these types.
type Style_Type is private;
Solid : constant Style_Type;
Dash : constant Style_Type;
Dot : constant Style_Type;
Dash_Dot : constant Style_Type;
Dash_Dot_Dot: constant Style_Type;
Invisible : constant Style_Type;
Inside_Frame: constant Style_Type;
User_Style: constant Style_Type;
Alternate : constant Style_Type;
function To_Int (Style : in Style_Type) return Claw.Int;
-- Convert a Style to an Int for low-level use.
function To_Style (Value : in Claw.Int) return Style_Type;
-- Convert a value to a Style.
private
type Style_Type is new Int;
Solid : constant Style_Type := 0;
Dash : constant Style_Type := 1;
Dot : constant Style_Type := 2;
Dash_Dot : constant Style_Type := 3;
Dash_Dot_Dot: constant Style_Type := 4;
Invisible : constant Style_Type := 5;
Inside_Frame: constant Style_Type := 6;
User_Style: constant Style_Type := 7;
Alternate : constant Style_Type := 8;
end;
function Create (Stock : in Stock_Type) return Pen_Type;
-- Create a Pen Object for the specified stock pen.
-- Raises:
-- Windows_Error if Windows returns an error.
function Create (Style : in Styles.Style_Type;
Line_Width : in Natural;
Color : in Claw.Colors.Color_Type) return Pen_Type;
-- Create a Pen Object with the specified Color, Line_Width, and Style.
-- Raises:
-- Windows_Error if Windows returns an error.
-- Not_Supported_Error if Line_Width > 1, and Style is not
-- Solid, Invisible, or Inside_Frame.
-- Notes: Unless the style is Solid, the color must be a solid color.
-- (Use Claw.Attributes.Get_Nearest_Solid_Color to get the most
-- appropriate color).
-- A width of 0 will always provide a pen of one pixel wide.
procedure Destroy (Pen : in out Pen_Type);
-- Destroy a Pen object, deselecting it from any Canvases it is
-- in use in. The Pen object will be invalid after this call.
-- Raises:
-- Not_Valid_Error if the Pen is not valid.
-- Windows_Error if Windows returns an error.
procedure Initialize (Pen : in out Pen_Type);
-- Initialize Pen (for Controlled types; this routine need not
-- be called explicitly).
procedure Adjust (Pen : in out Pen_Type);
-- Adjust Pen (for Controlled types; this routine need not
-- be called explicitly).
procedure Finalize (Pen : in out Pen_Type);
-- Finalize Pen (for Controlled types; this routine need not
-- be called explicitly).
function Get_Handle (Pen : in Pen_Type) return Claw.Win32.HPen;
-- Returns the Pen handle for Pen.
-- Use this to get a handle in order to directly call the Win32 API.
-- Use of this routine is discouraged.
-- Raises:
-- Not_Valid_Error if Pen does not have a valid (Windows) Pen.
private
type Stock_Type is new Int;
White : constant Stock_Type:=6;
Black : constant Stock_Type:=7;
Null_Pen: constant Stock_Type:=8;
type Pen_Type is new Claw.Root_Tool_Type with record
Is_Stock: Boolean:=False;
end record;
end Claw.Pens;