2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
7 #include <proto/layers.h>
8 #include "intuition_intern.h"
9 #include "boolgadgets.h"
10 #include "boopsigadgets.h"
11 #include "propgadgets.h"
12 #include "strgadgets.h"
16 #include <aros/debug.h>
18 #include <intuition/classes.h>
20 BOOL
qualifygadget(struct Gadget
*gadgets
,LONG mustbe
, LONG mustnotbe
,struct IntuitionBase
*IntuitionBase
);
21 void rendergadget(struct Gadget
*gadgets
,struct Window
*window
, struct Requester
*requester
,struct IntuitionBase
*IntuitionBase
);
22 struct Gadget
*findprevgadget(struct Gadget
*gadget
,struct Window
*window
,struct IntuitionBase
*IntuitionBase
);
24 /*****************************************************************************
27 #include <intuition/intuition.h>
28 #include <proto/intuition.h>
30 AROS_LH4(void, RefreshGList
,
33 AROS_LHA(struct Gadget
*, gadgets
, A0
),
34 AROS_LHA(struct Window
*, window
, A1
),
35 AROS_LHA(struct Requester
*, requester
, A2
),
36 AROS_LHA(LONG
, numGad
, D0
),
39 struct IntuitionBase
*, IntuitionBase
, 72, Intuition
)
42 Refresh (draw anew) the specified number of gadgets starting
43 at the specified gadget.
46 gadgets - This is the first gadget which will be refreshed.
47 window - The window which contains the gadget
48 requester - If the gadget has GTYP_REQGADGET set, this must be
49 a pointer to a Requester; otherwise the value is
51 numGad - How many gadgets should be refreshed. The value
52 may range from 0 to MAXLONG. If there are less gadgets
53 in the list than numGad, only the gadgets in the
54 list will be refreshed.
60 This function *must not* be called inside a
61 BeginRefresh()/EndRefresh() pair.
65 RefreshGList (&gadget, win, NULL, 1);
67 // Refresh all gadgets in the window
68 RefreshGList (win->FirstGadget, win, NULL, -1L);
77 29-10-95 digulla automatically created from
78 intuition_lib.fd and clib/intuition_protos.h
80 *****************************************************************************/
86 if (!gadgets
|| !numGad
)
89 if ((gadgets
->GadgetType
& GTYP_REQGADGET
) == 0)
93 else if (numGad
== -2)
95 gadgets
= requester
->ReqGadget
;
101 LOCKWINDOWLAYERS(window
);
104 int_refreshglist(gadgets
,
115 UNLOCKWINDOWLAYERS(window
);
118 ReturnVoid("RefreshGList");
123 void int_refreshglist(struct Gadget
*gadgets
, struct Window
*window
,
124 struct Requester
*requester
, LONG numGad
, LONG mustbe
, LONG mustnotbe
,
125 struct IntuitionBase
*IntuitionBase
)
127 #ifdef GADTOOLSCOMPATIBLE
129 struct Gadget
*gadtoolsgadget
= 0;
133 DEBUG_INTREFRESHGLIST(dprintf("IntRefreshGList: Gadgets 0x%lx Window 0x%lx Req 0x%lx Num %ld Must 0x%lx MustNot 0x%lx\n",
134 gadgets
, window
, requester
, numGad
, mustbe
, mustnotbe
));
136 // in case we're not called from RefreshGList...
140 LOCKWINDOWLAYERS(window
);
143 for ( ; gadgets
&& numGad
; gadgets
=gadgets
->NextGadget
, numGad
--)
145 #ifdef GADTOOLSCOMPATIBLE
146 if (gadgets
->GadgetType
& 0x100)
148 gadtoolsgadget
= gadgets
;
153 if (!(qualifygadget(gadgets
,mustbe
,mustnotbe
,IntuitionBase
))) continue;
154 //DEBUG_REFRESHGLIST(dprintf("IntRefreshGList: Gadget %p Type 0x%04lx\n",
155 // gadgets, gadgets->GadgetType));
157 D(bug("RefreshGList: gadget=%p type 0x%x [%d %d %d %d]\n",
158 gadgets
,gadgets
->GadgetType
,
159 gadgets
->LeftEdge
,gadgets
->TopEdge
,
160 gadgets
->Width
,gadgets
->Height
));
162 /*SetAPen(window->RPort, 4);
163 Move(window->RPort, gadgets->LeftEdge-1, gadgets->TopEdge-1);
164 Draw(window->RPort, gadgets->LeftEdge+gadgets->Width, gadgets->TopEdge-1);
165 Draw(window->RPort, gadgets->LeftEdge+gadgets->Width, gadgets->TopEdge+gadgets->Height);
166 Draw(window->RPort, gadgets->LeftEdge-1, gadgets->TopEdge+gadgets->Height);
167 Draw(window->RPort, gadgets->LeftEdge-1, gadgets->TopEdge-1);*/
169 rendergadget(gadgets
,window
,requester
,IntuitionBase
);
170 } /* for ( ; gadgets && numGad; gadgets=gadgets->NextGadget, numGad --) */
172 #ifdef GADTOOLSCOMPATIBLE
175 for ( ; gadtoolsgadget
&& num
; num
--)
177 if ((gadtoolsgadget
->GadgetType
& 0x100) && (qualifygadget(gadtoolsgadget
,mustbe
,mustnotbe
,IntuitionBase
))) rendergadget(gadtoolsgadget
,window
,requester
,IntuitionBase
);
178 gadtoolsgadget
= findprevgadget(gadtoolsgadget
,window
,IntuitionBase
);
186 UNLOCKWINDOWLAYERS(window
);
190 BOOL
qualifygadget(struct Gadget
*gadgets
,LONG mustbe
, LONG mustnotbe
,struct IntuitionBase
*IntuitionBase
)
192 if ((mustbe
!= 0) || (mustnotbe
!= 0))
194 if (gadgets
->Activation
& (GACT_LEFTBORDER
| GACT_RIGHTBORDER
|
195 GACT_TOPBORDER
| GACT_BOTTOMBORDER
|
198 if (mustnotbe
& REFRESHGAD_BORDER
) return FALSE
; /* don't refresh if border gadget */
202 if (mustbe
& REFRESHGAD_BORDER
) return FALSE
; /* don't refresh if not a border gadget */
205 if (gadgets
->Activation
& GACT_TOPBORDER
)
207 if (mustnotbe
& REFRESHGAD_TOPBORDER
) return FALSE
; /* don't refresh if border gadget */
211 if (mustbe
& REFRESHGAD_TOPBORDER
) return FALSE
; /* don't refresh if not a border gadget */
214 if (gadgets
->Flags
& (GFLG_RELRIGHT
| GFLG_RELBOTTOM
|
215 GFLG_RELWIDTH
| GFLG_RELHEIGHT
))
217 if (mustnotbe
& REFRESHGAD_REL
) return FALSE
; /* don't refresh if rel??? gadget */
221 if (mustbe
& REFRESHGAD_REL
) return FALSE
; /* don't refresh if not rel??? gadget */
224 if (gadgets
->Flags
& GFLG_RELSPECIAL
)
226 if (mustnotbe
& REFRESHGAD_RELS
) return FALSE
; /* don't refresh if relspecial gadget */
230 if (mustbe
& REFRESHGAD_RELS
) return FALSE
; /* don't refresh if not relspecial gadget */
233 if ((gadgets
->GadgetType
& GTYP_GTYPEMASK
) == GTYP_CUSTOMGADGET
)
235 if (mustnotbe
& REFRESHGAD_BOOPSI
) return FALSE
; /* don't refresh if boopsi gadget */
239 if (mustbe
& REFRESHGAD_BOOPSI
) return FALSE
; /* don't refresh if not boopsi gadget */
242 } /* if ((mustbe != 0) || (mustnotbe != 0)) */
246 void rendergadget(struct Gadget
*gadgets
,struct Window
*window
, struct Requester
*requester
,struct IntuitionBase
*IntuitionBase
)
248 switch (gadgets
->GadgetType
& GTYP_GTYPEMASK
)
250 case GTYP_BOOLGADGET
:
251 RefreshBoolGadget (gadgets
, window
, requester
, IntuitionBase
);
254 case GTYP_GADGET0002
:
257 case GTYP_PROPGADGET
:
258 RefreshPropGadget (gadgets
, window
, requester
, IntuitionBase
);
262 RefreshStrGadget (gadgets
, window
, requester
, IntuitionBase
);
265 case GTYP_CUSTOMGADGET
:
266 RefreshBoopsiGadget (gadgets
, window
, requester
, IntuitionBase
);
270 RefreshBoolGadget (gadgets
, window
, requester
, IntuitionBase
);
273 } /* switch GadgetType */
276 struct Gadget
*findprevgadget(struct Gadget
*gadget
,struct Window
*window
,struct IntuitionBase
*IntuitionBase
)
278 struct Gadget
*prevgad
= 0, *gad
;
280 for (gad
= window
->FirstGadget
; gad
; gad
= gad
->NextGadget
)
282 if (gad
== gadget
) return prevgad
;