opbuttons.c

Go to the documentation of this file.
00001 
00002 /*  $Id: opbuttons.c 1204 2006-04-05 23:07:18Z karstenw $    */
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 /*Synthetic buttons for outline windows.*/
00029 
00030 #include "frontier.h"
00031 #include "standard.h"
00032 
00033 #include "shell.h"
00034 #include "lang.h"
00035 #include "oplist.h"
00036 #include "strings.h"
00037 #include "langxml.h"
00038 #include "processinternal.h"
00039 #include "ops.h"
00040 #include "opbuttons.h"
00041 
00042 
00043 void opbuttonsattach (hdlwindowinfo hinfo, hdlhashtable htable) {
00044 
00045     /*
00046     7.1b18 PBS: attach buttons to this outline.
00047     */
00048 
00049     hdlhashnode hn;
00050     short ct = 0;
00051     hdllistrecord hlist;
00052 
00053     (**hinfo).flhidebuttons = false;
00054 
00055     (**hinfo).flsyntheticbuttons = true;
00056 
00057     opnewlist (&hlist, false);
00058     
00059     (**hinfo).buttonlist = (Handle) hlist;
00060     
00061     /*loop through all of the items in the table*/
00062     
00063     for (hn = (**htable).hfirstsort; hn != nil; hn = (**hn).sortedlink) {
00064 
00065         bigstring bsname;
00066 
00067         ct++;
00068 
00069         if (ct > 16) /*16 is max number of buttons*/
00070             break;
00071 
00072         gethashkey (hn, bsname);
00073         
00074         xmlgetname (bsname);
00075 
00076         oppushstring ((hdllistrecord) (**hinfo).buttonlist, nil, bsname);
00077         } /*for*/
00078 
00079     (**hinfo).buttonscripttable = (Handle) htable;
00080     } /*opbuttonsattach*/
00081 
00082 
00083 boolean opbuttonstatus (short buttonnum, tybuttonstatus *status) {
00084 #pragma unused (buttonnum)
00085 
00086     /*
00087     7.1b18 PBS: buttons are always displayed and enabled.
00088     */
00089     
00090     if (outlinedata == NULL)
00091         return (false);
00092 
00093     (*status).flenabled = true;
00094     
00095     (*status).fldisplay = true;
00096     
00097     (*status).flbold = false; /*our buttons are never bold*/
00098     
00099     return (true);
00100     } /*opbuttonstatus*/
00101 
00102 
00103 boolean opbutton (short buttonnum) {
00104     
00105     /*
00106     7.1b18 PBS: Handle a click in an outline button. Run
00107     the associated script.
00108     */
00109     
00110     hdlhashtable ht = (hdlhashtable) (**shellwindowinfo).buttonscripttable;
00111     hdlhashnode hn;
00112     hdltreenode hcode;
00113     tyvaluerecord v;
00114     short ct = 0;
00115 
00116     /*Find the item in the table and call the script.*/
00117     
00118     for (hn = (**ht).hfirstsort; hn != nil; hn = (**hn).sortedlink) {
00119 
00120         ct++;
00121 
00122         if (ct > 16) /*16 is max number of buttons*/
00123             break;
00124 
00125         if (ct == buttonnum) {
00126         
00127             langcompilescript (hn, &hcode);
00128 
00129             langexternalvaltocode ((**hn).val, &hcode);
00130 
00131             langruncode (hcode, nil, &v);
00132 
00133             disposevaluerecord (v, false);
00134 
00135             break;
00136             } /*if*/        
00137         } /*for*/
00138 
00139     return (true);
00140     } /*scriptbutton*/

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