home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of A1200
/
World_Of_A1200.iso
/
programs
/
printer
/
graphpaper
/
src
/
src.lha
/
gads.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-04-06
|
1KB
|
61 lines
#include "graph.h"
#define KEEPORDER 1
/* Remove gads from, or add to, the window's list in hopes of speeding */
/* things up by not refreshing the world just to refresh one. */
static struct Gadget *head = NULL;
void Snip(struct Gadget *gad)
{
/* Use ID field to rember old position, in case we want it later. */
/* The UserData field is already being used for other things. */
gad->GadgetID = RemoveGadget(wG, gad);
/* remember it */
gad->NextGadget = head;
head = gad;
}
/* cut out all but 1 gadget */
void SnipAllBut(struct Gadget *keeper)
{
struct Gadget *walker;
walker = wG->FirstGadget;
while (walker) {
if (walker == keeper) {
walker = walker->NextGadget;
} else {
Snip(walker);
walker = wG->FirstGadget; /* resync */
}
}
}
void RestoreGads(void)
{
struct Gadget *gad;
int position = 0;
while (head) {
gad = head;
head = gad->NextGadget;
gad->NextGadget = NULL;
#if KEEPORDER
position = gad->GadgetID;
#endif
AddGadget(wG, gad, position);
}
}
void RefreshOneGad(struct Gadget *gad)
{
SnipAllBut(gad);
RefreshGadgets(gad, wG, NULL);
RestoreGads();
}