home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / developm / source / frntsdk1.cpt / Frontier SDK 1.0 ƒ / Applet Toolkit / smallicon.c < prev   
Encoding:
C/C++ Source or Header  |  1991-11-03  |  1.0 KB  |  53 lines

  1.  
  2.  
  3. /*⌐ Copyright 1988-1991 UserLand Software, Inc.  All Rights Reserved.*/
  4.  
  5.  
  6.  
  7. #include "appletinternal.h"
  8.  
  9.  
  10. typedef char smalliconbits [32];
  11.  
  12. typedef smalliconbits *ptrsmalliconbits, **hdlsmalliconbits;
  13.  
  14.  
  15.  
  16.  
  17. boolean plotsmallicon (hdlappwindow appwindow, Rect r, short iconlist, short iconnum, boolean flinvert) {
  18.  
  19.     register hdlsmalliconbits hbits;
  20.     register short mode;
  21.     BitMap bmap;
  22.     
  23.     hbits = (hdlsmalliconbits) GetResource ('SICN', iconlist);
  24.     
  25.     if (hbits == nil) /*failed to load the resource*/  
  26.         return (false);
  27.         
  28.     r.right = r.left + widthsmallicon; /*we only pay attention to the top, left fields of rectangle*/
  29.     
  30.     r.bottom = r.top + heightsmallicon;
  31.         
  32.     bmap.baseAddr = (Ptr) &(*hbits) [iconnum];
  33.     
  34.     bmap.rowBytes = 2;
  35.     
  36.     bmap.bounds.top = bmap.bounds.left = 0; 
  37.     
  38.     bmap.bounds.bottom = r.bottom - r.top; 
  39.     
  40.     bmap.bounds.right = r.right - r.left;
  41.     
  42.     if (flinvert)
  43.         mode = notSrcCopy;
  44.     else 
  45.         mode = srcCopy;
  46.         
  47.     CopyBits (&bmap, &(*(**appwindow).macwindow).portBits, &bmap.bounds, &r, mode, nil);
  48.     
  49.     return (true);
  50.     } /*plotsmallicon*/
  51.     
  52.     
  53.