749N/A * Copyright 1989 Massachusetts Institute of Technology 749N/A * Permission to use, copy, modify, distribute, and sell this software and its 749N/A * documentation for any purpose is hereby granted without fee, provided that 749N/A * the above copyright notice appear in all copies and that both that 749N/A * copyright notice and this permission notice appear in supporting 749N/A * documentation, and that the name of M.I.T. not be used in advertising or 749N/A * publicity pertaining to distribution of the software without specific, 749N/A * written prior permission. M.I.T. makes no representations about the 749N/A * suitability of this software for any purpose. It is provided "as is" 749N/A * without express or implied warranty. 749N/A * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL 749N/A * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. 749N/A * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 749N/A * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 749N/A * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 749N/A * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 749N/A * This is the List widget, it is useful to display a list, without the 749N/A * overhead of having a widget for each item in the list. It allows 749N/A * the user to select an item in a list and notifies the application through 749N/A * By: Chris D. Peterson 749N/A * Default Translation table. 749N/A/**************************************************************** 749N/A * Full class record constant 749N/A ****************************************************************/ 749N/A /* class_name */ "List",
749N/A/* Simple class fields initialization */ 749N/A/**************************************************************** 749N/A ****************************************************************/ 749N/A/* Function Name: ResetList 749N/A * Description: Resets the new list when important things change. 749N/A * Arguments: w - the widget. 749N/A * changex, changey - allow the height or width to change? 749N/A * If list is NULL then the list will just be the name of the widget. 749N/A/* Function Name: ChangeSize. 749N/A * Description: Laysout the widget. 749N/A * Arguments: w - the widget to try change the size of. 749N/A "Size Changed when it shouldn't have",
749N/A "when computing layout");
749N/A "List Widget: Unknown geometry return.");
749N/A "List Widget: Unknown geometry return.");
749N/A/* Function Name: Initialize 749N/A * Description: Function that initilizes the widget instance. 749N/A * Arguments: junk - NOT USED. 749N/A * new - the new widget. 749N/A * Initialize all private resources. 749N/A/* Function Name: CvtToItem 749N/A * Description: Converts Xcoord to item number of item containing that 749N/A * Arguments: w - the list widget. 749N/A * xloc, yloc - x location, and y location. 749N/A * Returns: the item number. 749N/A /* If out of range, return minimum possible value. */ 749N/A /* If in right margin handle things right. */ 749N/A/* Function Name: FindCornerItems. 749N/A * Description: Find the corners of the rectangle in item space. 749N/A * Arguments: w - the list widget. 749N/A * event - the event structure that has the rectangle it it. 749N/A * ul_ret, lr_ret - the corners ** RETURNED **. 749N/A/* Function Name: ItemInRectangle 749N/A * Description: returns TRUE if the item passed is in the given rectangle. 749N/A * Arguments: w - the list widget. 749N/A * ul, lr - corners of the rectangle in item space. 749N/A * item - item to check. 749N/A * Returns: TRUE if the item passed is in the given rectangle. 749N/A/* Function Name: HighlightBackground 749N/A * Description: paints the color of the background for the given item. 749N/A * Arguments: w - the widget. 749N/A * x, y - ul corner of the area item occupies. 749N/A * item - the item we are dealing with. 749N/A * gc - the gc that is used to paint this rectangle 749N/A/* Function Name: PaintItemName 749N/A * Description: paints the name of the item in the appropriate location. 749N/A * Arguments: w - the list widget. 749N/A * item - the item to draw. 749N/A * NOTE: no action taken on an unrealized widget. 749N/A/* Function Name: Redisplay 749N/A * Description: Repaints the widget window on expose events. 749N/A * Arguments: w - the list widget. 749N/A * event - the expose event for this repaint. 749N/A/* Function Name: PreferredGeom 749N/A * Description: This tells the parent what size we would like to be 749N/A * given certain constraints. 749N/A * Arguments: w - the widget. 749N/A * intended - what the parent intends to do with us. 749N/A * requested - what we want to happen. 749N/A * We only care about our height and width. 749N/A/* Function Name: Resize 749N/A * Description: resizes the widget, by changing the number of rows and 749N/A * Arguments: w - the widget. 749N/A "List Widget: Size changed when it shouldn't have when resising.");
749N/A/* Function Name: Layout 749N/A * Description: lays out the item in the list. 749N/A * Arguments: w - the widget. 749N/A * xfree, yfree - TRUE if we are free to resize the widget in 749N/A * width, height - the is the current width and height that 749N/A * we are going to layout the list widget to, 749N/A * depending on xfree and yfree of course. 749N/A * Returns: TRUE if width or height have been changed. 749N/A * If force columns is set then always use number of columns specified 749N/A /* 12/3 = 4 and 10/3 = 4, but 9/3 = 3 */ 749N/A * If both width and height are free to change the use default_cols 749N/A * to determine the number columns and set new width and height to 749N/A * If the width is fixed then use it to determine the number of columns. 749N/A * If the height is free to move (width still fixed) then resize the height 749N/A * of the widget to fit the current list exactly. 749N/A * The last case is xfree and !yfree we use the height to determine 749N/A * the number of rows and then set the width to just fit the resulting 749N/A/* Function Name: Notify 749N/A * Description: Notifies the user that a button has been pressed, and 749N/A * calles the callback, if the XtNpasteBuffer resource 749N/A * is true then the name of the item is also put in the 749N/A * X cut buffer ( buf (0) ). 749N/A * Arguments: w - the widget that the notify occured in. 749N/A * event - event that caused this notification. 749N/A * params, num_params - not used. 749N/A * Find item and if out of range then unhighlight and return. 749N/A * If the current item is unhighlighted then the user has aborted the 749N/A * notify, so unhighlight and return. 749N/A * Call Callback function. 749N/A * Description: unhighlights the current element. 749N/A * Arguments: w - the widget that the event occured in. 749N/A * params, num_params - not used. 749N/A * Description: Highlights the current element. 749N/A * Arguments: w - the widget that the event occured in. 749N/A * event - event that caused this notification. 749N/A * params, num_params - not used. 749N/A * Set specified arguments into widget 749N/A /* Reset row height. */ 749N/A/* Exported Functions */ 749N/A/* Function Name: XawListChange. 749N/A * Description: Changes the list being used and shown. 749N/A * Arguments: w - the list widget. 749N/A * nitems - the number of items in the list. 749N/A * longest - the length (in Pixels) of the longest element 749N/A * resize - if TRUE the the list widget will 749N/A * try to resize itself. 749N/A * NOTE: If nitems of longest are <= 0 then they will be calculated. 749N/A * If nitems is <= 0 then the list needs to be NULL terminated. 749N/A/* Function Name: XawListUnhighlight 749N/A * Description: unlights the current highlighted element. 749N/A * Arguments: w - the widget. 749N/A/* Function Name: XawListHighlight 749N/A * Description: Highlights the given item. 749N/A * Arguments: w - the list widget. 749N/A * item - the item to hightlight. 749N/A/* Function Name: XawListShowCurrent 749N/A * Description: returns the currently highlighted object. 749N/A * Arguments: w - the list widget. 749N/A * Returns: the info about the currently highlighted object.