From fc413c70a5f4383bdd7e3c393c4429a8a712a5df Mon Sep 17 00:00:00 2001 From: Erich Hoover Date: Fri, 22 Jun 2012 11:07:19 -0600 Subject: [PATCH] hhctrl.ocx: Add icons for the table of contents TreeView control. --- dlls/hhctrl.ocx/Makefile.in | 4 +++- dlls/hhctrl.ocx/content.c | 5 +++- dlls/hhctrl.ocx/help.c | 41 +++++++++++++++++++++++++++++---- dlls/hhctrl.ocx/hhctrl.h | 5 ++++ dlls/hhctrl.ocx/hhctrl.rc | 3 +++ dlls/hhctrl.ocx/hhtreeview.bmp | Bin 0 -> 3194 bytes dlls/hhctrl.ocx/hhtreeview.svg | 18 +++++++++++++++ dlls/hhctrl.ocx/resource.h | 7 ++++++ 8 files changed, 76 insertions(+), 7 deletions(-) create mode 100644 dlls/hhctrl.ocx/hhtreeview.bmp create mode 100644 dlls/hhctrl.ocx/hhtreeview.svg diff --git a/dlls/hhctrl.ocx/Makefile.in b/dlls/hhctrl.ocx/Makefile.in index 05b3e35e28a..289cc391a1f 100644 --- a/dlls/hhctrl.ocx/Makefile.in +++ b/dlls/hhctrl.ocx/Makefile.in @@ -16,6 +16,8 @@ IDL_TLB_SRCS = hhctrl_tlb.idl RC_SRCS = hhctrl.rc PO_SRCS = hhctrl.rc -SVG_SRCS = hhtoolbar.svg +SVG_SRCS = \ + hhtoolbar.svg \ + hhtreeview.svg @MAKE_DLL_RULES@ diff --git a/dlls/hhctrl.ocx/content.c b/dlls/hhctrl.ocx/content.c index d246c49258e..28bda119b0b 100644 --- a/dlls/hhctrl.ocx/content.c +++ b/dlls/hhctrl.ocx/content.c @@ -22,6 +22,7 @@ #include "hhctrl.h" #include "stream.h" +#include "resource.h" #include "wine/debug.h" @@ -267,10 +268,12 @@ static void insert_content_item(HWND hwnd, ContentItem *parent, ContentItem *ite TVINSERTSTRUCTW tvis; memset(&tvis, 0, sizeof(tvis)); - tvis.u.item.mask = TVIF_TEXT|TVIF_PARAM; + tvis.u.item.mask = TVIF_TEXT|TVIF_PARAM|TVIF_IMAGE|TVIF_SELECTEDIMAGE; tvis.u.item.cchTextMax = strlenW(item->name)+1; tvis.u.item.pszText = item->name; tvis.u.item.lParam = (LPARAM)item; + tvis.u.item.iImage = item->child ? HHTV_FOLDER : HHTV_DOCUMENT; + tvis.u.item.iSelectedImage = item->child ? HHTV_FOLDER : HHTV_DOCUMENT; tvis.hParent = parent ? parent->id : 0; tvis.hInsertAfter = TVI_LAST; diff --git a/dlls/hhctrl.ocx/help.c b/dlls/hhctrl.ocx/help.c index ef41ec2b753..3acb024d299 100644 --- a/dlls/hhctrl.ocx/help.c +++ b/dlls/hhctrl.ocx/help.c @@ -707,6 +707,24 @@ static LRESULT CALLBACK Child_WndProc(HWND hWnd, UINT message, WPARAM wParam, LP return OnTabChange(hWnd); case TVN_SELCHANGEDW: return OnTopicChange(info, (void*)((NMTREEVIEWW *)lParam)->itemNew.lParam); + case TVN_ITEMEXPANDINGW: { + TVITEMW *item = &((NMTREEVIEWW *)lParam)->itemNew; + HWND hwndTreeView = info->tabs[TAB_CONTENTS].hwnd; + + item->mask = TVIF_IMAGE|TVIF_SELECTEDIMAGE; + if (item->state & TVIS_EXPANDED) + { + item->iImage = HHTV_FOLDER; + item->iSelectedImage = HHTV_FOLDER; + } + else + { + item->iImage = HHTV_OPENFOLDER; + item->iSelectedImage = HHTV_OPENFOLDER; + } + SendMessageW(hwndTreeView, TVM_SETITEMW, 0, (LPARAM)item); + return 0; + } case NM_DBLCLK: if(!info) return 0; @@ -1163,18 +1181,29 @@ static BOOL HH_AddHTMLPane(HHInfo *pHHInfo) static BOOL AddContentTab(HHInfo *info) { + HIMAGELIST hImageList; + HBITMAP hBitmap; + HWND hWnd; + if(info->tabs[TAB_CONTENTS].id == -1) return TRUE; /* No "Contents" tab */ - info->tabs[TAB_CONTENTS].hwnd = CreateWindowExW(WS_EX_CLIENTEDGE, WC_TREEVIEWW, - szEmpty, WS_CHILD | WS_BORDER | 0x25, 50, 50, 100, 100, - info->WinType.hwndNavigation, NULL, hhctrl_hinstance, NULL); - if(!info->tabs[TAB_CONTENTS].hwnd) { + hWnd = CreateWindowExW(WS_EX_CLIENTEDGE, WC_TREEVIEWW, szEmpty, WS_CHILD | WS_BORDER | TVS_LINESATROOT + | TVS_SHOWSELALWAYS | TVS_HASBUTTONS, 50, 50, 100, 100, + info->WinType.hwndNavigation, NULL, hhctrl_hinstance, NULL); + if(!hWnd) { ERR("Could not create treeview control\n"); return FALSE; } + hImageList = ImageList_Create(16, 16, ILC_COLOR32, 0, HHTV_NUMBITMAPS); + hBitmap = LoadBitmapW(hhctrl_hinstance, MAKEINTRESOURCEW(IDB_HHTREEVIEW)); + ImageList_Add(hImageList, hBitmap, NULL); + SendMessageW(hWnd, TVM_SETIMAGELIST, TVSIL_NORMAL, (LPARAM)hImageList); + + info->contents.hImageList = hImageList; + info->tabs[TAB_CONTENTS].hwnd = hWnd; ResizeTabChild(info, TAB_CONTENTS); - ShowWindow(info->tabs[TAB_CONTENTS].hwnd, SW_SHOW); + ShowWindow(hWnd, SW_SHOW); return TRUE; } @@ -1729,6 +1758,8 @@ void ReleaseHelpViewer(HHInfo *info) ReleaseIndex(info); ReleaseSearch(info); + if(info->contents.hImageList) + ImageList_Destroy(info->contents.hImageList); if(info->WinType.hwndHelp) DestroyWindow(info->WinType.hwndHelp); diff --git a/dlls/hhctrl.ocx/hhctrl.h b/dlls/hhctrl.ocx/hhctrl.h index 73b2a6b216d..eea7f7f982b 100644 --- a/dlls/hhctrl.ocx/hhctrl.h +++ b/dlls/hhctrl.ocx/hhctrl.h @@ -134,6 +134,10 @@ typedef struct { HWND hwndContainer; } SearchTab; +typedef struct { + HIMAGELIST hImageList; +} ContentsTab; + typedef struct { IOleClientSite *client_site; IWebBrowser2 *web_browser; @@ -158,6 +162,7 @@ typedef struct { IndexItem *index; IndexPopup popup; SearchTab search; + ContentsTab contents; HWND hwndTabCtrl; HWND hwndSizeBar; HFONT hFont; diff --git a/dlls/hhctrl.ocx/hhctrl.rc b/dlls/hhctrl.ocx/hhctrl.rc index 4ec8fe9d0d0..a9ccee21c90 100644 --- a/dlls/hhctrl.ocx/hhctrl.rc +++ b/dlls/hhctrl.ocx/hhctrl.rc @@ -76,3 +76,6 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL /* @makedep: hhtoolbar.bmp */ IDB_HHTOOLBAR BITMAP hhtoolbar.bmp + +/* @makedep: hhtreeview.bmp */ +IDB_HHTREEVIEW BITMAP hhtreeview.bmp diff --git a/dlls/hhctrl.ocx/hhtreeview.bmp b/dlls/hhctrl.ocx/hhtreeview.bmp new file mode 100644 index 0000000000000000000000000000000000000000..b8e262c0e5e576ebc57d1420c5ecaa0ad3561654 GIT binary patch literal 3194 zcmc(h-A|ik7{M_ zsHPMs&@W1%VYF+Z*bTDssg5{4#-MYEP^6SkGp7T+z3-X=DSDDDp?AaO&VH?T&LSxcxsL zUO4w|t0^xDPE5Xd%~Bva^Wpik))Q+Z&-Mg^O$RSHH8pkdn;Hd} zKYjzepS^!+5GUxaL=5N-*>SQ0&bN}IRIGX?A9&rD(KkPpvBV)y6He(ja zuy+48`qIOrejNndTFkK?=AB=`!`^E!=ePu$Fj`uqD~U|;~++uH#>+jxG7 z^i-4A>jlb{*7Avo2^bt41nk)!*Yo_zzu)g?_r~f&y!^|`%C_kKo}M1)?(PP=-OlPD z-?g>1Pmo=WMiZs7vhw$$qM~a4{CIlGLZwpuCYQ_i@&5h7!a@etzK=Ceay|D?SyK(d zJ_vh3Yf`N7qfjWe$H&LnZywb_84xa)3(CvOCrV38Q#j})rKF@poSB))UP;MAJbiC( zFH}@ie2ev-=H%w)o+eNheLdy=*}{Iz57O}ZF(ZRgsSL+p3B8H=eew2*^jLp#JRQG| T?_OQx=Ok2BRb_Gg|GobQdgPJi literal 0 HcmV?d00001 diff --git a/dlls/hhctrl.ocx/hhtreeview.svg b/dlls/hhctrl.ocx/hhtreeview.svg new file mode 100644 index 00000000000..6b8517fdcd7 --- /dev/null +++ b/dlls/hhctrl.ocx/hhtreeview.svg @@ -0,0 +1,18 @@ + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/dlls/hhctrl.ocx/resource.h b/dlls/hhctrl.ocx/resource.h index 560a0c3a662..0faa9da9320 100644 --- a/dlls/hhctrl.ocx/resource.h +++ b/dlls/hhctrl.ocx/resource.h @@ -41,3 +41,10 @@ #define HHTB_CONTRACT 4 #define HHTB_EXPAND 5 #define HHTB_NUMBITMAPS HHTB_EXPAND + +#define IDB_HHTREEVIEW 1001 +/* IDB_HHTREEVIEW bitmaps: */ +#define HHTV_DOCUMENT 0 +#define HHTV_FOLDER 1 +#define HHTV_OPENFOLDER 2 +#define HHTV_NUMBITMAPS HHTV_OPENFOLDER