2 ** $Id: BoopsiLib.h,v 1.1 2000/01/12 20:30:05 bernie Exp $
4 ** Copyright (C) 1999 Bernardo Innocenti
5 ** All rights reserved.
7 ** Use 4 chars wide TABs to read this file
9 ** Prototypes for the GetGadgetBox() and GetGadgetBounds() helpers
12 #ifndef INTUITION_CGHOOKS_H
13 #include <intuition/cghooks.h>
16 #ifndef INTUITION_IMAGECLASS_H
17 #include <intuition/imageclass.h>
21 /* Supported class flavours:
24 * Build a class library if this option is set or
25 * a static linker object otherwise.
28 * Call AddClass() to show this class globally if set,
29 * make a private class otherwise.
31 #define FLAVOUR_CLASSLIB (1<<0)
32 #define FLAVOUR_PUBCLASS (1<<1)
36 /* Useful functions to compute the actual size of a gadget, regardless
37 * of its relativity flags
39 void GetGadgetBox(struct GadgetInfo *ginfo, struct ExtGadget *g, struct IBox *box);
40 void GetGadgetBounds(struct GadgetInfo *ginfo, struct ExtGadget *g, struct IBox *bounds);
43 /* Convert a struct IBox to a struct Rectangle
45 INLINE void IBoxToRect(struct IBox *box, struct Rectangle *rect)
48 ASSERT_VALID_PTR(rect)
50 rect->MinX = box->Left;
51 rect->MinY = box->Top;
52 rect->MaxX = box->Left + box->Width - 1;
53 rect->MaxY = box->Top + box->Height - 1;
57 /* Tell if a gadget has a boopsi frame
59 INLINE BOOL GadgetHasFrame(struct Gadget *g)
63 (g->Flags & GFLG_GADGIMAGE) &&
64 (((struct Image *)g->GadgetRender)->Depth == CUSTOMIMAGEDEPTH));
68 /* Some layers magic adapded from "MUI.undoc",
69 * by Alessandro Zummo <azummo@ita.flashnet.it>
72 /* This macro evalutates to true when the layer is
73 * covered by another layer
75 #define LayerCovered(l) \
76 ((!(l)->ClipRect) || \
77 ((l)->bounds.MinX != (l)->ClipRect->bounds.MinX) || \
78 ((l)->bounds.MinY != (l)->ClipRect->bounds.MinY) || \
79 ((l)->bounds.MaxX != (l)->ClipRect->bounds.MaxX) || \
80 ((l)->bounds.MaxY != (l)->ClipRect->bounds.MaxY))
82 /* memcmp(&(l)->ClipRect->bounds, &(l)->bounds, sizeof (struct Rectangle))) */
84 /* This macro evalutates to true if the layer has damage regions */
85 #define LayerDamaged(l) \
86 ((l)->DamageList && (l)->DamageList->RegionRectangle)
88 /* This macro checks if ScrollRaster() needs to be called to
89 * scroll the layer damage after a scrolling operation.
91 #define NeedZeroScrollRaster(l) \
92 (((l)->Flags & LAYERSIMPLE) && (LayerCovered(l) || LayerDamaged(l)))