/*  File:         gui.h
 *  Created:      20-10-95
 *  Updated:      30-12-95
 *  Version:      1.0
 *  Project:      Clicker
 *  Owner:        Jeroen Vermeulen
 *  Requirements: KickStart V39+
 *  Legal:        PD
 *  Status:       Release
 */

/* Enumeration type for our prefs window gadgets:
 */
enum { mygadget_clickmouse, mygadget_volume, mygadget_period, mygadget_cycles };


/* Struct WindowContext:
 * Contains all state associated with the prefs window.  This is used as a
 * handle for keeping track of all window data and passing it around.
 * NOTE:  Any item can change if the window is opened or closed.
 * NOTE:  Items not marked "SAFE" may not even be valid.
 */
struct WindowContext
{
  BOOL           Shown;         /* Window is currently visible?         VALID */
  ULONG          SigMask;       /* IDCMP-port sig mask for window.      VALID */
  struct Window *Win;           /* Window struct.                             */
  struct Gadget *glist;         /* GadTools gadget list                       */
  void          *visinfo;       /* VisualInfo.                                */
  struct Screen *pubscr;        /* Current screen.                      VALID */
};


/* MakeWindow():
 * Sets up the prefs window, but doesn't show it unless the Show argument is
 * TRUE.  If successful, MakeWindow() returns a pointer to a WindowContext
 * structure.  If not, NULL is returned and the STRPTR pointed to by errptr will
 * point to an error string.
 * The window must later be deallocated with DestroyWindow().
 */
struct WindowContext *MakeWindow(STRPTR *const errptr, const BOOL Show);


/* ShowWindow():
 * Reveal prefs window, setting it up first if necessary.  A non-NULL pointer to
 * its WindowContext structure is passed in as an argument.
 * If the window fails to open, errptr will point to an error string.
 */
void ShowWindow(STRPTR *const errptr, struct WindowContext *const WinStruct);


/* HideWindow():
 * Removes the prefs window from the screen, but may keep its structures around
 * for speed and convenience.
 */
void HideWindow(struct WindowContext *const WinStruct);


/* DestroyWindow():
 * Call this to deallocate the prefs window.  It will be closed first if
 * necessary.
 */
void DestroyWindow(struct WindowContext *const WinStruct);
