package Claw.Window_Operations is

    --
    -- CLAW - Class Library for Ada and Windows.
    --
    -- This package holds classwide routines that are usable with windows
    -- in the entire class hierarchy of Claw.Root_Window_Type.
    --
    --
    -- Copyright 1996, 1997  R.R. Software, Inc.
    -- P.O. Box 1512, Madison WI  53701
    -- All rights reserved.
    --
    -- Simplified for Demo.

    procedure Minimize (Window:	in out Claw.Root_Window_Type'Class);
	--
	-- Minimize the window Window.
	-- Raises:
        --      Not_Valid_Error if Window does not have an open (Windows) window.
        --      Windows_Error if Windows returns an error.
	--

    procedure Enable (Window:	in out Claw.Root_Window_Type'Class);
	--
	-- Enables keyboard and mouse input to the specified window or
	-- control.
	-- Raises:
        --      Not_Valid_Error if Window does not have an open (Windows) window.
        --      Windows_Error if Windows returns an error.
	--

    procedure Disable (Window:	in out Claw.Root_Window_Type'Class);
	--
	-- Disables keyboard and mouse input to the specified window or
	-- control.
	-- Raises:
        --      Not_Valid_Error if Window does not have an open (Windows) window.
        --      Windows_Error if Windows returns an error.
	--

    function Is_Enabled (Window:  in Claw.Root_Window_Type'Class) return Boolean;
	--
	-- Return TRUE if Window is enabled, FALSE if not.
	-- Returns FALSE is the window is invalid.
	--

    procedure Set_Active (Window:  in Claw.Root_Window_Type'Class);
	--
	-- Set top level window Window associated with the thread to be the
	-- active window.
	-- Raises:
        --      Not_Valid_Error if Window does not have an open (Windows) window.
        --      Windows_Error if Windows returns an error.
	--

    function Get_Active return Claw.Root_Window_Type'Class;
	--
	-- Get the window object of the active window associated with the
	-- thread and return it.
	-- Raises:
        --      Windows_Error if Windows returns an error.
	--

    function Is_Foreground(Window : in Claw.Root_Window_Type'Class) return Boolean;
        -- return True if Window is in the foreground (the window
        -- with which the user is currently working).
        -- Raises
        --      Windows_Error if Windows returns an error.
        -- Note: return False if Window is not valid.

    procedure Set_Foreground (Window: in out Claw.Root_Window_Type'Class);
	--
	-- Puts the thread that created the specified window into the
	-- foreground and actives the window.
	-- Raises:
        --      Not_Valid_Error if Window does not have an open (Windows) window.
        --      Windows_Error if Windows returns an error.
	--

    function Get_Foreground return Claw.Root_Window_Type'Class;
	--
	-- Returns the window object of the foreground window (the window
	-- with which the user is currently working).
	-- Raises:
        --      Windows_Error if Windows returns an error.
	--

    procedure Set_Focus (Window: in out Claw.Root_Window_Type'Class);
	--
	-- Sets the keyboard focus to the specified window.
	-- Raises:
        --      Not_Valid_Error if Window does not have an open (Windows) window.
        --      Windows_Error if Windows returns an error.
	--

    function Get_Focus return Claw.Root_Window_Type'Class;
	--
	-- Returns the (CLAW) window object which has the keyboard
	-- focus.
	-- Raises:
        --      Windows_Error if Windows returns an error or no window
	--	    has the keyboard focus.
	--

    function Has_Focus (Window : in Claw.Root_Window_Type'Class) return Boolean;
	--
	-- Returns if window has the keyboard focus.
	-- Raises:
        --      Not_Valid_Error if Window does not have an open (Windows) window.
        --      Windows_Error if Windows returns an error.
	--

    function Size (Window: in Claw.Root_Window_Type'Class)
	return Claw.Size_Type;
	--
        -- Returns the current size of the window.  This includes all borders,
	-- captions, menu bars, etc.  For just the client (usable area) size,
	-- use Client_Size instead.
	-- Raises:
        --      Not_Valid_Error if Window does not have an open (Windows) window.
        --      Windows_Error if Windows returns an error.

    function Client_Size (Window: in Claw.Root_Window_Type'Class)
	return Claw.Size_Type;
	--
        -- Returns the current client area size of the window.  This respects
	-- any redefinition of the client area by Get_Client_Area.
	-- Raises:
        --      Not_Valid_Error if Window does not have an open (Windows) window.
        --      Windows_Error if Windows returns an error.

    function Position (Window:	in Claw.Root_Window_Type'Class)
			return Claw.Point_Type;
	--
        -- Returns the current position of the window.  This will be in
	-- client coordinates if Window is a child window, and screen
	-- coordinates otherwise.
	-- Raises:
        --      Not_Valid_Error if Window does not have an open (Windows) window.
        --      Windows_Error if Windows returns an error.

    procedure Move (Window:	in out Claw.Root_Window_Type'Class;
		    Position:	in Claw.Point_Type;
		    Size:	in Claw.Size_Type;
		    Redraw:	in Boolean);
	--
        -- Changes the position and dimensions of the specified window. For a
	-- top-level window, the position and dimensions are relative to the
	-- upper-left corner of the screen. For a child window, they are
	-- relative to the upper-left corner of the parent window's client
	-- area.
	-- Raises:
        --      Not_Valid_Error if Window does not have an open (Windows) window.
        --      Windows_Error if Windows returns an error.
	--

    procedure Show (Window:	in out Claw.Root_Window_Type'Class;
		    How:	in     Claw.Codes.Show_Window_Type);
	--
	-- Sets the specified window's show state to 'How'.
	-- Use How = Show_Startup on the first call to this routine for
	-- the main application window (How = Show_Startup is invalid for
	-- other kinds of Windows).
	-- Raises:
        --      Not_Valid_Error if Window does not have an open (Windows) window.
	--	Not_Found_Error if the window type does not support the window state.
        --      Windows_Error if Windows returns an error.
	-- Implementation Note: This routine dispatches to the appropriate
	-- primitive operation.  This duplicate definition is here to minimize
	-- surprises.

    procedure Update (Window:	in out Claw.Root_Window_Type'Class);
	--
	-- Updates the client area of the specified window by calling When_Draw
	-- for the window if the window's update region is not empty.
	-- Raises:
        --      Not_Valid_Error if Window does not have an open (Windows) window.
        --      Windows_Error if Windows returns an error.
	--

    procedure Invalidate (Window    : in Claw.Root_Window_Type'Class;
			  Erase_Background : in Boolean := TRUE);
	--
	-- Invalidate the entiree client area of Window,
	-- erasing the background if Erase_Background is True.
	-- This are will be redrawn on the next call to When_Draw, if it
	-- is not validated first.
	-- Raises:
	--	Not_Valid_Error if Window does not have an open (Windows) window.
	--	Windows_Error if Windows returns an error.
	--

    procedure Validate (Window    : in Claw.Root_Window_Type'Class);
	--
	-- Validate the entire client area of Window.
	-- This will prevent an immediate call to When_Draw.
	-- Raises:
	--	Not_Valid_Error if Window does not have an open (Windows) window.
	--	Windows_Error if Windows returns an error.
	--

    package Locations is
        type Location_Flag_Type is private;
        Draw_Frame  : constant Location_Flag_Type; -- Tell the window to draw its frame.
        Hide_Window : constant Location_Flag_Type; -- Hide the window.
        No_Activate : constant Location_Flag_Type; -- do not activate the window.
        No_Copy_Bits: constant Location_Flag_Type; -- The client contents are discarded.
        No_Move	    : constant Location_Flag_Type; -- Don't move the window
						   -- (the Position parameter is ignored).
        No_Size	    : constant Location_Flag_Type; -- Don't resize the window
						   -- (the Size parameter is ignored).
        No_Redraw   : constant Location_Flag_Type; -- Don't redraw the window.
        No_Z_Order  : constant Location_Flag_Type; -- Don't change the window's position in the Z-Order
						   -- (the Insert_After/Insert_Mode parameter is ignored).
        Show_Window : constant Location_Flag_Type; -- Show the window.
        No_Owner_Z_Order: constant Location_Flag_Type; -- Don't change the owner's position in the Z-Order.
        No_Send_Changing: constant Location_Flag_Type; -- Don't set a position changing message.

        function "+" (Left, Right: in Location_Flag_Type) return Location_Flag_Type;
        function "-" (Left, Right: in Location_Flag_Type) return Location_Flag_Type;
        function ">=" (Left, Right : in Location_Flag_Type) return Boolean;
	function UInt_of (Value : in Location_Flag_Type) return UInt;
	function Flag_of (Value : in UInt) return Location_Flag_Type;
    private
        type Location_Flag_Type is new UInt;
        Draw_Frame	: constant Location_Flag_Type := 16#0020#;
        Hide_Window	: constant Location_Flag_Type := 16#0080#;
        No_Activate	: constant Location_Flag_Type := 16#0010#;
        No_Copy_Bits	: constant Location_Flag_Type := 16#0100#;
        No_Move		: constant Location_Flag_Type := 16#0002#;
        No_Size		: constant Location_Flag_Type := 16#0001#;
        No_Redraw	: constant Location_Flag_Type := 16#0008#;
        No_Z_Order	: constant Location_Flag_Type := 16#0004#;
        Show_Window	: constant Location_Flag_Type := 16#0040#;
        No_Owner_Z_Order: constant Location_Flag_Type := 16#0200#;
        No_Send_Changing: constant Location_Flag_Type := 16#0400#;
	-- These last two aren't in the current Windows documentation, so
	-- we've omitted them above.
        Defer_Erase	: constant Location_Flag_Type := 16#2000#;
        Asynchronous_Window_Position : constant Location_Flag_Type := 16#4000#;
    end Locations;

    procedure Set_Location (Window:	  in out Claw.Root_Window_Type'Class;
		            Insert_After: in Claw.Root_Window_Type'Class;
		            Position:     in Claw.Point_Type;
		            Size:	  in Claw.Size_Type;
		            Flags:	  in Locations.Location_Flag_Type);
	--
	-- Changes the size, position, and Z order of a child, pop-up, or
	-- top-level window. Child, pop-up, and top-level windows are ordered
	-- according to their appearance on the screen. The topmost window
	-- receives the highest rank and is the first window in the Z order.
	-- Raises:
        --      Not_Valid_Error if Window or Insert_After does not have an open
        --		(Windows) window.
        --      Windows_Error if Windows returns an error.
	--

    function Client_To_Screen (Window:	in Claw.Root_Window_Type'Class;
    			       Point:	in Claw.Point_Type) return Claw.Point_Type;
	--
	-- Convert client coordinates of a point to screen coordinates.
	--
	-- Raises:
	--	Not_Valid_Error if Window is not valid.
	--	Windows_Error if there is a problem.
	--


      -- Many other window operations are available here in the full version of CLAW.


end Claw.Window_Operations;