tablelayout.c

Go to the documentation of this file.
00001 
00002 /*  $Id: tablelayout.c 355 2005-01-11 22:48:55Z andreradke $    */
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 #include <standard.h>
00029 #include "memory.h"
00030 #include "quickdraw.h"
00031 #include "scrollbar.h"
00032 #include "tableinternal.h"
00033 #include "windowlayout.h"
00034 
00035 
00036 
00037 #define tabletopmargin 3
00038 
00039 
00040 boolean tablesetextrainfo (hdlwindowinfo hw, hdltableformats hformats) {
00041     
00042     tyextrainfo info;
00043     register short scrollbarwidth;
00044     register hdlextrainfo hinfo;
00045     Rect rcontent;
00046     Rect r;
00047     short msgheight;
00048     Rect gridrect;
00049     
00050     rcontent = (**hw).contentrect;
00051     
00052     hinfo = (hdlextrainfo) (**hformats).hextrainfo;
00053     
00054     if (hinfo == nil) 
00055         clearbytes (&info, longsizeof (info));
00056     else
00057         moveleft (*hinfo, &info, longsizeof (info));
00058     
00059     /*set up some values for all rect computations*/ {
00060     
00061         scrollbarwidth = getscrollbarwidth ();
00062         
00063         /*
00064         pushstyle (msgfont, msgsize, msgstyle);
00065     
00066         msgheight = globalfontinfo.ascent + globalfontinfo.descent;
00067         
00068         msgheight += 2; /%leave a little space above and below text%/
00069         
00070         msgheight += msgheight / 2; /%approx 1.5 times the height%/
00071         
00072         popstyle ();
00073         */
00074         
00075         msgheight = popupheight; 
00076         }
00077     
00078     /*do info.growiconrect*/ {
00079         
00080         shellcalcgrowiconrect (rcontent, hw);
00081         }
00082     
00083     /*do info.tablerect, reset fields of hformats*/ {
00084         
00085         r = rcontent;
00086         
00087         r.top += tabletopmargin; /*three pixels between titles and top of window*/
00088     
00089         r.bottom -= msgheight + windowmargin;
00090         
00091         r.left += windowmargin;
00092     
00093         r.right -= windowmargin + iconrectwidth + windowmargin + scrollbarwidth;
00094         
00095         tablepushformats (hformats); 
00096         
00097         tableresetrects (r); 
00098         
00099         tablepopformats ();
00100         
00101         info.tablerect = r;
00102         
00103         gridrect = (**hformats).tablerect; /*for sizing other objects*/
00104         }
00105         
00106     /*do info.kindpopuprect*/ {
00107         
00108         r.left = gridrect.left + 3; /*flush with left edge of icons*/
00109         
00110         r.right = r.left + popupwidth;
00111         
00112         r.top = gridrect.bottom + ((rcontent.bottom - gridrect.bottom - msgheight) / 2);
00113         
00114         r.bottom = r.top + msgheight;
00115         
00116         info.kindpopuprect = r; 
00117         }
00118         
00119     /*do info.sortpopuprect*/ {
00120         
00121         r = info.kindpopuprect;
00122         
00123         r.left = r.right + popupbetweenwidth;
00124         
00125         r.right = r.left + popupwidth;
00126         
00127         info.sortpopuprect = r;
00128         }
00129         
00130     /*do (**hw).messagerect*/ {
00131         
00132         r = info.sortpopuprect; /*inherits top and bottom*/
00133         
00134         r.left = r.right + popupbetweenwidth;
00135         
00136         r.right = gridrect.right + scrollbarwidth;
00137         
00138         (**hw).messagerect = r; 
00139         }
00140         
00141     /*do info.iconrect*/ {
00142     
00143         r.top = gridrect.top;
00144         
00145         r.bottom = r.top + iconrectheight;
00146         
00147         r.right = rcontent.right - windowmargin;
00148         
00149         r.left = r.right - iconrectwidth;
00150         
00151         insetrect (&r, -4, 0); /*a little extra width for title*/
00152         
00153         info.iconrect = r; 
00154         }
00155         
00156     /*do info.vertscrollbar*/ {
00157         
00158         r = gridrect; /*the space occupied by the grid of cells*/
00159         
00160         r.left = r.right; /*scrollbar is just to right of grid*/
00161         
00162         r.right = r.left + scrollbarwidth;
00163         
00164         r.bottom = r.top + (**hformats).nonblankvertpixels;
00165         
00166         setscrollbarrect ((**hw).vertscrollbar, r);
00167         
00168         //showscrollbar ((**hw).vertscrollbar);
00169         }
00170     
00171     if (hinfo == nil) { /*allocate a new handle*/
00172         
00173         hdlextrainfo hnewinfo;
00174         
00175         if (!newfilledhandle (&info, longsizeof (info), (Handle *) &hnewinfo))
00176             return (false);
00177             
00178         (**hformats).hextrainfo = (Handle) hnewinfo;
00179         
00180         return (true);
00181         }
00182     
00183     /*copy into the existing handle*/
00184     
00185     lockhandle ((Handle) hinfo);
00186     
00187     moveleft (&info, *hinfo, longsizeof (info));
00188     
00189     unlockhandle ((Handle) hinfo);  
00190     
00191     return (true);
00192     } /*tablesetextrainfo*/
00193     
00194     
00195 boolean tablegetextrainfo (hdltableformats hformats, tyextrainfo *info) {
00196     
00197     register hdlextrainfo h;
00198     
00199     h = (hdlextrainfo) (**hformats).hextrainfo;
00200     
00201     moveleft (*h, info, longsizeof (tyextrainfo));
00202     
00203     return (true);
00204     } /*tablegetextrainfo*/
00205 
00206 
00207 boolean tablegetcontentsize (long *width, long *height) {
00208     
00209     register short pixels;
00210     
00211     tablegettablesize (width, height);
00212     
00213     pixels = tabletopmargin + windowmargin + popupheight + 4;
00214     
00215     *height += pixels;
00216     
00217     pixels = windowmargin + windowmargin + iconrectwidth + windowmargin + getscrollbarwidth ();
00218     
00219     *width += pixels;
00220     
00221     return (true);
00222     } /*tablegetcontentsize*/
00223 
00224 
00225 
00226 

Generated on Wed May 31 18:20:02 2006 for frontierkernel 10.1.10a by  doxygen 1.4.6