Author: dquintana Date: Fri Apr 25 10:44:36 2014 New Revision: 62961
URL: http://svn.reactos.org/svn/reactos?rev=62961&view=rev Log: [BROWSEUI] * Reenable the brand box on file browser windows. * Fix an invalid usage of a null HWND. * Implement size calculation of the standard toolbar. CORE-7330
Modified: branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp branches/shell-experiments/dll/win32/browseui/internettoolbar.h branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp branches/shell-experiments/dll/win32/browseui/toolsband.cpp
Modified: branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/brow... ============================================================================== --- branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp [iso-8859-1] Fri Apr 25 10:44:36 2014 @@ -817,7 +817,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::InitNew() { CComPtr<IShellMenu> menuBar; - //CComPtr<IUnknown> logoBar; + CComPtr<IUnknown> logoBar; CComPtr<IUnknown> toolsBar; CComPtr<IUnknown> navigationBar; CComPtr<IOleWindow> menuOleWindow; @@ -825,6 +825,7 @@ CComPtr<IOleWindow> navigationOleWindow; HRESULT hResult;
+ /* Create and attach the menubar to the rebar */ hResult = CreateMenuBar(&menuBar); if (FAILED(hResult)) return hResult; @@ -835,15 +836,15 @@ hResult = menuOleWindow->GetWindow(&fMenuBandWindow); fMenuBar.Attach(menuBar.Detach()); // transfer the ref count
- /* FIXME + /* Create and attach the brand/logo to the rebar */ hResult = CreateBrandBand(&logoBar); if (FAILED(hResult)) return hResult; AddDockItem(logoBar, ITBBID_BRANDBAND, CDockSite::ITF_NOGRIPPER | CDockSite::ITF_NOTITLE | CDockSite::ITF_FIXEDSIZE); fLogoBar.Attach(logoBar.Detach()); // transfer the ref count - */ - + + /* Create and attach the standard toolbar to the rebar */ hResult = CreateToolsBar(&toolsBar); if (FAILED(hResult)) return hResult; @@ -856,6 +857,7 @@ if (FAILED(hResult)) return hResult;
+ /* Create and attach the address/navigation toolbar to the rebar */ hResult = CreateAddressBand(&navigationBar); if (FAILED(hResult)) return hResult;
Modified: branches/shell-experiments/dll/win32/browseui/internettoolbar.h URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/brow... ============================================================================== --- branches/shell-experiments/dll/win32/browseui/internettoolbar.h [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/browseui/internettoolbar.h [iso-8859-1] Fri Apr 25 10:44:36 2014 @@ -87,7 +87,7 @@ CComPtr<IShellMenu> fMenuBar; // the menu rebar HWND fMenuBandWindow; HWND fNavigationWindow; - //CComPtr<IUnknown> fLogoBar; // the reactos logo + CComPtr<IUnknown> fLogoBar; // the reactos logo CComPtr<IUnknown> fControlsBar; // navigation controls CComPtr<IUnknown> fNavigationBar; // address bar CComObject<CMenuCallback> fMenuCallback;
Modified: branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/brow... ============================================================================== --- branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp [iso-8859-1] Fri Apr 25 10:44:36 2014 @@ -1305,11 +1305,10 @@ RECT statusRect; RECT toolbarRect; int x; - HRESULT hResult;
GetClientRect(&clientRect);
- if (fStatusBarVisible) + if (fStatusBarVisible && fStatusBar) { ::GetWindowRect(fStatusBar, &statusRect); ::SetWindowPos(fStatusBar, NULL, clientRect.left, clientRect.bottom - (statusRect.bottom - statusRect.top), @@ -1320,14 +1319,9 @@
for (x = 0; x < 3; x++) { - CComPtr<IOleWindow> oleWindow; - if (fClientBars[x].hwnd == NULL && fClientBars[x].clientBar != NULL) { - hResult = fClientBars[x].clientBar->QueryInterface( - IID_IOleWindow, reinterpret_cast<void **>(&oleWindow)); - if (SUCCEEDED(hResult)) - hResult = oleWindow->GetWindow(&fClientBars[x].hwnd); + IUnknown_GetWindow(fClientBars[x].clientBar, &fClientBars[x].hwnd); } if (fClientBars[x].hwnd != NULL) {
Modified: branches/shell-experiments/dll/win32/browseui/toolsband.cpp URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/brow... ============================================================================== --- branches/shell-experiments/dll/win32/browseui/toolsband.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/browseui/toolsband.cpp [iso-8859-1] Fri Apr 25 10:44:36 2014 @@ -24,10 +24,9 @@
#include "precomp.h"
-/* -TODO: - **Fix GetBandInfo to calculate size correctly -*/ +/* FIXME, I can't include windowsx because it conflicts with some #defines */ +#define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp)) +#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
class CToolsBand : public CWindowImpl<CToolsBand, CWindow, CControlWinTraits>, @@ -108,25 +107,43 @@
HRESULT STDMETHODCALLTYPE CToolsBand::GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO* pdbi) { + RECT actualRect; + POINTL actualSize; + POINTL idealSize; + POINTL maxSize; + POINTL itemSize; + + ::GetWindowRect(m_hWnd, &actualRect); + actualSize.x = actualRect.right - actualRect.left; + actualSize.y = actualRect.bottom - actualRect.top; + + /* Obtain the ideal size, to be used as min and max */ + SendMessageW(m_hWnd, TB_AUTOSIZE, 0, 0); + SendMessageW(m_hWnd, TB_GETMAXSIZE, 0, reinterpret_cast<LPARAM>(&maxSize)); + + idealSize = maxSize; + SendMessageW(m_hWnd, TB_GETIDEALSIZE, FALSE, reinterpret_cast<LPARAM>(&idealSize)); + + /* Obtain the button size, to be used as the integral size */ + DWORD size = SendMessageW(m_hWnd, TB_GETBUTTONSIZE, 0, 0); + itemSize.x = GET_X_LPARAM(size); + itemSize.y = GET_Y_LPARAM(size); + if (pdbi->dwMask & DBIM_MINSIZE) { - pdbi->ptMinSize.x = 400; - pdbi->ptMinSize.y = 38; + pdbi->ptMinSize = idealSize; } if (pdbi->dwMask & DBIM_MAXSIZE) { - pdbi->ptMaxSize.x = 0; - pdbi->ptMaxSize.y = 0; + pdbi->ptMaxSize = maxSize; } if (pdbi->dwMask & DBIM_INTEGRAL) { - pdbi->ptIntegral.x = 0; - pdbi->ptIntegral.y = 0; + pdbi->ptIntegral = itemSize; } if (pdbi->dwMask & DBIM_ACTUAL) { - pdbi->ptActual.x = 400; - pdbi->ptActual.y = 38; + pdbi->ptActual = actualSize; } if (pdbi->dwMask & DBIM_TITLE) wcscpy(pdbi->wszTitle, L"");