home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / rom / intuition / newobjecta.c < prev    next >
C/C++ Source or Header  |  1997-01-27  |  3KB  |  126 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: newobjecta.c,v 1.5 1997/01/27 00:36:41 ldp Exp $
  4.     $Log: newobjecta.c,v $
  5.     Revision 1.5  1997/01/27 00:36:41  ldp
  6.     Polish
  7.  
  8.     Revision 1.4  1996/12/10 14:00:06  aros
  9.     Moved #include into first column to allow makedepend to see it.
  10.  
  11.     Revision 1.3  1996/10/24 15:51:22  aros
  12.     Use the official AROS macros over the __AROS versions.
  13.  
  14.     Revision 1.2  1996/10/23 16:30:09  aros
  15.     Ooops.. PublicClassList is a MinNode list :-)
  16.  
  17.     Revision 1.1  1996/08/28 17:55:35  digulla
  18.     Proportional gadgets
  19.     BOOPSI
  20.  
  21.  
  22.     Desc:
  23.     Lang: english
  24. */
  25. #define AROS_ALMOST_COMPATIBLE
  26. #include <exec/lists.h>
  27. #include <intuition/classes.h>
  28. #include <proto/exec.h>
  29. #include <proto/alib.h>
  30. #include "intuition_intern.h"
  31.  
  32. /*****************************************************************************
  33.  
  34.     NAME */
  35. #include <intuition/classusr.h>
  36. #include <proto/intuition.h>
  37.  
  38.     AROS_LH3(APTR, NewObjectA,
  39.  
  40. /*  SYNOPSIS */
  41.     AROS_LHA(struct IClass  *, classPtr, A0),
  42.     AROS_LHA(UBYTE          *, classID, A1),
  43.     AROS_LHA(struct TagItem *, tagList, A2),
  44.  
  45. /*  LOCATION */
  46.     struct IntuitionBase *, IntuitionBase, 106, Intuition)
  47.  
  48. /*  FUNCTION
  49.     Use this function to create BOOPSI objects (BOOPSI stands for
  50.     "Basic Object Oriented Programming System for Intuition).
  51.  
  52.     You may specify a class either by it's name (if it's a public class)
  53.     or by a pointer to its definition (if it's a private class). If
  54.     classPtr is NULL, classID is used.
  55.  
  56.     INPUTS
  57.     classPtr - Pointer to a private class (or a public class if you
  58.         happen to have a pointer to it)
  59.     classID - Name of a public class
  60.     tagList - Initial attributes. Read the documentation of the class
  61.         carefully to find out which attributes must be specified
  62.         here and which can.
  63.  
  64.     RESULT
  65.     A BOOPSI object which can be manipulated with general functions and
  66.     which must be disposed with DisposeObject() later.
  67.  
  68.     NOTES
  69.     This functions send OM_NEW to the dispatcher of the class.
  70.  
  71.     EXAMPLE
  72.  
  73.     BUGS
  74.  
  75.     SEE ALSO
  76.     DisposeObject(), SetAttrs(), GetAttr(), MakeClass(),
  77.     "Basic Object-Oriented Programming System for Intuition" and
  78.     "boopsi Class Reference" Dokument.
  79.  
  80.     INTERNALS
  81.  
  82.     HISTORY
  83.     29-10-95    digulla automatically created from
  84.                 intuition_lib.fd and clib/intuition_protos.h
  85.  
  86. *****************************************************************************/
  87. {
  88.     AROS_LIBFUNC_INIT
  89.     AROS_LIBBASE_EXT_DECL(struct IntuitionBase *,IntuitionBase)
  90.     Object * object;
  91.     struct _Object carrier;
  92.  
  93.     /* No classPtr ? */
  94.     if (!classPtr)
  95.     {
  96.     /* Search for the class */
  97.     for (classPtr=GetHead(PublicClassList);
  98.         classPtr;
  99.         classPtr=GetSucc(classPtr)
  100.     )
  101.     {
  102.         if (!strcmp (classPtr->cl_ID, classID))
  103.         break;
  104.     }
  105.  
  106.     if (!classPtr)
  107.         return (NULL); /* Nothing found */
  108.     }
  109.  
  110.     /* Put the classPtr in our dummy object */
  111.     carrier.o_Class = classPtr;
  112.  
  113.     /* Try to create a new object */
  114.     if ((object = (Object *) DoMethod (BASEOBJECT(&carrier), OM_NEW,
  115.         tagList, NULL)))
  116.     {
  117.     OCLASS(object) = classPtr;
  118.  
  119.     /* One more object */
  120.     classPtr->cl_ObjectCount ++;
  121.     }
  122.  
  123.     return (object);
  124.     AROS_LIBFUNC_EXIT
  125. } /* NewObjectA */
  126.