Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
motifutil.h
Go to the documentation of this file.
00001 /*
00002 
00003   Copyright (C) 2000, 2001 Silicon Graphics, Inc.  All Rights Reserved.
00004 
00005   This program is free software; you can redistribute it and/or modify it
00006   under the terms of version 2 of the GNU General Public License as
00007   published by the Free Software Foundation.
00008 
00009   This program is distributed in the hope that it would be useful, but
00010   WITHOUT ANY WARRANTY; without even the implied warranty of
00011   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00012 
00013   Further, this software is distributed without any warranty that it is
00014   free of the rightful claim of any third person regarding infringement 
00015   or the like.  Any license provided herein, whether implied or 
00016   otherwise, applies only to this software file.  Patent licenses, if 
00017   any, provided herein do not apply to combinations of this program with 
00018   other software, or any other product whatsoever.  
00019 
00020   You should have received a copy of the GNU General Public License along
00021   with this program; if not, write the Free Software Foundation, Inc., 59
00022   Temple Place - Suite 330, Boston MA 02111-1307, USA.
00023 
00024   Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pky,
00025   Mountain View, CA 94043, or:
00026 
00027   http://www.sgi.com
00028 
00029   For further information regarding this notice, see:
00030 
00031   http://oss.sgi.com/projects/GenInfo/NoticeExplan
00032 
00033 */
00034 
00035 
00036 #ifndef motifutil_INCLUDED
00037 #define motifutil_INCLUDED
00038 #ifdef __cplusplus
00039 extern "C" {
00040 #endif
00041 
00042 /* ====================================================================
00043  * ====================================================================
00044  *
00045  *
00046  * Revision history:
00047  *  26-Feb-92 - Original Version
00048  *
00049  * Description:
00050  *
00051  * Interface to utilities for Motif user interface creation.
00052  *
00053  * ====================================================================
00054  * ====================================================================
00055  */
00056 
00057 
00058 #ifdef _KEEP_RCS_ID
00059 #endif /* _KEEP_RCS_ID */
00060 
00061 /* Callback for quitting the program: */
00062 extern void Quit_Callback (
00063   Widget w,                     /* Invoking widget */
00064   XtPointer client_data,        /* Client's data */
00065   XtPointer call_data           /* Callback data */
00066 );
00067 
00068 /* Callback for unmanaging a popup menu: */
00069 extern void Unmanage_Callback (
00070   Widget w,             /* Invoking widget */
00071   XtPointer form,       /* Client's data -- form to unmanage */
00072   XtPointer call_data   /* Callback data */
00073 );
00074 
00075 /* Create a radio box widget, with the given parent and Args, and with
00076  * children which are toggle button gadgets with labels given.
00077  *
00078  * If title is non-NULL, the radio box is put in a form with the title
00079  * above it.  The args passed in are set for the top-level widget
00080  * created, whether it is a form or the radio box.
00081  */
00082 extern Widget Build_Radio_Box (
00083   Widget parent,        /* Parent widget */
00084   char  *title,         /* Title or NULL */
00085   char  *name,          /* Name of radio box */
00086   Arg   wargs[],        /* Argument array, with some extra space */
00087   int   nargs,          /* Current size of wargs array */
00088   char  *labels[],      /* Button label array */
00089   int   nlabels         /* Number of buttons */
00090 );
00091 
00092 /* ====================================================================
00093  *
00094  * Pulldown Menus
00095  *
00096  * We define below a struct for describing the desired structure of a
00097  * possibly cascading set of pulldown menu items, and a general routine
00098  * which creates them based on such structs.  This is based on an
00099  * article in The X Journal, Jan/Feb 1992, by Dan Heller.
00100  *
00101  * ====================================================================
00102  */
00103 
00104 /* Define the menu item structure.  The expected usage will be to
00105  * declare a static array of these, describing all of the items in a
00106  * pulldown menu.  For purposes of Build_Pulldown_Menu below, such an
00107  * array should be terminated by a NULL record.
00108  */
00109 typedef struct _menu_item {
00110   char  *label;         /* Item's label */
00111   WidgetClass *class;   /* Item's class: pushbutton, label, separator */
00112   char  mnemonic;       /* Item's mnemonic: NULL if none */
00113   char  *accelerator;   /* Item's accelerator: NULL if none */
00114   char  *accel_text;    /*   will be converted to compound string */
00115   void  (*callback)();  /* Callback routine: NULL if none */
00116   XtPointer callback_data;      /* client_data for callback() */
00117   struct _menu_item *subitems;  /* Pull-right menu items, or NULL */
00118 } MENU_ITEM;
00119 
00120 /* Define the access macros, based on the array of structs model: */
00121 #define MITEM_label(m,i)        ((m[i]).label)
00122 #define MITEM_class(m,i)        ((m[i]).class)
00123 #define MITEM_mnemonic(m,i)     ((m[i]).mnemonic)
00124 #define MITEM_accelerator(m,i)  ((m[i]).accelerator)
00125 #define MITEM_accel_text(m,i)   ((m[i]).accel_text)
00126 #define MITEM_callback(m,i)     ((m[i]).callback)
00127 #define MITEM_callback_data(m,i) ((m[i]).callback_data)
00128 #define MITEM_subitems(m,i)     ((m[i]).subitems)
00129 
00130 /* Define the construction routine.  Pulldown menus are built from
00131  * cascade buttons, so this function creates the cascade button which
00132  * owns the menu, the menu, and any submenu specified:
00133  */
00134 extern Widget Build_Pulldown_Menu (
00135   Widget parent,
00136   char  *menu_title,
00137   char  menu_mnemonic,
00138   MENU_ITEM *items
00139 );
00140 
00141 #ifdef __cplusplus
00142 }
00143 #endif
00144 #endif /* motifutil_INCLUDED */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines