| 1 | /* Copyright (c) 2006 by Arkkra Enterprises */ |
| 2 | /* All rights reserved */ |
| 3 | |
| 4 | #ifndef _HELP_H_ |
| 5 | #define _HELP_H_ |
| 6 | |
| 7 | // Classes for Help menu item off of main toolbar |
| 8 | |
| 9 | #include <FL/Fl_Double_Window.H> |
| 10 | #include <FL/Fl_Multiline_Output.H> |
| 11 | #include <FL/Fl_Help_View.H> |
| 12 | #include <FL/Fl_Return_Button.H> |
| 13 | #include <FL/Fl_Text_Display.H> |
| 14 | #include <FL/filename.H> |
| 15 | #include "Config.H" |
| 16 | |
| 17 | |
| 18 | // Class for window to let user browse the HTML version of Mup User's Guide |
| 19 | |
| 20 | class Uguide_browser : Fl_Double_Window { |
| 21 | |
| 22 | friend class Help; |
| 23 | |
| 24 | public: |
| 25 | Uguide_browser(void); |
| 26 | ~Uguide_browser(void); |
| 27 | |
| 28 | // User can change font/size preference. This callback notifies |
| 29 | // of such changes, so we can adjust the output accordingly |
| 30 | static void font_change_cb(void * data, Fl_Font font, unsigned char size); |
| 31 | |
| 32 | // Load the User's Guide top level index.html file |
| 33 | void load_uguide(void); |
| 34 | |
| 35 | private: |
| 36 | void font_change(Fl_Font font, unsigned char size); |
| 37 | |
| 38 | // On Windows, Fl_Help_View doesn't seem to properly follow relative |
| 39 | // URLs, so we use the link() callback to prepend the proper directory. |
| 40 | static const char * resolve_link(Fl_Widget *, const char * uri); |
| 41 | |
| 42 | Fl_Help_View *browser_p; |
| 43 | Font_change_registration * font_change_reg_p; |
| 44 | bool loaded; |
| 45 | }; |
| 46 | |
| 47 | |
| 48 | // Class to give first time user some hints. |
| 49 | |
| 50 | class StartupHints : Fl_Double_Window { |
| 51 | |
| 52 | friend class Help; |
| 53 | |
| 54 | public: |
| 55 | StartupHints(void); |
| 56 | ~StartupHints(void); |
| 57 | |
| 58 | static void OK_cb(Fl_Widget *, void * data); |
| 59 | // User can change font/size preference. This callback notifies |
| 60 | // of such changes, so we can adjust the output accordingly |
| 61 | static void font_change_cb(void * data, Fl_Font font, unsigned char size); |
| 62 | private: |
| 63 | void OK(void); |
| 64 | void font_change(Fl_Font font, unsigned char size); |
| 65 | |
| 66 | Font_change_registration * font_change_reg_p; |
| 67 | Fl_Text_Display * text_p; // The text of the hints |
| 68 | Fl_Return_Button * OK_p; |
| 69 | }; |
| 70 | |
| 71 | |
| 72 | // Class for "About" window |
| 73 | |
| 74 | class About_dialog : Fl_Double_Window { |
| 75 | |
| 76 | friend class Help; |
| 77 | |
| 78 | public: |
| 79 | About_dialog(void); |
| 80 | ~About_dialog(void); |
| 81 | |
| 82 | static void OK_cb(Fl_Widget *, void * data); |
| 83 | |
| 84 | private: |
| 85 | void OK(void); |
| 86 | |
| 87 | Fl_Multiline_Output * message_p; |
| 88 | Fl_Return_Button * ok_p; |
| 89 | }; |
| 90 | |
| 91 | |
| 92 | // Class for Help menu item from main toolbar |
| 93 | |
| 94 | class Help { |
| 95 | public: |
| 96 | Help(void); |
| 97 | ~Help(void); |
| 98 | |
| 99 | static void Uguide_cb(Fl_Widget *, void * data); |
| 100 | static void Startup_Hints_cb(Fl_Widget *, void * data); |
| 101 | static void About_cb(Fl_Widget *, void * data); |
| 102 | |
| 103 | private: |
| 104 | void Uguide(void); |
| 105 | void Startup_Hints(void); |
| 106 | void About(void); |
| 107 | |
| 108 | About_dialog * about_p; |
| 109 | StartupHints * startup_hints_p; |
| 110 | Uguide_browser * uguide_p; |
| 111 | }; |
| 112 | |
| 113 | #endif |