with Claw.Buttons;
package Claw.Draw_Button is
-- This package contains the User-drawn Button control.
pragma Elaborate_Body; -- Insure that the body is elaborated before anyone
-- can call CLAW.
type Draw_Button_Type is new CLAW.Buttons.Root_Button_Type with private;
use type Claw.Buttons.Styles.Button_Style_Type;
procedure Create (
Button : in out Draw_Button_Type;
Text : in String := "";
Parent : in out CLAW.Root_Window_Type'Class;
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 User-drawn Button Control of style, 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 (
Button : in out Draw_Button_Type;
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 When_Initialize (Control : in out Draw_Button_Type);
-- This procedure is called when the Control object is made valid.
-- This routine should be used to initialize the object for types
-- derived from Draw_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.
procedure When_Draw (Control : in out Draw_Button_Type;
Canvas : in out Root_Canvas_Type'Class;
Draw_Info : in Claw.Owner_Draw.Owner_Draw_Info_Type;
Use_Default: in out Boolean);
-- This procedure is called whenever an owner draw control needs
-- to be drawn. Draw_Info contains information about what to draw;
-- Canvas is the canvas to draw on. Use_Default should be set to
-- true if this routine did the necessary drawing, and false otherwise.
-- The default version of this routine always executes the default
-- action.
-- Implementation notes: This routine is called in response to the
-- WM_DRAWITEM message for controls; this message goes to the
-- parent object, but Claw redirects it here. Windows requires
-- Canvas to be left in its default state; Claw will reset it
-- to that state when this routine exits.
private
type Draw_Button_Type is new CLAW.Buttons.Root_Button_Type with null record;
end Claw.Draw_Button;