tabs.c

00001 /*
00002  * $Id: tabs.c 5167 2007-05-19 20:03:34Z ajc $
00003  */
00009 #include "webcit.h"
00010 
00016 void tabbed_dialog(int num_tabs, char *tabnames[]) {
00017         int i;
00018 
00019         wprintf("<script type=\"text/javascript\">                                              "
00020                 "var previously_selected_tab = '0';                                             "
00021                 "function tabsel(which_tab) {                                                   "
00022                 "       if (which_tab == previously_selected_tab) {                             "
00023                 "               return;                                                         "
00024                 "       }                                                                       "
00025                 "       $('tabtd'+previously_selected_tab).style.backgroundColor = '#cccccc';   "
00026                 "       $('tabdiv'+previously_selected_tab).style.display = 'none';             "
00027                 "       $('tabtd'+which_tab).style.backgroundColor = '#ffffff';                 "
00028                 "       $('tabdiv'+which_tab).style.display = 'block';                          "
00029                 "       previously_selected_tab = which_tab;                                    "
00030                 "}                                                                              "
00031                 "</script>                                                                      \n"
00032         );
00033 
00034         wprintf("<table id=\"TheTabs\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%%\">"
00035                 "<tr align=\"center\" style=\"cursor:pointer\"><td>&nbsp;</td>"
00036         );
00037 
00038         for (i=0; i<num_tabs; ++i) {
00039                 wprintf("<td id=\"tabtd%d\" bgcolor=\"#%s\" "
00040                         "onClick='tabsel(\"%d\");'"
00041                         ">"
00042                         "<span class=\"tablabel\">",
00043                         i,
00044                         ( (i==0) ? "ffffff" : "cccccc" ),
00045                         i,
00046                         i
00047                 );
00048                 wprintf("%s", tabnames[i]);
00049                 wprintf("</span></td>");
00050 
00051                 wprintf("<td>&nbsp;</td>\n");
00052         }
00053 
00054         wprintf("</tr></table>\n");
00055         wprintf("<table class=\"tabs_background\"><tr><td>");
00056 }
00057 
00063 void begin_tab(int tabnum, int num_tabs) {
00064         wprintf("<!-- begin tab %d of %d -->\n", tabnum, num_tabs);
00065         wprintf("<div id=\"tabdiv%d\" style=\"display:%s\">",
00066                 tabnum,
00067                 ( (tabnum == 0) ? "block" : "none" )
00068         );
00069 }
00070 
00076 void end_tab(int tabnum, int num_tabs) {
00077         wprintf("</div>\n");
00078         wprintf("<!-- end tab %d of %d -->\n", tabnum, num_tabs);
00079 
00080         if (tabnum == num_tabs-1) {
00081                 wprintf("</td></tr></table>\n");
00082                 wprintf("<script type=\"text/javascript\">"
00083                         " Nifty(\"table#TheTabs td\", \"small transparent top\");"
00084                         "</script>"
00085                 );
00086         }
00087 }
00088 
00089 

Generated on Wed Jun 20 23:13:10 2007 for webcit by  doxygen 1.5.2