home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / pufferfish / source / buttonclass / buttonclass.doc < prev    next >
Encoding:
Text File  |  1994-03-29  |  5.1 KB  |  156 lines

  1.  
  2.                 Boopsi Button and Progress Class 37.3
  3.  
  4.                            February 6, 1994
  5.  
  6.                       Written by Douglas Keller
  7.  
  8. [Slightly modified by Peter Janes, March 29, 1994, for use in PufferFish.]
  9.  
  10. 0.  Introduction
  11. ----------------
  12.  
  13. Buttonclass is a boopsi custom gadget which looks like a standard
  14. gadtools button gadget.  The buttonclass supports a couple of things
  15. gadtools does not, the foreground and background color of the gadget
  16. can be changed, and the gadget can be put into the selected state so
  17. the gadget looks depressed.
  18.  
  19. Starting with 37.3 the button class supports a standard drawer image
  20. to signal it will open a file requester if pressed.
  21.  
  22. Also starting with 37.3 a progress indicator gadget is included, it is
  23. used to show the progress of an operation from 0 to 100 percent.
  24.  
  25. ButtonClass is based on the example in the RKM Libraries manual.
  26.  
  27.  
  28. 1.  Files
  29. ---------
  30.  
  31. buttonclass.h    - public include file for buttonclass and progressclass
  32.  
  33. buttonclass.c    - Sas/C 6.51 code for the buttonclass
  34.  
  35. progressclass.c  - Sas/C 6.51 code for the progressclass
  36.  
  37. ButtonClassNB.lib- scanned library containing the classes
  38.  
  39. lmkfile          - Sas/C 6.51 makefile
  40.  
  41. test             - test program that uses the classes
  42.  
  43. test.c           - source to test program
  44.  
  45. headers.h        - system headers for buttonclass.c and progressclass.c
  46.  
  47.  
  48. 2.  Using the ButtonClass
  49. -------------------------
  50.  
  51. The buttonclass includes a set of functions to initialize and free the
  52. buttonclass.
  53.  
  54.     Class *initButtonGadgetClass ( struct Library *IntuitionBase,
  55.                struct Library *UtilityBase, struct Library *GfxBase );
  56.  
  57.     BOOL freeButtonGadgetClass ( Class *cl );
  58.  
  59. InitButtonGadgetClass() takes IntuitionBase, UtilityBase, and GfxBase
  60. as arguments.  The reason they are passed in rather then global is so
  61. the buttonclass can be used in a reentrant program which has no
  62. writable global data.
  63.  
  64. To use the progress class, initProgressGadgetClass() and
  65. freeProgressGadgetClass() needs to be used.
  66.  
  67. The Class returned by initButtonGadgetClass() is then passed to
  68. NewObject() to create the gadget.
  69.  
  70.     gad = NewObject(buttonClass, NULL,
  71.         GA_ID,          1L,
  72.         GA_Top,         20
  73.         GA_Left,        20,
  74.         GA_Width,       100,
  75.         GA_Height,      11,
  76.         GA_Immediate,   TRUE,
  77.         GA_RelVerify,   TRUE,
  78.         BUT_Text,       "Label",
  79.         TAG_DONE);
  80.  
  81. SetGadgetAttrs() can be used to change gadget attributes.
  82.  
  83.     SetGadgetAttrs(gad, window, NULL,  /* make the gadget selected */
  84.         GA_Selected,    TRUE,
  85.         TAG_DONE);
  86.  
  87.     SetGadgetAttrs(gad, window, NULL,  /* change gadget text */
  88.         BUT_Text,       "new text",
  89.         TAG_DONE);
  90.  
  91. Buttonclass supports the following gadgets.
  92.  
  93.     BUT_Text       - STRPTR used for the text of the gadget.
  94.     BUT_Color      - Foreground (text) color of the gadget.
  95.     BUT_Key        - char which should be underlined if found in BUT_Text.
  96. [PEJ: No code for BUT_Key exists in the 37.3 release.  '_' is used if found, though.]
  97.     BUT_BackColor  - Background color of the gadget.
  98.     BUT_TextFont   - TextFont struct to used for BUT_Text.
  99.  
  100.     New of 37.2
  101.  
  102.     BUT_Image      - Image to display in the unselected state, (struct Image *)
  103.     BUT_SelectImage- Image to display in the selected state, (struct Image *)
  104.     GA_Disabled    - Disabled TRUE or FALSE.
  105.  
  106.     New of 37.3
  107.  
  108.     BUT_Drawer     - BOOL, if TRUE show a standard drawer image in
  109.                      button.
  110.     PRO_Min        - The low value of the progress indicator, defaults to 0.
  111.     PRO_Max        - The high value of the progress indicator, defaults to 100.
  112.     PRO_Current    - The current value of the progress indicator, must
  113.                      between PRO_Min and PRO_Max.
  114.     PRO_ShowPercent- BOOL, if TRUE show percentage in indicator bar.
  115.     PRO_TextFont   - TextFont struct to used for PRO_ShowPercent.
  116.  
  117.  
  118. Currently the Images are drawn relative to the top left corner of
  119. the gadget using the TopEdge and LeftEdge of Image.  When I get some
  120. time I am going to add support for different justifications of the
  121. Images and Text.
  122.  
  123. If only a BUT_Image is given, the image is draw in the selected state
  124. when it is selected.  This allows boopsi images to be drawn in the
  125. selected state.
  126.  
  127.  
  128. 3.  Legal junk
  129. --------------
  130.  
  131. Permission is granted to distribute this program and its documentation
  132. for non-commercial purposes.  This program may not be distributed for
  133. a profit without permission from Doug Keller.  Fred Fish has
  134. permission to distribute this program as part of the Fred Fish
  135. library.
  136.  
  137. This code can be used for any purpose as long as credit is given.
  138.  
  139.  
  140. 4.  Bugs and Info
  141. -----------------
  142.  
  143. [PEJ: Fixed what may be a bug--top/left lines of bounding box were being
  144. drawn before images were updated, bottom/right lines after.  Now draws an
  145. image, then draws the bounding box.  It works for PufferFish--your mileage
  146. may vary.
  147.  
  148. Also slightly modified the lmkfile: uses both stack and register parameters
  149. (instead of just register parms as distributed).]
  150.  
  151. If you would like to get in touch with me I can be reached on the
  152. following:
  153.  
  154.             Bix : dkeller
  155.         Internet: dkeller@vnet.ibm.com
  156.