home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1995 November
/
PCWK1195.iso
/
inne
/
win
/
sieciowe
/
oiv_demo.lzh
/
disk2
/
DATA.2
/
include
/
Ivf
/
IvfApp.h
next >
Wrap
C/C++ Source or Header
|
1995-06-19
|
9KB
|
256 lines
/*
* Copyright (C) 1995 Template Graphics Software, Inc.
_______________________________________________________________________
_________________ TEMPLATE GRAPHICS SOFTWARE INC. ___________________
|
|
| This class provides methods for initialization of Open Inventor and
| the Inventor Framework Class library.
|
| Author(s): James R. Gambale, Jr.
|
_________________ TEMPLATE GRAPHICS SOFTWARE INC. ___________________
_______________________________________________________________________
*/
#ifndef __CIVFAPP_H__
#define __CIVFAPP_H__
#include "IvfEnterScope.h"
#include "IvfView.h"
class CIvfDoc ;
class CIvfMainFrame ;
class CDocument ;
class CDocTemplate ;
class CView ;
class CWnd ;
class CFrameWnd ;
// This type is for the application supplied conversion method that converts
// an MFC CView object into an IVF CIvfView Object.
typedef CIvfView * (*IvfCvtAfxViewProc)(CView *) ;
// This type is for the application supplied conversion method that converts
// an IVF CIvfView Object into an MFC CView object.
typedef CView * (*IvfCvtIvfViewProc)(CIvfView *) ;
// This type is for the application supplied conversion method that converts
// an MFC CDocument object into an IVF CIvfDoc object.
typedef CIvfDoc * (*IvfCvtAfxDocProc)(CDocument *) ;
// This type is for the application supplied conversion method that converts
// an IVF CIvfDoc Object into an MFC CDocument object.
typedef CDocument * (*IvfCvtIvfDocProc)(CIvfDoc *) ;
class CIvfApp
{
public:
CIvfApp();
~CIvfApp();
// This method intializes the IVF class library. It is called from InitInstance
// in the MFC application object.
static BOOL IvfInitInstance(
CWinApp * pApp,
CIvfApp * pIvfApp,
CIvfMainFrame * pFrame,
CDocTemplate * pDocTemplate,
IvfCvtAfxViewProc pAfxViewProc,
IvfCvtIvfViewProc pIvfViewProc,
IvfCvtAfxDocProc pAfxDocProc,
IvfCvtIvfDocProc pIvfDocProc,
CRuntimeClass * pVwrClass,
void * pVwrArgs,
BOOL nMDI=FALSE) ;
// Given a pointer to an IVF document object, this method will return a pointer
// to the corresponding IVF view object. It will return the active view if
// the argument is NULL.
CIvfView * IvfGetView(CIvfDoc *pIvfDoc = NULL) ;
// Given a pointer to an IVF view object, this method will return a pointer
// to the corresponding IVF document object. If the argument is NULL, the
// document corresponding to the active view is returned.
CIvfDoc * IvfGetDocument(CIvfView *pIvfView = NULL) ;
// This method returns a pointer to the IVF frame window object.
CIvfMainFrame * IvfGetFrame() ;
// Given a pointer to an IVF view object, this method calls the
// application supplied conversion method to perform
// a type safe cast down to the application view class and then
// a cast up to the MFC view class. A pointer to the MFC view object
// corresponding to the IVF view object is returned. If the argument
// is NULL, a pointer to the active view is returned.
CView * IvfGetAfxView(CIvfView *pIvfView = NULL) ;
// Given a pointer to an IVF view object, this method first locates
// the corresponding IVF document object. It then calls the
// application supplied conversion method to perform a type safe
// cast of the IVF document object pointer down to the application document
// class and then a cast up to the MFC document class. A pointer to
// the MFC document object corresponding to the IVF view object
// is returned. If the argument is NULL, a pointer to the document
// object corresponding to the active view is returned.
CDocument * IvfGetAfxDoc(CIvfView *pIvfView = NULL) ;
// Given a pointer to an IVF document object, calls the
// application supplied conversion method to perform a type safe
// cast of the IVF document object pointer down to the application document
// class, and then a cast up to the MFC document class. A pointer to
// the MFC document object corresponding to the IVF document object
// is returned.
CDocument * IvfGetAfxDoc(CIvfDoc *pIvfDoc) ;
// Given a pointer to an IVF view object, this method first locates
// the corresponding IVF document object. It then calls the
// application supplied conversion method to perform a type safe
// cast of the IVF document object pointer down to the application document
// class and then a cast up to the MFC document class. A pointer to
// the MFC document object corresponding to the IVF view object
// is returned. If the argument is NULL, a pointer to the document
// object corresponding to the active view is returned.
CFrameWnd * IvfGetAfxFrame(CIvfView *pIvfView = NULL) ;
// This method invokes the application supplied conversion method
// to convert an MFC view object pointer into an IVF view object
// pointer.
CIvfView * ToIvf(CView *pAfxView) ;
// This method invokes the application supplied conversion method
// to convert an IVF view object pointer into an MFC view object
// pointer.
CView * ToAfx(CIvfView *pIvfView) ;
// This method invokes the application supplied conversion method
// to convert an MFC document object pointer into an IVF document
// object pointer.
CIvfDoc * ToIvf(CDocument *pAfxDoc) ;
// This method invokes the application supplied conversion method
// to convert an IVF document object pointer into an MFC document
// object pointer.
CDocument * ToAfx(CIvfDoc *pIvfDoc) ;
// This method returns a pointer to the application object.
static CIvfApp * IvfGetApp() { return m_pApp; } ;
// This method returns a pointer to the application document template
// object.
static CDocTemplate * IvfGetDocTemplate() { return m_pDocTemplate; };
// This method returns a pointer to the runtime class information
// for the IVF viewer class object.
static CRuntimeClass * IvfVwrClass() { return m_pVwrClass ; } ;
// This method returns a pointer to the arguments passed to
// the of the IVF viewer class for viewer creation.
static void * IvfVwrArgs() { return m_pVwrArgs ; } ;
// This method returns a boolean that indicates if this
// an MDI application.
static BOOL IvfIsMdi() { return m_nMDI ; } ;
private:
// pointer to the IVF application object
static __IvfStaticImport CIvfApp * m_pApp ;
// pointer to the application document template object
static __IvfStaticImport CDocTemplate * m_pDocTemplate ;
// pointer to the runtime class information for the IVF viewer
// class
static __IvfStaticImport CRuntimeClass * m_pVwrClass ;
// pointer to the arguments for IVF viewer creation
static __IvfStaticImport void * m_pVwrArgs ;
// MDI flag
static __IvfStaticImport BOOL m_nMDI ;
// pointer to the frame window object
CIvfMainFrame * m_pFrame ;
// pointer to application supplied type safe pointer
// conversion methods
IvfCvtAfxViewProc m_pAfxViewProc ;
IvfCvtIvfViewProc m_pIvfViewProc ;
IvfCvtAfxDocProc m_pAfxDocProc ;
IvfCvtIvfDocProc m_pIvfDocProc ;
};
// IVF_INIT_INSTANCE Macro
// This macro is invoked from the MFC application objects InitInstance method.
// It invokes the CIvfApp method IvfInitInstance to intialize IVF.
#ifdef __TGS_DEMO_UNLOCK
#include <Inventor/lock/demoUnlock.h>
#include <Inventor/lock/SoLockMgr.h>
#define IVF_INIT_INSTANCE(CFrameClass,CViewClass,CDocClass,pVwrClass,pVwrArgs,nMDI) \
{ \
SoLockManager::SetUnlockString(DEMO_UNLOCK_STRING) ; \
CFrameClass *pFrame = (CFrameClass *)m_pMainWnd ; \
CIvfApp::IvfInitInstance(this,this,pFrame,pDocTemplate, \
IvfCvtAfxView, \
IvfCvtIvfView, \
IvfCvtAfxDoc, \
IvfCvtIvfDoc, \
pVwrClass, \
pVwrArgs, \
nMDI); \
}
#else
#define IVF_INIT_INSTANCE(CFrameClass,CViewClass,CDocClass,pVwrClass,pVwrArgs,nMDI) \
{ \
CFrameClass *pFrame = (CFrameClass *)m_pMainWnd ; \
CIvfApp::IvfInitInstance(this,this,pFrame,pDocTemplate, \
IvfCvtAfxView, \
IvfCvtIvfView, \
IvfCvtAfxDoc, \
IvfCvtIvfDoc, \
pVwrClass, \
pVwrArgs, \
nMDI); \
}
#endif
// This macro is used to define the type safe conversion methods
// for the application.
#define IVF_AFX_CONVERSION_METHOD(AppViewClassName,AppDocClassName) \
static CIvfView *IvfCvtAfxView(CView *pAfxView) \
{ \
AppViewClassName *pView = (AppViewClassName *) pAfxView ; \
return pView ; \
} \
static CView *IvfCvtIvfView(CIvfView *pIvfView) \
{ \
AppViewClassName *pView = (AppViewClassName *) pIvfView ; \
return pView ; \
} \
static CIvfDoc *IvfCvtAfxDoc(CDocument *pAfxDoc) \
{ \
AppDocClassName *pDoc = (AppDocClassName *) pAfxDoc ; \
return pDoc ; \
} \
static CDocument *IvfCvtIvfDoc(CIvfDoc *pIvfDoc) \
{ \
AppDocClassName *pDoc = (AppDocClassName *) pIvfDoc ; \
return pDoc ; \
}
#include "IvfLeaveScope.h"
/////////////////////////////////////////////////////////////////////////////
#endif