;
; winUtils.sh
;
; Various window utility functions
;
;  1994-1998 Straylight
;

;----- Licensing note -------------------------------------------------------
;
; This file is part of Straylight's Sapphire library.
;
; Sapphire is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2, or (at your option)
; any later version.
;
; Sapphire is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with Sapphire.  If not, write to the Free Software Foundation,
; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

;----- Overview -------------------------------------------------------------
;
; Functions provided:
;
;  winUtils_setTitle
;  winUtils_setPosition
;  winUtils_findValid
;  winUtils_shaded

		[	:LNOT::DEF:winUtils__dfn
		GBLL	winUtils__dfn

; --- winUtils_setTitle ---
;
; On entry:	R0 == pointer to string to set in title
;		R1 == pointer to title bar buffer
;		R2 == window handle to write to
;
; On exit:	--
;
; Use:		Sets a window's title string.  If the string is different,
;		the title is redrawn.  The contortion to do this is
;		unpleasant, and is not to be performed in public.

		IMPORT	winUtils_setTitle

; --- winUtils_setPosition ---
;
; On entry:	R0 == window opening style
;		R1 == pointer to window state block
;		R2,R3 == extra arguments for displaying the window
;
; On exit:	R2,R3 contain position for opening with Wimp_CreateMenu
;
; Use:		Modifies the window state block pointed to by R0 so that the
;		window appears as required in the given opening style.  The
;		window is always moved to the top.

		IMPORT	winUtils_setPosition

; --- winUtils_findValid ---
;
; On entry:	R0 == pointer to icon block
; 		R1 == character to find in block (not case-sensitive)
;		R2 == old pointer to search from, or 0
;
; On exit:	R1 == character forced to lower case
;		CS if found, and
;		  R2 points to command string
;		else CC and
;		  R2 corrupted
;
; Use:		Tries to find a validation string command in the given
;		icon block.

		IMPORT	winUtils_findValid

; --- winUtils_shaded ---
;
; On entry:	R0 == window handle
;		R1 == icon handle
;
; On exit:	CS if icon is shaded, CC otherwise
;
; Use:		Informs caller whether an icon is shaded in the Sapphire
;		sense (ESG 31 or shaded bit set).

		IMPORT	winUtils_shaded

; --- Opening styles for winUtils_setPosition ---
;
; These are actually the same as the dbox_open styles, without the flags
; bits.

		^	0
wStyle_current	#	1			;In its current position
wStyle_centre	#	1			;Centred on the screen
wStyle_pointer	#	1			;Centred over the pointer
wStyle_givenY	#	1			;At a given height on screen
						;  R2 == y coordinate to open
wStyle_givenXY	#	1			;At a given position on scrn
						;  R2 == x coordinate
						;  R3 == y coordinate

		]

;----- That's all, folks ----------------------------------------------------

		END
