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, hstack1, hstack, hspring, ok, hstack2, *termination;
- DialogElement check1, check2, check3, check4;
- 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, &hstack1,
- DA_Member, &hstack,
- DA_Member, &hstack2,
- TAG_DONE );
- initDialogElement( &hstack, &root, dispatchHStack, &error,
- DA_Member, &hspring,
- DA_Member, &ok,
- DA_Member, &hspring,
- TAG_DONE );
- initDialogElement( &hspring, &root, dispatchHSpring, &error, 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( &hstack1, &root, dispatchHStack, &error,
- DA_Member, &check1,
- DA_Member, &check4,
- TAG_DONE );
- initDialogElement( &hstack2, &root, dispatchHStack, &error,
- DA_Member, &check3,
- DA_Member, &check2,
- TAG_DONE );
- initDialogElement( &check1, &root, dispatchCheckBox, &error,
- NGDA_TextAttr, myScreen->Font,
- NGDA_VisualInfo, myVisualInfo,
- NGDA_GadgetText, "placement left",
- /* NGDA_Flags, PLACETEXT_LEFT, *** default *** */
- TAG_DONE );
- initDialogElement( &check2, &root, dispatchCheckBox, &error,
- NGDA_TextAttr, myScreen->Font,
- NGDA_VisualInfo, myVisualInfo,
- NGDA_GadgetText, "placement right",
- NGDA_Flags, PLACETEXT_RIGHT,
- TAG_DONE );
- initDialogElement( &check3, &root, dispatchCheckBox, &error,
- NGDA_TextAttr, myScreen->Font,
- NGDA_VisualInfo, myVisualInfo,
- NGDA_GadgetText, "placement above",
- NGDA_Flags, PLACETEXT_ABOVE,
- TAG_DONE );
- initDialogElement( &check4, &root, dispatchCheckBox, &error,
- NGDA_TextAttr, myScreen->Font,
- NGDA_VisualInfo, myVisualInfo,
- NGDA_GadgetText, "placement below",
- NGDA_Flags, PLACETEXT_BELOW,
- TAG_DONE );
-
- if( error )
- goto cleanup;
-
- termination = runSimpleDialog( &root,
- WA_Title, "Example : GadTools CHECKBOX",
- WA_InnerWidth, 300,
- WA_InnerHeight, 200,
- TAG_DONE );
-
- cleanup:
- cleanupDialogElement( &check1 );
- cleanupDialogElement( &check2 );
- cleanupDialogElement( &check3 );
- cleanupDialogElement( &check4 );
- cleanupDialogElement( &ok );
- cleanupDialogElement( &hstack );
- cleanupDialogElement( &hspring );
- cleanupDialogElement( &hstack1 );
- cleanupDialogElement( &hstack2 );
- cleanupDialogElement( &vstack );
- 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 );
- }
-