with Claw.Buttons;
with Claw.Fonts;
package Claw.Radio_Button is
    -- This package contains the Radio Button control.
    -- Note: This package creates single radio buttons.
    -- It generally more convenient to define an entire set of radio buttons
    -- as a single entity: use the package Claw.Radio_Button_Set for that.

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

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

    use type Claw.Buttons.Styles.Button_Style_Type;

    procedure Create (
	Button	   : in out Radio_Button_Type;
        Text	   : in String := "";
        Parent     : in out CLAW.Root_Window_Type'Class;
	Is_Automatic : in Boolean := False;
        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 Radio_Button Control of style, size, and parent.
	-- The button will be automatic if Is_Automatic is true.
	-- 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.

    procedure Create (
	Button	   : in out Radio_Button_Type;
        Text	   : in String := "";
        Parent     : in out Claw.Root_Window_Type'Class;
	Font	   : in out Claw.Fonts.Font_Type;
	Is_Automatic : in Boolean := False;
        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 Radio_Button Control of style, font, size, and parent.
	-- The button will be automatic if Is_Automatic is true.
	-- 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.

    procedure Modify (
	Button	   : in out Radio_Button_Type;
	Is_Automatic : in Boolean := False;
        Style      : in Claw.Buttons.Styles.Button_Style_Type :=
			    Claw.Buttons.Styles.Text);
        -- Modify an existing radio button control to have the new
	-- characteristics specified.
        -- Raises:
        --      Not_Valid_Error if Button 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 or Set_Icon can be used to modify the other initial items.

    procedure Set_Check (Button : in Radio_Button_Type;
			 Check  : in Claw.Buttons.Check_Type);
	-- Set the check state for Button.
        -- Raises:
        --      Not_Valid_Error if Button does not have a valid control,
	--		or if Check = UNKNOWN.
        --      Windows_Error if Windows returns an error.

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

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

    procedure Set_Text_Color (Button : in out Radio_Button_Type;
			      Color  : in Claw.Colors.Color_Type);
	-- Set Button 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 Button does not have a valid control.

    procedure Set_Colors (Button	   : in out Radio_Button_Type;
			  Text_Color       : in Claw.Colors.Color_Type;
			  Background_Color : in Claw.Colors.Color_Type);
	-- Set Button 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 button itself is fixed in Windows 4.x;
	-- for Windows 3.x, the text color is used.
        -- Raises:
        --      Not_Valid_Error if Button does not have a valid control.

    procedure Check_Radio_Button (Window       : in CLAW.Root_Window_Type'Class;
				  First_Button : in Identifier_Type;
				  Last_Button  : in Identifier_Type;
				  Check_Button : in Identifier_Type);
	-- Check the radio Check_Button, and remove the check from all of the
	-- other buttons between First_Button and Last_Button.
	-- Raises:
	--	Not_Valid_Error if Window does not have a valid window.
	--	Windows_Error if Windows returns an error.

    function Get_Checked_Radio_Button (Window	    : in CLAW.Root_Window_Type'Class;
				       First_Button : in Identifier_Type;
				       Last_Button  : in Identifier_Type) return Identifier_Type;
	-- Return the Id of the radio button which is currently checked
	-- of the group First_Button to Last_Button.
	-- Raises:
	--	Not_Valid_Error if Window does not have a valid window.
	--	Not_Found_Error if no button is checked, or the Ids do not
	--	identify a set of radio buttons.
	--	Windows_Error if Windows returns an error.


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

    procedure When_Initialize (Control : in out Radio_Button_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 Radio_Button_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.Radio_Button;