#ifndef _XawOptionList_h
#define _XawOptionList_h

/* $Id: OptionList.h,v 1.9 93/04/08 07:18:43 bert Exp $ */

/***********************************************************************
 *
 * OptionList Widget
 *
 ***********************************************************************/

#include <X11/Xaw/Simple.h>
#include <X11/Xfuncproto.h>

/* Resources:

 Name		     Class		RepType		Default Value
 ----		     -----		-------		-------------
 background	     Background		Pixel		XtDefaultBackground
 border		     BorderColor	Pixel		XtDefaultForeground
 borderWidth	     BorderWidth	Dimension	1
 callback            Callback           XtCallbackList  NULL       **6
 columnPadding       Spacing            Dimension       2
 columnSpacing       Spacing            Dimension       10
 cursor		     Cursor		Cursor		left_ptr
 cursorName	     Cursor		String		NULL
 defaultColumns      Columns            int             2          **5
 destroyCallback     Callback		Pointer		NULL 
 fieldSensitive      FieldSensitive     Boolean *       NULL       **7
 font		     Font		XFontStruct*	XtDefaultFont
 forceColumns        Columns            Boolean         False      **5
 foreground	     Foreground		Pixel		XtDefaultForeground
 height		     Height		Dimension	0          **1
 highlightBorder     Spacing            Dimension       1
 insensitiveBorder   Insensitive	Pixmap		Gray
 internalHeight	     Height		Dimension	2
 internalWidth	     Width		Dimension	4
 optionList          OptionList         String *        NULL       **2
 longest             Longest            int             0          **3  **4
 mappedWhenManaged   MappedWhenManaged	Boolean		True
 numberStrings       NumberStrings      int             0          **4
 pasteBuffer         Boolean            Boolean         False
 pointerColor	     Foreground		Pixel		XtDefaultForeground
 pointerColorBackground Background	Pixel		XtDefaultBackground
 rowPadding          Spacing            Dimension       0
 rowSpacing          Spacing            Dimension       2
 sensitive	     Sensitive		Boolean		True
 verticalOptionList  Boolean            Boolean         False
 width		     Width		Dimension	0          **1
 x		     Position		Position	0
 y		     Position		Position	0

 **1 - If the Width or Height of the optionList widget is zero (0) then the value
       is set to the minimum size necessay to fit the entire optionList.

       If both Width and Height are zero then they are adjusted to fit the
       entire optionList that is created width the number of default columns 
       specified in the defaultColumns resource.

 **2 - This is an array of strings the specify elements of the optionList.
       (What good is a optionList widget without a optionList??  :-)

 **3 - Longest is the length of the widest string in pixels.

 **4 - If either of these values are zero (0) then the optionList widget calculates
       the correct value. 

       (This allows you to make startup faster if you already have 
        this information calculated)

       NOTE: If the numberStrings value is zero the optionList must 
             be NULL terminated.

 **5 - By setting the OptionList.Columns resource you can force the application to
       have a given number of columns.	     
        
 **6 - This returns the name and index of the item selected in an 
       XawOptionListReturnStruct that is pointed to by the client_data
       in the CallbackProc.

 **7 - The size of this array should be >= numberStrings (or length of
       optionList if numberStrings is zero).

*/


/*
 * Value returned when there are no highlighted objects. 
 */

#define XAW_LIST_NONE -1	

#define XtCOptionList "OptionList"
#define XtCFieldSensitive "FieldSensitive"
#define XtCSpacing "Spacing"
#define XtCColumns "Columns"
#define XtCLongest "Longest"
#define XtCNumberStrings "NumberStrings"

#define XtNcursor "cursor"
#define XtNcolumnSpacing "columnSpacing"
#define XtNcolumnPadding "columnPadding"
#define XtNdefaultColumns "defaultColumns"
#define XtNforceColumns "forceColumns"
#define XtNoptionList "optionList"
#define XtNfieldSensitive "fieldSensitive"
#define XtNlongest "longest"
#define XtNnumberStrings "numberStrings"
#define XtNpasteBuffer "pasteBuffer"
#define XtNrowSpacing "rowSpacing"
#define XtNrowPadding "rowPadding"
#define XtNscrollParent "scrollParent"
#define XtNverticalOptionList "verticalOptionList"
#define XtNhighlightBorder "highlightBorder"
 
/* Class record constants */

extern WidgetClass optionListWidgetClass;

typedef struct _OptionListClassRec *OptionListWidgetClass;
typedef struct _OptionListRec      *OptionListWidget;

/* The optionList return structure. */

typedef struct _XawOptionListReturnStruct {
  String string;
  int list_index;
} XawOptionListReturnStruct;

/******************************************************************
 *
 * Exported Functions
 *
 *****************************************************************/

_XFUNCPROTOBEGIN

/*	Function Name: XawOptionListChange.
 *	Description: Changes the optionList being used and shown.
 *	Arguments: w - the optionList widget.
 *                 optionList - the new optionList.
 *                 nitems - the number of items in the optionList.
 *                 longest - the length (in Pixels) of the longest element
 *                           in the optionList.
 *                 resize - if TRUE the the optionList widget will
 *                          try to resize itself.
 *	Returns: none.
 *      NOTE:      If nitems of longest are <= 0 then they will be caluculated.
 *                 If nitems is <= 0 then the optionList needs to be NULL terminated.
 */

extern void XawOptionListChange(
#if NeedFunctionPrototypes
    Widget		/* w */,
    String*		/* optionList */,
    Boolean*		/* fieldSensitive */,
    int			/* nitems */,
    int			/* longest */,
#if NeedWidePrototypes
    /* Boolean */ int	/* resize */
#else
    Boolean		/* resize */
#endif
#endif
);

/*	Function Name: XawOptionListUnhighlight
 *	Description: unlights the current highlighted element.
 *	Arguments: w - the widget.
 *	Returns: none.
 */

extern void XawOptionListUnhighlight(
#if NeedFunctionPrototypes
    Widget		/* w */
#endif
);

/*	Function Name: XawOptionListHighlight
 *	Description: Highlights the given item.
 *	Arguments: w - the optionList widget.
 *                 item - the item to highlight.
 *	Returns: none.
 */

extern void XawOptionListHighlight(
#if NeedFunctionPrototypes
    Widget		/* w */,
    int			/* item */
#endif
);


/*	Function Name: XawOptionListShowCurrent
 *	Description: returns the currently highlighted object.
 *	Arguments: w - the optionList widget.
 *	Returns: the info about the currently highlighted object.
 */

extern XawOptionListReturnStruct * XawOptionListShowCurrent(
#if NeedFunctionPrototypes
    Widget		/* w */
#endif
);

_XFUNCPROTOEND

#endif /* _XawOptionList_h */
/* DON'T ADD STUFF AFTER THIS #endif */
