I did not know about that:-)
How does that behave? My guess would be: If the link is relative, it can
load it the FL_Help_View again, if it is absolute (including local
files), it should open it using fl_open_uri(). This would also reduce
security risks. I suppose opening non-html files with default
application is OK, assuming Fl_Help_View is never used with untrusted
(eg. downloaded) html pages - also due to its limited capabilities.
It might also be worth to add to the Fl_Help_View class a method like
Fl_Help_View::link_callback(Fl_Callback * c);
This callback would be called whenever a link is clicked. It would pass
itself as a widget and href string as data, leaving up to the programmer
how to handle it. The default callback would load it back to the same
Fl_Help_View widget if the link is relative, otherwise it would call
fl_open_uri(). This would add flexibility - opening in new
Fl_Help_Dialog window if a help-page link is middle-button clicked;
calling program function/subroutine if clicked on special link; ....
For instance links like
<a href="call:salary Joe">Show salary for Joe</a>
<a href="call:quit">Quit program</a>
could be handled by callback
void my_link_callback(Fl_Widget * w, void * d){
const char * link = (const char * )d;
if(!srtncmp(link, "call:salary ", 12))
fl_message("The salary of %s is %g", link+12, get_salary(link+12))
else if(!srtcmp(link, "call:quit"))
quit();
else
Fl_Help_View::default_link_callback(w, d);
}
In such a case a custom html page (which can be a document generated by
the program itself) can also be used as a direct interface to some
program functionality.
R.
Greg Ercolano wrote:
>
> Yes, and I believe in 1.3.x, the Fl_Help_Viewer now
> will use that when people click on <A HREF="http://xxx">
> links in html files. Or at least I remember making a patch
> for that and I *think* I submitted it and it was accepted.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk