hhctrl.ocx: Implement pop-up menu for Options button.
diff --git a/dlls/hhctrl.ocx/help.c b/dlls/hhctrl.ocx/help.c
index 3dcad10..d8725b1 100644
--- a/dlls/hhctrl.ocx/help.c
+++ b/dlls/hhctrl.ocx/help.c
@@ -667,6 +667,52 @@
#define ICON_SIZE 20
+static void DisplayPopupMenu(HHInfo *info)
+{
+ HMENU menu, submenu;
+ TBBUTTONINFOW button;
+ MENUITEMINFOW item;
+ POINT coords;
+ RECT rect;
+ DWORD index;
+
+ menu = LoadMenuW(hhctrl_hinstance, MAKEINTRESOURCEW(MENU_POPUP));
+
+ if (!menu)
+ return;
+
+ submenu = GetSubMenu(menu, 0);
+
+ /* Update the Show/Hide menu item */
+ item.cbSize = sizeof(MENUITEMINFOW);
+ item.fMask = MIIM_STRING;
+
+ if (info->WinType.fNotExpanded)
+ item.dwTypeData = HH_LoadString(IDS_SHOWTABS);
+ else
+ item.dwTypeData = HH_LoadString(IDS_HIDETABS);
+
+ SetMenuItemInfoW(submenu, IDTB_EXPAND, FALSE, &item);
+ heap_free(item.dwTypeData);
+
+ /* Find the index toolbar button */
+ button.cbSize = sizeof(TBBUTTONINFOW);
+ button.dwMask = TBIF_COMMAND;
+ index = SendMessageW(info->WinType.hwndToolBar, TB_GETBUTTONINFOW, IDTB_OPTIONS, (LPARAM) &button);
+
+ if (index == -1)
+ return;
+
+ /* Get position */
+ SendMessageW(info->WinType.hwndToolBar, TB_GETITEMRECT, index, (LPARAM) &rect);
+
+ coords.x = rect.left;
+ coords.y = rect.bottom;
+
+ ClientToScreen(info->WinType.hwndToolBar, &coords);
+ TrackPopupMenu(submenu, TPM_LEFTALIGN | TPM_TOPALIGN | TPM_LEFTBUTTON | TPM_NOANIMATION, coords.x, coords.y, 0, info->WinType.hwndHelp, NULL);
+}
+
static void TB_OnClick(HWND hWnd, DWORD dwID)
{
HHInfo *info = (HHInfo *)GetWindowLongPtrW(hWnd, GWLP_USERDATA);
@@ -699,6 +745,8 @@
DoSync(info);
break;
case IDTB_OPTIONS:
+ DisplayPopupMenu(info);
+ break;
case IDTB_BROWSE_FWD:
case IDTB_BROWSE_BACK:
case IDTB_JUMP1:
diff --git a/dlls/hhctrl.ocx/hhctrl.rc b/dlls/hhctrl.ocx/hhctrl.rc
index 2b5e976..562a96b 100644
--- a/dlls/hhctrl.ocx/hhctrl.rc
+++ b/dlls/hhctrl.ocx/hhctrl.rc
@@ -2,6 +2,7 @@
* HTML Help resources
*
* Copyright 2005 James Hawkins
+ * Copyright 2011 Owen Rudge for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -28,6 +29,9 @@
IDS_INDEX "I&ndex"
IDS_SEARCH "&Search"
IDS_FAVORITES "Favor&ites"
+
+ IDS_HIDETABS "Hide &Tabs"
+ IDS_SHOWTABS "Show &Tabs"
END
STRINGTABLE
@@ -58,6 +62,21 @@
IDTB_TOC_PREV "IDTB_TOC_PREV"
END
+MENU_POPUP MENUEX
+{
+ POPUP "Options"
+ {
+ MENUITEM "", IDTB_EXPAND,
+ MENUITEM "S&ync", IDTB_SYNC
+ MENUITEM "&Back", IDTB_BACK
+ MENUITEM "&Forward", IDTB_FORWARD
+ MENUITEM "&Home", IDTB_HOME
+ MENUITEM "&Stop", IDTB_STOP
+ MENUITEM "&Refresh", IDTB_REFRESH
+ MENUITEM "&Print...", IDTB_PRINT
+ }
+}
+
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
/* @makedep: hhctrl_tlb.tlb */
diff --git a/dlls/hhctrl.ocx/resource.h b/dlls/hhctrl.ocx/resource.h
index a08fdd9..417fc88 100644
--- a/dlls/hhctrl.ocx/resource.h
+++ b/dlls/hhctrl.ocx/resource.h
@@ -27,3 +27,7 @@
#define IDS_INDEX 2
#define IDS_SEARCH 3
#define IDS_FAVORITES 4
+#define IDS_HIDETABS 5
+#define IDS_SHOWTABS 6
+
+#define MENU_POPUP 1