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

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: newmodifyprop.c,v 1.5 1997/01/27 00:36:41 ldp Exp $
  4.     $Log: newmodifyprop.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/11/08 11:28:04  aros
  12.     All OS function use now Amiga types
  13.  
  14.     Moved intuition-driver protos to intuition_intern.h
  15.  
  16.     Revision 1.2  1996/10/24 15:51:22  aros
  17.     Use the official AROS macros over the __AROS versions.
  18.  
  19.     Revision 1.1  1996/10/10 13:09:55  digulla
  20.     New function: NewModifyProp()
  21.  
  22.  
  23.     Desc:
  24.     Lang: english
  25. */
  26. #include "intuition_intern.h"
  27. #include "propgadgets.h"
  28.  
  29. /*****************************************************************************
  30.  
  31.     NAME */
  32. #include <intuition/intuition.h>
  33. #include <proto/intuition.h>
  34.  
  35.     AROS_LH9(void, NewModifyProp,
  36.  
  37. /*  SYNOPSIS */
  38.     AROS_LHA(struct Gadget    *, gadget, A0),
  39.     AROS_LHA(struct Window    *, window, A1),
  40.     AROS_LHA(struct Requester *, requester, A2),
  41.     AROS_LHA(ULONG             , flags, D0),
  42.     AROS_LHA(ULONG             , horizPot, D1),
  43.     AROS_LHA(ULONG             , vertPot, D2),
  44.     AROS_LHA(ULONG             , horizBody, D3),
  45.     AROS_LHA(ULONG             , vertBody, D4),
  46.     AROS_LHA(LONG              , numGad, D5),
  47.  
  48. /*  LOCATION */
  49.     struct IntuitionBase *, IntuitionBase, 78, Intuition)
  50.  
  51. /*  FUNCTION
  52.     Changes the values in the PropInfo-structure of a proportional
  53.     gadget and refreshes the specified number of gadgets beginning
  54.     at the proportional gadget. If numGad is 0 (zero), then no
  55.     refreshing is done.
  56.  
  57.     INPUTS
  58.     gadget - Must be a PROPGADGET
  59.     window - The window which contains the gadget
  60.     requester - If the gadget has GTYP_REQGADGET set, this must be
  61.         non-NULL.
  62.     flags - New flags
  63.     horizPot - New value for the HorizPot field of the PropInfo
  64.     vertPot - New value for the VertPot field of the PropInfo
  65.     horizBody - New value for the HorizBody field of the PropInfo
  66.     vertBody - New value for the VertBody field of the PropInfo
  67.     numGad - How many gadgets to refresh. 0 means none (not even
  68.         the current gadget) and -1 means all of them.
  69.  
  70.     RESULT
  71.     None.
  72.  
  73.     NOTES
  74.  
  75.     EXAMPLE
  76.  
  77.     BUGS
  78.  
  79.     SEE ALSO
  80.     NewModifyProp(), RefreshGadgets(), RefreshGList()
  81.  
  82.     INTERNALS
  83.  
  84.     HISTORY
  85.     29-10-95    digulla automatically created from
  86.                 intuition_lib.fd and clib/intuition_protos.h
  87.  
  88. *****************************************************************************/
  89. {
  90.     AROS_LIBFUNC_INIT
  91.     AROS_LIBBASE_EXT_DECL(struct IntuitionBase *,IntuitionBase)
  92.     struct PropInfo * pi;
  93.     struct BBox old, new;
  94.     int right, bottom;
  95.  
  96.     if ((gadget->GadgetType & GTYP_GTYPEMASK) != GTYP_PROPGADGET
  97.     || !gadget->SpecialInfo
  98.     )
  99.     return;
  100.  
  101.     pi = gadget->SpecialInfo;
  102.  
  103.     CalcBBox (window, gadget, &old);
  104.  
  105.     new = old;
  106.  
  107.     CalcKnobSize (gadget, &old);
  108.  
  109.     pi->Flags = flags;
  110.     pi->HorizPot = horizPot;
  111.     pi->VertPot = vertPot;
  112.     pi->HorizBody = horizBody;
  113.     pi->VertBody = vertBody;
  114.  
  115.     CalcKnobSize (gadget, &new);
  116.  
  117.     right = old.Left + old.Width; /* No -1 here; we don't add +1 later */
  118.     bottom = old.Top + old.Height;
  119.  
  120.     /* Calculate area to clear */
  121.     if (new.Left < old.Left)
  122.     old.Left = new.Left;
  123.  
  124.     if (new.Top < old.Top)
  125.     old.Top = new.Top;
  126.  
  127.     if (new.Left+new.Width > right)
  128.     right = new.Left + new.Width;
  129.  
  130.     if (new.Top+new.Height > bottom)
  131.     bottom = new.Top + new.Height;
  132.  
  133.     old.Width = right - old.Left; /* No +1 here; see above */
  134.     old.Height = bottom - old.Top; /* No +1 here; see above */
  135.  
  136.     RefreshPropGadgetKnob (flags, &old, &new, window, IntuitionBase);
  137.  
  138.     if (numGad > 1 && gadget->NextGadget)
  139.     RefreshGList (gadget->NextGadget, window, requester, numGad-1);
  140.  
  141.     AROS_LIBFUNC_EXIT
  142. } /* NewModifyProp */
  143.