home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1996 November
/
VPR9611B.ISO
/
vabasic
/
ntclnt.exe
/
DISK8
/
data.8
/
datab
/
INCLUDE
/
VWCOMP.HH
< prev
next >
Wrap
Text File
|
1996-07-29
|
7KB
|
221 lines
//----------------------------------------------------------------
// $Source: /rcs/vwrcs/components/intel/vwcomp.hh,v $
// Checked in by: $Author: andres $
// $Date: 1996/06/11 17:08:56 $ $Revision: 1.20 $
//----------------------------------------------------------------
// Copyright(c) 1992, Visual Edge Software Ltd.
//
// ALL RIGHTS RESERVED. This notice is intended as a precaution
// against inadvertent publication, and shall not be deemed to
// consitute an acknowledgment that publication has occurred
// nor to imply any waiver of confidentiality. The year included
// in the notice is the year of the creation of the work.
//----------------------------------------------------------------
// DESCRIPTION:
// This file contains the declaration for the VwGuiComponent
// class.
//----------------------------------------------------------------
// Copyright (c) International Business Machines Inc, 1995
#ifndef VWCOMP_HH
#define VWCOMP_HH
#include <vwglobal.hh>
#include <vstring.hh>
#include <varray.hh>
#include <vwmeasur.hh>
#include <vcatalog.hh>
#include <object.hh>
class VwContainer;
class VwComponent;
class VwFormBase;
class VwApplication;
class VwCallback;
//
// Place holder for future class holding callback specific data
//
class VwCallbackData;
#ifdef NOTEMPLATES
# ifndef VwCallbackListDefined
# define VwCallbackListDefined
# define CLASSNAME VwCallbackList
# define ENTRYTYPE VwCallback*
# include <mst/varray.mst>
# endif
# ifndef VwClientDataListDefined
# define VwClientDataListDefined
# define CLASSNAME VwClientDataList
# define ENTRYTYPE void*
# include <mst/varray.mst>
# endif
# ifndef VwComponentListDefined
# define VwComponentListDefined
# define CLASSNAME VwComponentList
# define ENTRYTYPE VwComponent*
# include <mst/varray.mst>
# endif
#else
typedef VeArray<VwCallback *> VwCallbackList;
typedef VeArray<void *> VwClientDataList;
typedef VeArray<VwComponent *> VwComponentList;
#endif
typedef void (*VwCallbackProcedurePtr_t) (VwComponent *, void *,
VwCallbackData * = 0);
//
// The following type is identical to the above one execept for the
// default 3rd parameter. This type is required because using the
// other type causes compiler errors when the type is used as a
// function parameter type as in AddDestroyCallback().
//
typedef void (*VwCallbackProcPtr_t) (VwComponent *, void *,
VwCallbackData *);
//
// Message catalog
//
extern VeCatalog *VwCompoCat;
class VwComponent : public VeObject
{
public:
RTTI_H(VeClass,VeObject);
// overides the new and delete to be sure that
// they are called in the DLL
#ifdef __DEBUG_ALLOC__
VMETHODDECL(void*) operator new(size_t size, const char *, size_t);
VMETHODDECL(void ) operator delete(void* ptr, const char *, size_t);
#else
VMETHODDECL(void*) operator new(size_t size );
VMETHODDECL(void ) operator delete(void* ptr );
#endif
virtual VOPERDECL ~VwComponent();
//
// Property Accesors
//
VVIRTUALDECL(const String) Name();
VVIRTUALDECL(VwStatus) PutName(String);
VVIRTUALDECL(VwContainer*) Parent();
VVIRTUALDECL(VwFormBase*) Form();
VVIRTUALDECL(const String) Tag();
VVIRTUALDECL(VwStatus) PutTag(String);
VVIRTUALDECL(void*) UserData ();
VVIRTUALDECL(VwStatus) PutUserData (void * );
VVIRTUALDECL(VwInt) Index();
VVIRTUALDECL(VwStatus) PutIndex(VwInt);
VVIRTUALDECL(void) UserModeChangeNotify();
VVIRTUALDECL(void*) NativeObject();
//
//this method deletes a component and all its descendants
//
VVIRTUALDECL(void) Destroy();
VVIRTUALDECL(VwBool) IsDestroyInProgress();
VVIRTUALDECL(void) PutIsDestroyInProgress(VwBool);
//
// Return the VwApplication instance associated with
// this components
//
VVIRTUALDECL(VwApplication*) Application();
//
// Destroy callback put method.
//
VMETHODDECL(void) AddDestroyCallback(VwCallbackProcPtr_t,
void *data = 0);
VMETHODDECL(void*) RemoveDestroyCallback(VwCallbackProcPtr_t,
void *data);
VMETHODDECL(VwClientDataList) RemoveDestroyCallbacks(VwCallbackProcPtr_t);
VVIRTUALDECL(void) DispatchDestroyCallbacks();
VMETHODDECL(VwInt) ErrorCode();
VMETHODDECL(void) ClearErrorCode();
VMETHODDECL(VobMixinFactory*) MixinFactory();
protected:
VeString itsName;
VwContainer* itsParent;
VwInt itsIndex;
VeString itsTag;
void* itsUserData;
VwInt itsErrorCode;
//
// Protected Constructor to prevent instantiation
//
VOPERDECL VwComponent(const String name, VwContainer *parent);
VMETHODDECL(VwBool) IsDynamicallyAllocated();
//
// Destroy callbacks list
//
VwCallbackList itsDestroyCbList;
//
// Keeps track of components that have not been destroyed.
// Components should add to this table just before executing
// user code in a call back. Upon return from user callback
// they should check if they are still in the LiveObjectTable
// before accessing any of their properties.
// In general events should call user code last. In which
// case they don't have to add themselves to the LiveObjectTable.
//
VMETHODDECL(VwComponentList *) LiveObjectList();
private:
static VMETHODDECL(void) NotifyApplication(VwComponent*, void*);
VwBool isDestroyInProgress;
VwBool isDynamicallyAllocated;
static VwBool allocatedFromNew;
};
/*
* Property name constants
*/
#define VwPname "Name"
#define VwPparent "Parent"
#define VwPindex "Index"
#define VwPtag "Tag"
class VwCallback {
public:
VwCallback(VwCallbackProcPtr_t cb, void * clientData = 0)
: itsCbProc(cb), itsClientData(clientData) {}
virtual void Dispatch(VwComponent *cmp);
void *ClientData() {return itsClientData;}
VwCallbackProcPtr_t CallbackProc() {return itsCbProc;}
private:
VwCallbackProcPtr_t itsCbProc;
void *itsClientData;
};
#endif /* VWCOMPONENT_HH */