with Claw.Fonts;
package Claw.Groupbox is
--
-- CLAW - Class Library for Ada and Windows.
--
-- This package contains the Groupbox control.
--
-- 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.
-- Groupbox class
type Groupbox_Type is new CLAW.Root_Control_Type with private;
package Styles is
type Groupbox_Style_Type is private;
function DWORD_of (s : in Groupbox_Style_Type) return CLAW.DWORD;
-- Low-level access to styles.
function "+"(Left, Right : Groupbox_Style_Type) return Groupbox_Style_Type;
-- Combines two styles into a single styles value.
function "+"(Left : Claw.Styles.Window_Style_Type; Right : Groupbox_Style_Type)
return Groupbox_Style_Type;
-- Combines two styles into a single styles value.
function "+"(Left : Groupbox_Style_Type; Right : Claw.Styles.Window_Style_Type)
return Groupbox_Style_Type;
-- Combines two styles into a single styles value.
function ">="(Left, Right : Groupbox_Style_Type) return Boolean;
function ">="(Left : Groupbox_Style_Type; Right : Claw.Styles.Window_Style_Type)
return Boolean;
-- Read A >= B as A includes B.
-- That is, each set style in B is also in A.
function Groupbox_Style_of (S : in DWord) return Groupbox_Style_Type;
-- Create a style from a DWord for low-level use.
-- Groupbox Control Styles (note, these can be combined with most
-- Windows styles)
Normal : constant Groupbox_Style_Type; -- No special style.
Left : constant Groupbox_Style_Type; -- >= Win 4.0 only
Right : constant Groupbox_Style_Type; -- >= Win 4.0 only
Center : constant Groupbox_Style_Type; -- >= Win 4.0 only
Top : constant Groupbox_Style_Type; -- >= Win 4.0 only
Bottom : constant Groupbox_Style_Type; -- >= Win 4.0 only
Vertically_Center: constant Groupbox_Style_Type; -- >= Win 4.0 only
Multiline : constant Groupbox_Style_Type; -- >= Win 4.0 only
Flat : constant Groupbox_Style_Type; -- >= Win 4.0 only
private
-- Groupbox Styles
type Groupbox_Style_Type is new Claw.DWord;
Normal : constant Groupbox_Style_Type := 16#0000#; -- No special style.
Left : constant Groupbox_Style_Type := 16#0100#; -- >= Win 4.0 only
Right : constant Groupbox_Style_Type := 16#0200#; -- >= Win 4.0 only
Center : constant Groupbox_Style_Type := 16#0300#; -- >= Win 4.0 only
Top : constant Groupbox_Style_Type := 16#0400#; -- >= Win 4.0 only
Bottom : constant Groupbox_Style_Type := 16#0800#; -- >= Win 4.0 only
Vertically_Center: constant Groupbox_Style_Type := 16#0C00#; -- >= Win 4.0 only
Multiline : constant Groupbox_Style_Type := 16#2000#; -- >= Win 4.0 only
Flat : constant Groupbox_Style_Type := 16#8000#; -- >= Win 4.0 only
end Styles;
use type Claw.Groupbox.Styles.Groupbox_Style_Type; -- Make operators visible.
procedure Create (
Groupbox : in out Groupbox_Type;
Text : in String := "";
Parent : in out CLAW.Root_Window_Type'Class;
Style : in Claw.Groupbox.Styles.Groupbox_Style_Type :=
Claw.Styles.Child + Claw.Groupbox.Styles.Normal + Claw.Styles.Visible;
Extended_Style: in Claw.Styles.Extended_Window_Style_Type := Claw.Styles.None;
Position : in Point_Type := Use_Default_Control_Position;
Size : in Size_Type := Use_Default_Control_Size;
In_Dialog_Units : in Boolean := False;
Id : in Identifier_Type := 0);
-- Create a Groupbox Control of style, kind, size, and parent.
-- The position will be set relative to the parent window.
-- If Size is Use_Default_Size, it will be set to the size
-- of the parent window.
-- If In_Dialog_Units is True, then Size and Position are in
-- dialog units for Parent. Otherwise, they are in pixels.
-- The Id for the control is the value specified.
-- Raises:
-- Already_Valid_Error if the window is already valid.
-- Not_Valid_Error if the parent window is not already valid.
-- Windows_Error if Windows returns an error.
procedure Modify (
Groupbox : in out Groupbox_Type;
Style : in Claw.Groupbox.Styles.Groupbox_Style_Type := Claw.Groupbox.Styles.Normal);
-- Modify an existing groupbox to have the new characteristics
-- specified.
-- Raises:
-- Not_Valid_Error if Static does not have a valid control.
-- Windows_Error if Windows returns an error.
-- Usage Note: Claw.Window_Operations.Move can be used change the size
-- and position of this control (since a control IS a [root_]window).
-- Claw.Window_Operations.Size and Position can be used to
-- determine the current size and position.
-- Set_Text can be used to modify the other initial item.
procedure Set_Text (Groupbox : in out Groupbox_Type;
Text : in String);
-- Set the text for Groupbox.
-- Raises:
-- Not_Valid_Error if Window does not have a valid control.
-- Windows_Error if Windows returns an error.
function Get_Text (Groupbox : in Groupbox_Type) return String;
-- Get the text for Groupbox.
-- Raises:
-- Not_Valid_Error if Window does not have a valid control.
-- Windows_Error if Windows returns an error.
procedure Set_Font (Groupbox : in out Groupbox_Type;
Font : in out Claw.Fonts.Font_Type);
-- Set the font for Groupbox.
-- Raises:
-- Not_Valid_Error if Groupbox does not have a valid control,
-- or if Font is not valid.
-- Windows_Error if Windows returns an error.
function Get_Font (Groupbox : in Groupbox_Type) return Claw.Fonts.Font_Type;
-- Get the font for Groupbox.
-- Raises:
-- Not_Valid_Error if Groupbox does not have a valid control,
-- or if Groupbox uses the default font.
-- Windows_Error if Windows returns an error.
procedure Set_Default_Colors (Groupbox : in out Groupbox_Type);
-- Set Groupbox to use the default colors.
-- Raises:
-- Not_Valid_Error if Groupbox does not have a valid control.
procedure Set_Text_Color (Groupbox : in out Groupbox_Type;
Color : in Claw.Colors.Color_Type);
-- Set Groupbox to use Color as the text color; it will use the
-- background color of its parent window.
-- Raises:
-- Not_Valid_Error if Groupbox does not have a valid control.
procedure Set_Colors (Groupbox : in out Groupbox_Type;
Text_Color : in Claw.Colors.Color_Type;
Background_Color : in Claw.Colors.Color_Type);
-- Set Groupbox to use Text_Color as the text color and Background_Color
-- as the background color.
-- Raises:
-- Not_Valid_Error if Groupbox does not have a valid control.
-- Action routines:
procedure When_Initialize (Control : in out Groupbox_Type);
-- This procedure is called when the Control object is made valid.
-- Any overriding When_Initialize should call the parent routine
-- (as with most OOP overriding routines) before they do any other
-- initialization for types derived from Groupbox_Type.
-- Implementation note: This routine is called directly by Claw when
-- Claw is creating control objects; it is not called in response to
-- any Windows message.
private
type Groupbox_Type is new CLAW.Root_Control_Type with null record;
end Claw.Groupbox;