!************
!
!   $Id: xwidgets.inc,v 1.1 2008/07/19 22:30:29 jgs Exp $
!
!   Description:	X-Widget structure definitions
!
!   Include Dependencies: Expects that mtypes.h with the M_PTR pointer
!   structure definition has been included above it.
!
!*************

	integer*4 XW_NONE
	parameter (XW_NONE = 0)
	integer*4 XW_MENU
	parameter (XW_MENU = 1)
	integer*4 XW_VALUATOR
	parameter (XW_VALUATOR = 2)
	integer*4 XW_PROMPT
	parameter (XW_PROMPT = 3)
	integer*4 XW_MSGMONITOR
	parameter (XW_MSGMONITOR = 4)
	integer*4 XW_MESSAGE
	parameter (XW_MESSAGE = 5)
	integer*4 XW_COLORTAB
	parameter (XW_COLORTAB = 6)
	integer*4 XW_COLORMAP
	parameter (XW_COLORMAP = 7)
	integer*4 XW_PMONITOR
	parameter (XW_PMONITOR = 8)
	integer*4 XW_FRAME
	parameter (XW_FRAME = 9)
	integer*4 XW_FILES
	parameter (XW_FILES = 10)
	integer*4 XW_XWIDGET
	parameter (XW_XWIDGET = 11)

	integer*4 XW_FREE
	parameter (XW_FREE = -4)
	integer*4 XW_INIT
	parameter (XW_INIT = -3)
	integer*4 XW_RESET
	parameter (XW_RESET = -2)
	integer*4 XW_SETUP
	parameter (XW_SETUP = -1)
	integer*4 XW_ONESHOT
	parameter (XW_ONESHOT = 0)
	integer*4 XW_DRAW
	parameter (XW_DRAW = 1)
	integer*4 XW_EVENT
	parameter (XW_EVENT = 2)
	integer*4 XW_UPDATE
	parameter (XW_UPDATE = 3)
	integer*4 XW_UNHILITE
	parameter (XW_UNHILITE = 4)
	integer*4 XW_COMMAND
	parameter (XW_COMMAND = 5)

	structure /AVAL/
	  integer*2 cw	! width of widget in characters
	  integer*2 ch	! height of widget in characters
	  integer*2 cpos	! current cursor position in string
	  logical*2 edit	! indicates whether text is editable
	  logical*1 insert	! current insert mode state (TRUE=on)
	  logical*1 lit	! current state of cursor (TRUE=drawn)
	  logical*1 wrap	! TRUE=wrap lines longer than X-Widget
	  logical*1 nobox	! TRUE=Do not use X-Widget box
	  integer*4 lines	! number of separate lines
	  integer*4 cline	! current line position of cursor
	  integer*2 cl	! char offset at left edge
	  integer*2 ct	! line offset at top edge
	  record /M_PTR/ strings! array of M_PTRS to strings, if 0 it is initted
	  record /M_PTR/ xscroll	! if not 0, pointer to /SVAL/ structure
	  record /M_PTR/ yscroll	! if not 0, pointer to /SVAL/ structure
	  integer*2 titlebar	! TRUE=put prompt in X-Widget title bar
	  integer*2 okaybar		! TRUE=include OK,CANCEL buttons below
	  real*4 time		! TMONITOR's last time SECNDS was checked
	end structure

	integer*4 L_aval
	parameter (L_aval = (32+3*L_M_Ptr))

	structure /MVAL/
	  record /M_PTR/ items		! pointer to menu items string
	  record /M_PTR/ itemc		! pointer to menu items colors
	  integer*2 items_len	! length of menu items string
	  integer*2 nitems		! number of menu items
	  integer*2 iw		! number of columns of items in menu
	  integer*2 ih		! number of rows of items in menu
	  integer*2 lit		! currently highlighted item
	  integer*2 cw		! character width of each item label
	  integer*2 ldef		! current item number with > marker
	  integer*2 nitemc	! current number of colors allocated in itemc
	  character*8 pad	! stores option menu & title location info
	end structure

	integer*4 L_mval
	parameter (L_mval = (24+2*L_M_Ptr))

	structure /DVAL/
	  real*8 vmin		! if <= vmax, min value bound
	  real*8 vmax		! if >= vmin, max value bound
	  real*8 vinc		! increment used with +,-,++,-- buttons
	  real*8 advall		! used for internal formatting
	  record /M_PTR/ format	! pointer to format string
	  integer*2 format_len	! length of format string
	  integer*2 iexp		! exponent value
	  integer*2 iexpc		! cursor position (as power of 10)
	  integer*2 lsm		! length of numeric string
	  integer*2 lsmmax		! maximum length of numeric string
	  byte buttons		! 0=none, 1=top, 2=bottom, 3=both
	  logical*1 cont		! TRUE=update control id continously
	  character*4 pad
	end structure

	integer*4 L_dval
	parameter (L_dval = (L_M_Ptr+48))

	structure /MSGVAL/
	  integer*4 nmsg	! max number of messages to display in box
	  integer*4 rid		! /ID of primitive to monitor (0=all)
	  integer*4 last	! number of messages last displayed in box
	  character*4 pad
	end structure

	integer*4 L_msgval
	parameter (L_msgval = 16)

	structure /XWIDGET/
	  byte wtype		! x-widget type
	  character dtype		! data type
	  byte group		! control panel group ID
	  logical*1 common_help	! if TRUE look for help in XCOMMON.EXP
	  integer*4 mask		! attributes bit-mask
	  integer*4 x, y	! position of x-widget's upper left corner
	  integer*4 w, h		! x-widget dimensions in pixels
	  character*(L_max_resname) label	! results label
	  real*8 val		! control value  ascii value length
	  record /M_PTR/ callback	! callback pointer
	  record /M_PTR/ aval		! ascii control value pointer
	  record /M_PTR/ title		! x-widget title string pointer
	  integer*4 aval_len	! ascii value max length
	  integer*4 title_len	! title string length
	  integer*4 id		! control ID
	  real*4 pause		! pause between repeated events
	  union
	    map
	      record /AVAL/ av	! AVAL x-widget specific fields
	    endmap
	    map
	      record /MVAL/ mv	! MVAL x-widget specific fields
	    endmap
	    map
	      record /DVAL/ dv	! DVAL x-widget specific fields
	    endmap
	    map
	      record /MSGVAL/ msgv	! MSGMONITOR x-widget specific fields
	    endmap
	    map
	      integer*4 border	! FRAME border width (<0 for fill)
	    endmap
	  endunion
!+++
! wgd added
	  integer*4 MWMIndex        !Index of MWM structure for Headless  WGD
	  integer*4 MWMMaster       !Index of MWM master Macro slot.
!---
	end structure


	structure /SCROLLBAR/
	  integer*4 flag		! flag field for MX$SCROLLBAR routine
	  integer*4 action		! returned action performed (XW_EVENT)
	  real*8 smin, srange	! min and range values of scroll bar
	  real*8 tmin, trange	! min and range values of trough
	  real*8 step		! ratios of smin to move for step
	  real*8 page		! ratios of smin to move for page
	  real*8 scale		! ratio to scale by for expand/shrink
	  logical*4 dragoutline! FALSE = smooth scroll, TRUE = drag & drop
	  real*4 initial_pause
	  real*4 repeat_pause

	  integer*2 x, y, w, h	! These fields are private and are to be
	  integer*2 s1, sw, swmin, soff	! set through other interfaces
	  integer*2 a1, a2, arrow
	  logical*1 mxevent
	  byte origin
	  integer*4 repeat_count
	end structure

	integer*4 L_scrollbar
	parameter (L_scrollbar = 96)

	integer*4 SB_EXPAND
	parameter (SB_EXPAND = 1)
	integer*4 SB_SHRINK
	parameter (SB_SHRINK = 2)
	integer*4 SB_FULL
	parameter (SB_FULL = 3)
	integer*4 SB_STEPINC
	parameter (SB_STEPINC = 4)
	integer*4 SB_STEPDEC
	parameter (SB_STEPDEC = 5)
	integer*4 SB_PAGEINC
	parameter (SB_PAGEINC = 6)
	integer*4 SB_PAGEDEC
	parameter (SB_PAGEDEC = 7)
	integer*4 SB_DRAG
	parameter (SB_DRAG = 8)


