Import my Hybrid-CD stuff from last year.
[reactos.git] / reactos / base / applications / winhlp32 / 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 tagHelpButton
44 {
45 HWND hWnd;
46
47 LPCSTR lpszID;
48 LPCSTR lpszName;
49 LPCSTR lpszMacro;
50
51 WPARAM wParam;
52
53 RECT rect;
54
55 struct tagHelpButton*next;
56 } WINHELP_BUTTON;
57
58 typedef struct
59 {
60 HLPFILE_PAGE* page;
61 HLPFILE_WINDOWINFO* wininfo;
62 ULONG relative;
63 } WINHELP_WNDPAGE;
64
65 typedef struct tagPageSet
66 {
67 /* FIXME: for now it's a fixed size */
68 WINHELP_WNDPAGE set[40];
69 unsigned index;
70 } WINHELP_PAGESET;
71
72 typedef struct tagWinHelp
73 {
74 unsigned ref_count;
75 WINHELP_BUTTON* first_button;
76 HLPFILE_PAGE* page;
77
78 HWND hMainWnd;
79 HWND hHistoryWnd;
80
81 WNDPROC origRicheditWndProc;
82
83 HFONT* fonts;
84 UINT fonts_len;
85
86 HCURSOR hHandCur;
87
88 HBRUSH hBrush;
89
90 HLPFILE_WINDOWINFO* info;
91
92 WINHELP_PAGESET back;
93 unsigned font_scale; /* 0 = small, 1 = normal, 2 = large */
94
95 struct tagWinHelp* next;
96 } WINHELP_WINDOW;
97
98 #define DC_NOMSG 0x00000000
99 #define DC_MINMAX 0x00000001
100 #define DC_INITTERM 0x00000002
101 #define DC_JUMP 0x00000004
102 #define DC_ACTIVATE 0x00000008
103 #define DC_CALLBACKS 0x00000010
104
105 #define DW_NOTUSED 0
106 #define DW_WHATMSG 1
107 #define DW_MINMAX 2
108 #define DW_SIZE 3
109 #define DW_INIT 4
110 #define DW_TERM 5
111 #define DW_STARTJUMP 6
112 #define DW_ENDJUMP 7
113 #define DW_CHGFILE 8
114 #define DW_ACTIVATE 9
115 #define DW_CALLBACKS 10
116
117 typedef LONG (CALLBACK *WINHELP_LDLLHandler)(WORD, LONG_PTR, LONG_PTR);
118
119 typedef struct tagDll
120 {
121 HANDLE hLib;
122 const char* name;
123 WINHELP_LDLLHandler handler;
124 DWORD class;
125 struct tagDll* next;
126 } WINHELP_DLL;
127
128 typedef struct
129 {
130 UINT wVersion;
131 HANDLE hInstance;
132 BOOL isBook;
133 WINHELP_WINDOW* active_win;
134 WINHELP_WINDOW* active_popup;
135 WINHELP_WINDOW* win_list;
136 WNDPROC button_proc;
137 WINHELP_DLL* dlls;
138 WINHELP_PAGESET history;
139 HFONT hButtonFont;
140 } WINHELP_GLOBALS;
141
142 extern const struct winhelp_callbacks
143 {
144 WORD (WINAPI *GetFSError)(void);
145 HANDLE (WINAPI *HfsOpenSz)(LPSTR,BYTE);
146 WORD (WINAPI *RcCloseHfs)(HANDLE);
147 HANDLE (WINAPI *HfOpenHfs)(HANDLE,LPSTR,BYTE);
148 HANDLE (WINAPI *RcCloseHf)(HANDLE);
149 LONG (WINAPI *LcbReadHf)(HANDLE,BYTE*,LONG);
150 LONG (WINAPI *LTellHf)(HANDLE);
151 LONG (WINAPI *LSeekHf)(HANDLE,LONG,WORD);
152 BOOL (WINAPI *FEofHf)(HANDLE);
153 LONG (WINAPI *LcbSizeHf)(HANDLE);
154 BOOL (WINAPI *FAccessHfs)(HANDLE,LPSTR,BYTE);
155 WORD (WINAPI *RcLLInfoFromHf)(HANDLE,WORD,LPWORD,LPLONG,LPLONG);
156 WORD (WINAPI *RcLLInfoFromHfs)(HANDLE,LPSTR,WORD,LPWORD,LPLONG,LPLONG);
157 void (WINAPI *ErrorW)(int);
158 void (WINAPI *ErrorSz)(LPSTR);
159 ULONG_PTR (WINAPI *GetInfo)(WORD,HWND);
160 LONG (WINAPI *API)(LPSTR,WORD,DWORD);
161 } Callbacks;
162
163 extern WINHELP_GLOBALS Globals;
164
165 BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE*, int, BOOL);
166 BOOL WINHELP_OpenHelpWindow(HLPFILE_PAGE* (*)(HLPFILE*, LONG, ULONG*),
167 HLPFILE*, LONG, HLPFILE_WINDOWINFO*, int);
168 BOOL WINHELP_GetOpenFileName(LPSTR, int);
169 BOOL WINHELP_CreateIndexWindow(BOOL);
170 void WINHELP_DeleteBackSet(WINHELP_WINDOW*);
171 HLPFILE* WINHELP_LookupHelpFile(LPCSTR lpszFile);
172 HLPFILE_WINDOWINFO* WINHELP_GetWindowInfo(HLPFILE* hlpfile, LPCSTR name);
173 void WINHELP_LayoutMainWindow(WINHELP_WINDOW* win);
174 WINHELP_WINDOW* WINHELP_GrabWindow(WINHELP_WINDOW*);
175 BOOL WINHELP_ReleaseWindow(WINHELP_WINDOW*);
176
177 extern const char MAIN_WIN_CLASS_NAME[];
178 extern const char BUTTON_BOX_WIN_CLASS_NAME[];
179 extern const char TEXT_WIN_CLASS_NAME[];
180 extern const char SHADOW_WIN_CLASS_NAME[];
181 extern const char HISTORY_WIN_CLASS_NAME[];
182 extern const char STRING_BUTTON[];
183 extern const char STRING_MENU_Xx[];
184 extern const char STRING_DIALOG_TEST[];
185 #endif
186
187 /* Buttons */
188 #define WH_FIRST_BUTTON 500