/[xforms]/xforms/demos/wwwl.c
ViewVC logotype

Diff of /xforms/demos/wwwl.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by leeming, Thu Apr 24 09:35:33 2003 UTC revision 1.6 by leeming, Tue Sep 9 00:28:25 2003 UTC
# Line 20  Line 20 
20   */   */
21    
22    
23  /* Demo showing object gravity, form minsize etc. (also double click).  /* Demo showing object gravity, form minsize etc. (also double click).
24   *   *
25   * With some more work, this could be made into a useful program ...   * With some more work, this could be made into a useful program ...
26   *   *
# Line 66  static WWW www_sites[] = Line 66  static WWW www_sites[] =
66  {  {
67      {      {
68        "XForms App.",        "XForms App.",
69        {        {
70            {            {
71                "@b@C4XForms Home Page",                "@b@C4XForms Home Page",
72                "http://world.std.com/~xforms"                "http://world.std.com/~xforms"
# Line 154  static WWW www_sites[] = Line 154  static WWW www_sites[] =
154      {      {
155          "All FAQs",          "All FAQs",
156          {          {
157              {              {
158                  "Usenet FAQs",                  "Usenet FAQs",
159                  "http://www.cis.ohio-state.edu/hypertext/faq/usenet"                  "http://www.cis.ohio-state.edu/hypertext/faq/usenet"
160              },              },
# Line 186  static WWW www_sites[] = Line 186  static WWW www_sites[] =
186                  "Houston Rockets",                  "Houston Rockets",
187                  "http://hyrax.med.uth.tmc.edu/misc/rockets.html"                  "http://hyrax.med.uth.tmc.edu/misc/rockets.html"
188              },              },
189              {              {
190                  NULL,                  NULL,
191                  NULL                  NULL
192              }              }
# Line 251  FD_www *ui; Line 251  FD_www *ui;
251  static int show_sites;  static int show_sites;
252    
253  /* initialize and show how many categories we have got */  /* initialize and show how many categories we have got */
254  void  void
255  init_cat(void)  init_cat(void)
256  {  {
257      WWW *www = www_sites;      WWW *www = www_sites;
# Line 261  init_cat(void) Line 261  init_cat(void)
261  }  }
262    
263  /* initialize file menu */  /* initialize file menu */
264  void  void
265  init_file_menu(void)  init_file_menu(void)
266  {  {
267      fl_fit_object_label(ui->file,1,0);      fl_fit_object_label(ui->file,1,0);
# Line 269  init_file_menu(void) Line 269  init_file_menu(void)
269  }  }
270    
271  /* initialize sites given category cat */  /* initialize sites given category cat */
272  void  void
273  init_sites(int cat)  init_sites(int cat)
274  {  {
275      WWW *www = www_sites + cat - 1;      WWW *www = www_sites + cat - 1;
# Line 287  init_sites(int cat) Line 287  init_sites(int cat)
287  }  }
288    
289  /* new catogrey is selected */  /* new catogrey is selected */
290  void  void
291  change_cat(FL_OBJECT * ob, long data)  change_cat(FL_OBJECT * ob, long data)
292  {  {
293      init_sites(fl_get_choice(ob));      init_sites(fl_get_choice(ob));
# Line 299  void init_shown(void) Line 299  void init_shown(void)
299      fl_addto_choice(ui->shown, "Subject|Sites");      fl_addto_choice(ui->shown, "Subject|Sites");
300  }  }
301    
302  /* request a change of what is shown, site name or subject */  /* request a change of what is shown, site name or subject */
303  void  void
304  change_shown(FL_OBJECT * ob, long data)  change_shown(FL_OBJECT * ob, long data)
305  {  {
306      int oldshow = show_sites;      int oldshow = show_sites;
# Line 308  change_shown(FL_OBJECT * ob, long data) Line 308  change_shown(FL_OBJECT * ob, long data)
308          init_sites(fl_get_choice(ui->cat));          init_sites(fl_get_choice(ui->cat));
309  }  }
310    
311  /* file menu is selected. Currently we do nothing except exit */  /* file menu is selected. Currently we do nothing except exit */
312  void  void
313  do_file_menu(FL_OBJECT * ob, long data)  do_file_menu(FL_OBJECT * ob, long data)
314  {  {
315        if(fl_get_menu(ob)== 3)        if(fl_get_menu(ob)== 3)
# Line 329  get_site(int cat, int thesite) Line 329  get_site(int cat, int thesite)
329  }  }
330    
331  /* either double-clicked or connect button is pressed */  /* either double-clicked or connect button is pressed */
332  void  void
333  connect_cb(FL_OBJECT * ob, long data)  connect_cb(FL_OBJECT * ob, long data)
334  {  {
335      char cmdbuf[1024];      char cmdbuf[1024];
# Line 339  connect_cb(FL_OBJECT * ob, long data) Line 339  connect_cb(FL_OBJECT * ob, long data)
339      {      {
340          fl_set_cursor(ui->www->window, XC_watch);          fl_set_cursor(ui->www->window, XC_watch);
341          XFlush(fl_get_display());          XFlush(fl_get_display());
342          fl_snprintf(cmdbuf,          fl_snprintf(cmdbuf,
343                   sizeof( cmdbuf),                   sizeof( cmdbuf),
344                   "%s %s",                   "%s %s",
345                   WWW_BROWSER,                   WWW_BROWSER,
346                   get_site(fl_get_choice(ui->cat), i));                   get_site(fl_get_choice(ui->cat), i));
# Line 350  connect_cb(FL_OBJECT * ob, long data) Line 350  connect_cb(FL_OBJECT * ob, long data)
350      }      }
351  }  }
352    
353  void  void
354  change_sites(FL_OBJECT * ob, long data)  change_sites(FL_OBJECT * ob, long data)
355  {  {
356     /* no-op */     /* no-op */
357  }  }
358    
359  int  int
360  main(int argc, char *argv[])  main(int argc, char *argv[])
361  {  {
362    
# Line 374  main(int argc, char *argv[]) Line 374  main(int argc, char *argv[])
374    
375      fl_set_browser_dblclick_callback(ui->listbr, connect_cb, 0);      fl_set_browser_dblclick_callback(ui->listbr, connect_cb, 0);
376    
377      fl_show_form(ui->www, FL_PLACE_CENTER|FL_FREE_SIZE,      fl_show_form(ui->www, FL_PLACE_CENTER|FL_FREE_SIZE,
378                            FL_FULLBORDER, "www launcher");                            FL_FULLBORDER, "www launcher");
379      fl_do_forms();      fl_do_forms();
380      fl_end_all_command();      fl_end_all_command();

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26