save old text color during a call of DrawCaptionTempW
[wine/kumbayo.git] / programs / winhelp / hlpfile.h
blob3632902efd7669db13fe540c1a49892cb36268ab
1 /*
2 * Help Viewer
4 * Copyright 1996 Ulrich Schmid
5 * 2002 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 struct tagHlpFilePage* next;
98 struct tagHlpFilePage* prev;
100 DWORD browse_bwd;
101 DWORD browse_fwd;
103 struct tagHlpFileFile* file;
104 } HLPFILE_PAGE;
106 typedef struct
108 LONG lMap;
109 unsigned long offset;
110 } HLPFILE_MAP;
112 typedef struct
114 LOGFONT LogFont;
115 HFONT hFont;
116 COLORREF color;
117 } HLPFILE_FONT;
119 typedef struct tagHlpFileFile
121 LPSTR lpszPath;
122 LPSTR lpszTitle;
123 LPSTR lpszCopyright;
124 HLPFILE_PAGE* first_page;
125 HLPFILE_PAGE* last_page;
126 HLPFILE_MACRO* first_macro;
127 BYTE* Context;
128 BYTE* kwbtree;
129 BYTE* kwdata;
130 unsigned wMapLen;
131 HLPFILE_MAP* Map;
132 unsigned long contents_start;
134 struct tagHlpFileFile* prev;
135 struct tagHlpFileFile* next;
137 unsigned wRefCount;
139 unsigned short version;
140 unsigned short flags;
141 unsigned short tbsize; /* topic block size */
142 unsigned short dsize; /* decompress size */
143 unsigned short compressed;
144 unsigned hasPhrases; /* file has |Phrases */
145 unsigned hasPhrases40; /* file has |PhrIndex/|PhrImage */
147 unsigned numBmps;
148 HBITMAP* bmps;
150 unsigned numFonts;
151 HLPFILE_FONT* fonts;
153 unsigned numWindows;
154 HLPFILE_WINDOWINFO* windows;
155 } HLPFILE;
158 * Compare function type for HLPFILE_BPTreeSearch function.
160 * PARAMS
161 * p [I] pointer to testing block (key + data)
162 * key [I] pointer to key value to look for
163 * leaf [I] whether this function called for index of leaf page
164 * next [O] pointer to pointer to next block
166 typedef int (*HLPFILE_BPTreeCompare)(void *p, const void *key,
167 int leaf, void **next);
170 * Callback function type for HLPFILE_BPTreeEnum function.
172 * PARAMS
173 * p [I] pointer to data block
174 * next [O] pointer to pointer to next block
175 * cookie [IO] cookie data
177 typedef void (*HLPFILE_BPTreeCallback)(void *p, void **next, void *cookie);
179 HLPFILE* HLPFILE_ReadHlpFile(LPCSTR lpszPath);
180 HLPFILE_PAGE* HLPFILE_Contents(HLPFILE* hlpfile);
181 HLPFILE_PAGE* HLPFILE_PageByHash(HLPFILE* hlpfile, LONG lHash);
182 HLPFILE_PAGE* HLPFILE_PageByMap(HLPFILE* hlpfile, LONG lMap);
183 HLPFILE_PAGE* HLPFILE_PageByOffset(HLPFILE* hlpfile, LONG offset);
184 LONG HLPFILE_Hash(LPCSTR lpszContext);
185 void HLPFILE_FreeLink(HLPFILE_LINK* link);
186 void HLPFILE_FreeHlpFile(HLPFILE*);
188 void* HLPFILE_BPTreeSearch(BYTE*, const void*, HLPFILE_BPTreeCompare);
189 void HLPFILE_BPTreeEnum(BYTE*, HLPFILE_BPTreeCallback cb, void *cookie);