diff --git a/dll/win32/browseui/internettoolbar.cpp b/dll/win32/browseui/internettoolbar.cpp index ec48dd92d04..c2ee9793f94 100644 --- a/dll/win32/browseui/internettoolbar.cpp +++ b/dll/win32/browseui/internettoolbar.cpp @@ -817,7 +817,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::GetSizeMax(ULARGE_INTEGER *pcbSize) HRESULT STDMETHODCALLTYPE CInternetToolbar::InitNew() { CComPtr menuBar; - //CComPtr logoBar; + CComPtr logoBar; CComPtr toolsBar; CComPtr navigationBar; CComPtr menuOleWindow; @@ -825,6 +825,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::InitNew() CComPtr navigationOleWindow; HRESULT hResult; + /* Create and attach the menubar to the rebar */ hResult = CreateMenuBar(&menuBar); if (FAILED(hResult)) return hResult; @@ -835,15 +836,15 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::InitNew() 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 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::InitNew() if (FAILED(hResult)) return hResult; + /* Create and attach the address/navigation toolbar to the rebar */ hResult = CreateAddressBand(&navigationBar); if (FAILED(hResult)) return hResult; diff --git a/dll/win32/browseui/internettoolbar.h b/dll/win32/browseui/internettoolbar.h index 71d3421451d..0b6ae67a819 100644 --- a/dll/win32/browseui/internettoolbar.h +++ b/dll/win32/browseui/internettoolbar.h @@ -87,7 +87,7 @@ public: CComPtr fMenuBar; // the menu rebar HWND fMenuBandWindow; HWND fNavigationWindow; - //CComPtr fLogoBar; // the reactos logo + CComPtr fLogoBar; // the reactos logo CComPtr fControlsBar; // navigation controls CComPtr fNavigationBar; // address bar CComObject fMenuCallback; diff --git a/dll/win32/browseui/shellbrowser.cpp b/dll/win32/browseui/shellbrowser.cpp index 026484e5b5a..f74b5c1d34c 100644 --- a/dll/win32/browseui/shellbrowser.cpp +++ b/dll/win32/browseui/shellbrowser.cpp @@ -1305,11 +1305,10 @@ void CShellBrowser::RepositionBars() 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 @@ void CShellBrowser::RepositionBars() for (x = 0; x < 3; x++) { - CComPtr oleWindow; - if (fClientBars[x].hwnd == NULL && fClientBars[x].clientBar != NULL) { - hResult = fClientBars[x].clientBar->QueryInterface( - IID_IOleWindow, reinterpret_cast(&oleWindow)); - if (SUCCEEDED(hResult)) - hResult = oleWindow->GetWindow(&fClientBars[x].hwnd); + IUnknown_GetWindow(fClientBars[x].clientBar, &fClientBars[x].hwnd); } if (fClientBars[x].hwnd != NULL) { diff --git a/dll/win32/browseui/toolsband.cpp b/dll/win32/browseui/toolsband.cpp index aad947a269f..79f89985a09 100644 --- a/dll/win32/browseui/toolsband.cpp +++ b/dll/win32/browseui/toolsband.cpp @@ -24,10 +24,9 @@ Implements the toolbar band of a cabinet window #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, @@ -108,25 +107,43 @@ CToolsBand::~CToolsBand() 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(&maxSize)); + + idealSize = maxSize; + SendMessageW(m_hWnd, TB_GETIDEALSIZE, FALSE, reinterpret_cast(&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"");