package Claw.Low_Level.Windows is
    --
    -- CLAW - Class Library for Ada and Windows.
    --
    -- This is the place where various commonly used low-level routines
    -- are collected.
    --
    -- This child package deals with Window manipulation and query routines.
    --
    -- It is a child of a private package, so it cannot be withed by user
    -- code.
    --
    -- Copyright 1996, 1997  R.R. Software, Inc.
    -- P.O. Box 1512, Madison WI  53701
    -- All rights reserved.
    --

    use Claw.Win32;

    -- function Create_Window_Ex (Ex_Style:        Dword;
    --                            Class_Name:      Lpcstr;
    --                            Window_Name:     Lpcstr;
    --                            Style   :        Claw.Styles.Window_Style_Type;
    --                            X,
    --                            Y       :        Long;
    --                            Width,
    --                            Height  :        Long;
    --                            Wnd_Parent:      Hwnd;
    --                            Menu    :        Hmenu;
    --                            Instance:        HInstance;
    --                            Param   :        Long) return Hwnd;
    -- pragma Import (StdCall, Create_Window_Ex, "CreateWindowExA");
    --
    -- function Destroy_Window(Wnd     :        Hwnd) return Bool;
    -- pragma Import (StdCall, Destroy_Window, "DestroyWindow");

    function Close_Window(Wnd     :        Hwnd) return Bool;
    pragma Import (StdCall, Close_Window, "CloseWindow");

    function Show_Window(Wnd     :        Hwnd;
                         Cmd_Show:        Claw.Codes.Show_Window_Type) return Bool;
    pragma Import (StdCall, Show_Window, "ShowWindow");

    function Update_Window (Wnd     :        Hwnd) return Bool;
    pragma Import (StdCall, Update_Window, "UpdateWindow");

    function Register_Class(Wnd_Class: access Wnd_Class_Type) return Atom;
    pragma Import (StdCall, Register_Class, "RegisterClassA");

    function Is_Window(Wnd     :        Hwnd) return Bool;
    pragma Import (StdCall, Is_Window, "IsWindow");

    function Is_Window_Enabled(Wnd     :        Hwnd) return Bool;
    pragma Import (StdCall, Is_Window_Enabled, "IsWindowEnabled");

    function Is_Window_Visible(Wnd     :        Hwnd) return Bool;
    pragma Import (StdCall, Is_Window_Visible, "IsWindowVisible");

    function Get_Class_Name (Wnd      : in Hwnd;
                             Name     : in Lpcstr;
			     Name_Len : in Int) return Int;
    pragma Import (StdCall, Get_Class_Name, "GetClassNameA");

    function Get_Parent (Wnd	: in HWnd) return HWnd;
    pragma Import (StdCall, Get_Parent, "GetParent");

    function Set_Parent (Child, New_Parent : in HWnd) return HWnd;
    pragma Import (StdCall, Set_Parent, "SetParent");

    function Get_Client_Rect (Wnd   : in Hwnd;
                              Rect  : access Rectangle_Type) return Bool;
    pragma Import (StdCall, Get_Client_Rect, "GetClientRect");

    function Get_Window_Rect (Wnd   : in Hwnd;
                              Rect  : access Rectangle_Type) return Bool;
    pragma Import (StdCall, Get_Window_Rect, "GetWindowRect");

    function Invalidate_Rect(Wnd     :        Hwnd;
                             Rect    :        access Rectangle_Type;
                             Erase   :        Bool) return Bool;
    pragma Import (StdCall, Invalidate_Rect, "InvalidateRect");

    function Invalidate_Client(Wnd     :        Hwnd;
                               Rect    :        Long := 0;
                               Erase   :        Bool) return Bool;
    pragma Import (StdCall, Invalidate_Client, "InvalidateRect");

    function Validate_Rect(Wnd     :        Hwnd;
                           Rect    :        access Rectangle_Type) return Bool;
    pragma Import (StdCall, Validate_Rect, "ValidateRect");

    function Validate_Client(Wnd     :        Hwnd;
                             Rect    :        Long := 0) return Bool;
    pragma Import (StdCall, Validate_Client, "ValidateRect");

    function Enable_Window (Wnd:	in HWnd;
    			    Enable:     in Bool) return Bool;
    pragma Import (StdCall, Enable_Window, "EnableWindow");

    function Set_Active_Window (Wnd:	in HWnd) return HWnd;
    pragma Import (StdCall, Set_Active_Window, "SetActiveWindow");

    function Get_Active_Window return HWnd;
    pragma Import (StdCall, Get_Active_Window, "GetActiveWindow");

    function Set_Focus(Wnd: in HWnd) return HWnd;
    pragma Import (StdCall, Set_Focus, "SetFocus");

    function Get_Focus return HWnd;
    pragma Import (StdCall, Get_Focus, "GetFocus");

    function Set_Foreground_Window (Wnd:	in HWnd) return Bool;
    pragma Import (StdCall, Set_Foreground_Window, "SetForegroundWindow");

    function Get_Foreground_Window return HWnd;
    pragma Import (StdCall, Get_Foreground_Window, "GetForegroundWindow");

    function Get_Window_Placement (Wnd:	    in HWnd;
				   Ptr:	    access Placement_Type)
				return Bool;
    pragma Import (StdCall, Get_Window_Placement, "GetWindowPlacement");

    function Set_Window_Placement (Wnd:	    in HWnd;
				   Ptr:	    access Placement_Type)
				return Bool;
    pragma Import (StdCall, Set_Window_Placement, "SetWindowPlacement");

    function Move_Window (Wnd:		in HWnd;
			  X,
			  Y,
			  Width,
			  Height:	in Int;
			  Repaint:	in Bool) return Bool;
    pragma Import (StdCall, Move_Window, "MoveWindow");

    function Scroll_Window (Wnd:		in HWnd;
			    X,
			    Y:	in Int;
			    Scroll: access Rectangle_Type;
			    Clip: access Rectangle_Type) return Bool;
    pragma Import (StdCall, Scroll_Window, "ScrollWindow");

    function Scroll_Window_2 (Wnd:		in HWnd;
			      X,
			      Y:	in Int;
			      SNull:	in Int := 0;
			      CNull:	in Int := 0) return Bool;
    pragma Import (StdCall, Scroll_Window_2, "ScrollWindow");


    function Bring_Window_To_Top (Wnd:	    in HWnd) return Bool;
    pragma Import (StdCall, Bring_Window_To_Top, "BringWindowToTop");

    function Set_Window_Pos (Wnd:		in HWnd;
			     WndInsertAfter:	in HWnd;
			     X,
			     Y,
			     CX,
			     CY:		in Int;
			     Flags:		in UInt) return Bool;
    pragma Import (StdCall, Set_Window_Pos, "SetWindowPos");

    function Flash_Window (Wnd:		in HWnd;
			   Invert:	in Bool) return Bool;
    pragma Import (StdCall, Flash_Window, "FlashWindow");

    function Get_Window_Text (Wnd:	    in HWnd;
			      lpString:	    in Lpcstr;
			      MaxCount:	    in Int) return Int;
    pragma Import (StdCall, Get_Window_Text, "GetWindowTextA");

    function Get_Window_Text_Length (Wnd:	in HWnd) return Int;
    pragma Import (StdCall, Get_Window_Text_Length, "GetWindowTextLengthA");

    function Set_Window_Text (Wnd:	in HWnd;
			      Str:	in Lpcstr) return Bool;
    pragma Import (StdCall, Set_Window_Text, "SetWindowTextA");

    function Get_Window (Wnd:	in HWnd;
			 Cmd:	in UInt) return HWnd;
    pragma Import (StdCall, Get_Window, "GetWindow");

    function Get_Top_Window (Wnd:	in HWnd) return HWnd;
    pragma Import (StdCall, Get_Top_Window, "GetTopWindow");

    type Enum_Child_Func_Type is access function (Wnd:     in HWnd;
						  L_Param: in LParam) return Bool;
    pragma Convention (StdCall, Enum_Child_Func_Type);

    function Enum_Child_Windows (Wnd:     in HWnd;
				 Func:	  in Enum_Child_Func_Type;
				 L_Param: in LParam) return Bool;
    pragma Import (StdCall, Enum_Child_Windows, "EnumChildWindows");

    function Is_Child (WndParent:	in HWnd;
		       Wnd:		in HWnd) return Bool;
    pragma Import (StdCall, Is_Child, "IsChild");

    function Is_Window_Unicode (Wnd:	in HWnd) return Bool;
    pragma Import (StdCall, Is_Window_Unicode, "IsWindowUnicode");

    function Is_Zoomed (Wnd:	in HWnd) return Bool;
    pragma Import (StdCall, Is_Zoomed, "IsZoomed");

    function Is_Iconic (Wnd:	in HWnd) return Bool;
    pragma Import (StdCall, Is_Iconic, "IsIconic");

    function Get_Last_Active_Popup (Wnd:	in HWnd) return Hwnd;
    pragma Import (StdCall, Get_Last_Active_Popup, "GetLastActivePopup");

    function Show_Owned_Popups (Wnd:	in HWnd;
				Show:	in Bool) return Bool;
    pragma Import (StdCall, Show_Owned_Popups, "ShowOwnedPopups");

    function Any_Popup return Bool;
    pragma Import (StdCall, Any_Popup, "AnyPopup");

    function Get_Desktop_Window return HWnd;
    pragma Import (StdCall, Get_Desktop_Window, "GetDesktopWindow");

    --function Window_From_Point (Point:    in Claw.Point_Type) return HWnd;
    -- Note: We cannot use the above because the standard defines the above
    -- as being passed by reference, not value as Win32 assumes.  (The ARG
    -- is planning on changing this, but we cannot assume that compilers are
    -- changed yet).  (The next two functions have the same problem).
    function Window_From_Point (Point_X,
			        Point_Y:    in Long) return HWnd;
    pragma Import (StdCall, Window_From_Point, "WindowFromPoint");

    function Child_Window_From_Point (Parent:	in HWnd;
				      Point_X,
				      Point_Y:    in Long) return HWnd;
    pragma Import (StdCall, Child_Window_From_Point, "ChildWindowFromPoint");

    function Child_Window_From_Point_Ex (Parent:    in HWnd;
				         Point_X,
				         Point_Y:    in Long;
					 Flags:	    in UInt) return HWnd;
    pragma Import (StdCall, Child_Window_From_Point_Ex, "ChildWindowFromPointEx");


    function Adjust_Window_Rect_Ex (Rect    :        access Rectangle_Type;
                                    Style   :        Dword;
                                    Menu    :        Bool;
                                    Ex_Style:        Dword) return Claw.Win32.Bool;
    pragma Import (StdCall, Adjust_Window_Rect_Ex, "AdjustWindowRectEx");

    function Fill_Rect (Dc      :        Hdc;
                        Rect    :        access Rectangle_Type;
                        Brush   :        Hbrush) return Int;
    pragma Import (StdCall, Fill_Rect, "FillRect");

    function Frame_Rect (Dc      :        Hdc;
                         Rect    :        access Rectangle_Type;
                         Brush   :        Hbrush) return Int;
    pragma Import (StdCall, Frame_Rect, "FrameRect");

    function Inflate_Rect(Rect    :        access Rectangle_Type;
                          X,
                          Y       :        Int) return Claw.Win32.Bool;
    pragma Import (StdCall, Inflate_Rect, "InflateRect");

    function Intersect_Rect(Dest_Rect:       access Rectangle_Type;
                            Src_1_Rect,
                            Src_2_Rect:      access Rectangle_Type) return Claw.Win32.Bool;
    pragma Import (StdCall, Intersect_Rect, "IntersectRect");

    function Invert_Rect(Dc      :        Hdc;
                         Rect    :        access Rectangle_Type) return Claw.Win32.Bool;
    pragma Import (StdCall, Invert_Rect, "InvertRect");

    function Is_Rect_Empty(Rect    :        access Rectangle_Type) return Claw.Win32.Bool;
    pragma Import (StdCall, Is_Rect_Empty, "IsRectEmpty");

    function Offset_Rect(Rect    :        access Rectangle_Type;
                         X,
                         Y       :        Int) return Bool;
    pragma Import (StdCall, Offset_Rect, "OffsetRect");

    function Pt_in_Rect(Rect    :        access Rectangle_Type;
                        Pt_X    :        Long;
			Pt_Y    :	 Long) return Bool;
    pragma Import (StdCall, Pt_in_Rect, "PtInRect");

    function Rect_Visible(Dc      :        Hdc;
                          Rect    :        access Rectangle_Type) return Bool;
    pragma Import (StdCall, Rect_Visible, "RectVisible");

    function Subtract_Rect (Dest_Rect,
                            Src_1_Rect,
                            Src_2_Rect:      access Rectangle_Type) return Bool;
    pragma Import (StdCall, Subtract_Rect, "SubtractRect");

    function Union_Rect (Dest_Rect,
                         Src_1_Rect,
                         Src_2_Rect:      access Rectangle_Type) return Bool;
    pragma Import (StdCall, Union_Rect, "UnionRect");

    function Get_Bounds_Rect (Dc : HDc;
	lprcBounds : access Rectangle_Type; Flags : UInt) return UInt;
    pragma Import (StdCall, Get_Bounds_Rect, "GetBoundsRect");

    function Set_Bounds_Rect (Dc : HDc;
	lprcBounds : access Rectangle_Type; Flags : UInt) return UInt;
    pragma Import (StdCall, Set_Bounds_Rect, "SetBoundsRect");

    function Exclude_Clip_Rect(Dc      :        HDc;
                               X1,
                               Y1,
                               X2,
                               Y2      :        Int) return Int;
    pragma Import (StdCall, Exclude_Clip_Rect, "ExcludeClipRect");

    function Get_Clip_Box(Dc      :        Hdc;
                          Rect    :        access Rectangle_Type) return Int;
    pragma Import (StdCall, Get_Clip_Box, "GetClipBox");

    function Intersect_Clip_Rect(Dc      :        Hdc;
                                 X1,
                                 Y1,
                                 X2,
                                 Y2      :        Int) return Int;
    pragma Import (StdCall, Intersect_Clip_Rect, "IntersectClipRect");

    -- Menu routines:

    function Create_Menu return Hmenu;
    pragma Import (StdCall, Create_Menu, "CreateMenu");

    function Create_Popup_Menu return Hmenu;
    pragma Import (StdCall, Create_Popup_Menu, "CreatePopupMenu");

    function SAppend_Menu(H       : in     Hmenu;
                          Flag    : in     Claw.UInt;
                          Id      : in     Claw.UInt;
                          String_Ptr: in   Lpcstr) return Claw.Win32.Bool;
    pragma Import (StdCall, SAppend_Menu, "AppendMenuA");

    function BAppend_Menu(H       : in     Hmenu;
                          Flag    : in     Claw.UInt;
                          Id      : in     Claw.UInt;
                          Hbitmap : in     Claw.Win32.Hbitmap) return Claw.Win32.Bool;
    pragma Import (StdCall, BAppend_Menu, "AppendMenuA");

    function PAppend_Menu(H       : in     Hmenu;
                          Flag    : in     Claw.UInt;
                          Submenu : in     Hmenu;
                          String_Ptr: in   Lpcstr) return Claw.Win32.Bool;
    pragma Import (StdCall, PAppend_Menu, "AppendMenuA");

    function IAppend_Menu(H       : in     Hmenu;
                          Flag    : in     Claw.UInt;
                          Id      : in     Claw.UInt;
                          Info    : in     Claw.Dword) return Claw.Win32.Bool;
    pragma Import (StdCall, IAppend_Menu, "AppendMenuA");

    function SInsert_Menu(H       : in     Hmenu;
			  Position: in     Claw.UInt;
                          Flag    : in     Claw.UInt;
                          Id      : in     Claw.UInt;
                          String_Ptr: in   Lpcstr) return Claw.Win32.Bool;
    pragma Import (StdCall, SInsert_Menu, "InsertMenuA");

    function BInsert_Menu(H       : in     Hmenu;
			  Position: in     Claw.UInt;
                          Flag    : in     Claw.UInt;
                          Id      : in     Claw.UInt;
                          Hbitmap : in     Claw.Win32.Hbitmap) return Claw.Win32.Bool;
    pragma Import (StdCall, BInsert_Menu, "InsertMenuA");

    function PInsert_Menu(H       : in     Hmenu;
			  Position: in     Claw.UInt;
                          Flag    : in     Claw.UInt;
                          Submenu : in     Hmenu;
                          String_Ptr: in   Lpcstr) return Claw.Win32.Bool;
    pragma Import (StdCall, PInsert_Menu, "InsertMenuA");

    function IInsert_Menu(H       : in     Hmenu;
			  Position: in     Claw.UInt;
                          Flag    : in     Claw.UInt;
                          Id      : in     Claw.UInt;
                          Info    : in     Claw.Dword) return Claw.Win32.Bool;
    pragma Import (StdCall, IInsert_Menu, "InsertMenuA");

    function Destroy_Menu(H : in Claw.Win32.Hmenu) return Claw.Win32.Bool;
    pragma Import (StdCall, Destroy_Menu, "DestroyMenu");

    function Remove_Menu (H : in Claw.Win32.Hmenu;
			  Position : in UInt;
			  How : in UInt) return Claw.Win32.Bool;
    pragma Import (StdCall, Remove_Menu, "RemoveMenu");

    function SModify_Menu(H       : in     Hmenu;
			  Position: in     Claw.UInt;
                          Flag    : in     Claw.UInt;
                          Id      : in     Claw.UInt;
                          String_Ptr: in   Lpcstr) return Claw.Win32.Bool;
    pragma Import (StdCall, SModify_Menu, "ModifyMenuA");

    function PModify_Menu(H       : in     Hmenu;
			  Position: in     Claw.UInt;
                          Flag    : in     Claw.UInt;
                          Submenu : in     Claw.Win32.HMenu;
                          String_Ptr: in   Lpcstr) return Claw.Win32.Bool;
    pragma Import (StdCall, PModify_Menu, "ModifyMenuA");

    function BModify_Menu(H       : in     Hmenu;
			  Position: in     Claw.UInt;
                          Flag    : in     Claw.UInt;
                          Id      : in     Claw.UInt;
                          Bitmap  : in     Claw.Win32.HBitmap) return Claw.Win32.Bool;
    pragma Import (StdCall, BModify_Menu, "ModifyMenuA");

    function Draw_Menu_Bar(Window_Handle : in Claw.Win32.HWnd) return Claw.Win32.Bool;
    pragma Import (StdCall, Draw_Menu_Bar, "DrawMenuBar");

    function Track_Popup_Menu(Menu      : in Claw.Win32.HMenu;
                              Flag_Set  : in Claw.UInt;
                              X, Y      : in Claw.Int;
                              Must_Be_0 : in Claw.Int := 0;
                              Wnd       : in Claw.Win32.HWnd;
                              Live_Area : access Claw.Rectangle_Type)
					    return Claw.Win32.Bool;
    pragma Import (StdCall, Track_Popup_Menu, "TrackPopupMenu");

    function Track_Popup_Menu_N(Menu      : in Claw.Win32.HMenu;
                                Flag_Set  : in Claw.UInt;
                                X, Y      : in Claw.Int;
                                Must_Be_0 : in Claw.Int := 0;
                                Wnd       : in Claw.Win32.HWnd;
                                Null_Area : in Claw.Int := 0)
	    return Claw.Win32.Bool;
    pragma Import (StdCall, Track_Popup_Menu_N, "TrackPopupMenu");

    type TPM_Info_Type is record
	Size	: Claw.UInt := 20;
	Exclude	: Claw.Rectangle_Type;
    end record;

    function Track_Popup_Menu_Ex (Menu      : in Claw.Win32.HMenu;
				  Flag_Set  : in Claw.UInt;
				  X, Y      : in Claw.Int;
				  Wnd       : in Claw.Win32.HWnd;
				  Live_Area : access TPM_Info_Type)
	    return Claw.Win32.Bool;
    pragma Import (StdCall, Track_Popup_Menu_Ex, "TrackPopupMenuEx");

    function Check_Menu_Item(H     : in Claw.Win32.HMenu;
                             Which : in Claw.UInt;
                             Flag  : in Claw.UInt) return Claw.UInt;
    pragma Import (StdCall, Check_Menu_Item, "CheckMenuItem");

    function Get_Menu_State(H     : in Claw.Win32.HMenu;
                            Which : in Claw.UInt;
                            Flag  : in Claw.UInt) return Claw.UInt;
    pragma Import (StdCall, Get_Menu_State, "GetMenuState");

    function Enable_Menu_Item(H     : in Claw.Win32.HMenu;
                              Which : in Claw.UInt;
                              Flag  : in Claw.UInt) return Claw.UInt;
    pragma Import (StdCall, Enable_Menu_Item, "EnableMenuItem");

    function Hilite_Menu_Item(W     : in Claw.Win32.HWnd;
                              H     : in Claw.Win32.HMenu;
                              Which : in Claw.UInt;
                              Flag  : in Claw.UInt) return Claw.Win32.Bool;
    pragma Import (StdCall, Hilite_Menu_Item, "HiliteMenuItem");


    function Check_Menu_Radio_Item(H     : in Claw.Win32.HMenu;
                                   First, Last, Which : in Claw.UInt;
                                   Flag  : in Claw.UInt) return Claw.Win32.Bool;
    pragma Import (StdCall, Check_Menu_Radio_Item, "CheckMenuRadioItem");


    function Menu_Item_From_Point (W : in Claw.Win32.HWnd;
				   M : in Claw.Win32.HMenu;
				   X, Y : in Claw.Long)
				    return Claw.Int;
    -- See note re Claw.Point in Claw.Low_Level.Windows.Window_From_Point
    pragma Import (StdCall, Menu_Item_From_Point, "MenuItemFromPoint");

    function Get_Menu_Check_Mark_Dimensions return Claw.Long;
    pragma Import (StdCall, Get_Menu_Check_Mark_Dimensions, "GetMenuCheckMarkDimensions");

    function Set_Menu_Item_Bitmaps (H     : in Claw.Win32.HMenu;
				    Which : in Claw.UInt;
				    Flag  : in Claw.UInt;
				    Checked : in Claw.Win32.HBitmap;
				    Unchecked : in Claw.Win32.HBitmap) return Claw.Win32.Bool;
    pragma Import (StdCall, Set_Menu_Item_Bitmaps, "SetMenuItemBitmaps");

    function Set_Menu_Default_Item (H     : in Claw.Win32.HMenu;
				    Which : in Claw.UInt;
				    fByPos: in Claw.UInt) return Claw.Win32.Bool;
    pragma Import (StdCall, Set_Menu_Default_Item, "SetMenuDefaultItem");
    -- Note: fByPos is not MF_BYxxx, but is a Bool passed as a UInt.
    -- Which is either an item or a position.
    -- This is a Windows 4.0 only function.

    function Get_Menu_Default_Item(H : in Claw.Win32.HMenu;
				   uByPos : in Claw.UInt;
				   How : in Claw.UInt) return Claw.UInt;
    -- Note: uByPos is not MF_BYxxx, but is a Bool passed as a UInt.
    -- How is zero or more of the following flag values:
    --  Use_Disabled : UInt := 1;
    --	Go_Into_Popups : UInt := 2;
    -- This is a Windows 4.0 only function.
    pragma Import (StdCall, Get_Menu_Default_Item, "GetMenuDefaultItem");

    function Get_Menu_Item_Rect(W : in Claw.Win32.HWnd;
                                M : in Claw.Win32.HMenu;
                                uItem : in Claw.UInt;
                                lprcItem : access Claw.Rectangle_Type)
					    return Claw.Win32.Bool;
    pragma Import (StdCall, Get_Menu_Item_Rect, "GetMenuItemRect");

    function Get_Menu_Item_Count (M : in Claw.Win32.HMenu) return Claw.Int;
    pragma Import (StdCall, Get_Menu_Item_Count, "GetMenuItemCount");

    function Get_Menu_Item_Id (M : in Claw.Win32.HMenu;
			       Pos : in Claw.Int) return Claw.UInt;
    pragma Import (StdCall, Get_Menu_Item_Id, "GetMenuItemID");

    type Menu_Item_Info_Type is record
	Size	: Claw.UInt := 44;
	Mask	: Claw.UInt;
	MType	: Claw.UInt;
	State	: Claw.UInt;
	Id	: Claw.UInt;
	SubMenu : Claw.Win32.HMenu;
	Checked : Claw.Win32.HBitmap;
	Unchecked:Claw.Win32.HBitmap;
	Item_Data:Claw.DWord;
	Type_Data:Claw.Win32.LPCStr; -- or a bitmap handle when MType is set for that.
	Count	: Claw.UInt; -- Length of text value.
    end record;
    for Menu_Item_Info_Type use record
	Size	at  0 range 0 .. 31;
	Mask	at  4 range 0 .. 31;
	MType	at  8 range 0 .. 31;
	State	at 12 range 0 .. 31;
	Id	at 16 range 0 .. 31;
	Submenu	at 20 range 0 .. 31;
	Checked	at 24 range 0 .. 31;
	UnChecked at 28 range 0 .. 31;
	Item_Data at 32 range 0 .. 31;
	Type_Data at 36 range 0 .. 31;
	Count	at 40 range 0 .. 31;
    end record;

    -- Flag values for Mask:
    MIIM_CHECKMARKS : constant Claw.UInt := 16#0008#;
	-- Retrieves or sets the Checked and Unchecked components.
    MIIM_DATA	    : constant Claw.UInt := 16#0020#;
	-- Retrieves or sets the Item_Data component.
    MIIM_ID	    : constant Claw.UInt := 16#0002#;
	-- Retrieves or sets the Id component.
    MIIM_STATE	    : constant Claw.UInt := 16#0001#;
	-- Retrieves or sets the State component.
    MIIM_SUBMENU    : constant Claw.UInt := 16#0004#;
	-- Retrieves or sets the Submenu component.
    MIIM_TYPE	    : constant Claw.UInt := 16#0010#;
	-- Retrieves or sets the MType and Type_Data components.

    function Get_Menu_Item_Info (M : in Claw.Win32.HMenu;
			         Pos : in Claw.UInt;
				 By_Pos : in Claw.Win32.Bool; -- FALSE = Pos = Menu ID; otherwise it is a position.
				 Info : access Menu_Item_Info_Type)
			return Claw.Win32.Bool;
    pragma Import (StdCall, Get_Menu_Item_Info, "GetMenuItemInfoA");

    function Set_Menu_Item_Info (M : in Claw.Win32.HMenu;
			         Pos : in Claw.UInt;
				 By_Pos : in Claw.Win32.Bool; -- FALSE = Pos = Menu ID; otherwise it is a position.
				 Info : access Menu_Item_Info_Type)
			return Claw.Win32.Bool;
    pragma Import (StdCall, Set_Menu_Item_Info, "SetMenuItemInfoA");

    function Insert_Menu_Item (M : in Claw.Win32.HMenu;
			       Pos : in Claw.UInt;
			       By_Pos : in Claw.Win32.Bool; -- FALSE = Pos = Menu ID; otherwise it is a position.
			       Info : access Menu_Item_Info_Type)
			return Claw.Win32.Bool;
    pragma Import (StdCall, Insert_Menu_Item, "InsertMenuItemA");
	-- Inserts in front of the specified Pos.  All of the other
	-- Append and Insert routines are obsolete or obsolesent.

    function Get_Submenu (M : in Claw.Win32.HMenu;
			  Pos : in Claw.Int) return Claw.Win32.HMenu;
    pragma Import (StdCall, Get_Submenu, "GetSubMenu");


    function Load_Menu (Instance : in HInstance;
                        Menu_Name: in Lpcstr) return Hmenu;
    pragma Import (StdCall, Load_Menu, "LoadMenuA");

    function Get_Menu (Wnd    : in Hwnd) return Hmenu;
    pragma Import (StdCall, Get_Menu, "GetMenu");

    function Set_Menu (Wnd    : in Hwnd;
                       Menu   : in Hmenu) return Bool;
    pragma Import (StdCall, Set_Menu, "SetMenu");

    function Get_System_Menu (Wnd    : in Hwnd;
			      Revert : in Bool) return Hmenu;
    pragma Import (StdCall, Get_System_Menu, "GetSystemMenu");

    -- Caret routines:
    function Create_Caret (Wnd   : in HWnd;
			   Bitmap: in HBitmap;
			   Width : in Int;
			   Height: in Int) return Bool;
    pragma Import (StdCall, Create_Caret, "CreateCaret");

    -- Special bitmap parameter values:
    BLACK_CARET : constant HBitmap := 0;
    GRAY_CARET  : constant HBitmap := 1;

    function Destroy_Caret return Bool;
    pragma Import (StdCall, Destroy_Caret, "DestroyCaret");

    function Hide_Caret (Wnd   : in HWnd) return Bool;
    pragma Import (StdCall, Hide_Caret, "HideCaret");

    function Show_Caret (Wnd   : in HWnd) return Bool;
    pragma Import (StdCall, Show_Caret, "ShowCaret");

    function Get_Caret_Pos (Point : access Point_Type) return Bool;
    pragma Import (StdCall, Get_Caret_Pos, "GetCaretPos");

    function Set_Caret_Pos (X   : in Int;
			    Y   : in Int) return Bool;
    pragma Import (StdCall, Set_Caret_Pos, "SetCaretPos");

    function Get_Caret_Blink_Time return UInt;
    pragma Import (StdCall, Get_Caret_Blink_Time, "GetCaretBlinkTime");

    function Set_Caret_Blink_Time (Milliseconds : in UInt) return Bool;
    pragma Import (StdCall, Set_Caret_Blink_Time, "SetCaretBlinkTime");

end Claw.Low_Level.Windows;