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 |
* |
* |
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" |
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 |
}, |
}, |
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 |
} |
} |
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; |
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); |
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; |
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)); |
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; |
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) |
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]; |
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)); |
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 |
|
|
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(); |