List.h revision 749
1450N/A/* $XConsortium: List.h,v 1.22 94/04/17 20:12:17 kaleb Exp $ */
1450N/A
1450N/A/*
1450N/ACopyright (c) 1989, 1994 X Consortium
1450N/A
1450N/APermission is hereby granted, free of charge, to any person obtaining a copy
1450N/Aof this software and associated documentation files (the "Software"), to deal
1450N/Ain the Software without restriction, including without limitation the rights
1450N/Ato use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1450N/Acopies of the Software, and to permit persons to whom the Software is
1450N/Afurnished to do so, subject to the following conditions:
1450N/A
1450N/AThe above copyright notice and this permission notice shall be included in
1450N/Aall copies or substantial portions of the Software.
1450N/A
1450N/ATHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1450N/AIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1450N/AFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1450N/AX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
1450N/AAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1450N/ACONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1450N/A
1450N/AExcept as contained in this notice, the name of the X Consortium shall not be
1450N/Aused in advertising or otherwise to promote the sale, use or other dealings
1450N/Ain this Software without prior written authorization from the X Consortium.
1450N/A*/
1450N/A
1450N/A/* This is the List widget, it is useful to display a list, without the
1450N/A * overhead of having a widget for each item in the list. It allows
1450N/A * the user to select an item in a list and notifies the application through
1450N/A * a callback function.
1450N/A *
1450N/A * Created: 8/13/88
1450N/A * By: Chris D. Peterson
1450N/A * MIT X Consortium
1450N/A */
1450N/A
1450N/A#ifndef _XawList_h
1450N/A#define _XawList_h
1450N/A
1450N/A/***********************************************************************
1450N/A *
1450N/A * List Widget
1450N/A *
1450N/A ***********************************************************************/
1450N/A
1450N/A#include <X11/Xaw/Simple.h>
1450N/A
1450N/A/* Resources:
1450N/A
1450N/A Name Class RepType Default Value
1450N/A ---- ----- ------- -------------
1450N/A background Background Pixel XtDefaultBackground
1450N/A border BorderColor Pixel XtDefaultForeground
1450N/A borderWidth BorderWidth Dimension 1
1450N/A callback Callback XtCallbackList NULL **6
1450N/A columnSpacing Spacing Dimension 6
1450N/A cursor Cursor Cursor left_ptr
1450N/A cursorName Cursor String NULL
1450N/A defaultColumns Columns int 2 **5
1450N/A destroyCallback Callback Pointer NULL
1450N/A font Font XFontStruct* XtDefaultFont
1450N/A forceColumns Columns Boolean False **5
1450N/A foreground Foreground Pixel XtDefaultForeground
1450N/A height Height Dimension 0 **1
1450N/A insensitiveBorder Insensitive Pixmap Gray
1450N/A internalHeight Height Dimension 2
1450N/A internalWidth Width Dimension 4
1450N/A list List String * NULL **2
1450N/A longest Longest int 0 **3 **4
1450N/A mappedWhenManaged MappedWhenManaged Boolean True
1450N/A numberStrings NumberStrings int 0 **4
1450N/A pasteBuffer Boolean Boolean False
1450N/A pointerColor Foreground Pixel XtDefaultForeground
1450N/A pointerColorBackground Background Pixel XtDefaultBackground
1450N/A rowSpacing Spacing Dimension 4
1450N/A sensitive Sensitive Boolean True
1450N/A verticalList Boolean Boolean False
1450N/A width Width Dimension 0 **1
1450N/A x Position Position 0
1450N/A y Position Position 0
1450N/A
1450N/A **1 - If the Width or Height of the list widget is zero (0) then the value
1450N/A is set to the minimum size necessay to fit the entire list.
1450N/A
1450N/A If both Width and Height are zero then they are adjusted to fit the
1450N/A entire list that is created width the number of default columns
1450N/A specified in the defaultColumns resource.
1450N/A
1450N/A **2 - This is an array of strings the specify elements of the list.
1450N/A This resource must be specified.
1450N/A (What good is a list widget without a list?? :-)
1450N/A
1450N/A **3 - Longest is the length of the widest string in pixels.
1450N/A
1450N/A **4 - If either of these values are zero (0) then the list widget calculates
1450N/A the correct value.
1450N/A
1450N/A (This allows you to make startup faster if you already have
1450N/A this information calculated)
1450N/A
1450N/A NOTE: If the numberStrings value is zero the list must
1450N/A be NULL terminated.
1450N/A
1450N/A **5 - By setting the List.Columns resource you can force the application to
1450N/A have a given number of columns.
1450N/A
1450N/A **6 - This returns the name and index of the item selected in an
1450N/A XawListReturnStruct that is pointed to by the client_data
1450N/A in the CallbackProc.
1450N/A
1450N/A*/
1450N/A
1450N/A
1450N/A/*
1450N/A * Value returned when there are no highlighted objects.
1450N/A */
1450N/A
1450N/A#define XAW_LIST_NONE -1
1450N/A
1450N/A#define XtCList "List"
1450N/A#define XtCSpacing "Spacing"
1450N/A#define XtCColumns "Columns"
1450N/A#define XtCLongest "Longest"
1450N/A#define XtCNumberStrings "NumberStrings"
1450N/A
1450N/A#define XtNcursor "cursor"
1450N/A#define XtNcolumnSpacing "columnSpacing"
1450N/A#define XtNdefaultColumns "defaultColumns"
1450N/A#define XtNforceColumns "forceColumns"
1450N/A#define XtNlist "list"
1450N/A#define XtNlongest "longest"
1450N/A#define XtNnumberStrings "numberStrings"
1450N/A#define XtNpasteBuffer "pasteBuffer"
1450N/A#define XtNrowSpacing "rowSpacing"
1450N/A#define XtNverticalList "verticalList"
1450N/A
1450N/A#ifndef XtNfontSet
1450N/A#define XtNfontSet "fontSet"
1450N/A#endif
1450N/A
1450N/A#ifndef XtCFontSet
1450N/A#define XtCFontSet "FontSet"
1450N/A#endif
1450N/A
1450N/A/* Class record constants */
1450N/A
1450N/Aextern WidgetClass listWidgetClass;
1450N/A
1450N/Atypedef struct _ListClassRec *ListWidgetClass;
1450N/Atypedef struct _ListRec *ListWidget;
1450N/A
1450N/A/* The list return structure. */
1450N/A
1450N/Atypedef struct _XawListReturnStruct {
1450N/A String string;
1450N/A int list_index;
1450N/A} XawListReturnStruct;
1450N/A
1450N/A/******************************************************************
1450N/A *
1450N/A * Exported Functions
1450N/A *
1450N/A *****************************************************************/
1450N/A
1450N/A_XFUNCPROTOBEGIN
1450N/A
1450N/A/* Function Name: XawListChange.
1450N/A * Description: Changes the list being used and shown.
1450N/A * Arguments: w - the list widget.
1450N/A * list - the new list.
1450N/A * nitems - the number of items in the list.
1450N/A * longest - the length (in Pixels) of the longest element
1450N/A * in the list.
1450N/A * resize - if TRUE the the list widget will
1450N/A * try to resize itself.
1450N/A * Returns: none.
1450N/A * NOTE: If nitems of longest are <= 0 then they will be caluculated.
1450N/A * If nitems is <= 0 then the list needs to be NULL terminated.
1450N/A */
1450N/A
1450N/Aextern void XawListChange(
1450N/A#if NeedFunctionPrototypes
1450N/A Widget /* w */,
1450N/A String* /* list */,
1450N/A int /* nitems */,
1450N/A int /* longest */,
1450N/A#if NeedWidePrototypes
1450N/A /* Boolean */ int /* resize */
1450N/A#else
1450N/A Boolean /* resize */
1450N/A#endif
1450N/A#endif
1450N/A);
1450N/A
1450N/A/* Function Name: XawListUnhighlight
1450N/A * Description: unlights the current highlighted element.
1450N/A * Arguments: w - the widget.
1450N/A * Returns: none.
1450N/A */
1450N/A
1450N/Aextern void XawListUnhighlight(
1450N/A#if NeedFunctionPrototypes
1450N/A Widget /* w */
1450N/A#endif
1450N/A);
1450N/A
1450N/A/* Function Name: XawListHighlight
1450N/A * Description: Highlights the given item.
1450N/A * Arguments: w - the list widget.
1450N/A * item - the item to highlight.
1450N/A * Returns: none.
1450N/A */
1450N/A
1450N/Aextern void XawListHighlight(
1450N/A#if NeedFunctionPrototypes
1450N/A Widget /* w */,
1450N/A int /* item */
1450N/A#endif
1450N/A);
1450N/A
1450N/A
1450N/A/* Function Name: XawListShowCurrent
1450N/A * Description: returns the currently highlighted object.
1450N/A * Arguments: w - the list widget.
1450N/A * Returns: the info about the currently highlighted object.
1450N/A */
1450N/A
1450N/Aextern XawListReturnStruct * XawListShowCurrent(
1450N/A#if NeedFunctionPrototypes
1450N/A Widget /* w */
1450N/A#endif
1450N/A);
1450N/A
1450N/A_XFUNCPROTOEND
1450N/A
1450N/A#endif /* _XawList_h */
1450N/A