home *** CD-ROM | disk | FTP | other *** search
- #include <exec/nodes.h>
- #include <exec/lists.h>
- #include <libraries/gadtools.h>
- #include <utility/tagitem.h>
- #include <proto/exec.h>
- #include <proto/gadtools.h>
- #include <proto/intuition.h>
- #include <proto/utility.h>
- #include <dialog/dialog.h>
-
- struct Screen *myScreen;
- APTR myVisualInfo;
-
- VOID dialog( VOID )
- {
- DialogElement root, vstack, vbumper, hcons, ok, *termination;
- DialogElement pos1, hcons1, neg1;
- DialogElement pos2, hcons2, neg2;
- DialogElement pos3, hcons3, neg3;
- ULONG error = 0;
-
- initDialogElement( &root, NULL, dispatchRoot, &error,
- DA_Screen, myScreen,
- DA_Member, &vstack,
- WA_Activate, TRUE,
- WA_DragBar, TRUE,
- TAG_DONE );
- initDialogElement( &vstack, &root, dispatchVStack, &error,
- DA_Member, &hcons1,
- DA_Member, &vbumper,
- DA_Member, &hcons2,
- DA_Member, &vbumper,
- DA_Member, &hcons3,
- DA_Member, &vbumper,
- DA_Member, &hcons,
- DA_Alignment, 0,
- TAG_DONE );
- initDialogElement( &hcons, &root, dispatchHCons, &error,
- DA_CAR, &ok,
- TAG_DONE );
- initDialogElement( &ok, &root, dispatchButton, &error,
- NGDA_TextAttr, myScreen->Font,
- NGDA_VisualInfo, myVisualInfo,
- NGDA_GadgetText, "_Ok",
- GT_Underscore, '_',
- DA_EquivalentKey, 'O',
- DA_Termination, TRUE,
- TAG_DONE );
- initDialogElement( &vbumper, &root, dispatchVBumper, &error, TAG_DONE );
- initDialogElement( &hcons1, &root, dispatchHCons, &error,
- DA_CAR, &pos1,
- DA_CDR, &neg1,
- TAG_DONE );
- initDialogElement( &pos1, &root, dispatchButton, &error,
- NGDA_TextAttr, myScreen->Font,
- NGDA_VisualInfo, myVisualInfo,
- NGDA_GadgetText, "confirm",
- TAG_DONE );
- initDialogElement( &neg1, &root, dispatchButton, &error,
- NGDA_TextAttr, myScreen->Font,
- NGDA_VisualInfo, myVisualInfo,
- NGDA_GadgetText, "deny",
- TAG_DONE );
- initDialogElement( &hcons2, &root, dispatchHCons, &error,
- DA_CAR, &pos2,
- DA_CDR, &neg2,
- TAG_DONE );
- initDialogElement( &pos2, &root, dispatchButton, &error,
- NGDA_TextAttr, myScreen->Font,
- NGDA_VisualInfo, myVisualInfo,
- NGDA_GadgetText, "agree",
- TAG_DONE );
- initDialogElement( &neg2, &root, dispatchButton, &error,
- NGDA_TextAttr, myScreen->Font,
- NGDA_VisualInfo, myVisualInfo,
- NGDA_GadgetText, "disagree",
- TAG_DONE );
- initDialogElement( &hcons3, &root, dispatchHCons, &error,
- DA_CAR, &pos3,
- DA_CDR, &neg3,
- TAG_DONE );
- initDialogElement( &pos3, &root, dispatchButton, &error,
- NGDA_TextAttr, myScreen->Font,
- NGDA_VisualInfo, myVisualInfo,
- NGDA_GadgetText, "accept",
- TAG_DONE );
- initDialogElement( &neg3, &root, dispatchButton, &error,
- NGDA_TextAttr, myScreen->Font,
- NGDA_VisualInfo, myVisualInfo,
- NGDA_GadgetText, "reject",
- TAG_DONE );
-
- if( error )
- goto cleanup;
-
- termination = runSimpleDialog( &root,
- WA_Title, "Example : grouping by hcons",
- WA_InnerWidth, 300,
- TAG_DONE );
-
- cleanup:
- cleanupDialogElement( &pos1 );
- cleanupDialogElement( &neg1 );
- cleanupDialogElement( &hcons1 );
- cleanupDialogElement( &pos2 );
- cleanupDialogElement( &neg2 );
- cleanupDialogElement( &hcons2 );
- cleanupDialogElement( &pos3 );
- cleanupDialogElement( &neg3 );
- cleanupDialogElement( &hcons3 );
- cleanupDialogElement( &ok );
- cleanupDialogElement( &vstack );
- cleanupDialogElement( &vbumper );
- cleanupDialogElement( &hcons );
- cleanupDialogElement( &root );
- }
-
- main( int argc, char *argv[] )
- {
- myScreen = LockPubScreen( NULL );
- if( !myScreen )
- goto cleanup;
-
- myVisualInfo = GetVisualInfo( myScreen, TAG_DONE );
- if( !myVisualInfo )
- goto cleanup;
-
- dialog();
-
- cleanup:
- if( myVisualInfo )
- FreeVisualInfo( myVisualInfo );
- if( myScreen )
- UnlockPubScreen( NULL, myScreen );
- }
-