home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Elysian Archive
/
AmigaElysianArchive.iso
/
prog
/
c
/
precg105.lha
/
source
/
StringLister.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-12-24
|
4KB
|
155 lines
/* ==========================================================================
**
** StringLister.c
**
** A StringLister is an object whose primary purpose in life is to
** manage a list of strings.
**
** ©1991 WILLISoft
**
** ==========================================================================
*/
#include "StringLister.h"
#include "StringListerClass.h"
#include <proto/exec.h>
#include <proto/intuition.h>
#include <proto/graphics.h>
#include "amigamem.h"
BOOL StringLister_AddString( StringLister *self, char *string, UBYTE qualifier )
{
StringList *slist;
if (slist = StringList_of(self))
{
return StringList_AddString( slist, string, qualifier );
}
return FALSE;
}
BOOL StringLister_DeleteString( StringLister *self, USHORT i )
{
StringList *slist;
/*printf("StringLister_DeleteString\n");*/
if (slist = StringList_of(self))
{
return StringList_DeleteString( slist, i );
}
return FALSE;
}
BOOL StringLister_DeleteAllStrings( StringLister *self )
{
StringList *slist;
/*printf("StringLister_DeleteString\n");*/
if (slist = StringList_of(self))
{
return StringList_DeleteAllStrings( slist );
}
return FALSE;
}
void SelectString( StringLister *self, USHORT i, BOOL select )
{
struct StringListerClass *class;
if (class = (struct StringListerClass*) self->isa)
{
if (class->SelectString)
(*class->SelectString)( self, i, select );
}
}
BOOL StringLister_elaborated = FALSE;
struct StringListerClass StringLister_Class;
void StringListerClass_Init( struct StringListerClass *class )
{
InteractorClass_Init( (struct InteractorClass *) class );
class->isa = InteractorClass();
class->ClassName = "StringLister";
class->AddString = StringLister_AddString;
class->DeleteString = StringLister_DeleteString;
class->DeleteAllStrings = StringLister_DeleteAllStrings;
class->StringList_of = NULL;
class->SelectString = NULL;
}
struct StringListerClass *StringListerClass( void )
{
if (! StringLister_elaborated)
{
StringListerClass_Init( &StringLister_Class );
StringLister_elaborated = TRUE;
}
return &StringLister_Class;
}
void StringLister_Init( StringLister *self )
{
Interactor_Init( self );
self->isa = StringListerClass();
}
BOOL AddString( StringLister *self, char *string, UBYTE qualifier )
{
struct StringListerClass *class;
if (class= (struct StringListerClass*) self->isa)
{
if (class->AddString)
{
/*printf("AddString, class=%s, string=%s, qualifier=%d\n",*/
/* class->ClassName, string, qualifier );*/
return (*class->AddString)(self, string, qualifier );
}
}
return FALSE;
}
BOOL DeleteString( StringLister *self, USHORT i )
{
struct StringListerClass *class;
if (class= (struct StringListerClass*) self->isa)
{
if (class->DeleteString)
return (*class->DeleteString)(self, i );
}
return FALSE;
}
BOOL DeleteAllStrings( StringLister *self )
{
struct StringListerClass *class;
if (class= (struct StringListerClass*) self->isa)
{
if (class->DeleteAllStrings)
return (*class->DeleteAllStrings)(self);
}
return FALSE;
}
const StringList *StringList_of( StringLister *self )
{
struct StringListerClass *class;
if (class= (struct StringListerClass*) self->isa)
{
if (class->StringList_of)
return (*class->StringList_of)(self);
}
return NULL;
}