applet.h

Go to the documentation of this file.
00001 
00002 /*  $Id: applet.h 355 2005-01-11 22:48:55Z andreradke $    */
00003 
00004 /* copyright 1991-96 UserLand Software, Inc. All Rights Reserved.*/
00005 
00006 
00007 #ifndef appletinclude
00008 #define appletinclude /*so other modules can tell if we've been included*/
00009 
00010 
00011 #ifndef appletdefsinclude
00012 
00013     #include "appletdefs.h"
00014     
00015 #endif
00016 
00017 
00018 #ifndef opsinclude
00019 
00020     #include "appletops.h"
00021     
00022 #endif
00023 
00024 
00025 #ifndef cursorinclude
00026 
00027     #include "appletcursor.h"
00028     
00029 #endif
00030 
00031 
00032 #ifndef mouseinclude
00033 
00034     #include "appletmouse.h"
00035     
00036 #endif
00037 
00038 
00039 #ifndef kbinclude
00040 
00041     #include "appletkb.h"
00042 
00043 #endif
00044 
00045 
00046 #ifndef memoryinclude
00047 
00048     #include "appletmemory.h"
00049 
00050 #endif
00051 
00052 
00053 #ifndef appletfilesinclude
00054 
00055     #include "appletfiles.h"
00056     
00057 #endif
00058 
00059 
00060 #ifndef quickdrawinclude
00061 
00062     #include "appletquickdraw.h"
00063 
00064 #endif
00065 
00066 
00067 #ifndef stringsinclude
00068 
00069     #include "appletstrings.h"
00070 
00071 #endif
00072 
00073 
00074 #ifndef fontinclude
00075 
00076     #include "appletfont.h"
00077 
00078 #endif
00079 
00080 
00081 #ifndef undoinclude
00082 
00083     #include "appletundo.h"
00084 
00085 #endif
00086 
00087 
00088 #ifndef frontierinclude
00089 
00090     #include "appletfrontier.h"
00091 
00092 #endif
00093 
00094 
00095 #ifndef paletteinclude
00096 
00097     #include "appletpalette.h"
00098 
00099 #endif
00100 
00101 
00102 #ifndef appletwiresinclude
00103 
00104     #include "appletwires.h"
00105     
00106 #endif
00107 
00108 
00109 #ifndef __IAC__
00110 
00111     #include <iac.h>
00112     
00113 #endif
00114 
00115 
00116 #ifndef appletcardinclude
00117 
00118     #include "appletcard.h"
00119 
00120 #endif
00121     
00122 
00123 
00124 
00125 
00126 
00127 extern EventRecord appletevent; /*the last event received by appletmain.c*/
00128 
00129 
00130 typedef struct tyselectioninfo {
00131     
00132     boolean fldirty; /*something changed, menus need updating*/
00133     
00134     boolean flcansetfont; /*can we set font in current context?*/
00135     
00136     boolean flcansetsize; /*can we set size?*/
00137     
00138     boolean flcansetstyle; /*can we set style?*/
00139     
00140     boolean flcansetjust; /*can we set justification?*/
00141     
00142     boolean flcansetleading; /*can we set leading?*/
00143     
00144     short fontnum;
00145     
00146     short fontsize;
00147     
00148     short leading;
00149     
00150     boolean flplain;
00151     
00152     boolean flshadow;
00153     
00154     boolean floutline;
00155     
00156     boolean flunderline;
00157     
00158     boolean flitalic;
00159     
00160     boolean flbold;
00161     
00162     boolean flsubscript;
00163     
00164     boolean flsuperscript;
00165     
00166     boolean flextended; 
00167     
00168     boolean flcondensed;
00169             
00170     tyjustification justification;
00171     
00172     short fontstyle; /*see setselectionstyleinfo*/
00173     } tyselectioninfo;
00174     
00175     
00176 typedef boolean (*tysystemidlecallback) (long);
00177 
00178 typedef boolean (*tyappcallback) (void);
00179 
00180 
00181 typedef struct tyappwindow {
00182     
00183     tyfilespec filespec; /*the file being edited in the window*/
00184     
00185     short fnum; /*the file remains open while editing, this is the system file number*/
00186     
00187     WindowPtr macwindow; /*the Macintosh window pointer for the window*/
00188         
00189     short defaultfont, defaultsize, defaultstyle;
00190     
00191     tyjustification defaultjustification;
00192     
00193     short fontheight;
00194     
00195     Handle appdata;
00196     
00197     Rect windowrect;
00198     
00199     Rect contentrect, oldcontentrect;
00200     
00201     Rect statusrect; /*the rectangle covering the status portion of window*/
00202     
00203     Rect updaterect; /*when an update event is in process, this is the dirty part of the window*/
00204     
00205     hdlscrollbar vertbar, horizbar; /*the window's scrollbars*/
00206     
00207     boolean flactive; /*if true it's the frontmost/active window*/
00208     
00209     boolean flmadechanges;
00210     
00211     boolean flresetscrollbars;
00212     
00213     boolean flcolorwindow;
00214     
00215     boolean flzoomed;
00216     
00217     boolean flprinting;
00218     
00219     boolean fliacdata; /*if true appdata came via iac, not a file*/
00220     
00221     OSType iacdataowner; /*if fliacdata, this was the sender of the packed data*/
00222     
00223     AEDesc iacdatarefcon; /*if fliacdata, this is the owner's reference info for the data*/
00224     
00225     short zoomheight, zoomwidth; /*set by getcontentsizecallback*/
00226     
00227     Point scrollorigin;
00228     
00229     tyselectioninfo selectioninfo;
00230     
00231     RGBColor forecolor, backcolor; 
00232     
00233     short originpushdepth; /*see apppushorigin*/
00234     
00235     hdlpaletterecord hpalette; /*info about the palette for this window, nil if it has no palette*/
00236 
00237     Handle undostack, redostack;
00238     
00239     short windowvertpixels, windowhorizpixels;
00240 
00241     Handle hmessage; /*the string that's displayed in the message area, nil if no message*/ 
00242     
00243     Rect messagerect; /*this is where we draw the window's message*/
00244 
00245     long filetype, creator; /*file type and creator for file saving*/
00246     
00247     tysystemidlecallback systemidlecallback; /*for interruptable idle-time processing, for clay basket*/
00248     
00249     long systemidlerefcon; /*passed to the callback routine*/
00250     
00251     long systemidleticks; /*how much of an idle wait to we need to see before calling the callback?*/
00252     
00253     long lastsystemidle; /*needed if the system is idle for more than systemidleticks ticks*/
00254     
00255     boolean systemidlecomplete; /*the idle handler sets this if he doesn't want to be called until after the user does something*/
00256     
00257     unsigned long idleatreset; /*number of idle ticks when the window was reset*/
00258     
00259     boolean notsaveable; /*some apps need to determine save-ability on a window level, not a global level*/
00260     
00261     short statuspixels; /*allow apps to have status bars for some windows and not for others*/
00262     
00263     tyappcallback msgclickcallback; /*handles clicks in the message part of the window*/
00264     
00265     short idmenu; /*this menu is inserted when the window is in front*/
00266     
00267     boolean flcloseonidle; /*if true, we close the window next time thru the main event loop*/
00268     
00269     boolean flzoombeforeopen; /*if true, we zoom-out the window before making it visible*/
00270     
00271     boolean touchparentsonsave; /*if true, we set the mod date of all containing folders when we save*/
00272     } tyappwindow, *ptrappwindow, **hdlappwindow;
00273 
00274 
00275 #define app1class 'app1'
00276 
00277 typedef boolean (*tyapphandleptrcallback) (Handle *);
00278 
00279 typedef boolean (*tyapphandlecallback) (Handle);
00280 
00281 typedef void (*tyapprectcallback) (Rect);
00282 
00283 typedef boolean (*tyappbooleancallback) (boolean);
00284 
00285 typedef boolean (*tyappshortcallback) (short);
00286 
00287 typedef boolean (*tyappsscrollcallback) (tydirection, boolean, short);
00288 
00289 typedef boolean (*tymenucallback) (short, short);
00290 
00291 typedef boolean (*tystringcallback) (bigstring);
00292 
00293 typedef boolean (*tyfilespeccallback) (ptrfilespec);
00294 
00295 typedef boolean (*tyappgetundoglobalscallback) (long *);
00296 
00297 typedef boolean (*tyappsetundoglobalscallback) (long, boolean);
00298 
00299 
00300 
00301 
00302 typedef struct typrintinfo {
00303     
00304     Rect paperrect;
00305     
00306     short vpagepixels; /*number of pixels on a page, vertically*/
00307     
00308     short ctpages; /*the number of pages in the document being printed*/
00309     
00310     Handle printhandle; /*a handle to the machine's print record*/
00311     } typrintinfo;
00312 
00313 
00314 typedef struct tyappletrecord {
00315     
00316     hdlappwindow appwindow; /*the frontmost applet window, callbacks work on this*/
00317 
00318     Handle appdata; /*a handle allocated by the applet to hold its data*/
00319     
00320     long filetype, creator; /*file type and creator for file saving*/
00321     
00322     sfcallback filefiltercallback; /*determines if files are displayed in stanard file dialog*/
00323     
00324     typrintinfo printinfo; /*for coordinating printing between applet and the shell*/
00325     
00326     short defaultfont, defaultsize, defaultstyle;
00327     
00328     boolean resizeable; /*if true the app's windows can be resized*/
00329     
00330     boolean eraseonresize; /*if true, the toolkit erases the window when it's resized*/
00331     
00332     boolean horizscroll; /*if true, the applet implements horiz scrolling*/
00333     
00334     boolean vertscroll; /*if true, the applet implements vert scrolling*/
00335     
00336     boolean haswindowmenu; /*if true, the applet wants a Window menu*/
00337     
00338     boolean haspalette; /*if true, the applet has an icon palette*/
00339     
00340     short ctpaletteicons; /*the number of icons in the palette*/
00341     
00342     short minwindowwidth, minwindowheight; /*constraints when resizing a window*/
00343     
00344     boolean notsaveable; /*if true, the applet doesn't implement saving/opening files*/
00345     
00346     short statuspixels; /*height of status bar at top of window*/
00347     
00348     boolean usecolor; /*if true, we allocate a color window on color machines*/
00349     
00350     boolean exactcolors; /*if true, we use the palette manager to be sure you get exact colors*/
00351     
00352     boolean appmanagesfontmenus; /*if true, the toolkit doesn't insert font/size/style sub-menus*/
00353     
00354     boolean insyseventhandler; /*true if the applet code is running in a call to a system event handler*/
00355     
00356     boolean dontpostcallback; /*see apppostcallback, DW 3/2/93*/
00357     
00358     boolean hasmessagearea; /*if true, we allocate 1/3 of the horiz scroll bar for a string msg*/
00359     
00360     boolean usetempmemory; /*if true, appletmemory uses temp memory instead of the application heap*/
00361     
00362     long systemidleticks; /*the number of ticks until system idle routine is called, 0, disables feature*/
00363     
00364     boolean openingfile; /*so newrecord routine can tell that a file is being opened -- hack!*/
00365     
00366     boolean commanderror; /*a serious error raised by the app, the toolkit stops what it's doing now*/
00367     
00368     tyappcallback newrecordcallback; /*allocate and initialize a new data handle*/
00369     
00370     tyappcallback disposerecordcallback; /*dealloc a data handle*/
00371     
00372     tyappcallback idlecallback; /*set mouse cursor, other "idle" stuff*/
00373     
00374     tyappbooleancallback activatecallback; /*activate or deactivate the window data*/
00375     
00376     tyappbooleancallback switchcallback; /*the app is being switched in or out*/
00377     
00378     tyappcallback updatecallback; /*update the display of the window data*/
00379     
00380     tyappcallback preupdatecallback; /*inval anything that needs inval'ing before an update*/
00381     
00382     tyappcallback windowresizecallback; /*recalc display data, adjust to new window size*/
00383     
00384     tyappcallback iacmessagecallback; /*process an IAC message*/
00385     
00386     tyappcallback iacfastmessagecallback; /*process a system event handler message*/
00387     
00388     tyapphandleptrcallback packcallback; /*pack memory structure into a disk handle*/
00389     
00390     tyapphandlecallback unpackcallback; /*unpack disk handle into memory structure*/
00391     
00392     tyapphandleptrcallback gettextcallback; /*return a handle of unformatted ASCII text*/
00393     
00394     tyapphandleptrcallback getpictcallback; /*return a Macintosh PicHandle of selected items*/
00395     
00396     tyappsscrollcallback scrollcallback;
00397     
00398     tyappcallback scrolltocallback;
00399     
00400     tyappcallback resetscrollcallback;
00401     
00402     tyappcallback pagesetupcallback;
00403     
00404     tyappcallback openprintcallback;
00405     
00406     tyappshortcallback printpagecallback;
00407     
00408     tyappcallback closeprintcallback;
00409     
00410     tyapphandlecallback puttextcallback;
00411     
00412     tyapphandlecallback putpictcallback;
00413     
00414     tyappcallback haveselectioncallback;
00415     
00416     tyappcallback selectallcallback;
00417     
00418     tyappcallback keystrokecallback;
00419     
00420     tyappcallback mousecallback;
00421     
00422     tyappcallback mouseinstatuscallback;
00423     
00424     tyappcallback updatestatuscallback;
00425     
00426     tymenucallback menucallback;
00427     
00428     tyappcallback insertmenucallback;
00429     
00430     tyappcallback setselectioninfocallback;
00431     
00432     tyappcallback setfontcallback;
00433     
00434     tyappcallback setsizecallback;
00435     
00436     tyappcallback setstylecallback;
00437     
00438     tyappcallback setjustifycallback;
00439     
00440     tyapphandleptrcallback copycallback; 
00441     
00442     tyappcallback clearcallback;
00443     
00444     tyapphandlecallback pastecallback;
00445     
00446     tyappcallback initmacintoshcallback;
00447     
00448     tyappbooleancallback resumecallback; /*suspend or resume the window*/
00449     
00450     tyapprectcallback eraserectcallback; /*color apps may want to override the default routine*/
00451     
00452     tyappcallback getcontentsizecallback; /*for apps that want to be smart about zooming*/
00453     
00454     tyappcallback openappcallback; /*for apps that want to open untitled window if no docs launched*/
00455     
00456     tyfilespeccallback opendoccallback; /*allow app to override 'odoc' Apple Event*/
00457     
00458     tyappcallback setglobalscallback; /*app can copy from app.appdata to its own globals*/
00459     
00460     tyapphandleptrcallback getoptionscallback;
00461     
00462     tyapphandlecallback putoptionscallback;
00463     
00464     tyappgetundoglobalscallback getundoglobalscallback;
00465     
00466     tyappsetundoglobalscallback setundoglobalscallback;
00467     
00468     tyappcallback afteropenwindowcallback;
00469     
00470     tyappcallback beforeclosewindowcallback;
00471     
00472     tyappcallback aftersavewindowcallback;
00473     
00474     tyappcallback beforequitcallback;
00475     
00476     tystringcallback alertcallback; 
00477     
00478     tyappshortcallback diskinsertedcallback;
00479     
00480     tyfilespeccallback interpretfilecallback;
00481     } tyappletrecord, *ptrappletrecord, **hdlappletrecord;
00482     
00483     
00484 extern tyappletrecord app; /*global applet record, short name for easy access*/
00485 
00486 
00487 
00488 #ifndef scrollbarinclude
00489 
00490     #include "appletscrollbar.h"
00491 
00492 #endif
00493 
00494 
00495 
00496 void appgetdesktoprect (hdlappwindow, Rect *);
00497 
00498 boolean apppushwindow (hdlappwindow);
00499 
00500 boolean apppopwindow (void);
00501 
00502 boolean apppushorigin (void);
00503 
00504 boolean apppoporigin (void);
00505 
00506 boolean appopenbitmap (Rect, hdlappwindow);
00507 
00508 boolean appclosebitmap (hdlappwindow);
00509 
00510 boolean apppushclip (Rect r);
00511 
00512 boolean apppopclip (void);
00513 
00514 void appprecallback (void);
00515 
00516 void apppostcallback (void);
00517 
00518 boolean newappwindow (bigstring, boolean);
00519 
00520 void invalappwindow (hdlappwindow, boolean);
00521 
00522 void updateappwindow (hdlappwindow);
00523 
00524 void moveappwindow (hdlappwindow, Rect);
00525 
00526 boolean findbywindowtitle (bigstring, hdlappwindow *);
00527 
00528 boolean findnthwindow (short, hdlappwindow *);
00529 
00530 short countwindows (void);
00531 
00532 boolean appletinitmanagers (void);
00533 
00534 void runapplet (void);
00535 
00536 boolean exitmainloop (void);
00537 
00538 boolean closefrontwindow (void);
00539 
00540 boolean initprint (void);
00541 
00542 boolean pagesetup (void);
00543 
00544 boolean printappwindow (hdlappwindow, boolean);
00545 
00546 boolean getprintinfo (void);
00547 
00548 pascal Boolean appscriptcomplete (void); /*call this when a script completes*/
00549 
00550 boolean visitappwindows (boolean  (*) ());
00551 
00552 boolean invalallwindows (void);
00553 
00554 boolean eraseallwindows (void);
00555 
00556 void setappwindow (hdlappwindow);
00557 
00558 void apperaserect (Rect);
00559 
00560 boolean apprectneedsupdate (Rect);
00561 
00562 void appinvalstatusseparator (void);
00563 
00564 void drawappgrowicon (hdlappwindow);
00565 
00566 void setappwindowmadechanges (hdlappwindow);
00567 
00568 #endif

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