kernel32/tests: Add tests to examine output file part pointer behavior for GetFullPat...
[wine/multimedia.git] / dlls / hhctrl.ocx / hhctrl.h
blob91d3a775aceeb07121a3acb287ff3b5c1d7ece02
1 /*
2 * Copyright 2005 James Hawkins
3 * Copyright 2007 Jacek Caban for CodeWeavers
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #ifndef HHCTRL_H
21 #define HHCTRL_H
23 #include <stdarg.h>
25 #define COBJMACROS
27 #include "windef.h"
28 #include "winbase.h"
29 #include "winuser.h"
30 #include "winnls.h"
31 #include "htmlhelp.h"
32 #include "ole2.h"
33 #include "exdisp.h"
34 #include "mshtmhst.h"
35 #include "commctrl.h"
37 #ifdef INIT_GUID
38 #include "initguid.h"
39 #endif
41 #include "wine/itss.h"
42 #include "wine/unicode.h"
44 #define WB_GOBACK 0
45 #define WB_GOFORWARD 1
46 #define WB_GOHOME 2
47 #define WB_SEARCH 3
48 #define WB_REFRESH 4
49 #define WB_STOP 5
51 typedef struct {
52 LPWSTR chm_file;
53 LPWSTR chm_index;
54 } ChmPath;
56 typedef struct ContentItem {
57 struct ContentItem *parent;
58 struct ContentItem *child;
59 struct ContentItem *next;
61 HTREEITEM id;
63 LPWSTR name;
64 LPWSTR local;
65 ChmPath merge;
66 } ContentItem;
68 typedef struct IndexSubItem {
69 LPWSTR name;
70 LPWSTR local;
71 } IndexSubItem;
73 typedef struct IndexItem {
74 struct IndexItem *next;
76 HTREEITEM id;
77 LPWSTR keyword;
78 ChmPath merge;
80 int nItems;
81 int itemFlags;
82 int indentLevel;
83 IndexSubItem *items;
84 } IndexItem;
86 typedef struct SearchItem {
87 struct SearchItem *next;
89 HTREEITEM id;
90 LPWSTR title;
91 LPWSTR filename;
92 } SearchItem;
94 typedef struct CHMInfo
96 IITStorage *pITStorage;
97 IStorage *pStorage;
98 WCHAR *szFile;
100 IStream *strings_stream;
101 char **strings;
102 DWORD strings_size;
104 WCHAR *defTopic;
105 WCHAR *defTitle;
106 WCHAR *defToc;
107 } CHMInfo;
109 #define TAB_CONTENTS 0
110 #define TAB_INDEX 1
111 #define TAB_SEARCH 2
112 #define TAB_FAVORITES 3
114 typedef struct {
115 HWND hwnd;
116 DWORD id;
117 } HHTab;
119 typedef struct {
120 HWND hwndList;
121 HWND hwndPopup;
122 HWND hwndCallback;
123 } IndexPopup;
125 typedef struct {
126 SearchItem *root;
127 HWND hwndEdit;
128 HWND hwndList;
129 HWND hwndContainer;
130 } SearchTab;
132 typedef struct {
133 IOleClientSite *client_site;
134 IWebBrowser2 *web_browser;
135 IOleObject *wb_object;
137 HH_WINTYPEW WinType;
139 LPWSTR pszType;
140 LPWSTR pszCaption;
141 LPWSTR pszToc;
142 LPWSTR pszIndex;
143 LPWSTR pszFile;
144 LPWSTR pszHome;
145 LPWSTR pszJump1;
146 LPWSTR pszJump2;
147 LPWSTR pszUrlJump1;
148 LPWSTR pszUrlJump2;
149 LPWSTR pszCustomTabs;
151 CHMInfo *pCHMInfo;
152 ContentItem *content;
153 IndexItem *index;
154 IndexPopup popup;
155 SearchTab search;
156 HWND hwndTabCtrl;
157 HWND hwndSizeBar;
158 HFONT hFont;
160 HHTab tabs[TAB_FAVORITES+1];
161 DWORD current_tab;
162 } HHInfo;
164 BOOL InitWebBrowser(HHInfo*,HWND);
165 void ReleaseWebBrowser(HHInfo*);
166 void ResizeWebBrowser(HHInfo*,DWORD,DWORD);
167 void DoPageAction(HHInfo*,DWORD);
169 void InitContent(HHInfo*);
170 void ReleaseContent(HHInfo*);
172 void InitIndex(HHInfo*);
173 void ReleaseIndex(HHInfo*);
175 CHMInfo *OpenCHM(LPCWSTR szFile);
176 BOOL LoadWinTypeFromCHM(HHInfo *info);
177 CHMInfo *CloseCHM(CHMInfo *pCHMInfo);
178 void SetChmPath(ChmPath*,LPCWSTR,LPCWSTR);
179 IStream *GetChmStream(CHMInfo*,LPCWSTR,ChmPath*);
180 LPWSTR FindContextAlias(CHMInfo*,DWORD);
182 HHInfo *CreateHelpViewer(LPCWSTR);
183 void ReleaseHelpViewer(HHInfo*);
184 BOOL NavigateToUrl(HHInfo*,LPCWSTR);
185 BOOL NavigateToChm(HHInfo*,LPCWSTR,LPCWSTR);
187 void InitSearch(HHInfo *info, const char *needle);
188 void ReleaseSearch(HHInfo *info);
190 /* memory allocation functions */
192 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
194 return HeapAlloc(GetProcessHeap(), 0, len);
197 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
199 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
202 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
204 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
207 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
209 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
212 static inline BOOL heap_free(void *mem)
214 return HeapFree(GetProcessHeap(), 0, mem);
217 static inline LPWSTR strdupW(LPCWSTR str)
219 LPWSTR ret;
220 int size;
222 if(!str)
223 return NULL;
225 size = (strlenW(str)+1)*sizeof(WCHAR);
226 ret = heap_alloc(size);
227 memcpy(ret, str, size);
229 return ret;
232 static inline LPWSTR strdupnAtoW(LPCSTR str, LONG lenA)
234 LPWSTR ret;
235 DWORD len;
237 if(!str)
238 return NULL;
240 if (lenA > 0)
242 /* find length of string */
243 LPCSTR eos = memchr(str, 0, lenA);
244 if (eos) lenA = eos - str;
247 len = MultiByteToWideChar(CP_ACP, 0, str, lenA, NULL, 0)+1; /* +1 for null pad */
248 ret = heap_alloc(len*sizeof(WCHAR));
249 MultiByteToWideChar(CP_ACP, 0, str, lenA, ret, len);
250 ret[len-1] = 0;
252 return ret;
255 static inline LPWSTR strdupAtoW(LPCSTR str)
257 return strdupnAtoW(str, -1);
262 extern HINSTANCE hhctrl_hinstance;
263 extern BOOL hh_process;
265 #endif