Author: gadamopoulos
Date: Tue Jun 27 10:05:59 2017
New Revision: 75216
URL:
http://svn.reactos.org/svn/reactos?rev=75216&view=rev
Log:
[BROWSEUI] -CBandSite: Implement the context menu of the rebar. It queries the
IContextMenu if the band and appends to it a static menu part that can show or hide the
title and close the toolbar. Showing or hiding the title isn't implemented yet.
Modified:
trunk/reactos/dll/win32/browseui/lang/bg-BG.rc
trunk/reactos/dll/win32/browseui/lang/de-DE.rc
trunk/reactos/dll/win32/browseui/lang/en-US.rc
trunk/reactos/dll/win32/browseui/lang/es-ES.rc
trunk/reactos/dll/win32/browseui/lang/fr-FR.rc
trunk/reactos/dll/win32/browseui/lang/he-IL.rc
trunk/reactos/dll/win32/browseui/lang/it-IT.rc
trunk/reactos/dll/win32/browseui/lang/ja-JP.rc
trunk/reactos/dll/win32/browseui/lang/pl-PL.rc
trunk/reactos/dll/win32/browseui/lang/pt-BR.rc
trunk/reactos/dll/win32/browseui/lang/ro-RO.rc
trunk/reactos/dll/win32/browseui/lang/ru-RU.rc
trunk/reactos/dll/win32/browseui/lang/sq-AL.rc
trunk/reactos/dll/win32/browseui/lang/tr-TR.rc
trunk/reactos/dll/win32/browseui/lang/uk-UA.rc
trunk/reactos/dll/win32/browseui/lang/zh-CN.rc
trunk/reactos/dll/win32/browseui/lang/zh-TW.rc
trunk/reactos/dll/win32/browseui/resource.h
trunk/reactos/dll/win32/browseui/shellbars/CBandSite.cpp
trunk/reactos/dll/win32/browseui/shellbars/CBandSite.h
trunk/reactos/dll/win32/browseui/shellbars/shellbars.h
Modified: trunk/reactos/dll/win32/browseui/lang/bg-BG.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/lang/bg…
==============================================================================
--- trunk/reactos/dll/win32/browseui/lang/bg-BG.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/lang/bg-BG.rc [iso-8859-1] Tue Jun 27 10:05:59 2017
@@ -87,6 +87,12 @@
END
END
+IDM_BAND_MENU MENUEX
+BEGIN
+ MENUITEM "Sho&w title", IDM_BAND_TITLE
+ MENUITEM "&Close toolbar", IDM_BAND_CLOSE
+END
+
/* Dialogs */
IDD_PROGRESS_DLG DIALOGEX 0, 0, 260, 85
Modified: trunk/reactos/dll/win32/browseui/lang/de-DE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/lang/de…
==============================================================================
--- trunk/reactos/dll/win32/browseui/lang/de-DE.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/lang/de-DE.rc [iso-8859-1] Tue Jun 27 10:05:59 2017
@@ -105,6 +105,12 @@
END
END
+IDM_BAND_MENU MENUEX
+BEGIN
+ MENUITEM "Sho&w title", IDM_BAND_TITLE
+ MENUITEM "&Close toolbar", IDM_BAND_CLOSE
+END
+
/* Dialogs */
IDD_PROGRESS_DLG DIALOGEX 0, 0, 260, 85
Modified: trunk/reactos/dll/win32/browseui/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/lang/en…
==============================================================================
--- trunk/reactos/dll/win32/browseui/lang/en-US.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/lang/en-US.rc [iso-8859-1] Tue Jun 27 10:05:59 2017
@@ -105,6 +105,12 @@
END
END
+IDM_BAND_MENU MENUEX
+BEGIN
+ MENUITEM "Sho&w title", IDM_BAND_TITLE
+ MENUITEM "&Close toolbar", IDM_BAND_CLOSE
+END
+
/* Dialogs */
IDD_PROGRESS_DLG DIALOGEX 0, 0, 260, 85
Modified: trunk/reactos/dll/win32/browseui/lang/es-ES.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/lang/es…
==============================================================================
--- trunk/reactos/dll/win32/browseui/lang/es-ES.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/lang/es-ES.rc [iso-8859-1] Tue Jun 27 10:05:59 2017
@@ -89,6 +89,12 @@
END
END
+IDM_BAND_MENU MENUEX
+BEGIN
+ MENUITEM "Sho&w title", IDM_BAND_TITLE
+ MENUITEM "&Close toolbar", IDM_BAND_CLOSE
+END
+
/* Dialogs */
IDD_PROGRESS_DLG DIALOGEX 0, 0, 260, 85
Modified: trunk/reactos/dll/win32/browseui/lang/fr-FR.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/lang/fr…
==============================================================================
--- trunk/reactos/dll/win32/browseui/lang/fr-FR.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/lang/fr-FR.rc [iso-8859-1] Tue Jun 27 10:05:59 2017
@@ -105,6 +105,12 @@
END
END
+IDM_BAND_MENU MENUEX
+BEGIN
+ MENUITEM "Sho&w title", IDM_BAND_TITLE
+ MENUITEM "&Close toolbar", IDM_BAND_CLOSE
+END
+
/* Dialogs */
IDD_PROGRESS_DLG DIALOGEX 0, 0, 260, 85
Modified: trunk/reactos/dll/win32/browseui/lang/he-IL.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/lang/he…
==============================================================================
--- trunk/reactos/dll/win32/browseui/lang/he-IL.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/lang/he-IL.rc [iso-8859-1] Tue Jun 27 10:05:59 2017
@@ -89,6 +89,12 @@
END
END
+IDM_BAND_MENU MENUEX
+BEGIN
+ MENUITEM "Sho&w title", IDM_BAND_TITLE
+ MENUITEM "&Close toolbar", IDM_BAND_CLOSE
+END
+
/* Dialogs */
IDD_PROGRESS_DLG DIALOGEX 0, 0, 260, 85
Modified: trunk/reactos/dll/win32/browseui/lang/it-IT.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/lang/it…
==============================================================================
--- trunk/reactos/dll/win32/browseui/lang/it-IT.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/lang/it-IT.rc [iso-8859-1] Tue Jun 27 10:05:59 2017
@@ -87,6 +87,12 @@
END
END
+IDM_BAND_MENU MENUEX
+BEGIN
+ MENUITEM "Sho&w title", IDM_BAND_TITLE
+ MENUITEM "&Close toolbar", IDM_BAND_CLOSE
+END
+
/* Dialogs */
IDD_PROGRESS_DLG DIALOGEX 0, 0, 260, 85
Modified: trunk/reactos/dll/win32/browseui/lang/ja-JP.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/lang/ja…
==============================================================================
--- trunk/reactos/dll/win32/browseui/lang/ja-JP.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/lang/ja-JP.rc [iso-8859-1] Tue Jun 27 10:05:59 2017
@@ -105,6 +105,12 @@
END
END
+IDM_BAND_MENU MENUEX
+BEGIN
+ MENUITEM "Sho&w title", IDM_BAND_TITLE
+ MENUITEM "&Close toolbar", IDM_BAND_CLOSE
+END
+
/* Dialogs */
IDD_PROGRESS_DLG DIALOGEX 0, 0, 260, 85
Modified: trunk/reactos/dll/win32/browseui/lang/pl-PL.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/lang/pl…
==============================================================================
--- trunk/reactos/dll/win32/browseui/lang/pl-PL.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/lang/pl-PL.rc [iso-8859-1] Tue Jun 27 10:05:59 2017
@@ -95,6 +95,12 @@
END
END
+IDM_BAND_MENU MENUEX
+BEGIN
+ MENUITEM "Sho&w title", IDM_BAND_TITLE
+ MENUITEM "&Close toolbar", IDM_BAND_CLOSE
+END
+
/* Dialogs */
IDD_PROGRESS_DLG DIALOGEX 0, 0, 260, 85
Modified: trunk/reactos/dll/win32/browseui/lang/pt-BR.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/lang/pt…
==============================================================================
--- trunk/reactos/dll/win32/browseui/lang/pt-BR.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/lang/pt-BR.rc [iso-8859-1] Tue Jun 27 10:05:59 2017
@@ -89,6 +89,12 @@
END
END
+IDM_BAND_MENU MENUEX
+BEGIN
+ MENUITEM "Sho&w title", IDM_BAND_TITLE
+ MENUITEM "&Close toolbar", IDM_BAND_CLOSE
+END
+
/* Dialogs */
IDD_PROGRESS_DLG DIALOGEX 0, 0, 260, 85
Modified: trunk/reactos/dll/win32/browseui/lang/ro-RO.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/lang/ro…
==============================================================================
--- trunk/reactos/dll/win32/browseui/lang/ro-RO.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/lang/ro-RO.rc [iso-8859-1] Tue Jun 27 10:05:59 2017
@@ -89,6 +89,12 @@
END
END
+IDM_BAND_MENU MENUEX
+BEGIN
+ MENUITEM "Sho&w title", IDM_BAND_TITLE
+ MENUITEM "&Close toolbar", IDM_BAND_CLOSE
+END
+
/* Dialogs */
IDD_PROGRESS_DLG DIALOGEX 0, 0, 260, 85
Modified: trunk/reactos/dll/win32/browseui/lang/ru-RU.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/lang/ru…
==============================================================================
--- trunk/reactos/dll/win32/browseui/lang/ru-RU.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/lang/ru-RU.rc [iso-8859-1] Tue Jun 27 10:05:59 2017
@@ -89,6 +89,12 @@
END
END
+IDM_BAND_MENU MENUEX
+BEGIN
+ MENUITEM "Sho&w title", IDM_BAND_TITLE
+ MENUITEM "&Close toolbar", IDM_BAND_CLOSE
+END
+
/* Dialogs */
IDD_PROGRESS_DLG DIALOGEX 0, 0, 260, 85
Modified: trunk/reactos/dll/win32/browseui/lang/sq-AL.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/lang/sq…
==============================================================================
--- trunk/reactos/dll/win32/browseui/lang/sq-AL.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/lang/sq-AL.rc [iso-8859-1] Tue Jun 27 10:05:59 2017
@@ -106,6 +106,12 @@
END
END
+IDM_BAND_MENU MENUEX
+BEGIN
+ MENUITEM "Sho&w title", IDM_BAND_TITLE
+ MENUITEM "&Close toolbar", IDM_BAND_CLOSE
+END
+
/* Dialogs */
IDD_PROGRESS_DLG DIALOGEX 0, 0, 260, 85
Modified: trunk/reactos/dll/win32/browseui/lang/tr-TR.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/lang/tr…
==============================================================================
--- trunk/reactos/dll/win32/browseui/lang/tr-TR.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/lang/tr-TR.rc [iso-8859-1] Tue Jun 27 10:05:59 2017
@@ -89,6 +89,12 @@
END
END
+IDM_BAND_MENU MENUEX
+BEGIN
+ MENUITEM "Sho&w title", IDM_BAND_TITLE
+ MENUITEM "&Close toolbar", IDM_BAND_CLOSE
+END
+
/* Dialogs */
IDD_PROGRESS_DLG DIALOGEX 0, 0, 260, 85
Modified: trunk/reactos/dll/win32/browseui/lang/uk-UA.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/lang/uk…
==============================================================================
--- trunk/reactos/dll/win32/browseui/lang/uk-UA.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/lang/uk-UA.rc [iso-8859-1] Tue Jun 27 10:05:59 2017
@@ -89,6 +89,12 @@
END
END
+IDM_BAND_MENU MENUEX
+BEGIN
+ MENUITEM "Sho&w title", IDM_BAND_TITLE
+ MENUITEM "&Close toolbar", IDM_BAND_CLOSE
+END
+
/* Dialogs */
IDD_PROGRESS_DLG DIALOGEX 0, 0, 260, 85
Modified: trunk/reactos/dll/win32/browseui/lang/zh-CN.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/lang/zh…
==============================================================================
--- trunk/reactos/dll/win32/browseui/lang/zh-CN.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/lang/zh-CN.rc [iso-8859-1] Tue Jun 27 10:05:59 2017
@@ -107,6 +107,12 @@
END
END
+IDM_BAND_MENU MENUEX
+BEGIN
+ MENUITEM "Sho&w title", IDM_BAND_TITLE
+ MENUITEM "&Close toolbar", IDM_BAND_CLOSE
+END
+
/* Dialogs */
IDD_PROGRESS_DLG DIALOGEX 0, 0, 260, 85
Modified: trunk/reactos/dll/win32/browseui/lang/zh-TW.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/lang/zh…
==============================================================================
--- trunk/reactos/dll/win32/browseui/lang/zh-TW.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/lang/zh-TW.rc [iso-8859-1] Tue Jun 27 10:05:59 2017
@@ -107,6 +107,12 @@
END
END
+IDM_BAND_MENU MENUEX
+BEGIN
+ MENUITEM "Sho&w title", IDM_BAND_TITLE
+ MENUITEM "&Close toolbar", IDM_BAND_CLOSE
+END
+
/* Dialogs */
IDD_PROGRESS_DLG DIALOGEX 0, 0, 260, 85
Modified: trunk/reactos/dll/win32/browseui/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/resourc…
==============================================================================
--- trunk/reactos/dll/win32/browseui/resource.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/resource.h [iso-8859-1] Tue Jun 27 10:05:59 2017
@@ -59,6 +59,10 @@
#define IDM_TASKBAR_TOOLBARS_DESKTOP 3
#define IDM_TASKBAR_TOOLBARS_QUICKLAUNCH 4
#define IDM_TASKBAR_TOOLBARS_NEW 1
+
+#define IDM_BAND_MENU 269
+#define IDM_BAND_TITLE 0xA200
+#define IDM_BAND_CLOSE 0xA201
/* Random id for band close button, feel free to change it */
#define IDM_BASEBAR_CLOSE 0xA200
Modified: trunk/reactos/dll/win32/browseui/shellbars/CBandSite.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/shellba…
==============================================================================
--- trunk/reactos/dll/win32/browseui/shellbars/CBandSite.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/shellbars/CBandSite.cpp [iso-8859-1] Tue Jun 27
10:05:59 2017
@@ -221,6 +221,83 @@
return UpdateSingleBand(Band);
}
+HRESULT CBandSiteBase::OnContextMenu(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
LRESULT *plrResult)
+{
+ /* Find the index fo the band that was clicked */
+ int x = GET_X_LPARAM(lParam);
+ int y = GET_Y_LPARAM(lParam);
+
+ RBHITTESTINFO htInfo = {{x, y}};
+ ScreenToClient(fRebarWindow, &htInfo.pt);
+ int iBand = SendMessageW(fRebarWindow, RB_HITTEST, 0, (LPARAM)&htInfo);
+ if (iBand < 0)
+ {
+ /* FIXME: what to do here? */
+ return S_OK;
+ }
+
+ /* Now get the id of the band that was clicked */
+ REBARBANDINFOW bandInfo = {sizeof(bandInfo), RBBIM_ID};
+ SendMessageW(fRebarWindow, RB_GETBANDINFOW, htInfo.iBand, (LPARAM)&bandInfo);
+
+ /* Finally get the band */
+ DWORD dwBandID = bandInfo.wID;
+ struct BandObject *Band = GetBandByID(dwBandID);
+ if (Band == NULL)
+ return E_FAIL;
+
+ HMENU hMenu = CreatePopupMenu();
+ if (hMenu == NULL)
+ return E_OUTOFMEMORY;
+
+ /* Try to load the menu of the band */
+ UINT idBandLast = 0;
+ CComPtr<IContextMenu> pcm;
+ HRESULT hr = Band->DeskBand->QueryInterface(IID_PPV_ARG(IContextMenu,
&pcm));
+ if (SUCCEEDED(hr))
+ {
+ hr = pcm->QueryContextMenu(hMenu, 0, 0, UINT_MAX, CMF_NORMAL);
+ if (SUCCEEDED(hr))
+ {
+ idBandLast = HRESULT_CODE(hr);
+ }
+ }
+
+ /* Load the static part of the menu */
+ HMENU hMenuStatic = LoadMenuW(GetModuleHandleW(L"browseui.dll"),
MAKEINTRESOURCEW(IDM_BAND_MENU));
+ if (hMenuStatic)
+ Shell_MergeMenus(hMenu, hMenuStatic, UINT_MAX, 0, UINT_MAX, MM_DONTREMOVESEPS |
MM_SUBMENUSHAVEIDS);
+
+ EnableMenuItem(hMenu, IDM_BAND_TITLE, MF_GRAYED);
+ /* TODO: Show IDM_BAND_TITLE as checked if the band title is shown */
+
+ /* TODO: Query the menu of our site */
+
+ UINT uCommand = ::TrackPopupMenuEx(hMenu, TPM_RETURNCMD, x, y, fRebarWindow, NULL);
+ if (uCommand < idBandLast)
+ {
+ CMINVOKECOMMANDINFO cmi = { sizeof(cmi), 0, fRebarWindow,
MAKEINTRESOURCEA(uCommand)};
+ hr = pcm->InvokeCommand(&cmi);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+ }
+ else
+ {
+ if (uCommand == IDM_BAND_TITLE)
+ {
+ /* TODO: Implement showing or hiding the title */
+ }
+ else if(uCommand == IDM_BAND_CLOSE)
+ {
+ hr = RemoveBand(dwBandID);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+ }
+ }
+
+ return S_OK;
+}
+
struct CBandSiteBase::BandObject *CBandSiteBase::GetBandFromHwnd(HWND hwnd)
{
HRESULT hRet;
@@ -567,6 +644,15 @@
if (fRebarWindow == NULL)
return E_FAIL;
+ if (uMsg == WM_CONTEXTMENU)
+ {
+ HRESULT hr = OnContextMenu(hWnd, uMsg, wParam, lParam, plrResult);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
+
+ return S_OK;
+ }
+
if (hWnd == fRebarWindow)
{
/* FIXME: Just send the message? */
Modified: trunk/reactos/dll/win32/browseui/shellbars/CBandSite.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/shellba…
==============================================================================
--- trunk/reactos/dll/win32/browseui/shellbars/CBandSite.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/shellbars/CBandSite.h [iso-8859-1] Tue Jun 27
10:05:59 2017
@@ -120,6 +120,7 @@
HRESULT UpdateAllBands();
HRESULT UpdateBand(DWORD dwBandID);
struct BandObject *GetBandFromHwnd(HWND hwnd);
+ HRESULT OnContextMenu(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT
*plrResult);
BEGIN_COM_MAP(CBandSiteBase)
COM_INTERFACE_ENTRY_IID(IID_IBandSite, IBandSite)
Modified: trunk/reactos/dll/win32/browseui/shellbars/shellbars.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/shellba…
==============================================================================
--- trunk/reactos/dll/win32/browseui/shellbars/shellbars.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/shellbars/shellbars.h [iso-8859-1] Tue Jun 27
10:05:59 2017
@@ -33,4 +33,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(browseui);
+#define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
+#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
+
#endif /* _BROWSEUI_PCH_ */