[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

svn path=/branches/shell-experiments/; revision=62961
This commit is contained in:
David Quintana 2014-04-25 10:44:36 +00:00
parent 2f3d0e3e01
commit 60334b103a
4 changed files with 37 additions and 24 deletions

View file

@ -817,7 +817,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::GetSizeMax(ULARGE_INTEGER *pcbSize)
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 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::InitNew()
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 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;

View file

@ -87,7 +87,7 @@ public:
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;

View file

@ -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<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)
{

View file

@ -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<CToolsBand, CWindow, CControlWinTraits>,
@ -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<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"");