#ifndef PCGWINDOW_H
#define PCGWINDOW_H


#include <intuition/intuition.h>
#include "object.h"
#include "Interactor.h"

typedef struct pcgWindow
   {
      Class                 *isa;
      char                  *ObjectName;
      void                  *Next;      /* Not used. */
      struct pcgWindow      *IaWindow;  /* not used. */
      Point                  Location;
      Point                  Size;
      struct NewWindow       NewWindow;
      struct Window         *Window;
      ULONG                  IDCMPFlags;
      struct Interactor     *FirstInteractor;
      struct GraphicObject  *FirstGraphic;
      struct MsgPort        *SharedUserPort;
      Menu                  *MenuStrip;
   } pcgWindow;

/*
   The field 'IDCMPFlags' maintains the current IDCMP values.  The field
   NewWindow.IDCMPFlags contains the bare minimum IDCMP values that the
   window must have.  (Other IDCMP flags are set automagically by adding
   Interactors to the window.

   NOTE: If SharedUserPort is not NULL, it is assumed to be a pointer to
   a valid MessagePort structure, and that the window is to use this
   MessagePort as its UserPort instead of creating its own.

   This is useful for having multiple windows sharing one MessagePort.
   (See the Amiga 1.3 RKMs:  Libraries and Devices, Chapter 7, page 171
   for more details on sharing UserPorts.
 */




void pcgWindow_Init( pcgWindow     *self,
                     UWORD          leftedge,
                     UWORD          topedge,
                     UWORD          width,
                     UWORD          height,
                     UWORD          minwidth,
                     UWORD          minheight,
                     UWORD          maxwidth,
                     UWORD          maxheight,
                     char          *title,
                     ULONG          IDCMPFlags,
                     ULONG          flags,
                     struct Screen *screen );



struct Window *pcgOpenWindow( pcgWindow *self );

void pcgCloseWindow( pcgWindow  *self );

struct Window *iWindow( pcgWindow *self );
   /* returns a pointer to the Intuition window. */

RastPort *RPort( pcgWindow *self );

ULONG SetIDCMPFlags( pcgWindow *self, ULONG newflags );


void AddWindowObject   ( pcgWindow      *window,
                         GraphicObject   *graphic );

void RemoveWindowObject( pcgWindow      *window,
                         GraphicObject   *graphic );

void AddMenuStrip( pcgWindow *window, Menu *menustrip );

void RemoveMenuStrip( pcgWindow *window );

#endif
