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