dbghelp: Allow to add an alternate file_map for an ELF file (where to look for its...
[wine] / dlls / hhctrl.ocx / hhctrl.h
1 /*
2  * Copyright 2005 James Hawkins
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 #ifndef HHCTRL_H
20 #define HHCTRL_H
21
22 #include <stdarg.h>
23
24 #define COBJMACROS
25
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "winnls.h"
30 #include "htmlhelp.h"
31 #include "ole2.h"
32 #include "exdisp.h"
33 #include "mshtmhst.h"
34
35 #ifdef INIT_GUID
36 #include "initguid.h"
37 #endif
38
39 #include "wine/itss.h"
40
41 #define WB_GOBACK     0
42 #define WB_GOFORWARD  1
43 #define WB_GOHOME     2
44 #define WB_SEARCH     3
45 #define WB_REFRESH    4
46 #define WB_STOP       5
47
48 typedef struct CHMInfo
49 {
50     IITStorage *pITStorage;
51     IStorage *pStorage;
52     LPCWSTR szFile;
53
54     IStream *strings_stream;
55     char **strings;
56     DWORD strings_size;
57 } CHMInfo;
58
59
60 typedef struct WBInfo
61 {
62     IOleClientSite *pOleClientSite;
63     IWebBrowser2 *pWebBrowser2;
64     IOleObject *pBrowserObject;
65     HWND hwndParent;
66 } WBInfo;
67
68 BOOL WB_EmbedBrowser(WBInfo *pWBInfo, HWND hwndParent);
69 void WB_UnEmbedBrowser(WBInfo *pWBInfo);
70 void WB_ResizeBrowser(WBInfo *pWBInfo, DWORD dwWidth, DWORD dwHeight);
71 void WB_DoPageAction(WBInfo *pWBInfo, DWORD dwAction);
72
73 CHMInfo *OpenCHM(LPCWSTR szFile);
74 BOOL CHM_LoadWinTypeFromCHM(CHMInfo *pCHMInfo, HH_WINTYPEW *pHHWinType);
75 CHMInfo *CloseCHM(CHMInfo *pCHMInfo);
76
77 /* memory allocation functions */
78
79 static inline void *hhctrl_alloc(size_t len)
80 {
81     return HeapAlloc(GetProcessHeap(), 0, len);
82 }
83
84 static inline void *hhctrl_alloc_zero(size_t len)
85 {
86     return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
87 }
88
89 static inline void *hhctrl_realloc(void *mem, size_t len)
90 {
91     return HeapReAlloc(GetProcessHeap(), 0, mem, len);
92 }
93
94 static inline void *hhctrl_realloc_zero(void *mem, size_t len)
95 {
96     return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
97 }
98
99 static inline BOOL hhctrl_free(void *mem)
100 {
101     return HeapFree(GetProcessHeap(), 0, mem);
102 }
103
104 static inline LPWSTR strdupAtoW(LPCSTR str)
105 {
106     LPWSTR ret;
107     DWORD len;
108
109     if(!str)
110         return NULL;
111
112     len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
113     ret = hhctrl_alloc(len*sizeof(WCHAR));
114     MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
115
116     return ret;
117 }
118
119 #endif