winhelp: Added the notion of WINHELP_WNDPAGE and use it to move the history to the...
[wine] / programs / winhelp / winhelp.h
1 /*
2  * Help Viewer
3  *
4  * Copyright    1996 Ulrich Schmid
5  * Copyright    2002 Sylvain Petreolle <spetreolle@yahoo.fr>
6  *              2002 Eric Pouech
7  *
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.
12  *
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.
17  *
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
21  */
22
23 #define MAX_LANGUAGE_NUMBER     255
24 #define MAX_STRING_LEN          255
25
26 #define INTERNAL_BORDER_WIDTH   5
27 #define POPUP_YDISTANCE         20
28 #define SHADOW_DX               10
29 #define SHADOW_DY               10
30 #define BUTTON_CX               6
31 #define BUTTON_CY               6
32
33 #ifndef RC_INVOKED
34
35 #include <stdarg.h>
36
37 #include "hlpfile.h"
38 #include "windef.h"
39 #include "winbase.h"
40 #include "macro.h"
41 #include "winhelp_res.h"
42
43 typedef struct tagHelpLinePart
44 {
45     RECT      rect;
46     enum {hlp_line_part_text, hlp_line_part_bitmap, hlp_line_part_metafile} cookie;
47     union
48     {
49         struct
50         {
51             LPCSTR      lpsText;
52             HFONT       hFont;
53             COLORREF    color;
54             WORD        wTextLen;
55             WORD        wUnderline; /* 0 None, 1 simple, 2 double, 3 dotted */
56         } text;
57         struct
58         {
59             HBITMAP     hBitmap;
60         } bitmap;
61         struct
62         {
63             HMETAFILE   hMetaFile;
64             INT         mm;
65         } metafile;
66     } u;
67     HLPFILE_LINK*       link;
68
69     struct tagHelpLinePart *next;
70 } WINHELP_LINE_PART;
71
72 typedef struct tagHelpLine
73 {
74     RECT                rect;
75     WINHELP_LINE_PART   first_part;
76     struct tagHelpLine* next;
77 } WINHELP_LINE;
78
79 typedef struct tagHelpButton
80 {
81     HWND                hWnd;
82
83     LPCSTR              lpszID;
84     LPCSTR              lpszName;
85     LPCSTR              lpszMacro;
86
87     WPARAM              wParam;
88
89     RECT                rect;
90
91     struct tagHelpButton*next;
92 } WINHELP_BUTTON;
93
94 typedef struct
95 {
96     HLPFILE_PAGE*       page;
97     HLPFILE_WINDOWINFO* wininfo;
98 } WINHELP_WNDPAGE;
99
100 typedef struct tagPageSet
101 {
102     /* FIXME: for now it's a fixed size */
103     WINHELP_WNDPAGE     set[40];
104     unsigned            index;
105 } WINHELP_PAGESET;
106
107 typedef struct tagWinHelp
108 {
109     LPCSTR              lpszName;
110
111     WINHELP_BUTTON*     first_button;
112     HLPFILE_PAGE*       page;
113     WINHELP_LINE*       first_line;
114
115     HWND                hMainWnd;
116     HWND                hShadowWnd;
117     HWND                hHistoryWnd;
118
119     HFONT*              fonts;
120     UINT                fonts_len;
121
122     HCURSOR             hArrowCur;
123     HCURSOR             hHandCur;
124
125     HBRUSH              hBrush;
126
127     HLPFILE_WINDOWINFO* info;
128
129     WINHELP_PAGESET     back;
130
131     struct tagWinHelp*  next;
132 } WINHELP_WINDOW;
133
134 #define DC_NOMSG     0x00000000
135 #define DC_MINMAX    0x00000001
136 #define DC_INITTERM  0x00000002
137 #define DC_JUMP      0x00000004
138 #define DC_ACTIVATE  0x00000008
139 #define DC_CALLBACKS 0x00000010
140
141 #define DW_NOTUSED    0
142 #define DW_WHATMSG    1
143 #define DW_MINMAX     2
144 #define DW_SIZE       3
145 #define DW_INIT       4
146 #define DW_TERM       5
147 #define DW_STARTJUMP  6
148 #define DW_ENDJUMP    7
149 #define DW_CHGFILE    8
150 #define DW_ACTIVATE   9
151 #define DW_CALLBACKS 10
152
153 typedef long (CALLBACK *WINHELP_LDLLHandler)(WORD, LONG, LONG);
154
155 typedef struct tagDll
156 {
157     HANDLE              hLib;
158     const char*         name;
159     WINHELP_LDLLHandler handler;
160     DWORD               class;
161     struct tagDll*      next;
162 } WINHELP_DLL;
163
164 typedef struct
165 {
166     UINT                wVersion;
167     HANDLE              hInstance;
168     HWND                hPopupWnd;
169     BOOL                isBook;
170     WINHELP_WINDOW*     active_win;
171     WINHELP_WINDOW*     win_list;
172     WNDPROC             button_proc;
173     WINHELP_DLL*        dlls;
174     WINHELP_PAGESET     history;
175 } WINHELP_GLOBALS;
176
177 extern WINHELP_GLOBALS Globals;
178 extern FARPROC         Callbacks[];
179
180 BOOL WINHELP_CreateHelpWindowByHash(HLPFILE*, LONG, HLPFILE_WINDOWINFO*, int);
181 BOOL WINHELP_CreateHelpWindowByMap(HLPFILE*, LONG, HLPFILE_WINDOWINFO*, int);
182 BOOL WINHELP_CreateHelpWindowByOffset(HLPFILE*, LONG, HLPFILE_WINDOWINFO*, int);
183 BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE*, int);
184 BOOL WINHELP_GetOpenFileName(LPSTR, int);
185 BOOL WINHELP_CreateIndexWindow(void);
186 INT  WINHELP_MessageBoxIDS(UINT, UINT, WORD);
187 INT  WINHELP_MessageBoxIDS_s(UINT, LPCSTR, UINT, WORD);
188 HLPFILE* WINHELP_LookupHelpFile(LPCSTR lpszFile);
189 HLPFILE_WINDOWINFO* WINHELP_GetWindowInfo(HLPFILE* hlpfile, LPCSTR name);
190 void WINHELP_LayoutMainWindow(WINHELP_WINDOW* win);
191
192 extern const char MAIN_WIN_CLASS_NAME[];
193 extern const char BUTTON_BOX_WIN_CLASS_NAME[];
194 extern const char TEXT_WIN_CLASS_NAME[];
195 extern const char SHADOW_WIN_CLASS_NAME[];
196 extern const char HISTORY_WIN_CLASS_NAME[];
197 extern const char STRING_BUTTON[];
198 extern const char STRING_MENU_Xx[];
199 extern const char STRING_DIALOG_TEST[];
200 #endif
201
202 /* Buttons */
203 #define WH_FIRST_BUTTON     500