home *** CD-ROM | disk | FTP | other *** search
/ Super Net 1 / SUPERNET_1.iso / PC / OTROS / UNIX / ARCHIE / CLIENTS / XARCHIE0.TAR / classnames.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-21  |  2.5 KB  |  83 lines

  1. /*
  2.  * classnames.c : Map class names to classes. This code is totally
  3.  *    self-contained and so can be used for other projects. A smaller
  4.  *    executable might result from only including the classes an
  5.  *    application needs.
  6.  *
  7.  * George Ferguson, ferguson@cs.rochester.edu, 21 Aug 1991.
  8.  *
  9.  */
  10. #include <X11/Intrinsic.h>
  11. #include <X11/StringDefs.h>
  12. #include <X11/Shell.h>
  13. #include <X11/Xaw/Command.h>
  14. #include <X11/Xaw/Grip.h>
  15. #include <X11/Xaw/Label.h>
  16. #include <X11/Xaw/List.h>
  17. #include <X11/Xaw/Scrollbar.h>
  18. #include <X11/Xaw/StripChart.h>
  19. #include <X11/Xaw/Toggle.h>
  20. #include <X11/Xaw/SimpleMenu.h>
  21. #include <X11/Xaw/SmeBSB.h>
  22. #include <X11/Xaw/SmeLine.h>
  23. #include <X11/Xaw/MenuButton.h>
  24. #include <X11/Xaw/AsciiText.h>
  25. #include <X11/Xaw/Box.h>
  26. #include <X11/Xaw/Dialog.h>
  27. #include <X11/Xaw/Form.h>
  28. #include <X11/Xaw/Paned.h>
  29. #include <X11/Xaw/Viewport.h>
  30. #include <EzMenu.h>
  31.  
  32. static struct tableRec {
  33.     char *name;
  34.     WidgetClass *class;
  35.     Boolean isShell;
  36. } table[] = {
  37.     { "Command",    &commandWidgetClass,    False },
  38.     { "Grip",    &gripWidgetClass,    False },
  39.     { "Label",    &labelWidgetClass,    False },
  40.     { "List",    &listWidgetClass,    False },
  41.     { "Scrollbar",    &scrollbarWidgetClass,    False },
  42.     { "StripChart",    &stripChartWidgetClass,    False },
  43.     { "Toggle",    &toggleWidgetClass,    False },
  44.     { "SimpleMenu",    &simpleMenuWidgetClass,    True },
  45.     { "SmeBSB",    &smeBSBObjectClass,    False },
  46.     { "SmeLine",    &smeLineObjectClass,    False },
  47.     { "MenuButton",    &menuButtonWidgetClass,    False },
  48.     { "AsciiText",    &asciiTextWidgetClass,    False },
  49.     { "Box",    &boxWidgetClass,    False },
  50.     { "Dialog",    &dialogWidgetClass,    False },
  51.     { "Form",    &formWidgetClass,    False },
  52.     { "Paned",    &panedWidgetClass,    False },
  53.     { "Viewport",    &viewportWidgetClass,    False },
  54.     { "Shell",         &shellWidgetClass,        True },
  55.     { "OverrideShell",     &overrideShellWidgetClass,    True },
  56.     { "WMShell",         &wmShellWidgetClass,        True },
  57.     { "TransientShell",     &transientShellWidgetClass,    True },
  58.     { "TopLevelShell",    &topLevelShellWidgetClass,    True },
  59.     { "ApplicationShell",    &applicationShellWidgetClass,    True },
  60.     { "EzMenu",        &ezMenuWidgetClass,        True },
  61. };
  62.  
  63. /*
  64.  * classNameToWidgetClass : Returns the WidgetClass with the given "name".
  65.  *    In addition, sets the isShell flag to True or False depending on
  66.  *    whether the class is a Shell class or not.
  67.  *    Return NULL if the name is not the name of any WidgetClass.
  68.  */
  69. WidgetClass
  70. classNameToWidgetClass(name,isShellp)
  71. char *name;
  72. Boolean *isShellp;
  73. {
  74.     int i;
  75.  
  76.     for (i=0; i < XtNumber(table); i++)
  77.     if (strcmp(name,table[i].name) == 0) {
  78.         *isShellp = table[i].isShell;
  79.         return(*(table[i].class));
  80.     }
  81.     return((WidgetClass)NULL);
  82. }
  83.