2001-08-02 23:43:49 +04:00
|
|
|
//
|
2001-09-29 18:38:59 +04:00
|
|
|
// Fl_Help_Dialog test program.
|
2001-08-02 23:43:49 +04:00
|
|
|
//
|
2010-11-29 00:06:39 +03:00
|
|
|
// Copyright 1999-2010 by Easy Software Products.
|
2017-02-08 05:06:52 +03:00
|
|
|
// Copyright 2011-2017 by Bill Spitzak and others.
|
2001-08-02 23:43:49 +04:00
|
|
|
//
|
2011-07-19 08:49:30 +04:00
|
|
|
// This library is free software. Distribution and use rights are outlined in
|
|
|
|
// the file "COPYING" which should have been included with this file. If this
|
|
|
|
// file is missing or damaged, see the license at:
|
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
// https://www.fltk.org/COPYING.php
|
2001-08-02 23:43:49 +04:00
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
// Please see the following page on how to report bugs and issues:
|
2005-04-16 04:13:17 +04:00
|
|
|
//
|
2020-07-01 19:03:10 +03:00
|
|
|
// https://www.fltk.org/bugs.php
|
2001-08-02 23:43:49 +04:00
|
|
|
//
|
|
|
|
// Contents:
|
|
|
|
//
|
|
|
|
// main() - Display the help GUI...
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
// Include necessary headers...
|
|
|
|
//
|
|
|
|
|
2001-09-29 18:38:59 +04:00
|
|
|
#include <FL/Fl_Help_Dialog.H>
|
2023-01-21 19:27:58 +03:00
|
|
|
#include <FL/Fl_GIF_Image.H>
|
2020-07-01 19:03:10 +03:00
|
|
|
#include <FL/filename.H> /* FL_PATH_MAX */
|
2023-01-21 19:27:58 +03:00
|
|
|
#include <FL/Fl.H> /* Fl::first_window(), etc */
|
2020-07-01 19:03:10 +03:00
|
|
|
#include <string.h> /* strcpy(), etc */
|
2011-01-04 03:53:13 +03:00
|
|
|
|
2023-01-21 19:27:58 +03:00
|
|
|
static void cb_refresh(void *d) {
|
|
|
|
// trigger a redraw of the window to see animated GIF's
|
|
|
|
if (Fl::first_window())
|
|
|
|
Fl::first_window()->redraw();
|
|
|
|
Fl::repeat_timeout(1./10, cb_refresh, d);
|
|
|
|
}
|
|
|
|
|
2001-08-02 23:43:49 +04:00
|
|
|
//
|
|
|
|
// 'main()' - Display the help GUI...
|
|
|
|
//
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
int // O - Exit status
|
|
|
|
main(int argc, // I - Number of command-line arguments
|
|
|
|
char *argv[]) // I - Command-line arguments
|
2001-08-02 23:43:49 +04:00
|
|
|
{
|
2023-01-21 19:27:58 +03:00
|
|
|
Fl_GIF_Image::animate = true; // create animated shared .GIF images
|
2016-05-15 16:52:17 +03:00
|
|
|
Fl_Help_Dialog *help = new Fl_Help_Dialog;
|
2020-08-21 19:54:40 +03:00
|
|
|
int i;
|
|
|
|
if (!Fl::args(argc, argv, i)) Fl::fatal(Fl::help);
|
|
|
|
const char *fname = (i < argc) ? argv[i] : "help_dialog.html";
|
2017-11-19 04:18:16 +03:00
|
|
|
|
2020-08-21 19:54:40 +03:00
|
|
|
help->load(fname); // TODO: add error check (when load() returns int instead of void)
|
2017-11-19 04:18:16 +03:00
|
|
|
|
2004-07-27 00:52:52 +04:00
|
|
|
help->show(1, argv);
|
2001-08-02 23:43:49 +04:00
|
|
|
|
2023-01-21 19:27:58 +03:00
|
|
|
Fl::add_timeout(1./10, cb_refresh, help); // to animate GIF's
|
2001-08-02 23:43:49 +04:00
|
|
|
Fl::run();
|
|
|
|
|
|
|
|
delete help;
|
|
|
|
|
2016-05-15 16:52:17 +03:00
|
|
|
return 0;
|
2001-08-02 23:43:49 +04:00
|
|
|
}
|