hhctrl.ocx: Move more code from doWinMain.
[wine/multimedia.git] / dlls / hhctrl.ocx / hhctrl.h
blob5d2bb0f0c8db890e9a0ed9c1c08172d0afef8c03
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"
36 #ifdef INIT_GUID
37 #include "initguid.h"
38 #endif
40 #include "wine/itss.h"
41 #include "wine/unicode.h"
43 #define WB_GOBACK 0
44 #define WB_GOFORWARD 1
45 #define WB_GOHOME 2
46 #define WB_SEARCH 3
47 #define WB_REFRESH 4
48 #define WB_STOP 5
50 typedef struct CHMInfo
52 IITStorage *pITStorage;
53 IStorage *pStorage;
54 LPCWSTR szFile;
56 IStream *strings_stream;
57 char **strings;
58 DWORD strings_size;
59 } CHMInfo;
62 typedef struct {
63 IOleClientSite *client_site;
64 IWebBrowser2 *web_browser;
65 IOleObject *wb_object;
67 HH_WINTYPEW WinType;
68 CHMInfo *pCHMInfo;
69 HWND hwndTabCtrl;
70 HWND hwndSizeBar;
71 HFONT hFont;
72 } HHInfo;
74 BOOL InitWebBrowser(HHInfo*,HWND);
75 void ReleaseWebBrowser(HHInfo*);
76 void ResizeWebBrowser(HHInfo*,DWORD,DWORD);
77 void DoPageAction(HHInfo*,DWORD);
79 CHMInfo *OpenCHM(LPCWSTR szFile);
80 BOOL LoadWinTypeFromCHM(CHMInfo *pCHMInfo, HH_WINTYPEW *pHHWinType);
81 CHMInfo *CloseCHM(CHMInfo *pCHMInfo);
83 /* memory allocation functions */
85 static inline void *hhctrl_alloc(size_t len)
87 return HeapAlloc(GetProcessHeap(), 0, len);
90 static inline void *hhctrl_alloc_zero(size_t len)
92 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
95 static inline void *hhctrl_realloc(void *mem, size_t len)
97 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
100 static inline void *hhctrl_realloc_zero(void *mem, size_t len)
102 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
105 static inline BOOL hhctrl_free(void *mem)
107 return HeapFree(GetProcessHeap(), 0, mem);
110 static inline LPWSTR strdupW(LPCWSTR str)
112 LPWSTR ret;
113 int size;
115 if(!str)
116 return NULL;
118 size = (strlenW(str)+1)*sizeof(WCHAR);
119 ret = hhctrl_alloc(size);
120 memcpy(ret, str, size);
122 return ret;
125 static inline LPWSTR strdupAtoW(LPCSTR str)
127 LPWSTR ret;
128 DWORD len;
130 if(!str)
131 return NULL;
133 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
134 ret = hhctrl_alloc(len*sizeof(WCHAR));
135 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
137 return ret;
140 extern HINSTANCE hhctrl_hinstance;
142 #endif