with Claw.Buttons;
with Claw.Fonts;
package Claw.Checkbox is
    -- This package contains the Checkbox Button control.

    pragma Elaborate_Body; -- Insure that the body is elaborated before anyone
                           -- can call CLAW.

    type Checkbox_Type is new CLAW.Buttons.Root_Button_Type with private;

    type Checkbox_Kind_Type is (Normal, Three_State, Automatic, Automatic_Three_State);

    use type Claw.Buttons.Styles.Button_Style_Type;

    procedure Create (
	Box	   : in out Checkbox_Type;
        Text	   : in String := "";
        Parent     : in out CLAW.Root_Window_Type'Class;
	Kind	   : in Checkbox_Kind_Type := NORMAL;
        Style      : in Claw.Buttons.Styles.Button_Style_Type :=
			Claw.Styles.Child + Claw.Buttons.Styles.Text + 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 Checkbox 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
	-- text for text controls.
	-- 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.
	-- This form is used for text-containing buttons.
        -- 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.
	--	Not_Supported_Error if an attempt to use Icons or Bitmaps
	--	   when running on Windows 3.x (buttons cannot be drawn
	--	   with Icons or Bitmaps unless running on Windows 4.x).  Other
	--	   styles are not checked.

    procedure Create (
	Box	   : in out Checkbox_Type;
        Text	   : in String := "";
        Parent     : in out CLAW.Root_Window_Type'Class;
	Font	   : in out Claw.Fonts.Font_Type;
	Kind	   : in Checkbox_Kind_Type := NORMAL;
        Style      : in Claw.Buttons.Styles.Button_Style_Type :=
			Claw.Styles.Child + Claw.Buttons.Styles.Text + 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 Checkbox Control of style, kind, font, 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
	-- text for text controls.
	-- 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.
	-- This form is used for text-containing buttons.
        -- 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.
	--	Not_Supported_Error if an attempt to use Icons or Bitmaps
	--	   when running on Windows 3.x (buttons cannot be drawn
	--	   with Icons or Bitmaps unless running on Windows 4.x).  Other
	--	   styles are not checked.

    procedure Modify (
	Box	   : in out Checkbox_Type;
	Kind	   : in Checkbox_Kind_Type := NORMAL;
        Style      : in Claw.Buttons.Styles.Button_Style_Type :=
			    Claw.Buttons.Styles.Text);
        -- Modify an existing checkbox control to have the new characteristics
	-- specified.
        -- Raises:
        --      Not_Valid_Error if Box does not have a valid control.
        --      Windows_Error if Windows returns an error.
	--	Not_Supported_Error if an attempt to use Icons or Bitmaps
	--	   when running on Windows 3.x (buttons cannot be drawn
	--	   with Icons or Bitmaps unless running on Windows 4.x).  Other
	--	   styles are not checked.
        -- 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 or Set_Icon can be used to modify the other initial items.

    -- Inherits everything else, including Destroy, Set_Check, Get_Check,
    -- Is_Pushed, Set_Push_State, and When_Initialize.

    procedure Set_Default_Colors (Box : in out Checkbox_Type);
	-- Set Box to use the default colors.
        -- Raises:
        --      Not_Valid_Error if Box does not have a valid control.

    procedure Set_Text_Color (Box    : in out Checkbox_Type;
			      Color  : in Claw.Colors.Color_Type);
	-- Set Box to use Color as the text color; it will use the
	-- background color of its parent window. Color should be a solid color.
        -- Raises:
        --      Not_Valid_Error if Box does not have a valid control.

    procedure Set_Colors (Box		   : in out Checkbox_Type;
			  Text_Color       : in Claw.Colors.Color_Type;
			  Background_Color : in Claw.Colors.Color_Type);
	-- Set Box to use Text_Color as the text color and Background_Color
	-- as the background color. Both Text_Color and Background_Color should
	-- be a solid color.
	-- Note: The color of the box itself is fixed in Windows 4.x;
	-- for Windows 3.x, the text color is used.
        -- Raises:
        --      Not_Valid_Error if Box does not have a valid control.

private
    type Checkbox_Type is new CLAW.Buttons.Root_Button_Type with null record;

    procedure When_Initialize (Control : in out Checkbox_Type);
        -- This procedure is called when the Control object is made valid.
	-- This routine can be used to initialize the object for types derived
	-- from Checkbox_Type.
        -- 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 Root_Button_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.

end Claw.Checkbox;