helpwnd.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: html/helpwnd.h
  3. // Purpose: interface of wxHtmlHelpWindow
  4. // Author: wxWidgets team
  5. // Licence: wxWindows licence
  6. /////////////////////////////////////////////////////////////////////////////
  7. /*!
  8. * Command IDs
  9. */
  10. enum
  11. {
  12. //wxID_HTML_HELPFRAME = wxID_HIGHEST + 1,
  13. wxID_HTML_PANEL = wxID_HIGHEST + 10,
  14. wxID_HTML_BACK,
  15. wxID_HTML_FORWARD,
  16. wxID_HTML_UPNODE,
  17. wxID_HTML_UP,
  18. wxID_HTML_DOWN,
  19. wxID_HTML_PRINT,
  20. wxID_HTML_OPENFILE,
  21. wxID_HTML_OPTIONS,
  22. wxID_HTML_BOOKMARKSLIST,
  23. wxID_HTML_BOOKMARKSADD,
  24. wxID_HTML_BOOKMARKSREMOVE,
  25. wxID_HTML_TREECTRL,
  26. wxID_HTML_INDEXPAGE,
  27. wxID_HTML_INDEXLIST,
  28. wxID_HTML_INDEXTEXT,
  29. wxID_HTML_INDEXBUTTON,
  30. wxID_HTML_INDEXBUTTONALL,
  31. wxID_HTML_NOTEBOOK,
  32. wxID_HTML_SEARCHPAGE,
  33. wxID_HTML_SEARCHTEXT,
  34. wxID_HTML_SEARCHLIST,
  35. wxID_HTML_SEARCHBUTTON,
  36. wxID_HTML_SEARCHCHOICE,
  37. wxID_HTML_COUNTINFO
  38. };
  39. /**
  40. @class wxHtmlHelpWindow
  41. This class is used by wxHtmlHelpController to display help within a frame or
  42. dialog, but you can use it yourself to create an embedded HTML help window.
  43. For example:
  44. @code
  45. // m_embeddedHelpWindow is a wxHtmlHelpWindow
  46. // m_embeddedHtmlHelp is a wxHtmlHelpController
  47. // Create embedded HTML Help window
  48. m_embeddedHelpWindow = new wxHtmlHelpWindow;
  49. m_embeddedHtmlHelp.UseConfig(config, rootPath); // Set your own config object here
  50. m_embeddedHtmlHelp.SetHelpWindow(m_embeddedHelpWindow);
  51. m_embeddedHelpWindow->Create(this, wxID_ANY, wxDefaultPosition, GetClientSize(),
  52. wxTAB_TRAVERSAL|wxBORDER_NONE, wxHF_DEFAULT_STYLE);
  53. m_embeddedHtmlHelp.AddBook(wxFileName(wxT("doc.zip")));
  54. @endcode
  55. You should pass the style wxHF_EMBEDDED to the style parameter of
  56. wxHtmlHelpController to allow the embedded window to be destroyed
  57. independently of the help controller.
  58. @library{wxhtml}
  59. @category{help,html}
  60. */
  61. class wxHtmlHelpWindow : public wxWindow
  62. {
  63. public:
  64. wxHtmlHelpWindow(wxHtmlHelpData* data = NULL);
  65. /**
  66. Constructor.
  67. For the values of @a helpStyle, please see the documentation for
  68. wxHtmlHelpController.
  69. */
  70. wxHtmlHelpWindow(wxWindow* parent, int wxWindowID,
  71. const wxPoint& pos = wxDefaultPosition,
  72. const wxSize& size = wxDefaultSize,
  73. int style = wxTAB_TRAVERSAL|wxBORDER_NONE,
  74. int helpStyle = wxHF_DEFAULT_STYLE,
  75. wxHtmlHelpData* data = NULL);
  76. /**
  77. Creates the help window. See @ref wxHtmlHelpWindow() "the constructor"
  78. for a description of the parameters.
  79. */
  80. bool Create(wxWindow* parent, wxWindowID id,
  81. const wxPoint& pos = wxDefaultPosition,
  82. const wxSize& size = wxDefaultSize, int style = wxTAB_TRAVERSAL|wxBORDER_NONE,
  83. int helpStyle = wxHF_DEFAULT_STYLE);
  84. /**
  85. Displays page x.
  86. If not found it will give the user the choice of searching books.
  87. Looking for the page runs in these steps:
  88. -# try to locate file named x (if x is for example "doc/howto.htm")
  89. -# try to open starting page of book x
  90. -# try to find x in contents (if x is for example "How To ...")
  91. -# try to find x in index (if x is for example "How To ...")
  92. */
  93. bool Display(const wxString& x);
  94. /**
  95. @overload
  96. This form takes numeric ID as the parameter (uses an extension to MS format,
  97. param name="ID" value=id).
  98. */
  99. bool Display(const int id);
  100. /**
  101. Displays contents panel.
  102. */
  103. bool DisplayContents();
  104. /**
  105. Displays index panel.
  106. */
  107. bool DisplayIndex();
  108. /**
  109. Returns the wxHtmlHelpData object, which is usually a pointer to the
  110. controller's data.
  111. */
  112. wxHtmlHelpData* GetData();
  113. /**
  114. Search for given keyword. Optionally it searches through the index
  115. (mode = @c wxHELP_SEARCH_INDEX), default the content (mode = @c wxHELP_SEARCH_ALL).
  116. */
  117. bool KeywordSearch(const wxString& keyword,
  118. wxHelpSearchMode mode = wxHELP_SEARCH_ALL);
  119. /**
  120. Reads the user's settings for this window.
  121. @see wxHtmlHelpController::ReadCustomization
  122. */
  123. void ReadCustomization(wxConfigBase* cfg,
  124. const wxString& path = wxEmptyString);
  125. /**
  126. Associates a wxConfig object with the help window. It is recommended that you
  127. use wxHtmlHelpController::UseConfig instead.
  128. */
  129. void UseConfig(wxConfigBase* config,
  130. const wxString& rootpath = wxEmptyString);
  131. /**
  132. Saves the user's settings for this window.
  133. @see wxHtmlHelpController::WriteCustomization
  134. */
  135. void WriteCustomization(wxConfigBase* cfg,
  136. const wxString& path = wxEmptyString);
  137. /**
  138. Refresh all panels. This is necessary if a new book was added.
  139. */
  140. void RefreshLists();
  141. wxHtmlHelpController* GetController() const;
  142. void SetController(wxHtmlHelpController* controller);
  143. protected:
  144. /**
  145. Creates search panel.
  146. */
  147. void CreateSearch();
  148. /**
  149. You may override this virtual method to add more buttons to the help window's
  150. toolbar. @a toolBar is a pointer to the toolbar and @a style is the style
  151. flag as passed to the Create() method.
  152. wxToolBar::Realize is called immediately after returning from this function.
  153. See @c samples/html/helpview for an example.
  154. */
  155. virtual void AddToolbarButtons(wxToolBar* toolBar, int style);
  156. /**
  157. Creates contents panel. (May take some time.)
  158. */
  159. void CreateContents();
  160. /**
  161. Creates index panel. (May take some time.)
  162. */
  163. void CreateIndex();
  164. };