home *** CD-ROM | disk | FTP | other *** search
- // REALplugin.h
- //
- // This file is part of the REALbasic plugin API. It's included automatically
- // by "rb_plugin.h", so normally you'll just include the latter.
- //
- // © 1997-2000 REAL Software Inc. -- All Rights Reserved
-
- #ifndef REALPLUGIN_H
- #define REALPLUGIN_H
-
- #if TARGET_CPU_68K
- // Compile with Metrowerks-ish/Think C calling conventions:
- // Turn "MPW C" option off, and return pointers in D0 rather than A0.
- #pragma d0_pointers on
- #pragma mpwc off
- #endif
-
- // define some shorter macros for the four kinds of targets we support
- #if WIN32
- #define TARGET_WIN32 1
- #endif
- #if TARGET_CPU_68K
- #define TARGET_68K 1
- #endif
- #if TARGET_CPU_PPC
- #if TARGET_API_MAC_CARBON
- #define TARGET_CARBON 1
- #else
- #define TARGET_PPC 1
- #endif
- #endif
-
- // define some constants for use with REALGetControlPosition etc.
- #define kREALLeft 0
- #define kREALTop 1
- #define kREALWidth 2
- #define kREALHeight 3
-
- struct REALstringStruct
- {
- // This structure is for examination purposes only!
- // Do not construct them yourself - use REALBuildString!
- private:
- long mPrivateUsageCount;
- unsigned char *mPrivateStringData;
- long mPrivateAllocLength;
- long mPrivateLength;
- public:
- long Length(void);
- const char *CString();
- const unsigned char *PString();
- };
-
- typedef REALstringStruct *REALstring;
-
- typedef void (*REALproc)(void);
-
- struct REALdbDatabaseStruct;
- typedef REALdbDatabaseStruct *REALdbDatabase;
-
- struct REALdbCursorStruct;
- typedef REALdbCursorStruct *REALdbCursor;
-
- struct REALcontrolInstanceStruct;
- typedef REALcontrolInstanceStruct *REALcontrolInstance;
-
- struct REALgraphicsStruct;
- typedef REALgraphicsStruct *REALgraphics;
-
- struct REALobjectStruct;
- typedef REALobjectStruct *REALobject;
-
- struct REALfolderItemStruct;
- typedef REALfolderItemStruct *REALfolderItem;
-
- struct REALpictureStruct;
- typedef REALpictureStruct *REALpicture;
-
- struct REALsoundStruct;
- typedef REALsoundStruct *REALsound;
-
- struct REALappleEventStruct;
- typedef REALappleEventStruct *REALappleEvent;
-
- struct REALwindowStruct;
- typedef REALwindowStruct *REALwindow;
-
- struct REALpopupMenuStruct;
- typedef REALpopupMenuStruct *REALpopupMenu;
-
- struct REALmovieStruct;
- typedef REALmovieStruct *REALmovie;
-
- struct REALmoviePlayerStruct;
- typedef REALmoviePlayerStruct *REALmoviePlayer;
-
- struct REALsocketStruct;
- typedef REALsocketStruct *REALsocket;
-
- #define REALnoImplementation ((REALproc) nil)
-
- struct REALmethodDefinition
- {
- REALproc function;
- REALproc setterFunction;
- const char *declaration;
- };
-
- #define REALpropInvalidate 1
- #define REALpropRuntimeOnly 2
-
- #define REALstandardGetter ((REALproc) -1)
- #define REALstandardSetter ((REALproc) -1)
-
- struct REALproperty
- {
- const char *group;
- const char *name;
- const char *type;
- int flags;
- REALproc getter;
- REALproc setter;
- int param;
- REALproc editor;
- int enumCount;
- const char **enumEntries;
- };
-
- struct REALevent
- {
- const char *declaration;
- int forSystemUse;
- };
-
- struct REALeventInstance
- {
- const char *name;
- REALproc implementation;
- };
-
- struct REALbindingDescription
- {
- const char *szInterface;
- const char *szDescription;
- const char *szPart;
- };
-
- struct REALcontrolBehaviour
- {
- void (*constructorFunction)(REALcontrolInstance);
- void (*destructorFunction)(REALcontrolInstance);
- #ifdef WIN32
- void (*redrawFunction)(REALcontrolInstance, REALgraphics context);
- #else
- void (*redrawFunction)(REALcontrolInstance);
- #endif
- Boolean (*clickFunction)(REALcontrolInstance, int, int, int);
- void (*mouseDragFunction)(REALcontrolInstance, int, int);
- void (*mouseUpFunction)(REALcontrolInstance, int, int);
- void (*gainedFocusFunction)(REALcontrolInstance);
- void (*lostFocusFunction)(REALcontrolInstance);
- REALproc keyDownFunction;
- void (*openFunction)(REALcontrolInstance);
- void (*closeFunction)(REALcontrolInstance);
- void (*backgroundIdleFunction)(REALcontrolInstance);
- void (*drawOffscreenFunction)(REALcontrolInstance, REALgraphics context);
- void (*setSpecialBackground)(REALcontrolInstance);
- void (*constantChanging)(REALcontrolInstance, REALstring);
- void (*droppedNewInstance)(REALcontrolInstance);
-
- REALproc unusedFunction1;
- REALproc unusedFunction2;
- REALproc unusedFunction3;
- REALproc unusedFunction4;
- REALproc unusedFunction5;
- REALproc unusedFunction6;
- REALproc unusedFunction7;
- REALproc unusedFunction8;
- REALproc unusedFunction9;
- };
-
- #define kCurrentREALControlVersion 5
-
- #define REALcontrolAcceptFocus 1
- #define REALcontrolFocusRing 2
- #define REALinvisibleControl 4
- #define REALopaqueControl 8
- #define REALenabledControl 16
-
- struct REALcontrol
- {
- int version;
- const char *name;
- int dataSize;
- int flags;
- int toolbarPICT, toolbarDownPICT;
- int defaultWidth, defaultHeight;
- REALproperty *properties;
- int propertyCount;
- REALmethodDefinition *methods;
- int methodCount;
- REALevent *events;
- int eventCount;
- REALcontrolBehaviour *behaviour;
- int forSystemUse;
- REALeventInstance *eventInstances;
- int eventInstanceCount;
- const char *interfaces;
- REALbindingDescription *bindDescriptions;
- int bindDescriptionCount;
- };
-
- struct REALclassDefinition
- {
- int version;
- const char *name;
- const char *superName;
- int dataSize;
- int forSystemUse;
- REALproc constructor;
- REALproc destructor;
- REALproperty *properties;
- int propertyCount;
- REALmethodDefinition *methods;
- int methodCount;
- REALevent *events;
- int eventCount;
- REALeventInstance *eventInstances;
- int eventInstanceCount;
- const char *interfaces;
- REALbindingDescription *bindDescriptions;
- int bindDescriptionCount;
- };
-
- #if !TARGET_WIN32
- typedef void (*REALEventCallback)(EventRecord *event, long param);
- #endif
-
- #define kCurrentREALDatabaseVersion 1
-
- typedef void (*REALDataSourceInterfaceProc)(void);
- typedef REALdbDatabase (*REALDataSourceProc)(Ptr data, int dataLen);
-
- struct dbDatabase;
- struct dbTable;
- struct dbCursor;
-
- struct dbDate
- {
- short year;
- short month;
- short day;
- };
-
- struct dbTime
- {
- short hour;
- short minute;
- short second;
- };
-
- struct dbTimeStamp
- {
- short year;
- short month;
- short day;
- short hour;
- short minute;
- short second;
- };
-
- enum dbFieldType
- {
- dbTypeNull,
- dbTypeByte,
- dbTypeShort,
- dbTypeLong,
- dbTypeChar,
- dbTypeText,
- dbTypeFloat,
- dbTypeDouble,
- dbTypeDate,
- dbTypeTime,
- dbTypeTimeStamp,
- dbTypeCurrency,
- dbTypeBoolean,
- dbTypeDecimal,
- dbTypeBinary,
- dbTypeLongText,
- dbTypeLongBinary,
- dbTypeMacPICT,
- dbTypeUnknown = 255
- };
-
- struct REALnewColumn
- {
- REALnewColumn *nextColumn;
- REALstring columnName;
- long columnType;
- long bAllowNULL;
- };
-
- struct REALcolumnValue
- {
- REALcolumnValue *nextColumn;
- REALstring columnName;
- REALstring columnValue;
- };
-
- enum REALcolumnOperation
- {
- rcOpEquals,
- rcOpLessThan,
- rcOpGreaterThan,
- rcOpLessThanEqual,
- rcOpGreaterThanEqual,
- rcOpNotEqual,
- rcOpLike,
- rcOpNotLike,
- rcOpIsNull,
- rcOpIsNotNull,
-
- rcOpAnd = 64,
- rcOpOr
- };
-
- struct REALcolumnConstraints
- {
- REALcolumnConstraints *left, *right;
- REALcolumnOperation columnOperation;
- REALstring column;
- REALstring value;
- };
-
- struct REALgetColumn
- {
- REALgetColumn *next;
- REALstring column;
- };
-
- enum {
- dbEnginePrimaryKeySupported = 1,
- dbEngineAlterTableAddParens = 2,
- dbEngineDontUseBrackets = 4
- };
-
- struct REALfieldUpdate
- {
- REALfieldUpdate *next;
- Ptr tableField;
- int tableFieldLen;
- Ptr recordKey;
- int recordKeyLen;
- REALstring value;
- };
-
- struct REALdbEngineDefinition
- {
- int version;
- unsigned char forSystemUse;
- unsigned char flags1;
- unsigned char flags2;
- unsigned char flags3;
-
- void (*closeDatabase)(dbDatabase *); // void (*closeDatabase)(dbDatabase *);
-
- REALdbCursor (*getTableSchemaCursor)(dbDatabase *); // dbCursor *(*tableCursor)(dbDatabase *)) /* optional */
- REALdbCursor (*getFieldSchemaCursor)(dbDatabase *, REALstring); // dbCursor *(*fieldCursor)(dbDatabase *, REALstring)) /* optional */
-
- REALdbCursor (*directSQLSelect)(dbDatabase *, REALstring); // DatabaseCursorObject (*directSQLSelect)(dbDatabase *, REALstring selectString);
- void (*directSQLExecute)(dbDatabase *, REALstring); // void (*directSQLExecute)(dbDatabase *, REALstring executeString);
-
- void (*createTable)(dbDatabase *, REALstring, REALnewColumn *, unsigned char *, int); // void (*createTable)(dbDatabase *, REALstring name, REALnewColumn *columns, unsigned char *primaryKey, int primaryKeyCount);
- void (*addTableRecord)(dbDatabase *, REALstring, REALcolumnValue *); // void (*addTableRecord)(dbDatabase *, REALstring tableName, REALcolumnValue *values);
- REALdbCursor (*getTableCursor)(dbDatabase *, REALstring, REALgetColumn *, REALcolumnConstraints *); // DatabaseCursorObject *(*getTableCursor)(dbDatabase *, REALstring tableName, REALgetColumn *columns, REALcolumnConstraints *constraints);
-
- void (*updateFields)(dbDatabase *, REALfieldUpdate *fields);
- void (*addTableColumn)(dbDatabase *, REALstring, REALnewColumn *);
- REALdbCursor (*getDatabaseIndexes)(dbDatabase *, REALstring table);
-
- long (*getLastErrorCode)(dbDatabase *);
- REALstring (*getLastErrorString)(dbDatabase *);
-
- void (*commit)(dbDatabase *);
- void (*rollback)(dbDatabase *);
-
- REALstring (*getProperty)(dbDatabase *, REALstring propertyName);
-
- REALproc unused1;
- REALproc unused2;
- REALproc unused3;
- REALproc unused4;
- REALproc unused5;
- REALproc unused6;
- REALproc unused7;
- REALproc unused8;
- REALproc unused9;
- REALproc unused10;
- };
-
- struct REALdbTableDefinition
- {
- int version;
- int forSystemUse;
-
- REALproc closeTable; // void (*closeTable)(dbTable *);
- REALproc tableCursor; // dbCursor *(*tableCursor)(dbTable *);
- };
-
- struct REALcursorUpdate
- {
- REALcursorUpdate *next;
- int fieldIndex;
- REALstring columnValue;
- };
-
- struct REALdbCursorDefinition
- {
- int version;
- int forSystemUse;
-
- void (*closeCursor)(dbCursor *);
- int (*cursorColumnCount)(dbCursor *); // int (*cursorColumnCount)(dbCursor *);
- REALstring (*cursorColumnName)(dbCursor *, int column); // REALstring (*cursorColumnName)(dbCursor *, int column); /* optional */
- int (*cursorRowCount)(dbCursor *); // int (*cursorRowCount)(dbCursor *); /* optional */
- void (*cursorColumnValue)(dbCursor *, int, Ptr *, dbFieldType *, int *); // void (*cursorColumnValue)(dbCursor *, int column, Ptr *value, dbFieldType *type, int *length);
- void (*cursorReleaseValue)(dbCursor *); // void (*cursorReleaseValue)(dbCursor *); /* optional */
- Boolean (*cursorNextRow)(dbCursor *); // Boolean (*cursorNextRow)(dbCursor *);
- void (*cursorDelete)(dbCursor *); // void (*cursorDelete)(dbCursor *);
- void (*cursorDeleteAll)(dbCursor *); // void (*cursorDeleteAll)(dbCursor *);
- Boolean (*cursorFieldKey)(dbCursor *, int, Ptr *, int *, Ptr *, int *);
- void (*cursorUpdate)(dbCursor *, REALcursorUpdate *fields);
- void (*cursorEdit)(dbCursor *); // called by dbCursor.Edit in RB
- void *dummy4;
- void *dummy5;
- void *dummy6;
- void *dummy7;
- void *dummy8;
- void *dummy9;
- void *dummy10;
- };
-
- #define FieldOffset(type, field) (long)(&((type *) 0)->field)
-
- extern "C" {
- void PluginEntry(void);
- }
-
- #endif
-