home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_C / BUTCLAS3.ZIP / BUTTONCL.DOC < prev    next >
Text File  |  1994-02-08  |  5KB  |  146 lines

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