[BROWSEUI]
authorDavid Quintana <gigaherz@gmail.com>
Fri, 2 May 2014 17:25:19 +0000 (17:25 +0000)
committerDavid Quintana <gigaherz@gmail.com>
Fri, 2 May 2014 17:25:19 +0000 (17:25 +0000)
* Do not set the imagelist if the bitmap wasn't loaded.
* Fix the flags that caused the toolbar not to relocate when toggling the lock mode.

svn path=/branches/shell-experiments/; revision=63114

dll/win32/browseui/internettoolbar.cpp
dll/win32/browseui/toolsband.cpp

index e80b899..b1c33cc 100644 (file)
@@ -849,7 +849,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::InitNew()
     hResult = CreateToolsBar(&toolsBar);
     if (FAILED(hResult))
         return hResult;
-    AddDockItem(toolsBar, ITBBID_TOOLSBAND, CDockSite::ITF_NOTITLE | CDockSite::ITF_NEWBANDALWAYS);
+    AddDockItem(toolsBar, ITBBID_TOOLSBAND, CDockSite::ITF_NOTITLE | CDockSite::ITF_NEWBANDALWAYS | CDockSite::ITF_GRIPPERALWAYS);
     fControlsBar.Attach(toolsBar.Detach());             // transfer the ref count
     hResult = fControlsBar->QueryInterface(IID_PPV_ARG(IOleWindow, &toolbarOleWindow));
     if (FAILED(hResult))
@@ -862,7 +862,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::InitNew()
     hResult = CreateAddressBand(&navigationBar);
     if (FAILED(hResult))
         return hResult;
-    AddDockItem(navigationBar, ITBBID_ADDRESSBAND, CDockSite::ITF_NEWBANDALWAYS);
+    AddDockItem(navigationBar, ITBBID_ADDRESSBAND, CDockSite::ITF_NEWBANDALWAYS | CDockSite::ITF_GRIPPERALWAYS);
     hResult = navigationBar->QueryInterface(IID_PPV_ARG(IOleWindow, &navigationOleWindow));
     hResult = navigationOleWindow->GetWindow(&fNavigationWindow);
     fNavigationBar.Attach(navigationBar.Detach());
index f04815b..8cd95bb 100644 (file)
@@ -278,14 +278,17 @@ HRESULT STDMETHODCALLTYPE CToolsBand::SetSite(IUnknown* pUnkSite)
         LoadImage(shell32Instance, MAKEINTRESOURCE(214),
             IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE | LR_CREATEDIBSECTION));
 
-    DIBSECTION bitmapInfo;
-    GetObjectW(imageBitmap, sizeof(bitmapInfo), &bitmapInfo);
-    HIMAGELIST imageList = ImageList_Create(bitmapInfo.dsBm.bmHeight, bitmapInfo.dsBm.bmHeight, ILC_COLOR32, 4, 4);
+    if (imageBitmap)
+    {
+        DIBSECTION bitmapInfo;
+        GetObjectW(imageBitmap, sizeof(bitmapInfo), &bitmapInfo);
+        HIMAGELIST imageList = ImageList_Create(bitmapInfo.dsBm.bmHeight, bitmapInfo.dsBm.bmHeight, ILC_COLOR32, 4, 4);
 
-    ImageList_Add(imageList, imageBitmap, NULL);
-    DeleteObject(imageBitmap);
+        ImageList_Add(imageList, imageBitmap, NULL);
+        DeleteObject(imageBitmap);
 
-    SendMessage(TB_SETIMAGELIST, 0, (LPARAM)imageList);
+        SendMessage(TB_SETIMAGELIST, 0, (LPARAM) imageList);
+    }
 
     SendMessage(TB_ADDBUTTONSW, numShownButtons, (LPARAM)&tbButtonsAdd);