appletscrollbar.c

Go to the documentation of this file.
00001 
00002 /*  $Id: appletscrollbar.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 "appletops.h"
00009 #include "appletquickdraw.h"
00010 #include "appletmain.h"
00011 #include "appletmsg.h"
00012 #include "appletscrollbar.h"
00013 
00014 
00015 
00016 #define idvertbar 256
00017 #define idhorizbar 257
00018 
00019 
00020 /*
00021 7/25/94 dmb: updated for Univeral Headers, PowerPC
00022 */
00023 
00024 
00025 static boolean scrollbarpushclip (hdlscrollbar hscrollbar) {
00026     
00027     /*
00028     11/19/90 DW: patch things up for the table displayer, and perhaps others in
00029     the future.  if the scrollbar is of trivial height, we disable the drawing
00030     that's about to happen.  we were getting one-pixel high scrollbars being
00031     drawn.
00032     */
00033     
00034     Rect r = (**hscrollbar).contrlRect;
00035     
00036     if ((r.bottom - r.top) == 1)
00037         r.bottom = r.top;
00038         
00039     return (pushclip (r));
00040     } /*scrollbarpushclip*/
00041     
00042     
00043 void validscrollbar (hdlscrollbar hscrollbar) {
00044 
00045     hdlscrollbar h = hscrollbar;
00046     
00047     if (h != nil) 
00048         validrect ((**h).contrlRect);
00049     } /*validscrollbar*/
00050     
00051     
00052 void invalscrollbar (hdlscrollbar hscrollbar) {
00053 
00054     hdlscrollbar h = hscrollbar;
00055     
00056     if (h != nil) 
00057         invalrect ((**h).contrlRect);
00058     } /*invalscrollbar*/
00059     
00060     
00061 boolean pointinscrollbar (Point pt, hdlscrollbar hscrollbar) {
00062 
00063     hdlscrollbar h = hscrollbar;
00064     
00065     if (h == nil) /*defensive driving*/
00066         return (false);
00067         
00068     return (pointinrect (pt, (**h).contrlRect));
00069     } /*pointinscrollbar*/
00070     
00071     
00072 void disablescrollbar (hdlscrollbar hscrollbar) {
00073     
00074     hdlscrollbar h = hscrollbar;
00075     
00076     if (h == nil) /*defensive driving*/
00077         return;
00078         
00079     scrollbarpushclip (h);
00080         
00081     HiliteControl (h, -1);
00082     
00083     /*validscrollbar (h);*/
00084     
00085     popclip ();
00086     } /*disablescrollbar*/
00087     
00088     
00089 void enablescrollbar (hdlscrollbar hscrollbar) {
00090     
00091     hdlscrollbar h = hscrollbar;
00092     
00093     if (h == nil) /*defensive driving*/
00094         return;
00095         
00096     if (!(**h).contrlRfCon) { /*the window containing the scrollbar is inactive*/
00097         
00098         disablescrollbar (h);
00099         
00100         return;
00101         }
00102         
00103     scrollbarpushclip (h);
00104         
00105     HiliteControl (h, 0);
00106     
00107     /*validscrollbar (h);*/
00108     
00109     popclip ();
00110     } /*enablescrollbar*/
00111     
00112     
00113 boolean scrollbarenabled (hdlscrollbar hscrollbar) {
00114     
00115     return ((**hscrollbar).contrlHilite != 255);
00116     } /*scrollbarenabled*/
00117     
00118     
00119 void activatescrollbar (hdlscrollbar hscrollbar, boolean flactivate) {
00120     
00121     /*
00122     8/25/92 DW: use the contrlRfCon field to indicate whether the 
00123     scrollbar is active or not. this flag is respected by subsequent calls
00124     to enablescrollbar.
00125     */
00126     
00127     hdlscrollbar h = hscrollbar;
00128     
00129     (**h).contrlRfCon = flactivate;
00130     
00131     if (flactivate)
00132         enablescrollbar (h);
00133     else
00134         disablescrollbar (h);
00135     } /*activatescrollbar*/
00136     
00137     
00138 void getscrollbarinfo (hscrollbar, minscroll, maxscroll, current) hdlscrollbar hscrollbar; short *minscroll, *maxscroll, *current; {
00139     
00140     hdlscrollbar h = hscrollbar;
00141     
00142     if (h == nil) { /*defensive driving*/
00143     
00144         *minscroll = *maxscroll = *current = 0;
00145         
00146         return;
00147         }
00148     
00149     *minscroll = GetCtlMin (h);
00150         
00151     *maxscroll = GetCtlMax (h);
00152         
00153     *current = GetCtlValue (h);
00154     } /*getscrollbarinfo*/
00155     
00156     
00157 short getscrollbarcurrent (hdlscrollbar hscrollbar) {
00158     
00159     short minscroll, maxscroll, current;
00160     
00161     getscrollbarinfo (hscrollbar, &minscroll, &maxscroll, &current);
00162     
00163     return (current);
00164     } /*getscrollbarcurrent*/
00165     
00166     
00167 void showscrollbar (hdlscrollbar hscrollbar) {
00168     
00169     hdlscrollbar h = hscrollbar;
00170     
00171     if (h == nil) /*defensive driving*/
00172         return;
00173         
00174     scrollbarpushclip (h);
00175         
00176     ShowControl (h); /*no effect if scrollbar is already visible, according to IM-1*/
00177     
00178     popclip ();
00179     
00180     /*don't validate the scrollbar rect, ShowControl might not draw it...*/
00181     } /*showscrollbar*/
00182     
00183     
00184 void hidescrollbar (hdlscrollbar hscrollbar) {
00185     
00186     hdlscrollbar h = hscrollbar;
00187     
00188     if (h == nil) /*defensive driving*/
00189         return;
00190         
00191     scrollbarpushclip (h);
00192         
00193     HideControl (h);
00194     
00195     popclip ();
00196     
00197     invalrect ((**h).contrlRect);
00198     } /*hidescrollbar*/
00199     
00200 
00201 void drawscrollbar (hdlscrollbar hscrollbar) {
00202     
00203     hdlscrollbar h = hscrollbar;
00204     
00205     if (h == nil) /*defensive driving*/
00206         return;
00207         
00208     scrollbarpushclip (h);
00209     
00210     Draw1Control (h);
00211     
00212     popclip ();
00213     
00214     validscrollbar (h);
00215     } /*drawscrollbar*/
00216     
00217     
00218 void displayscrollbar (hdlscrollbar hscrollbar) {
00219     
00220     /*
00221     the caller is saying that we should enable it if there is enough 
00222     material to enable scrolling.
00223     */
00224     
00225     hdlscrollbar h = hscrollbar;
00226     short minscroll, maxscroll, current;
00227     
00228     if (h == nil) /*defensive driving*/
00229         return;
00230         
00231     getscrollbarinfo (h, &minscroll, &maxscroll, &current);
00232     
00233     if (minscroll <= maxscroll) /*there's something to scroll to*/
00234         enablescrollbar (h);
00235     else
00236         disablescrollbar (h);
00237         
00238     drawscrollbar (h);
00239     } /*displayscrollbar*/
00240     
00241     
00242 void setscrollbarinfo (hdlscrollbar hscrollbar, short minscroll, short maxscroll, short current) {
00243     
00244     /*
00245     set the bounds of the scrollbar, and its current value.
00246     
00247     if the current info agrees with the parameters we do nothing, 
00248     avoiding unpleasant flicker.
00249     
00250     disables drawing while setting the values, and draws it when 
00251     all three values have been set.  avoids inconsistent displays.
00252     */
00253     
00254     hdlscrollbar h = hscrollbar;
00255     short curmin, curmax, curval;
00256     
00257     if (h == nil) /*defensive driving*/
00258         return;
00259         
00260     if (maxscroll < minscroll) /*DW 10/3/94*/
00261         maxscroll = minscroll;
00262     
00263     getscrollbarinfo (h, &curmin, &curmax, &curval);
00264     
00265     if ((minscroll == curmin) && (maxscroll == curmax) && (current == curval))
00266         return; /*nothing to do*/
00267     
00268     pushemptyclip (); /*disable drawing*/
00269     
00270     SetCtlMax (h, maxscroll);
00271     
00272     SetCtlMin (h, minscroll);
00273     
00274     SetCtlValue (h, current);
00275     
00276     popclip ();
00277     
00278     displayscrollbar (h);
00279     } /*setscrollbarinfo*/
00280     
00281     
00282 void setscrollbarminmax (hdlscrollbar hscrollbar, short minscroll, short maxscroll) {
00283     
00284     hdlscrollbar h = hscrollbar;
00285     short curmin, curmax, curval;
00286     
00287     if (h == nil) /*defensive driving*/
00288         return;
00289     
00290     getscrollbarinfo (h, &curmin, &curmax, &curval);
00291     
00292     if ((minscroll != curmin) || (maxscroll != curmax)) {
00293     
00294         setscrollbarinfo (h, minscroll, maxscroll, curval);
00295         }
00296     } /*setscrollbarminmax*/
00297     
00298     
00299 void setscrollbarcurrent (hdlscrollbar hscrollbar, short current) {
00300 
00301     hdlscrollbar h = hscrollbar;
00302     
00303     if (h == nil) /*defensive driving*/
00304         return;
00305     
00306     scrollbarpushclip (h);
00307     
00308     SetCtlValue (h, current);
00309     
00310     popclip ();
00311     } /*setscrollbarcurrent*/
00312 
00313 
00314 short getscrollbarwidth (void) {
00315     
00316     return (16); /*standard Macintosh scrollbars*/
00317     } /*getscrollbarwidth*/
00318 
00319 
00320 boolean newscrollbar (WindowPtr w, boolean flvert, hdlscrollbar *hscrollbar) {
00321     
00322     /*
00323     create a new scroll bar linked into the control list of the indicated
00324     window.  
00325     
00326     we need to know if it is a vertical or horizontal scrollbar so we can
00327     choose the proper resource template.  we use a CDEF that has different
00328     specs for horiz and vertical scrollbars.
00329     */
00330     
00331     hdlscrollbar h;
00332     short resnum;
00333     
00334     if (flvert)
00335         resnum = idvertbar;
00336     else
00337         resnum = idhorizbar;
00338     
00339     *hscrollbar = h = GetNewControl (resnum, w);
00340     
00341     return (h != nil);
00342     } /*newscrollbar*/
00343     
00344     
00345 void disposescrollbar (hdlscrollbar hscrollbar) {
00346     
00347     hdlscrollbar h = hscrollbar;
00348     
00349     if (h != nil)
00350         DisposeControl (h);
00351     } /*disposescrollbar*/
00352     
00353     
00354 void getscrollbarrect (hdlscrollbar hscrollbar, Rect *r) {
00355 
00356     hdlscrollbar h = hscrollbar;
00357     
00358     if (h != nil) 
00359         *r = (**h).contrlRect;
00360     else
00361         zerorect (r);
00362     } /*getscrollbarrect*/
00363     
00364     
00365 void setscrollbarrect (hdlscrollbar hscrollbar, Rect r) {
00366 
00367     hdlscrollbar h = hscrollbar;
00368     
00369     if (h != nil) {
00370         
00371         HideControl (h);
00372         
00373         SizeControl (h, r.right - r.left, r.bottom - r.top);
00374         
00375         MoveControl (h, r.left, r.top);
00376         }
00377     } /*setscrollbarrect*/
00378     
00379     
00380 void scrollbarflushright (Rect r, hdlscrollbar hscrollbar) {
00381     
00382     hdlscrollbar h = hscrollbar;
00383     short width;
00384     
00385     if (h == nil) /*defensive driving*/
00386         return;
00387         
00388     width = getscrollbarwidth ();
00389     
00390     HideControl (h); /*also invals the rectangle that the scrollbar currently occupies*/
00391     
00392     SizeControl (h, width, r.bottom - r.top + 2);
00393     
00394     MoveControl (h, r.right - width + 1, r.top - 1);
00395     } /*scrollbarflushright*/
00396     
00397     
00398 void scrollbarflushbottom (Rect r, hdlscrollbar hscrollbar) {
00399     
00400     hdlscrollbar h = hscrollbar;
00401     short width;
00402     
00403     if (h == nil) /*defensive driving*/
00404         return;
00405         
00406     width = getscrollbarwidth ();
00407         
00408     HideControl (h);
00409     
00410     SizeControl (hscrollbar, r.right - r.left, width);
00411         
00412     MoveControl (hscrollbar, r.left, r.bottom - width + 1);
00413     } /*scrollbarflushbottom*/
00414     
00415     
00416 boolean findscrollbar (Point pt, WindowPtr w, hdlscrollbar *hscrollbar, short *scrollbarpart) {
00417     
00418     *scrollbarpart = FindControl (pt, w, hscrollbar);
00419     
00420     return (*hscrollbar != nil);
00421     } /*findscrollbar*/
00422     
00423     
00424 boolean scrollbarhit (hdlscrollbar hscrollbar, short part, boolean *flup, boolean *flpage) {
00425     
00426     /*
00427     can be called by a routine that tracks a mouse hit in a scroll bar.
00428     
00429     return true if it represents a valid scroll action, according to the info
00430     stored in the scrollbar handle.
00431     
00432     return false if the indicated action would move beyond the min or max for
00433     the scrollbar.
00434     
00435     set flup and flpage according to the indicated scrollbar part.
00436     */
00437     
00438     hdlscrollbar h = hscrollbar;
00439     short minscroll, maxscroll, current;
00440     
00441     if (h == nil) /*defensive driving*/
00442         return (false);
00443         
00444     getscrollbarinfo (h, &minscroll, &maxscroll, &current);
00445     
00446     switch (part) {
00447     
00448         case inUpButton:
00449             *flup = false; /*scroll text down*/
00450             
00451             *flpage = false;
00452             
00453             return (current > minscroll);
00454             
00455         case inDownButton:
00456             *flup = true; /*scroll text up*/
00457             
00458             *flpage = false;
00459             
00460             return (current < maxscroll);
00461             
00462         case inPageUp:
00463             *flup = false; /*scroll text down*/
00464             
00465             *flpage = true; 
00466             
00467             return (current > minscroll);
00468             
00469         case inPageDown:
00470             *flup = true; /*scroll text up*/
00471             
00472             *flpage = true;
00473             
00474             return (current < maxscroll);
00475         } /*switch*/
00476         
00477     return (false); /*fell through the switch statement*/
00478     } /*scrollbarhit*/
00479     
00480 
00481 void resizeappscrollbars (appwindow) hdlappwindow appwindow; {
00482     
00483     /*
00484     DW 6/27/93: allow for message area, takes space from the 
00485     horiz scrollbar.
00486     
00487     DW 10/27/93: inval the message area for window resizing.
00488     */
00489     
00490     hdlappwindow ha = appwindow;
00491     
00492     if (app.hasmessagearea) {
00493         
00494         invalrect ((**ha).messagerect);
00495             
00496         appsetmessagerect (ha);
00497         }
00498     
00499     if (app.horizscroll || app.vertscroll) {
00500         
00501         short scrollbarwidth;
00502         Rect rwholewindow = (**ha).windowrect;
00503         Rect r;
00504         
00505         scrollbarwidth = getscrollbarwidth ();
00506     
00507         if (app.vertscroll) {
00508     
00509             r = rwholewindow; 
00510         
00511             r.bottom -= scrollbarwidth - 1;
00512             
00513             r.top += (**ha).statuspixels; /*leave room for status bar at top of window*/
00514             
00515             r.top = (**ha).contentrect.top;
00516         
00517             scrollbarflushright (r, (**ha).vertbar);
00518             }
00519         
00520         if (app.horizscroll) {
00521         
00522             r = rwholewindow; 
00523         
00524             r.right -= scrollbarwidth - 2;
00525             
00526             if (app.hasmessagearea)
00527                 r.left = (**ha).messagerect.right - 1;
00528             else
00529                 r.left -= 1; 
00530             
00531             scrollbarflushbottom (r, (**ha).horizbar);
00532             }
00533         }
00534     } /*resizeappscrollbars*/
00535     
00536     
00537 void showappscrollbars (appwindow) hdlappwindow appwindow; {
00538     
00539     hdlappwindow ha = appwindow;
00540     
00541     if (app.vertscroll)
00542         showscrollbar ((**ha).vertbar);
00543     
00544     if (app.horizscroll)
00545         showscrollbar ((**ha).horizbar);
00546     } /*showappscrollbars*/
00547     
00548     
00549 void updateappscrollbars (appwindow) hdlappwindow appwindow; {
00550     
00551     hdlappwindow ha = appwindow;
00552         
00553     if (app.vertscroll) {
00554         
00555         showscrollbar ((**ha).vertbar);
00556         
00557         drawscrollbar ((**ha).vertbar);
00558         }
00559         
00560     if (app.horizscroll) {
00561         
00562         showscrollbar ((**ha).horizbar);
00563         
00564         drawscrollbar ((**ha).horizbar);
00565         }
00566     } /*updateappscrollbars*/
00567     
00568     
00569 void activateappscrollbars (hdlappwindow appwindow, boolean flactivate) {
00570     
00571     hdlappwindow ha = appwindow;
00572     
00573     if (app.vertscroll)     
00574         activatescrollbar ((**ha).vertbar, flactivate);
00575         
00576     if (app.horizscroll)    
00577         activatescrollbar ((**ha).horizbar, flactivate);
00578     } /*activateappscrollbars*/
00579     
00580     
00581 tydirection scrolldirection (boolean flvert, boolean flup) {
00582 
00583     tydirection dir;
00584     
00585     if (flvert) {
00586         if (flup)
00587             dir = up;
00588         else
00589             dir = down;
00590         }
00591     else {
00592         if (flup)
00593             dir = left;
00594         else
00595             dir = right; 
00596         }
00597         
00598     return (dir);
00599     } /*scrolldirection*/ 
00600 
00601 
00602 static pascal void apphorizscroll (hdlscrollbar ctrl, short part) {
00603     
00604     tydirection dir;
00605     boolean flleft, flpage;
00606     
00607     if (!scrollbarhit (ctrl, part, &flleft, &flpage))
00608         return;
00609         
00610     dir = scrolldirection (false, flleft);
00611         
00612     scrollappwindow (dir, flpage, 1);
00613     } /*apphorizscroll*/
00614 
00615 
00616 static pascal void appvertscroll (hdlscrollbar sb, short part) {
00617     
00618     tydirection dir;
00619     boolean flup, flpage;
00620     
00621     if (!scrollbarhit (sb, part, &flup, &flpage))
00622         return;
00623     
00624     dir = scrolldirection (true, flup);
00625         
00626     scrollappwindow (dir, flpage, 1);
00627     } /*appvertscroll*/
00628 
00629 #if USESROUTINEDESCRIPTORS
00630 
00631     static RoutineDescriptor apphorizscrollDesc = BUILD_ROUTINE_DESCRIPTOR (uppControlActionProcInfo, apphorizscroll);
00632     static RoutineDescriptor appvertscrollDesc = BUILD_ROUTINE_DESCRIPTOR (uppControlActionProcInfo, appvertscroll);
00633     
00634     #define apphorizscrollUPP &apphorizscrollDesc
00635     #define appvertscrollUPP &appvertscrollDesc
00636     
00637 #else
00638 
00639     #define apphorizscrollUPP &apphorizscroll
00640     #define appvertscrollUPP &appvertscroll
00641 
00642 #endif
00643 
00644 void handlescrollbar (boolean flvert, hdlscrollbar sb, short part, Point pt) {
00645     
00646     short oldscrollbarcurrent;
00647     
00648     if (part == inThumb) {
00649         
00650         oldscrollbarcurrent = getscrollbarcurrent (sb);
00651         
00652         scrollbarpushclip (sb);
00653         
00654         TrackControl (sb, pt, nil);
00655             
00656         popclip ();
00657         
00658         scrolltoappwindow ();
00659         
00660         /*
00661         ctscroll = getscrollbarcurrent (sb) - oldscrollbarcurrent;
00662         
00663         dir = scrolldirection (flvert, ctscroll > 0);
00664         
00665         (*app.scrollcallback) (dir, false, abs (ctscroll));
00666         */
00667         }
00668     else {
00669         scrollbarpushclip (sb);
00670         
00671         if (flvert)
00672             TrackControl (sb, pt,appvertscrollUPP);
00673         else
00674             TrackControl (sb, pt, apphorizscrollUPP);
00675         
00676         invalscrollbar (sb); /*DW 8/19/94*/
00677         
00678         popclip ();
00679         }
00680     } /*handlescrollbar*/
00681     
00682     
00683 boolean appdefaultresetscroll (void) {
00684         
00685     hdlappwindow ha = app.appwindow;
00686     Rect rcontent;
00687     short vertmin, vertmax, vertcurrent;    
00688     short horizmin, horizmax, horizcurrent;
00689     
00690     appprecallback ();
00691         
00692     (*app.getcontentsizecallback) ();
00693     
00694     apppostcallback ();
00695     
00696     getscrollbarinfo ((**ha).vertbar, &vertmin, &vertmax, &vertcurrent);
00697     
00698     getscrollbarinfo ((**ha).horizbar, &horizmin, &horizmax, &horizcurrent);
00699     
00700     rcontent = (**ha).contentrect;
00701     
00702     /*reset the vertical scrollbar*/ {
00703         
00704         short needpixels = (**ha).zoomheight;
00705         short havepixels = rcontent.bottom - rcontent.top;
00706         hdlscrollbar bar = (**ha).vertbar;
00707         
00708         if (havepixels >= needpixels) {
00709             
00710             disablescrollbar (bar);
00711             
00712             /*setscrollbarinfo (bar, 0, 0, 0);*/
00713             }
00714         else {
00715             short x = 0;
00716             
00717             enablescrollbar (bar);
00718             
00719             vertmin = 0;
00720             
00721             vertmax = needpixels - havepixels;
00722             }
00723         }
00724         
00725     /*reset the horiz scrollbar*/ {
00726         
00727         short needpixels = (**ha).zoomwidth;
00728         short havepixels = rcontent.right - rcontent.left;
00729         hdlscrollbar bar = (**ha).horizbar;
00730         
00731         if (havepixels >= needpixels) {
00732             
00733             disablescrollbar (bar);
00734             
00735             /*setscrollbarinfo (bar, 0, 0, 0);*/
00736             }
00737         else {
00738             short x = 0;
00739             
00740             enablescrollbar (bar);
00741             
00742             horizmin = 0;
00743             
00744             horizmax = needpixels - havepixels;
00745             }
00746         }
00747     
00748     setscrollbarinfo ((**ha).vertbar, vertmin, vertmax, vertcurrent);
00749     
00750     setscrollbarinfo ((**ha).horizbar, horizmin, horizmax, horizcurrent);
00751     
00752     return (true);
00753     } /*appdefaultresetscroll*/
00754     
00755 
00756 boolean appdefaultscroll (tydirection dir, boolean flpage, short ctscroll) {
00757     
00758     /*
00759     if the applet didn't define a scrolling routine, this routine will
00760     be called to do the scrolling. it implements a very bare-bones way
00761     of scrolling, that often is just what you want... in order for this
00762     to work, the app must define a scrollto callback routine.
00763     */
00764     
00765     hdlappwindow ha = app.appwindow;
00766     short ct = ctscroll;
00767     short dh = 0, dv = 0;
00768     Rect r;
00769     
00770     if ((ct == 1) && (!flpage)) { /*it's heuristic time!*/
00771         
00772         if (!optionkeydown ()) {
00773             
00774             ct = getfontheight (); /*scroll by this (reasonable) amount*/
00775             
00776             /*user holds down the option key to get a 2-pixel scroll*/
00777             }
00778         }
00779     
00780     if (ct % 2) /*it's an odd number*/
00781         ct++;
00782     
00783     r = (**ha).contentrect;
00784     
00785     switch (dir) {
00786         
00787         case down:
00788             if (flpage)
00789                 dv = -(r.bottom - r.top);
00790             else
00791                 dv = -ct;
00792             
00793             break;
00794             
00795         case up:
00796             if (flpage)
00797                 dv = r.bottom - r.top;
00798             else
00799                 dv = ct;
00800             
00801             break;
00802         
00803         case right:
00804             if (flpage)
00805                 dh = -(r.right - r.left);
00806             else
00807                 dh = -ct;
00808                 
00809             break;
00810             
00811         case left:
00812             if (flpage)
00813                 dh = r.right - r.left;
00814             else
00815                 dh = ct;
00816                 
00817             break;
00818             
00819         default:
00820             return (false);
00821         } /*switch*/
00822     
00823     if ((dv != 0) && scrollbarenabled ((**ha).vertbar)) {
00824         
00825         short x;
00826         short vertmin, vertmax, vertcurrent;
00827         
00828         getscrollbarinfo ((**ha).vertbar, &vertmin, &vertmax, &vertcurrent);
00829         
00830         x = vertcurrent + dv;
00831     
00832         x = max (x, vertmin);
00833     
00834         x = min (x, vertmax);
00835         
00836         dv = vertcurrent - x;
00837         
00838         vertcurrent = x;
00839         
00840         scrollbarpushclip ((**ha).vertbar);
00841         
00842         SetCtlValue ((**ha).vertbar, vertcurrent);
00843         
00844         Draw1Control ((**ha).vertbar);
00845         
00846         popclip ();
00847         
00848         /*setscrollbarinfo ((**ha).vertbar, vertmin, vertmax, vertcurrent);*/
00849         }
00850     
00851     if ((dh != 0) && scrollbarenabled ((**ha).horizbar)) {
00852         
00853         short x;
00854         short horizmin, horizmax, horizcurrent;
00855         
00856         getscrollbarinfo ((**ha).horizbar, &horizmin, &horizmax, &horizcurrent);
00857         
00858         x = horizcurrent + dh;
00859     
00860         x = max (x, horizmin);
00861     
00862         x = min (x, horizmax);
00863         
00864         dh = horizcurrent - x;
00865         
00866         horizcurrent = x;
00867         
00868         scrollbarpushclip ((**ha).horizbar);
00869         
00870         SetCtlValue ((**ha).horizbar, horizcurrent);
00871         
00872         Draw1Control ((**ha).horizbar);
00873         
00874         popclip ();
00875         
00876         /*setscrollbarinfo ((**ha).horizbar, horizmin, horizmax, horizcurrent);*/
00877         }
00878     
00879     if ((dh != 0) || (dv != 0)) {
00880         
00881         scrolltoappwindow ();
00882         
00883         /*
00884         scrollrect (r, dh, dv);
00885     
00886         updateappwindow (ha);
00887         */
00888         }
00889         
00890     return (true);
00891     } /*appdefaultscroll*/
00892     
00893     
00894 boolean scrollappwindow (tydirection dir, boolean flpage, short ctscroll) {
00895     
00896     boolean fl;
00897     
00898     appprecallback ();
00899         
00900     fl = (*app.scrollcallback) (dir, flpage, 1);
00901     
00902     apppostcallback ();
00903     
00904     return (fl);
00905     } /*scrollappwindow*/
00906     
00907 
00908 boolean scrolltoappwindow (void) {
00909 
00910     boolean fl;
00911     
00912     appprecallback ();
00913     
00914     fl = (*app.scrolltocallback) ();
00915     
00916     apppostcallback ();
00917     
00918     return (fl);
00919     } /*scrolltoappwindow*/
00920     
00921         
00922 void resetappscrollbars (hdlappwindow appwindow) {
00923     
00924     hdlappwindow savedwindow = app.appwindow;
00925     
00926     setappwindow (appwindow);
00927     
00928     appprecallback ();
00929     
00930     (*app.resetscrollcallback) ();
00931     
00932     apppostcallback ();
00933     
00934     setappwindow (savedwindow);
00935     } /*resetappscrollbars*/
00936     
00937     
00938 void installscroll (void) {
00939     
00940     if ((app.horizscroll) || (app.vertscroll)) {
00941     
00942         if (app.scrollcallback == nil)
00943             app.scrollcallback = &appdefaultscroll;
00944             
00945         if (app.resetscrollcallback == nil)
00946             app.resetscrollcallback = &appdefaultresetscroll;
00947         }
00948     } /*installscroll*/
00949     
00950     

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