#include "xheaders.h"

#include XDragHandler_i
#include XDragEvent_i
#include XMouseHandler_i
#include XMouseEvent_i
#include XWindow_i
#include XContainerHandler_i
#include XItemDrawHandler_i
#include XBackgroundDrawHandler_i
#include XStyleHandler_i

#include <stdlib.h>


XHandler :: XHandler( USHORT ide, XWindow * handleWindow)
{
   SHORT i;

   id = ide;
   handleFor = handleWindow;

   handleFor->handlers += 1;
   handleFor->regHandlers = (XHandler**) realloc( handleFor->regHandlers, handleFor->handlers * sizeof(XHandler*));
   handleFor->regHandlers[ handleFor->handlers - 1 ] = this;
}


XHandler :: ~XHandler()
{
   SHORT i;
   BOOL swap = FALSE;

   if(handleFor )
      {
         for(i=0; i < handleFor->handlers - 1; i++)
           {
              if( handleFor->regHandlers[i] == this )
                 swap = TRUE;
              if(swap)
                 handleFor->regHandlers[i] = handleFor->regHandlers[i+1];
           }
         handleFor->handlers-=1;
         handleFor->regHandlers = (XHandler**) realloc( handleFor->regHandlers, handleFor->handlers * sizeof(XHandler*));
      }
}


void XDragHandler :: HandleEvent ( XDragEvent * event)
{
}


BOOL XMouseHandler :: HandleEvent ( XMouseEvent*)
{
   return FALSE;
}


BOOL XItemDrawHandler :: HandleEvent ( XItemDrawEvent*)
{
   return FALSE;
}


BOOL XBackgroundDrawHandler :: HandleEvent ( XBackgroundDrawEvent*)
{
   return FALSE;
}


BOOL XStyleHandler :: HandleEvent ( XEvent*)
{
   return FALSE;
}

