;
; dbx.numWrite.sh
;
; Numeric writable icons
;
;  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:
;
;  numWrite_set
;  numWrite_read
;  numWrite_bump
;
; Controls provided:
;
;   numWrite
;
; Macros provided:
;
;   NUMWRT

		GET	sapphire:dbx.dbx

		[	:LNOT::DEF:numWrite__dfn
		GBLL	numWrite__dfn

; --- numWrite ---
;
; Control data:	+0 == minimum value
;		+4 == maximum value
;		+8
;
; Workspace:	+0
;
; Flags:	--
;
; Use:		Control type for numeric writable icons.

		IMPORT	numWrite

; --- numWrite ---
;
; Control data:	+0 == minimum value
;		+4 == maximum value
;		+8
;
; Workspace:	+0
;
; Flags:	--
;
; Use:		Control type for numeric writable icons.

		IMPORT	numWrite

; --- numWrite_set ---
;
; On entry:	R0 == dialogue box handle
;		R1 == icon number within dialogue
;		R2 == value to set in the icon
;
; On exit:	R2 == value actually set
;
; Use:		Writes the specified numeric value into the given writable
;		icon.  The icon must be a dbx control with numWrite type
;		for this to work.

		IMPORT	numWrite_set

; --- numWrite_read ---
;
; On entry:	R0 == dialogue box handle
;		R1 == icon handle
;
; On exit:	CC if icon contains a valid integer, and
;		  R2 == value shown in the icon
;		else CS and
;		  R2 == 0
;
; Use:		Reads the numeric value within the icon specifed.

		IMPORT	numWrite_read

; --- numWrite_bump ---
;
; On entry:	R0 == dialogue box handle
;		R1 == icon handle
;		R2 == increment to apply to it
;
; On exit:	R2 == updated value in the icon
;
; Use:		Adjusts the value in a writable icon by a given increment.

		IMPORT	numWrite_bump

; --- Macro: NUMWRT ---
;
; Arguments:	icon == icon handle of control
;		min == minimum representable value
;		max == maximum representable value
;
; Use:		Inserts a definition of a numerical writable icon into
;		a dbx dialogue definition table.

		MACRO
$label		NUMWRT	$icon,$min,$max
$label		CONTROL	$icon,numWrite,,0
		DCD	$min
		DCD	$max
		ECTRL
		MEND

;----- Constants ------------------------------------------------------------

numWrite_event	EQU	&80000004		;R1 == icon number changed
						;R2 == subreason code
						;R3 == new value of icon

numWrite_change	EQU	0			;Subreason -- number changed
numWrite_move	EQU	1			;Subreason -- cursor moved

		]

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

		END
