2 Copyright © 1995-2013, 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);
76 *****************************************************************************/
82 if (!gadgets
|| !numGad
)
85 if ((gadgets
->GadgetType
& GTYP_REQGADGET
) == 0)
89 else if (numGad
== -2)
91 gadgets
= requester
->ReqGadget
;
95 LOCKGADGET(IntuitionBase
)
97 LOCKWINDOWLAYERS(window
);
100 int_refreshglist(gadgets
,
109 UNLOCKGADGET(IntuitionBase
)
111 UNLOCKWINDOWLAYERS(window
);
114 ReturnVoid("RefreshGList");
119 void int_refreshglist(struct Gadget
*gadgets
, struct Window
*window
,
120 struct Requester
*requester
, LONG numGad
, LONG mustbe
, LONG mustnotbe
,
121 struct IntuitionBase
*IntuitionBase
)
123 #ifdef GADTOOLSCOMPATIBLE
125 struct Gadget
*gadtoolsgadget
= 0;
129 DEBUG_INTREFRESHGLIST(dprintf("IntRefreshGList: Gadgets 0x%lx Window 0x%lx Req 0x%lx Num %ld Must 0x%lx MustNot 0x%lx\n",
130 gadgets
, window
, requester
, numGad
, mustbe
, mustnotbe
));
132 // in case we're not called from RefreshGList...
134 LOCKGADGET(IntuitionBase
)
136 LOCKWINDOWLAYERS(window
);
139 for ( ; gadgets
&& numGad
; gadgets
=gadgets
->NextGadget
, numGad
--)
141 #ifdef GADTOOLSCOMPATIBLE
142 if (gadgets
->GadgetType
& 0x100)
144 gadtoolsgadget
= gadgets
;
149 if (!(qualifygadget(gadgets
,mustbe
,mustnotbe
,IntuitionBase
))) continue;
150 //DEBUG_REFRESHGLIST(dprintf("IntRefreshGList: Gadget %p Type 0x%04lx\n",
151 // gadgets, gadgets->GadgetType));
153 D(bug("RefreshGList: gadget=%p type 0x%x [%d %d %d %d]\n",
154 gadgets
,gadgets
->GadgetType
,
155 gadgets
->LeftEdge
,gadgets
->TopEdge
,
156 gadgets
->Width
,gadgets
->Height
));
158 /*SetAPen(window->RPort, 4);
159 Move(window->RPort, gadgets->LeftEdge-1, gadgets->TopEdge-1);
160 Draw(window->RPort, gadgets->LeftEdge+gadgets->Width, gadgets->TopEdge-1);
161 Draw(window->RPort, gadgets->LeftEdge+gadgets->Width, gadgets->TopEdge+gadgets->Height);
162 Draw(window->RPort, gadgets->LeftEdge-1, gadgets->TopEdge+gadgets->Height);
163 Draw(window->RPort, gadgets->LeftEdge-1, gadgets->TopEdge-1);*/
165 rendergadget(gadgets
,window
,requester
,IntuitionBase
);
166 } /* for ( ; gadgets && numGad; gadgets=gadgets->NextGadget, numGad --) */
168 #ifdef GADTOOLSCOMPATIBLE
171 for ( ; gadtoolsgadget
&& num
; num
--)
173 if ((gadtoolsgadget
->GadgetType
& 0x100) && (qualifygadget(gadtoolsgadget
,mustbe
,mustnotbe
,IntuitionBase
))) rendergadget(gadtoolsgadget
,window
,requester
,IntuitionBase
);
174 gadtoolsgadget
= findprevgadget(gadtoolsgadget
,window
,IntuitionBase
);
180 UNLOCKGADGET(IntuitionBase
)
182 UNLOCKWINDOWLAYERS(window
);
186 BOOL
qualifygadget(struct Gadget
*gadgets
,LONG mustbe
, LONG mustnotbe
,struct IntuitionBase
*IntuitionBase
)
188 if ((mustbe
!= 0) || (mustnotbe
!= 0))
190 if (gadgets
->Activation
& (GACT_LEFTBORDER
| GACT_RIGHTBORDER
|
191 GACT_TOPBORDER
| GACT_BOTTOMBORDER
|
194 if (mustnotbe
& REFRESHGAD_BORDER
) return FALSE
; /* don't refresh if border gadget */
198 if (mustbe
& REFRESHGAD_BORDER
) return FALSE
; /* don't refresh if not a border gadget */
201 if (gadgets
->Activation
& GACT_TOPBORDER
)
203 if (mustnotbe
& REFRESHGAD_TOPBORDER
) return FALSE
; /* don't refresh if border gadget */
207 if (mustbe
& REFRESHGAD_TOPBORDER
) return FALSE
; /* don't refresh if not a border gadget */
210 if (gadgets
->Flags
& (GFLG_RELRIGHT
| GFLG_RELBOTTOM
|
211 GFLG_RELWIDTH
| GFLG_RELHEIGHT
))
213 if (mustnotbe
& REFRESHGAD_REL
) return FALSE
; /* don't refresh if rel??? gadget */
217 if (mustbe
& REFRESHGAD_REL
) return FALSE
; /* don't refresh if not rel??? gadget */
220 if (gadgets
->Flags
& GFLG_RELSPECIAL
)
222 if (mustnotbe
& REFRESHGAD_RELS
) return FALSE
; /* don't refresh if relspecial gadget */
226 if (mustbe
& REFRESHGAD_RELS
) return FALSE
; /* don't refresh if not relspecial gadget */
229 if ((gadgets
->GadgetType
& GTYP_GTYPEMASK
) == GTYP_CUSTOMGADGET
)
231 if (mustnotbe
& REFRESHGAD_BOOPSI
) return FALSE
; /* don't refresh if boopsi gadget */
235 if (mustbe
& REFRESHGAD_BOOPSI
) return FALSE
; /* don't refresh if not boopsi gadget */
238 } /* if ((mustbe != 0) || (mustnotbe != 0)) */
242 void rendergadget(struct Gadget
*gadgets
,struct Window
*window
, struct Requester
*requester
,struct IntuitionBase
*IntuitionBase
)
244 switch (gadgets
->GadgetType
& GTYP_GTYPEMASK
)
246 case GTYP_BOOLGADGET
:
247 RefreshBoolGadget (gadgets
, window
, requester
, IntuitionBase
);
250 case GTYP_GADGET0002
:
253 case GTYP_PROPGADGET
:
254 RefreshPropGadget (gadgets
, window
, requester
, IntuitionBase
);
258 RefreshStrGadget (gadgets
, window
, requester
, IntuitionBase
);
261 case GTYP_CUSTOMGADGET
:
262 RefreshBoopsiGadget (gadgets
, window
, requester
, IntuitionBase
);
266 RefreshBoolGadget (gadgets
, window
, requester
, IntuitionBase
);
269 } /* switch GadgetType */
272 struct Gadget
*findprevgadget(struct Gadget
*gadget
,struct Window
*window
,struct IntuitionBase
*IntuitionBase
)
274 struct Gadget
*prevgad
= 0, *gad
;
276 for (gad
= window
->FirstGadget
; gad
; gad
= gad
->NextGadget
)
278 if (gad
== gadget
) return prevgad
;