#include <common/vhandler.hpp>

WORD VectorHandler::insertHandler(HandlerType handlerType,PureCallback *lpCallback,CallOrder callOrder)
{
	WORD returnCode;

	switch(handlerType)
	{
	  case ChangeCBChainHandler :
		  returnCode=insert(mChangeCBChainVector,lpCallback,callOrder);
		  break;
		case DrawClipboardHandler :
		  returnCode=insert(mDrawClipboardVector,lpCallback,callOrder);
		  break;
	  case UserHandler :
		  returnCode=insert(mUserVector,lpCallback,callOrder);
			break;
		case NCCreateHandler :
      returnCode=insert(mNCCreateVector,lpCallback,callOrder);
			break;
		case CreateHandler :
			returnCode=insert(mCreateVector,lpCallback,callOrder);
			break;
		case InitDialogHandler :
      returnCode=insert(mInitDialogVector,lpCallback,callOrder);
			break;
		case SetFontHandler :
			returnCode=insert(mSetFontVector,lpCallback,callOrder);
      break;
		case SizeHandler :
      returnCode=insert(mSizeVector,lpCallback,callOrder);
			break;
		case PaintHandler :
      returnCode=insert(mPaintVector,lpCallback,callOrder);
			break;
		case EraseBackgroundHandler :
		  returnCode=insert(mEraseBackgroundVector,lpCallback,callOrder);
			break;
		case PaletteChangedHandler :
		  returnCode=insert(mPaletteChangedVector,lpCallback,callOrder);
			break;
		case TimerHandler :
      returnCode=insert(mTimerVector,lpCallback,callOrder)-1;
			break;
		case CharHandler :
      returnCode=insert(mCharVector,lpCallback,callOrder);
			break;
		case CommandHandler :
      returnCode=insert(mCommandVector,lpCallback,callOrder);
			break;
		case CompactingHandler :
      returnCode=insert(mCompactingVector,lpCallback,callOrder);
			break;
		case WinIniChangeHandler :
      returnCode=insert(mWinIniChangeVector,lpCallback,callOrder);
			break;
		case LeftButtonDoubleHandler :
      returnCode=insert(mLeftButtonDoubleVector,lpCallback,callOrder);
			break;
		case LeftButtonDownHandler :
      returnCode=insert(mLeftButtonDownVector,lpCallback,callOrder);
			break;
		case LeftButtonUpHandler :
			returnCode=insert(mLeftButtonUpVector,lpCallback,callOrder);
			break;
		case RightButtonDoubleHandler :
      returnCode=insert(mRightButtonDoubleVector,lpCallback,callOrder);
			break;
		case RightButtonDownHandler :
      returnCode=insert(mRightButtonDownVector,lpCallback,callOrder);
	    break;
		case RightButtonUpHandler :
			returnCode=insert(mRightButtonUpVector,lpCallback,callOrder);
			break;
		case NCLeftButtonDownHandler :
			returnCode=insert(mNCLeftButtonDownVector,lpCallback,callOrder);
			break;
		case NCLeftButtonUpHandler :
			returnCode=insert(mNCLeftButtonUpVector,lpCallback,callOrder);
			break;
		case NCRightButtonDownHandler :
			returnCode=insert(mNCRightButtonDownVector,lpCallback,callOrder);
			break;
		case NCRightButtonUpHandler :
			returnCode=insert(mNCRightButtonUpVector,lpCallback,callOrder);
			break;
		case SetFocusHandler :
			returnCode=insert(mSetFocusVector,lpCallback,callOrder);
			break;
		case KillFocusHandler :
			returnCode=insert(mKillFocusVector,lpCallback,callOrder);
			break;
		case KeyUpHandler :
      returnCode=insert(mKeyUpVector,lpCallback,callOrder);
		  break;
		case KeyDownHandler :
			returnCode=insert(mKeyDownVector,lpCallback,callOrder);
		  break;
		case SysKeyDownHandler :
		  returnCode=insert(mSysKeyDownVector,lpCallback,callOrder);
			break;
		case SysKeyUpHandler :
		  returnCode=insert(mSysKeyUpVector,lpCallback,callOrder);
			break;
		case MinMaxHandler :
      returnCode=insert(mMinMaxVector,lpCallback,callOrder);
		  break;
		case EnterIdleHandler :
			returnCode=insert(mEnterIdleVector,lpCallback,callOrder);
		  break;
		case MenuSelectHandler :
			returnCode=insert(mMenuSelectVector,lpCallback,callOrder);
		  break;
		case DrawItemHandler :
      returnCode=insert(mDrawItemVector,lpCallback,callOrder);
		  break;
		case SysColorChangeHandler :
      returnCode=insert(mSysColorChangeVector,lpCallback,callOrder);
			break;
		case CloseHandler :
      returnCode=insert(mCloseVector,lpCallback,callOrder);
			break;
		case MouseMoveHandler :
      returnCode=insert(mMouseMoveVector,lpCallback,callOrder);
			break;
		case ControlColorHandler :
			returnCode=insert(mControlColorVector,lpCallback,callOrder);
			break;
		case NotifyHandler :
			returnCode=insert(mNotifyVector,lpCallback,callOrder);
			break;
		case DDEInitiateHandler :
      returnCode=insert(mDDEInitiateVector,lpCallback,callOrder);
			break;
		case DDEAckHandler :
			returnCode=insert(mDDEAckVector,lpCallback,callOrder);
			break;
		case DDERequestHandler :
      returnCode=insert(mDDERequestVector,lpCallback,callOrder);
			break;
		case DDETerminateHandler :
      returnCode=insert(mDDETerminateVector,lpCallback,callOrder);
			break;
		case DDEDataHandler :
      returnCode=insert(mDDEDataVector,lpCallback,callOrder);
			break;
		case MeasureItemHandler :
			returnCode=insert(mMeasureItemVector,lpCallback,callOrder);
      break;
		case MMOpenHandler :
      returnCode=insert(mMMOpenVector,lpCallback,callOrder);
			break;
		case MMCloseHandler :
      returnCode=insert(mMMCloseVector,lpCallback,callOrder);
			break;
		case MMDoneHandler :
      returnCode=insert(mMMDoneVector,lpCallback,callOrder);
			break;
		case DialogCodeHandler :
			returnCode=insert(mDialogCodeVector,lpCallback,callOrder);
      break;
		case NCDestroyHandler :
			returnCode=insert(mNCDestroyVector,lpCallback,callOrder);
			break;
		case DestroyHandler :
			returnCode=insert(mDestroyVector,lpCallback,callOrder);
			break;
	  case VerticalScrollHandler :
		  returnCode=insert(mVerticalScrollVector,lpCallback,callOrder);
			break;
		case HorizontalScrollHandler :
		  returnCode=insert(mHorizontalScrollVector,lpCallback,callOrder);
			break;
		case DropFilesHandler :
		  returnCode=insert(mDropFilesVector,lpCallback,callOrder);
			break;
		case MDIActivateHandler :
		  returnCode=insert(mMDIActivateVector,lpCallback,callOrder);
			break;
		case MDIDestroyHandler :
		  returnCode=insert(mMDIDestroyVector,lpCallback,callOrder);
			break;
		case QueryEndSessionHandler :
		  returnCode=insert(mQueryEndSessionVector,lpCallback,callOrder);
			break;
		case ActivateAppHandler :
		  returnCode=insert(mActivateAppVector,lpCallback,callOrder);
		  break;
		case DisplayChangeHandler :
		  returnCode=insert(mDisplayChangeVector,lpCallback,callOrder);
		  break;
		case ShowWindowHandler :
		  returnCode=insert(mShowWindowVector,lpCallback,callOrder);
			break;
		case CaptureChangedHandler :
		  returnCode=insert(mCaptureChangedVector,lpCallback,callOrder);
			break;
		case DeviceChangeHandler :
		  returnCode=insert(mDeviceChangeVector,lpCallback,callOrder);
	}
	return returnCode;
}

CallbackData::ReturnType VectorHandler::callHandlers(HandlerType handlerType,CallbackData someCallbackData)
{
	CallbackData::ReturnType returnCode;

	switch(handlerType)
	{
	  case ChangeCBChainHandler :
		  if(!handlers(mChangeCBChainVector))returnCode=TRUE;
			else returnCode=callHandler(mChangeCBChainVector,someCallbackData);
			break;
		case DrawClipboardHandler :
		  if(!handlers(mDrawClipboardVector))returnCode=TRUE;
			else returnCode=callHandler(mDrawClipboardVector,someCallbackData);
		  break;
	  case UserHandler :
		  if(!handlers(mUserVector))returnCode=TRUE;
			else returnCode=callHandler(mUserVector,someCallbackData);
			break;
		case NCCreateHandler :
			if(!handlers(mNCCreateVector))returnCode=TRUE;
			else returnCode=callHandler(mNCCreateVector,someCallbackData);
			break;
		case CreateHandler :
			returnCode=callHandler(mCreateVector,someCallbackData);
			break;
		case InitDialogHandler :
		  returnCode=callHandler(mInitDialogVector,someCallbackData);
			break;
		case SetFontHandler :
      returnCode=callHandler(mSetFontVector,someCallbackData);
      break;
		case PaintHandler :
		  returnCode=callHandler(mPaintVector,someCallbackData);
		  break;
		case EraseBackgroundHandler :
		  returnCode=callHandler(mEraseBackgroundVector,someCallbackData);
			break;
		case PaletteChangedHandler :
		  returnCode=callHandler(mPaletteChangedVector,someCallbackData);
			break;
		case TimerHandler :
			returnCode=mTimerVector[someCallbackData.wParam()].callback(someCallbackData);
			break;
		case CharHandler :
			returnCode=callHandler(mCharVector,someCallbackData);
			break;
		case SizeHandler :
			returnCode=callHandler(mSizeVector,someCallbackData);
			break;
		case CommandHandler :
			returnCode=callHandler(mCommandVector,someCallbackData);
			break;
		case CompactingHandler :
			returnCode=callHandler(mCompactingVector,someCallbackData);
			break;
		case LeftButtonDoubleHandler :
			returnCode=callHandler(mLeftButtonDoubleVector,someCallbackData);
			break;
		case LeftButtonDownHandler :
			returnCode=callHandler(mLeftButtonDownVector,someCallbackData);
			break;
		case LeftButtonUpHandler :
			returnCode=callHandler(mLeftButtonUpVector,someCallbackData);
			break;
		case RightButtonDoubleHandler :
      returnCode=callHandler(mRightButtonDoubleVector,someCallbackData);
      break;
		case RightButtonUpHandler :
			returnCode=callHandler(mRightButtonUpVector,someCallbackData);
      break;
		case RightButtonDownHandler :
      returnCode=callHandler(mRightButtonDownVector,someCallbackData);
			break;
		case NCLeftButtonDownHandler :
      returnCode=callHandler(mNCLeftButtonDownVector,someCallbackData);
      break;
		case NCLeftButtonUpHandler :
      returnCode=callHandler(mNCLeftButtonUpVector,someCallbackData);
      break;
		case NCRightButtonDownHandler :
      returnCode=callHandler(mNCRightButtonDownVector,someCallbackData);
      break;
		case NCRightButtonUpHandler :
      returnCode=callHandler(mNCRightButtonUpVector,someCallbackData);
      break;
		case WinIniChangeHandler :
			returnCode=callHandler(mWinIniChangeVector,someCallbackData);
			break;
		case SysColorChangeHandler :
			returnCode=callHandler(mSysColorChangeVector,someCallbackData);
			break;
		case SetFocusHandler :
		  returnCode=callHandler(mSetFocusVector,someCallbackData);
			break;
		case KillFocusHandler :
			returnCode=callHandler(mKillFocusVector,someCallbackData);
			break;
		case KeyUpHandler :
		  returnCode=callHandler(mKeyUpVector,someCallbackData);
		  break;
		case KeyDownHandler :
		  returnCode=callHandler(mKeyDownVector,someCallbackData);
		  break;
		case SysKeyDownHandler :
		  returnCode=callHandler(mSysKeyDownVector,someCallbackData);
		  break;
		case SysKeyUpHandler :
		  returnCode=callHandler(mSysKeyUpVector,someCallbackData);
		  break;
		case MinMaxHandler :
		  returnCode=callHandler(mMinMaxVector,someCallbackData);
		  break;
		case EnterIdleHandler :
		  returnCode=callHandler(mEnterIdleVector,someCallbackData);
		  break;
		case MenuSelectHandler :
		  returnCode=callHandler(mMenuSelectVector,someCallbackData);
		  break;
		case DrawItemHandler :
		  returnCode=callHandler(mDrawItemVector,someCallbackData);
			break;
		case MouseMoveHandler :
			returnCode=callHandler(mMouseMoveVector,someCallbackData);
			break;
		case ControlColorHandler :  
		  returnCode=callHandler(mControlColorVector,someCallbackData);
			break;
		case NotifyHandler :
			returnCode=callHandler(mNotifyVector,someCallbackData);
			break;
		case MeasureItemHandler :
			returnCode=callHandler(mMeasureItemVector,someCallbackData);
      break;
		case DDEInitiateHandler :
			returnCode=callHandler(mDDEInitiateVector,someCallbackData);
			break;
		case DDEAckHandler :
			returnCode=callHandler(mDDEAckVector,someCallbackData);
			break;
		case DDERequestHandler :
			returnCode=callHandler(mDDERequestVector,someCallbackData);
			break;
		case DDETerminateHandler :
			returnCode=callHandler(mDDETerminateVector,someCallbackData);
			break;
		case DDEDataHandler :
			returnCode=callHandler(mDDEDataVector,someCallbackData);
			break;
		case MMOpenHandler :
			returnCode=callHandler(mMMOpenVector,someCallbackData);
			break;
		case MMCloseHandler :
			returnCode=callHandler(mMMCloseVector,someCallbackData);
			break;
		case MMDoneHandler :
			returnCode=callHandler(mMMDoneVector,someCallbackData);
			break;
		case CloseHandler :
			returnCode=callHandler(mCloseVector,someCallbackData);
			break;
		case DialogCodeHandler :
			returnCode=callHandler(mDialogCodeVector,someCallbackData);
			break;
		case DestroyHandler :
			returnCode=callHandler(mDestroyVector,someCallbackData);
			break;
		case NCDestroyHandler :
			returnCode=callHandler(mNCDestroyVector,someCallbackData);
			break;
		case HorizontalScrollHandler :
		  returnCode=callHandler(mHorizontalScrollVector,someCallbackData);
		  break;
		case VerticalScrollHandler :
		  returnCode=callHandler(mVerticalScrollVector,someCallbackData);
		  break;
		case DropFilesHandler :
		  returnCode=callHandler(mDropFilesVector,someCallbackData);
			break;
		case MDIActivateHandler :
		  returnCode=callHandler(mMDIActivateVector,someCallbackData);
			break;
		case MDIDestroyHandler :
		  returnCode=callHandler(mMDIDestroyVector,someCallbackData);
			break;
		case QueryEndSessionHandler :
		  returnCode=callHandler(mQueryEndSessionVector,someCallbackData);
		  break;
		case ActivateAppHandler :
      returnCode=callHandler(mActivateAppVector,someCallbackData);
		  break;
		case DisplayChangeHandler :
      returnCode=callHandler(mDisplayChangeVector,someCallbackData);
		  break;
		case ShowWindowHandler :
		  returnCode=callHandler(mShowWindowVector,someCallbackData);
			break;
		case CaptureChangedHandler :
		  returnCode=callHandler(mCaptureChangedVector,someCallbackData);
			break;
		case DeviceChangeHandler :
		  returnCode=callHandler(mDeviceChangeVector,someCallbackData);
	}
	return returnCode;
}

CallbackData::ReturnType VectorHandler::callHandler(Block<CallbackPointer> &someCallbackVector,CallbackData &someCallbackData)
{
	size_t size((size_t)someCallbackVector.size());
	CallbackData::ReturnType returnCode(0);
	CallbackData::ReturnType callReturn;

	for(int vectorIndex=0;vectorIndex<size;vectorIndex++)
  {
	  if(FALSE!=(callReturn=someCallbackVector[vectorIndex].callback(someCallbackData)))returnCode=callReturn;
		size=(size_t)someCallbackVector.size();
	}
	return returnCode;
}

void VectorHandler::removeHandler(HandlerType handlerType,PureCallback *lpCallback)
{
	switch(handlerType)
	{
	  case ChangeCBChainHandler :
		  removeHandler(mChangeCBChainVector,CallbackPointer(lpCallback));
		  break;
		case DrawClipboardHandler :
		  removeHandler(mDrawClipboardVector,CallbackPointer(lpCallback));
		  break;
	  case UserHandler :
		  removeHandler(mUserVector,CallbackPointer(lpCallback));
			break;
		case NCCreateHandler :
			removeHandler(mNCCreateVector,CallbackPointer(lpCallback));
			break;
		case CreateHandler :
			removeHandler(mCreateVector,CallbackPointer(lpCallback));
			break;
		case InitDialogHandler :
		  removeHandler(mInitDialogVector,CallbackPointer(lpCallback));
			break;
		case SetFontHandler :
			removeHandler(mSetFontVector,CallbackPointer(lpCallback));
      break;
		case TimerHandler :
			removeHandler(mTimerVector,CallbackPointer(lpCallback));
			break;
		case CharHandler :
			removeHandler(mCharVector,CallbackPointer(lpCallback));
			break;
		case SizeHandler :
			removeHandler(mSizeVector,CallbackPointer(lpCallback));
			break;
		case CompactingHandler :
			removeHandler(mCompactingVector,CallbackPointer(lpCallback));
			break;
		case WinIniChangeHandler :
			removeHandler(mWinIniChangeVector,CallbackPointer(lpCallback));
			break;
		case SysColorChangeHandler :
			removeHandler(mSysColorChangeVector,CallbackPointer(lpCallback));
			break;
		case LeftButtonDoubleHandler :
			removeHandler(mLeftButtonDoubleVector,CallbackPointer(lpCallback));
			break;
		case LeftButtonDownHandler :
			removeHandler(mLeftButtonDownVector,CallbackPointer(lpCallback));
			break;
		case LeftButtonUpHandler :
			removeHandler(mLeftButtonUpVector,CallbackPointer(lpCallback));
			break;
		case RightButtonDoubleHandler :
      removeHandler(mRightButtonDoubleVector,CallbackPointer(lpCallback));
      break;
		case RightButtonDownHandler :
      removeHandler(mRightButtonDownVector,CallbackPointer(lpCallback));
      break;
		case RightButtonUpHandler :
			removeHandler(mRightButtonUpVector,CallbackPointer(lpCallback));
			break;
		case NCLeftButtonDownHandler :
			removeHandler(mNCLeftButtonDownVector,CallbackPointer(lpCallback));
			break;
		case NCLeftButtonUpHandler :
			removeHandler(mNCLeftButtonUpVector,CallbackPointer(lpCallback));
			break;
		case NCRightButtonDownHandler :
			removeHandler(mNCRightButtonDownVector,CallbackPointer(lpCallback));
			break;
		case NCRightButtonUpHandler :
			removeHandler(mNCRightButtonUpVector,CallbackPointer(lpCallback));
			break;
		case PaintHandler :
			removeHandler(mPaintVector,CallbackPointer(lpCallback));
			break;
		case EraseBackgroundHandler :
		  removeHandler(mEraseBackgroundVector,CallbackPointer(lpCallback));
			break;
		case PaletteChangedHandler :
		  removeHandler(mPaletteChangedVector,CallbackPointer(lpCallback));
			break;
		case CommandHandler :
			removeHandler(mCommandVector,CallbackPointer(lpCallback));
			break;
		case SetFocusHandler :
		  removeHandler(mSetFocusVector,CallbackPointer(lpCallback));
			break;
		case KillFocusHandler :
			removeHandler(mKillFocusVector,CallbackPointer(lpCallback));
			break;
		case KeyUpHandler :
		  removeHandler(mKeyUpVector,CallbackPointer(lpCallback));
		  break;
		case KeyDownHandler :
		  removeHandler(mKeyDownVector,CallbackPointer(lpCallback));
		  break;
		case SysKeyUpHandler :
		  removeHandler(mSysKeyUpVector,CallbackPointer(lpCallback));
		  break;
		case SysKeyDownHandler :
		  removeHandler(mSysKeyDownVector,CallbackPointer(lpCallback));
		  break;
		case MinMaxHandler :
		  removeHandler(mMinMaxVector,CallbackPointer(lpCallback));
		  break;
		case EnterIdleHandler :
		 removeHandler(mEnterIdleVector,CallbackPointer(lpCallback));
		 break;
		case DrawItemHandler :
			removeHandler(mDrawItemVector,CallbackPointer(lpCallback));
			break;
		case ControlColorHandler :
			removeHandler(mControlColorVector,CallbackPointer(lpCallback));
			break;
		case NotifyHandler :
			removeHandler(mNotifyVector,CallbackPointer(lpCallback));
			break;
		case MenuSelectHandler :
		  removeHandler(mMenuSelectVector,CallbackPointer(lpCallback));
			break;
		case MeasureItemHandler :
			removeHandler(mMeasureItemVector,CallbackPointer(lpCallback));
      break;
		case DDEInitiateHandler :
			removeHandler(mDDEInitiateVector,CallbackPointer(lpCallback));
			break;
		case DDEAckHandler :
			removeHandler(mDDEAckVector,CallbackPointer(lpCallback));
			break;
		case DDERequestHandler :
			removeHandler(mDDERequestVector,CallbackPointer(lpCallback));
			break;
		case DDETerminateHandler :
			removeHandler(mDDETerminateVector,CallbackPointer(lpCallback));
			break;
		case DDEDataHandler :
			removeHandler(mDDEDataVector,CallbackPointer(lpCallback));
			break;
		case MMOpenHandler :
      removeHandler(mMMOpenVector,CallbackPointer(lpCallback));
      break;
		case MMCloseHandler :
      removeHandler(mMMCloseVector,CallbackPointer(lpCallback));
      break;
		case MMDoneHandler :
      removeHandler(mMMDoneVector,CallbackPointer(lpCallback));
      break;
		case CloseHandler :
			removeHandler(mCloseVector,CallbackPointer(lpCallback));
			break;
		case MouseMoveHandler :
			removeHandler(mMouseMoveVector,CallbackPointer(lpCallback));
			break;
		case DialogCodeHandler :
			removeHandler(mDialogCodeVector,CallbackPointer(lpCallback));
      break;
		case DestroyHandler :
			removeHandler(mDestroyVector,CallbackPointer(lpCallback));
			break;
		case NCDestroyHandler :
			removeHandler(mNCDestroyVector,CallbackPointer(lpCallback));
			break;
		case HorizontalScrollHandler :
		  removeHandler(mHorizontalScrollVector,CallbackPointer(lpCallback));
		  break;
		case VerticalScrollHandler :
		  removeHandler(mVerticalScrollVector,CallbackPointer(lpCallback));
		  break;
		case DropFilesHandler :
		  removeHandler(mDropFilesVector,CallbackPointer(lpCallback));
			break;
		case MDIActivateHandler :
		  removeHandler(mMDIActivateVector,CallbackPointer(lpCallback));
			break;
		case MDIDestroyHandler :
		  removeHandler(mMDIDestroyVector,CallbackPointer(lpCallback));
			break;
		case QueryEndSessionHandler :
		  removeHandler(mQueryEndSessionVector,CallbackPointer(lpCallback));
		  break;
		case ActivateAppHandler :
		  removeHandler(mActivateAppVector,CallbackPointer(lpCallback));
		  break;
		case DisplayChangeHandler :
		  removeHandler(mDisplayChangeVector,CallbackPointer(lpCallback));
		  break;
		case ShowWindowHandler :
		  removeHandler(mShowWindowVector,CallbackPointer(lpCallback));
			break;
		case CaptureChangedHandler :
		  removeHandler(mCaptureChangedVector,CallbackPointer(lpCallback));
			break;
		case DeviceChangeHandler :
		  removeHandler(mDeviceChangeVector,CallbackPointer(lpCallback));
			break;

	}
}

void VectorHandler::removeHandler(Block<CallbackPointer> &someCallbackVector,CallbackPointer &locatePointer)
{
	size_t size((size_t)someCallbackVector.size());

	for(int vectorIndex=0;vectorIndex<size;vectorIndex++)
  {
		if(someCallbackVector[vectorIndex]==locatePointer)
    {
			someCallbackVector.remove(vectorIndex);
			size=(size_t)someCallbackVector.size();
			vectorIndex=-1;
		}
  }
}

WORD VectorHandler::installedHandlers(HandlerType handlerType)const
{
	switch(handlerType)
	{
	  case ChangeCBChainHandler :
		  return (WORD)mChangeCBChainVector.size();
		case DrawClipboardHandler :
		  return (WORD)mDrawClipboardVector.size();
	  case UserHandler :
		  return (WORD)mUserVector.size();
		case NCCreateHandler :
			return (WORD)mNCCreateVector.size();
		case CreateHandler :
			return (WORD)mCreateVector.size();
		case InitDialogHandler :
			return (WORD)mInitDialogVector.size();
		case SetFontHandler :
			return (WORD)mSetFontVector.size();
		case TimerHandler :
			return (WORD)mTimerVector.size();
		case SizeHandler :
			return (WORD)mSizeVector.size();
		case CompactingHandler :
			return (WORD)mCompactingVector.size();
		case WinIniChangeHandler :
			return (WORD)mWinIniChangeVector.size();
		case SysColorChangeHandler :
			return (WORD)mSysColorChangeVector.size();
		case LeftButtonDoubleHandler :
			return (WORD)mLeftButtonDoubleVector.size();
		case LeftButtonDownHandler :
			return (WORD)mLeftButtonDownVector.size();
		case LeftButtonUpHandler :
			return (WORD)mLeftButtonUpVector.size();
		case RightButtonDoubleHandler :
			return (WORD)mRightButtonDoubleVector.size();
		case RightButtonUpHandler :
      return (WORD)mRightButtonUpVector.size();
		case RightButtonDownHandler :
			return mRightButtonDownVector.size();
		case NCLeftButtonDownHandler :
			return mNCLeftButtonDownVector.size();
		case NCLeftButtonUpHandler :
			return mNCLeftButtonUpVector.size();
		case NCRightButtonDownHandler :
			return mNCRightButtonDownVector.size();
		case NCRightButtonUpHandler :
			return mNCRightButtonUpVector.size();
		case PaintHandler :
			return (WORD)mPaintVector.size();
		case EraseBackgroundHandler :
		  return mEraseBackgroundVector.size();
		case PaletteChangedHandler :
		  return mPaletteChangedVector.size();
		case CommandHandler :
			return (WORD)mCommandVector.size();
		case SetFocusHandler :
			return (WORD)mSetFocusVector.size();
		case KillFocusHandler :
			return (WORD)mKillFocusVector.size();
		case MeasureItemHandler :
			return (WORD)mMeasureItemVector.size();
		case KeyUpHandler :
		  return (WORD)mKeyUpVector.size(); 
		case KeyDownHandler :
			return (WORD)mKeyDownVector.size();
		case SysKeyDownHandler :
		  return (WORD)mSysKeyDownVector.size();
		case SysKeyUpHandler :
		  return (WORD)mSysKeyUpVector.size();
		case CharHandler :
			return (WORD)mCharVector.size();
		case MinMaxHandler :
		  return (WORD)mMinMaxVector.size();
		case EnterIdleHandler :
		  return (WORD)mEnterIdleVector.size();
		case MenuSelectHandler :
		  return (WORD)mMenuSelectVector.size();
		case DrawItemHandler :
			return (WORD)mDrawItemVector.size();
		case NotifyHandler :
			return (WORD)mNotifyVector.size();
		case DDEInitiateHandler :
			return (WORD)mDDEInitiateVector.size();
		case DDEAckHandler :
			return (WORD)mDDEAckVector.size();
		case DDERequestHandler :
			return (WORD)mDDERequestVector.size();
		case DDETerminateHandler :
			return (WORD)mDDETerminateVector.size();
		case DDEDataHandler :
			return (WORD)mDDEDataVector.size();
		case MMOpenHandler :
      return (WORD)mMMOpenVector.size();
		case MMCloseHandler :
			return (WORD)mMMCloseVector.size();
		case MMDoneHandler :
			return (WORD)mMMDoneVector.size();
		case ControlColorHandler :
			return (WORD)mControlColorVector.size();
		case MouseMoveHandler :
			return (WORD)mMouseMoveVector.size();
		case CloseHandler :
			return (WORD)mCloseVector.size();
		case DialogCodeHandler :
      return (WORD)mDialogCodeVector.size();
		case DestroyHandler :
			return (WORD)mDestroyVector.size();
		case NCDestroyHandler :
			return (WORD)mNCDestroyVector.size();
		case HorizontalScrollHandler :
		  return (WORD)mHorizontalScrollVector.size();
		case VerticalScrollHandler :
		  return (WORD)mVerticalScrollVector.size();
		case DropFilesHandler :
		  return (WORD)mDropFilesVector.size();
		case MDIActivateHandler :
		  return (WORD)mMDIActivateVector.size();
		case MDIDestroyHandler :
		  return (WORD)mMDIDestroyVector.size();
		case QueryEndSessionHandler :
		  return (WORD)mQueryEndSessionVector.size();
		case ActivateAppHandler :
		  return (WORD)mActivateAppVector.size();
		case DisplayChangeHandler :
		  return (WORD)mActivateAppVector.size();
		case ShowWindowHandler :
		  return (WORD)mShowWindowVector.size();
		case CaptureChangedHandler :
		  return (WORD)mCaptureChangedVector.size();
		case DeviceChangeHandler :
		  return (WORD)mDeviceChangeVector.size();
		default :
			return 0;
	}
}

WORD VectorHandler::insert(Block<CallbackPointer> &someHandlerBlock,PureCallback *lpCallback,CallOrder callOrder)
{
	if(FirstHandler==callOrder&&someHandlerBlock.size())
	{
		CallbackPointer firstCallback(someHandlerBlock[0]);
		someHandlerBlock[0]=CallbackPointer(lpCallback);
    someHandlerBlock.insert(&firstCallback);
	}
	else someHandlerBlock.insert(&CallbackPointer(lpCallback));
  return (WORD)someHandlerBlock.size();
}

