Author: dquintana
Date: Fri Mar 7 22:28:55 2014
New Revision: 62448
URL:
http://svn.reactos.org/svn/reactos?rev=62448&view=rev
Log:
[BROWSEUI]
* Load and use rshell for the menubar.
* Properly forward WM_NOTIFY and WM_COMMAND messages to the toolbars.
[RSHELL]
* Improve behaviour of horizontal menubands.
* Clicking on submenu items does not work yet.
CORE-7586
Modified:
branches/shell-experiments/base/shell/rshell/CMakeLists.txt
branches/shell-experiments/base/shell/rshell/CMenuBand.cpp
branches/shell-experiments/base/shell/rshell/CMenuBand.h
branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp
branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp
branches/shell-experiments/base/shell/rshell/CMenuToolbars.h
branches/shell-experiments/dll/win32/browseui/CMakeLists.txt
branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp
branches/shell-experiments/dll/win32/browseui/internettoolbar.h
branches/shell-experiments/dll/win32/browseui/precomp.h
branches/shell-experiments/media/fonts/Marlett.ttf
Modified: branches/shell-experiments/base/shell/rshell/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMakeLists.txt [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMakeLists.txt [iso-8859-1] Fri Mar 7
22:28:55 2014
@@ -49,3 +49,9 @@
"$<TARGET_FILE:rshell>"
"$<TARGET_FILE_DIR:explorer_new>/$<TARGET_FILE_NAME:rshell>"
COMMENT "Copying to output directory")
+
+add_custom_command(TARGET rshell POST_BUILD
+ COMMAND "${CMAKE_COMMAND}" -E copy
+ "$<TARGET_FILE:rshell>"
+ "$<TARGET_FILE_DIR:filebrowser>/$<TARGET_FILE_NAME:rshell>"
+ COMMENT "Copying to output directory")
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] Fri Mar 7
22:28:55 2014
@@ -52,7 +52,10 @@
m_site(NULL),
m_psmc(NULL),
m_subMenuChild(NULL),
+ m_hmenu(NULL),
+ m_menuOwner(NULL),
m_useBigIcons(FALSE),
+ m_topLevelWindow(NULL),
m_hotBar(NULL),
m_hotItem(-1)
{
@@ -123,7 +126,7 @@
m_staticToolbar = new CMenuStaticToolbar(this);
}
m_hmenu = hmenu;
- m_menuOwner;
+ m_menuOwner = hwnd;
HRESULT hr = m_staticToolbar->SetMenu(hmenu, hwnd, dwFlags);
if (FAILED_UNEXPECTEDLY(hr))
@@ -203,7 +206,7 @@
}
hr = IUnknown_QueryService(m_site, SID_SMenuPopup, IID_PPV_ARG(IMenuPopup,
&m_subMenuParent));
- if (FAILED_UNEXPECTEDLY(hr))
+ if (FAILED(hr) && hr != E_NOINTERFACE)
return hr;
CComPtr<IOleWindow> pTopLevelWindow;
@@ -326,10 +329,13 @@
return hr;
}
- if (fShow)
- hr = m_focusManager->PushMenu(this);
- else
- hr = m_focusManager->PopMenu(this);
+ if (m_dwFlags & SMINIT_VERTICAL)
+ {
+ if (fShow)
+ hr = m_focusManager->PushMenu(this);
+ else
+ hr = m_focusManager->PopMenu(this);
+ }
return S_OK;
}
@@ -401,6 +407,8 @@
{
return S_FALSE;
}
+
+ return S_FALSE;
}
UNIMPLEMENTED;
@@ -610,9 +618,24 @@
return hr;
}
-HRESULT CMenuBand::_TrackSubMenuUsingTrackPopupMenu(HMENU popup, INT x, INT y)
-{
- ::TrackPopupMenu(popup, 0, x, y, 0, m_menuOwner, NULL);
+HRESULT CMenuBand::_TrackSubMenuUsingTrackPopupMenu(HMENU popup, INT x, INT y, RECT&
rcExclude)
+{
+ HWND sendTo = m_menuOwner;
+
+ // FIXME: use?
+ //TPMPARAMS params = { sizeof(TPMPARAMS), rcExclude };
+
+ if (sendTo)
+ {
+ ::TrackPopupMenuEx(popup, 0, x, y, sendTo, NULL); // ¶ms);
+ }
+ else
+ {
+ GetWindow(&sendTo);
+ ::TrackPopupMenuEx(popup, TPM_RETURNCMD, x, y, sendTo, NULL); // ¶ms);
+ // TODO: use the result somehow
+ }
+
return S_OK;
}
Modified: branches/shell-experiments/base/shell/rshell/CMenuBand.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuBand.h [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMenuBand.h [iso-8859-1] Fri Mar 7
22:28:55 2014
@@ -171,7 +171,7 @@
HRESULT _CallCBWithItemId(UINT Id, UINT uMsg, WPARAM wParam, LPARAM lParam);
HRESULT _CallCBWithItemPidl(LPITEMIDLIST pidl, UINT uMsg, WPARAM wParam, LPARAM
lParam);
- HRESULT _TrackSubMenuUsingTrackPopupMenu(HMENU popup, INT x, INT y);
+ HRESULT _TrackSubMenuUsingTrackPopupMenu(HMENU popup, INT x, INT y, RECT&
rcExclude);
HRESULT _GetTopLevelWindow(HWND*topLevel);
HRESULT _OnHotItemChanged(CMenuToolbarBase * tb, INT id);
HRESULT _MenuItemHotTrack(DWORD changeType);
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] Fri Mar 7
22:28:55 2014
@@ -417,7 +417,7 @@
{
if (m_SubMenuChild)
{
- if (SHIsSameObject(pmp, m_SubMenuChild))
+ if (pmp == m_SubMenuChild)
{
m_SubMenuChild = NULL;
}
Modified: branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp [iso-8859-1] Fri Mar 7
22:28:55 2014
@@ -67,6 +67,10 @@
hdr = reinterpret_cast<LPNMHDR>(lParam);
switch (hdr->code)
{
+ case TTN_GETDISPINFOA:
+ case TTN_GETDISPINFOW:
+ return S_OK;
+
case PGN_CALCSIZE:
csize = reinterpret_cast<LPNMPGCALCSIZE>(hdr);
@@ -99,7 +103,8 @@
switch (cdraw->nmcd.dwDrawStage)
{
case CDDS_PREPAINT:
- *theResult = CDRF_NOTIFYITEMDRAW;
+ if (m_toolbarFlags & SMINIT_VERTICAL)
+ *theResult = CDRF_NOTIFYITEMDRAW;
return S_OK;
case CDDS_ITEMPREPAINT:
@@ -160,6 +165,10 @@
return S_OK;
}
return S_OK;
+ case RBN_CHILDSIZE:
+ return S_OK;
+ default:
+ DbgPrint("WM_NOTIFY unknown code %d, %d\n", hdr->code,
hdr->idFrom);
}
return S_OK;
}
@@ -214,6 +223,13 @@
HRESULT CMenuToolbarBase::UpdateImageLists()
{
+ if ((m_toolbarFlags & (SMINIT_TOPLEVEL| SMINIT_VERTICAL)) == SMINIT_TOPLEVEL) //
not vertical.
+ {
+ /* Hide the placeholders for the button images */
+ SendMessageW(m_hwnd, TB_SETIMAGELIST, 0, 0);
+ return S_OK;
+ }
+
int shiml;
if (m_menuBand->UseBigIcons())
{
@@ -266,6 +282,8 @@
#endif
}
+ m_toolbarFlags = dwFlags;
+
RECT rc;
if (!::GetClientRect(hwndParent, &rc) || (rc.left == rc.right) || (rc.top ==
rc.bottom))
@@ -311,13 +329,6 @@
/* Identify the version of the used Common Controls DLL by sending the size of the
TBBUTTON structure */
SendMessageW(hwndToolbar, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
- //if (dwFlags & SMINIT_TOPLEVEL)
- //{
- // /* Hide the placeholders for the button images */
- // SendMessageW(m_hwnd, TB_SETIMAGELIST, 0, 0);
- //}
- //else
-
SetWindowLongPtr(hwndToolbar, GWLP_USERDATA,
reinterpret_cast<LONG_PTR>(this));
m_SubclassOld = (WNDPROC) SetWindowLongPtr(hwndToolbar, GWLP_WNDPROC,
reinterpret_cast<LONG_PTR>(CMenuToolbarBase::s_SubclassProc));
@@ -349,8 +360,11 @@
SetWindowPos(m_hwndToolbar, NULL, x, y, cx, m_idealSize.cy, 0);
}
SetWindowPos(m_hwnd, NULL, x, y, cx, cy, 0);
- DWORD btnSize = SendMessage(m_hwndToolbar, TB_GETBUTTONSIZE, 0, 0);
- SendMessage(m_hwndToolbar, TB_SETBUTTONSIZE, 0, MAKELPARAM(cx, HIWORD(btnSize)));
+ if (m_toolbarFlags & SMINIT_VERTICAL)
+ {
+ DWORD btnSize = SendMessage(m_hwndToolbar, TB_GETBUTTONSIZE, 0, 0);
+ SendMessage(m_hwndToolbar, TB_SETBUTTONSIZE, 0, MAKELPARAM(cx,
HIWORD(btnSize)));
+ }
return S_OK;
}
@@ -372,8 +386,16 @@
LRESULT CMenuToolbarBase::SubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
lParam)
{
+ LRESULT lr;
+
switch (uMsg)
{
+ case WM_COMMAND:
+ OnWinEvent(hWnd, uMsg, wParam, lParam, &lr);
+ break;
+ case WM_NOTIFY:
+ OnWinEvent(hWnd, uMsg, wParam, lParam, &lr);
+ break;
case WM_TIMER:
if (wParam == TIMERID_HOTTRACK)
{
@@ -402,9 +424,12 @@
}
else if (m_hotItem != hot->idNew)
{
- DWORD elapsed = 0;
- SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &elapsed, 0);
- SetTimer(m_hwndToolbar, TIMERID_HOTTRACK, elapsed, NULL);
+ if (m_toolbarFlags & SMINIT_VERTICAL)
+ {
+ DWORD elapsed = 0;
+ SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &elapsed, 0);
+ SetTimer(m_hwndToolbar, TIMERID_HOTTRACK, elapsed, NULL);
+ }
m_hotItem = hot->idNew;
m_menuBand->_OnHotItemChanged(this, m_hotItem);
@@ -415,8 +440,18 @@
HRESULT CMenuToolbarBase::OnHotItemChanged(CMenuToolbarBase * toolbar, INT item)
{
+ BOOL wasChecked = FALSE;
+ if (m_hotBar == this && !(m_toolbarFlags & SMINIT_VERTICAL))
+ {
+ wasChecked = SendMessage(m_hwndToolbar, TB_ISBUTTONCHECKED, m_hotItem, 0);
+ SendMessage(m_hwndToolbar, TB_CHECKBUTTON, m_hotItem, FALSE);
+ }
m_hotBar = toolbar;
m_hotItem = item;
+ if (wasChecked && m_hotBar == this && !(m_toolbarFlags &
SMINIT_VERTICAL))
+ {
+ SendMessage(m_hwndToolbar, TB_CHECKBUTTON, m_hotItem, TRUE);
+ }
InvalidateDraw();
return S_OK;
}
@@ -436,18 +471,25 @@
HRESULT hr = 0;
RECT rc = { 0 };
+ RECT rcx = { 0 };
if (!SendMessage(m_hwndToolbar, TB_GETITEMRECT, index,
reinterpret_cast<LPARAM>(&rc)))
return E_FAIL;
+ GetWindowRect(m_hwnd, &rcx);
+
POINT a = { rc.left, rc.top };
POINT b = { rc.right, rc.bottom };
+ POINT c = { rcx.left, rcx.top };
+ POINT d = { rcx.right, rcx.bottom };
ClientToScreen(m_hwndToolbar, &a);
ClientToScreen(m_hwndToolbar, &b);
+ ClientToScreen(m_hwnd, &c);
+ ClientToScreen(m_hwnd, &d);
POINTL pt = { b.x - 3, a.y - 3 };
- RECTL rcl = { a.x, a.y, b.x, b.y }; // maybe-TODO: fetch client area of deskbar?
+ RECTL rcl = { c.x, c.y, d.x, d.y };
#if USE_SYSTEM_MENUSITE
hr = CoCreateInstance(CLSID_MenuBandSite,
@@ -499,20 +541,40 @@
return S_OK;
}
-HRESULT CMenuToolbarBase::PopupSubMenu(UINT index, HMENU menu)
+HRESULT CMenuToolbarBase::PopupSubMenu(UINT uItem, UINT index, HMENU menu)
{
RECT rc = { 0 };
+ RECT rcx = { 0 };
if (!SendMessage(m_hwndToolbar, TB_GETITEMRECT, index,
reinterpret_cast<LPARAM>(&rc)))
return E_FAIL;
+ GetWindowRect(m_hwnd, &rcx);
+
+ POINT a = { rc.left, rc.top };
POINT b = { rc.right, rc.bottom };
-
+ POINT c = { rcx.left, rcx.top };
+ POINT d = { rcx.right, rcx.bottom };
+
+ ClientToScreen(m_hwndToolbar, &a);
ClientToScreen(m_hwndToolbar, &b);
+ ClientToScreen(m_hwnd, &c);
+ ClientToScreen(m_hwnd, &d);
+
+ POINT pt = { a.x, b.y };
+ RECT rcl = { c.x, c.y, d.x, d.y };
+
+ if (m_toolbarFlags & SMINIT_VERTICAL)
+ {
+ pt.x = b.x;
+ pt.y = a.y;
+ }
HMENU popup = GetSubMenu(menu, index);
- m_menuBand->_TrackSubMenuUsingTrackPopupMenu(popup, b.x, b.y);
+ m_menuBand->_TrackSubMenuUsingTrackPopupMenu(popup, pt.x, pt.y, rcl);
+
+ SendMessage(m_hwndToolbar, TB_CHECKBUTTON, uItem, FALSE);
return S_OK;
}
@@ -653,13 +715,16 @@
tbb.fsState = TBSTATE_ENABLED;
#ifndef TBSTYLE_EX_VERTICAL
- if (!last)
+ if (!last && (m_toolbarFlags & SMINIT_VERTICAL))
tbb.fsState |= TBSTATE_WRAP;
#endif
tbb.fsStyle = 0;
- if (hasSubMenu)
+ if (hasSubMenu && (m_toolbarFlags & SMINIT_VERTICAL))
tbb.fsStyle |= BTNS_DROPDOWN;
+
+ if (!(m_toolbarFlags & SMINIT_VERTICAL))
+ tbb.fsStyle |= BTNS_AUTOSIZE | BTNS_CHECKGROUP;
tbb.iString = (INT_PTR) caption;
tbb.idCommand = commandId;
@@ -667,8 +732,6 @@
tbb.iBitmap = iconId;
tbb.dwData = buttonData;
- DbgPrint("Trying to add a new button with id %d and caption
'%S'...\n", commandId, caption);
-
if (!SendMessageW(m_hwndToolbar, TB_ADDBUTTONS, 1,
reinterpret_cast<LPARAM>(&tbb)))
return HRESULT_FROM_WIN32(GetLastError());
@@ -681,14 +744,12 @@
tbb.fsState = TBSTATE_ENABLED;
#ifndef TBSTYLE_EX_VERTICAL
- if (!last)
+ if (!last && (m_toolbarFlags & SMINIT_VERTICAL))
tbb.fsState |= TBSTATE_WRAP;
#endif
tbb.fsStyle = BTNS_SEP;
tbb.iBitmap = 0;
- DbgPrint("Trying to add a new separator...\n");
-
if (!SendMessageW(m_hwndToolbar, TB_ADDBUTTONS, 1,
reinterpret_cast<LPARAM>(&tbb)))
return HRESULT_FROM_WIN32(GetLastError());
@@ -704,8 +765,6 @@
tbb.fsStyle = 0;
tbb.iString = (INT_PTR) MenuString;
tbb.iBitmap = -1;
-
- DbgPrint("Trying to add a new placeholder...\n");
if (!SendMessageW(m_hwndToolbar, TB_ADDBUTTONS, 1,
reinterpret_cast<LPARAM>(&tbb)))
return HRESULT_FROM_WIN32(GetLastError());
@@ -810,8 +869,6 @@
count++;
- DbgPrint("Found item with fType=%x, cmdId=%d\n", info.fType,
info.wID);
-
if (info.fType & MFT_SEPARATOR)
{
AddSeparator(last);
@@ -839,8 +896,6 @@
}
}
- DbgPrint("Created toolbar with %d buttons.\n", count);
-
return S_OK;
}
@@ -876,7 +931,7 @@
if (nfo->dwFlags&SMIF_TRACKPOPUP)
{
- return PopupSubMenu(index, m_hmenu);
+ return PopupSubMenu(uItem, index, m_hmenu);
}
else
{
@@ -951,12 +1006,8 @@
// If no items were added, show the "empty" placeholder
if (i == 0)
{
- DbgPrint("The toolbar is empty, adding placeholder.\n");
-
return AddPlaceholder();
}
-
- DbgPrint("Created toolbar with %d buttons.\n", i);
return hr;
}
Modified: branches/shell-experiments/base/shell/rshell/CMenuToolbars.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuToolbars.h [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMenuToolbars.h [iso-8859-1] Fri Mar 7
22:28:55 2014
@@ -42,6 +42,8 @@
CMenuToolbarBase * m_popupBar;
INT m_popupItem;
+ DWORD m_toolbarFlags;
+
private:
static LRESULT CALLBACK s_SubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
lParam);
@@ -61,7 +63,7 @@
HRESULT OnPopupItemChanged(CMenuToolbarBase * toolbar, INT item);
HRESULT PopupSubMenu(UINT itemId, UINT index, IShellMenu* childShellMenu);
- HRESULT PopupSubMenu(UINT index, HMENU menu);
+ HRESULT PopupSubMenu(UINT itemId, UINT index, HMENU menu);
HRESULT DoContextMenu(IContextMenu* contextMenu);
HRESULT ChangeHotItem(DWORD changeType);
Modified: branches/shell-experiments/dll/win32/browseui/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/CMakeLists.txt [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/browseui/CMakeLists.txt [iso-8859-1] Fri Mar 7
22:28:55 2014
@@ -59,3 +59,9 @@
add_pch(browseui precomp.h SOURCE)
add_cd_file(TARGET browseui DESTINATION reactos/system32 FOR all)
+
+add_custom_command(TARGET browseui POST_BUILD
+ COMMAND "${CMAKE_COMMAND}" -E copy
+ "$<TARGET_FILE:browseui>"
+ "$<TARGET_FILE_DIR:filebrowser>/$<TARGET_FILE_NAME:browseui>"
+ COMMENT "Copying to output directory")
Modified: branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp [iso-8859-1] Fri Mar
7 22:28:55 2014
@@ -66,6 +66,8 @@
extern HRESULT CreateBrandBand(REFIID riid, void **ppv);
extern HRESULT CreateBandProxy(REFIID riid, void **ppv);
extern HRESULT CreateAddressBand(REFIID riid, void **ppv);
+
+typedef HRESULT(*PMENUBAND_CONSTRUCTOR)(REFIID riid, void **ppv);
class CInternetToolbar;
@@ -372,8 +374,23 @@
favoritesHMenu = GetSubMenu(parentHMenu, 3);
if (favoritesHMenu == NULL)
return E_FAIL;
+#if 1
+ HMODULE hrs = LoadLibrary(L"rshell.dll");
+
+ PMENUBAND_CONSTRUCTOR func = (PMENUBAND_CONSTRUCTOR) GetProcAddress(hrs,
"CMenuBand_Constructor");
+ if (func)
+ {
+ hResult = func(IID_PPV_ARG(IShellMenu, &newMenu));
+ }
+ else
+ {
+ hResult = CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER,
+ IID_IShellMenu, reinterpret_cast<void **>(&newMenu));
+ }
+#else
hResult = CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER,
IID_IShellMenu, reinterpret_cast<void **>(&newMenu));
+#endif
if (FAILED(hResult))
return hResult;
hResult = newMenu->Initialize(this, FCIDM_MENU_FAVORITES, -1, SMINIT_VERTICAL
| SMINIT_CACHED);
@@ -536,8 +553,35 @@
HWND ownerWindow;
HRESULT hResult;
+#if 1
+ HMODULE hrs = LoadLibraryW(L"rshell.dll");
+
+ if (!hrs)
+ {
+ DbgPrint("Failed: %d\n", GetLastError());
+ return E_FAIL;
+ }
+
+ PMENUBAND_CONSTRUCTOR func = (PMENUBAND_CONSTRUCTOR) GetProcAddress(hrs,
"CMenuBand_Constructor");
+ if (func)
+ {
+ hResult = func(IID_PPV_ARG(IShellMenu, menuBar));
+ }
+ else
+ {
+ DbgPrint("Failed: %d\n", GetLastError());
+ hResult = E_FAIL;
+ }
+
+ if (FAILED(hResult))
+ {
+ hResult = CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER,
+ IID_IShellMenu, reinterpret_cast<void **>(menuBar));
+ }
+#else
hResult = CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER,
IID_IShellMenu, reinterpret_cast<void **>(menuBar));
+#endif
if (FAILED(hResult))
return hResult;
hResult = fMenuCallback.QueryInterface(IID_IShellMenuCallback,
reinterpret_cast<void **>(&callback));
@@ -1137,12 +1181,16 @@
CComPtr<IWinEventHandler> menuWinEventHandler;
HRESULT hResult;
- if (fMenuBar.p != NULL)
+ if (fMenuBar)
{
hResult = fMenuBar->QueryInterface(IID_IWinEventHandler,
reinterpret_cast<void **>(&menuWinEventHandler));
- return menuWinEventHandler->OnWinEvent(fMenuBandWindow, uMsg, wParam, lParam,
theResult);
- }
- return E_FAIL;
+ if (menuWinEventHandler->IsWindowOwner(hWnd))
+ {
+ return menuWinEventHandler->OnWinEvent(fMenuBandWindow, uMsg, wParam,
lParam, theResult);
+ }
+ }
+
+ return S_FALSE;
}
HRESULT STDMETHODCALLTYPE CInternetToolbar::IsWindowOwner(HWND hWnd)
@@ -1410,20 +1458,6 @@
return 1;
}
-LRESULT CInternetToolbar::OnNavigateCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL
&bHandled)
-{
- CComPtr<IWinEventHandler> winEventHandler;
- LRESULT theResult;
- HRESULT hResult;
-
- hResult = fNavigationBar->QueryInterface(IID_IWinEventHandler,
reinterpret_cast<void **>(&winEventHandler));
- hResult = winEventHandler->OnWinEvent(m_hWnd, uMsg, wParam, lParam,
&theResult);
- if (SUCCEEDED(hResult))
- return theResult;
- bHandled = FALSE;
- return 0;
-}
-
LRESULT CInternetToolbar::OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL
&bHandled)
{
HMENU contextMenuBar;
@@ -1553,27 +1587,78 @@
return 0;
}
+LRESULT CInternetToolbar::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL
&bHandled)
+{
+ LRESULT theResult;
+ HRESULT hResult;
+ HWND target = (HWND) lParam;
+
+ if (fMenuBar)
+ {
+ CComPtr<IWinEventHandler> menuWinEventHandler;
+ hResult = fMenuBar->QueryInterface(IID_IWinEventHandler,
reinterpret_cast<void **>(&menuWinEventHandler));
+ if (SUCCEEDED(hResult))
+ {
+ if (menuWinEventHandler->IsWindowOwner(target) == S_OK)
+ {
+ hResult = menuWinEventHandler->OnWinEvent(target, uMsg, wParam,
lParam, &theResult);
+ return FAILED(hResult) ? 0 : theResult;
+ }
+ }
+ }
+
+ if (fNavigationBar)
+ {
+ CComPtr<IWinEventHandler> menuWinEventHandler;
+ hResult = fNavigationBar->QueryInterface(IID_IWinEventHandler,
reinterpret_cast<void **>(&menuWinEventHandler));
+ if (SUCCEEDED(hResult))
+ {
+ if (menuWinEventHandler->IsWindowOwner(target) == S_OK)
+ {
+ hResult = menuWinEventHandler->OnWinEvent(target, uMsg, wParam,
lParam, &theResult);
+ return FAILED(hResult) ? 0 : theResult;
+ }
+ }
+ }
+
+ return 0;
+}
LRESULT CInternetToolbar::OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL
&bHandled)
{
- NMHDR *notifyHeader;
- CComPtr<IWinEventHandler> menuWinEventHandler;
- LRESULT theResult;
- HRESULT hResult;
-
- notifyHeader = (NMHDR *)lParam;
- if (fMenuBar.p != NULL && notifyHeader->hwndFrom == fMenuBandWindow)
- {
+ NMHDR *notifyHeader;
+ LRESULT theResult;
+ HRESULT hResult;
+
+ notifyHeader = (NMHDR *) lParam;
+
+ if (fMenuBar)
+ {
+ CComPtr<IWinEventHandler> menuWinEventHandler;
hResult = fMenuBar->QueryInterface(IID_IWinEventHandler,
reinterpret_cast<void **>(&menuWinEventHandler));
- hResult = menuWinEventHandler->OnWinEvent(fMenuBandWindow, uMsg, wParam,
lParam, &theResult);
- return theResult;
- }
- if (fNavigationBar.p != NULL && notifyHeader->hwndFrom ==
fNavigationWindow)
- {
- hResult = fNavigationBar->QueryInterface(
- IID_IWinEventHandler, reinterpret_cast<void
**>(&menuWinEventHandler));
- hResult = menuWinEventHandler->OnWinEvent(m_hWnd, uMsg, wParam, lParam,
&theResult);
- return theResult;
- }
+ if (SUCCEEDED(hResult))
+ {
+ if (menuWinEventHandler->IsWindowOwner(notifyHeader->hwndFrom) ==
S_OK)
+ {
+ hResult = menuWinEventHandler->OnWinEvent(notifyHeader->hwndFrom,
uMsg, wParam, lParam, &theResult);
+ return FAILED(hResult) ? 0 : theResult;
+ }
+ }
+ }
+
+ if (fNavigationBar)
+ {
+ CComPtr<IWinEventHandler> menuWinEventHandler;
+ hResult = fNavigationBar->QueryInterface(IID_IWinEventHandler,
reinterpret_cast<void **>(&menuWinEventHandler));
+ if (SUCCEEDED(hResult))
+ {
+ if (menuWinEventHandler->IsWindowOwner(notifyHeader->hwndFrom) ==
S_OK)
+ {
+ hResult = menuWinEventHandler->OnWinEvent(notifyHeader->hwndFrom,
uMsg, wParam, lParam, &theResult);
+ return FAILED(hResult) ? 0 : theResult;
+ }
+ }
+ }
+
return 0;
}
Modified: branches/shell-experiments/dll/win32/browseui/internettoolbar.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/internettoolbar.h [iso-8859-1]
(original)
+++ branches/shell-experiments/dll/win32/browseui/internettoolbar.h [iso-8859-1] Fri Mar
7 22:28:55 2014
@@ -196,6 +196,7 @@
LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
LRESULT OnSetCursor(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
LRESULT OnTipText(UINT idControl, NMHDR *pNMHDR, BOOL &bHandled);
+ LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
LRESULT OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
BEGIN_MSG_MAP(CInternetToolbar)
@@ -208,7 +209,7 @@
NOTIFY_HANDLER(0, TBN_DROPDOWN, OnMenuDropDown)
NOTIFY_HANDLER(0, TBN_QUERYINSERT, OnQueryInsert)
NOTIFY_HANDLER(0, TBN_QUERYDELETE, OnQueryDelete)
- MESSAGE_HANDLER(WM_COMMAND, OnNavigateCommand)
+ MESSAGE_HANDLER(WM_COMMAND, OnCommand)
MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextMenu)
MESSAGE_HANDLER(WM_SIZE, OnSize)
MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor)
Modified: branches/shell-experiments/dll/win32/browseui/precomp.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/precomp.h [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/browseui/precomp.h [iso-8859-1] Fri Mar 7
22:28:55 2014
@@ -38,6 +38,43 @@
#include "commonbrowser.h"
#include "globalfoldersettings.h"
#include "regtreeoptions.h"
+#include <stdio.h>
+
+static __inline ULONG
+Win32DbgPrint(const char *filename, int line, const char *lpFormat, ...)
+{
+ char szMsg[512];
+ char *szMsgStart;
+ const char *fname;
+ va_list vl;
+ ULONG uRet;
+
+ fname = strrchr(filename, '\\');
+ if (fname == NULL)
+ {
+ fname = strrchr(filename, '/');
+ if (fname != NULL)
+ fname++;
+ }
+ else
+ fname++;
+
+ if (fname == NULL)
+ fname = filename;
+
+ szMsgStart = szMsg + sprintf(szMsg, "%s:%d: ", fname, line);
+
+ va_start(vl, lpFormat);
+ uRet = (ULONG) vsprintf(szMsgStart, lpFormat, vl);
+ va_end(vl);
+
+ OutputDebugStringA(szMsg);
+
+ return uRet;
+}
+
+#define DbgPrint(fmt, ...) \
+ Win32DbgPrint(__FILE__, __LINE__, fmt, ##__VA_ARGS__)
WINE_DEFAULT_DEBUG_CHANNEL(browseui);
Modified: branches/shell-experiments/media/fonts/Marlett.ttf
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/media/fonts/M…
==============================================================================
Binary files - no diff available.