ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

hhctrl.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2005 James Hawkins
00003  * Copyright 2007 Jacek Caban for CodeWeavers
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2.1 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this library; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00018  */
00019 
00020 #ifndef HHCTRL_H
00021 #define HHCTRL_H
00022 
00023 #include <stdarg.h>
00024 
00025 #define COBJMACROS
00026 
00027 #include "windef.h"
00028 #include "winbase.h"
00029 #include "winuser.h"
00030 #include "winnls.h"
00031 #include "htmlhelp.h"
00032 #include "ole2.h"
00033 #include "exdisp.h"
00034 #include "mshtmhst.h"
00035 #include "commctrl.h"
00036 
00037 #ifdef INIT_GUID
00038 #include "initguid.h"
00039 #endif
00040 
00041 #include "wine/itss.h"
00042 #include "wine/unicode.h"
00043 
00044 #define WB_GOBACK     0
00045 #define WB_GOFORWARD  1
00046 #define WB_GOHOME     2
00047 #define WB_SEARCH     3
00048 #define WB_REFRESH    4
00049 #define WB_STOP       5
00050 
00051 typedef struct {
00052     LPWSTR chm_file;
00053     LPWSTR chm_index;
00054 } ChmPath;
00055 
00056 typedef struct ContentItem {
00057     struct ContentItem *parent;
00058     struct ContentItem *child;
00059     struct ContentItem *next;
00060 
00061     HTREEITEM id;
00062 
00063     LPWSTR name;
00064     LPWSTR local;
00065     ChmPath merge;
00066 } ContentItem;
00067 
00068 typedef struct IndexSubItem {
00069     LPWSTR name;
00070     LPWSTR local;
00071 } IndexSubItem;
00072 
00073 typedef struct IndexItem {
00074     struct IndexItem *next;
00075 
00076     HTREEITEM id;
00077     LPWSTR keyword;
00078     ChmPath merge;
00079 
00080     int nItems;
00081     int itemFlags;
00082     int indentLevel;
00083     IndexSubItem *items;
00084 } IndexItem;
00085 
00086 typedef struct SearchItem {
00087     struct SearchItem *next;
00088 
00089     HTREEITEM id;
00090     LPWSTR title;
00091     LPWSTR filename;
00092 } SearchItem;
00093 
00094 typedef struct CHMInfo
00095 {
00096     IITStorage *pITStorage;
00097     IStorage *pStorage;
00098     WCHAR *szFile;
00099 
00100     IStream *strings_stream;
00101     char **strings;
00102     DWORD strings_size;
00103 
00104     WCHAR *defTopic;
00105     WCHAR *defTitle;
00106     WCHAR *defToc;
00107 } CHMInfo;
00108 
00109 #define TAB_CONTENTS   0
00110 #define TAB_INDEX      1
00111 #define TAB_SEARCH     2
00112 #define TAB_FAVORITES  3
00113 
00114 typedef struct {
00115     HWND hwnd;
00116     DWORD id;
00117 } HHTab;
00118 
00119 typedef struct {
00120     HWND hwndList;
00121     HWND hwndPopup;
00122     HWND hwndCallback;
00123 } IndexPopup;
00124 
00125 typedef struct {
00126     SearchItem *root;
00127     HWND hwndEdit;
00128     HWND hwndList;
00129     HWND hwndContainer;
00130 } SearchTab;
00131 
00132 typedef struct {
00133     IOleClientSite *client_site;
00134     IWebBrowser2 *web_browser;
00135     IOleObject *wb_object;
00136 
00137     HH_WINTYPEW WinType;
00138 
00139     LPWSTR pszType;
00140     LPWSTR pszCaption;
00141     LPWSTR pszToc;
00142     LPWSTR pszIndex;
00143     LPWSTR pszFile;
00144     LPWSTR pszHome;
00145     LPWSTR pszJump1;
00146     LPWSTR pszJump2;
00147     LPWSTR pszUrlJump1;
00148     LPWSTR pszUrlJump2;
00149     LPWSTR pszCustomTabs;
00150 
00151     CHMInfo *pCHMInfo;
00152     ContentItem *content;
00153     IndexItem *index;
00154     IndexPopup popup;
00155     SearchTab search;
00156     HWND hwndTabCtrl;
00157     HWND hwndSizeBar;
00158     HFONT hFont;
00159 
00160     HHTab tabs[TAB_FAVORITES+1];
00161     DWORD current_tab;
00162 } HHInfo;
00163 
00164 BOOL InitWebBrowser(HHInfo*,HWND);
00165 void ReleaseWebBrowser(HHInfo*);
00166 void ResizeWebBrowser(HHInfo*,DWORD,DWORD);
00167 void DoPageAction(HHInfo*,DWORD);
00168 
00169 void InitContent(HHInfo*);
00170 void ReleaseContent(HHInfo*);
00171 
00172 void InitIndex(HHInfo*);
00173 void ReleaseIndex(HHInfo*);
00174 
00175 CHMInfo *OpenCHM(LPCWSTR szFile);
00176 BOOL LoadWinTypeFromCHM(HHInfo *info);
00177 CHMInfo *CloseCHM(CHMInfo *pCHMInfo);
00178 void SetChmPath(ChmPath*,LPCWSTR,LPCWSTR);
00179 IStream *GetChmStream(CHMInfo*,LPCWSTR,ChmPath*);
00180 LPWSTR FindContextAlias(CHMInfo*,DWORD);
00181 
00182 HHInfo *CreateHelpViewer(LPCWSTR);
00183 void ReleaseHelpViewer(HHInfo*);
00184 BOOL NavigateToUrl(HHInfo*,LPCWSTR);
00185 BOOL NavigateToChm(HHInfo*,LPCWSTR,LPCWSTR);
00186 
00187 void InitSearch(HHInfo *info, const char *needle);
00188 void ReleaseSearch(HHInfo *info);
00189 
00190 /* memory allocation functions */
00191 
00192 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
00193 {
00194     return HeapAlloc(GetProcessHeap(), 0, len);
00195 }
00196 
00197 static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
00198 {
00199     return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
00200 }
00201 
00202 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
00203 {
00204     return HeapReAlloc(GetProcessHeap(), 0, mem, len);
00205 }
00206 
00207 static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
00208 {
00209     return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
00210 }
00211 
00212 static inline BOOL heap_free(void *mem)
00213 {
00214     return HeapFree(GetProcessHeap(), 0, mem);
00215 }
00216 
00217 static inline LPWSTR strdupW(LPCWSTR str)
00218 {
00219     LPWSTR ret;
00220     int size;
00221 
00222     if(!str)
00223         return NULL;
00224 
00225     size = (strlenW(str)+1)*sizeof(WCHAR);
00226     ret = heap_alloc(size);
00227     memcpy(ret, str, size);
00228 
00229     return ret;
00230 }
00231 
00232 static inline LPWSTR strdupnAtoW(LPCSTR str, LONG lenA)
00233 {
00234     LPWSTR ret;
00235     DWORD len;
00236 
00237     if(!str)
00238         return NULL;
00239 
00240     if (lenA > 0)
00241     {
00242         /* find length of string */
00243         LPCSTR eos = memchr(str, 0, lenA);
00244     if (eos) lenA = eos - str;
00245     }
00246 
00247     len = MultiByteToWideChar(CP_ACP, 0, str, lenA, NULL, 0)+1; /* +1 for null pad */
00248     ret = heap_alloc(len*sizeof(WCHAR));
00249     MultiByteToWideChar(CP_ACP, 0, str, lenA, ret, len);
00250     ret[len-1] = 0;
00251 
00252     return ret;
00253 }
00254 
00255 static inline LPWSTR strdupAtoW(LPCSTR str)
00256 {
00257     return strdupnAtoW(str, -1);
00258 }
00259 
00260 
00261 
00262 extern HINSTANCE hhctrl_hinstance;
00263 extern BOOL hh_process;
00264 
00265 #endif

Generated on Sat May 26 2012 04:22:22 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.