Implement LBS_COMBOBOX, and make use of it.
[wine] / programs / winhelp / hlpfile.h
1 /*
2  * Help Viewer
3  *
4  * Copyright    1996 Ulrich Schmid
5  *              2002 Eric Pouech
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21
22 struct tagHelpFile;
23
24 typedef struct 
25 {
26     char        type[10];
27     char        name[9];
28     char        caption[51];
29     POINT       origin;
30     SIZE        size;
31     int         style;
32     DWORD       win_style;
33     COLORREF    sr_color;       /* color for scrollable region */
34     COLORREF    nsr_color;      /* color for non scrollable region */
35 } HLPFILE_WINDOWINFO;
36
37 typedef struct
38 {
39     enum {hlp_link_link, hlp_link_popup, hlp_link_macro} cookie;
40     LPCSTR      lpszString;     /* name of the file to for the link (NULL if same file) */
41     LONG        lHash;          /* topic index */
42     unsigned    bClrChange : 1, /* true if the link is green & underlined */
43                 wRefCount;      /* number of internal references to this object */
44     unsigned    window;         /* window number for displaying the link (-1 is current) */
45 } HLPFILE_LINK;
46
47 enum para_type {para_normal_text, para_debug_text, para_bitmap, para_metafile};
48
49 typedef struct tagHlpFileParagraph
50 {
51     enum para_type              cookie;
52
53     union
54     {
55         struct
56         {
57             LPSTR                       lpszText;
58             unsigned                    wFont;
59             unsigned                    wIndent;
60             unsigned                    wHSpace;
61             unsigned                    wVSpace;
62         } text;
63         struct
64         {
65             unsigned                    pos;    /* 0: center, 1: left, 2: right */
66             union 
67             {
68                 struct 
69                 {
70                     HBITMAP             hBitmap;
71                 } bmp;
72                 struct
73                 {
74                     HMETAFILE           hMetaFile;
75                     SIZE                mfSize;
76                 } mf;
77             } u;
78         } gfx; /* for bitmaps and metafiles */
79     } u;
80
81     HLPFILE_LINK*               link;
82
83     struct tagHlpFileParagraph* next;
84 } HLPFILE_PARAGRAPH;
85
86 typedef struct tagHlpFileMacro
87 {
88     LPCSTR                      lpszMacro;
89     struct tagHlpFileMacro*     next;
90 } HLPFILE_MACRO;
91
92 typedef struct tagHlpFilePage
93 {
94     LPSTR                       lpszTitle;
95     HLPFILE_PARAGRAPH*          first_paragraph;
96     HLPFILE_MACRO*              first_macro;
97
98     unsigned                    wNumber;
99     unsigned                    offset;
100     struct tagHlpFilePage*      next;
101     struct tagHlpFilePage*      prev;
102
103     DWORD                       browse_bwd;
104     DWORD                       browse_fwd;
105
106     struct tagHlpFileFile*      file;
107 } HLPFILE_PAGE;
108
109 typedef struct
110 {
111     LONG                        lHash;
112     unsigned long               offset;
113 } HLPFILE_CONTEXT;
114
115 typedef struct
116 {
117     LOGFONT                     LogFont;
118     HFONT                       hFont;
119     COLORREF                    color;
120 } HLPFILE_FONT;
121
122 typedef struct tagHlpFileFile
123 {
124     LPSTR                       lpszPath;
125     LPSTR                       lpszTitle;
126     LPSTR                       lpszCopyright;
127     HLPFILE_PAGE*               first_page;
128     HLPFILE_MACRO*              first_macro;
129     unsigned                    wContextLen;
130     HLPFILE_CONTEXT*            Context;
131     unsigned long               contents_start;
132
133     struct tagHlpFileFile*      prev;
134     struct tagHlpFileFile*      next;
135
136     unsigned                    wRefCount;
137
138     unsigned short              version;
139     unsigned short              flags;
140     unsigned                    hasPhrases; /* Phrases or PhrIndex/PhrImage */
141
142     unsigned                    numBmps;
143     HBITMAP*                    bmps;
144
145     unsigned                    numFonts;
146     HLPFILE_FONT*               fonts;
147
148     unsigned                    numWindows;
149     HLPFILE_WINDOWINFO*         windows;
150 } HLPFILE;
151
152 HLPFILE*      HLPFILE_ReadHlpFile(LPCSTR lpszPath);
153 HLPFILE_PAGE* HLPFILE_Contents(HLPFILE* hlpfile);
154 HLPFILE_PAGE* HLPFILE_PageByHash(HLPFILE* hlpfile, LONG lHash);
155 HLPFILE_PAGE* HLPFILE_PageByOffset(HLPFILE* hlpfile, LONG offset);
156 LONG          HLPFILE_Hash(LPCSTR lpszContext);
157 void          HLPFILE_FreeLink(HLPFILE_LINK* link);
158 void          HLPFILE_FreeHlpFile(HLPFILE*);