appletmsg.c

Go to the documentation of this file.
00001 
00002 /*  $Id: appletmsg.c 355 2005-01-11 22:48:55Z andreradke $    */
00003 
00004 /* copyright 1991-96 UserLand Software, Inc. All Rights Reserved.*/
00005 
00006 
00007 #include "appletinternal.h"
00008 #include "appletmsg.h"
00009 
00010 
00011 #define messagefont geneva
00012 #define messagesize 9
00013 #define messagestyle 0
00014 
00015 
00016 
00017 void appsetmessagerect (hdlappwindow appwindow) {
00018     
00019     Rect r;
00020         
00021     if (app.hasmessagearea) {
00022     
00023         Rect rwindow = (*(**appwindow).macwindow).portRect;
00024         
00025         r.bottom = rwindow.bottom;
00026         
00027         r.left = rwindow.left;
00028         
00029         r.top = r.bottom - getscrollbarwidth () + 1;
00030         
00031         r.right = r.left + ((rwindow.right - rwindow.left) / 2);
00032         }
00033     else
00034         zerorect (&r);
00035     
00036     (**appwindow).messagerect = r;
00037     } /*appsetmessagerect*/
00038     
00039 
00040 void appdrawmessage (hdlappwindow appwindow) {
00041     
00042     if (app.hasmessagearea) {
00043         
00044         hdlappwindow ha = appwindow;
00045         WindowPtr w = (**ha).macwindow;
00046         Rect r = (**ha).messagerect;
00047         Rect rerase, rtext;
00048         bigstring bs;
00049         boolean flbitmap = false;
00050         
00051         pushmacport (w);
00052         
00053         /*flbitmap = openbitmap (r, w);*/
00054         
00055         pushclip (r);
00056         
00057         rerase = r; rerase.top++; rerase.right--; eraserect (rerase);
00058         
00059         pushforecolor (&blackcolor);
00060         
00061         MoveTo (r.left, r.top); LineTo (r.right, r.top);
00062         
00063         popforecolor ();
00064         
00065         texthandletostring ((**ha).hmessage, bs);
00066     
00067         pushstyle (messagefont, messagesize, messagestyle);
00068         
00069         rtext = r;
00070         
00071         InsetRect (&rtext, 1, 1);
00072     
00073         centerstring (rtext, bs);
00074     
00075         popstyle ();
00076         
00077         popclip ();
00078         
00079         if (flbitmap)
00080             closebitmap (w);
00081         
00082         popmacport ();
00083         }
00084     } /*appdrawmessage*/
00085     
00086     
00087 void appsetmessage (hdlappwindow appwindow, bigstring bs) {
00088     
00089     hdlappwindow ha = appwindow;
00090     
00091     if (ha == nil)
00092         return;
00093         
00094     if (app.hasmessagearea) {
00095         
00096         Handle htext;
00097         
00098         /*8/29/94 DW: don't do anything if the message hasn't changed*/ {
00099             
00100             bigstring bscurrentmessage;
00101             
00102             texthandletostring ((**ha).hmessage, bscurrentmessage);
00103             
00104             if (equalstrings (bscurrentmessage, bs)) /*nothing to do*/
00105                 return;
00106             }
00107     
00108         disposehandle ((**ha).hmessage);
00109         
00110         if (stringlength (bs) == 0)
00111             htext = nil;
00112         else
00113             newtexthandle (bs, &htext);
00114     
00115         (**ha).hmessage = htext;
00116     
00117         appdrawmessage (ha);
00118         }
00119     } /*appsetmessage*/
00120     
00121     
00122 void appmessageclick (hdlappwindow appwindow) {
00123     
00124     if ((**appwindow).msgclickcallback != nil)
00125         (*(**appwindow).msgclickcallback) ();
00126     } /*appmessageclick*/
00127     
00128     
00129     
00130     

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