Author: gadamopoulos
Date: Sun Feb 16 21:53:21 2014
New Revision: 62223
URL:
http://svn.reactos.org/svn/reactos?rev=62223&view=rev
Log:
[rshell]
- CMenuBand: Fix the size of the separators by setting iBitmap to 0 (which acts as the
width of the separator).
- CMenuDeskBar:
Create the window only in CMenuDeskBar::SetClient and not in SetSite.
Greatly simplify SetSite.
Make sure that WS_EX_TOPMOST isn't removed when we call SetWindowPos
Do not forward requests for the SID_SMenuPopup service to the taskbar as this causes the
menu band to capture the mouse for the taskbar and not the desk bar
Modified:
branches/shell-experiments/base/shell/rshell/CMenuBand.cpp
branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp
Modified: branches/shell-experiments/base/shell/rshell/CMenuBand.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuBand.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMenuBand.cpp [iso-8859-1] Sun Feb 16
21:53:21 2014
@@ -940,14 +940,14 @@
HRESULT CMenuStaticToolbar::FillToolbar()
{
int i;
- PWSTR MenuString;
-
int ic = GetMenuItemCount(m_hmenu);
for (i = 0; i < ic; i++)
{
MENUITEMINFOW info;
TBBUTTON tbb = { 0 };
+ PWSTR MenuString = NULL;
+
tbb.fsState = TBSTATE_ENABLED;
tbb.fsStyle = 0;
@@ -961,24 +961,24 @@
if (!AllocAndGetMenuString(m_hmenu, i, &MenuString))
return E_OUTOFMEMORY;
tbb.fsStyle |= BTNS_DROPDOWN;
+ tbb.iString = (INT_PTR) MenuString;
+ tbb.idCommand = info.wID;
+
+ SMINFO sminfo;
+ if (info.wID >= 0 &&
SUCCEEDED(m_menuBand->CallCBWithId(info.wID, SMC_GETINFO, 0, (LPARAM) &sminfo)))
+ {
+ tbb.iBitmap = sminfo.iIcon;
+ }
}
else
{
- MenuString = L"";
tbb.fsStyle |= BTNS_SEP;
}
- tbb.idCommand = info.wID;
- tbb.iString = (INT_PTR) MenuString;
-
- SMINFO sminfo;
- if (info.wID >= 0 && SUCCEEDED(m_menuBand->CallCBWithId(info.wID,
SMC_GETINFO, 0, (LPARAM) &sminfo)))
- {
- tbb.iBitmap = sminfo.iIcon;
- }
-
SendMessageW(m_hwnd, TB_ADDBUTTONS, 1, (LPARAM) (LPTBBUTTON) &tbb);
- HeapFree(GetProcessHeap(), 0, MenuString);
+
+ if (MenuString)
+ HeapFree(GetProcessHeap(), 0, MenuString);
}
return S_OK;
Modified: branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp [iso-8859-1] Sun Feb 16
21:53:21 2014
@@ -160,8 +160,6 @@
COM_INTERFACE_ENTRY_IID(IID_IBanneredBar, IBanneredBar)
COM_INTERFACE_ENTRY_IID(IID_IInitializeObject, IInitializeObject)
END_COM_MAP()
-
- HRESULT _CreateDeskBarWindow();
};
extern "C"
@@ -456,40 +454,6 @@
{
}
-HRESULT CMenuDeskBar::_CreateDeskBarWindow()
-{
- HRESULT hr;
- HWND ownerWindow = NULL;
-
- if (m_Site)
- {
- CComPtr<IOleWindow> oleWindow;
-
- hr = m_Site->QueryInterface(IID_IOleWindow, reinterpret_cast<void
**>(&oleWindow));
- if (FAILED(hr))
- return hr;
-
- hr = oleWindow->GetWindow(&ownerWindow);
- if (FAILED(hr))
- return hr;
-
- if (!::IsWindow(ownerWindow))
- return E_FAIL;
- }
-
- // FIXME
- if (m_hWnd)
- {
- SetWindowLongPtr(m_hWnd, GWLP_HWNDPARENT, (LONG_PTR)ownerWindow);
- }
- else
- {
- Create(ownerWindow);
- }
-
- return S_OK;
-}
-
HRESULT STDMETHODCALLTYPE CMenuDeskBar::GetWindow(HWND *lphwnd)
{
if (lphwnd == NULL)
@@ -547,6 +511,11 @@
if (m_Site == NULL)
return E_FAIL;
+ if (IsEqualGUID(guidService,SID_SMenuPopup))
+ {
+ return this->QueryInterface(riid, ppvObject);
+ }
+
return IUnknown_QueryService(m_Site, guidService, riid, ppvObject);
}
@@ -589,7 +558,7 @@
if (m_hWnd == NULL)
{
- _CreateDeskBarWindow();
+ Create(NULL);
}
hResult = punkClient->QueryInterface(IID_IUnknown, reinterpret_cast<void
**>(&m_Client));
@@ -623,30 +592,9 @@
HRESULT STDMETHODCALLTYPE CMenuDeskBar::SetSite(IUnknown *pUnkSite)
{
- HRESULT hr;
- CComPtr<IOleWindow> oleWindow;
- HWND ownerWindow = NULL;
-
- if (m_Site)
- {
- if (m_hWnd != NULL)
- {
- DestroyWindow();
- }
- m_Site.Release();
- }
-
- if (pUnkSite == NULL)
- {
- return S_OK;
- }
-
- // get window handle of parent
- hr = pUnkSite->QueryInterface(IID_PPV_ARG(IUnknown, &m_Site));
- if (FAILED(hr))
- return hr;
-
- return _CreateDeskBarWindow();
+ m_Site = pUnkSite;
+
+ return S_OK;
}
HRESULT STDMETHODCALLTYPE CMenuDeskBar::GetSite(REFIID riid, void **ppvSite)
@@ -822,7 +770,7 @@
int cx = rc.right;
int cy = rc.bottom;
- this->SetWindowPos(NULL, x, y, cx, cy, SWP_SHOWWINDOW);
+ this->SetWindowPos(HWND_TOPMOST, x, y, cx, cy, SWP_SHOWWINDOW);
// HACK: The bar needs to be notified of the size AFTER it is shown.
// Quick & dirty way of getting it done.