mirror of
https://github.com/reactos/reactos.git
synced 2025-06-11 04:47:22 +00:00
[BROWSEUI]
* Remove the unwanted "(Empty)" item from the static menu, the SF menu will add its own if needed. [RSHELL] * Load the "(Empty)" string from shell32 resources. [SHELL32] * Add the string resource for empty menus. svn path=/branches/shell-experiments/; revision=65389
This commit is contained in:
parent
4f5c586905
commit
cd35aef5ab
7 changed files with 58 additions and 19 deletions
|
@ -1345,8 +1345,7 @@ DefSize:
|
||||||
/* Make sure the height is at least the size of a caption icon. */
|
/* Make sure the height is at least the size of a caption icon. */
|
||||||
if (hIconStart != NULL)
|
if (hIconStart != NULL)
|
||||||
Size.cx += SmallIcon.cx + 4;
|
Size.cx += SmallIcon.cx + 4;
|
||||||
Size.cy = max(Size.cy,
|
Size.cy = max(Size.cy, SmallIcon.cy);
|
||||||
SmallIcon.cy);
|
|
||||||
|
|
||||||
/* Create the bitmap */
|
/* Create the bitmap */
|
||||||
hbmp = CreateCompatibleBitmap(hDCScreen,
|
hbmp = CreateCompatibleBitmap(hDCScreen,
|
||||||
|
|
|
@ -132,7 +132,7 @@ HRESULT STDMETHODCALLTYPE CMenuBand::SetMenu(
|
||||||
|
|
||||||
BOOL created = FALSE;
|
BOOL created = FALSE;
|
||||||
|
|
||||||
if (m_hmenu)
|
if (m_hmenu && m_hmenu != hmenu)
|
||||||
{
|
{
|
||||||
DestroyMenu(m_hmenu);
|
DestroyMenu(m_hmenu);
|
||||||
m_hmenu = NULL;
|
m_hmenu = NULL;
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
#include "CMenuBand.h"
|
#include "CMenuBand.h"
|
||||||
#include "CMenuToolbars.h"
|
#include "CMenuToolbars.h"
|
||||||
|
|
||||||
|
#define IDS_MENU_EMPTY 34561
|
||||||
|
|
||||||
#define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
|
#define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
|
||||||
#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
|
#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
|
||||||
|
|
||||||
|
@ -425,14 +427,19 @@ HRESULT CMenuToolbarBase::GetSizes(SIZE* pMinSize, SIZE* pMaxSize, SIZE* pIntegr
|
||||||
if (m_hasSizes)
|
if (m_hasSizes)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
|
TRACE("Sizes out of date, recalculating.\n");
|
||||||
|
|
||||||
if (!m_hWnd)
|
if (!m_hWnd)
|
||||||
|
{
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
// Obtain the ideal size, to be used as min and max
|
// Obtain the ideal size, to be used as min and max
|
||||||
AutoSize();
|
|
||||||
GetMaxSize(&m_idealSize);
|
GetMaxSize(&m_idealSize);
|
||||||
GetIdealSize((m_initFlags & SMINIT_VERTICAL) != 0, &m_idealSize);
|
GetIdealSize((m_initFlags & SMINIT_VERTICAL) != 0, &m_idealSize);
|
||||||
|
|
||||||
|
TRACE("Ideal Size: (%d, %d) for %d buttons\n", m_idealSize, GetButtonCount());
|
||||||
|
|
||||||
// Obtain the button size, to be used as the integral size
|
// Obtain the button size, to be used as the integral size
|
||||||
DWORD size = GetButtonSize();
|
DWORD size = GetButtonSize();
|
||||||
m_itemSize.cx = GET_X_LPARAM(size);
|
m_itemSize.cx = GET_X_LPARAM(size);
|
||||||
|
@ -1004,7 +1011,9 @@ HRESULT CMenuToolbarBase::AddSeparator(BOOL last)
|
||||||
HRESULT CMenuToolbarBase::AddPlaceholder()
|
HRESULT CMenuToolbarBase::AddPlaceholder()
|
||||||
{
|
{
|
||||||
TBBUTTON tbb = { 0 };
|
TBBUTTON tbb = { 0 };
|
||||||
PCWSTR MenuString = L"(Empty)"; // FIXME: Make localizable
|
WCHAR MenuString[128];
|
||||||
|
|
||||||
|
LoadStringW(GetModuleHandle(L"shell32.dll"), IDS_MENU_EMPTY, MenuString, _countof(MenuString));
|
||||||
|
|
||||||
tbb.fsState = 0;
|
tbb.fsState = 0;
|
||||||
tbb.fsStyle = 0;
|
tbb.fsStyle = 0;
|
||||||
|
@ -1131,6 +1140,8 @@ HRESULT CMenuStaticToolbar::SetMenu(
|
||||||
m_hwndMenu = hwnd;
|
m_hwndMenu = hwnd;
|
||||||
m_dwMenuFlags = dwFlags;
|
m_dwMenuFlags = dwFlags;
|
||||||
|
|
||||||
|
ClearToolbar();
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1340,6 +1351,9 @@ HRESULT CMenuSFToolbar::SetShellFolder(IShellFolder *psf, LPCITEMIDLIST pidlFold
|
||||||
m_idList = ILClone(pidlFolder);
|
m_idList = ILClone(pidlFolder);
|
||||||
m_hKey = hKey;
|
m_hKey = hKey;
|
||||||
m_dwMenuFlags = dwFlags;
|
m_dwMenuFlags = dwFlags;
|
||||||
|
|
||||||
|
ClearToolbar();
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -547,18 +547,19 @@ HRESULT STDMETHODCALLTYPE CMenuCallback::GetObject(LPSMDATA psmd, REFIID riid, v
|
||||||
if (psmd->uId != FCIDM_MENU_FAVORITES)
|
if (psmd->uId != FCIDM_MENU_FAVORITES)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
|
// create favorites menu
|
||||||
|
hResult = psmd->punk->QueryInterface(IID_PPV_ARG(IShellMenu, &parentMenu));
|
||||||
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
|
return hResult;
|
||||||
|
hResult = parentMenu->GetMenu(&parentHMenu, &ownerWindow, NULL);
|
||||||
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
|
return hResult;
|
||||||
|
favoritesHMenu = GetSubMenu(parentHMenu, 3);
|
||||||
|
if (favoritesHMenu == NULL)
|
||||||
|
return E_FAIL;
|
||||||
|
|
||||||
if (fFavoritesMenu.p == NULL)
|
if (fFavoritesMenu.p == NULL)
|
||||||
{
|
{
|
||||||
// create favorites menu
|
|
||||||
hResult = psmd->punk->QueryInterface(IID_PPV_ARG(IShellMenu, &parentMenu));
|
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
|
||||||
return hResult;
|
|
||||||
hResult = parentMenu->GetMenu(&parentHMenu, &ownerWindow, NULL);
|
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
|
||||||
return hResult;
|
|
||||||
favoritesHMenu = GetSubMenu(parentHMenu, 3);
|
|
||||||
if (favoritesHMenu == NULL)
|
|
||||||
return E_FAIL;
|
|
||||||
#if USE_CUSTOM_MENUBAND
|
#if USE_CUSTOM_MENUBAND
|
||||||
if (!hRShell)
|
if (!hRShell)
|
||||||
{
|
{
|
||||||
|
@ -586,9 +587,6 @@ HRESULT STDMETHODCALLTYPE CMenuCallback::GetObject(LPSMDATA psmd, REFIID riid, v
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
return hResult;
|
return hResult;
|
||||||
hResult = newMenu->Initialize(this, FCIDM_MENU_FAVORITES, -1, SMINIT_VERTICAL | SMINIT_CACHED);
|
hResult = newMenu->Initialize(this, FCIDM_MENU_FAVORITES, -1, SMINIT_VERTICAL | SMINIT_CACHED);
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
|
||||||
return hResult;
|
|
||||||
hResult = newMenu->SetMenu(favoritesHMenu, ownerWindow, SMSET_TOP | SMSET_DONTOWN);
|
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
return hResult;
|
return hResult;
|
||||||
|
|
||||||
|
@ -609,6 +607,10 @@ HRESULT STDMETHODCALLTYPE CMenuCallback::GetObject(LPSMDATA psmd, REFIID riid, v
|
||||||
fFavoritesMenu = newMenu;
|
fFavoritesMenu = newMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hResult = fFavoritesMenu->SetMenu(favoritesHMenu, ownerWindow, SMSET_TOP | SMSET_DONTOWN);
|
||||||
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
|
return hResult;
|
||||||
|
|
||||||
return fFavoritesMenu->QueryInterface(riid, ppvObject);
|
return fFavoritesMenu->QueryInterface(riid, ppvObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -794,7 +796,16 @@ HRESULT CInternetToolbar::CreateMenuBar(IShellMenu **pMenuBar)
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
return hResult;
|
return hResult;
|
||||||
|
|
||||||
hResult = menubar->SetMenu((HMENU) V_INTREF(&menuOut), ownerWindow, SMSET_DONTOWN);
|
HMENU hMenuBar = (HMENU) V_INTREF(&menuOut);
|
||||||
|
|
||||||
|
// FIXME: Figure out the proper way to do this.
|
||||||
|
HMENU hMenuFavs = GetSubMenu(hMenuBar, 3);
|
||||||
|
if (hMenuFavs)
|
||||||
|
{
|
||||||
|
DeleteMenu(hMenuFavs, IDM_FAVORITES_EMPTY, MF_BYCOMMAND);
|
||||||
|
}
|
||||||
|
|
||||||
|
hResult = menubar->SetMenu(hMenuBar, ownerWindow, SMSET_DONTOWN);
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
return hResult;
|
return hResult;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1874,6 +1874,17 @@ HRESULT STDMETHODCALLTYPE CShellBrowser::SetMenuSB(HMENU hmenuShared, HOLEMENU h
|
||||||
hResult = GetMenuBand(IID_PPV_ARG(IShellMenu, &shellMenu));
|
hResult = GetMenuBand(IID_PPV_ARG(IShellMenu, &shellMenu));
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
return hResult;
|
return hResult;
|
||||||
|
|
||||||
|
if (hmenuShared)
|
||||||
|
{
|
||||||
|
// FIXME: Figure out the proper way to do this.
|
||||||
|
HMENU hMenuFavs = GetSubMenu(hmenuShared, 3);
|
||||||
|
if (hMenuFavs)
|
||||||
|
{
|
||||||
|
DeleteMenu(hMenuFavs, IDM_FAVORITES_EMPTY, MF_BYCOMMAND);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
hResult = shellMenu->SetMenu(hmenuShared, m_hWnd, SMSET_DONTOWN);
|
hResult = shellMenu->SetMenu(hmenuShared, m_hWnd, SMSET_DONTOWN);
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
return hResult;
|
return hResult;
|
||||||
|
|
|
@ -798,4 +798,6 @@ BEGIN
|
||||||
IDS_BYTES_FORMAT "bytes"
|
IDS_BYTES_FORMAT "bytes"
|
||||||
IDS_UNKNOWN_APP "Unknown application"
|
IDS_UNKNOWN_APP "Unknown application"
|
||||||
IDS_EXE_DESCRIPTION "Description:"
|
IDS_EXE_DESCRIPTION "Description:"
|
||||||
|
|
||||||
|
IDS_MENU_EMPTY "(Empty)"
|
||||||
END
|
END
|
||||||
|
|
|
@ -202,6 +202,8 @@
|
||||||
#define IDS_DESCRIPTION 331
|
#define IDS_DESCRIPTION 331
|
||||||
#define IDS_COPY_OF 332
|
#define IDS_COPY_OF 332
|
||||||
|
|
||||||
|
#define IDS_MENU_EMPTY 34561
|
||||||
|
|
||||||
/* Note: those strings are referenced from the registry */
|
/* Note: those strings are referenced from the registry */
|
||||||
#define IDS_RECYCLEBIN_FOLDER_NAME 8964
|
#define IDS_RECYCLEBIN_FOLDER_NAME 8964
|
||||||
#define IDS_ADMINISTRATIVETOOLS 22982
|
#define IDS_ADMINISTRATIVETOOLS 22982
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue