home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
dev
/
bgui-1.1a.lha
/
BGUI
/
demos
/
filereq.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-08-03
|
7KB
|
179 lines
;/* Execute me to compile with DICE V3.0.
dcc filereq.c -proto -mi -ms -mRR -3.0 -lbgui
quit
*/
/*
** $RCSfile: filereq.c,v $
** Description: Simple BGUI filereqclass demo.
** Copyright: (C) Copyright 1994 Jaba Development.
** (C) Copyright 1994 Jan van den Baard.
** All Rights Reserved.
**
** $Author: jaba $
** $Revision: 1.2 $
** $Date: 1994/08/03 11:21:10 $
**/
#include <exec/types.h>
#include <libraries/gadtools.h>
#include <libraries/asl.h>
#include <libraries/bgui.h>
#include <libraries/bgui_macros.h>
#include <clib/alib_protos.h>
#include <proto/exec.h>
#include <proto/intuition.h>
#include <proto/utility.h>
#include <proto/bgui.h>
#include <stdlib.h>
#include <stdio.h>
/*
** Library base pointer.
**/
struct Library *BGUIBase = NULL;
/*
** Bulk GetAttr(). This really belongs in amiga.lib... I think.
**/
ULONG GetAttrs( Object *obj, ULONG tag1, ... )
{
struct TagItem *tstate = ( struct TagItem * )&tag1, *tag;
ULONG num = 0L;
while ( tag = NextTagItem( &tstate ))
num += GetAttr( tag->ti_Tag, obj, ( ULONG * )tag->ti_Data );
return( num );
}
int main( int argc, char *argv[] )
{
Object *filereq;
ULONG rc, dr, fl, pt, pa, l, t, w, h;
/*
** Open the library.
**/
if ( BGUIBase = OpenLibrary( BGUINAME, BGUIVERSION )) {
/*
** Create a filerequester object.
**/
filereq = FileReqObject, ASLFR_DoPatterns, TRUE, EndObject;
if ( filereq ) {
/*
** Pop the requester.
**/
if ( ! ( rc = DoRequest( filereq ))) {
/*
** Obtain attribute values.
**/
GetAttrs( filereq, FRQ_Drawer, &dr,
FRQ_File, &fl,
FRQ_Pattern, &pt,
FRQ_Path, &pa,
FRQ_Left, &l,
FRQ_Top, &t,
FRQ_Width, &w,
FRQ_Height, &h,
TAG_END );
/*
** Dump 'm on the console.
**/
printf( "Drawer : %s\n"
"File : %s\n"
"Pattern : %s\n"
"Path : %s\n"
"Left,Top,Width,Height : %ld,%ld,%ld,%ld\n",
dr, fl, pt, pa, l, t, w, h );
} else if ( rc == FRQ_CANCEL )
/*
** Requester canceled.
**/
puts("Canceled" );
else
/*
** Error.
**/
printf("Error %ld\n", rc );
/*
** Make it a save requester.
**/
if ( ! ( rc = SetAttrs( filereq, ASLFR_DoSaveMode, TRUE, TAG_END ))) {
/*
** Pop the requester.
**/
if ( ! ( rc = DoRequest( filereq ))) {
/*
** Obtain attribute values.
**/
GetAttrs( filereq, FRQ_Drawer, &dr,
FRQ_File, &fl,
FRQ_Pattern, &pt,
FRQ_Path, &pa,
FRQ_Left, &l,
FRQ_Top, &t,
FRQ_Width, &w,
FRQ_Height, &h,
TAG_END );
/*
** Dump 'm to the console.
**/
printf( "Drawer : %s\n"
"File : %s\n"
"Pattern : %s\n"
"Path : %s\n"
"Left,Top,Width,Height : %ld,%ld,%ld,%ld\n",
dr, fl, pt, pa, l, t, w, h );
} else if ( rc == FRQ_CANCEL )
/*
** Requester canceled.
**/
puts("Canceled" );
else
/*
** Error.
**/
printf("Error %ld\n", rc );
} else
/*
** Error with SetAttrs().
**/
printf( "Error %ld\n", rc );
/*
** Diump the filerequester object.
**/
DisposeObject( filereq);
} else
puts( "unable to create filerequester object." );
/*
** Close the library.
**/
CloseLibrary( BGUIBase );
} else
puts( "unable to open the bgui.library" );
return( 0 );
}
#ifdef _DCC
int wbmain( struct wbStartup *wbs )
{
return( main( 0, NULL ));
}
#endif
/*
* $Log: filereq.c,v $
* Revision 1.2 1994/08/03 11:21:10 jaba
* Switched to proto/ instead of clib/.
*
* Revision 1.1 1994/06/20 16:43:03 jaba
* Initial revision
*
*/