makefiles: Generate the config.status dependency as part of the makefile dependencies.
[wine/multimedia.git] / dlls / hhctrl.ocx / hhctrl.h
blobd0c1545792928b8ae4e5086755354d2f314a7319
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 IndexSubItem *items;
83 } IndexItem;
85 typedef struct CHMInfo
87 IITStorage *pITStorage;
88 IStorage *pStorage;
89 WCHAR *szFile;
91 IStream *strings_stream;
92 char **strings;
93 DWORD strings_size;
95 WCHAR *defTopic;
96 WCHAR *defTitle;
97 WCHAR *defToc;
98 } CHMInfo;
100 #define TAB_CONTENTS 0
101 #define TAB_INDEX 1
102 #define TAB_SEARCH 2
103 #define TAB_FAVORITES 3
105 typedef struct {
106 HWND hwnd;
107 DWORD id;
108 } HHTab;
110 typedef struct {
111 HWND hwndList;
112 HWND hwndPopup;
113 HWND hwndCallback;
114 } IndexPopup;
116 typedef struct {
117 IOleClientSite *client_site;
118 IWebBrowser2 *web_browser;
119 IOleObject *wb_object;
121 HH_WINTYPEW WinType;
123 LPWSTR pszType;
124 LPWSTR pszCaption;
125 LPWSTR pszToc;
126 LPWSTR pszIndex;
127 LPWSTR pszFile;
128 LPWSTR pszHome;
129 LPWSTR pszJump1;
130 LPWSTR pszJump2;
131 LPWSTR pszUrlJump1;
132 LPWSTR pszUrlJump2;
133 LPWSTR pszCustomTabs;
135 CHMInfo *pCHMInfo;
136 ContentItem *content;
137 IndexItem *index;
138 IndexPopup popup;
139 HWND hwndTabCtrl;
140 HWND hwndSizeBar;
141 HFONT hFont;
143 HHTab tabs[TAB_FAVORITES+1];
144 DWORD current_tab;
145 } HHInfo;
147 BOOL InitWebBrowser(HHInfo*,HWND);
148 void ReleaseWebBrowser(HHInfo*);
149 void ResizeWebBrowser(HHInfo*,DWORD,DWORD);
150 void DoPageAction(HHInfo*,DWORD);
152 void InitContent(HHInfo*);
153 void ReleaseContent(HHInfo*);
155 void InitIndex(HHInfo*);
156 void ReleaseIndex(HHInfo*);
158 CHMInfo *OpenCHM(LPCWSTR szFile);
159 BOOL LoadWinTypeFromCHM(HHInfo *info);
160 CHMInfo *CloseCHM(CHMInfo *pCHMInfo);
161 void SetChmPath(ChmPath*,LPCWSTR,LPCWSTR);
162 IStream *GetChmStream(CHMInfo*,LPCWSTR,ChmPath*);
163 LPWSTR FindContextAlias(CHMInfo*,DWORD);
165 HHInfo *CreateHelpViewer(LPCWSTR);
166 void ReleaseHelpViewer(HHInfo*);
167 BOOL NavigateToUrl(HHInfo*,LPCWSTR);
168 BOOL NavigateToChm(HHInfo*,LPCWSTR,LPCWSTR);
170 /* memory allocation functions */
172 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
174 return HeapAlloc(GetProcessHeap(), 0, len);
177 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
179 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
182 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
184 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
187 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
189 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
192 static inline BOOL heap_free(void *mem)
194 return HeapFree(GetProcessHeap(), 0, mem);
197 static inline LPWSTR strdupW(LPCWSTR str)
199 LPWSTR ret;
200 int size;
202 if(!str)
203 return NULL;
205 size = (strlenW(str)+1)*sizeof(WCHAR);
206 ret = heap_alloc(size);
207 memcpy(ret, str, size);
209 return ret;
212 static inline LPWSTR strdupnAtoW(LPCSTR str, LONG lenA)
214 LPWSTR ret;
215 DWORD len;
217 if(!str)
218 return NULL;
220 if (lenA > 0)
222 /* find length of string */
223 LPCSTR eos = memchr(str, 0, lenA);
224 if (eos) lenA = eos - str;
227 len = MultiByteToWideChar(CP_ACP, 0, str, lenA, NULL, 0)+1; /* +1 for null pad */
228 ret = heap_alloc(len*sizeof(WCHAR));
229 MultiByteToWideChar(CP_ACP, 0, str, lenA, ret, len);
230 ret[len-1] = 0;
232 return ret;
235 static inline LPWSTR strdupAtoW(LPCSTR str)
237 return strdupnAtoW(str, -1);
242 extern HINSTANCE hhctrl_hinstance;
243 extern BOOL hh_process;
245 #endif