home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 3 / CDPDIII.bin / pd / programming / utils / dialoglib / examples.lha / test06.c < prev    next >
C/C++ Source or Header  |  1993-03-09  |  4KB  |  136 lines

  1. #include <exec/nodes.h>
  2. #include <exec/lists.h>
  3. #include <libraries/gadtools.h>
  4. #include <utility/tagitem.h>
  5. #include <proto/exec.h>
  6. #include <proto/gadtools.h>
  7. #include <proto/intuition.h>
  8. #include <proto/utility.h>
  9. #include <dialog/dialog.h>
  10.  
  11. struct Screen *myScreen;
  12. APTR myVisualInfo;
  13.  
  14. VOID dialog( VOID )
  15. {
  16.     DialogElement root, vstack, vbumper, hcons, ok, *termination;
  17.     DialogElement pos1, hcons1, neg1;
  18.     DialogElement pos2, hcons2, neg2;
  19.     DialogElement pos3, hcons3, neg3;
  20.     ULONG error = 0;
  21.  
  22.     initDialogElement( &root, NULL, dispatchRoot, &error,
  23.         DA_Screen, myScreen,
  24.         DA_Member, &vstack,
  25.         WA_Activate, TRUE,
  26.         WA_DragBar, TRUE,
  27.         TAG_DONE );
  28.     initDialogElement( &vstack, &root, dispatchVStack, &error,
  29.         DA_Member, &hcons1,
  30.         DA_Member, &vbumper,
  31.         DA_Member, &hcons2,
  32.         DA_Member, &vbumper,
  33.         DA_Member, &hcons3,
  34.         DA_Member, &vbumper,
  35.         DA_Member, &hcons,
  36.         DA_Alignment, 0,
  37.         TAG_DONE );
  38.     initDialogElement( &hcons, &root, dispatchHCons, &error,
  39.         DA_CAR, &ok,
  40.         TAG_DONE );
  41.     initDialogElement( &ok, &root, dispatchButton, &error,
  42.         NGDA_TextAttr, myScreen->Font,
  43.         NGDA_VisualInfo, myVisualInfo,
  44.         NGDA_GadgetText, "_Ok",
  45.         GT_Underscore, '_',
  46.         DA_EquivalentKey, 'O',
  47.         DA_Termination, TRUE,
  48.         TAG_DONE );
  49.     initDialogElement( &vbumper, &root, dispatchVBumper, &error, TAG_DONE );
  50.     initDialogElement( &hcons1, &root, dispatchHCons, &error,
  51.         DA_CAR, &pos1,
  52.         DA_CDR, &neg1,
  53.         TAG_DONE );
  54.     initDialogElement( &pos1, &root, dispatchButton, &error,
  55.         NGDA_TextAttr, myScreen->Font,
  56.         NGDA_VisualInfo, myVisualInfo,
  57.         NGDA_GadgetText, "confirm",
  58.         TAG_DONE );
  59.     initDialogElement( &neg1, &root, dispatchButton, &error,
  60.         NGDA_TextAttr, myScreen->Font,
  61.         NGDA_VisualInfo, myVisualInfo,
  62.         NGDA_GadgetText, "deny",
  63.         TAG_DONE );
  64.     initDialogElement( &hcons2, &root, dispatchHCons, &error,
  65.         DA_CAR, &pos2,
  66.         DA_CDR, &neg2,
  67.         TAG_DONE );
  68.     initDialogElement( &pos2, &root, dispatchButton, &error,
  69.         NGDA_TextAttr, myScreen->Font,
  70.         NGDA_VisualInfo, myVisualInfo,
  71.         NGDA_GadgetText, "agree",
  72.         TAG_DONE );
  73.     initDialogElement( &neg2, &root, dispatchButton, &error,
  74.         NGDA_TextAttr, myScreen->Font,
  75.         NGDA_VisualInfo, myVisualInfo,
  76.         NGDA_GadgetText, "disagree",
  77.         TAG_DONE );
  78.     initDialogElement( &hcons3, &root, dispatchHCons, &error,
  79.         DA_CAR, &pos3,
  80.         DA_CDR, &neg3,
  81.         TAG_DONE );
  82.     initDialogElement( &pos3, &root, dispatchButton, &error,
  83.         NGDA_TextAttr, myScreen->Font,
  84.         NGDA_VisualInfo, myVisualInfo,
  85.         NGDA_GadgetText, "accept",
  86.         TAG_DONE );
  87.     initDialogElement( &neg3, &root, dispatchButton, &error,
  88.         NGDA_TextAttr, myScreen->Font,
  89.         NGDA_VisualInfo, myVisualInfo,
  90.         NGDA_GadgetText, "reject",
  91.         TAG_DONE );
  92.  
  93.     if( error )
  94.         goto cleanup;
  95.  
  96.     termination = runSimpleDialog( &root,
  97.         WA_Title, "Example : grouping by hcons",
  98.         WA_InnerWidth, 300,
  99.         TAG_DONE );
  100.  
  101. cleanup:
  102.     cleanupDialogElement( &pos1 );
  103.     cleanupDialogElement( &neg1 );
  104.     cleanupDialogElement( &hcons1 );
  105.     cleanupDialogElement( &pos2 );
  106.     cleanupDialogElement( &neg2 );
  107.     cleanupDialogElement( &hcons2 );
  108.     cleanupDialogElement( &pos3 );
  109.     cleanupDialogElement( &neg3 );
  110.     cleanupDialogElement( &hcons3 );
  111.     cleanupDialogElement( &ok );
  112.     cleanupDialogElement( &vstack );
  113.     cleanupDialogElement( &vbumper );
  114.     cleanupDialogElement( &hcons );
  115.     cleanupDialogElement( &root );
  116. }
  117.  
  118. main( int argc, char *argv[] )
  119. {
  120.     myScreen = LockPubScreen( NULL );
  121.     if( !myScreen )
  122.         goto cleanup;
  123.  
  124.     myVisualInfo = GetVisualInfo( myScreen, TAG_DONE );
  125.     if( !myVisualInfo )
  126.         goto cleanup;
  127.  
  128.     dialog();
  129.  
  130. cleanup:
  131.     if( myVisualInfo )
  132.         FreeVisualInfo( myVisualInfo );
  133.     if( myScreen )
  134.         UnlockPubScreen( NULL, myScreen );
  135. }
  136.