home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1996 November
/
VPR9611B.ISO
/
vabasic
/
ntclnt.exe
/
DISK8
/
data.8
/
datab
/
INCLUDE
/
CPLACE.HH
< prev
next >
Wrap
Text File
|
1996-07-29
|
6KB
|
177 lines
//-------------------------------------------------------------
// $Source: /rcs/crcs/utils/intel/cplace.hh,v $
// Checked in by: $Author: thomas $
// $Date: 1996/05/27 23:36:57 $ $Revision: 1.8 $
//--------------------------------------------------------------
// Copyright (c) International Business Machines Inc, 1994
//
// 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 class declaration for the
// VwpHandle and VwpPlaceable classes.
//--------------------------------------------------------------
#ifndef CPLACE_HH
#define CPLACE_HH
#include <cdc.hh>
#ifdef VSYS_OS2
#define VwResHandle LHANDLE
#define VwResPalette HPAL
#define VwResTypeBitmap CF_BITMAP
#define VwResTypeMetafile CF_METAFILE
#define VwResTypeIcon -1
#define VwResColor LONG
#else
#define VwResHandle HANDLE
#define VwResPalette HPALETTE
#define VwResTypeBitmap CF_BITMAP
#define VwResTypeMetafile CF_METAFILEPICT
#define VwResTypeIcon -1
#define VwResColor COLORREF
#endif
#ifdef NOTEMPLATES
#ifndef CPlaceableTableDefined
#define CPlaceableTableDefined
#define CLASSNAME VwpPlaceableTable
#define ENTRYTYPE void*
#include <mst/ihash.mst>
#endif
#else
#include <ihash.hh>
typedef VeIHashTable<void*> VwpPlaceableTable;
#endif
// File Types for VwLoadPlaceable. Providing a fileType to VwLoadPlaceable
// will speed up the Picture creation process.
#define UNKNOWN_FILETYPE 0
#define BITMAP_FILETYPE 1
#define ICON_FILETYPE 2
#define META_FILETYPE 3
/************************************************************************/
/************************************************************************/
/**************** Class Definitions ************************************/
/************************************************************************/
//*************************************************************************
// The VwpHandle class is a general container or wrapper for platform handles
// introduced by subclasses of the VwpPlaceable class. It allows serveral
// instances to share the same platform handle by reference count.
// New CPlaceables should inherit or implement a destroy call back
// (CDestroyCallback) used to dispose of the platform handle.
//*************************************************************************
typedef VwBool (*CDestroyCallback)(VwResHandle);
VCLASS VwpHandle {
public:
VOPERDECL VwpHandle();
VOPERDECL VwpHandle(VwResHandle, CDestroyCallback,
VwResPalette = NULL);
virtual VOPERDECL ~VwpHandle();
VMETHODDECL(VwResHandle) Handle();
VMETHODDECL(void) SetHandle(VwResHandle);
VMETHODDECL(CDestroyCallback) DestroyCallback();
VMETHODDECL(void) SetDestroyCallback(CDestroyCallback);
VMETHODDECL(int) Acquire();
VMETHODDECL(int) Release();
VMETHODDECL(VwResPalette) DIBPalette();
private:
VwBool FireCallback();
void Init();
VwResHandle itsHandle;
CDestroyCallback itsCallback;
int itsRefCount;
VwResPalette itsDIBPal;
};
VCLASS VwpPlaceable {
public:
VOPERDECL VwpPlaceable();
virtual VOPERDECL ~VwpPlaceable();
VVIRTUALDECL(void) Init();
// Visual Basic functionality
VVIRTUALDECL(VwStatus) Load(const char * = NULL, long offset = 0) = 0;
VVIRTUALDECL(VwStatus) Load(FILE *) = 0;
VVIRTUALDECL(VwStatus) Load(void * buffer, LONG buflen) = 0;
VVIRTUALDECL(VwStatus) Paint(VwpDC *, VwpRect *) = 0;
VVIRTUALDECL(VwStatus) Save(const char * = NULL) = 0;
VVIRTUALDECL(VwStatus) Save(FILE *) = 0;
VVIRTUALDECL(int) GraphicFormat() = 0;
VVIRTUALDECL(LONG) GraphicLength() = 0;
VVIRTUALDECL(VwStatus) DumpGraphic(void *buffer) = 0;
VVIRTUALDECL(VwResHandle) CloneGraphic() = 0;
VVIRTUALDECL(VwpPlaceable *) Copy() = 0;
static VMETHODDECL(VwBool) CanLoadFrom(void *, LONG, VeString, FILE *, VwpPlaceable **);
// Platform handle manipulation interface
VVIRTUALDECL(VwpHandle*) Handle();
VVIRTUALDECL(void) SetHandle(VwpHandle *);
VVIRTUALDECL(VwResHandle) PlatformHandle();
VVIRTUALDECL(VwBool) FreeHandle();
// Reference Counting Interface
VVIRTUALDECL(int) AddRef();
VVIRTUALDECL(int) RemoveRef();
VVIRTUALDECL(int) Reference();
VMETHODDECL(void*) SetPlatformData(void *);
VMETHODDECL(void*) PlatformData();
// Property Interface
VMETHODDECL(VwBool) Stretch();
VMETHODDECL(void) SetStretch(VwBool);
// Additional Function
VMETHODDECL(VwStatus) Size(VwpSize &);
VMETHODDECL(void) SetSize(int, int);
VMETHODDECL(void) SetSize(VwpSize);
VMETHODDECL(VwStatus) Position(VwpPoint &);
VMETHODDECL(void) SetPosition(int, int);
VMETHODDECL(VeString) FileName();
VMETHODDECL(void) SetFileName(const char *);
// Function to determine if a pointer of unknown origin points to a VwpPlaceable
static VMETHODDECL(VwBool) IsValidCPlaceable(void*);
protected:
VwpPoint itsPos;
VwpSize itsSize;
void *itsPlatformData;
VwpHandle *itsHandle;
private:
static VwpPlaceableTable* theCPlaceableTable;
VeString itsFileName;
int itsRefCount;
struct {
short stretch:1;
} itsDisplayFlags;
};
#endif