home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Extras / BOOPSI / led_ic / classbase.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-10-27  |  3.5 KB  |  128 lines

  1. /*****************************************************************************
  2.  *
  3.  * COPYRIGHT: Unless otherwise noted, all files are Copyright (c) 1992-1999
  4.  * Amiga, Inc. All rights reserved.
  5.  *
  6.  * DISCLAIMER: This software is provided "as is".  No representations or
  7.  * warranties are made with respect to the accuracy, reliability,
  8.  * performance, currentness, or operation of this software, and all use is at
  9.  * your own risk. Neither Amiga nor the authors assume any responsibility
  10.  * or liability whatsoever with respect to your use of this software.
  11.  *
  12.  *****************************************************************************
  13.  * classbase.c
  14.  * Class library initialization
  15.  * Written by David N. Junod
  16.  *
  17.  */
  18.  
  19. #include <exec/types.h>
  20. #include <intuition/classes.h>
  21. #include <intuition/classusr.h>
  22.  
  23. #include <clib/intuition_protos.h>
  24.  
  25. #include <pragmas/intuition_pragmas.h>
  26.  
  27. /*****************************************************************************/
  28.  
  29. #include "classbase.h"
  30. #include "classdata.h"
  31.  
  32. /****** led.image/--datasheet-- ***********************************************
  33. *
  34. *    NAME
  35. *       led.image--Simulated LED display image.                 (V42)
  36. *
  37. *    SUPERCLASS
  38. *    imageclass
  39. *
  40. *    DESCRIPTION
  41. *    The led.image image class provides a simulated LED image display.
  42. *
  43. *    METHODS
  44. *    OM_NEW--Create the LED image.  Passed to superclass, then OM_SET.
  45. *
  46. *    OM_SET--Set object attributes.  Passed to superclass first.
  47. *
  48. *    OM_UPDATE--Set object notification attributes.  Passed to superclass
  49. *        first.
  50. *
  51. *    IM_DRAW--Renders the images.  Overrides the superclass.
  52. *
  53. *    All other methods are passed to the superclass, including OM_DISPOSE.
  54. *
  55. *    ATTRIBUTES
  56. *    SYSIA_DrawInfo (struct DrawInfo *) -- Contains important pen
  57. *        information.  This is required if IA_BGPen and IA_FGPen are
  58. *        not specified.
  59. *
  60. *    IA_FGPen (LONG) -- Pen to use to draw the lit segments.  If -1
  61. *        is specified then TEXTPEN is used.
  62. *
  63. *    IA_BGPen (LONG) -- Pen to use to draw the unlit segments or
  64. *        background.  If -1 is specified then BACKGROUNDPEN is used.
  65. *
  66. *    IA_Width (LONG) -- Width of the image.
  67. *
  68. *    IA_Height (LONG) -- Height of the image.
  69. *
  70. *    LED_Pairs (LONG) -- Number of pairs of digits.
  71. *
  72. *    LED_Values (WORD *) -- Array of values.  One entry per pair
  73. *        is required.
  74. *
  75. *    LED_Colon (BOOL) -- Is the colon between pairs lit or not.
  76. *        Defaults to FALSE.
  77. *
  78. *    LED_Signed (BOOL) -- Leave room for a negative sign or
  79. *        not.  Defaults to FALSE.
  80. *
  81. *    LED_Negative (BOOL) -- Is the negative sign lit or not.
  82. *        Defaults to FALSE.
  83. *
  84. *******************************************************************************
  85. *
  86. * David N. Junod
  87. *
  88. */
  89.  
  90. /*****************************************************************************/
  91.  
  92. VOID CallCHook(void);
  93.  
  94. /*****************************************************************************/
  95.  
  96. BOOL __asm CreateClass (register __a6 struct ClassLib *cb)
  97. {
  98.     Class *cl;
  99.  
  100.     if (cl = MakeClass ("led.image", IMAGECLASS, NULL, sizeof (struct objectData), 0))
  101.     {
  102.         cl->cl_Dispatcher.h_Entry    = (HOOKFUNC)CallCHook;
  103.         cl->cl_Dispatcher.h_SubEntry = (HOOKFUNC)ClassDispatcher;
  104.     cl->cl_Dispatcher.h_Data     = cb;
  105.     cl->cl_UserData              = (ULONG) cb;
  106.     AddClass (cl);
  107.     }
  108.  
  109.     /* Set the class pointer */
  110.     cb->cb_Library.cl_Class = cl;
  111.  
  112.     return (BOOL)(cl != NULL);
  113. }
  114.  
  115.  
  116. /*****************************************************************************/
  117.  
  118.  
  119. BOOL __asm DestroyClass (register __a6 struct ClassLib *cb)
  120. {
  121.     BOOL result;
  122.  
  123.     if (result = FreeClass (cb->cb_Library.cl_Class))
  124.     cb->cb_Library.cl_Class = NULL;
  125.  
  126.     return result;
  127. }
  128.