Author: dquintana
Date: Tue Feb 18 10:26:50 2014
New Revision: 62239
URL:
http://svn.reactos.org/svn/reactos?rev=62239&view=rev
Log:
[RSHELL]
* Change C-style casts to static_cast where possible, and reinterpret_cast elsewhere.
* Make coding style and formatting more consistent.
Modified:
branches/shell-experiments/base/shell/rshell/CDesktopBrowser.cpp
branches/shell-experiments/base/shell/rshell/CMenuBand.cpp
branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp
branches/shell-experiments/base/shell/rshell/CMenuSite.cpp
branches/shell-experiments/base/shell/rshell/CStartMenu.cpp
Modified: branches/shell-experiments/base/shell/rshell/CDesktopBrowser.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CDesktopBrowser.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/rshell/CDesktopBrowser.cpp [iso-8859-1] Tue Feb
18 10:26:50 2014
@@ -26,9 +26,9 @@
#define SHDESK_TAG 0x4b534544
-static const WCHAR szProgmanClassName[] =
{'P','r','o','g','m','a','n'};
-static const WCHAR szProgmanWindowName[] = {
-
'P','r','o','g','r','a','m','
','M','a','n','a','g','e','r'
+static const WCHAR szProgmanClassName [] = { 'P', 'r', 'o',
'g', 'm', 'a', 'n' };
+static const WCHAR szProgmanWindowName [] = {
+ 'P', 'r', 'o', 'g', 'r', 'a',
'm', ' ', 'M', 'a', 'n', 'a', 'g',
'e', 'r'
};
class CDesktopBrowser :
@@ -52,7 +52,7 @@
CDesktopBrowser();
~CDesktopBrowser();
HRESULT Initialize(HWND hWndx, IShellDesktopTray *ShellDeskx);
- HWND FindDesktopListView ();
+ HWND FindDesktopListView();
BOOL CreateDeskWnd();
HWND DesktopGetWindowControl(IN UINT id);
static LRESULT CALLBACK ProgmanWindowProc(IN HWND hwnd, IN UINT uMsg, IN WPARAM
wParam, IN LPARAM lParam);
@@ -78,19 +78,19 @@
virtual HRESULT STDMETHODCALLTYPE SetToolbarItems(LPTBBUTTON lpButtons, UINT
nButtons, UINT uFlags);
// *** ICommDlgBrowser methods ***
- virtual HRESULT STDMETHODCALLTYPE OnDefaultCommand (struct IShellView *ppshv);
- virtual HRESULT STDMETHODCALLTYPE OnStateChange (struct IShellView *ppshv, ULONG
uChange);
- virtual HRESULT STDMETHODCALLTYPE IncludeObject (struct IShellView *ppshv,
LPCITEMIDLIST pidl);
+ virtual HRESULT STDMETHODCALLTYPE OnDefaultCommand(struct IShellView *ppshv);
+ virtual HRESULT STDMETHODCALLTYPE OnStateChange(struct IShellView *ppshv, ULONG
uChange);
+ virtual HRESULT STDMETHODCALLTYPE IncludeObject(struct IShellView *ppshv,
LPCITEMIDLIST pidl);
// *** IServiceProvider methods ***
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void
**ppvObject);
-BEGIN_COM_MAP(CDesktopBrowser)
- COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
- COM_INTERFACE_ENTRY_IID(IID_IShellBrowser, IShellBrowser)
- COM_INTERFACE_ENTRY_IID(IID_ICommDlgBrowser, ICommDlgBrowser)
- COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
-END_COM_MAP()
+ BEGIN_COM_MAP(CDesktopBrowser)
+ COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
+ COM_INTERFACE_ENTRY_IID(IID_IShellBrowser, IShellBrowser)
+ COM_INTERFACE_ENTRY_IID(IID_ICommDlgBrowser, ICommDlgBrowser)
+ COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
+ END_COM_MAP()
};
CDesktopBrowser::CDesktopBrowser()
@@ -163,7 +163,7 @@
CComObject<CDesktopBrowser> *pThis;
HRESULT hRet;
- ShellDesk = (IShellDesktopTray *)lpCreateStruct->lpCreateParams;
+ ShellDesk = static_cast<IShellDesktopTray
*>(lpCreateStruct->lpCreateParams);
if (ShellDesk == NULL)
{
WARN("No IShellDesk interface provided!");
@@ -185,7 +185,7 @@
return pThis;
}
-HWND CDesktopBrowser::FindDesktopListView ()
+HWND CDesktopBrowser::FindDesktopListView()
{
return FindWindowExW(hWndShellView, NULL, WC_LISTVIEW, NULL);
}
@@ -202,8 +202,8 @@
}
fs.ViewMode = FVM_ICON;
- fs.fFlags = FWF_DESKTOP | FWF_NOCLIENTEDGE | FWF_NOSCROLL | FWF_TRANSPARENT;
- hRet = DesktopView->CreateViewWindow(NULL, &fs, (IShellBrowser *)this,
&rcClient, &hWndShellView);
+ fs.fFlags = FWF_DESKTOP | FWF_NOCLIENTEDGE | FWF_NOSCROLL | FWF_TRANSPARENT;
+ hRet = DesktopView->CreateViewWindow(NULL, &fs, static_cast<IShellBrowser
*>(this), &rcClient, &hWndShellView);
if (!SUCCEEDED(hRet))
return FALSE;
@@ -265,7 +265,7 @@
return S_FALSE;
}
-typedef HRESULT (WINAPI *SH_OPEN_NEW_FRAME)(LPITEMIDLIST pidl, IUnknown *paramC, long
param10, long param14);
+typedef HRESULT(WINAPI *SH_OPEN_NEW_FRAME)(LPITEMIDLIST pidl, IUnknown *paramC, long
param10, long param14);
HRESULT STDMETHODCALLTYPE CDesktopBrowser::BrowseObject(LPCITEMIDLIST pidl, UINT wFlags)
{
@@ -284,14 +284,14 @@
{
switch (id)
{
- case FCW_TOOLBAR:
- case FCW_STATUS:
- case FCW_TREE:
- case FCW_PROGRESS:
- return NULL;
-
- default:
- return NULL;
+ case FCW_TOOLBAR:
+ case FCW_STATUS:
+ case FCW_TREE:
+ case FCW_PROGRESS:
+ return NULL;
+
+ default:
+ return NULL;
}
}
@@ -321,10 +321,7 @@
hWnd = DesktopGetWindowControl(id);
if (hWnd != NULL)
{
- *pret = SendMessageW(hWnd,
- uMsg,
- wParam,
- lParam);
+ *pret = SendMessageW(hWnd, uMsg, wParam, lParam);
return S_OK;
}
@@ -395,8 +392,7 @@
if (uMsg != WM_NCCREATE)
{
- pThis = (CDesktopBrowser*)GetWindowLongPtrW(hwnd,
- 0);
+ pThis = reinterpret_cast<CDesktopBrowser*>(GetWindowLongPtrW(hwnd, 0));
if (pThis == NULL)
goto DefMsgHandler;
}
@@ -405,86 +401,86 @@
{
switch (uMsg)
{
- case WM_ERASEBKGND:
- return (LRESULT)PaintDesktop((HDC)wParam);
-
- case WM_GETISHELLBROWSER:
- Ret = (LRESULT)((IShellBrowser *)pThis);
- break;
-
- case WM_SIZE:
- if (wParam == SIZE_MINIMIZED)
+ case WM_ERASEBKGND:
+ return (LRESULT) PaintDesktop((HDC) wParam);
+
+ case WM_GETISHELLBROWSER:
+ Ret = reinterpret_cast<LRESULT>(static_cast<IShellBrowser
*>(pThis));
+ break;
+
+ case WM_SIZE:
+ if (wParam == SIZE_MINIMIZED)
+ {
+ /* Hey, we're the desktop!!! */
+ ShowWindow(hwnd,
+ SW_RESTORE);
+ }
+ else
+ {
+ RECT rcDesktop;
+
+ rcDesktop.left = GetSystemMetrics(SM_XVIRTUALSCREEN);
+ rcDesktop.top = GetSystemMetrics(SM_YVIRTUALSCREEN);
+ rcDesktop.right = GetSystemMetrics(SM_CXVIRTUALSCREEN);
+ rcDesktop.bottom = GetSystemMetrics(SM_CYVIRTUALSCREEN);
+
+ /* FIXME: Update work area */
+ }
+ break;
+
+ case WM_SYSCOLORCHANGE:
+ case WM_SETTINGCHANGE:
+ {
+ if (uMsg == WM_SYSCOLORCHANGE || wParam == SPI_SETDESKWALLPAPER || wParam ==
0)
+ {
+ if (pThis->hWndShellView != NULL)
{
- /* Hey, we're the desktop!!! */
- ShowWindow(hwnd,
- SW_RESTORE);
+ /* Forward the message */
+ SendMessageW(pThis->hWndShellView,
+ uMsg,
+ wParam,
+ lParam);
}
- else
- {
- RECT rcDesktop;
-
- rcDesktop.left = GetSystemMetrics(SM_XVIRTUALSCREEN);
- rcDesktop.top = GetSystemMetrics(SM_YVIRTUALSCREEN);
- rcDesktop.right = GetSystemMetrics(SM_CXVIRTUALSCREEN);
- rcDesktop.bottom = GetSystemMetrics(SM_CYVIRTUALSCREEN);
-
- /* FIXME: Update work area */
- }
- break;
-
- case WM_SYSCOLORCHANGE:
- case WM_SETTINGCHANGE:
+ }
+ break;
+ }
+
+ case WM_CREATE:
+ {
+ pThis->ShellDesk->RegisterDesktopWindow(pThis->hWnd);
+
+ if (!pThis->CreateDeskWnd())
+ WARN("Could not create the desktop view control!\n");
+ break;
+ }
+
+ case WM_NCCREATE:
+ {
+ LPCREATESTRUCT CreateStruct = (LPCREATESTRUCT) lParam;
+ pThis = SHDESK_Create(hwnd, CreateStruct);
+ if (pThis == NULL)
{
- if (uMsg == WM_SYSCOLORCHANGE || wParam == SPI_SETDESKWALLPAPER || wParam
== 0)
- {
- if (pThis->hWndShellView != NULL)
- {
- /* Forward the message */
- SendMessageW(pThis->hWndShellView,
- uMsg,
- wParam,
- lParam);
- }
- }
+ WARN("Failed to create desktop structure\n");
break;
}
- case WM_CREATE:
- {
- pThis->ShellDesk->RegisterDesktopWindow(pThis->hWnd);
-
- if (!pThis->CreateDeskWnd())
- WARN("Could not create the desktop view control!\n");
- break;
- }
-
- case WM_NCCREATE:
- {
- LPCREATESTRUCT CreateStruct = (LPCREATESTRUCT)lParam;
- pThis = SHDESK_Create(hwnd, CreateStruct);
- if (pThis == NULL)
- {
- WARN("Failed to create desktop structure\n");
- break;
- }
-
- SetWindowLongPtrW(hwnd,
- 0,
- (LONG_PTR)pThis);
- Ret = TRUE;
- break;
- }
-
- case WM_NCDESTROY:
- {
- pThis->Release();
- break;
- }
-
- default:
-DefMsgHandler:
- Ret = DefWindowProcW(hwnd, uMsg, wParam, lParam);
- break;
+ SetWindowLongPtrW(hwnd,
+ 0,
+ (LONG_PTR) pThis);
+ Ret = TRUE;
+ break;
+ }
+
+ case WM_NCDESTROY:
+ {
+ pThis->Release();
+ break;
+ }
+
+ default:
+ DefMsgHandler :
+ Ret = DefWindowProcW(hwnd, uMsg, wParam, lParam);
+ break;
}
}
@@ -503,7 +499,7 @@
wcProgman.hInstance = shell32_hInstance;
wcProgman.hIcon = NULL;
wcProgman.hCursor = LoadCursorW(NULL, IDC_ARROW);
- wcProgman.hbrBackground = (HBRUSH)(COLOR_BACKGROUND + 1);
+ wcProgman.hbrBackground = (HBRUSH) (COLOR_BACKGROUND + 1);
wcProgman.lpszMenuName = NULL;
wcProgman.lpszClassName = szProgmanClassName;
@@ -547,9 +543,9 @@
hWndDesk = CreateWindowExW(0, szProgmanClassName, szProgmanWindowName,
WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
rcDesk.left, rcDesk.top, rcDesk.right, rcDesk.bottom,
- NULL, NULL, shell32_hInstance, (LPVOID)ShellDesk);
+ NULL, NULL, shell32_hInstance, (LPVOID) ShellDesk);
if (hWndDesk != NULL)
- return (HANDLE)GetWindowLongPtrW(hWndDesk, 0);
+ return (HANDLE) GetWindowLongPtrW(hWndDesk, 0);
return NULL;
}
@@ -560,7 +556,7 @@
*/
BOOL WINAPI SHDesktopMessageLoop(HANDLE hDesktop)
{
- CDesktopBrowser *Desk = (CDesktopBrowser *)hDesktop;
+ CDesktopBrowser *Desk = reinterpret_cast<CDesktopBrowser *>(hDesktop);
if (Desk == NULL || Desk->Tag != SHDESK_TAG)
{
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] Tue Feb 18
10:26:50 2014
@@ -56,6 +56,7 @@
HRESULT OnHotItemChange(const NMTBHOTITEM * hot);
HRESULT PopupSubMenu(UINT index, IShellMenu* childShellMenu);
+ HRESULT DoContextMenu(IContextMenu* contextMenu);
static LRESULT CALLBACK s_SubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
lParam);
protected:
@@ -281,7 +282,7 @@
END_COM_MAP()
private:
- HRESULT _CallCB(UINT uMsg, WPARAM wParam, LPARAM lParam);
+ HRESULT _CallCB(UINT uMsg, WPARAM wParam, LPARAM lParam, UINT id = 0, LPITEMIDLIST
pidl = NULL);
};
extern "C"
@@ -850,14 +851,14 @@
HRESULT CMenuToolbarBase::CreateToolbar(HWND hwndParent, DWORD dwFlags)
{
LONG tbStyles = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
- TBSTYLE_TOOLTIPS | TBSTYLE_TRANSPARENT | TBSTYLE_REGISTERDROP | TBSTYLE_LIST |
TBSTYLE_FLAT |
+ TBSTYLE_TOOLTIPS | TBSTYLE_TRANSPARENT | TBSTYLE_REGISTERDROP | TBSTYLE_LIST |
TBSTYLE_FLAT | TBSTYLE_CUSTOMERASE |
CCS_NODIVIDER | CCS_NOPARENTALIGN | CCS_NORESIZE | CCS_TOP;
LONG tbExStyles = TBSTYLE_EX_DOUBLEBUFFER;
if (dwFlags & SMINIT_VERTICAL)
{
tbStyles |= CCS_VERT;
- tbExStyles |= TBSTYLE_EX_VERTICAL;
+ tbExStyles |= TBSTYLE_EX_VERTICAL | WS_EX_TOOLWINDOW;
}
RECT rc;
@@ -921,7 +922,7 @@
LRESULT CALLBACK CMenuToolbarBase::s_SubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam,
LPARAM lParam)
{
- CMenuToolbarBase * pthis = (CMenuToolbarBase *) GetWindowLongPtr(hWnd,
GWLP_USERDATA);
+ CMenuToolbarBase * pthis = reinterpret_cast<CMenuToolbarBase
*>(GetWindowLongPtr(hWnd, GWLP_USERDATA));
return pthis->SubclassProc(hWnd, uMsg, wParam, lParam);
}
@@ -1023,6 +1024,36 @@
return S_OK;
}
+HRESULT CMenuToolbarBase::DoContextMenu(IContextMenu* contextMenu)
+{
+ HRESULT hr;
+ HMENU hPopup = CreatePopupMenu();
+
+ if (hPopup == NULL)
+ return E_FAIL;
+
+ hr = contextMenu->QueryContextMenu(hPopup, 0, 0, UINT_MAX, CMF_NORMAL);
+ if (FAILED(hr))
+ {
+ DestroyMenu(hPopup);
+ return hr;
+ }
+
+ DWORD dwPos = GetMessagePos();
+ UINT uCommand = ::TrackPopupMenu(hPopup, TPM_RETURNCMD, GET_X_LPARAM(dwPos),
GET_Y_LPARAM(dwPos), 0, m_hwnd, NULL);
+ if (uCommand == 0)
+ return S_FALSE;
+
+ CMINVOKECOMMANDINFO cmi = { 0 };
+ cmi.cbSize = sizeof(cmi);
+ cmi.lpVerb = MAKEINTRESOURCEA(uCommand);
+ cmi.hwnd = m_hwnd;
+ hr = contextMenu->InvokeCommand(&cmi);
+
+ DestroyMenu(hPopup);
+ return hr;
+}
+
BOOL
AllocAndGetMenuString(HMENU hMenu, UINT ItemIDByPosition, WCHAR** String)
{
@@ -1095,7 +1126,7 @@
if (!AllocAndGetMenuString(m_hmenu, i, &MenuString))
return E_OUTOFMEMORY;
if (::GetSubMenu(m_hmenu, i) != NULL)
- tbb.fsStyle |= BTNS_WHOLEDROPDOWN;
+ tbb.fsStyle |= BTNS_DROPDOWN;
tbb.iString = (INT_PTR) MenuString;
tbb.idCommand = info.wID;
@@ -1126,47 +1157,7 @@
if (hr != S_OK)
return hr;
- HMENU hPopup = CreatePopupMenu();
-
- if (hPopup == NULL)
- return E_FAIL;
-
- int ID_SHELL_CMD_FIRST = 0xF;
- int ID_SHELL_CMD_LAST = 0x7fef;
- hr = contextMenu->QueryContextMenu(hPopup, 0, ID_SHELL_CMD_FIRST,
ID_SHELL_CMD_LAST, CMF_VERBSONLY);
- if (FAILED(hr))
- {
- DestroyMenu(hPopup);
- return hr;
- }
-
- POINT pt = rclick->pt;
- if (!ClientToScreen(m_hwnd, &pt))
- {
- DestroyMenu(hPopup);
- return HRESULT_FROM_WIN32(GetLastError());
- }
-
- CComPtr<IOleWindow> site;
- hr = m_menuBand->GetSite(IID_PPV_ARG(IOleWindow, &site));
- if (FAILED(hr))
- {
- DestroyMenu(hPopup);
- return hr;
- }
-
- HWND hwndSite;
- hr = site->GetWindow(&hwndSite);
- if (FAILED(hr))
- {
- DestroyMenu(hPopup);
- return hr;
- }
-
- ::TrackPopupMenu(hPopup, 0, pt.x, pt.y, 0, hwndSite, NULL);
-
- DestroyMenu(hPopup);
- return S_OK;
+ return DoContextMenu(contextMenu);
}
HRESULT CMenuStaticToolbar::OnCommand(WPARAM wParam, LPARAM lParam, LRESULT *theResult)
@@ -1246,7 +1237,7 @@
if (attrs != 0)
{
- tbb.fsStyle |= BTNS_WHOLEDROPDOWN;
+ tbb.fsStyle |= BTNS_DROPDOWN;
}
tbb.idCommand = i++;
@@ -1319,59 +1310,20 @@
if (!SendMessage(m_hwnd, TB_GETBUTTON, index, (LPARAM) &btn))
return NULL;
- return (LPITEMIDLIST)btn.dwData;
+ return (LPITEMIDLIST) btn.dwData;
}
HRESULT CMenuSFToolbar::OnContextMenu(NMMOUSE * rclick)
{
HRESULT hr;
- CComPtr<IOleWindow> site;
CComPtr<IContextMenu> contextMenu;
-
- hr = m_menuBand->GetSite(IID_PPV_ARG(IOleWindow, &site));
- if (FAILED(hr))
- {
- return hr;
- }
-
- HWND hwndSite;
- hr = site->GetWindow(&hwndSite);
- if (FAILED(hr))
- {
- return hr;
- }
-
- LPITEMIDLIST pidl = GetPidlFromId(rclick->dwItemData, NULL);
-
- hr = m_shellFolder->GetUIObjectOf(hwndSite, 1, (LPCITEMIDLIST *) &pidl,
IID_IContextMenu, NULL, (PVOID *) &contextMenu);
+ LPCITEMIDLIST pidl = reinterpret_cast<LPCITEMIDLIST>(rclick->dwItemData);
+
+ hr = m_shellFolder->GetUIObjectOf(m_hwnd, 1, &pidl, IID_IContextMenu, NULL,
reinterpret_cast<VOID **>(&contextMenu));
if (hr != S_OK)
return hr;
- HMENU hPopup = CreatePopupMenu();
-
- if (hPopup == NULL)
- return E_FAIL;
-
- int ID_SHELL_CMD_FIRST = 0xF;
- int ID_SHELL_CMD_LAST = 0x7fef;
- hr = contextMenu->QueryContextMenu(hPopup, 0, ID_SHELL_CMD_FIRST,
ID_SHELL_CMD_LAST, CMF_VERBSONLY);
- if (FAILED(hr))
- {
- DestroyMenu(hPopup);
- return hr;
- }
-
- POINT pt = rclick->pt;
- if (!ClientToScreen(m_hwnd, &pt))
- {
- DestroyMenu(hPopup);
- return HRESULT_FROM_WIN32(GetLastError());
- }
-
- ::TrackPopupMenu(hPopup, 0, pt.x, pt.y, 0, hwndSite, NULL);
-
- DestroyMenu(hPopup);
- return S_OK;
+ return DoContextMenu(contextMenu);
}
HRESULT CMenuSFToolbar::OnCommand(WPARAM wParam, LPARAM lParam, LRESULT *theResult)
@@ -1381,7 +1333,7 @@
HRESULT CMenuSFToolbar::PopupItem(UINT uItem)
{
- int index;
+ int index;
CComPtr<IShellMenu> shellMenu;
HRESULT hr = m_menuBand->CallCBWithPidl(GetPidlFromId(uItem, &index),
SMC_GETOBJECT, (WPARAM) &IID_IShellMenu, (LPARAM) &shellMenu);
if (FAILED(hr))
@@ -1581,8 +1533,6 @@
HRESULT STDMETHODCALLTYPE CMenuBand::OnPosRectChangeDB(RECT *prc)
{
- SIZE sizeStaticX = { 0 };
- SIZE sizeShlFldX = { 0 };
SIZE sizeStaticY = { 0 };
SIZE sizeShlFldY = { 0 };
HWND hwndStatic = NULL;
@@ -1604,8 +1554,6 @@
if (hwndStatic) SendMessageW(hwndStatic, TB_GETIDEALSIZE, TRUE, (LPARAM)
&sizeStaticY);
if (hwndShlFld) SendMessageW(hwndShlFld, TB_GETIDEALSIZE, TRUE, (LPARAM)
&sizeShlFldY);
- if (hwndStatic) SendMessageW(hwndStatic, TB_GETIDEALSIZE, FALSE, (LPARAM)
&sizeStaticX);
- if (hwndShlFld) SendMessageW(hwndShlFld, TB_GETIDEALSIZE, FALSE, (LPARAM)
&sizeShlFldX);
int sy = max(prc->bottom - prc->top, sizeStaticY.cy + sizeShlFldY.cy);
@@ -1958,14 +1906,14 @@
return S_OK;
case WM_NOTIFY:
- NMHDR * hdr = (LPNMHDR) lParam;
+ NMHDR * hdr = reinterpret_cast<LPNMHDR>(lParam);
NMTBCUSTOMDRAW * cdraw;
NMTBHOTITEM * hot;
NMMOUSE * rclick;
switch (hdr->code)
{
case TBN_HOTITEMCHANGE:
- hot = (NMTBHOTITEM*) hdr;
+ hot = reinterpret_cast<LPNMTBHOTITEM>(hdr);
if (m_staticToolbar && m_staticToolbar->IsWindowOwner(hWnd))
{
@@ -1980,7 +1928,7 @@
return S_OK;
case NM_RCLICK:
- rclick = (LPNMMOUSE) hdr;
+ rclick = reinterpret_cast<LPNMMOUSE>(hdr);
if (m_staticToolbar && m_staticToolbar->IsWindowOwner(hWnd))
{
@@ -1994,7 +1942,7 @@
return S_OK;
case NM_CUSTOMDRAW:
- cdraw = (LPNMTBCUSTOMDRAW) hdr;
+ cdraw = reinterpret_cast<LPNMTBCUSTOMDRAW>(hdr);
switch (cdraw->nmcd.dwDrawStage)
{
case CDDS_PREPAINT:
@@ -2121,7 +2069,17 @@
return S_OK;
}
-HRESULT CMenuBand::CallCBWithId(UINT Id, UINT uMsg, WPARAM wParam, LPARAM lParam)
+HRESULT CMenuBand::CallCBWithId(UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ return _CallCB(uMsg, wParam, lParam, id);
+}
+
+HRESULT CMenuBand::CallCBWithPidl(LPITEMIDLIST pidl, UINT uMsg, WPARAM wParam, LPARAM
lParam)
+{
+ return _CallCB(uMsg, wParam, lParam, 0, pidl);
+}
+
+HRESULT CMenuBand::_CallCB(UINT uMsg, WPARAM wParam, LPARAM lParam, UINT id, LPITEMIDLIST
pidl)
{
if (!m_psmc)
return S_FALSE;
@@ -2130,11 +2088,12 @@
GetWindow(&hwnd);
SMDATA smData = { 0 };
- smData.punk = (IShellMenu2*)this;
- smData.uId = Id;
+ smData.punk = static_cast<IShellMenu2*>(this);
+ smData.uId = id;
smData.uIdParent = m_uId;
smData.uIdAncestor = m_uIdAncestor;
smData.hwnd = hwnd;
+ smData.pidlItem = pidl;
if (m_staticToolbar)
{
smData.hmenu = m_hmenu;
@@ -2148,59 +2107,4 @@
smData.psf->Release();
return hr;
}
-
-HRESULT CMenuBand::CallCBWithPidl(LPITEMIDLIST pidl, UINT uMsg, WPARAM wParam, LPARAM
lParam)
-{
- if (!m_psmc)
- return S_FALSE;
-
- HWND hwnd;
- GetWindow(&hwnd);
-
- SMDATA smData = { 0 };
- smData.punk = (IShellMenu2*)this;
- smData.uIdParent = m_uId;
- smData.uIdAncestor = m_uIdAncestor;
- smData.hwnd = hwnd;
- smData.pidlItem = pidl;
- if (m_staticToolbar)
- {
- smData.hmenu = m_hmenu;
- }
- smData.pvUserData = NULL;
- if (m_SFToolbar)
- m_SFToolbar->GetShellFolder(NULL, &smData.pidlFolder,
IID_PPV_ARG(IShellFolder, &smData.psf));
- HRESULT hr = m_psmc->CallbackSM(&smData, uMsg, wParam, lParam);
- ILFree(smData.pidlFolder);
- if (smData.psf)
- smData.psf->Release();
- return hr;
-}
-
-HRESULT CMenuBand::_CallCB(UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- if (!m_psmc)
- return S_FALSE;
-
- HWND hwnd;
- GetWindow(&hwnd);
-
- SMDATA smData = { 0 };
- smData.punk = (IShellMenu2*)this;
- smData.uIdParent = m_uId;
- smData.uIdAncestor = m_uIdAncestor;
- smData.hwnd = hwnd;
- if (m_staticToolbar)
- {
- smData.hmenu = m_hmenu;
- }
- smData.pvUserData = NULL;
- if (m_SFToolbar)
- m_SFToolbar->GetShellFolder(NULL, &smData.pidlFolder,
IID_PPV_ARG(IShellFolder, &smData.psf));
- HRESULT hr = m_psmc->CallbackSM(&smData, uMsg, wParam, lParam);
- ILFree(smData.pidlFolder);
- if (smData.psf)
- 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] Tue Feb 18
10:26:50 2014
@@ -480,7 +480,7 @@
}
HRESULT STDMETHODCALLTYPE CMenuDeskBar::QueryStatus(const GUID *pguidCmdGroup, ULONG
cCmds,
- OLECMD prgCmds[], OLECMDTEXT *pCmdText)
+ OLECMD prgCmds [], OLECMDTEXT *pCmdText)
{
return E_NOTIMPL;
}
@@ -512,7 +512,7 @@
if (m_Site == NULL)
return E_FAIL;
- if (IsEqualGUID(guidService,SID_SMenuPopup))
+ if (IsEqualGUID(guidService, SID_SMenuPopup))
{
return this->QueryInterface(riid, ppvObject);
}
@@ -633,7 +633,7 @@
::GetObject(m_Banner, sizeof(bm), &bm);
rc.left += bm.bmWidth;
}
-
+
::SetWindowPos(clientWnd, NULL, rc.left, rc.top, rc.right - rc.left, rc.bottom -
rc.top, 0);
}
@@ -703,10 +703,10 @@
TRACE("Painting banner: %d by %d\n", bm.bmWidth, bm.bmHeight);
- if (!::StretchBlt(hdc, 0, 0, bx, cy-by, hdcMem, 0, 0, bx, 1, SRCCOPY))
+ if (!::StretchBlt(hdc, 0, 0, bx, cy - by, hdcMem, 0, 0, bx, 1, SRCCOPY))
WARN("StretchBlt failed\n");
- if (!::BitBlt(hdc, 0, cy-by, bx, by, hdcMem, 0, 0, SRCCOPY))
+ if (!::BitBlt(hdc, 0, cy - by, bx, by, hdcMem, 0, 0, SRCCOPY))
WARN("BitBlt failed\n");
::SelectObject(hdcMem, hbmOld);
@@ -754,7 +754,7 @@
hr = IUnknown_QueryServiceExec(m_Client, SID_SMenuBandChild, &CLSID_MenuBand,
CMD, CMD_EXEC_OPT, NULL, NULL);
if (FAILED(hr))
return hr;
-
+
::AdjustWindowRect(&rc, ::GetWindowLong(m_hWnd, GWL_STYLE), FALSE);
rc.right -= rc.left;
rc.bottom -= rc.top;
@@ -812,7 +812,7 @@
HRESULT STDMETHODCALLTYPE CMenuDeskBar::SetBitmap(THIS_ HBITMAP hBitmap)
{
m_Banner = hBitmap;
-
+
BOOL bHandled;
OnSize(WM_SIZE, 0, 0, bHandled);
@@ -841,7 +841,7 @@
if (FAILED(hr))
return hr;
- SetWindowPos(m_hWnd, 0,0,0,0, SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOMOVE |
SWP_NOZORDER);
+ SetWindowPos(m_hWnd, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOMOVE |
SWP_NOZORDER);
UIActivateIO(FALSE, NULL);
}
Modified: branches/shell-experiments/base/shell/rshell/CMenuSite.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuSite.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMenuSite.cpp [iso-8859-1] Tue Feb 18
10:26:50 2014
@@ -58,7 +58,7 @@
CMenuSite();
~CMenuSite() {}
- DECLARE_WND_CLASS_EX(_T("MenuSite"), 0, COLOR_WINDOW)
+ DECLARE_WND_CLASS_EX(_T("MenuSite"), 0, COLOR_MENU)
DECLARE_NOT_AGGREGATABLE(CMenuSite)
DECLARE_PROTECT_FINAL_CONSTRUCT()
@@ -88,7 +88,7 @@
virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *phwnd);
// IOleCommandTarget
- virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID * pguidCmdGroup, ULONG
cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText);
+ virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID * pguidCmdGroup, ULONG
cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText);
virtual HRESULT STDMETHODCALLTYPE Exec(const GUID * pguidCmdGroup, DWORD nCmdID,
DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
// IInputObject
@@ -119,7 +119,7 @@
virtual HRESULT STDMETHODCALLTYPE SetModeDBC(DWORD dwMode);
private:
- IUnknown * ToIUnknown() { return (IDeskBarClient*)this; }
+ IUnknown * ToIUnknown() { return static_cast<IDeskBarClient*>(this); }
};
extern "C"
@@ -421,6 +421,7 @@
{
RECT Rect = { 0 };
GetClientRect(&Rect);
+ Rect.right = Rect.right;
pMenuPopup->OnPosRectChangeDB(&Rect);
}
}
@@ -428,7 +429,7 @@
lResult = 1;
break;
case WM_NOTIFY:
- hWndTarget = ((NMHDR *)lParam)->hwndFrom;
+ hWndTarget = reinterpret_cast<LPNMHDR>(lParam)->hwndFrom;
break;
case WM_COMMAND:
hWndTarget = (HWND) lParam;
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] Tue Feb 18
10:26:50 2014
@@ -52,12 +52,12 @@
* 4. showing the programs start menu is SLOW compared to windows. this needs some
investigation
*/
-class CShellMenuCallback :
+class CShellMenuCallback :
public CComObjectRootEx<CComMultiThreadModelNoCS>,
- public IShellMenuCallback
+ public IShellMenuCallback
{
private:
-
+
HWND m_hwndTray;
CComPtr<IShellMenu> m_pShellMenu;
CComPtr<IBandSite> m_pBandSite;
@@ -87,7 +87,7 @@
HRESULT OnGetInfo(LPSMDATA psmd, SMINFO *psminfo)
{
int iconIndex = 0;
-
+
switch (psmd->uId)
{
case IDM_PROGRAMS: iconIndex = -20; break;
@@ -114,7 +114,7 @@
if (iconIndex)
{
if ((psminfo->dwMask & SMIM_ICON) != 0)
- psminfo->iIcon = Shell_GetCachedImageIndex(L"shell32.dll",
iconIndex, FALSE);
+ psminfo->iIcon = Shell_GetCachedImageIndex(L"shell32.dll",
iconIndex, FALSE);
#ifdef TEST_TRACKPOPUPMENU_SUBMENUS
if ((psminfo->dwMask & SMIM_FLAGS) != 0)
psminfo->dwFlags |= SMIF_TRACKPOPUP;
@@ -128,7 +128,7 @@
HRESULT hr;
int csidl = 0;
IShellMenu *pShellMenu;
-
+
switch (psmd->uId)
{
case IDM_PROGRAMS: csidl = CSIDL_PROGRAMS; break;
@@ -163,7 +163,7 @@
MENUITEMINFO mii;
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_SUBMENU;
- if (GetMenuItemInfoW( psmd->hmenu, psmd->uId, FALSE, &mii))
+ if (GetMenuItemInfoW(psmd->hmenu, psmd->uId, FALSE, &mii))
{
hr = pShellMenu->SetMenu(mii.hSubMenu, NULL, SMSET_BOTTOM);
}
@@ -174,7 +174,7 @@
HRESULT OnGetContextMenu(LPSMDATA psmd, REFIID iid, void ** pv)
{
if (psmd->uId == IDM_PROGRAMS ||
- psmd->uId == IDM_CONTROLPANEL ||
+ psmd->uId == IDM_CONTROLPANEL ||
psmd->uId == IDM_NETWORKCONNECTIONS ||
psmd->uId == IDM_PRINTERSANDFAXES)
{
@@ -186,9 +186,9 @@
HRESULT OnGetObject(LPSMDATA psmd, REFIID iid, void ** pv)
{
- if (IsEqualIID(iid , IID_IShellMenu))
+ if (IsEqualIID(iid, IID_IShellMenu))
return OnGetSubMenu(psmd, iid, pv);
- else if (IsEqualIID( iid, IID_IContextMenu))
+ else if (IsEqualIID(iid, IID_IContextMenu))
return OnGetContextMenu(psmd, iid, pv);
return S_FALSE;
@@ -196,14 +196,14 @@
HRESULT OnExec(LPSMDATA psmd)
{
- if(psmd->uId == IDM_CONTROLPANEL)
- ShellExecuteW(NULL, L"open",
L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}",
NULL,NULL, 1);
- else if(psmd->uId == IDM_NETWORKCONNECTIONS)
- ShellExecuteW(NULL, L"open",
L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{7007ACC7-3202-11D1-AAD2-00805FC1270E}",
NULL,NULL, 1);
- else if(psmd->uId == IDM_PRINTERSANDFAXES)
- ShellExecuteW(NULL, L"open",
L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{2227A280-3AEA-1069-A2DE-08002B30309D}",
NULL,NULL, 1);
+ if (psmd->uId == IDM_CONTROLPANEL)
+ ShellExecuteW(NULL, L"open",
L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}",
NULL, NULL, 1);
+ else if (psmd->uId == IDM_NETWORKCONNECTIONS)
+ ShellExecuteW(NULL, L"open",
L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{7007ACC7-3202-11D1-AAD2-00805FC1270E}",
NULL, NULL, 1);
+ else if (psmd->uId == IDM_PRINTERSANDFAXES)
+ ShellExecuteW(NULL, L"open",
L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{2227A280-3AEA-1069-A2DE-08002B30309D}",
NULL, NULL, 1);
else
- PostMessageW( m_hwndTray, WM_COMMAND, psmd->uId, 0);
+ PostMessageW(m_hwndTray, WM_COMMAND, psmd->uId, 0);
return S_OK;
}
@@ -216,7 +216,7 @@
COM_INTERFACE_ENTRY_IID(IID_IShellMenuCallback, IShellMenuCallback)
END_COM_MAP()
- void Initialize(
+ void Initialize(
IShellMenu* pShellMenu,
IBandSite* pBandSite,
IDeskBar* pDeskBar)
@@ -242,27 +242,25 @@
switch (uMsg)
{
case SMC_INITMENU:
- return OnInitMenu();
+ return OnInitMenu();
case SMC_GETINFO:
- return OnGetInfo(psmd, reinterpret_cast<SMINFO*>(lParam));
+ return OnGetInfo(psmd, reinterpret_cast<SMINFO*>(lParam));
case SMC_GETOBJECT:
- return OnGetObject(psmd, *reinterpret_cast<IID *>(wParam),
reinterpret_cast<void **>(lParam));
+ return OnGetObject(psmd, *reinterpret_cast<IID *>(wParam),
reinterpret_cast<void **>(lParam));
case SMC_EXEC:
- return OnExec(psmd);
+ return OnExec(psmd);
case SMC_SFEXEC:
- m_pTrayPriv->Execute(psmd->psf, psmd->pidlItem);
- break;
- }
-
- return S_FALSE;
+ m_pTrayPriv->Execute(psmd->psf, psmd->pidlItem);
+ break;
+ }
+
+ return S_FALSE;
}
};
-extern "C"
+extern "C"
HRESULT
-CStartMenu_Constructor(
- REFIID riid,
- void **ppv)
+CStartMenu_Constructor(REFIID riid, void **ppv)
{
IShellMenu* pShellMenu;
IBandSite* pBandSite;
@@ -305,7 +303,7 @@
#endif
if (FAILED(hr))
return hr;
-
+
CComObject<CShellMenuCallback> *pCallback;
hr = CComObject<CShellMenuCallback>::CreateInstance(&pCallback);
if (FAILED(hr))
@@ -322,15 +320,15 @@
/* IID_IAugmentedShellFolder2 8db3b3f4-6cfe-11d1-8ae9-00c04fd918d0 */
hr = SHGetFolderLocation(NULL, CSIDL_STARTMENU, 0, 0, &pidlStartMenu);
hr = SHGetDesktopFolder(&shellFolder);
- hr = shellFolder->BindToObject(pidlStartMenu, NULL, IID_IShellFolder,
(void**)&psfStartMenu);
+ hr = shellFolder->BindToObject(pidlStartMenu, NULL, IID_IShellFolder, (void**)
&psfStartMenu);
hr = pShellMenu->SetShellFolder(psfStartMenu, NULL, NULL, 0);
-
- hr = pDeskBar->SetClient(pBandSite);
- if (FAILED(hr))
- return hr;
-
- hr = pBandSite->AddBand(pShellMenu);
+
+ hr = pDeskBar->SetClient(pBandSite);
+ if (FAILED(hr))
+ return hr;
+
+ hr = pBandSite->AddBand(pShellMenu);
if (FAILED(hr))
return hr;