menuresize.c

Go to the documentation of this file.
00001 
00002 /*  $Id: menuresize.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 "frontier.h"
00029 #include "standard.h"
00030 
00031 #include "quickdraw.h"
00032 #include "popup.h"
00033 #include "windowlayout.h"
00034 #include "scrollbar.h"
00035 #include "dialogs.h"
00036 #include "shell.h"
00037 #include "shellbuttons.h"
00038 #include "op.h"
00039 #include "opinternal.h"
00040 #include "menueditor.h"
00041 #include "menuinternal.h"
00042 
00043 
00044 
00045 #define itemmargin 8
00046 
00047 // 5.0a25 dmb: wire off Zoom button
00048 #undef iconrectheight
00049 #undef iconrectwidth
00050 #define iconrectheight 0
00051 #define iconrectwidth 0
00052 
00053 
00054 
00055 static void mesetalloutlinerects (Rect r) {
00056 
00057     oppushoutline ((**menudata).menuoutline);
00058     
00059     insetrect (&r, 1, 1);
00060     
00061     opresize (r);
00062     
00063     #ifdef WIN95VERSION
00064         opupdatenow ();
00065     #endif
00066 
00067     oppopoutline ();
00068     } /*mesetalloutlinerects*/
00069 
00070 
00071 boolean meresetwindowrects (hdlwindowinfo hw) {
00072     
00073     register hdlmenurecord hm = (hdlmenurecord) (**hw).hdata;
00074     short scrollbarwidth;
00075     short msgheight;
00076     Rect rcontent;
00077     Rect menurect;
00078     Rect r;
00079     
00080     if (outlinedata == nil)
00081         return (false);
00082     
00083     /*set up some values for all rect computations*/ {
00084     
00085         scrollbarwidth = getscrollbarwidth ();
00086         
00087         msgheight = popupheight; 
00088         }
00089     
00090     /*get contentrect and do info.growiconrect*/ {
00091         
00092         rcontent = (**hw).contentrect;
00093         
00094         shellcalcgrowiconrect (rcontent, hw);
00095         }
00096     
00097     /*inset contentrect uniformly*/ {
00098         
00099         insetrect (&rcontent, windowmargin, windowmargin);
00100         }
00101     
00102     /*do iconrect*/ {
00103     
00104         r = rcontent;
00105         
00106         r.bottom = r.top + iconrectheight;
00107         
00108         r.left = r.right - iconrectwidth;
00109         
00110     //  insetrect (&r, -4, 0); /*a little extra width for title*/
00111         
00112         if (hm != nil)
00113             (**hm).iconrect = r; 
00114         }
00115         
00116     /*do menurect*/ {
00117         
00118         menurect = rcontent;
00119 
00120         menurect.right -= iconrectwidth + windowmargin + scrollbarwidth;
00121 
00122         menurect.bottom -= msgheight + windowmargin;
00123 
00124         if (hm != nil)
00125             (**hm).menuoutlinerect = menurect;
00126         }
00127     
00128     /*do cmdkeypopuprect*/ {
00129         
00130         r = rcontent;
00131         
00132         r.top = r.bottom - msgheight;
00133 
00134         r.right = r.left + cmdkeypopupwidth;
00135         
00136         if (hm != nil)
00137             (**hm).cmdkeypopuprect = r; 
00138         }
00139     
00140     /*do messagerect*/ {
00141         
00142         r.left = r.right + popupbetweenwidth;
00143         
00144         r.right = menurect.right + scrollbarwidth;
00145         
00146         (**hw).messagerect = r; 
00147         }
00148         
00149     /*do vertscrollbar*/ {
00150         
00151         r = menurect; /*the space occupied by the grid of cells*/
00152         
00153         r.left = r.right; /*scrollbar is just to right of grid*/
00154         
00155         r.right = r.left + scrollbarwidth;
00156         
00157         setscrollbarrect ((**hw).vertscrollbar, r);
00158         
00159         //showscrollbar ((**hw).vertscrollbar);
00160         }
00161     
00162     return (true);
00163     } /*meresetwindowrects*/
00164 
00165 
00166 void meresize (void) {
00167     
00168     Rect outlinerect;
00169     
00170     megetoutlinerect (&outlinerect); /*flow through code that adjusts the rect*/
00171     
00172     insetrect (&outlinerect, 1, 1);
00173     
00174     mesetalloutlinerects (outlinerect);
00175     } /*meresize*/
00176 
00177 

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