winhelp: Now use the icon out of hlpfile if any.
[wine/wine-jacek.git] / programs / winhelp / hlpfile.h
blob739ad38b985fa7a4226fb25e3a63694711c5e3be
1 /*
2 * Help Viewer
4 * Copyright 1996 Ulrich Schmid
5 * 2002, 2008 Eric Pouech
6 * 2007 Kirill K. Smirnov
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 struct tagHelpFile;
25 typedef struct
27 char type[10];
28 char name[9];
29 char caption[51];
30 POINT origin;
31 SIZE size;
32 int style;
33 DWORD win_style;
34 COLORREF sr_color; /* color for scrollable region */
35 COLORREF nsr_color; /* color for non scrollable region */
36 } HLPFILE_WINDOWINFO;
38 typedef struct
40 enum {hlp_link_link, hlp_link_popup, hlp_link_macro} cookie;
41 LPCSTR lpszString; /* name of the file to for the link (NULL if same file) */
42 LONG lHash; /* topic index */
43 unsigned bClrChange : 1, /* true if the link is green & underlined */
44 wRefCount; /* number of internal references to this object */
45 unsigned window; /* window number for displaying the link (-1 is current) */
46 } HLPFILE_LINK;
48 enum para_type {para_normal_text, para_debug_text, para_bitmap, para_metafile};
50 typedef struct tagHlpFileParagraph
52 enum para_type cookie;
54 union
56 struct
58 LPSTR lpszText;
59 unsigned wFont;
60 unsigned wIndent;
61 unsigned wHSpace;
62 unsigned wVSpace;
63 } text;
64 struct
66 unsigned pos; /* 0: center, 1: left, 2: right */
67 union
69 struct
71 HBITMAP hBitmap;
72 } bmp;
73 METAFILEPICT mfp;
74 } u;
75 } gfx; /* for bitmaps and metafiles */
76 } u;
78 HLPFILE_LINK* link;
80 struct tagHlpFileParagraph* next;
81 } HLPFILE_PARAGRAPH;
83 typedef struct tagHlpFileMacro
85 LPCSTR lpszMacro;
86 struct tagHlpFileMacro* next;
87 } HLPFILE_MACRO;
89 typedef struct tagHlpFilePage
91 LPSTR lpszTitle;
92 HLPFILE_PARAGRAPH* first_paragraph;
93 HLPFILE_MACRO* first_macro;
95 unsigned wNumber;
96 unsigned offset;
97 DWORD reference;
98 struct tagHlpFilePage* next;
99 struct tagHlpFilePage* prev;
101 DWORD browse_bwd;
102 DWORD browse_fwd;
104 struct tagHlpFileFile* file;
105 } HLPFILE_PAGE;
107 typedef struct
109 LONG lMap;
110 unsigned long offset;
111 } HLPFILE_MAP;
113 typedef struct
115 LOGFONT LogFont;
116 HFONT hFont;
117 COLORREF color;
118 } HLPFILE_FONT;
120 typedef struct tagHlpFileFile
122 BYTE* file_buffer;
123 UINT file_buffer_size;
124 LPSTR lpszPath;
125 LPSTR lpszTitle;
126 LPSTR lpszCopyright;
127 HLPFILE_PAGE* first_page;
128 HLPFILE_PAGE* last_page;
129 HLPFILE_MACRO* first_macro;
130 BYTE* Context;
131 BYTE* kwbtree;
132 BYTE* kwdata;
133 unsigned wMapLen;
134 HLPFILE_MAP* Map;
135 unsigned long contents_start;
137 struct tagHlpFileFile* prev;
138 struct tagHlpFileFile* next;
140 unsigned wRefCount;
142 unsigned short version;
143 unsigned short flags;
144 unsigned short tbsize; /* topic block size */
145 unsigned short dsize; /* decompress size */
146 unsigned short compressed;
147 unsigned hasPhrases; /* file has |Phrases */
148 unsigned hasPhrases40; /* file has |PhrIndex/|PhrImage */
149 UINT num_phrases;
150 unsigned* phrases_offsets;
151 char* phrases_buffer;
153 BYTE** topic_map;
154 BYTE* topic_end;
155 UINT topic_maplen;
157 unsigned numBmps;
158 HBITMAP* bmps;
160 unsigned numFonts;
161 HLPFILE_FONT* fonts;
163 unsigned numWindows;
164 HLPFILE_WINDOWINFO* windows;
165 HICON hIcon;
166 } HLPFILE;
169 * Compare function type for HLPFILE_BPTreeSearch function.
171 * PARAMS
172 * p [I] pointer to testing block (key + data)
173 * key [I] pointer to key value to look for
174 * leaf [I] whether this function called for index of leaf page
175 * next [O] pointer to pointer to next block
177 typedef int (*HLPFILE_BPTreeCompare)(void *p, const void *key,
178 int leaf, void **next);
181 * Callback function type for HLPFILE_BPTreeEnum function.
183 * PARAMS
184 * p [I] pointer to data block
185 * next [O] pointer to pointer to next block
186 * cookie [IO] cookie data
188 typedef void (*HLPFILE_BPTreeCallback)(void *p, void **next, void *cookie);
190 HLPFILE* HLPFILE_ReadHlpFile(LPCSTR lpszPath);
191 HLPFILE_PAGE* HLPFILE_Contents(HLPFILE* hlpfile);
192 HLPFILE_PAGE* HLPFILE_PageByHash(HLPFILE* hlpfile, LONG lHash);
193 HLPFILE_PAGE* HLPFILE_PageByMap(HLPFILE* hlpfile, LONG lMap);
194 HLPFILE_PAGE* HLPFILE_PageByOffset(HLPFILE* hlpfile, LONG offset);
195 LONG HLPFILE_Hash(LPCSTR lpszContext);
196 void HLPFILE_FreeLink(HLPFILE_LINK* link);
197 void HLPFILE_FreeHlpFile(HLPFILE*);
199 void* HLPFILE_BPTreeSearch(BYTE*, const void*, HLPFILE_BPTreeCompare);
200 void HLPFILE_BPTreeEnum(BYTE*, HLPFILE_BPTreeCallback cb, void *cookie);
202 BOOL HLPFILE_BrowsePage(HLPFILE_PAGE*);