home *** CD-ROM | disk | FTP | other *** search
/ Beginning Mac Programming / Beginning Mac Programming.bin / pc / Open Me for REALbasic 3 / REALbasic 3.2 / Goodies / REAL Software / REALbasic Plug-ins SDK / Includes / REALplugin.h < prev    next >
Encoding:
Text File  |  2000-11-29  |  10.6 KB  |  453 lines

  1. // REALplugin.h
  2. //
  3. //    This file is part of the REALbasic plugin API.  It's included automatically
  4. //    by "rb_plugin.h", so normally you'll just include the latter.
  5. //
  6. // © 1997-2000 REAL Software Inc. -- All Rights Reserved
  7.  
  8. #ifndef REALPLUGIN_H
  9. #define REALPLUGIN_H
  10.  
  11. #if TARGET_CPU_68K
  12.     // Compile with Metrowerks-ish/Think C calling conventions:
  13.     // Turn "MPW C" option off, and return pointers in D0 rather than A0.
  14.     #pragma d0_pointers on
  15.     #pragma mpwc off
  16. #endif
  17.  
  18. // define some shorter macros for the four kinds of targets we support
  19. #if WIN32
  20.     #define TARGET_WIN32 1
  21. #endif
  22. #if TARGET_CPU_68K
  23.     #define TARGET_68K 1
  24. #endif
  25. #if TARGET_CPU_PPC
  26.     #if TARGET_API_MAC_CARBON
  27.         #define TARGET_CARBON 1
  28.     #else
  29.         #define TARGET_PPC 1
  30.     #endif
  31. #endif
  32.  
  33. // define some constants for use with REALGetControlPosition etc.
  34. #define kREALLeft 0
  35. #define kREALTop 1
  36. #define kREALWidth 2
  37. #define kREALHeight 3
  38.  
  39. struct REALstringStruct
  40. {
  41. // This structure is for examination purposes only!
  42. // Do not construct them yourself - use REALBuildString!
  43. private:
  44.     long mPrivateUsageCount;
  45.     unsigned char *mPrivateStringData;
  46.     long mPrivateAllocLength;
  47.     long mPrivateLength;
  48. public:
  49.     long Length(void);
  50.     const char *CString();
  51.     const unsigned char *PString();
  52. };
  53.  
  54. typedef REALstringStruct *REALstring;
  55.  
  56. typedef void (*REALproc)(void);
  57.  
  58. struct REALdbDatabaseStruct;
  59. typedef REALdbDatabaseStruct *REALdbDatabase;
  60.  
  61. struct REALdbCursorStruct;
  62. typedef REALdbCursorStruct *REALdbCursor;
  63.  
  64. struct REALcontrolInstanceStruct;
  65. typedef REALcontrolInstanceStruct *REALcontrolInstance;
  66.  
  67. struct REALgraphicsStruct;
  68. typedef REALgraphicsStruct *REALgraphics;
  69.  
  70. struct REALobjectStruct;
  71. typedef REALobjectStruct *REALobject;
  72.  
  73. struct REALfolderItemStruct;
  74. typedef REALfolderItemStruct *REALfolderItem;
  75.  
  76. struct REALpictureStruct;
  77. typedef REALpictureStruct *REALpicture;
  78.  
  79. struct REALsoundStruct;
  80. typedef REALsoundStruct *REALsound;
  81.  
  82. struct REALappleEventStruct;
  83. typedef REALappleEventStruct *REALappleEvent;
  84.  
  85. struct REALwindowStruct;
  86. typedef REALwindowStruct *REALwindow;
  87.  
  88. struct REALpopupMenuStruct;
  89. typedef REALpopupMenuStruct *REALpopupMenu;
  90.  
  91. struct REALmemoryBlockStruct;
  92. typedef REALmemoryBlockStruct *REALmemoryBlock;
  93.  
  94. struct REALmovieStruct;
  95. typedef REALmovieStruct *REALmovie;
  96.  
  97. struct REALmoviePlayerStruct;
  98. typedef REALmoviePlayerStruct *REALmoviePlayer;
  99.  
  100. struct REALsocketStruct;
  101. typedef REALsocketStruct *REALsocket;
  102.  
  103. #define REALnoImplementation ((REALproc) nil)
  104.  
  105. struct REALmethodDefinition
  106. {
  107.     REALproc function;
  108.     REALproc setterFunction;
  109.     const char *declaration;
  110. };
  111.  
  112. #define REALpropInvalidate 1
  113. #define REALpropRuntimeOnly 2
  114.  
  115. #define REALstandardGetter ((REALproc) -1)
  116. #define REALstandardSetter ((REALproc) -1)
  117.  
  118. struct REALproperty
  119. {
  120.     const char *group;
  121.     const char *name;
  122.     const char *type;
  123.     int flags;
  124.     REALproc getter;
  125.     REALproc setter;
  126.     int param;
  127.     REALproc editor;
  128.     int enumCount;
  129.     const char **enumEntries;
  130. };
  131.  
  132. struct REALevent
  133. {
  134.     const char *declaration;
  135.     int forSystemUse;
  136. };
  137.  
  138. struct REALeventInstance
  139. {
  140.     const char *name;
  141.     REALproc implementation;
  142. };
  143.  
  144. struct REALbindingDescription
  145. {
  146.     const char *szInterface;
  147.     const char *szDescription;
  148.     const char *szPart;
  149. };
  150.  
  151. struct REALcontrolBehaviour
  152. {
  153.     void (*constructorFunction)(REALcontrolInstance);
  154.     void (*destructorFunction)(REALcontrolInstance);
  155. #ifdef WIN32
  156.     void (*redrawFunction)(REALcontrolInstance, REALgraphics context);
  157. #else
  158.     void (*redrawFunction)(REALcontrolInstance);
  159. #endif
  160.     Boolean (*clickFunction)(REALcontrolInstance, int, int, int);
  161.     void (*mouseDragFunction)(REALcontrolInstance, int, int);
  162.     void (*mouseUpFunction)(REALcontrolInstance, int, int);
  163.     void (*gainedFocusFunction)(REALcontrolInstance);
  164.     void (*lostFocusFunction)(REALcontrolInstance);
  165.     REALproc keyDownFunction;
  166.     void (*openFunction)(REALcontrolInstance);
  167.     void (*closeFunction)(REALcontrolInstance);
  168.     void (*backgroundIdleFunction)(REALcontrolInstance);
  169.     void (*drawOffscreenFunction)(REALcontrolInstance, REALgraphics context);
  170.     void (*setSpecialBackground)(REALcontrolInstance);
  171.     void (*constantChanging)(REALcontrolInstance, REALstring);
  172.     void (*droppedNewInstance)(REALcontrolInstance);
  173.  
  174.     REALproc unusedFunction1;
  175.     REALproc unusedFunction2;
  176.     REALproc unusedFunction3;
  177.     REALproc unusedFunction4;
  178.     REALproc unusedFunction5;
  179.     REALproc unusedFunction6;
  180.     REALproc unusedFunction7;
  181.     REALproc unusedFunction8;
  182.     REALproc unusedFunction9;
  183. };
  184.  
  185. #define kCurrentREALControlVersion 5
  186.  
  187. #define REALcontrolAcceptFocus 1
  188. #define REALcontrolFocusRing 2
  189. #define REALinvisibleControl 4
  190. #define REALopaqueControl 8
  191. #define REALenabledControl 16
  192.  
  193. struct REALcontrol
  194. {
  195.     int version;
  196.     const char *name;
  197.     int dataSize;
  198.     int flags;
  199.     int toolbarPICT, toolbarDownPICT;
  200.     int defaultWidth, defaultHeight;
  201.     REALproperty *properties;
  202.     int propertyCount;
  203.     REALmethodDefinition *methods;
  204.     int methodCount;
  205.     REALevent *events;
  206.     int eventCount;
  207.     REALcontrolBehaviour *behaviour;
  208.     int forSystemUse;
  209.     REALeventInstance *eventInstances;
  210.     int eventInstanceCount;
  211.     const char *interfaces;
  212.     REALbindingDescription *bindDescriptions;
  213.     int bindDescriptionCount;
  214. };
  215.  
  216. struct REALclassDefinition
  217. {
  218.     int version;
  219.     const char *name;
  220.     const char *superName;
  221.     int dataSize;
  222.     int forSystemUse;
  223.     REALproc constructor;
  224.     REALproc destructor;
  225.     REALproperty *properties;
  226.     int propertyCount;
  227.     REALmethodDefinition *methods;
  228.     int methodCount;
  229.     REALevent *events;
  230.     int eventCount;
  231.     REALeventInstance *eventInstances;
  232.     int eventInstanceCount;
  233.     const char *interfaces;
  234.     REALbindingDescription *bindDescriptions;
  235.     int bindDescriptionCount;
  236. };
  237.  
  238. #if !TARGET_WIN32
  239. typedef void (*REALEventCallback)(EventRecord *event, long param);
  240. #endif
  241.  
  242. #define kCurrentREALDatabaseVersion 1
  243.  
  244. typedef void (*REALDataSourceInterfaceProc)(void);
  245. typedef REALdbDatabase (*REALDataSourceProc)(Ptr data, int dataLen);
  246.  
  247. struct dbDatabase;
  248. struct dbTable;
  249. struct dbCursor;
  250.  
  251. struct dbDate
  252. {
  253.     short year;
  254.     short month;
  255.     short day;
  256. };
  257.  
  258. struct dbTime
  259. {
  260.     short hour;
  261.     short minute;
  262.     short second;
  263. };
  264.  
  265. struct dbTimeStamp
  266. {
  267.     short year;
  268.     short month;
  269.     short day;
  270.     short hour;
  271.     short minute;
  272.     short second;
  273. };
  274.  
  275. enum dbFieldType
  276. {
  277.     dbTypeNull,
  278.     dbTypeByte,
  279.     dbTypeShort,
  280.     dbTypeLong,
  281.     dbTypeChar,
  282.     dbTypeText,
  283.     dbTypeFloat,
  284.     dbTypeDouble,
  285.     dbTypeDate,
  286.     dbTypeTime,
  287.     dbTypeTimeStamp,
  288.     dbTypeCurrency,
  289.     dbTypeBoolean,
  290.     dbTypeDecimal,
  291.     dbTypeBinary,
  292.     dbTypeLongText,            // deprecated; use dbTypeText
  293.     dbTypeLongBinary,        // deprecated; use dbTypeBinary
  294.     dbTypeMacPICT,
  295.     dbTypeUnknown = 255
  296. };
  297.  
  298. struct REALnewColumn
  299. {
  300.     REALnewColumn *nextColumn;
  301.     REALstring columnName;
  302.     long columnType;
  303.     long bAllowNULL;
  304. };
  305.  
  306. struct REALcolumnValue
  307. {
  308.     REALcolumnValue *nextColumn;
  309.     REALstring columnName;
  310.     REALstring columnValue;
  311. };
  312.  
  313. enum REALcolumnOperation
  314. {
  315.     rcOpEquals,
  316.     rcOpLessThan,
  317.     rcOpGreaterThan,
  318.     rcOpLessThanEqual,
  319.     rcOpGreaterThanEqual,
  320.     rcOpNotEqual,
  321.     rcOpLike,
  322.     rcOpNotLike,
  323.     rcOpIsNull,
  324.     rcOpIsNotNull,
  325.  
  326.     rcOpAnd = 64,
  327.     rcOpOr
  328. };
  329.  
  330. struct REALcolumnConstraints
  331. {
  332.     REALcolumnConstraints *left, *right;
  333.     REALcolumnOperation columnOperation;
  334.     REALstring column;
  335.     REALstring value;
  336. };
  337.  
  338. struct REALgetColumn
  339. {
  340.     REALgetColumn *next;
  341.     REALstring column;
  342. };
  343.  
  344. enum {
  345.     dbEnginePrimaryKeySupported = 1,
  346.     dbEngineAlterTableAddParens = 2,
  347.     dbEngineDontUseBrackets = 4
  348. };
  349.  
  350. struct REALfieldUpdate
  351. {
  352.     REALfieldUpdate *next;
  353.     Ptr tableField;
  354.     int tableFieldLen;
  355.     Ptr recordKey;
  356.     int recordKeyLen;
  357.     REALstring value;
  358. };
  359.  
  360. struct REALdbEngineDefinition
  361. {
  362.     int version;
  363.     unsigned char forSystemUse;
  364.     unsigned char flags1;
  365.     unsigned char flags2;
  366.     unsigned char flags3;
  367.  
  368.     void (*closeDatabase)(dbDatabase *); // void (*closeDatabase)(dbDatabase *);
  369.  
  370.     REALdbCursor (*getTableSchemaCursor)(dbDatabase *); // dbCursor *(*tableCursor)(dbDatabase *)) /* optional */
  371.     REALdbCursor (*getFieldSchemaCursor)(dbDatabase *, REALstring); // dbCursor *(*fieldCursor)(dbDatabase *, REALstring)) /* optional */
  372.  
  373.     REALdbCursor (*directSQLSelect)(dbDatabase *, REALstring); // DatabaseCursorObject (*directSQLSelect)(dbDatabase *, REALstring selectString);
  374.     void (*directSQLExecute)(dbDatabase *, REALstring); // void (*directSQLExecute)(dbDatabase *, REALstring executeString);
  375.  
  376.     void (*createTable)(dbDatabase *, REALstring, REALnewColumn *, unsigned char *, int); // void (*createTable)(dbDatabase *, REALstring name, REALnewColumn *columns, unsigned char *primaryKey, int primaryKeyCount);
  377.     void (*addTableRecord)(dbDatabase *, REALstring, REALcolumnValue *); // void (*addTableRecord)(dbDatabase *, REALstring tableName, REALcolumnValue *values);
  378.     REALdbCursor (*getTableCursor)(dbDatabase *, REALstring, REALgetColumn *, REALcolumnConstraints *); // DatabaseCursorObject *(*getTableCursor)(dbDatabase *, REALstring tableName, REALgetColumn *columns, REALcolumnConstraints *constraints);
  379.  
  380.     void (*updateFields)(dbDatabase *, REALfieldUpdate *fields);
  381.     void (*addTableColumn)(dbDatabase *, REALstring, REALnewColumn *);
  382.     REALdbCursor (*getDatabaseIndexes)(dbDatabase *, REALstring table);
  383.  
  384.     long (*getLastErrorCode)(dbDatabase *);
  385.     REALstring (*getLastErrorString)(dbDatabase *);
  386.  
  387.     void (*commit)(dbDatabase *);
  388.     void (*rollback)(dbDatabase *);
  389.  
  390.     REALstring (*getProperty)(dbDatabase *, REALstring propertyName);
  391.  
  392.     REALproc unused1;
  393.     REALproc unused2;
  394.     REALproc unused3;
  395.     REALproc unused4;
  396.     REALproc unused5;
  397.     REALproc unused6;
  398.     REALproc unused7;
  399.     REALproc unused8;
  400.     REALproc unused9;
  401.     REALproc unused10;
  402. };
  403.  
  404. struct REALdbTableDefinition
  405. {
  406.     int version;
  407.     int forSystemUse;
  408.  
  409.     REALproc closeTable; // void (*closeTable)(dbTable *);
  410.     REALproc tableCursor; // dbCursor *(*tableCursor)(dbTable *);
  411. };
  412.  
  413. struct REALcursorUpdate
  414. {
  415.     REALcursorUpdate *next;
  416.     int fieldIndex;
  417.     REALstring columnValue;
  418. };
  419.  
  420. struct REALdbCursorDefinition
  421. {
  422.     int version;
  423.     int forSystemUse;
  424.  
  425.     void (*closeCursor)(dbCursor *);
  426.     int (*cursorColumnCount)(dbCursor *); // int (*cursorColumnCount)(dbCursor *);
  427.     REALstring (*cursorColumnName)(dbCursor *, int column); // REALstring (*cursorColumnName)(dbCursor *, int column); /* optional */
  428.     int (*cursorRowCount)(dbCursor *); // int (*cursorRowCount)(dbCursor *); /* optional */
  429.     void (*cursorColumnValue)(dbCursor *, int, Ptr *, dbFieldType *, int *); // void (*cursorColumnValue)(dbCursor *, int column, Ptr *value, dbFieldType *type, int *length);
  430.     void (*cursorReleaseValue)(dbCursor *); // void (*cursorReleaseValue)(dbCursor *); /* optional */
  431.     Boolean (*cursorNextRow)(dbCursor *); // Boolean (*cursorNextRow)(dbCursor *);
  432.     void (*cursorDelete)(dbCursor *); // void (*cursorDelete)(dbCursor *);
  433.     void (*cursorDeleteAll)(dbCursor *); // void (*cursorDeleteAll)(dbCursor *);
  434.     Boolean (*cursorFieldKey)(dbCursor *, int, Ptr *, int *, Ptr *, int *);
  435.     void (*cursorUpdate)(dbCursor *, REALcursorUpdate *fields);
  436.     void (*cursorEdit)(dbCursor *);            // called by dbCursor.Edit in RB
  437.     void *dummy4;
  438.     void *dummy5;
  439.     void *dummy6;
  440.     void *dummy7;
  441.     void *dummy8;
  442.     void *dummy9;
  443.     void *dummy10;
  444. };
  445.  
  446. #define FieldOffset(type, field) (long)(&((type *) 0)->field)
  447.  
  448. extern "C" {
  449. void PluginEntry(void);
  450. }
  451.  
  452. #endif
  453.