home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The CDPD Public Domain Collection for CDTV 3
/
CDPDIII.bin
/
pd
/
programming
/
utils
/
dialoglib
/
examples.lha
/
test00.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-03-09
|
3KB
|
124 lines
#include <libraries/gadtools.h>
#include <utility/tagitem.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, hstack, hspring, vstack, hstack1, ok, hstack2, *termination;
DialogElement text1, text2, text3, text4;
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, &text1,
DA_Member, &text4,
TAG_DONE );
initDialogElement( &hstack2, &root, dispatchHStack, &error,
DA_Member, &text3,
DA_Member, &text2,
TAG_DONE );
initDialogElement( &text1, &root, dispatchText, &error,
NGDA_TextAttr, myScreen->Font,
NGDA_VisualInfo, myVisualInfo,
NGDA_GadgetText, "placement left",
/* NGDA_Flags, PLACETEXT_LEFT, *** default *** */
GTTX_Text, "bla bla bla",
GTTX_Border, TRUE,
TAG_DONE );
initDialogElement( &text2, &root, dispatchText, &error,
NGDA_TextAttr, myScreen->Font,
NGDA_VisualInfo, myVisualInfo,
NGDA_GadgetText, "placement right",
NGDA_Flags, PLACETEXT_RIGHT,
GTTX_Text, "bla bla bla",
GTTX_Border, TRUE,
TAG_DONE );
initDialogElement( &text3, &root, dispatchText, &error,
NGDA_TextAttr, myScreen->Font,
NGDA_VisualInfo, myVisualInfo,
NGDA_GadgetText, "placement above",
NGDA_Flags, PLACETEXT_ABOVE,
GTTX_Text, "bla bla bla",
GTTX_Border, TRUE,
TAG_DONE );
initDialogElement( &text4, &root, dispatchText, &error,
NGDA_TextAttr, myScreen->Font,
NGDA_VisualInfo, myVisualInfo,
NGDA_GadgetText, "placement below",
NGDA_Flags, PLACETEXT_BELOW,
GTTX_Text, "bla bla bla",
GTTX_Border, TRUE,
TAG_DONE );
if( error )
goto cleanup;
termination = runSimpleDialog( &root,
WA_Title, "Example : GadTools TEXT",
WA_InnerWidth, 300,
WA_InnerHeight, 200,
TAG_DONE );
cleanup:
cleanupDialogElement( &text1 );
cleanupDialogElement( &text2 );
cleanupDialogElement( &text3 );
cleanupDialogElement( &text4 );
cleanupDialogElement( &ok );
cleanupDialogElement( &hstack1 );
cleanupDialogElement( &hstack2 );
cleanupDialogElement( &hspring );
cleanupDialogElement( &hstack );
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 );
}