////////////////////////////////////////////////////////////////////////////////
//
// DocumentFrameEvent  -     
//
////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "eventsAuto.h"

#ifndef _DOCUMENTFRAMEEVENT_H
#include "DocumentFrameEvent.h"
#endif

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

////////////////////////////////////////////////////////////////////////////////
//
// DocumentFrameEvent  -     
//
////////////////////////////////////////////////////////////////////////////////

//-------------------------------------------------------------------------------
//
// ---
DocumentFrameEvent::DocumentFrameEvent( LPUNKNOWN pObject, LPDISPATCH doc, bool selfAdvise /*true*/ )
: BaseEvent( pObject, DIID_ksDocumentFrameNotify, doc, -1, NULL, selfAdvise )
{
}


//-------------------------------------------------------------------------------
//
// ---
DocumentFrameEvent::~DocumentFrameEvent()
{
}


//-------------------------------------------------------------------------------
//
// ---
BEGIN_EVENTSINK_MAP(DocumentFrameEvent, BaseEvent)
	ON_EVENT (DocumentFrameEvent, (unsigned int)-1, frBeginPaint,          BeginPaint,          VTS_DISPATCH)
	ON_EVENT (DocumentFrameEvent, (unsigned int)-1, frClosePaint,          ClosePaint,          VTS_DISPATCH)
	ON_EVENT (DocumentFrameEvent, (unsigned int)-1, frMouseDown,           MouseDown,           VTS_I2 VTS_I2 VTS_I4 VTS_I4)
	ON_EVENT (DocumentFrameEvent, (unsigned int)-1, frMouseUp,             MouseUp,             VTS_I2 VTS_I2 VTS_I4 VTS_I4)
	ON_EVENT (DocumentFrameEvent, (unsigned int)-1, frMouseDblClick,       MouseDblClick,       VTS_I2 VTS_I2 VTS_I4 VTS_I4)
	ON_EVENT (DocumentFrameEvent, (unsigned int)-1, frBeginPaintGL,        BeginPaintGL,        VTS_DISPATCH VTS_I4)
	ON_EVENT (DocumentFrameEvent, (unsigned int)-1, frClosePaintGL,        ClosePaintGL,        VTS_DISPATCH VTS_I4)
	ON_EVENT (DocumentFrameEvent, (unsigned int)-1, frAddGabarit,          AddGabarit,          VTS_DISPATCH)
//	ON_EVENT (DocumentFrameEvent, (unsigned int)-1, frBeginCurrentProcess, BeginCurrentProcess, VTS_I4)
//	ON_EVENT (DocumentFrameEvent, (unsigned int)-1, frStopCurrentProcess,  StopCurrentProcess,  VTS_I4)
//  ON_EVENT (DocumentFrameEvent, (unsigned int)-1, frActivate,            Activate,            VTS_NONE)
//  ON_EVENT (DocumentFrameEvent, (unsigned int)-1, frDeactivate,          Deactivate,          VTS_NONE)
//  ON_EVENT (DocumentFrameEvent, (unsigned int)-1, frCloseFrame,          CloseFrame,          VTS_NONE)
END_EVENTSINK_MAP()


//-------------------------------------------------------------------------------
// frBeginPaint          -   
// ---
VARIANT_BOOL DocumentFrameEvent::BeginPaint( LPDISPATCH paintObj )
{
  if ( IsSelfAdvise() /*&& theApp.m_mes_SELECT*/ )
  {
    CString str( m_libName + " --> DocumentFrameEvent::BeginPaint" );
    kompas->ksMessage( str.GetBuffer(0) );
  }
  return true;
}

//-------------------------------------------------------------------------------
// frClosePaint          -   
// ---
VARIANT_BOOL DocumentFrameEvent::ClosePaint( LPDISPATCH paintObj )
{
  if ( IsSelfAdvise() /*&& theApp.m_mes_SELECT*/ )
  {
    CString str( m_libName + " --> DocumentFrameEvent::ClosePaint" );
    kompas->ksMessage( str.GetBuffer(0) );
  }
  return true;
}

//-------------------------------------------------------------------------------
// frMouseDown           -   
// ---
VARIANT_BOOL DocumentFrameEvent::MouseDown( short nButton, short nShiftState, long x, long y )
{
  if ( IsSelfAdvise() /*&& theApp.m_mes_SELECT*/ )
  {
    CString str;
    str.Format( "%s --> SelectMngEvent::MouseDown\nnButton = %i\nnShiftState = %i\nX = %i\nY = %i", 
                m_libName, nButton, nShiftState, x, y );
    kompas->ksMessage( str.GetBuffer(0) );
  }
  return true;
}

//-------------------------------------------------------------------------------
// frMouseUp             -   
// ---
VARIANT_BOOL DocumentFrameEvent::MouseUp( short nButton, short nShiftState, long x, long y )
{
  if ( IsSelfAdvise() /*&& theApp.m_mes_SELECT*/ )
  {
    CString str;
    str.Format( "%s --> SelectMngEvent::MouseUp\nnButton = %i\nnShiftState = %i\nX = %i\nY = %i", 
                m_libName, nButton, nShiftState, x, y );
    kompas->ksMessage( str.GetBuffer(0) );
  }
  return true;
}

//-------------------------------------------------------------------------------
// frMouseDblClick       -    
// ---
VARIANT_BOOL DocumentFrameEvent::MouseDblClick( short nButton, short nShiftState, long x, long y )
{
  if ( IsSelfAdvise() /*&& theApp.m_mes_SELECT*/ )
  {
    CString str;
    str.Format( "%s --> SelectMngEvent::MouseDblClick\nnButton = %i\nnShiftState = %i\nX = %i\nY = %i", 
                m_libName, nButton, nShiftState, x, y );
    kompas->ksMessage( str.GetBuffer(0) );
  }
  return true;
}

//-------------------------------------------------------------------------------
// frBeginPaintGL   -     OpenGL
// ---
VARIANT_BOOL DocumentFrameEvent::BeginPaintGL( LPDISPATCH glObj, long drawMode )
{
  if ( IsSelfAdvise() /*&& theApp.m_mes_SELECT*/ )
  {
    CString str( m_libName + " --> DocumentFrameEvent::BeginPaintGL" );
    kompas->ksMessage( str.GetBuffer(0) );
  }
  return true;
}

//-------------------------------------------------------------------------------
// frClosePaintGL   -     OpenGL
// ---
VARIANT_BOOL DocumentFrameEvent::ClosePaintGL( LPDISPATCH glObj, long drawMode )
{
  if ( IsSelfAdvise() /*&& theApp.m_mes_SELECT*/ )
  {
    CString str( m_libName + " --> DocumentFrameEvent::CloseClosePaintGL" );
    kompas->ksMessage( str.GetBuffer(0) );
  }
  return true;
}

//-------------------------------------------------------------------------------
// frAddGabarit          -   
// ---
VARIANT_BOOL DocumentFrameEvent::AddGabarit( LPDISPATCH gabObj )
{
  if ( IsSelfAdvise() /*&& theApp.m_mes_SELECT*/ )
  {
    CString str( m_libName + " --> DocumentFrameEvent::AddGabarit" );
    kompas->ksMessage( str.GetBuffer(0) );
  }
  return true;
}

//-------------------------------------------------------------------------------
// frBeginCurrentProcess -   
// ---
VARIANT_BOOL DocumentFrameEvent::BeginCurrentProcess( long id )
{
  if ( IsSelfAdvise() /*&& theApp.m_mes_SELECT*/ )
  {
    CString str( m_libName + " --> DocumentFrameEvent::BeginCurrentProcess" );
    kompas->ksMessage( str.GetBuffer(0) );
  }
  return true;
}

//-------------------------------------------------------------------------------
// frStopCurrentProcess  -   
// ---
VARIANT_BOOL DocumentFrameEvent::StopCurrentProcess( long id )
{
  if ( IsSelfAdvise() /*&& theApp.m_mes_SELECT*/ )
  {
    CString str( m_libName + " --> DocumentFrameEvent::StopCurrentProcess" );
    kompas->ksMessage( str.GetBuffer(0) );
  }
  return true;
}

//-------------------------------------------------------------------------------
// frActivate            -  
// ---
VARIANT_BOOL DocumentFrameEvent::Activate()
{
  if ( IsSelfAdvise() /*&& theApp.m_mes_SELECT*/ )
  {
    CString str( m_libName + " --> DocumentFrameEvent::Activate" );
    kompas->ksMessage( str.GetBuffer(0) );
  }
  return true;
}

//-------------------------------------------------------------------------------
// frDeactivate          -  
// ---
VARIANT_BOOL DocumentFrameEvent::Deactivate()
{
  if ( IsSelfAdvise() /*&& theApp.m_mes_SELECT*/ )
  {
    CString str( m_libName + " --> DocumentFrameEvent::Deactivate" );
    kompas->ksMessage( str.GetBuffer(0) );
  }
  return true;
}

//-------------------------------------------------------------------------------
// frCloseFrame          -  
// ---
VARIANT_BOOL DocumentFrameEvent::CloseFrame()
{
  if ( IsSelfAdvise() /*&& theApp.m_mes_SELECT*/ )
  {
    CString str( m_libName + " --> DocumentFrameEvent::CloseFrame" );
    kompas->ksMessage( str.GetBuffer(0) );
    delete this;
  }
  return true;
}

