/*
 *  WICONIFY    A utility that allows you to iconify any Intuition window
 *              on any screen, and to open WB windows on any screen.
 *
 *  wStructs.h  The main internal structures used by wIconify.
 *
 *  Copyright 1990 by Davide P. Cervone, all rights reserved.
 *  You may use this code, provided this copyright notice is kept intact.
 */

#define WICONREF    struct wIconRef
#define WSCREEN     struct wScreen

#include "wIcon.h"


/*
 *  The is the internal representation of an icon as seen by wIconify.
 *  Each wScreen has a linked list of wIconRefs that are on that screen.
 *  A copy of the original wIcon structure is keep within the wIconRef.
 *  When the wIconCalls library returns icon pointers, it is really 
 *  giving pointers to wIconRefs, not wIcons.  The additional flags
 *  defined below are for system use only, and may not be specified
 *  by the user in a wIcon.Flags field.
 */

struct wIconRef
{
   struct wIconRef *Next,*Prev;
   struct Window *Window;           /* window associated to icon */
   struct wScreen *Screen;          /* wScreen where this window lives */
   struct wGadget *Gadget;          /* gadget in use on backdrop window */
   struct wIcon Icon;               /* icon images, flags, etc. */
      #define WI_DRAGGING           BIT(4)  /* icon is being dragged */
      #define WI_BACKDROPCHANGE     BIT(5)  /* BACKDROP flags was changed */
      #define WI_REFRESHCHANGE      BIT(6)  /* SMART_REFRESH flag was changed */
      #define WI_NOCARECHANGE       BIT(7)  /* NOCAREREFRESH changed */
      #define WI_SYSICON            BIT(8)  /* wIconify allocated it */
      #define WI_SCREENICON         BIT(10) /* icon is for a screen */
      #define WI_SYSTEMFLAGS        0x020005F4  /* can't be set by user */
      #define WI_CHANGEBITS\
         (WI_BACKDROPCHANGE| WI_REFRESHCHANGE| WI_NOCARECHANGE)
};

#undef  WICONREF
typedef struct wIconRef WICONREF;


/*
 *  Each screen with a wIconify window has an associated wScreen structure.
 *  These maintian the information needed to add and remove icons on a
 *  screen, and to close the screen safely.
 */

struct wScreen
{
   struct wScreen *Next,*Prev;
   struct Screen *Screen;       /* pointer to screen */
   struct Window *BackDrop;     /* pointer to wIconify backdrop window */
   struct wbWindow *Window;     /* list of wbWindows openned by wIconify */
   struct wIconRef *IconRef;    /* list of IconRef's for this screen */
   APTR  CloseTask;             /* pointer to task waiting to close screen */
   ULONG CloseSignal;           /*  signal to tell task it's OK to close */
   ULONG Flags;
      #define WI_CLOSING    BIT(0)  /* screen is being closed */
      #define WI_WSCREEN    BIT(1)  /* wIconify opened this screen */
      #define WI_STARTDRAG  BIT(3)  /* Icons are being pressed */
/*    #define WI_DRAGGING   BIT(4)  */
      #define WI_REFRESH    BIT(5)  /* screen icons should be refreshed */
      #define WI_CLEARIT    BIT(6)  /* screen should be cleared first */
      #define WI_LAYERLOCK  BIT(7)  /* the screens layerinfo is locked */
   struct wGadget *Selected;    /* pointer to first selected icon's gadget */
   struct wScreen *NextRefresh; /* pointer to next screen needing refresh */
   WICONREF Icon;               /* the screen's icon */
};

#undef  WSCREEN
typedef struct wScreen WSCREEN;


/*
 *  Each WB window that has been openned on a screen other than the real
 *  WB screen gets one of these structures.  These are used to tell
 *  when it is safe to close a screen.
 */

struct wbWindow
{
   struct wbWindow *Next,*Prev;
   struct Window *Window;           /* window opened on WB screen */
   struct wScreen *Screen;          /* screen that was WB screen */
};

typedef struct wbWindow WBWINDOW;


/*
 *  An exteneded Gadget definition that includes the gadget's IText,
 *  and BoolInfo, as well as pointers used in multiple selection.
 */

struct wGadget
{
   struct Gadget Gadget;                    /* actual Gadget structure */
   struct IntuiText IText;                  /* gadget's text */
   struct wGadget *NextSelect,*PrevSelect;  /* linked list of gadgets */
   struct BoolInfo Mask;                    /* the gadget Mask */
};

typedef struct wGadget WGADGET;


/*
 *  Each screen in the ignored-screen list has one of these.
 */

struct Ignore                               /* screens to ignore */
{
   struct Ignore *Next;                     /* linked list of them */
   char *Title;                             /* ignore screens of this title */
};
