ioa.h

Go to the documentation of this file.
00001 
00002 /*  $Id: ioa.h 1186 2006-04-03 13:06:44Z hasseily $    */
00003 
00004 /******************************************************************************
00005 
00006     UserLand Frontier(tm) -- High performance Web content management,
00007     object database, system-level and Internet scripting environment,
00008     including source code editing and debugging.
00009 
00010     Copyright (C) 1992-2004 UserLand Software, Inc.
00011 
00012     This program is free software; you can redistribute it and/or modify
00013     it under the terms of the GNU General Public License as published by
00014     the Free Software Foundation; either version 2 of the License, or
00015     (at your option) any later version.
00016 
00017     This program is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020     GNU General Public License for more details.
00021 
00022     You should have received a copy of the GNU General Public License
00023     along with this program; if not, write to the Free Software
00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 
00026 ******************************************************************************/
00027 
00028 #define ioainclude
00029 
00030 #ifdef isFrontier
00031     #include "font.h"
00032     #define widthsmallicon 16 /*dimensions of a SICN resource*/
00033     #define heightsmallicon 16
00034 
00035     typedef struct tydaterecord { 
00036         
00037         short day, month, year;
00038         
00039         short hour, minute, second;
00040         } tydaterecord;
00041 #endif
00042 
00043 #ifndef appletdefsinclude
00044 
00045     #include <appletdefs.h>
00046 
00047 #endif
00048 
00049 
00050 #ifndef __APPLEEVENTS__
00051 
00052     #include <AppleEvents.h>
00053 
00054 #endif
00055 
00056 
00057 
00058 
00059 #define idUserTalk 'LAND' /*identifies Frontier as a scripting component*/
00060 
00061 #define idAppleScript 'ascr' /*identifies AppleScript as a scripting component*/
00062 
00063 
00064 typedef long tyobjecttype;
00065 
00066 
00067 /*UserLand-supplied object types*/
00068 
00069     #define notype 0 
00070     
00071     #define grouptype 1
00072     
00073     #define checkboxtype 2
00074     
00075     #define radiobuttontype 3
00076     
00077     #define picturetype 4
00078     
00079     #define statictexttype 5
00080     
00081     #define edittexttype 6
00082     
00083     #define buttontype 7
00084     
00085     #define scrollbartype 8
00086     
00087     #define unusedtype2 9
00088     
00089     #define recttype 10
00090     
00091     #define ovaltype 11
00092     
00093     #define linetype 12
00094     
00095     #define icontype 13
00096     
00097     #define formulatype 14
00098     
00099     #define popuptype 15
00100     
00101     #define clonetype 16
00102 
00103 
00104 /*recalc options for objects*/
00105 
00106     #define neverrecalc 1   
00107 
00108     #define initrecalc 2 /*recalc only when card starts up*/
00109 
00110     #define changerecalc 3 /*recalc when another object changes*/
00111 
00112     #define timerecalc 4 /*recalc every x seconds*/
00113     
00114     
00115 typedef struct tyobject {
00116 
00117     short versionnumber;
00118     
00119     struct tyobject **nextobject; /*next object in the object list*/
00120     
00121     struct tyobject **nextselectedobject; /*part of the selection list structure*/
00122     
00123     struct tyobject **childobjectlist; /*for group objects*/
00124     
00125     struct tyobject **nextinthread; /*flat list of objects, for run mode*/
00126     
00127     struct tycard **owningcard; /*each object points back to the card that it appears in*/
00128     
00129     tyobjecttype objecttype; /*a button, checkbox, static text, etc.*/
00130     
00131     Rect objectrect; /*the display rectangle for the object*/
00132     
00133     Handle objectname; /*the variable name for this object*/
00134     
00135     Handle objectvalue; /*the string that's displayed in the object*/
00136     
00137     Handle objectscript; /*the script that runs when the object is hit, the object's action script*/
00138     
00139     Handle objecterrormessage; /*error that was generated when the object was calculated*/
00140     
00141     Handle objectdata; /*a refcon handle, must be a contiguous block, no dangling handles*/
00142     
00143     unsigned short objectflag: 1; /*for buttons, true --> bold, checkboxes, the box is checked*/
00144     
00145     unsigned short objectvisible: 1; /*if false, the object isn't drawn*/
00146     
00147     unsigned short objectenabled: 1; /*if false the object is disabled*/
00148     
00149     unsigned short objecttransparent: 1; /*if true, don't erase the rect before drawing object*/
00150     
00151     unsigned short objectautosize: 1; /*enables auto-resizing -- when you single-click to create new object*/
00152     
00153     unsigned short objectinval: 1; /*indicates the object needs re-display*/
00154     
00155     unsigned short objecthasframe: 1; /*do we draw a frame for the object?*/
00156     
00157     unsigned short objecttmpbit: 1; /*for any temporary use at all*/
00158     
00159     unsigned short objectselected: 1; /*if true, the object is part of the selection list*/
00160     
00161     unsigned short reservedbit1: 1; /*room for growth*/
00162     
00163     unsigned short reservedbit2: 1; /*room for growth*/
00164     
00165     unsigned short reservedbit3: 1; /*room for growth*/
00166     
00167     unsigned short appbit1: 1; /*other modules can use this bit*/
00168     
00169     unsigned short appbit2: 1; /*other modules can use this bit*/
00170     
00171     unsigned short appbit3: 1; /*other modules can use this bit*/
00172     
00173     unsigned short appbit4: 1; /*other modules can use this bit*/
00174     
00175     OSType objectlanguage; /*component subtype for linked script's interpreter*/ 
00176     
00177     Handle objecteditrecord; 
00178     
00179     short objectfont;
00180     
00181     short objectfontsize;
00182     
00183     short objectstyle;
00184     
00185     tyjustification objectjustification;
00186     
00187     RGBColor objectfillcolor, objecttextcolor, objectframecolor;
00188     
00189     short objectdropshadowdepth;
00190     
00191     short objectlinespacing;
00192     
00193     short objectindentation;
00194     
00195     short sorttag; /*used for sorting the object list by location*/
00196     
00197     Handle objectrecalcscript; /*the object's recalc script*/
00198     
00199     short objectrecalcstatus; /*when does this object recalc?*/
00200     
00201     short objectrecalcperiod; /*if it recalcs every x seconds, this is x*/
00202     
00203     unsigned long objectnextruntime; /*number of secs since 1/1/04 for the next recalc*/
00204     
00205     char waste [6];
00206     } tyobject, *ptrobject, **hdlobject;
00207     
00208     
00209 typedef boolean (*tyobjectvisitroutine) (hdlobject);
00210         
00211 typedef void (*tyupdatecallback) (void);
00212 
00213 
00214 #define cttemphandles 25
00215 
00216 
00217 typedef boolean (*tyobjectcallback) (hdlobject);
00218 
00219 typedef boolean (*tystackedobjectcallback) (tyobject *);
00220 
00221 typedef boolean (*tycleanobjectcallback) (hdlobject, short, short, Rect *);
00222 
00223 typedef boolean (*tyobjectbooleancallback) (hdlobject, boolean);
00224 
00225 typedef boolean (*tyobjectcharcallback) (hdlobject, char);
00226 
00227 typedef boolean (*tyobjectrectcallback) (hdlobject, Rect *);
00228 
00229 typedef boolean (*tyobjectptrhandlecallback) (hdlobject, Handle *);
00230 
00231 typedef boolean (*tyobjecthandlecallback) (hdlobject, Handle);
00232 
00233 typedef boolean (*tyobjectstringcallback) (hdlobject, Str255);
00234 
00235 typedef boolean (*tymouseclickcallback) (hdlobject, hdlobject, Point, boolean, boolean);
00236 
00237 typedef boolean (*tyobjectpointcallback) (hdlobject, Point);
00238 
00239 typedef void (*tygetobjectsizecallback) (hdlobject, short *, short *);
00240 
00241 typedef boolean (*tyshortcallback) (short);
00242 
00243 typedef boolean (*tyvoidcallback) (void);
00244 
00245 typedef void (*tydrawtexthandlecallback) (Handle, Rect, tyjustification);
00246 
00247 typedef boolean (*tyhandlecallback) (Handle);
00248 
00249 typedef boolean (*tyeditclickcallback) (Point, boolean, Handle);
00250 
00251 typedef boolean (*tycharhandlecallback) (char, Handle);
00252 
00253 typedef boolean (*tyRGBcallback) (const RGBColor *);
00254 
00255 typedef Handle (*tyreturnshandlecallback) (void);
00256 
00257 typedef boolean (*tygetnthstringcallback) (hdlobject, short, bigstring);
00258 
00259 typedef boolean (*tyappleeventcallback) (hdlobject, AppleEvent *);
00260 
00261 typedef boolean (*typackdatacallback) (hdlobject, Handle *);
00262 
00263 typedef boolean (*tyunpackdatacallback) (hdlobject, Handle);
00264 
00265 typedef boolean (*tyevalscriptcallback) (hdlobject, Handle, Handle *, OSType, bigstring);
00266 
00267 
00268  
00269 typedef struct tycard {
00270     
00271     short versionnumber; /*must be the first object in the struct, must be 2 bytes*/
00272     
00273     hdlobject objectlist; /*the first object in the display list, must be 2nd item in this struct*/
00274     
00275     hdlobject selectionlist; /*the first selected object, nil if nothing selected*/
00276     
00277     Handle windowtitle; /*the string displayed in the window's title bar, if it has one*/
00278     
00279     boolean runmode; /*if true, the card is being run, not being edited*/
00280     
00281     boolean flactive; /*true if the window containing this card is active*/
00282     
00283     boolean tracking; /*if true we're in a very special mode, tracking the mouse*/
00284     
00285     hdlobject trackerobject; /*the object that's being tracked*/
00286     
00287     boolean trackerpressed; /*if true, the mouse is in the right rectangle*/
00288     
00289     boolean bitmapactive; /*if true, drawing routines don't use offscreen bitmaps*/
00290     
00291     Handle updatethiseditbuffer; /*used for deferred edit buffer updating*/
00292     
00293     hdlobject activetextobject; /*the current edittext object being edited*/
00294     
00295     boolean flskiptext; /*see drawobject*/
00296     
00297     boolean dontdraw; /*set true if we're just finding out how big the drawing is*/
00298     
00299     Rect pictrect; /*this is how big the drawing is*/
00300     
00301     PicHandle macpicture; /*used when we're printing the card*/
00302     
00303     boolean needsupdate; /*set true if some object has been inval'd*/
00304     
00305     RGBColor backcolor; /*the card's background color*/
00306     
00307     WindowPtr drawwindow; /*allows runmode to override the window that's drawn into*/
00308     
00309     Rect updaterect; /*the portion of the card that needs updating*/
00310     
00311     tyobject defaults; /*defaults for colors, other styles*/
00312     
00313     tyupdatecallback updatecallback; /*updating is handled differently in runtime*/
00314     
00315     boolean flgrid; /*if true, snap-to-grid is on*/
00316     
00317     short gridunits; /*the number of pixels for each grid unit*/
00318     
00319     Handle temphandles [cttemphandles]; /*temporary handles generated when eval'ing expressions*/
00320     
00321     boolean recalcneeded; /*if true some value changed, all formulas need recalcing*/
00322     
00323     long recalctickcount; /*the time to do the recalc, non-zero when user is typing, for example*/
00324     
00325     short rightborder, bottomborder; /*allows designer to determine the size of the running card*/
00326     
00327     long refcon; /*used by editor to store other stuff*/
00328     
00329     Handle tablename; /*the sub-table of system.cards that holds this card's table*/
00330     
00331     Handle embeddedtable; /*packed Frontier table that goes where the card goes*/
00332     
00333     boolean tablestoredinfrontier; /*if false, Frontier wasn't running when the card was opened*/
00334     
00335     FontInfo fontinfo; /*a copy of globalfontinfo, available to IOA callback routines*/
00336 
00337     tygetobjectsizecallback IOAgetobjectsizeCallback;
00338     
00339     tyobjectptrhandlecallback IOAgetstringvalueCallback;
00340     
00341     tyRGBcallback IOApushforecolorCallback;
00342     
00343     tyvoidcallback IOApopforecolorCallback;
00344     
00345     tyRGBcallback IOApushbackcolorCallback;
00346     
00347     tyvoidcallback IOApopbackcolorCallback;
00348     
00349     tyobjectcallback IOArunbuttonscriptCallback;
00350     
00351     tyobjectptrhandlecallback IOAgetbooleanvalueCallback;
00352     
00353     tyobjecthandlecallback IOAsetbooleanvalueCallback;
00354     
00355     tydrawtexthandlecallback IOAeditdrawtexthandleCallback;
00356     
00357     tyobjectcallback IOArecalcobjectvalueCallback;
00358     
00359     tyevalscriptcallback IOAevalscriptCallback;
00360     
00361     tyobjectcallback IOAinvalobjectCallback;
00362     
00363     tyobjecthandlecallback IOAsetobjectvalueCallback;
00364     
00365     tyvoidcallback IOAclearactivetextobjectCallback;
00366     
00367     tyobjectcallback IOAsetactivetextobjectCallback;
00368     
00369     tyreturnshandlecallback IOAgetactiveeditrecordCallback;
00370     
00371     tyeditclickcallback IOAeditclickCallback;
00372     
00373     tyhandlecallback IOAeditselectallCallback;
00374     
00375     tyhandlecallback IOAeditidleCallback;
00376     
00377     tycharhandlecallback IOAeditkeystrokeCallback;
00378     
00379     tygetnthstringcallback IOAgetnthstringCallback;
00380     
00381     boolean flinvisiblegrid; /*move me! then rebuild all the IOAs*/
00382     
00383     boolean flautoname; /*move me! then rebuild all the IOAs*/
00384     
00385     EventRecord macevent; /*move me! then rebuild all the IOAs*/
00386     
00387     boolean floater; /*true if the window is a floating window in the host*/
00388     
00389     long idwindow; /*determines what kind of window is used to display card*/
00390     
00391     boolean fullupdate; /*true if a global has been changed, requiring a full update*/
00392     
00393     Point defaultnewobjectlocation; /*the next place a new object is created by a script*/
00394     
00395     Rect deferredinvalrect; /*allows system event handlers to inval a rectangle*/
00396     
00397     boolean notscriptedcard: 1; /*for clay basket and others, that drive the cards from C*/
00398     
00399     boolean runtimevaluechanged: 1; /*DW 9/19/95 -- at least 1 value in card changed, you might want to enable an Update button*/
00400     
00401     boolean reservedbit2: 1; /*room for growth*/
00402     
00403     boolean reservedbit3: 1; /*room for growth*/
00404     
00405     boolean reservedbit4: 1; /*room for growth*/
00406     
00407     boolean reservedbit5: 1; /*room for growth*/
00408     
00409     boolean reservedbit6: 1; /*room for growth*/
00410     
00411     boolean reservedbit7: 1; /*room for growth*/
00412     
00413     boolean reservedbit8: 1; /*room for growth*/
00414     
00415     boolean runmodechanges: 1; /*set true when one of the objects changes, can be cleared by client after changes are saved or discarded*/
00416     
00417     boolean appbit1: 1; /*a bit that the application can use*/
00418     
00419     boolean appbit2: 1; /*a bit that the application can use*/
00420     
00421     boolean appbit3: 1; /*a bit that the application can use*/
00422     
00423     boolean appbit4: 1; /*a bit that the application can use*/
00424     
00425     boolean appbit5: 1; /*a bit that the application can use*/
00426     
00427     boolean appbit6: 1; /*a bit that the application can use*/
00428     
00429     hdlobject recalcobject; /*dmb 1.0b20 - the object that changed, triggering a card recalc*/
00430     
00431     char waste [4]; /*room for growth*/
00432     } tycard, **hdlcard;
00433     
00434 
00435 typedef struct tyioaconfigrecord {
00436     
00437     long objectTypeID; 
00438     
00439     char objectTypeName [32];
00440     
00441     char objectFlagName [32];
00442     
00443     boolean frameWhenEditing;
00444     
00445     boolean canEditValue;
00446     
00447     boolean toggleFlagWhenHit;
00448     
00449     boolean mutuallyExclusive;
00450     
00451     boolean speaksForGroup;
00452     
00453     boolean handlesMouseTrack;
00454     
00455     boolean editableInRunMode;
00456     
00457     boolean isFontAware;
00458     
00459     boolean alwaysIdle;
00460     
00461     boolean hasSpecialCard;
00462     
00463     boolean cantDrawInBitmap;
00464     
00465     tystackedobjectcallback initObjectCallback;
00466     
00467     tyobjectcallback disposeDataCallback;
00468     
00469     tyobjectcallback drawObjectCallback;
00470     
00471     tyobjectbooleancallback editObjectCallback;
00472     
00473     tyobjectcharcallback keystrokeObjectCallback;
00474     
00475     tyobjectcallback idleObjectCallback;
00476     
00477     tymouseclickcallback clickObjectCallback;
00478     
00479     tycleanobjectcallback cleanupObjectCallback;
00480     
00481     tyobjectbooleancallback recalcObjectCallback;
00482     
00483     tyobjectcallback canReplicateObjectCallback;
00484     
00485     tyobjectcallback catchReturnCallback;
00486     
00487     tyobjectrectcallback getObjectInvalRectCallback;
00488     
00489     tyobjectrectcallback getObjectEditRectCallback;
00490     
00491     tyobjectptrhandlecallback getValueForScriptCallback;
00492     
00493     tyobjecthandlecallback setValueFromScriptCallback;
00494     
00495     tyobjectpointcallback setObjectCursorCallback;
00496     
00497     tyobjectstringcallback debugObjectCallback;
00498     
00499     tyappleeventcallback getAttributesCallback;
00500     
00501     tyappleeventcallback setAttributesCallback;
00502     
00503     typackdatacallback packDataCallback;
00504     
00505     tyobjectcallback unpackDataCallback;
00506     } tyioaconfigrecord, *ptrioaconfigrecord, **hdlioaconfigrecord;
00507     
00508     
00509 void setupconfig (tyioaconfigrecord *); /*every IOA component must define this routine*/
00510 
00511 
00512 #define IOAgetconfigcommand 1
00513 #define IOAinitobjectcommand 2
00514 #define IOAdrawobjectcommand 3
00515 #define IOAeditobjectcommand 4
00516 #define IOAkeystrokecommand 5
00517 #define IOAidlecommand 6
00518 #define IOAclickcommand 7
00519 #define IOAcleanupcommand 8
00520 #define IOArecalccommand 9
00521 #define IOAcanreplicatcommand 10
00522 #define IOAcatchreturncommand 11
00523 #define IOAgetobjectinvalrectcommand 12
00524 #define IOAgetobjecteditrectcommand 13
00525 #define IOAgetvaluecommand 14
00526 #define IOAsetvaluecommand 15
00527 #define IOAsetcursorcommand 16
00528 #define IOAunpackdatacommand 17
00529 #define IOAdebugobjectcommand 18
00530 #define IOAgetattributescommand 19
00531 #define IOAsetattributescommand 20
00532 #define IOAgeticoncommand 21
00533 #define IOAgetcardcommand 22
00534 #define IOApackdatacommand 23
00535 #define IOAdisposedatacommand 24
00536 
00537     
00538     
00539 void IOAclearbytes (void *, long);
00540 
00541 short IOAmakemultiple (short, short);
00542 
00543 short IOAclosestmultiple (short, short);
00544 
00545 void IOAgetobjectsize (hdlobject, short *, short *);
00546 
00547 boolean IOAgetstringvalue (hdlobject, Handle *);
00548 
00549 boolean IOApushforecolor (RGBColor *);
00550 
00551 boolean IOApopforecolor (void);
00552 
00553 boolean IOApushbackcolor (RGBColor *); 
00554 
00555 boolean IOApopbackcolor (void);
00556 
00557 boolean IOAvisitobjects (hdlobject, tyobjectvisitroutine);
00558 
00559 boolean IOArunbuttonscript (hdlobject);
00560 
00561 void IOAcopystring (void *, void *);
00562 
00563 boolean IOAgetbooleanvalue (hdlobject, Handle *);
00564 
00565 boolean IOAsetbooleanvalue (hdlobject, Handle);
00566 
00567 void IOAeditdrawtexthandle (Handle, Rect, tyjustification);
00568 
00569 boolean IOArecalcobjectvalue (hdlobject);
00570 
00571 boolean IOAevalscript (hdlobject, Handle, Handle *, OSType, bigstring);
00572 
00573 boolean IOAsetobjectvalue (hdlobject, Handle);
00574 
00575 boolean IOAgetnthstring (hdlobject, short, bigstring);
00576 
00577 void IOAinvalobject (hdlobject);
00578 
00579 void IOAtexthandletostring (Handle, bigstring);
00580 
00581 boolean IOAnewtexthandle (bigstring, Handle *);
00582 
00583 void IOAcenterstring (Rect, bigstring);
00584 
00585 void IOAcenterrect (Rect *, Rect);
00586 
00587 boolean IOAclearactivetextobject (void);
00588 
00589 boolean IOAsetactivetextobject (hdlobject);
00590 
00591 Handle IOAgetactiveeditrecord (void);
00592 
00593 boolean IOAeditclick (Point, boolean, Handle);
00594 
00595 boolean IOAeditselectall (Handle);
00596 
00597 boolean IOAeditidle (Handle);
00598 
00599 boolean IOAeditkeystroke (char, Handle);
00600 
00601 void IOAellipsize (Str255, short);
00602 
00603 boolean IOAincolorwindow (hdlobject);
00604 
00605 boolean IOAopenresfile (void);
00606 
00607 void IOAcloseresfile (void);
00608 
00609 boolean IOApushstring (bigstring bssource, bigstring bsdest);
00610 
00611 boolean IOAregistercomponent (void);
00612 
00613 void IOAunregistercomponent (void);

Generated on Wed May 31 18:19:49 2006 for frontierkernel 10.1.10a by  doxygen 1.4.6