helpext.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: helpext.h
  3. // Purpose: interface of wxExtHelpController
  4. // Author: wxWidgets team
  5. // Licence: wxWindows licence
  6. /////////////////////////////////////////////////////////////////////////////
  7. /**
  8. @class wxExtHelpController
  9. This class implements help via an external browser.
  10. It requires the name of a directory containing the documentation
  11. and a file mapping numerical Section numbers to relative URLS.
  12. The map file contains two or three fields per line:
  13. numeric_id relative_URL [; comment/documentation]
  14. The numeric_id is the id used to look up the entry in
  15. DisplaySection()/DisplayBlock(). The relative_URL is a filename of
  16. an html file, relative to the help directory. The optional
  17. comment/documentation field (after a ';') is used for keyword
  18. searches, so some meaningful text here does not hurt.
  19. If the documentation itself contains a ';', only the part before
  20. that will be displayed in the listbox, but all of it used for search.
  21. Lines starting with ';' will be ignored.
  22. @library{wxadv}
  23. @category{help}
  24. @see wxHelpController
  25. */
  26. class wxExtHelpController : public wxHelpControllerBase
  27. {
  28. public:
  29. wxExtHelpController(wxWindow* parentWindow = NULL);
  30. virtual ~wxExtHelpController();
  31. /**
  32. Tell it which browser to use.
  33. The Netscape support will check whether Netscape is already
  34. running (by looking at the .netscape/lock file in the user's
  35. home directory) and tell it to load the page into the existing window.
  36. @param viewer
  37. The command to call a browser/html viewer.
  38. @param flags
  39. Set this to wxHELP_NETSCAPE if the browser is some variant of Netscape.
  40. */
  41. virtual void SetViewer(const wxString& viewer = wxEmptyString,
  42. long flags = wxHELP_NETSCAPE);
  43. /**
  44. This must be called to tell the controller where to find the
  45. documentation.
  46. If a locale is set, look in file/localename, i.e.
  47. If passed "/usr/local/myapp/help" and the current wxLocale is
  48. set to be "de", then look in "/usr/local/myapp/help/de/"
  49. first and fall back to "/usr/local/myapp/help" if that
  50. doesn't exist.
  51. @param dir
  52. directory name where to fine the help files
  53. @return @true on success
  54. */
  55. virtual bool Initialize(const wxString& dir);
  56. /**
  57. If file is "", reloads file given in Initialize.
  58. @param file
  59. Name of help directory.
  60. @return @true on success
  61. */
  62. virtual bool LoadFile(const wxString& file = wxEmptyString);
  63. /**
  64. Display list of all help entries.
  65. @return @true on success
  66. */
  67. virtual bool DisplayContents();
  68. /**
  69. Display help for id sectionNo.
  70. @return @true on success
  71. */
  72. virtual bool DisplaySection(int sectionNo);
  73. /**
  74. Display help for id sectionNo -- identical with DisplaySection().
  75. @return @true on success
  76. */
  77. virtual bool DisplaySection(const wxString& section);
  78. /**
  79. Display help for URL (using DisplayHelp) or keyword (using KeywordSearch)
  80. @return @true on success
  81. */
  82. virtual bool DisplayBlock(long blockNo);
  83. /**
  84. Search comment/documentation fields in map file and present a
  85. list to chose from.
  86. @param k
  87. string to search for, empty string will list all entries
  88. @param mode
  89. optional parameter allows the search the index (wxHELP_SEARCH_INDEX)
  90. but this currently only supported by the wxHtmlHelpController.
  91. @return @true on success
  92. */
  93. virtual bool KeywordSearch(const wxString& k,
  94. wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
  95. /**
  96. Does nothing.
  97. */
  98. virtual bool Quit();
  99. /**
  100. Does nothing.
  101. */
  102. virtual void OnQuit();
  103. /**
  104. Call the browser using a relative URL.
  105. */
  106. virtual bool DisplayHelp(const wxString& relativeURL) ;
  107. /**
  108. Allows one to override the default settings for the help frame.
  109. */
  110. virtual void SetFrameParameters(const wxString& titleFormat,
  111. const wxSize& size,
  112. const wxPoint& pos = wxDefaultPosition,
  113. bool newFrameEachTime = false);
  114. /**
  115. Obtains the latest settings used by the help frame and the help frame.
  116. */
  117. virtual wxFrame *GetFrameParameters(wxSize *size = NULL,
  118. wxPoint *pos = NULL,
  119. bool *newFrameEachTime = NULL);
  120. };