helpdata.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: html/helpdata.h
  3. // Purpose: interface of wxHtmlHelpData
  4. // Author: wxWidgets team
  5. // Licence: wxWindows licence
  6. /////////////////////////////////////////////////////////////////////////////
  7. /**
  8. @class wxHtmlBookRecord
  9. Helper class for wxHtmlHelpData
  10. */
  11. class wxHtmlBookRecord
  12. {
  13. public:
  14. wxHtmlBookRecord(const wxString& bookfile, const wxString& basepath,
  15. const wxString& title, const wxString& start);
  16. wxString GetBookFile() const;
  17. wxString GetTitle() const;
  18. wxString GetStart() const;
  19. wxString GetBasePath() const;
  20. /* SetContentsRange: store in the bookrecord where in the index/contents lists the
  21. * book's records are stored. This to facilitate searching in a specific book.
  22. * This code will have to be revised when loading/removing books becomes dynamic.
  23. * (as opposed to appending only)
  24. * Note that storing index range is pointless, because the index is alphab. sorted. */
  25. void SetContentsRange(int start, int end);
  26. int GetContentsStart() const;
  27. int GetContentsEnd() const;
  28. void SetTitle(const wxString& title);
  29. void SetBasePath(const wxString& path);
  30. void SetStart(const wxString& start);
  31. // returns full filename of page (which is part of the book),
  32. // i.e. with book's basePath prepended. If page is already absolute
  33. // path, basePath is _not_ prepended.
  34. wxString GetFullPath(const wxString &page) const;
  35. };
  36. /**
  37. @class wxHtmlHelpDataItem
  38. Helper class for wxHtmlHelpData
  39. */
  40. struct wxHtmlHelpDataItem
  41. {
  42. wxHtmlHelpDataItem();
  43. int level;
  44. wxHtmlHelpDataItem *parent;
  45. int id;
  46. wxString name;
  47. wxString page;
  48. wxHtmlBookRecord *book;
  49. // returns full filename of m_Page, i.e. with book's basePath prepended
  50. wxString GetFullPath() const;
  51. // returns item indented with spaces if it has level>1:
  52. wxString GetIndentedName() const;
  53. };
  54. /**
  55. @class wxHtmlHelpData
  56. This class is used by wxHtmlHelpController and wxHtmlHelpFrame to access HTML
  57. help items.
  58. It is internal class and should not be used directly - except for the case
  59. you're writing your own HTML help controller.
  60. @library{wxhtml}
  61. @category{help,html}
  62. */
  63. class wxHtmlHelpData : public wxObject
  64. {
  65. public:
  66. /**
  67. Constructor.
  68. */
  69. wxHtmlHelpData();
  70. /**
  71. Adds new book.
  72. @a book_url is URL (not filename!) of HTML help project (hhp) or ZIP file
  73. that contains arbitrary number of .hhp projects (this zip file can have
  74. either .zip or .htb extension, htb stands for "html book").
  75. Returns success.
  76. */
  77. bool AddBook(const wxString& book_url);
  78. /**
  79. Returns page's URL based on integer ID stored in project.
  80. */
  81. wxString FindPageById(int id);
  82. /**
  83. Returns page's URL based on its (file)name.
  84. */
  85. wxString FindPageByName(const wxString& page);
  86. /**
  87. Returns array with help books info.
  88. */
  89. const wxHtmlBookRecArray& GetBookRecArray() const;
  90. /**
  91. Returns reference to array with contents entries.
  92. */
  93. const wxHtmlHelpDataItems& GetContentsArray() const;
  94. /**
  95. Returns reference to array with index entries.
  96. */
  97. const wxHtmlHelpDataItems& GetIndexArray() const;
  98. /**
  99. Sets the temporary directory where binary cached versions of MS HTML Workshop
  100. files will be stored. (This is turned off by default and you can enable
  101. this feature by setting non-empty temp dir.)
  102. */
  103. void SetTempDir(const wxString& path);
  104. };