Author: dquintana
Date: Mon Feb 17 16:41:10 2014
New Revision: 62228
URL:
http://svn.reactos.org/svn/reactos?rev=62228&view=rev
Log:
[RSHELL]
* CMenuBand: Implement PopupItem for static menus.
* CMenuDeskBar: Initialize m_Banner.
* CStartMenu: Create CSubMenu_Constructor function that creates submenus (needs a better
name/location).
* Misc. code style changes.
CORE-7881
Modified:
branches/shell-experiments/base/shell/rshell/CMenuBand.cpp
branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp
branches/shell-experiments/base/shell/rshell/CStartMenu.cpp
branches/shell-experiments/base/shell/rshell/precomp.h
branches/shell-experiments/base/shell/rshell/wraplog.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] Mon Feb 17
16:41:10 2014
@@ -44,7 +44,7 @@
HRESULT GetWindow(HWND *phwnd);
HRESULT ShowWindow(BOOL fShow);
HRESULT Close();
-
+
BOOL IsWindowOwner(HWND hwnd) { return m_hwnd && m_hwnd == hwnd; }
virtual HRESULT FillToolbar() = 0;
@@ -897,7 +897,7 @@
}
SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LONG_PTR)this);
- m_SubclassOld = (WNDPROC)SetWindowLongPtr(m_hwnd, GWLP_WNDPROC,
(LONG_PTR)CMenuToolbarBase::s_SubclassProc);
+ m_SubclassOld = (WNDPROC) SetWindowLongPtr(m_hwnd, GWLP_WNDPROC, (LONG_PTR)
CMenuToolbarBase::s_SubclassProc);
return S_OK;
}
@@ -1030,7 +1030,7 @@
tbb.fsStyle |= BTNS_WHOLEDROPDOWN;
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)))
{
@@ -1067,10 +1067,27 @@
return E_FAIL;
if (!SendMessage(m_hwnd, TB_GETITEMRECT, index, (LPARAM) &rc))
return E_FAIL;
- int px = rc.right;
- int py = rc.bottom;
-
- // TODO: Create popup CMenuDeskBar
+
+ POINT a = { rc.left, rc.top };
+ POINT b = { rc.right, rc.bottom };
+
+ ClientToScreen(m_hwnd, &a);
+ ClientToScreen(m_hwnd, &b);
+
+ POINTL pt = { b.x, b.y };
+ RECTL rcl = { a.x, a.y, b.x, b.y }; // maybe-TODO: fetch client area of deskbar?
+
+ CComPtr<IShellMenu> shellMenu;
+ HRESULT hr = m_menuBand->CallCBWithId(uItem, SMC_GETOBJECT, (WPARAM)
&IID_IShellMenu, (LPARAM) &shellMenu);
+ if (FAILED(hr))
+ return hr;
+
+ CComPtr<IMenuPopup> popup;
+ hr = CSubMenu_Constructor(shellMenu, IID_PPV_ARG(IMenuPopup, &popup));
+ if (FAILED(hr))
+ return hr;
+
+ popup->Popup(&pt, &rcl, MPPF_TOP | MPPF_RIGHT);
return S_OK;
}
@@ -1179,7 +1196,7 @@
}
HRESULT CMenuSFToolbar::OnCommand(WPARAM wParam, LPARAM lParam, LRESULT *theResult)
{
-// return m_menuBand->CallCBWithPidl(GetPidlFromId(wParam), SMC_SFEXEC, 0, 0);
+ // TODO: return m_menuBand->CallCBWithPidl(GetPidlFromId(wParam), SMC_SFEXEC, 0,
0);
return S_OK;
}
@@ -1951,5 +1968,4 @@
smData.psf->Release();
return hr;
}
-
#endif
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] Mon Feb 17
16:41:10 2014
@@ -446,7 +446,8 @@
m_Vertical(true),
m_Visible(false),
m_NeededSize(200),
- m_Tracking(false)
+ m_Tracking(false),
+ m_Banner(NULL)
{
}
Modified: branches/shell-experiments/base/shell/rshell/CStartMenu.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CStartMenu.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CStartMenu.cpp [iso-8859-1] Mon Feb 17
16:41:10 2014
@@ -125,10 +125,14 @@
case IDM_DOCUMENTS: csidl = CSIDL_RECENT; break;
}
+#if 0
hr = CoCreateInstance(CLSID_MenuBand,
- NULL,
- CLSCTX_INPROC_SERVER,
- IID_PPV_ARG(IShellMenu,&pShellMenu));
+ NULL,
+ CLSCTX_INPROC_SERVER,
+ IID_PPV_ARG(IShellMenu, &pShellMenu));
+#else
+ hr = CMenuBand_Constructor(IID_PPV_ARG(IShellMenu, &pShellMenu));
+#endif
hr = pShellMenu->Initialize(this, 0, ANCESTORDEFAULT, SMINIT_VERTICAL);
@@ -252,7 +256,6 @@
IShellMenu* pShellMenu;
IBandSite* pBandSite;
IDeskBar* pDeskBar;
- IShellMenuCallback* callback;
LPITEMIDLIST pidlStartMenu;
HRESULT hr;
@@ -268,7 +271,7 @@
hr = CMenuBand_Constructor(IID_PPV_ARG(IShellMenu, &pShellMenu));
#endif
if (FAILED(hr))
- return NULL;
+ return hr;
#if 0
hr = CoCreateInstance(CLSID_MenuBandSite,
@@ -279,7 +282,7 @@
hr = CMenuSite_Constructor(IID_PPV_ARG(IBandSite, &pBandSite));
#endif
if (FAILED(hr))
- return NULL;
+ return hr;
#if 0
hr = CoCreateInstance(CLSID_MenuDeskBar,
@@ -290,23 +293,18 @@
hr = CMenuDeskBar_Constructor(IID_PPV_ARG(IDeskBar, &pDeskBar));
#endif
if (FAILED(hr))
- return NULL;
+ return hr;
CComObject<CShellMenuCallback> *pCallback;
hr = CComObject<CShellMenuCallback>::CreateInstance(&pCallback);
if (FAILED(hr))
- return FALSE;
+ return hr;
pCallback->AddRef(); // CreateInstance returns object with 0 ref count */
pCallback->Initialize(pShellMenu, pBandSite, pDeskBar);
- callback = pCallback;
-
- hr = CShellMenuCallback::_CreatorClass::CreateInstance(NULL,
IID_PPV_ARG(IShellMenuCallback, &callback));
- if (FAILED(hr))
- return NULL;
pShellMenu->Initialize(pCallback, -1, 0, SMINIT_TOPLEVEL | SMINIT_VERTICAL);
if (FAILED(hr))
- return NULL;
+ return hr;
/* FIXME: Use CLSID_MergedFolder class and IID_IAugmentedShellFolder2 interface here
*/
/* CLSID_MergedFolder 26fdc864-be88-46e7-9235-032d8ea5162e */
@@ -319,11 +317,53 @@
hr = pDeskBar->SetClient(pBandSite);
if (FAILED(hr))
- return NULL;
+ return hr;
hr = pBandSite->AddBand(pShellMenu);
if (FAILED(hr))
- return NULL;
+ return hr;
return pDeskBar->QueryInterface(riid, ppv);
}
+
+extern "C"
+HRESULT
+CSubMenu_Constructor(IShellMenu * pShellMenu, REFIID riid, void **ppv)
+{
+ IBandSite* pBandSite;
+ IDeskBar* pDeskBar;
+
+ HRESULT hr;
+
+#if 0
+ hr = CoCreateInstance(CLSID_MenuBandSite,
+ NULL,
+ CLSCTX_INPROC_SERVER,
+ IID_PPV_ARG(IBandSite, &pBandSite));
+#else
+ hr = CMenuSite_Constructor(IID_PPV_ARG(IBandSite, &pBandSite));
+#endif
+ if (FAILED(hr))
+ return hr;
+
+#if 0
+ hr = CoCreateInstance(CLSID_MenuDeskBar,
+ NULL,
+ CLSCTX_INPROC_SERVER,
+ IID_PPV_ARG(IDeskBar, &pDeskBar));
+#else
+ hr = CMenuDeskBar_Constructor(IID_PPV_ARG(IDeskBar, &pDeskBar));
+#endif
+ if (FAILED(hr))
+ return hr;
+
+ hr = pDeskBar->SetClient(pBandSite);
+ if (FAILED(hr))
+ return hr;
+
+ hr = pBandSite->AddBand(pShellMenu);
+ if (FAILED(hr))
+ return hr;
+
+ return pDeskBar->QueryInterface(riid, ppv);
+}
Modified: branches/shell-experiments/base/shell/rshell/precomp.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/precomp.h [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/precomp.h [iso-8859-1] Mon Feb 17
16:41:10 2014
@@ -32,4 +32,5 @@
extern "C" HRESULT CMenuDeskBar_Constructor(REFIID riid, LPVOID *ppv);
extern "C" HRESULT CMenuSite_Constructor(REFIID riid, LPVOID *ppv);
-extern "C" HRESULT CMenuBand_Constructor(REFIID riid, LPVOID *ppv);
+extern "C" HRESULT CMenuBand_Constructor(REFIID riid, LPVOID *ppv);
+extern "C" HRESULT CSubMenu_Constructor(IShellMenu * pShellMenu, REFIID riid,
void **ppv);
Modified: branches/shell-experiments/base/shell/rshell/wraplog.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/wraplog.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/wraplog.cpp [iso-8859-1] Mon Feb 17
16:41:10 2014
@@ -2,11 +2,11 @@
#include "wraplog.h"
#include <stdio.h>
-static UINT openCount = 0;
-static UINT callLevel;
+static INT openCount = 0;
+static INT callLevel;
static FILE*log;
-static UINT nTemps;
+static INT nTemps;
static CHAR strTemp[10][256];
void WrapLogOpen()