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

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

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

    use type Claw.Buttons.Styles.Button_Style_Type;

    procedure Create (
	Button	   : in out Button_Type;
        Text	   : in String := "";
        Parent     : in out CLAW.Root_Window_Type'Class;
	Default	   : 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 Button Control of style, size, and parent.
	-- The Button will be a default push button if Default is True, and a
	-- standard push button otherwise.
	-- 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).

    procedure Create (
	Button	   : in out Button_Type;
        Text	   : in String := "";
        Parent     : in out Claw.Root_Window_Type'Class;
	Font	   : in out Claw.Fonts.Font_Type;
	Default	   : 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 Button Control of style, font, size, and parent.
	-- The Button will be a default push button if Default is True, and a
	-- standard push button otherwise.
	-- 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).

    procedure Modify (
	Button	   : in out Button_Type;
	Default	   : in Boolean := FALSE;
        Style      : in Claw.Buttons.Styles.Button_Style_Type :=
			    Claw.Buttons.Styles.Text);
        -- Modify an existing 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.
	--	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.

    procedure Set_Check (Button : in Button_Type;
			 Check  : in Claw.Buttons.Check_Type);
	-- Set the check state for Button.
        -- Raises:
        --      Not_Valid_Error always; Push buttons do not have a check state.

    function Get_Check (Button : in Button_Type) return Claw.Buttons.Check_Type;
	-- Get the check state for Button.
        -- Raises:
        --      Not_Valid_Error always; Push buttons do not have a check state.

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

    -- Note: Windows does not allow custom colors for push buttons.
    -- To use non-default colors for a push button, a user-defined
    -- Draw_Button_Type must be used.

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

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