home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / n / newmarch.zip / ARROW-AC.C < prev    next >
C/C++ Source or Header  |  1992-09-08  |  2KB  |  71 lines

  1. /* Author:   $Author: jan $
  2.  * File:     $Source: /usr/usrs/jan/desktop/X_Book.boo/programs/RCS/arrow-act.c,v $
  3.  * Date:     $Date: 1992/09/09 00:09:45 $
  4.  * Revision: $Revision: 1.1 $
  5.  */
  6.  
  7. #include "copyright.h"
  8.  
  9. #include <Xm/Xm.h>
  10. #include <Xm/ArrowB.h>
  11.  
  12. char Class_name[] ="Arrow";
  13.  
  14. static char defaultTranslations[] = "<Key>Q: quit()";
  15. static XtTranslations trans_table;
  16.  
  17. void quit(w, event, params, num_params)
  18. Widget w; /* widget that invoked this function */
  19. XEvent *event;  /* last event that triggered the action */
  20. String *params;
  21. int num_params;
  22. {
  23.     printf("Key Q was pressed\n");
  24.     exit(0);
  25. }
  26.  
  27. static XtActionsRec actionsTable[] =
  28. {
  29. {"quit", quit}  /* name of action and  function above */
  30. };
  31.  
  32. main(argc, argv)
  33. int argc;
  34. char **argv;
  35.  
  36. {
  37.     Widget toplevel, arrow_widget;
  38.  
  39.     /* Initialise the intrinsics  with a toplevel widget */
  40.     toplevel = XtInitialize(NULL,
  41.             Class_name,
  42.             NULL,
  43.             0,  
  44.             &argc, argv);
  45.  
  46.     /* Create a widget, with the toplevel as manager;
  47.        its class is ArrowButton
  48.     */
  49.     arrow_widget = XmCreateArrowButton(toplevel,
  50.                            "an_arrow",
  51.                             NULL,
  52.                             0);
  53.  
  54.     XtManageChild(arrow_widget);
  55.  
  56.     /* register the new actions */
  57.     XtAddActions(actionsTable, XtNumber(actionsTable));
  58.  
  59.     /* compile the translation table */
  60.     trans_table = XtParseTranslationTable(defaultTranslations);
  61.  
  62.     /* augment the existing translations */
  63.     XtAugmentTranslations(arrow_widget, trans_table);
  64.  
  65.     /* display all of the widgets */
  66.     XtRealizeWidget(toplevel);
  67.  
  68.     /* enter the main processing loop */
  69.     XtMainLoop();
  70. }
  71.