- Convert browseui to C++/ATL. As part of this, classes in browseui and now registered with .rgs files.
- Add AddressBand, AddressEditBox, BandProxy, BaseBar, BaseBarSite, BrandBand, InternetToolbar, ShellBrowser, ToolsBand, and TravelLog.
- Add stub implementations of commonbrowser, globalfoldersettings, and regtreeoptions.
- Clean up some msvc compile problems in a few files.
- Reorganize some headers to make them better match the Platform SDK.
- Move InlineIsEqualGUID to guiddef.h.
- Create new header files shlguid_undoc.h, shlobj_undoc.h, and shlwapi_undoc.h to hold undocumented types, functions, and GUIDs.
- Move some undocumented definitions declared in explorer_new/todo.h and undoc.h to new headers.
- Rename a few interfaces in explorer_new to the correct name
- Add definition of RBSTR_CHANGERECT to commctrl.h
- IDeskBarClient inherits from IOleWindow, not IUnknown
- HMONITOR was declared in both dxsdk/axextend.idl and wine/wined3d.idl, but not in wtypes.idl where it belongs
- Added Init and Term to CComModule
- Thanks to encoded for solving the browseui linking problem!
svn path=/trunk/; revision=43872
#include <oleidl.h>
#include <ole2.h>
#include <shlobj.h>
+#include <shlobj_undoc.h>
#include <shlwapi.h>
#include <servprov.h>
#include <shlguid.h>
+#include <shlguid_undoc.h>
#include <ocidl.h>
#include <objidl.h>
#include <docobj.h>
static const IStartMenuSiteVtbl IStartMenuSiteImpl_Vtbl;
static const IServiceProviderVtbl IServiceProviderImpl_Vtbl;
-static const IStartMenuCallbackVtbl IStartMenuCallbackImpl_Vtbl;
+static const ITrayPrivVtbl ITrayPrivImpl_Vtbl;
static const IOleCommandTargetVtbl IOleCommandTargetImpl_Vtbl;
typedef struct
{
const IStartMenuSiteVtbl *lpVtbl;
const IServiceProviderVtbl *lpServiceProviderVtbl;
- const IStartMenuCallbackVtbl *lpStartMenuCallbackVtbl;
+ const ITrayPrivVtbl *lpStartMenuCallbackVtbl;
const IOleCommandTargetVtbl *lpOleCommandTargetVtbl;
LONG Ref;
IMPL_CASTS(IStartMenuSite, IStartMenuSite, lpVtbl)
IMPL_CASTS(IServiceProvider, IStartMenuSite, lpServiceProviderVtbl)
-IMPL_CASTS(IStartMenuCallback, IStartMenuSite, lpStartMenuCallbackVtbl)
+IMPL_CASTS(ITrayPriv, IStartMenuSite, lpStartMenuCallbackVtbl)
IMPL_CASTS(IOleCommandTarget, IStartMenuSite, lpOleCommandTargetVtbl)
/*******************************************************************/
*ppvObj = IServiceProvider_from_IStartMenuSiteImpl(This);
}
else if (IsEqualIID(riid,
- &IID_IStartMenuCallback) ||
+ &IID_ITrayPriv) ||
IsEqualIID(riid,
&IID_IOleWindow))
{
- *ppvObj = IStartMenuCallback_from_IStartMenuSiteImpl(This);
+ *ppvObj = ITrayPriv_from_IStartMenuSiteImpl(This);
}
else if (IsEqualIID(riid,
&IID_IOleCommandTarget))
/*******************************************************************/
-METHOD_IUNKNOWN_INHERITED_ADDREF(IStartMenuCallback, IStartMenuSite)
-METHOD_IUNKNOWN_INHERITED_RELEASE(IStartMenuCallback, IStartMenuSite)
-METHOD_IUNKNOWN_INHERITED_QUERYINTERFACE(IStartMenuCallback, IStartMenuSite)
+METHOD_IUNKNOWN_INHERITED_ADDREF(ITrayPriv, IStartMenuSite)
+METHOD_IUNKNOWN_INHERITED_RELEASE(ITrayPriv, IStartMenuSite)
+METHOD_IUNKNOWN_INHERITED_QUERYINTERFACE(ITrayPriv, IStartMenuSite)
static HRESULT STDMETHODCALLTYPE
-IStartMenuSiteImpl_GetWindow(IN OUT IStartMenuCallback *iface,
+IStartMenuSiteImpl_GetWindow(IN OUT ITrayPriv *iface,
OUT HWND *phwnd)
{
- IStartMenuSiteImpl *This = IStartMenuSiteImpl_from_IStartMenuCallback(iface);
- DbgPrint("IStartMenuCallback::GetWindow\n");
+ IStartMenuSiteImpl *This = IStartMenuSiteImpl_from_ITrayPriv(iface);
+ DbgPrint("ITrayPriv::GetWindow\n");
*phwnd = ITrayWindow_GetHWND(This->Tray);
if (*phwnd != NULL)
}
static HRESULT STDMETHODCALLTYPE
-IStartMenuSiteImpl_ContextSensitiveHelp(IN OUT IStartMenuCallback *iface,
+IStartMenuSiteImpl_ContextSensitiveHelp(IN OUT ITrayPriv *iface,
IN BOOL fEnterMode)
{
- DbgPrint("IStartMenuCallback::ContextSensitiveHelp\n");
+ DbgPrint("ITrayPriv::ContextSensitiveHelp\n");
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE
-IStartMenuSiteImpl_Execute(IN OUT IStartMenuCallback *iface,
+IStartMenuSiteImpl_Execute(IN OUT ITrayPriv *iface,
IN IShellFolder *pShellFolder,
IN LPCITEMIDLIST pidl)
{
HMODULE hShlwapi;
HRESULT ret = S_FALSE;
- IStartMenuSiteImpl *This = IStartMenuSiteImpl_from_IStartMenuCallback(iface);
+ IStartMenuSiteImpl *This = IStartMenuSiteImpl_from_ITrayPriv(iface);
- DbgPrint("IStartMenuCallback::Execute\n");
+ DbgPrint("ITrayPriv::Execute\n");
hShlwapi = GetModuleHandle(TEXT("SHLWAPI.DLL"));
if (hShlwapi != NULL)
}
static HRESULT STDMETHODCALLTYPE
-IStartMenuSiteImpl_Unknown(IN OUT IStartMenuCallback *iface,
+IStartMenuSiteImpl_Unknown(IN OUT ITrayPriv *iface,
IN PVOID Unknown1,
IN PVOID Unknown2,
IN PVOID Unknown3,
IN PVOID Unknown4)
{
- DbgPrint("IStartMenuCallback::Unknown(0x%p,0x%p,0x%p,0x%p)\n", Unknown1, Unknown2, Unknown3, Unknown4);
+ DbgPrint("ITrayPriv::Unknown(0x%p,0x%p,0x%p,0x%p)\n", Unknown1, Unknown2, Unknown3, Unknown4);
return E_NOTIMPL;
}
}
static HRESULT STDMETHODCALLTYPE
-IStartMenuSiteImpl_AppendMenu(IN OUT IStartMenuCallback *iface,
+IStartMenuSiteImpl_AppendMenu(IN OUT ITrayPriv *iface,
OUT HMENU* phMenu)
{
HMENU hMenu, hSettingsMenu;
UINT uLastItemsCount = 5; /* 5 menu items below the last separator */
TCHAR szUser[128];
- DbgPrint("IStartMenuCallback::AppendMenu\n");
+ DbgPrint("ITrayPriv::AppendMenu\n");
hMenu = LoadPopupMenu(hExplorerInstance,
MAKEINTRESOURCE(IDM_STARTMENU));
return S_OK;
}
-static const IStartMenuCallbackVtbl IStartMenuCallbackImpl_Vtbl =
+static const ITrayPrivVtbl ITrayPrivImpl_Vtbl =
{
/*** IUnknown methods ***/
- METHOD_IUNKNOWN_INHERITED_QUERYINTERFACE_NAME(IStartMenuCallback, IStartMenuSite),
- METHOD_IUNKNOWN_INHERITED_ADDREF_NAME(IStartMenuCallback, IStartMenuSite),
- METHOD_IUNKNOWN_INHERITED_RELEASE_NAME(IStartMenuCallback, IStartMenuSite),
+ METHOD_IUNKNOWN_INHERITED_QUERYINTERFACE_NAME(ITrayPriv, IStartMenuSite),
+ METHOD_IUNKNOWN_INHERITED_ADDREF_NAME(ITrayPriv, IStartMenuSite),
+ METHOD_IUNKNOWN_INHERITED_RELEASE_NAME(ITrayPriv, IStartMenuSite),
/*** IOleWindow methods ***/
IStartMenuSiteImpl_GetWindow,
IStartMenuSiteImpl_ContextSensitiveHelp,
- /*** IStartMenuCallback methods ***/
+ /*** ITrayPriv methods ***/
IStartMenuSiteImpl_Execute,
IStartMenuSiteImpl_Unknown,
IStartMenuSiteImpl_AppendMenu
This->lpVtbl = &IStartMenuSiteImpl_Vtbl;
This->lpServiceProviderVtbl = &IServiceProviderImpl_Vtbl;
- This->lpStartMenuCallbackVtbl = &IStartMenuCallbackImpl_Vtbl;
+ This->lpStartMenuCallbackVtbl = &ITrayPrivImpl_Vtbl;
This->lpOleCommandTargetVtbl = &IOleCommandTargetImpl_Vtbl;
This->Ref = 1;
static const IObjectWithSiteVtbl IObjectWithSiteImpl_Vtbl;
static const IDeskBarVtbl IDeskBarImpl_Vtbl;
static const IPersistStreamVtbl IPersistStreamImpl_Vtbl;
-static const IWindowEventHandlerVtbl IWindowEventHandlerImpl_Vtbl;
+static const IWinEventHandlerVtbl IWinEventHandlerImpl_Vtbl;
typedef struct
{
const IObjectWithSiteVtbl *lpObjectWithSiteVtbl;
const IDeskBarVtbl *lpDeskBarVtbl;
const IPersistStreamVtbl *lpPersistStreamVtbl;
- const IWindowEventHandlerVtbl *lpWindowEventHandlerVtbl;
+ const IWinEventHandlerVtbl *lpWindowEventHandlerVtbl;
/* FIXME: Implement IOleCommandTarget */
LONG Ref;
IMPL_CASTS(IObjectWithSite, ITaskBand, lpObjectWithSiteVtbl)
IMPL_CASTS(IDeskBar, ITaskBand, lpDeskBarVtbl)
IMPL_CASTS(IPersistStream, ITaskBand, lpPersistStreamVtbl)
-IMPL_CASTS(IWindowEventHandler, ITaskBand, lpWindowEventHandlerVtbl)
+IMPL_CASTS(IWinEventHandler, ITaskBand, lpWindowEventHandlerVtbl)
static ULONG STDMETHODCALLTYPE
ITaskBandImpl_AddRef(IN OUT ITaskBand *iface)
*ppvObj = IDeskBar_from_ITaskBandImpl(This);
}
else if (IsEqualIID(riid,
- &IID_IWindowEventHandler))
+ &IID_IWinEventHandler))
{
/* When run on Windows the system queries this interface, which is completely
undocumented :( It's queried during initialization of the tray band site.
interface in the ITaskBand implementation is only actually used if we use
the same interface to forward messages to the IBandSite implementation of
the shell! */
- *ppvObj = IWindowEventHandler_from_ITaskBandImpl(This);
+ *ppvObj = IWinEventHandler_from_ITaskBandImpl(This);
}
#if 0
else if (IsEqualIID(riid,
/*****************************************************************************/
-METHOD_IUNKNOWN_INHERITED_ADDREF(IWindowEventHandler, ITaskBand)
-METHOD_IUNKNOWN_INHERITED_RELEASE(IWindowEventHandler, ITaskBand)
-METHOD_IUNKNOWN_INHERITED_QUERYINTERFACE(IWindowEventHandler, ITaskBand)
+METHOD_IUNKNOWN_INHERITED_ADDREF(IWinEventHandler, ITaskBand)
+METHOD_IUNKNOWN_INHERITED_RELEASE(IWinEventHandler, ITaskBand)
+METHOD_IUNKNOWN_INHERITED_QUERYINTERFACE(IWinEventHandler, ITaskBand)
static HRESULT STDMETHODCALLTYPE
-IWindowEventHandlerImpl_ProcessMessage(IN OUT IWindowEventHandler *iface,
+IWinEventHandlerImpl_ProcessMessage(IN OUT IWinEventHandler *iface,
IN HWND hWnd,
IN UINT uMsg,
IN WPARAM wParam,
IN LPARAM lParam,
OUT LRESULT *plrResult)
{
- DbgPrint("ITaskBand: IWindowEventHandler::ProcessMessage(0x%p, 0x%x, 0x%p, 0x%p, 0x%p)\n", hWnd, uMsg, wParam, lParam, plrResult);
+ DbgPrint("ITaskBand: IWinEventHandler::ProcessMessage(0x%p, 0x%x, 0x%p, 0x%p, 0x%p)\n", hWnd, uMsg, wParam, lParam, plrResult);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE
-IWindowEventHandlerImpl_ContainsWindow(IN OUT IWindowEventHandler *iface,
+IWinEventHandlerImpl_ContainsWindow(IN OUT IWinEventHandler *iface,
IN HWND hWnd)
{
- ITaskBandImpl *This = ITaskBandImpl_from_IWindowEventHandler(iface);
+ ITaskBandImpl *This = ITaskBandImpl_from_IWinEventHandler(iface);
HRESULT hRet = S_OK;
if (This->hWnd != hWnd ||
return hRet;
}
-static const IWindowEventHandlerVtbl IWindowEventHandlerImpl_Vtbl =
+static const IWinEventHandlerVtbl IWinEventHandlerImpl_Vtbl =
{
/*** IUnknown methods ***/
- METHOD_IUNKNOWN_INHERITED_QUERYINTERFACE_NAME(IWindowEventHandler, ITaskBand),
- METHOD_IUNKNOWN_INHERITED_ADDREF_NAME(IWindowEventHandler, ITaskBand),
- METHOD_IUNKNOWN_INHERITED_RELEASE_NAME(IWindowEventHandler, ITaskBand),
- /*** IWindowEventHandler methods ***/
- IWindowEventHandlerImpl_ProcessMessage,
- IWindowEventHandlerImpl_ContainsWindow
+ METHOD_IUNKNOWN_INHERITED_QUERYINTERFACE_NAME(IWinEventHandler, ITaskBand),
+ METHOD_IUNKNOWN_INHERITED_ADDREF_NAME(IWinEventHandler, ITaskBand),
+ METHOD_IUNKNOWN_INHERITED_RELEASE_NAME(IWinEventHandler, ITaskBand),
+ /*** IWinEventHandler methods ***/
+ IWinEventHandlerImpl_ProcessMessage,
+ IWinEventHandlerImpl_ContainsWindow
};
/*****************************************************************************/
This->lpObjectWithSiteVtbl = &IObjectWithSiteImpl_Vtbl;
This->lpDeskBarVtbl = &IDeskBarImpl_Vtbl;
This->lpPersistStreamVtbl = &IPersistStreamImpl_Vtbl;
- This->lpWindowEventHandlerVtbl = &IWindowEventHandlerImpl_Vtbl;
+ This->lpWindowEventHandlerVtbl = &IWinEventHandlerImpl_Vtbl;
This->Ref = 1;
This->Tray = Tray;
IUnknown *punkInner;
IBandSite *BandSite;
ITaskBand *TaskBand;
- IWindowEventHandler *WindowEventHandler;
+ IWinEventHandler *WindowEventHandler;
IContextMenu *ContextMenu;
HWND hWndRebar;
if (This->WindowEventHandler != NULL)
{
- IWindowEventHandler_Release(This->WindowEventHandler);
+ IWinEventHandler_Release(This->WindowEventHandler);
This->WindowEventHandler = NULL;
}
*ppvObj = IBandSite_from_ITrayBandSiteImpl(This);
}
else if (IsEqualIID(riid,
- &IID_IWindowEventHandler))
+ &IID_IWinEventHandler))
{
- DbgPrint("ITaskBandSite: IWindowEventHandler queried!\n");
+ DbgPrint("ITaskBandSite: IWinEventHandler queried!\n");
*ppvObj = NULL;
return E_NOINTERFACE;
}
}
};
- /* Forward to the shell's IWindowEventHandler interface to get the default
+ /* Forward to the shell's IWinEventHandler interface to get the default
shell behavior! */
if (This->WindowEventHandler != NULL)
{
- /*DbgPrint("Calling IWindowEventHandler::ProcessMessage(0x%p, 0x%x, 0x%p, 0x%p, 0x%p) This->hWndRebar=0x%p\n", hWnd, uMsg, wParam, lParam, plResult, This->hWndRebar);*/
- hRet = IWindowEventHandler_ProcessMessage(This->WindowEventHandler,
+ /*DbgPrint("Calling IWinEventHandler::ProcessMessage(0x%p, 0x%x, 0x%p, 0x%p, 0x%p) This->hWndRebar=0x%p\n", hWnd, uMsg, wParam, lParam, plResult, This->hWndRebar);*/
+ hRet = IWinEventHandler_OnWinEvent(This->WindowEventHandler,
hWnd,
uMsg,
wParam,
if (uMsg == WM_NOTIFY)
{
const NMHDR *nmh = (const NMHDR *)lParam;
- DbgPrint("ITrayBandSite->IWindowEventHandler::ProcessMessage: WM_NOTIFY for 0x%p, From: 0x%p, Code: NM_FIRST-%u returned 0x%x\n", hWnd, nmh->hwndFrom, NM_FIRST - nmh->code, hRet);
+ DbgPrint("ITrayBandSite->IWinEventHandler::ProcessMessage: WM_NOTIFY for 0x%p, From: 0x%p, Code: NM_FIRST-%u returned 0x%x\n", hWnd, nmh->hwndFrom, NM_FIRST - nmh->code, hRet);
}
else
{
- DbgPrint("ITrayBandSite->IWindowEventHandler::ProcessMessage(0x%p,0x%x,0x%p,0x%p,0x%p->0x%p) returned: 0x%x\n", hWnd, uMsg, wParam, lParam, plResult, *plResult, hRet);
+ DbgPrint("ITrayBandSite->IWinEventHandler::ProcessMessage(0x%p,0x%x,0x%p,0x%p,0x%p->0x%p) returned: 0x%x\n", hWnd, uMsg, wParam, lParam, plResult, *plResult, hRet);
}
}
}
}
hRet = IUnknown_QueryInterface(This->punkInner,
- &IID_IWindowEventHandler,
+ &IID_IWinEventHandler,
(PVOID*)&This->WindowEventHandler);
if (!SUCCEEDED(hRet))
{
static const GUID SID_HACK_SMenuPopup = {0xD1E7AFEB,0x6A2E,0x11D0,{0x8C,0x78,0x00,0xC0,0x4F,0xD9,0x18,0xB4}};
#define SID_SMenuPopup SID_HACK_SMenuPopup
-
-
-
#ifdef COBJMACROS
#define IDeskBarClient_QueryInterface(T,a,b) (T)->lpVtbl->QueryInterface(T,a,b)
#define IDeskBarClient_AddRef(T) (T)->lpVtbl->AddRef(T)
#define IDeskBarClient_GetSize(T,a,b) (T)->lpVtbl->GetSize(T,a,b)
#endif
-static const GUID IID_HACK_IShellService = {0x5836FB00,0x8187,0x11CF,{0xA1,0x2B,0x00,0xAA,0x00,0x4A,0xE8,0x37}};
-#define IID_IShellService IID_HACK_IShellService
-
-#define INTERFACE IShellService
-DECLARE_INTERFACE_(IShellService,IUnknown)
-{
- /*** IUnknown methods ***/
- STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
- STDMETHOD_(ULONG,AddRef)(THIS) PURE;
- STDMETHOD_(ULONG,Release)(THIS) PURE;
- /*** IShellService methods ***/
- STDMETHOD_(HRESULT,SetOwner)(THIS_ IUnknown*) PURE;
-};
-#undef INTERFACE
-
-#ifdef COBJMACROS
-#define IShellService_QueryInterface(T,a,b) (T)->lpVtbl->QueryInterface(T,a,b)
-#define IShellService_AddRef(T) (T)->lpVtbl->AddRef(T)
-#define IShellService_Release(T) (T)->lpVtbl->Release(T)
-#define IShellService_SetOwner(T,a) (T)->lpVtbl->SetOwner(T,a)
-#endif
-
#endif /* __TODO_H */
static const GUID IID_HACK_IMenuBand = {0x568804CD,0xCBD7,0x11D0,{0x98,0x16,0x00,0xC0,0x4F,0xD9,0x19,0x72}};
#define IID_IMenuBand IID_HACK_IMenuBand
-static const GUID IID_HACK_IStartMenuCallback = {0x4622AD10,0xFF23,0x11D0,{0x8D,0x34,0x00,0xA0,0xC9,0x0F,0x27,0x19}};
-#define IID_IStartMenuCallback IID_HACK_IStartMenuCallback
-
-#define INTERFACE IStartMenuCallback
-DECLARE_INTERFACE_(IStartMenuCallback,IUnknown)
-{
- /*** IUnknown ***/
- STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
- STDMETHOD_(ULONG,AddRef)(THIS) PURE;
- STDMETHOD_(ULONG,Release)(THIS) PURE;
- /*** IOleWindow methods ***/
- STDMETHOD_(HRESULT,GetWindow)(THIS_ HWND*) PURE;
- STDMETHOD_(HRESULT,ContextSensitiveHelp)(THIS_ BOOL) PURE;
- /*** IStartMenuCallback ***/
- STDMETHOD_(HRESULT,Execute)(THIS_ IShellFolder*,LPCITEMIDLIST) PURE;
- STDMETHOD_(HRESULT,Unknown)(THIS_ PVOID,PVOID,PVOID,PVOID) PURE;
- STDMETHOD_(HRESULT,AppendMenu)(THIS_ HMENU*) PURE;
-};
-#undef INTERFACE
-
-#ifdef COBJMACROS
-#define IStartMenuCallback_QueryInterface(T,a,b) (T)->lpVtbl->QueryInterface(T,a,b)
-#define IStartMenuCallback_AddRef(T) (T)->lpVtbl->AddRef(T)
-#define IStartMenuCallback_Release(T) (T)->lpVtbl->Release(T)
-#define IStartMenuCallback_GetWindow(T,a) (T)->lpVtbl->GetWindow(T,a)
-#define IStartMenuCallback_ContextSensitiveHelp(T,a) (T)->lpVtbl->ContextSensitiveHelp(T,a)
-#define IStartMenuCallback_Execute(T,a,b) (T)->lpVtbl->Execute(T,a,b)
-#define IStartMenuCallback_Unknown(T,a,b,c,d) (T)->lpVtbl->Unknown(T,a,b,c,d)
-#define IStartMenuCallback_AppendMenu(T,a) (T)->lpVtbl->AppendMenu(T,a)
-#endif
-
-#define INTERFACE IBandSiteStreamCallback
-DECLARE_INTERFACE_(IBandSiteStreamCallback,IUnknown)
-{
- /*** IUnknown ***/
- STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
- STDMETHOD_(ULONG,AddRef)(THIS) PURE;
- STDMETHOD_(ULONG,Release)(THIS) PURE;
- /*** IBandSiteStreamCallback ***/
- STDMETHOD_(HRESULT,OnLoad)(THIS_ IStream *pStm, REFIID riid, PVOID *pvObj) PURE;
- STDMETHOD_(HRESULT,OnSave)(THIS_ IUnknown *pUnk, IStream *pStm) PURE;
-};
-#undef INTERFACE
-
-#ifdef COBJMACROS
-#define IBandSiteStreamCallback_QueryInterface(T,a,b) (T)->lpVtbl->QueryInterface(T,a,b)
-#define IBandSiteStreamCallback_AddRef(T) (T)->lpVtbl->AddRef(T)
-#define IBandSiteStreamCallback_Release(T) (T)->lpVtbl->Release(T)
-#define IBandSiteStreamCallback_OnLoad(T,a,b,c) (T)->lpVtbl->OnLoad(T,a,b,c)
-#define IBandSiteStreamCallback_OnSave(T,a,b) (T)->lpVtbl->OnSave(T,a,b)
-#endif
-
-static const GUID IID_HACK_IWindowEventHandler = {0xEA5F2D61,0xE008,0x11CF,{0x99,0xCB,0x00,0xC0,0x4F,0xD6,0x44,0x97}};
-#define IID_IWindowEventHandler IID_HACK_IWindowEventHandler
-
-#define INTERFACE IWindowEventHandler
-DECLARE_INTERFACE_(IWindowEventHandler,IUnknown)
-{
- /*** IUnknown ***/
- STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
- STDMETHOD_(ULONG,AddRef)(THIS) PURE;
- STDMETHOD_(ULONG,Release)(THIS) PURE;
- /*** IWindowEventHandler ***/
- STDMETHOD(ProcessMessage)(THIS_ HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plrResult) PURE;
- STDMETHOD(ContainsWindow)(THIS_ HWND hWnd) PURE;
-};
-#undef INTERFACE
-
-#ifdef COBJMACROS
-#define IWindowEventHandler_QueryInterface(T,a,b) (T)->lpVtbl->QueryInterface(T,a,b)
-#define IWindowEventHandler_AddRef(T) (T)->lpVtbl->AddRef(T)
-#define IWindowEventHandler_Release(T) (T)->lpVtbl->Release(T)
-#define IWindowEventHandler_ProcessMessage(T,a,b,c,d,e) (T)->lpVtbl->ProcessMessage(T,a,b,c,d,e)
-#define IWindowEventHandler_ContainsWindow(T,a) (T)->lpVtbl->ContainsWindow(T,a)
-#endif
-
-#define INTERFACE IShellDesktopTray
-DECLARE_INTERFACE_(IShellDesktopTray,IUnknown)
-{
- /*** IUnknown ***/
- STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
- STDMETHOD_(ULONG,AddRef)(THIS) PURE;
- STDMETHOD_(ULONG,Release)(THIS) PURE;
- /*** IShellDesktopTray ***/
- STDMETHOD_(ULONG,GetState)(THIS) PURE;
- STDMETHOD(GetTrayWindow)(THIS_ HWND*) PURE;
- STDMETHOD(RegisterDesktopWindow)(THIS_ HWND) PURE;
- STDMETHOD(Unknown)(THIS_ DWORD,DWORD) PURE;
-};
-#undef INTERFACE
-
-#ifdef COBJMACROS
-#define IShellDesktopTray_QueryInterface(T,a,b) (T)->lpVtbl->QueryInterface(T,a,b)
-#define IShellDesktopTray_AddRef(T) (T)->lpVtbl->AddRef(T)
-#define IShellDesktopTray_Release(T) (T)->lpVtbl->Release(T)
-#define IShellDesktopTray_GetState(T) (T)->lpVtbl->GetState(T)
-#define IShellDesktopTray_GetTrayWindow(T,a) (T)->lpVtbl->GetTrayWindow(T,a)
-#define IShellDesktopTray_RegisterDesktopWindow(T,a) (T)->lpVtbl->RegisterDesktopWindow(T,a)
-#define IShellDesktopTray_Unknown(T,a,b) (T)->lpVtbl->Unknown(T,a,b)
-#endif
-
-#if 0
-HANDLE WINAPI SHCreateDesktop(IShellDesktopTray*);
-BOOL WINAPI SHDesktopMessageLoop(HANDLE);
-#else
-typedef HANDLE (WINAPI *PSHCreateDesktop)(IShellDesktopTray*);
-static __inline HANDLE
-SHCreateDesktop(IShellDesktopTray* sdt)
-{
- static PSHCreateDesktop Func = NULL;
-
- if (Func == NULL)
- {
- HMODULE hShlwapi;
- hShlwapi = LoadLibrary(TEXT("SHELL32.DLL"));
- if (hShlwapi != NULL)
- {
- Func = (PSHCreateDesktop)GetProcAddress(hShlwapi, (LPCSTR)200);
- }
- }
-
- if (Func != NULL)
- {
- return Func(sdt);
- }
-
- MessageBox(NULL, TEXT("SHCreateDesktop not available"), NULL, 0);
- return NULL;
-}
-
-typedef BOOL (WINAPI *PSHDesktopMessageLoop)(HANDLE);
-static __inline BOOL
-SHDesktopMessageLoop(IN HANDLE hDesktop)
-{
- static PSHDesktopMessageLoop Func = NULL;
-
- if (Func == NULL)
- {
- HMODULE hShlwapi;
- hShlwapi = LoadLibrary(TEXT("SHELL32.DLL"));
- if (hShlwapi != NULL)
- {
- Func = (PSHDesktopMessageLoop)GetProcAddress(hShlwapi, (LPCSTR)201);
- }
- }
-
- if (Func != NULL)
- {
- return Func(hDesktop);
- }
-
- MessageBox(NULL, TEXT("SHDesktopMessageLoop not available"), NULL, 0);
- return FALSE;
-}
-#endif
-
#define WM_GETISHELLBROWSER (WM_USER+7)
BOOL WINAPI SetShellWindow(HWND);
BOOL WINAPI SetShellWindowEx(HWND, HWND);
IStream* WINAPI SHGetViewStream(LPCITEMIDLIST, DWORD, LPCTSTR, LPCTSTR, LPCTSTR);
BOOL WINAPI SHIsEmptyStream(IStream*);
-typedef struct tagCREATEMRULISTA
-{
- DWORD cbSize;
- DWORD nMaxItems;
- DWORD dwFlags;
- HKEY hKey;
- LPCSTR lpszSubKey;
- PROC lpfnCompare;
-} CREATEMRULISTA, *LPCREATEMRULISTA;
-typedef struct tagCREATEMRULISTW
-{
- DWORD cbSize;
- DWORD nMaxItems;
- DWORD dwFlags;
- HKEY hKey;
- LPCWSTR lpszSubKey;
- PROC lpfnCompare;
-} CREATEMRULISTW, *LPCREATEMRULISTW;
-
#define MRU_BINARY 0x1
#define MRU_CACHEWRITE 0x2
BOOL WINAPI DrawCaptionTempW(HWND,HDC,const RECT*,HFONT,HICON,LPCWSTR,UINT);
#ifdef UNICODE
-typedef CREATEMRULISTW CREATEMRULIST, *PCREATEMRULIST;
#define CreateMRUList CreateMRUListW
#define DrawCaptionTemp DrawCaptionTempW
#else
-typedef CREATEMRULISTA CREATEMRULIST, *PCREATEMRULIST;
#define CreateMRUList CreateMRUListA
#define DrawCaptionTemp DrawCaptionTempA
#endif
HRESULT WINAPI SHPropertyBag_ReadPOINTL(IPropertyBag*,LPCWSTR,POINTL*);
-#if 0
-HRESULT WINAPI SHGetPerScreenResName(OUT LPWSTR lpResName,
- IN INT cchResName,
- IN DWORD dwReserved);
-#else
-typedef HRESULT (WINAPI *PSHGetPerScreenResName)(LPWSTR,INT,DWORD);
-static __inline HRESULT
-SHGetPerScreenResName(OUT LPWSTR lpResName,
- IN INT cchResName,
- IN DWORD dwReserved OPTIONAL)
-{
- static PSHGetPerScreenResName Func = NULL;
-
- if (Func == NULL)
- {
- HMODULE hShlwapi;
- hShlwapi = LoadLibrary(TEXT("SHLWAPI.DLL"));
- if (hShlwapi != NULL)
- {
- Func = (PSHGetPerScreenResName)GetProcAddress(hShlwapi, (LPCSTR)533);
- }
- }
-
- if (Func != NULL)
- {
- return Func(lpResName, cchResName, dwReserved);
- }
-
- MessageBox(NULL, TEXT("SHGetPerScreenResName not available"), NULL, 0);
- return E_NOTIMPL;
-}
-#endif
-
-#if 0
-HRESULT WINAPI SHPropertyBag_ReadStream(IPropertyBag*,LPCWSTR,IStream**);
-#else
-typedef HRESULT (WINAPI *PSHPropertyBag_ReadStream)(IPropertyBag*,LPCWSTR,IStream**);
-static __inline HRESULT
-SHPropertyBag_ReadStream(IN IPropertyBag *ppb,
- IN LPCWSTR pszPropName,
- OUT IStream **ppStream)
-{
- static PSHPropertyBag_ReadStream Func = NULL;
-
- if (Func == NULL)
- {
- HMODULE hShlwapi;
- hShlwapi = LoadLibrary(TEXT("SHLWAPI.DLL"));
- if (hShlwapi != NULL)
- {
- Func = (PSHPropertyBag_ReadStream)GetProcAddress(hShlwapi, (LPCSTR)531);
- }
- }
-
- if (Func != NULL)
- {
- return Func(ppb, pszPropName, ppStream);
- }
-
- MessageBox(NULL, TEXT("SHPropertyBag_ReadStream not available"), NULL, 0);
- return E_NOTIMPL;
-}
-#endif
-
#endif /* _EXPLORER_UNDOC__H */
+++ /dev/null
-/*
- * Multisource AutoComplete list
- *
- * Copyright 2007 Mikolaj Zalewski
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#include "config.h"
-
-#include <stdarg.h>
-
-#define COBJMACROS
-
-#include "wine/debug.h"
-#include "windef.h"
-#include "winbase.h"
-#include "winreg.h"
-#include "winuser.h"
-#include "shlwapi.h"
-#include "winerror.h"
-#include "objbase.h"
-
-#include "shlguid.h"
-#include "shlobj.h"
-
-#include "wine/unicode.h"
-
-#include "browseui.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(browseui);
-
-struct ACLMultiSublist {
- IUnknown *punk;
- IEnumString *pEnum;
- IACList *pACL;
-};
-
-typedef struct tagACLMulti {
- const IEnumStringVtbl *vtbl;
- const IACListVtbl *aclVtbl;
- const IObjMgrVtbl *objmgrVtbl;
- LONG refCount;
- INT nObjs;
- INT currObj;
- struct ACLMultiSublist *objs;
-} ACLMulti;
-
-static const IEnumStringVtbl ACLMultiVtbl;
-static const IACListVtbl ACLMulti_ACListVtbl;
-static const IObjMgrVtbl ACLMulti_ObjMgrVtbl;
-
-static inline ACLMulti *impl_from_IACList(IACList *iface)
-{
- return (ACLMulti *)((char *)iface - FIELD_OFFSET(ACLMulti, aclVtbl));
-}
-
-static inline ACLMulti *impl_from_IObjMgr(IObjMgr *iface)
-{
- return (ACLMulti *)((char *)iface - FIELD_OFFSET(ACLMulti, objmgrVtbl));
-}
-
-static void release_obj(struct ACLMultiSublist *obj)
-{
- IUnknown_Release(obj->punk);
- if (obj->pEnum)
- IEnumString_Release(obj->pEnum);
- if (obj->pACL)
- IACList_Release(obj->pACL);
-}
-
-HRESULT WINAPI ACLMulti_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
-{
- ACLMulti *This;
- if (pUnkOuter)
- return CLASS_E_NOAGGREGATION;
-
- This = CoTaskMemAlloc(sizeof(ACLMulti));
- if (This == NULL)
- return E_OUTOFMEMORY;
- ZeroMemory(This, sizeof(*This));
- This->vtbl = &ACLMultiVtbl;
- This->aclVtbl = &ACLMulti_ACListVtbl;
- This->objmgrVtbl = &ACLMulti_ObjMgrVtbl;
- This->refCount = 1;
-
- TRACE("returning %p\n", This);
- *ppOut = (IUnknown *)This;
- BROWSEUI_refCount++;
- return S_OK;
-}
-
-static void WINAPI ACLMulti_Destructor(ACLMulti *This)
-{
- int i;
- TRACE("destroying %p\n", This);
- for (i = 0; i < This->nObjs; i++)
- release_obj(&This->objs[i]);
- CoTaskMemFree(This->objs);
- CoTaskMemFree(This);
- BROWSEUI_refCount--;
-}
-
-static HRESULT WINAPI ACLMulti_QueryInterface(IEnumString *iface, REFIID iid, LPVOID *ppvOut)
-{
- ACLMulti *This = (ACLMulti *)iface;
- *ppvOut = NULL;
-
- if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumString))
- {
- *ppvOut = This;
- }
- else if (IsEqualIID(iid, &IID_IACList))
- {
- *ppvOut = &This->aclVtbl;
- }
- else if (IsEqualIID(iid, &IID_IObjMgr))
- {
- *ppvOut = &This->objmgrVtbl;
- }
-
- if (*ppvOut)
- {
- IUnknown_AddRef(iface);
- return S_OK;
- }
-
- WARN("unsupported interface: %s\n", debugstr_guid(iid));
- return E_NOINTERFACE;
-}
-
-static ULONG WINAPI ACLMulti_AddRef(IEnumString *iface)
-{
- ACLMulti *This = (ACLMulti *)iface;
- return InterlockedIncrement(&This->refCount);
-}
-
-static ULONG WINAPI ACLMulti_Release(IEnumString *iface)
-{
- ACLMulti *This = (ACLMulti *)iface;
- ULONG ret;
-
- ret = InterlockedDecrement(&This->refCount);
- if (ret == 0)
- ACLMulti_Destructor(This);
- return ret;
-}
-
-static HRESULT WINAPI ACLMulti_Append(IObjMgr *iface, IUnknown *obj)
-{
- ACLMulti *This = impl_from_IObjMgr(iface);
-
- TRACE("(%p, %p)\n", This, obj);
- if (obj == NULL)
- return E_FAIL;
-
- This->objs = CoTaskMemRealloc(This->objs, sizeof(This->objs[0]) * (This->nObjs+1));
- This->objs[This->nObjs].punk = obj;
- IUnknown_AddRef(obj);
- if (FAILED(IUnknown_QueryInterface(obj, &IID_IEnumString, (LPVOID *)&This->objs[This->nObjs].pEnum)))
- This->objs[This->nObjs].pEnum = NULL;
- if (FAILED(IUnknown_QueryInterface(obj, &IID_IACList, (LPVOID *)&This->objs[This->nObjs].pACL)))
- This->objs[This->nObjs].pACL = NULL;
- This->nObjs++;
- return S_OK;
-}
-
-static HRESULT WINAPI ACLMulti_Remove(IObjMgr *iface, IUnknown *obj)
-{
- ACLMulti *This = impl_from_IObjMgr(iface);
- int i;
-
- TRACE("(%p, %p)\n", This, obj);
- for (i = 0; i < This->nObjs; i++)
- if (This->objs[i].punk == obj)
- {
- release_obj(&This->objs[i]);
- memmove(&This->objs[i], &This->objs[i+1], (This->nObjs-i-1)*sizeof(struct ACLMultiSublist));
- This->nObjs--;
- This->objs = CoTaskMemRealloc(This->objs, sizeof(This->objs[0]) * This->nObjs);
- return S_OK;
- }
-
- return E_FAIL;
-}
-
-static HRESULT WINAPI ACLMulti_Next(IEnumString *iface, ULONG celt, LPOLESTR *rgelt, ULONG *pceltFetched)
-{
- ACLMulti *This = (ACLMulti *)iface;
-
- TRACE("(%p, %d, %p, %p)\n", iface, celt, rgelt, pceltFetched);
- while (This->currObj < This->nObjs)
- {
- if (This->objs[This->currObj].pEnum)
- {
- /* native browseui 6.0 also returns only one element */
- HRESULT ret = IEnumString_Next(This->objs[This->currObj].pEnum, 1, rgelt, pceltFetched);
- if (ret != S_FALSE)
- return ret;
- }
- This->currObj++;
- }
-
- if (pceltFetched)
- *pceltFetched = 0;
- *rgelt = NULL;
- return S_FALSE;
-}
-
-static HRESULT WINAPI ACLMulti_Reset(IEnumString *iface)
-{
- ACLMulti *This = (ACLMulti *)iface;
- int i;
-
- This->currObj = 0;
- for (i = 0; i < This->nObjs; i++)
- {
- if (This->objs[i].pEnum)
- IEnumString_Reset(This->objs[i].pEnum);
- }
- return S_OK;
-}
-
-static HRESULT WINAPI ACLMulti_Skip(IEnumString *iface, ULONG celt)
-{
- /* native browseui 6.0 returns this: */
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI ACLMulti_Clone(IEnumString *iface, IEnumString **ppOut)
-{
- *ppOut = NULL;
- /* native browseui 6.0 returns this: */
- return E_OUTOFMEMORY;
-}
-
-static HRESULT WINAPI ACLMulti_Expand(IACList *iface, LPCWSTR wstr)
-{
- ACLMulti *This = impl_from_IACList(iface);
- HRESULT res = S_OK;
- int i;
-
- for (i = 0; i < This->nObjs; i++)
- {
- if (!This->objs[i].pACL)
- continue;
- res = IACList_Expand(This->objs[i].pACL, wstr);
- if (res == S_OK)
- break;
- }
- return res;
-}
-
-static const IEnumStringVtbl ACLMultiVtbl =
-{
- ACLMulti_QueryInterface,
- ACLMulti_AddRef,
- ACLMulti_Release,
-
- ACLMulti_Next,
- ACLMulti_Skip,
- ACLMulti_Reset,
- ACLMulti_Clone
-};
-
-static HRESULT WINAPI ACLMulti_IObjMgr_QueryInterface(IObjMgr *iface, REFIID iid, LPVOID *ppvOut)
-{
- ACLMulti *This = impl_from_IObjMgr(iface);
- return ACLMulti_QueryInterface((IEnumString *)This, iid, ppvOut);
-}
-
-static ULONG WINAPI ACLMulti_IObjMgr_AddRef(IObjMgr *iface)
-{
- ACLMulti *This = impl_from_IObjMgr(iface);
- return ACLMulti_AddRef((IEnumString *)This);
-}
-
-static ULONG WINAPI ACLMulti_IObjMgr_Release(IObjMgr *iface)
-{
- ACLMulti *This = impl_from_IObjMgr(iface);
- return ACLMulti_Release((IEnumString *)This);
-}
-
-static const IObjMgrVtbl ACLMulti_ObjMgrVtbl =
-{
- ACLMulti_IObjMgr_QueryInterface,
- ACLMulti_IObjMgr_AddRef,
- ACLMulti_IObjMgr_Release,
-
- ACLMulti_Append,
- ACLMulti_Remove
-};
-
-static HRESULT WINAPI ACLMulti_IACList_QueryInterface(IACList *iface, REFIID iid, LPVOID *ppvOut)
-{
- ACLMulti *This = impl_from_IACList(iface);
- return ACLMulti_QueryInterface((IEnumString *)This, iid, ppvOut);
-}
-
-static ULONG WINAPI ACLMulti_IACList_AddRef(IACList *iface)
-{
- ACLMulti *This = impl_from_IACList(iface);
- return ACLMulti_AddRef((IEnumString *)This);
-}
-
-static ULONG WINAPI ACLMulti_IACList_Release(IACList *iface)
-{
- ACLMulti *This = impl_from_IACList(iface);
- return ACLMulti_Release((IEnumString *)This);
-}
-
-static const IACListVtbl ACLMulti_ACListVtbl =
-{
- ACLMulti_IACList_QueryInterface,
- ACLMulti_IACList_AddRef,
- ACLMulti_IACList_Release,
-
- ACLMulti_Expand
-};
--- /dev/null
+/*
+ * Multisource AutoComplete list
+ *
+ * Copyright 2007 Mikolaj Zalewski
+ * Copyright 2009 Andrew Hill
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <windows.h>
+#include <shlobj.h>
+#include <shlobj_undoc.h>
+#include <shlguid.h>
+#include <shlguid_undoc.h>
+#include <tchar.h>
+#include <atlbase.h>
+#include <atlcom.h>
+#include <atlwin.h>
+#include "resource.h"
+#include "wine/debug.h"
+#include "aclmulti.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(browseui);
+
+void CACLMulti::release_obj(struct ACLMultiSublist *obj)
+{
+ obj->punk->Release();
+ if (obj->pEnum)
+ obj->pEnum->Release();
+ if (obj->pACL)
+ obj->pACL->Release();
+}
+
+CACLMulti::CACLMulti()
+{
+ fObjectCount = 0;
+ fCurrentObject = 0;
+ fObjects = NULL;
+}
+
+CACLMulti::~CACLMulti()
+{
+ int i;
+
+ TRACE("destroying %p\n", this);
+ for (i = 0; i < fObjectCount; i++)
+ release_obj(&fObjects[i]);
+ CoTaskMemFree(fObjects);
+}
+
+HRESULT STDMETHODCALLTYPE CACLMulti::Append(IUnknown *punk)
+{
+ TRACE("(%p, %p)\n", this, punk);
+ if (punk == NULL)
+ return E_FAIL;
+
+ fObjects = reinterpret_cast<struct ACLMultiSublist *>(CoTaskMemRealloc(fObjects, sizeof(fObjects[0]) * (fObjectCount + 1)));
+ fObjects[fObjectCount].punk = punk;
+ punk->AddRef();
+ if (FAILED(punk->QueryInterface(IID_IEnumString, (void **)&fObjects[fObjectCount].pEnum)))
+ fObjects[fObjectCount].pEnum = NULL;
+ if (FAILED(punk->QueryInterface(IID_IACList, (void **)&fObjects[fObjectCount].pACL)))
+ fObjects[fObjectCount].pACL = NULL;
+ fObjectCount++;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CACLMulti::Remove(IUnknown *punk)
+{
+ int i;
+
+ TRACE("(%p, %p)\n", this, punk);
+ for (i = 0; i < fObjectCount; i++)
+ if (fObjects[i].punk == punk)
+ {
+ release_obj(&fObjects[i]);
+ memmove(&fObjects[i], &fObjects[i + 1], (fObjectCount - i - 1) * sizeof(struct ACLMultiSublist));
+ fObjectCount--;
+ fObjects = reinterpret_cast<struct ACLMultiSublist *>(CoTaskMemRealloc(fObjects, sizeof(fObjects[0]) * fObjectCount));
+ return S_OK;
+ }
+
+ return E_FAIL;
+}
+
+HRESULT STDMETHODCALLTYPE CACLMulti::Next(ULONG celt, LPOLESTR *rgelt, ULONG *pceltFetched)
+{
+ TRACE("(%p, %d, %p, %p)\n", this, celt, rgelt, pceltFetched);
+ while (fCurrentObject < fObjectCount)
+ {
+ if (fObjects[fCurrentObject].pEnum)
+ {
+ /* native browseui 6.0 also returns only one element */
+ HRESULT ret = fObjects[fCurrentObject].pEnum->Next(1, rgelt, pceltFetched);
+ if (ret != S_FALSE)
+ return ret;
+ }
+ fCurrentObject++;
+ }
+
+ if (pceltFetched)
+ *pceltFetched = 0;
+ *rgelt = NULL;
+ return S_FALSE;
+}
+
+HRESULT STDMETHODCALLTYPE CACLMulti::Reset()
+{
+ int i;
+
+ fCurrentObject = 0;
+ for (i = 0; i < fObjectCount; i++)
+ {
+ if (fObjects[i].pEnum)
+ fObjects[i].pEnum->Reset();
+ }
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CACLMulti::Skip(ULONG celt)
+{
+ /* native browseui 6.0 returns this: */
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CACLMulti::Clone(IEnumString **ppOut)
+{
+ *ppOut = NULL;
+ /* native browseui 6.0 returns this: */
+ return E_OUTOFMEMORY;
+}
+
+HRESULT STDMETHODCALLTYPE CACLMulti::Expand(LPCWSTR wstr)
+{
+ HRESULT res = S_OK;
+ int i;
+
+ for (i = 0; i < fObjectCount; i++)
+ {
+ if (!fObjects[i].pACL)
+ continue;
+ res = fObjects[i].pACL->Expand(wstr);
+ if (res == S_OK)
+ break;
+ }
+ return res;
+}
--- /dev/null
+/*
+ * Multisource AutoComplete list
+ *
+ * Copyright 2007 Mikolaj Zalewski
+ * Copyright 2009 Andrew Hill
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _aclmulti_h
+#define _aclmulti_h
+
+class CACLMulti :
+ public CComCoClass<CACLMulti, &CLSID_ACLMulti>,
+ public CComObjectRootEx<CComMultiThreadModelNoCS>,
+ public IEnumString,
+ public IACList,
+ public IObjMgr
+{
+private:
+ struct ACLMultiSublist
+ {
+ IUnknown *punk;
+ IEnumString *pEnum;
+ IACList *pACL;
+ };
+
+ INT fObjectCount;
+ INT fCurrentObject;
+ struct ACLMultiSublist *fObjects;
+public:
+ CACLMulti();
+ ~CACLMulti();
+
+ // *** IEnumString methods ***
+ virtual HRESULT STDMETHODCALLTYPE Next(ULONG celt, LPOLESTR *rgelt, ULONG *pceltFetched);
+ virtual HRESULT STDMETHODCALLTYPE Skip(ULONG celt);
+ virtual HRESULT STDMETHODCALLTYPE Reset();
+ virtual HRESULT STDMETHODCALLTYPE Clone(IEnumString **ppenum);
+
+ // *** IACList methods ***
+ virtual HRESULT STDMETHODCALLTYPE Expand(LPCOLESTR pszExpand);
+
+ // *** IObjMgr methods ***
+ virtual HRESULT STDMETHODCALLTYPE Append(IUnknown *punk);
+ virtual HRESULT STDMETHODCALLTYPE Remove(IUnknown *punk);
+
+private:
+ void release_obj(struct ACLMultiSublist *obj);
+
+public:
+
+DECLARE_REGISTRY_RESOURCEID(IDR_ACLMULTI)
+DECLARE_NOT_AGGREGATABLE(CACLMulti)
+
+DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+BEGIN_COM_MAP(CACLMulti)
+ COM_INTERFACE_ENTRY_IID(IID_IEnumString, IEnumString)
+ COM_INTERFACE_ENTRY_IID(IID_IACList, IACList)
+ COM_INTERFACE_ENTRY_IID(IID_IObjMgr, IObjMgr)
+END_COM_MAP()
+};
+
+#endif // _aclmulti_h
--- /dev/null
+/*
+ * ReactOS Explorer
+ *
+ * Copyright 2009 Andrew Hill <ash77 at domain reactos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+Implements the navigation band of the cabinet window
+*/
+#include <windows.h>
+#include <shlobj.h>
+#include <shlobj_undoc.h>
+#include <shlguid.h>
+#include <shlguid_undoc.h>
+#include <tchar.h>
+#include <atlbase.h>
+#include <atlcom.h>
+#include <atlwin.h>
+#include "resource.h"
+#include "addressband.h"
+
+/*
+TODO:
+****Add command handler for show/hide Go button to OnWinEvent
+****Add tooltip notify handler
+ **Properly implement GetBandInfo
+ **Add support for showing/hiding Go button
+ **Fix so Go button will be shown/hidden properly on load
+ **Add correct text to Go button
+ **Implement TranslateAcceleratorIO
+ Implement Exec
+ Implement QueryService
+ Implement Load
+ Implement Save
+*/
+
+CAddressBand::CAddressBand()
+{
+ fEditControl = NULL;
+ fGoButton = NULL;
+ fComboBox = NULL;
+ fGoButtonShown = false;
+}
+
+CAddressBand::~CAddressBand()
+{
+}
+
+void CAddressBand::FocusChange(BOOL bFocus)
+{
+// m_bFocus = bFocus;
+
+ //Inform the input object site that the focus has changed.
+ if (fSite)
+ {
+#if 0
+ fSite->OnFocusChangeIS((IDockingWindow *)this, bFocus);
+#endif
+ }
+}
+
+HRESULT STDMETHODCALLTYPE CAddressBand::GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi)
+{
+ if (pdbi->dwMask & DBIM_MINSIZE)
+ {
+ pdbi->ptMinSize.x = 400;
+ pdbi->ptMinSize.y = 22;
+ }
+ if (pdbi->dwMask & DBIM_MAXSIZE)
+ {
+ pdbi->ptMaxSize.x = 0;
+ pdbi->ptMaxSize.y = 0;
+ }
+ if (pdbi->dwMask & DBIM_INTEGRAL)
+ {
+ pdbi->ptIntegral.x = 0;
+ pdbi->ptIntegral.y = 0;
+ }
+ if (pdbi->dwMask & DBIM_ACTUAL)
+ {
+ pdbi->ptActual.x = 400;
+ pdbi->ptActual.y = 22;
+ }
+ if (pdbi->dwMask & DBIM_TITLE)
+ wcscpy(pdbi->wszTitle, L"Address");
+ if (pdbi->dwMask & DBIM_MODEFLAGS)
+ pdbi->dwModeFlags = DBIMF_UNDELETEABLE;
+ if (pdbi->dwMask & DBIM_BKCOLOR)
+ pdbi->crBkgnd = 0;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressBand::SetSite(IUnknown *pUnkSite)
+{
+ CComPtr<IShellService> shellService;
+ CComPtr<IUnknown> offset34;
+ HWND parentWindow;
+ IOleWindow *oleWindow;
+ HWND toolbar;
+ static const TBBUTTON buttonInfo[] = { {0, 1, TBSTATE_ENABLED, 0} };
+ HIMAGELIST normalImagelist;
+ HIMAGELIST hotImageList;
+ HINSTANCE shellInstance;
+ HRESULT hResult;
+
+ fSite.Release();
+ if (pUnkSite == NULL)
+ return S_OK;
+ hResult = pUnkSite->QueryInterface(IID_IDockingWindowSite, (void **)&fSite);
+ if (FAILED(hResult))
+ return hResult;
+ parentWindow = NULL;
+ hResult = pUnkSite->QueryInterface(IID_IOleWindow, (void **)&oleWindow);
+ if (SUCCEEDED(hResult))
+ {
+ oleWindow->GetWindow(&parentWindow);
+ oleWindow->Release();
+ }
+ if (!::IsWindow(parentWindow))
+ return E_FAIL;
+
+ toolbar = CreateWindowEx(WS_EX_TOOLWINDOW, WC_COMBOBOXEXW, NULL, WS_CHILD | WS_VISIBLE |
+ WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY,
+ 0, 0, 500, 250, parentWindow, (HMENU)0xa205, _AtlBaseModule.GetModuleInstance(), 0);
+ if (toolbar == NULL)
+ return E_FAIL;
+ SubclassWindow(toolbar);
+ SendMessage(CBEM_SETEXTENDEDSTYLE, CBES_EX_CASESENSITIVE | CBES_EX_NOSIZELIMIT, CBES_EX_CASESENSITIVE | CBES_EX_NOSIZELIMIT);
+ fEditControl = (HWND)SendMessage(CBEM_GETEDITCONTROL, 0, 0);
+ fComboBox = (HWND)SendMessage(CBEM_GETCOMBOCONTROL, 0, 0);
+#if 1
+ hResult = CoCreateInstance(CLSID_AddressEditBox, NULL, CLSCTX_INPROC_SERVER, IID_IAddressEditBox, (void **)&fAddressEditBox);
+ if (FAILED(hResult))
+ return hResult;
+#else
+ // instantiate new version
+#endif
+ hResult = fAddressEditBox->QueryInterface(IID_IShellService, (void **)&shellService);
+ if (FAILED(hResult))
+ return hResult;
+ hResult = fAddressEditBox->Init(toolbar, fEditControl, 8, pUnkSite /*(IAddressBand *)this*/ );
+ if (FAILED(hResult))
+ return hResult;
+ hResult = shellService->SetOwner(pUnkSite);
+ if (FAILED(hResult))
+ return hResult;
+
+ // TODO: properly initialize this from registry
+ fGoButtonShown = true;
+
+ shellInstance = GetModuleHandle(_T("shell32.dll"));
+ normalImagelist = ImageList_LoadImageW(shellInstance, MAKEINTRESOURCE(IDB_GOBUTTON_NORMAL), 20, 0, RGB(255, 0, 255), IMAGE_BITMAP, LR_CREATEDIBSECTION);
+ hotImageList = ImageList_LoadImageW(shellInstance, MAKEINTRESOURCE(IDB_GOBUTTON_HOT), 20, 0, RGB(255, 0, 255), IMAGE_BITMAP, LR_CREATEDIBSECTION);
+
+ fGoButton = CreateWindowEx(WS_EX_TOOLWINDOW, TOOLBARCLASSNAMEW, 0, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TBSTYLE_LIST |
+ TBSTYLE_FLAT | TBSTYLE_TOOLTIPS | CCS_NODIVIDER | CCS_NOPARENTALIGN | CCS_NORESIZE,
+ 0, 0, 0, 0, m_hWnd, NULL, _AtlBaseModule.GetModuleInstance(), NULL);
+ SendMessage(fGoButton, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
+ SendMessage(fGoButton, TB_SETMAXTEXTROWS, 1, 0);
+ SendMessage(fGoButton, TB_SETIMAGELIST, 0, (LPARAM)normalImagelist);
+ SendMessage(fGoButton, TB_SETHOTIMAGELIST, 0, (LPARAM)hotImageList);
+ SendMessage(fGoButton, TB_ADDSTRINGW, (WPARAM)_AtlBaseModule.GetResourceInstance(), IDS_GOBUTTONLABEL);
+ SendMessage(fGoButton, TB_ADDBUTTONSW, 1, (LPARAM)&buttonInfo);
+
+ return hResult;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressBand::GetSite(REFIID riid, void **ppvSite)
+{
+ if (fSite == NULL)
+ return E_FAIL;
+ return fSite->QueryInterface(riid, ppvSite);
+}
+
+HRESULT STDMETHODCALLTYPE CAddressBand::GetWindow(HWND *lphwnd)
+{
+ if (lphwnd == NULL)
+ return E_POINTER;
+ *lphwnd = m_hWnd;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressBand::ContextSensitiveHelp(BOOL fEnterMode)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressBand::CloseDW(DWORD dwReserved)
+{
+ ShowDW(FALSE);
+
+ if (IsWindow())
+ DestroyWindow();
+
+ m_hWnd = NULL;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressBand::ResizeBorderDW(const RECT *prcBorder, IUnknown *punkToolbarSite, BOOL fReserved)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressBand::ShowDW(BOOL fShow)
+{
+ if (m_hWnd)
+ {
+ if (fShow)
+ ShowWindow(SW_SHOW);
+ else
+ ShowWindow(SW_HIDE);
+ }
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressBand::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText)
+{
+ CComPtr<IOleCommandTarget> oleCommandTarget;
+ HRESULT hResult;
+
+ hResult = fAddressEditBox->QueryInterface(IID_IOleCommandTarget, (void **)&oleCommandTarget);
+ if (FAILED(hResult))
+ return hResult;
+ return oleCommandTarget->QueryStatus(pguidCmdGroup, cCmds, prgCmds, pCmdText);
+}
+
+HRESULT STDMETHODCALLTYPE CAddressBand::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
+{
+ // incomplete
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressBand::HasFocusIO()
+{
+ if (GetFocus() == fEditControl || SendMessage(CB_GETDROPPEDSTATE, 0, 0))
+ return S_OK;
+ return S_FALSE;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressBand::TranslateAcceleratorIO(LPMSG lpMsg)
+{
+ // incomplete
+ return S_FALSE;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressBand::UIActivateIO(BOOL fActivate, LPMSG lpMsg)
+{
+ CComPtr<IInputObjectSite> inputObjectSite;
+ HRESULT hResult;
+
+ if (fActivate)
+ {
+ hResult = fSite->QueryInterface(IID_IInputObjectSite, (void **)&inputObjectSite);
+ if (FAILED(hResult))
+ return hResult;
+ hResult = inputObjectSite->OnFocusChangeIS((IDeskBand *)this, fActivate);
+ SetFocus();
+ }
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressBand::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
+{
+ CComPtr<IWinEventHandler> winEventHandler;
+ HRESULT hResult;
+
+ switch (uMsg)
+ {
+ case WM_WININICHANGE:
+ break;
+ case WM_COMMAND:
+ if (wParam == IDM_TOOLBARS_GOBUTTON)
+ {
+ // toggle whether the Go button is displayed
+ // setting is Yes or No, stored in key "Software\Microsoft\Internet Explorer\Main" in value ShowGoButton
+ // broadcast change notification to all explorer windows
+ }
+ break;
+ }
+ hResult = fAddressEditBox->QueryInterface(IID_IWinEventHandler, (void **)&winEventHandler);
+ if (FAILED(hResult))
+ return hResult;
+ return winEventHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, theResult);
+}
+
+HRESULT STDMETHODCALLTYPE CAddressBand::IsWindowOwner(HWND hWnd)
+{
+ CComPtr<IWinEventHandler> winEventHandler;
+ HRESULT hResult;
+
+ hResult = fAddressEditBox->QueryInterface(IID_IWinEventHandler, (void **)&winEventHandler);
+ if (FAILED(hResult))
+ return hResult;
+ return winEventHandler->IsWindowOwner(hWnd);
+}
+
+HRESULT STDMETHODCALLTYPE CAddressBand::FileSysChange(long param8, long paramC)
+{
+ CComPtr<IAddressBand> addressBand;
+ HRESULT hResult;
+
+ hResult = fAddressEditBox->QueryInterface(IID_IAddressBand, (void **)&addressBand);
+ if (FAILED(hResult))
+ return hResult;
+ return addressBand->FileSysChange(param8, paramC);
+}
+
+HRESULT STDMETHODCALLTYPE CAddressBand::Refresh(long param8)
+{
+ CComPtr<IAddressBand> addressBand;
+ HRESULT hResult;
+
+ hResult = fAddressEditBox->QueryInterface(IID_IAddressBand, (void **)&addressBand);
+ if (FAILED(hResult))
+ return hResult;
+ return addressBand->Refresh(param8);
+}
+
+HRESULT STDMETHODCALLTYPE CAddressBand::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressBand::OnFocusChangeIS(IUnknown *punkObj, BOOL fSetFocus)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressBand::GetClassID(CLSID *pClassID)
+{
+ if (pClassID == NULL)
+ return E_POINTER;
+ *pClassID = CLSID_SH_AddressBand;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressBand::IsDirty()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressBand::Load(IStream *pStm)
+{
+ // incomplete
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressBand::Save(IStream *pStm, BOOL fClearDirty)
+{
+ // incomplete
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressBand::GetSizeMax(ULARGE_INTEGER *pcbSize)
+{
+ // incomplete
+ return E_NOTIMPL;
+}
+
+LRESULT CAddressBand::OnNotifyClick(WPARAM wParam, NMHDR *notifyHeader, BOOL &bHandled)
+{
+ if (notifyHeader->hwndFrom == fGoButton)
+ {
+ SendMessage(fEditControl, WM_KEYDOWN, 13, 0);
+ SendMessage(fEditControl, WM_KEYUP, 13, 0);
+ }
+ return 0;
+}
+
+LRESULT CAddressBand::OnTipText(UINT idControl, NMHDR *notifyHeader, BOOL &bHandled)
+{
+ if (notifyHeader->hwndFrom == fGoButton)
+ {
+ // TODO
+ // Go to "destination path"
+ }
+ return 0;
+}
+
+LRESULT CAddressBand::OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
+{
+ POINT pt;
+ POINT ptOrig;
+ HWND parentWindow;
+ LRESULT result;
+
+ if (fGoButtonShown == false)
+ {
+ bHandled = FALSE;
+ return 0;
+ }
+ pt.x = 0;
+ pt.y = 0;
+ parentWindow = GetParent();
+ ::MapWindowPoints(m_hWnd, parentWindow, &pt, 1);
+ OffsetWindowOrgEx((HDC)wParam, pt.x, pt.y, &ptOrig);
+ result = SendMessage(parentWindow, WM_ERASEBKGND, wParam, 0);
+ SetWindowOrgEx((HDC)wParam, ptOrig.x, ptOrig.y, NULL);
+ if (result == 0)
+ {
+ bHandled = FALSE;
+ return 0;
+ }
+ return result;
+}
+
+LRESULT CAddressBand::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
+{
+ RECT goButtonBounds;
+ RECT buttonBounds;
+ long buttonWidth;
+ long buttonHeight;
+ RECT comboBoxBounds;
+ long newHeight;
+ long newWidth;
+
+ if (fGoButtonShown == false)
+ {
+ bHandled = FALSE;
+ return 0;
+ }
+ newHeight = HIWORD(lParam);
+ newWidth = LOWORD(lParam);
+ SendMessage(fGoButton, TB_GETITEMRECT, 0, (LPARAM)&buttonBounds);
+ buttonWidth = buttonBounds.right - buttonBounds.left;
+ buttonHeight = buttonBounds.bottom - buttonBounds.top;
+ DefWindowProc(WM_SIZE, wParam, MAKELONG(newWidth - buttonWidth - 2, newHeight));
+ ::GetWindowRect(fComboBox, &comboBoxBounds);
+ ::SetWindowPos(fGoButton, NULL, newWidth - buttonWidth, (comboBoxBounds.bottom - comboBoxBounds.top - buttonHeight) / 2,
+ buttonWidth, buttonHeight, SWP_NOOWNERZORDER | SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER);
+ goButtonBounds.left = newWidth - buttonWidth;
+ goButtonBounds.top = 0;
+ goButtonBounds.right = newWidth - buttonWidth;
+ goButtonBounds.bottom = newHeight;
+ InvalidateRect(&goButtonBounds, TRUE);
+ SendMessage(fComboBox, CB_SETDROPPEDWIDTH, 200, 0);
+ return 0;
+}
+
+LRESULT CAddressBand::OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
+{
+ RECT goButtonBounds;
+ RECT buttonBounds;
+ long buttonWidth;
+ long buttonHeight;
+ RECT comboBoxBounds;
+ WINDOWPOS positionInfoCopy;
+ long newHeight;
+ long newWidth;
+
+ if (fGoButtonShown == false)
+ {
+ bHandled = FALSE;
+ return 0;
+ }
+ positionInfoCopy = *(WINDOWPOS *)lParam;
+ newHeight = positionInfoCopy.cy;
+ newWidth = positionInfoCopy.cx;
+ SendMessage(fGoButton, TB_GETITEMRECT, 0, (LPARAM)&buttonBounds);
+ buttonWidth = buttonBounds.right - buttonBounds.left;
+ buttonHeight = buttonBounds.bottom - buttonBounds.top;
+ positionInfoCopy.cx = newWidth - 2 - buttonWidth;
+ DefWindowProc(WM_WINDOWPOSCHANGING, wParam, (LPARAM)&positionInfoCopy);
+ ::GetWindowRect(fComboBox, &comboBoxBounds);
+ ::SetWindowPos(fGoButton, NULL, newWidth - buttonWidth, (comboBoxBounds.bottom - comboBoxBounds.top - buttonHeight) / 2,
+ buttonWidth, buttonHeight, SWP_NOOWNERZORDER | SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER);
+ goButtonBounds.left = newWidth - buttonWidth;
+ goButtonBounds.top = 0;
+ goButtonBounds.right = newWidth - buttonWidth;
+ goButtonBounds.bottom = newHeight;
+ InvalidateRect(&goButtonBounds, TRUE);
+ SendMessage(fComboBox, CB_SETDROPPEDWIDTH, 200, 0);
+ return 0;
+}
+
+HRESULT CreateAddressBand(REFIID riid, void **ppv)
+{
+ CComObject<CAddressBand> *theMenuBar;
+ HRESULT hResult;
+
+ if (ppv == NULL)
+ return E_POINTER;
+ *ppv = NULL;
+ ATLTRY (theMenuBar = new CComObject<CAddressBand>);
+ if (theMenuBar == NULL)
+ return E_OUTOFMEMORY;
+ hResult = theMenuBar->QueryInterface (riid, (void **)ppv);
+ if (FAILED (hResult))
+ {
+ delete theMenuBar;
+ return hResult;
+ }
+ return S_OK;
+}
--- /dev/null
+/*
+ * ReactOS Explorer
+ *
+ * Copyright 2009 Andrew Hill <ash77 at domain reactos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _addressband_h
+#define _addressband_h
+
+class CAddressBand :
+ public CWindowImpl<CAddressBand, CWindow, CControlWinTraits>,
+ public CComCoClass<CAddressBand, &CLSID_SH_AddressBand>,
+ public CComObjectRootEx<CComMultiThreadModelNoCS>,
+ public IDeskBand,
+ public IOleCommandTarget,
+ public IObjectWithSite,
+ public IInputObject,
+ public IWinEventHandler,
+ public IAddressBand,
+ public IServiceProvider,
+ public IInputObjectSite,
+ public IPersistStream
+{
+private:
+ CComPtr<IDockingWindowSite> fSite;
+ CComPtr<IAddressEditBox> fAddressEditBox;
+ HWND fEditControl;
+ HWND fGoButton;
+ HWND fComboBox;
+ bool fGoButtonShown;
+public:
+ CAddressBand();
+ ~CAddressBand();
+private:
+ void FocusChange(BOOL bFocus);
+public:
+ // *** IDeskBand methods ***
+ virtual HRESULT STDMETHODCALLTYPE GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi);
+
+ // *** IObjectWithSite methods ***
+ virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite);
+ virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, void **ppvSite);
+
+ // *** IOleWindow methods ***
+ virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd);
+ virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode);
+
+ // *** IDockingWindow methods ***
+ virtual HRESULT STDMETHODCALLTYPE CloseDW(DWORD dwReserved);
+ virtual HRESULT STDMETHODCALLTYPE ResizeBorderDW(const RECT *prcBorder, IUnknown *punkToolbarSite, BOOL fReserved);
+ virtual HRESULT STDMETHODCALLTYPE ShowDW(BOOL fShow);
+
+ // *** IOleCommandTarget methods ***
+ virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText);
+ virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
+
+ // *** IInputObject methods ***
+ virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg);
+ virtual HRESULT STDMETHODCALLTYPE HasFocusIO();
+ virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg);
+
+ // *** IWinEventHandler methods ***
+ virtual HRESULT STDMETHODCALLTYPE OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult);
+ virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND hWnd);
+
+ // *** IAddressBand methods ***
+ virtual HRESULT STDMETHODCALLTYPE FileSysChange(long param8, long paramC);
+ virtual HRESULT STDMETHODCALLTYPE Refresh(long param8);
+
+ // *** IServiceProvider methods ***
+ virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
+
+ // *** IInputObjectSite methods ***
+ virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(IUnknown *punkObj, BOOL fSetFocus);
+
+ // *** IPersist methods ***
+ virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID);
+
+ // *** IPersistStream methods ***
+ virtual HRESULT STDMETHODCALLTYPE IsDirty();
+ virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm);
+ virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty);
+ virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize);
+
+ // message handlers
+ LRESULT OnNotifyClick(WPARAM wParam, NMHDR *notifyHeader, BOOL &bHandled);
+ LRESULT OnTipText(UINT idControl, NMHDR *notifyHeader, BOOL &bHandled);
+ LRESULT OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
+ LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
+ LRESULT OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
+
+BEGIN_MSG_MAP(CAddressBand)
+ NOTIFY_CODE_HANDLER(NM_CLICK, OnNotifyClick)
+ NOTIFY_CODE_HANDLER(TTN_NEEDTEXTW, OnTipText)
+ MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground)
+ MESSAGE_HANDLER(WM_SIZE, OnSize)
+ MESSAGE_HANDLER(WM_WINDOWPOSCHANGING, OnWindowPosChanging)
+END_MSG_MAP()
+
+DECLARE_REGISTRY_RESOURCEID(IDR_ADDRESSBAND)
+DECLARE_NOT_AGGREGATABLE(CAddressBand)
+
+DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+BEGIN_COM_MAP(CAddressBand)
+ COM_INTERFACE_ENTRY_IID(IID_IDeskBand, IDeskBand)
+ COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
+ COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
+ COM_INTERFACE_ENTRY_IID(IID_IDockingWindow, IDockingWindow)
+ COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
+ COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
+ COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
+ COM_INTERFACE_ENTRY_IID(IID_IAddressBand, IAddressBand)
+ COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
+ COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite)
+ COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
+ COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
+END_COM_MAP()
+};
+
+#endif // _addressband_h
--- /dev/null
+/*
+ * ReactOS Explorer
+ *
+ * Copyright 2009 Andrew Hill <ash77 at domain reactos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+This class handles the combo box of the address band.
+*/
+#include <windows.h>
+#include <shlobj.h>
+#include <shlobj_undoc.h>
+#include <shlguid.h>
+#include <shlguid_undoc.h>
+#include <tchar.h>
+#include <atlbase.h>
+#include <atlcom.h>
+#include <atlwin.h>
+#include "resource.h"
+#include "addresseditbox.h"
+/*
+TODO:
+ Add auto completion support
+ Subclass windows in Init method
+ Connect to browser connection point
+ Handle navigation complete messages to set edit box text
+ Handle listbox dropdown message and fill contents
+ Add drag and drop of icon in edit box
+ Handle enter in edit box to browse to typed path
+ Handle change notifies to update appropriately
+ Add handling of enter in edit box
+ Fix so selection in combo listbox navigates
+ Fix so editing text and typing enter navigates
+*/
+
+CAddressEditBox::CAddressEditBox() :
+ fEditWindow(NULL, this, 1),
+ fComboBoxExWindow(NULL, this, 2)
+{
+}
+
+CAddressEditBox::~CAddressEditBox()
+{
+}
+
+HRESULT STDMETHODCALLTYPE CAddressEditBox::SetOwner(IUnknown *)
+{
+ // connect to browser connection point
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressEditBox::FileSysChange(long param8, long paramC)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressEditBox::Refresh(long param8)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressEditBox::Init(HWND comboboxEx, HWND editControl, long param14, IUnknown *param18)
+{
+ fComboBoxExWindow.SubclassWindow(comboboxEx);
+ fEditWindow.SubclassWindow(editControl);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressEditBox::SetCurrentDir(long paramC)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressEditBox::ParseNow(long paramC)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressEditBox::Execute(long paramC)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressEditBox::Save(long paramC)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressEditBox::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
+{
+ // handle fill of listbox here
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressEditBox::IsWindowOwner(HWND hWnd)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressEditBox::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressEditBox::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressEditBox::GetTypeInfoCount(UINT *pctinfo)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressEditBox::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressEditBox::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressEditBox::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
+{
+ // on navigate complete, change edit section of combobox
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressEditBox::GetClassID(CLSID *pClassID)
+{
+ if (pClassID == NULL)
+ return E_POINTER;
+ *pClassID = CLSID_AddressEditBox;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressEditBox::IsDirty()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressEditBox::Load(IStream *pStm)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressEditBox::Save(IStream *pStm, BOOL fClearDirty)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CAddressEditBox::GetSizeMax(ULARGE_INTEGER *pcbSize)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT CreateAddressEditBox(REFIID riid, void **ppv)
+{
+ CComObject<CAddressEditBox> *theMenuBar;
+ HRESULT hResult;
+
+ if (ppv == NULL)
+ return E_POINTER;
+ *ppv = NULL;
+ ATLTRY (theMenuBar = new CComObject<CAddressEditBox>);
+ if (theMenuBar == NULL)
+ return E_OUTOFMEMORY;
+ hResult = theMenuBar->QueryInterface (riid, (void **)ppv);
+ if (FAILED (hResult))
+ {
+ delete theMenuBar;
+ return hResult;
+ }
+ return S_OK;
+}
--- /dev/null
+/*
+ * ReactOS Explorer
+ *
+ * Copyright 2009 Andrew Hill <ash77 at domain reactos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _addresseditbox_h
+#define _addresseditbox_h
+
+class CAddressEditBox :
+ public CWindowImpl<CAddressEditBox, CWindow, CControlWinTraits>,
+ public CComCoClass<CAddressEditBox, &CLSID_AddressEditBox>,
+ public CComObjectRootEx<CComMultiThreadModelNoCS>,
+ public IShellService,
+ public IAddressBand,
+ public IAddressEditBox,
+ public IWinEventHandler,
+ public IOleCommandTarget,
+ public IDispatch,
+ public IPersistStream
+{
+private:
+ CContainedWindow fEditWindow;
+ CContainedWindow fComboBoxExWindow;
+public:
+ CAddressEditBox();
+ ~CAddressEditBox();
+private:
+public:
+ // *** IShellService methods ***
+ virtual HRESULT STDMETHODCALLTYPE SetOwner(IUnknown *);
+
+ // *** IAddressBand methods ***
+ virtual HRESULT STDMETHODCALLTYPE FileSysChange(long param8, long paramC);
+ virtual HRESULT STDMETHODCALLTYPE Refresh(long param8);
+
+ // *** IAddressEditBox methods ***
+ virtual HRESULT STDMETHODCALLTYPE Init(HWND comboboxEx, HWND editControl, long param14, IUnknown *param18);
+ virtual HRESULT STDMETHODCALLTYPE SetCurrentDir(long paramC);
+ virtual HRESULT STDMETHODCALLTYPE ParseNow(long paramC);
+ virtual HRESULT STDMETHODCALLTYPE Execute(long paramC);
+ virtual HRESULT STDMETHODCALLTYPE Save(long paramC);
+
+ // *** IWinEventHandler methods ***
+ virtual HRESULT STDMETHODCALLTYPE OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult);
+ virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND hWnd);
+
+ // *** IOleCommandTarget methods ***
+ virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText);
+ virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
+
+ // *** IDispatch methods ***
+ virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo);
+ virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo);
+ virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId);
+ virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr);
+
+ // *** IPersist methods ***
+ virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID);
+
+ // *** IPersistStream methods ***
+ virtual HRESULT STDMETHODCALLTYPE IsDirty();
+ virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm);
+ virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty);
+ virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize);
+
+ // message handlers
+// LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
+// LRESULT OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
+
+DECLARE_REGISTRY_RESOURCEID(IDR_ADDRESSEDITBOX)
+DECLARE_NOT_AGGREGATABLE(CAddressEditBox)
+
+DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+BEGIN_MSG_MAP(CAddressEditBox)
+// MESSAGE_HANDLER(WM_NOTIFY, OnNotify)
+// MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
+// MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus)
+// ALT_MSG_MAP(1)
+// MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocusSaveButton)
+// ALT_MSG_MAP(2)
+// MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocusSelectButton)
+END_MSG_MAP()
+
+BEGIN_COM_MAP(CAddressEditBox)
+ COM_INTERFACE_ENTRY_IID(IID_IShellService, IShellService)
+ COM_INTERFACE_ENTRY_IID(IID_IAddressBand, IAddressBand)
+ COM_INTERFACE_ENTRY_IID(IID_IAddressEditBox, IAddressEditBox)
+ COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
+ COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
+ COM_INTERFACE_ENTRY_IID(IID_IDispatch, IDispatch)
+ COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
+ COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
+END_COM_MAP()
+};
+
+#endif // _addresseditbox_h
--- /dev/null
+/*
+ * ReactOS Explorer
+ *
+ * Copyright 2009 Andrew Hill <ash77 at domain reactos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+Used by the address band to dispatch navigation changes to the main browser object.
+
+TODO:
+
+*/
+#include <windows.h>
+#include <shlobj.h>
+#include <shlobj_undoc.h>
+#include <shlguid.h>
+#include <shlguid_undoc.h>
+#include <perhist.h>
+#include <exdisp.h>
+#include <tchar.h>
+#include <atlbase.h>
+#include <atlcom.h>
+#include <atlwin.h>
+#include "resource.h"
+#include "bandproxy.h"
+
+CBandProxy::CBandProxy()
+{
+}
+
+CBandProxy::~CBandProxy()
+{
+}
+
+HRESULT CBandProxy::FindBrowserWindow(IUnknown **browser)
+{
+ CComPtr<IServiceProvider> serviceProvider;
+ CComPtr<IWebBrowser2> webBrowser;
+ HRESULT hResult;
+
+ if (browser == NULL)
+ return E_POINTER;
+ hResult = fSite->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider);
+ if (FAILED (hResult))
+ return hResult;
+ hResult = serviceProvider->QueryService(SID_IWebBrowserApp, IID_IWebBrowser2, (void **)&webBrowser);
+ if (FAILED (hResult))
+ return hResult;
+ *browser = webBrowser.Detach();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBandProxy::SetSite(IUnknown *paramC)
+{
+ fSite = paramC;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBandProxy::CreateNewWindow(long paramC)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandProxy::GetBrowserWindow(IUnknown **paramC)
+{
+ if (paramC == NULL)
+ return E_POINTER;
+ return FindBrowserWindow(paramC);
+}
+
+HRESULT STDMETHODCALLTYPE CBandProxy::IsConnected()
+{
+ CComPtr<IUnknown> webBrowser;
+ HRESULT hResult;
+
+ hResult = FindBrowserWindow(&webBrowser);
+ if (FAILED (hResult) || webBrowser.p == NULL)
+ return S_FALSE;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBandProxy::NavigateToPIDL(LPCITEMIDLIST pidl)
+{
+ CComPtr<IOleWindow> oleWindow;
+ CComPtr<IServiceProvider> serviceProvider;
+ CComPtr<IUnknown> webBrowserUnknown;
+ CComPtr<IWebBrowser2> webBrowser;
+ HWND browserWindow;
+ CComVariant args;
+ CComVariant emptyVariant;
+ unsigned int arraySize;
+ HRESULT hResult;
+
+ hResult = FindBrowserWindow(&webBrowserUnknown);
+ if (FAILED (hResult))
+ return hResult;
+ hResult = webBrowserUnknown->QueryInterface(IID_IWebBrowserApp, (void **)&webBrowser);
+ if (FAILED (hResult))
+ return hResult;
+ hResult = webBrowser->put_Visible(TRUE);
+ hResult = webBrowser->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider);
+ if (SUCCEEDED (hResult))
+ {
+ hResult = serviceProvider->QueryService(SID_STopLevelBrowser, IID_IOleWindow, (void **)&oleWindow);
+ if (SUCCEEDED (hResult))
+ {
+ hResult = oleWindow->GetWindow(&browserWindow);
+ if (IsIconic(browserWindow))
+ ShowWindow(browserWindow, SW_RESTORE);
+ }
+ }
+ arraySize = ILGetSize(pidl);
+ V_VT(&args) = VT_ARRAY | VT_UI1;
+ V_ARRAY(&args) = SafeArrayCreateVector(VT_UI1, 0, arraySize);
+ if (V_ARRAY(&args) == NULL)
+ return E_OUTOFMEMORY;
+ memcpy(V_ARRAY(&args)->pvData, pidl, arraySize);
+ hResult = webBrowser->Navigate2(&args, &emptyVariant, &emptyVariant, &emptyVariant, &emptyVariant);
+ if (FAILED (hResult))
+ return hResult;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBandProxy::NavigateToURL(long paramC, long param10)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT CreateBandProxy(REFIID riid, void **ppv)
+{
+ CComObject<CBandProxy> *theBandProxy;
+ HRESULT hResult;
+
+ if (ppv == NULL)
+ return E_POINTER;
+ *ppv = NULL;
+ ATLTRY (theBandProxy = new CComObject<CBandProxy>);
+ if (theBandProxy == NULL)
+ return E_OUTOFMEMORY;
+ hResult = theBandProxy->QueryInterface (riid, (void **)ppv);
+ if (FAILED (hResult))
+ {
+ delete theBandProxy;
+ return hResult;
+ }
+ return S_OK;
+}
--- /dev/null
+/*
+ * ReactOS Explorer
+ *
+ * Copyright 2009 Andrew Hill <ash77 at domain reactos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _bandproxy_h
+#define _bandproxy_h
+
+class CBandProxy :
+ public CComCoClass<CBandProxy, &CLSID_BandProxy>,
+ public CComObjectRootEx<CComMultiThreadModelNoCS>,
+ public IBandProxy
+{
+private:
+ CComPtr<IUnknown> fSite;
+public:
+ CBandProxy();
+ ~CBandProxy();
+ HRESULT FindBrowserWindow(IUnknown **browser);
+
+ // *** IBandProxy methods ***
+ virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *paramC);
+ virtual HRESULT STDMETHODCALLTYPE CreateNewWindow(long paramC);
+ virtual HRESULT STDMETHODCALLTYPE GetBrowserWindow(IUnknown **paramC);
+ virtual HRESULT STDMETHODCALLTYPE IsConnected();
+ virtual HRESULT STDMETHODCALLTYPE NavigateToPIDL(LPCITEMIDLIST pidl);
+ virtual HRESULT STDMETHODCALLTYPE NavigateToURL(long paramC, long param10);
+
+DECLARE_REGISTRY_RESOURCEID(IDR_BANDPROXY)
+DECLARE_NOT_AGGREGATABLE(CBandProxy)
+
+DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+BEGIN_COM_MAP(CBandProxy)
+ COM_INTERFACE_ENTRY_IID(IID_IBandProxy, IBandProxy)
+END_COM_MAP()
+};
+
+#endif // _bandproxy_h
+++ /dev/null
-/*
- * Rebar band site
- *
- * Copyright 2007 Hervé Poussineau
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#include "config.h"
-
-#include <stdarg.h>
-
-#define COBJMACROS
-
-#include "wine/debug.h"
-#include "windef.h"
-#include "winbase.h"
-#include "winreg.h"
-#include "winuser.h"
-#include "shlwapi.h"
-#include "winerror.h"
-#include "objbase.h"
-#include "commctrl.h"
-
-#include "docobj.h"
-#include "shlguid.h"
-#include "shlobj.h"
-#include "shobjidl.h"
-#include "todo.h"
-#include "undoc.h"
-
-#include "wine/unicode.h"
-
-#include "browseui.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(browseui);
-
-#ifndef ASSERT
-#define ASSERT(cond) \
- if (!(cond)) \
- ERR ("ASSERTION %s AT %s:%d FAILED!\n", #cond, __FILE__, __LINE__)
-#endif
-
-extern HINSTANCE browseui_hinstance;
-
-struct BandObject {
- IDeskBand *DeskBand;
- IOleWindow *OleWindow;
- IWindowEventHandler *WndEvtHandler;
- DESKBANDINFO dbi;
-};
-
-typedef struct tagBandSite {
- const IBandSiteVtbl *vtbl;
- const IWindowEventHandlerVtbl *eventhandlerVtbl;
- const IDeskBarClientVtbl *deskbarVtbl;
- const IOleCommandTargetVtbl *oletargetVtbl;
- LONG refCount;
- LONG BandsCount;
- LONG BandsAllocated;
- struct BandObject *Bands;
- IUnknown *pUnkOuter;
- HWND hWndRebar;
- IOleWindow *OleWindow;
-} BandSite;
-
-static const IBandSiteVtbl BandSiteVtbl;
-static const IWindowEventHandlerVtbl BandSite_EventHandlerVtbl;
-static const IDeskBarClientVtbl BandSite_DeskBarVtbl;
-static const IOleCommandTargetVtbl BandSite_OleTargetVtbl;
-
-static inline BandSite *impl_from_IWindowEventHandler(IWindowEventHandler *iface)
-{
- return (BandSite *)((char *)iface - FIELD_OFFSET(BandSite, eventhandlerVtbl));
-}
-
-static inline BandSite *impl_from_IDeskBarClient(IDeskBarClient *iface)
-{
- return (BandSite *)((char *)iface - FIELD_OFFSET(BandSite, deskbarVtbl));
-}
-
-static inline BandSite *impl_from_IOleCommandTarget(IOleCommandTarget *iface)
-{
- return (BandSite *)((char *)iface - FIELD_OFFSET(BandSite, oletargetVtbl));
-}
-
-static UINT GetBandID(BandSite *This, struct BandObject *Band)
-{
- return (UINT)(Band - This->Bands);
-}
-
-static struct BandObject* GetBandByID(BandSite *This, DWORD dwBandID)
-{
- if (dwBandID >= This->BandsAllocated)
- return NULL;
-
- if (This->Bands[dwBandID].DeskBand == NULL)
- return NULL;
-
- return &This->Bands[dwBandID];
-}
-
-static void FreeBand(BandSite *This, struct BandObject *Band)
-{
- ASSERT(Band->DeskBand != NULL);
- ASSERT(Band->OleWindow != NULL);
- ASSERT(Band->WndEvtHandler != NULL);
- IDeskBand_Release(Band->DeskBand);
- IOleWindow_Release(Band->OleWindow);
- IWindowEventHandler_Release(Band->WndEvtHandler);
- ZeroMemory(Band, sizeof(*Band));
- This->BandsCount--;
-}
-
-static DWORD GetBandSiteViewMode(BandSite *This)
-{
- DWORD dwStyle;
-
- /* FIXME: What about DBIF_VIEWMODE_FLOATING and DBIF_VIEWMODE_TRANSPARENT? */
- dwStyle = GetWindowLongPtr(This->hWndRebar,
- GWL_STYLE);
-
- if (dwStyle & CCS_VERT)
- return DBIF_VIEWMODE_VERTICAL;
- else
- return DBIF_VIEWMODE_NORMAL;
-}
-
-static VOID BuildRebarBandInfo(BandSite *This, struct BandObject *Band, REBARBANDINFOW *prbi)
-{
- ZeroMemory(prbi, sizeof(*prbi));
- prbi->cbSize = sizeof(*prbi);
-
- prbi->fMask = RBBIM_ID;
- prbi->wID = GetBandID(This,
- Band);
-
- if (Band->dbi.dwMask & DBIM_MINSIZE)
- {
- prbi->fMask |= RBBIM_CHILDSIZE;
- prbi->cxMinChild = Band->dbi.ptMinSize.x;
- prbi->cyMinChild = Band->dbi.ptMinSize.y;
- }
-
- if (Band->dbi.dwMask & DBIM_MAXSIZE)
- {
- prbi->fMask |= RBBIM_CHILDSIZE;
- prbi->cyMaxChild = Band->dbi.ptMaxSize.y;
- }
-
- if ((Band->dbi.dwMask & (DBIM_INTEGRAL | DBIM_MODEFLAGS)) == (DBIM_INTEGRAL | DBIM_MODEFLAGS) &&
- (Band->dbi.dwModeFlags & DBIMF_VARIABLEHEIGHT))
- {
- prbi->fMask |= RBBIM_CHILDSIZE;
- prbi->cyIntegral = Band->dbi.ptIntegral.y;
- }
-
- if (Band->dbi.dwMask & DBIM_ACTUAL)
- {
- prbi->fMask |= RBBIM_IDEALSIZE | RBBIM_SIZE | RBBIM_CHILDSIZE;
- prbi->cxIdeal = Band->dbi.ptActual.x;
- prbi->cx = Band->dbi.ptActual.x;
- prbi->cyChild = Band->dbi.ptActual.y;
- }
-
- if (Band->dbi.dwMask & DBIM_TITLE)
- {
- prbi->fMask |= RBBIM_TEXT;
- prbi->lpText = Band->dbi.wszTitle;
- prbi->cch = wcslen(Band->dbi.wszTitle);
- }
-
- if (Band->dbi.dwMask & DBIM_MODEFLAGS)
- {
- prbi->fMask |= RBBIM_STYLE;
-
- if (Band->dbi.dwModeFlags & DBIMF_FIXED)
- prbi->fStyle |= RBBS_FIXEDSIZE | RBBS_NOGRIPPER;
- if (Band->dbi.dwModeFlags & DBIMF_FIXEDBMP)
- prbi->fStyle |= RBBS_FIXEDBMP;
- if (Band->dbi.dwModeFlags & DBIMF_VARIABLEHEIGHT)
- prbi->fStyle |= RBBS_VARIABLEHEIGHT;
- if (Band->dbi.dwModeFlags & DBIMF_DEBOSSED)
- prbi->fStyle |= RBBS_CHILDEDGE;
- if (Band->dbi.dwModeFlags & DBIMF_USECHEVRON)
- prbi->fStyle |= RBBS_USECHEVRON;
- if (Band->dbi.dwModeFlags & DBIMF_BREAK)
- prbi->fStyle |= RBBS_BREAK;
- if (Band->dbi.dwModeFlags & DBIMF_TOPALIGN)
- prbi->fStyle |= RBBS_TOPALIGN;
- if (Band->dbi.dwModeFlags & DBIMF_NOGRIPPER)
- prbi->fStyle |= RBBS_NOGRIPPER;
- if (Band->dbi.dwModeFlags & DBIMF_ALWAYSGRIPPER)
- prbi->fStyle |= RBBS_GRIPPERALWAYS;
- }
-
- if ((Band->dbi.dwMask & (DBIM_BKCOLOR | DBIM_MODEFLAGS)) == (DBIM_BKCOLOR | DBIM_MODEFLAGS) &&
- (Band->dbi.dwModeFlags & DBIMF_BKCOLOR))
- {
- prbi->fMask |= RBBIM_COLORS;
- prbi->clrFore = (COLORREF)(COLOR_WINDOWTEXT + 1);
- prbi->clrBack = Band->dbi.crBkgnd;
- }
-}
-
-static HRESULT UpdateSingleBand(BandSite *This, struct BandObject *Band)
-{
- REBARBANDINFOW rbi;
- DWORD dwViewMode;
- UINT uBand;
- HRESULT hRet;
-
- ZeroMemory (&Band->dbi, sizeof(Band->dbi));
- Band->dbi.dwMask = DBIM_MINSIZE | DBIM_MAXSIZE | DBIM_INTEGRAL |
- DBIM_ACTUAL | DBIM_TITLE | DBIM_MODEFLAGS | DBIM_BKCOLOR;
-
- dwViewMode = GetBandSiteViewMode(This);
-
- hRet = IDeskBand_GetBandInfo(Band->DeskBand,
- (DWORD)GetBandID(This,
- Band),
- dwViewMode,
- &Band->dbi);
- if (SUCCEEDED(hRet))
- {
- BuildRebarBandInfo(This,
- Band,
- &rbi);
- if (SUCCEEDED(IOleWindow_GetWindow(Band->OleWindow,
- &rbi.hwndChild)) &&
- rbi.hwndChild != NULL)
- {
- rbi.fMask |= RBBIM_CHILD;
- WARN ("ReBar band uses child window 0x%p\n", rbi.hwndChild);
- }
-
- uBand = (UINT)SendMessageW(This->hWndRebar,
- RB_IDTOINDEX,
- (WPARAM)rbi.wID,
- 0);
- if (uBand != (UINT)-1)
- {
- if (!SendMessageW(This->hWndRebar,
- RB_SETBANDINFOW,
- (WPARAM)uBand,
- (LPARAM)&rbi))
- {
- WARN("Failed to update the rebar band!\n");
- }
- }
- else
- WARN("Failed to map rebar band id to index!\n");
-
- }
-
- return hRet;
-}
-
-static HRESULT UpdateAllBands(BandSite *This)
-{
- LONG i;
- HRESULT hRet;
-
- for (i = 0; i < This->BandsAllocated; i++)
- {
- if (This->Bands[i].DeskBand != NULL)
- {
- hRet = UpdateSingleBand(This,
- &This->Bands[i]);
- if (!SUCCEEDED(hRet))
- return hRet;
- }
- }
-
- return S_OK;
-}
-
-static HRESULT UpdateBand(BandSite *This, DWORD dwBandID)
-{
- struct BandObject *Band;
-
- Band = GetBandByID(This,
- dwBandID);
- if (Band == NULL)
- return E_FAIL;
-
- return UpdateSingleBand(This,
- Band);
-}
-
-static struct BandObject* GetBandFromHwnd(BandSite *This, HWND hwnd)
-{
- HRESULT hRet;
- HWND hWndBand;
- LONG i;
-
- for (i = 0; i < This->BandsAllocated; i++)
- {
- if (This->Bands[i].DeskBand != NULL)
- {
- ASSERT(This->Bands[i].OleWindow);
-
- hWndBand = NULL;
- hRet = IOleWindow_GetWindow(This->Bands[i].OleWindow,
- &hWndBand);
- if (SUCCEEDED(hRet) && hWndBand == hwnd)
- return &This->Bands[i];
- }
- }
-
- return NULL;
-}
-
-HRESULT WINAPI BandSite_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
-{
- BandSite *This;
-
- if (!pUnkOuter)
- return E_POINTER;
-
- This = CoTaskMemAlloc(sizeof(BandSite));
- if (This == NULL)
- return E_OUTOFMEMORY;
- ZeroMemory(This, sizeof(*This));
- This->pUnkOuter = pUnkOuter;
- IUnknown_AddRef(pUnkOuter);
- This->vtbl = &BandSiteVtbl;
- This->eventhandlerVtbl = &BandSite_EventHandlerVtbl;
- This->deskbarVtbl = &BandSite_DeskBarVtbl;
- This->oletargetVtbl = &BandSite_OleTargetVtbl;
- This->refCount = 1;
-
- TRACE("returning %p\n", This);
- *ppOut = (IUnknown *)This;
- BROWSEUI_refCount++;
- return S_OK;
-}
-
-static void WINAPI BandSite_Destructor(BandSite *This)
-{
- int i;
- TRACE("destroying %p\n", This);
-
- if (This->hWndRebar != NULL)
- {
- DestroyWindow(This->hWndRebar);
- This->hWndRebar = NULL;
- }
-
- if (This->pUnkOuter != NULL)
- {
- IUnknown_Release(This->pUnkOuter);
- This->pUnkOuter = NULL;
- }
-
- if (This->Bands != NULL)
- {
- for (i = 0; i < This->BandsAllocated; i++)
- {
- if (This->Bands[i].DeskBand != NULL)
- FreeBand(This, &This->Bands[i]);
- }
- CoTaskMemFree(This->Bands);
- This->Bands = NULL;
- }
-
- if (This->OleWindow != NULL)
- {
- This->OleWindow->lpVtbl->Release(This->OleWindow);
- This->OleWindow = NULL;
- }
-
- CoTaskMemFree(This);
- BROWSEUI_refCount--;
-}
-
-static HRESULT WINAPI BandSite_QueryInterface(IBandSite *iface, REFIID iid, LPVOID *ppvOut)
-{
- BandSite *This = (BandSite *)iface;
- *ppvOut = NULL;
-
- TRACE("(%p, %s, %p)\n", iface, debugstr_guid(iid), ppvOut);
-
- if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IBandSite))
- {
- *ppvOut = &This->vtbl;
- }
- else if (IsEqualIID(iid, &IID_IWindowEventHandler))
- {
- *ppvOut = &This->eventhandlerVtbl;
- }
- else if (IsEqualIID(iid, &IID_IOleWindow) || IsEqualIID(iid, &IID_IDeskBarClient))
- {
- *ppvOut = &This->deskbarVtbl;
- }
- else if (IsEqualIID(iid, &IID_IOleCommandTarget))
- {
- *ppvOut = &This->oletargetVtbl;
- }
-
- if (*ppvOut)
- {
- IUnknown_AddRef(iface);
- return S_OK;
- }
-
- WARN("unsupported interface: %s\n", debugstr_guid(iid));
- return E_NOINTERFACE;
-}
-
-static ULONG WINAPI BandSite_AddRef(IBandSite *iface)
-{
- BandSite *This = (BandSite *)iface;
- TRACE("(%p)\n", iface);
- return InterlockedIncrement(&This->refCount);
-}
-
-static ULONG WINAPI BandSite_Release(IBandSite *iface)
-{
- BandSite *This = (BandSite *)iface;
- ULONG ret;
-
- TRACE("(%p)\n", iface);
-
- ret = InterlockedDecrement(&This->refCount);
- if (ret == 0)
- BandSite_Destructor(This);
- return ret;
-}
-
-static HRESULT WINAPI BandSite_AddBand(IBandSite *iface, IUnknown *punk)
-{
- BandSite *This = (BandSite *)iface;
- INT i;
- LONG NewAllocated;
- struct BandObject *NewBand = NULL;
- IDeskBand *DeskBand = NULL;
- IObjectWithSite *ObjWithSite = NULL;
- IOleWindow *OleWindow = NULL;
- IWindowEventHandler *WndEvtHandler = NULL;
- REBARBANDINFOW rbi;
- HRESULT hRet;
- UINT uBand;
-
- TRACE("(%p, %p)\n", iface, punk);
-
- if (punk == NULL || This->hWndRebar == NULL)
- return E_FAIL;
-
- hRet = IUnknown_QueryInterface(punk,
- &IID_IDeskBand,
- (PVOID*)&DeskBand);
- if (!SUCCEEDED(hRet) || DeskBand == NULL)
- goto Cleanup;
- hRet = IUnknown_QueryInterface(punk,
- &IID_IObjectWithSite,
- (PVOID*)&ObjWithSite);
- if (!SUCCEEDED(hRet) || ObjWithSite == NULL)
- goto Cleanup;
- hRet = IUnknown_QueryInterface(punk,
- &IID_IOleWindow,
- (PVOID*)&OleWindow);
- if (!SUCCEEDED(hRet) || OleWindow == NULL)
- goto Cleanup;
- hRet = IUnknown_QueryInterface(punk,
- &IID_IWindowEventHandler,
- (PVOID*)&WndEvtHandler);
- if (!SUCCEEDED(hRet) || WndEvtHandler == NULL)
- goto Cleanup;
-
- hRet = S_OK;
- if (This->BandsAllocated > This->BandsCount)
- {
- /* Search for a free band object */
- for (i = 0; i < This->BandsAllocated; i++)
- {
- if (This->Bands[i].DeskBand == NULL)
- {
- NewBand = &This->Bands[i];
- break;
- }
- }
- }
- else if (This->BandsAllocated > 0)
- {
- ASSERT (This->Bands != NULL);
-
- /* Reallocate the band object array */
- NewAllocated = This->BandsAllocated + 8;
- if (NewAllocated > 0xFFFF)
- NewAllocated = 0xFFFF;
- if (NewAllocated == This->BandsAllocated)
- {
- hRet = E_OUTOFMEMORY;
- goto Cleanup;
- }
-
-
- NewBand = CoTaskMemAlloc(NewAllocated * sizeof(struct BandObject));
- if (NewBand == NULL)
- {
- hRet = E_OUTOFMEMORY;
- goto Cleanup;
- }
-
- /* Copy the old array */
- CopyMemory(NewBand, This->Bands, This->BandsAllocated * sizeof(struct BandObject));
-
- /* Initialize the added bands */
- ZeroMemory(&NewBand[This->BandsAllocated], (NewAllocated - This->BandsAllocated) * sizeof(struct BandObject));
-
- NewBand = &This->Bands[This->BandsAllocated];
- This->BandsAllocated = NewAllocated;
- CoTaskMemFree(This->Bands);
- This->Bands = NewBand;
- }
- else
- {
- ASSERT(This->Bands == NULL);
- ASSERT(This->BandsAllocated == 0);
- ASSERT(This->BandsCount == 0);
-
- /* Allocate new array */
- This->Bands = CoTaskMemAlloc(8 * sizeof(struct BandObject));
- if (This->Bands == NULL)
- {
- hRet = E_OUTOFMEMORY;
- goto Cleanup;
- }
-
- /* Initialize the added bands */
- ZeroMemory(This->Bands, 8 * sizeof(struct BandObject));
-
- This->BandsAllocated += 8;
- NewBand = &This->Bands[0];
- }
-
- if (SUCCEEDED(hRet))
- {
- ASSERT(NewBand != NULL);
-
- This->BandsCount++;
- NewBand->DeskBand = DeskBand;
- NewBand->OleWindow = OleWindow;
- NewBand->WndEvtHandler = WndEvtHandler;
-
- DeskBand = NULL;
- OleWindow = NULL;
- WndEvtHandler = NULL;
-
- /* Create the ReBar band */
- hRet = IObjectWithSite_SetSite(ObjWithSite,
- (IUnknown*)iface);
- if (SUCCEEDED(hRet))
- {
- uBand = (UINT)-1;
- if (SUCCEEDED(UpdateSingleBand(This,
- NewBand)))
- {
- if (NewBand->dbi.dwMask & DBIM_MODEFLAGS)
- {
- if (NewBand->dbi.dwModeFlags & DBIMF_ADDTOFRONT)
- uBand = 0;
- }
- }
-
- BuildRebarBandInfo(This,
- NewBand,
- &rbi);
-
- if (SUCCEEDED(IOleWindow_GetWindow(NewBand->OleWindow,
- &rbi.hwndChild)) &&
- rbi.hwndChild != NULL)
- {
- rbi.fMask |= RBBIM_CHILD;
- WARN ("ReBar band uses child window 0x%p\n", rbi.hwndChild);
- }
-
- if (!SendMessageW(This->hWndRebar,
- RB_INSERTBANDW,
- (WPARAM)uBand,
- (LPARAM)&rbi))
- {
- hRet = E_FAIL;
- goto Cleanup;
- }
-
- hRet = (HRESULT)((USHORT)GetBandID(This,
- NewBand));
- }
- else
- {
- WARN("IBandSite::AddBand(): Call to IDeskBand::SetSite() failed: %x\n", hRet);
-
- /* Remove the band from the ReBar control */
- uBand = (UINT)SendMessageW(This->hWndRebar,
- RB_IDTOINDEX,
- (WPARAM)rbi.wID,
- 0);
- if (uBand != (UINT)-1)
- {
- if (!SendMessageW(This->hWndRebar,
- RB_DELETEBAND,
- (WPARAM)uBand,
- 0))
- {
- ERR("Failed to delete band!\n");
- }
- }
- else
- ERR("Failed to map band id to index!\n");
-
- FreeBand(This,
- NewBand);
-
- hRet = E_FAIL;
- /* goto Cleanup; */
- }
- }
-Cleanup:
- if (DeskBand != NULL)
- IDeskBand_Release(DeskBand);
- if (ObjWithSite != NULL)
- IObjectWithSite_Release(ObjWithSite);
- if (OleWindow != NULL)
- IOleWindow_Release(OleWindow);
- if (WndEvtHandler != NULL)
- IWindowEventHandler_Release(WndEvtHandler);
- return hRet;
-}
-
-static HRESULT WINAPI BandSite_EnumBands(IBandSite *iface, UINT uBand, DWORD *pdwBandID)
-{
- BandSite *This = (BandSite *)iface;
- DWORD i;
-
- TRACE("(%p, %u, %p)\n", iface, uBand, pdwBandID);
-
- if (uBand == (UINT)-1)
- return (UINT)This->BandsCount;
-
- if (uBand >= This->BandsCount)
- return E_FAIL;
-
- for (i = 0; i < This->BandsAllocated; i++)
- {
- if (This->Bands[i].DeskBand != NULL)
- {
- if (uBand == 0)
- {
- *pdwBandID = i;
- return S_OK;
- }
-
- uBand--;
- }
- }
-
- return E_FAIL;
-}
-
-static HRESULT WINAPI BandSite_QueryBand(IBandSite *iface, DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState, LPWSTR pszName, int cchName)
-{
- BandSite *This = (BandSite *)iface;
- struct BandObject *Band;
-
- TRACE("(%p, %u, %p, %p, %p, %d)\n", iface, dwBandID, ppstb, pdwState, pszName, cchName);
-
- Band = GetBandByID(This, dwBandID);
- if (Band == NULL)
- return E_FAIL;
-
- if (ppstb != NULL)
- {
- Band->DeskBand->lpVtbl->AddRef(Band->DeskBand);
- *ppstb = Band->DeskBand;
- }
-
- if (pdwState != NULL)
- {
- FIXME("IBandSite::QueryBand() requests band state!\n");
- *pdwState = 0;
- }
-
- if (pszName != NULL && cchName > 0)
- {
- FIXME("IBandSite::QueryBand() requests band name!\n");
- pszName[0] = 0;
- }
- return S_OK;
-}
-
-static HRESULT WINAPI BandSite_SetBandState(IBandSite *iface, DWORD dwBandID, DWORD dwMask, DWORD dwState)
-{
- BandSite *This = (BandSite *)iface;
- struct BandObject *Band;
-
- TRACE("(%p, %u, %x, %x)\n", iface, dwBandID, dwMask, dwState);
-
- Band = GetBandByID(This, dwBandID);
- if (Band == NULL)
- return E_FAIL;
-
- FIXME("Stub\n");
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI BandSite_RemoveBand(IBandSite *iface, DWORD dwBandID)
-{
- BandSite *This = (BandSite *)iface;
- struct BandObject *Band;
- UINT uBand;
-
- TRACE("(%p, %u)\n", iface, dwBandID);
-
- if (This->hWndRebar == NULL)
- return E_FAIL;
-
- Band = GetBandByID(This, dwBandID);
- if (Band == NULL)
- return E_FAIL;
-
- uBand = (UINT)SendMessageW(This->hWndRebar,
- RB_IDTOINDEX,
- (WPARAM)GetBandID(This,
- Band),
- 0);
- if (uBand != (UINT)-1)
- {
- if (!SendMessageW(This->hWndRebar,
- RB_DELETEBAND,
- (WPARAM)uBand,
- 0))
- {
- ERR("Could not delete band!\n");
- }
- }
- else
- ERR("Could not map band id to index!\n");
-
- FreeBand(This, Band);
- return S_OK;
-}
-
-static HRESULT WINAPI BandSite_GetBandObject(IBandSite *iface, DWORD dwBandID, REFIID riid, VOID **ppv)
-{
- BandSite *This = (BandSite *)iface;
- struct BandObject *Band;
-
- TRACE("(%p, %u, %s, %p)\n", iface, dwBandID, debugstr_guid(riid), ppv);
-
- Band = GetBandByID(This, dwBandID);
- if (Band == NULL)
- {
- *ppv = NULL;
- return E_FAIL;
- }
-
- return IDeskBand_QueryInterface(Band->DeskBand, riid, ppv);
-}
-
-static HRESULT WINAPI BandSite_SetBandSiteInfo(IBandSite *iface, const BANDSITEINFO *pbsinfo)
-{
- FIXME("(%p, %p)\n", iface, pbsinfo);
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI BandSite_GetBandSiteInfo(IBandSite *iface, BANDSITEINFO *pbsinfo)
-{
- FIXME("(%p, %p)\n", iface, pbsinfo);
- return E_NOTIMPL;
-}
-
-static const IBandSiteVtbl BandSiteVtbl =
-{
- BandSite_QueryInterface,
- BandSite_AddRef,
- BandSite_Release,
-
- BandSite_AddBand,
- BandSite_EnumBands,
- BandSite_QueryBand,
- BandSite_SetBandState,
- BandSite_RemoveBand,
- BandSite_GetBandObject,
- BandSite_SetBandSiteInfo,
- BandSite_GetBandSiteInfo,
-};
-
-static HRESULT WINAPI BandSite_IWindowEventHandler_QueryInterface(IWindowEventHandler *iface, REFIID iid, LPVOID *ppvOut)
-{
- BandSite *This = impl_from_IWindowEventHandler(iface);
- TRACE("(%p, %s, %p)\n", iface, debugstr_guid(iid), ppvOut);
- return BandSite_QueryInterface((IBandSite *)This, iid, ppvOut);
-}
-
-static ULONG WINAPI BandSite_IWindowEventHandler_AddRef(IWindowEventHandler *iface)
-{
- BandSite *This = impl_from_IWindowEventHandler(iface);
- TRACE("(%p)\n", iface);
- return BandSite_AddRef((IBandSite *)This);
-}
-
-static ULONG WINAPI BandSite_IWindowEventHandler_Release(IWindowEventHandler *iface)
-{
- BandSite *This = impl_from_IWindowEventHandler(iface);
- TRACE("(%p)\n", iface);
- return BandSite_Release((IBandSite *)This);
-}
-
-static HRESULT WINAPI BandSite_ProcessMessage(IWindowEventHandler *iface, HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plrResult)
-{
- BandSite *This = impl_from_IWindowEventHandler(iface);
- struct BandObject *Band;
-
- TRACE("(%p, %p, %u, %p, %p, %p)\n", iface, hWnd, uMsg, wParam, lParam, plrResult);
-
- *plrResult = 0;
- if (This->hWndRebar == NULL)
- return E_FAIL;
-
- if (hWnd == This->hWndRebar)
- {
- /* FIXME: Just send the message? */
- *plrResult = SendMessageW(hWnd,
- uMsg,
- wParam,
- lParam);
- return S_OK;
- }
-
- Band = GetBandFromHwnd(This,
- hWnd);
- if (Band != NULL)
- {
- return IWindowEventHandler_ProcessMessage(Band->WndEvtHandler,
- hWnd,
- uMsg,
- wParam,
- lParam,
- plrResult);
- }
-
- return E_FAIL;
-}
-
-static HRESULT WINAPI BandSite_ContainsWindow(IWindowEventHandler *iface, HWND hWnd)
-{
- BandSite *This = impl_from_IWindowEventHandler(iface);
- struct BandObject *Band;
-
- TRACE("(%p, %p)\n", iface, hWnd);
-
- if (This->hWndRebar == NULL)
- return E_FAIL;
-
- Band = GetBandFromHwnd(This,
- hWnd);
- if (Band != NULL)
- return S_OK;
-
- return S_FALSE;
-}
-
-static const IWindowEventHandlerVtbl BandSite_EventHandlerVtbl =
-{
- BandSite_IWindowEventHandler_QueryInterface,
- BandSite_IWindowEventHandler_AddRef,
- BandSite_IWindowEventHandler_Release,
-
- BandSite_ProcessMessage,
- BandSite_ContainsWindow,
-};
-
-static HRESULT WINAPI BandSite_IDeskBarClient_QueryInterface(IDeskBarClient *iface, REFIID iid, LPVOID *ppvOut)
-{
- BandSite *This = impl_from_IDeskBarClient(iface);
- TRACE("(%p, %s, %p)\n", iface, debugstr_guid(iid), ppvOut);
- return BandSite_QueryInterface((IBandSite *)This, iid, ppvOut);
-}
-
-static ULONG WINAPI BandSite_IDeskBarClient_AddRef(IDeskBarClient *iface)
-{
- BandSite *This = impl_from_IDeskBarClient(iface);
- TRACE("(%p)\n", iface);
- return BandSite_AddRef((IBandSite *)This);
-}
-
-static ULONG WINAPI BandSite_IDeskBarClient_Release(IDeskBarClient *iface)
-{
- BandSite *This = impl_from_IDeskBarClient(iface);
- TRACE("(%p)\n", iface);
- return BandSite_Release((IBandSite *)This);
-}
-
-static HRESULT WINAPI BandSite_IDeskBarClient_GetWindow(IDeskBarClient *iface, HWND *phWnd)
-{
- BandSite *This = impl_from_IDeskBarClient(iface);
-
- TRACE("(%p, %p)\n", iface, phWnd);
-
- *phWnd = This->hWndRebar;
- if (This->hWndRebar != NULL)
- return S_OK;
-
- return E_FAIL;
-}
-
-static HRESULT WINAPI BandSite_IDeskBarClient_ContextSensitiveHelp(IDeskBarClient *iface, BOOL fEnterMode)
-{
- FIXME("(%p, %d)\n", iface, fEnterMode);
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI BandSite_IDeskBarClient_SetDeskBarSite(IDeskBarClient *iface, IUnknown *pUnk)
-{
- BandSite *This = impl_from_IDeskBarClient(iface);
- HWND hWndParent;
- HRESULT hRet;
-
- TRACE("(%p, %p)\n", iface, pUnk);
-
- if (This->OleWindow != NULL)
- {
- This->OleWindow->lpVtbl->Release(This->OleWindow);
- This->OleWindow = NULL;
- }
-
- hRet = IUnknown_QueryInterface(pUnk,
- &IID_IOleWindow,
- (PVOID*)&This->OleWindow);
- if (!SUCCEEDED(hRet))
- {
- This->OleWindow = NULL;
- return E_FAIL;
- }
-
- hRet = IOleWindow_GetWindow(This->OleWindow,
- &hWndParent);
- if (!SUCCEEDED(hRet))
- return E_FAIL;
-
- This->hWndRebar = CreateWindowExW(WS_EX_TOOLWINDOW,
- REBARCLASSNAMEW,
- NULL,
- WS_CHILD | WS_CLIPSIBLINGS |
- WS_CLIPCHILDREN | RBS_VARHEIGHT |
- RBS_BANDBORDERS | CCS_NODIVIDER |
- CCS_NORESIZE | CCS_NOPARENTALIGN,
- 0,
- 0,
- 0,
- 0,
- hWndParent,
- NULL,
- browseui_hinstance,
- NULL);
- if (This->hWndRebar == NULL)
- {
- IOleWindow_Release(This->OleWindow);
- This->OleWindow = NULL;
- WARN("IDeskbarClient::SetDeskBarSite() failed to create ReBar control!\n");
- return E_FAIL;
- }
-
- return S_OK;
-}
-
-static HRESULT WINAPI BandSite_IDeskBarClient_SetModeDBC(IDeskBarClient *iface, DWORD dwMode)
-{
- BandSite *This = impl_from_IDeskBarClient(iface);
- LONG dwStyle, dwPrevStyle;
-
- TRACE("(%p, %x)\n", iface, dwMode);
-
- if (This->hWndRebar == NULL)
- return E_FAIL;
-
- dwStyle = dwPrevStyle = GetWindowLongPtr(This->hWndRebar,
- GWL_STYLE);
- if (dwMode & DBIF_VIEWMODE_VERTICAL)
- dwStyle |= CCS_VERT;
-
- if (dwMode & ~DBIF_VIEWMODE_VERTICAL)
- FIXME("IDeskBarClient::SetModeDBC() unhandled modes: %x\n", dwStyle & ~DBIF_VIEWMODE_VERTICAL);
-
- if (dwStyle != dwPrevStyle)
- {
- SetWindowLongPtr(This->hWndRebar,
- GWL_STYLE,
- dwPrevStyle);
- }
-
- return S_OK;
-}
-
-static HRESULT WINAPI BandSite_IDeskBarClient_UIActivateDBC(IDeskBarClient *iface, DWORD dwState)
-{
- BandSite *This = impl_from_IDeskBarClient(iface);
-
- TRACE("(%p, %x)\n", iface, dwState);
-
- if (This->hWndRebar == NULL)
- return E_FAIL;
-
- ShowWindow(This->hWndRebar, (dwState & DBC_SHOW) ? SW_SHOW : SW_HIDE);
- FIXME("IDeskBarClient::UIActivateDBC() Properly notify bands?\n");
- return S_OK;
-}
-
-static HRESULT WINAPI BandSite_IDeskBarClient_GetSize(IDeskBarClient *iface, DWORD unknown1, LPRECT unknown2)
-{
- FIXME("(%p, %x, %p)\n", iface, unknown1, unknown2);
- return E_NOTIMPL;
-}
-
-static const IDeskBarClientVtbl BandSite_DeskBarVtbl =
-{
- BandSite_IDeskBarClient_QueryInterface,
- BandSite_IDeskBarClient_AddRef,
- BandSite_IDeskBarClient_Release,
-
- BandSite_IDeskBarClient_GetWindow,
- BandSite_IDeskBarClient_ContextSensitiveHelp,
-
- BandSite_IDeskBarClient_SetDeskBarSite,
- BandSite_IDeskBarClient_SetModeDBC,
- BandSite_IDeskBarClient_UIActivateDBC,
- BandSite_IDeskBarClient_GetSize,
-};
-
-static HRESULT WINAPI BandSite_IOleCommandTarget_QueryInterface(IOleCommandTarget *iface, REFIID iid, LPVOID *ppvOut)
-{
- BandSite *This = impl_from_IOleCommandTarget(iface);
- TRACE("(%p, %s, %p)\n", iface, debugstr_guid(iid), ppvOut);
- return BandSite_QueryInterface((IBandSite *)This, iid, ppvOut);
-}
-
-static ULONG WINAPI BandSite_IOleCommandTarget_AddRef(IOleCommandTarget *iface)
-{
- BandSite *This = impl_from_IOleCommandTarget(iface);
- TRACE("(%p)\n", iface);
- return BandSite_AddRef((IBandSite *)This);
-}
-
-static ULONG WINAPI BandSite_IOleCommandTarget_Release(IOleCommandTarget *iface)
-{
- BandSite *This = impl_from_IOleCommandTarget(iface);
- TRACE("(%p)\n", iface);
- return BandSite_Release((IBandSite *)This);
-}
-
-static HRESULT WINAPI BandSite_IOleCommandTarget_QueryStatus(IOleCommandTarget *iface, const GUID *pguidCmdGroup, DWORD cCmds, OLECMD *prgCmds, OLECMDTEXT *pCmdText)
-{
- FIXME("(%p, %p, %u, %p, %p)\n", iface, pguidCmdGroup, cCmds, prgCmds, pCmdText);
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI BandSite_IOleCommandTarget_Exec(IOleCommandTarget *iface, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdExecOpt, VARIANTARG *pvaIn, VARIANTARG *pvaOut)
-{
- BandSite *This = impl_from_IOleCommandTarget(iface);
- HRESULT hRet = S_OK;
-
- TRACE("(%p, %p, %u, %u, %p, %p)\n", iface, pguidCmdGroup, nCmdID, nCmdExecOpt, pvaIn, pvaOut);
-
- if (This->hWndRebar == NULL)
- return E_FAIL;
-
- if (IsEqualIID(pguidCmdGroup, &IID_IDeskBand))
- {
- switch (nCmdID)
- {
- case DBID_BANDINFOCHANGED:
- if (pvaIn == NULL)
- hRet = UpdateAllBands(This);
- else
- {
- /* Update a single band */
- if (pvaIn->n1.n2.vt == VT_I4)
- hRet = UpdateBand(This, pvaIn->n1.n2.n3.lVal);
- else
- hRet = E_FAIL;
- }
- break;
-
- case DBID_SHOWONLY:
- case DBID_MAXIMIZEBAND:
- case DBID_PUSHCHEVRON:
- FIXME("IOleCommandTarget::Exec(): Unsupported command ID %d\n", nCmdID);
- return E_NOTIMPL;
- default:
- return E_FAIL;
- }
- return S_OK;
- }
- else
- WARN("IOleCommandTarget::Exec(): Unsupported command group GUID\n");
-
- return E_NOTIMPL;
-}
-
-static const IOleCommandTargetVtbl BandSite_OleTargetVtbl =
-{
- BandSite_IOleCommandTarget_QueryInterface,
- BandSite_IOleCommandTarget_AddRef,
- BandSite_IOleCommandTarget_Release,
-
- BandSite_IOleCommandTarget_QueryStatus,
- BandSite_IOleCommandTarget_Exec,
-};
--- /dev/null
+/*
+ * Rebar band site
+ *
+ * Copyright 2007 Hervé Poussineau
+ * Copyright 2009 Andrew Hill
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <windows.h>
+#include <shlobj.h>
+#include <shlobj_undoc.h>
+#include <shlguid.h>
+#include <shlguid_undoc.h>
+#include <tchar.h>
+#include <atlbase.h>
+#include <atlcom.h>
+#include <atlwin.h>
+#include "resource.h"
+#include "wine/debug.h"
+#include "bandsite.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(browseui);
+
+#ifndef ASSERT
+#define ASSERT(cond) \
+ if (!(cond)) \
+ ERR ("ASSERTION %s AT %s:%d FAILED!\n", #cond, __FILE__, __LINE__)
+#endif
+
+CBandSiteBase::CBandSiteBase()
+{
+ fBandsCount = 0;
+ fBandsAllocated = 0;
+ fBands = NULL;
+ fRebarWindow = NULL;
+}
+
+UINT CBandSiteBase::GetBandID(struct BandObject *Band)
+{
+ return (UINT)(Band - fBands);
+}
+
+struct CBandSiteBase::BandObject *CBandSiteBase::GetBandByID(DWORD dwBandID)
+{
+ if ((LONG)dwBandID >= fBandsAllocated)
+ return NULL;
+
+ if (fBands[dwBandID].DeskBand == NULL)
+ return NULL;
+
+ return &fBands[dwBandID];
+}
+
+void CBandSiteBase::FreeBand(struct BandObject *Band)
+{
+ ATLASSERT(Band->DeskBand != NULL);
+ ATLASSERT(Band->OleWindow != NULL);
+ ATLASSERT(Band->WndEvtHandler != NULL);
+ Band->DeskBand->Release();
+ Band->OleWindow->Release();
+ Band->WndEvtHandler->Release();
+ memset(Band, 0, sizeof(*Band));
+ fBandsCount--;
+}
+
+DWORD CBandSiteBase::GetBandSiteViewMode()
+{
+ DWORD dwStyle;
+
+ /* FIXME: What about DBIF_VIEWMODE_FLOATING and DBIF_VIEWMODE_TRANSPARENT? */
+ dwStyle = GetWindowLongPtr(fRebarWindow, GWL_STYLE);
+
+ if (dwStyle & CCS_VERT)
+ return DBIF_VIEWMODE_VERTICAL;
+ else
+ return DBIF_VIEWMODE_NORMAL;
+}
+
+VOID CBandSiteBase::BuildRebarBandInfo(struct BandObject *Band, REBARBANDINFOW *prbi)
+{
+ memset(prbi, 0, sizeof(*prbi));
+ prbi->cbSize = sizeof(*prbi);
+
+ prbi->fMask = RBBIM_ID;
+ prbi->wID = GetBandID(Band);
+
+ if (Band->dbi.dwMask & DBIM_MINSIZE)
+ {
+ prbi->fMask |= RBBIM_CHILDSIZE;
+ prbi->cxMinChild = Band->dbi.ptMinSize.x;
+ prbi->cyMinChild = Band->dbi.ptMinSize.y;
+ }
+
+ if (Band->dbi.dwMask & DBIM_MAXSIZE)
+ {
+ prbi->fMask |= RBBIM_CHILDSIZE;
+ prbi->cyMaxChild = Band->dbi.ptMaxSize.y;
+ }
+
+ if ((Band->dbi.dwMask & (DBIM_INTEGRAL | DBIM_MODEFLAGS)) == (DBIM_INTEGRAL | DBIM_MODEFLAGS) &&
+ (Band->dbi.dwModeFlags & DBIMF_VARIABLEHEIGHT))
+ {
+ prbi->fMask |= RBBIM_CHILDSIZE;
+ prbi->cyIntegral = Band->dbi.ptIntegral.y;
+ }
+
+ if (Band->dbi.dwMask & DBIM_ACTUAL)
+ {
+ prbi->fMask |= RBBIM_IDEALSIZE | RBBIM_SIZE | RBBIM_CHILDSIZE;
+ prbi->cxIdeal = Band->dbi.ptActual.x;
+ prbi->cx = Band->dbi.ptActual.x;
+ prbi->cyChild = Band->dbi.ptActual.y;
+ }
+
+ if (Band->dbi.dwMask & DBIM_TITLE)
+ {
+ prbi->fMask |= RBBIM_TEXT;
+ prbi->lpText = Band->dbi.wszTitle;
+ prbi->cch = wcslen(Band->dbi.wszTitle);
+ }
+
+ if (Band->dbi.dwMask & DBIM_MODEFLAGS)
+ {
+ prbi->fMask |= RBBIM_STYLE;
+
+ if (Band->dbi.dwModeFlags & DBIMF_FIXED)
+ prbi->fStyle |= RBBS_FIXEDSIZE | RBBS_NOGRIPPER;
+ if (Band->dbi.dwModeFlags & DBIMF_FIXEDBMP)
+ prbi->fStyle |= RBBS_FIXEDBMP;
+ if (Band->dbi.dwModeFlags & DBIMF_VARIABLEHEIGHT)
+ prbi->fStyle |= RBBS_VARIABLEHEIGHT;
+ if (Band->dbi.dwModeFlags & DBIMF_DEBOSSED)
+ prbi->fStyle |= RBBS_CHILDEDGE;
+ if (Band->dbi.dwModeFlags & DBIMF_USECHEVRON)
+ prbi->fStyle |= RBBS_USECHEVRON;
+ if (Band->dbi.dwModeFlags & DBIMF_BREAK)
+ prbi->fStyle |= RBBS_BREAK;
+ if (Band->dbi.dwModeFlags & DBIMF_TOPALIGN)
+ prbi->fStyle |= RBBS_TOPALIGN;
+ if (Band->dbi.dwModeFlags & DBIMF_NOGRIPPER)
+ prbi->fStyle |= RBBS_NOGRIPPER;
+ if (Band->dbi.dwModeFlags & DBIMF_ALWAYSGRIPPER)
+ prbi->fStyle |= RBBS_GRIPPERALWAYS;
+ }
+
+ if ((Band->dbi.dwMask & (DBIM_BKCOLOR | DBIM_MODEFLAGS)) == (DBIM_BKCOLOR | DBIM_MODEFLAGS) &&
+ (Band->dbi.dwModeFlags & DBIMF_BKCOLOR))
+ {
+ prbi->fMask |= RBBIM_COLORS;
+ prbi->clrFore = (COLORREF)(COLOR_WINDOWTEXT + 1);
+ prbi->clrBack = Band->dbi.crBkgnd;
+ }
+}
+
+HRESULT CBandSiteBase::UpdateSingleBand(struct BandObject *Band)
+{
+ REBARBANDINFOW rbi;
+ DWORD dwViewMode;
+ UINT uBand;
+ HRESULT hRet;
+
+ memset(&Band->dbi, 0, sizeof(Band->dbi));
+ Band->dbi.dwMask = DBIM_MINSIZE | DBIM_MAXSIZE | DBIM_INTEGRAL |
+ DBIM_ACTUAL | DBIM_TITLE | DBIM_MODEFLAGS | DBIM_BKCOLOR;
+
+ dwViewMode = GetBandSiteViewMode();
+
+ hRet = Band->DeskBand->GetBandInfo((DWORD)GetBandID(Band), dwViewMode, &Band->dbi);
+ if (SUCCEEDED(hRet))
+ {
+ BuildRebarBandInfo(Band, &rbi);
+ if (SUCCEEDED(Band->OleWindow->GetWindow(&rbi.hwndChild)) &&
+ rbi.hwndChild != NULL)
+ {
+ rbi.fMask |= RBBIM_CHILD;
+ WARN ("ReBar band uses child window 0x%p\n", rbi.hwndChild);
+ }
+
+ uBand = (UINT)SendMessageW(fRebarWindow, RB_IDTOINDEX, (WPARAM)rbi.wID, 0);
+ if (uBand != (UINT)-1)
+ {
+ if (!SendMessageW(fRebarWindow, RB_SETBANDINFOW, (WPARAM)uBand, (LPARAM)&rbi))
+ {
+ WARN("Failed to update the rebar band!\n");
+ }
+ }
+ else
+ WARN("Failed to map rebar band id to index!\n");
+
+ }
+
+ return hRet;
+}
+
+HRESULT CBandSiteBase::UpdateAllBands()
+{
+ LONG i;
+ HRESULT hRet;
+
+ for (i = 0; i < fBandsAllocated; i++)
+ {
+ if (fBands[i].DeskBand != NULL)
+ {
+ hRet = UpdateSingleBand(&fBands[i]);
+ if (!SUCCEEDED(hRet))
+ return hRet;
+ }
+ }
+
+ return S_OK;
+}
+
+HRESULT CBandSiteBase::UpdateBand(DWORD dwBandID)
+{
+ struct BandObject *Band;
+
+ Band = GetBandByID(dwBandID);
+ if (Band == NULL)
+ return E_FAIL;
+
+ return UpdateSingleBand(Band);
+}
+
+struct CBandSiteBase::BandObject *CBandSiteBase::GetBandFromHwnd(HWND hwnd)
+{
+ HRESULT hRet;
+ HWND hWndBand;
+ LONG i;
+
+ for (i = 0; i < fBandsAllocated; i++)
+ {
+ if (fBands[i].DeskBand != NULL)
+ {
+ ASSERT(fBands[i].OleWindow);
+
+ hWndBand = NULL;
+ hRet = fBands[i].OleWindow->GetWindow(&hWndBand);
+ if (SUCCEEDED(hRet) && hWndBand == hwnd)
+ return &fBands[i];
+ }
+ }
+
+ return NULL;
+}
+
+CBandSiteBase::~CBandSiteBase()
+{
+ int i;
+
+ TRACE("destroying %p\n", this);
+
+ if (fRebarWindow != NULL)
+ {
+ DestroyWindow(fRebarWindow);
+ fRebarWindow = NULL;
+ }
+
+ if (fBands != NULL)
+ {
+ for (i = 0; i < fBandsAllocated; i++)
+ {
+ if (fBands[i].DeskBand != NULL)
+ FreeBand(&fBands[i]);
+ }
+ CoTaskMemFree(fBands);
+ fBands = NULL;
+ }
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::AddBand(IUnknown *punk)
+{
+ INT i;
+ LONG NewAllocated;
+ struct BandObject *NewBand = NULL;
+ CComPtr<IDeskBand> DeskBand;
+ CComPtr<IObjectWithSite> ObjWithSite;
+ CComPtr<IOleWindow> OleWindow;
+ CComPtr<IWinEventHandler> WndEvtHandler;
+ REBARBANDINFOW rbi;
+ HRESULT hRet;
+ UINT uBand;
+
+ TRACE("(%p, %p)\n", this, punk);
+
+ if (punk == NULL || fRebarWindow == NULL)
+ return E_FAIL;
+
+ hRet = punk->QueryInterface(IID_IDeskBand, (PVOID *)&DeskBand);
+ if (!SUCCEEDED(hRet) || DeskBand == NULL)
+ goto Cleanup;
+ hRet = punk->QueryInterface(IID_IObjectWithSite, (PVOID *)&ObjWithSite);
+ if (!SUCCEEDED(hRet) || ObjWithSite == NULL)
+ goto Cleanup;
+ hRet = punk->QueryInterface(IID_IOleWindow, (PVOID *)&OleWindow);
+ if (!SUCCEEDED(hRet) || OleWindow == NULL)
+ goto Cleanup;
+ hRet = punk->QueryInterface(IID_IWinEventHandler, (PVOID *)&WndEvtHandler);
+ if (!SUCCEEDED(hRet) || WndEvtHandler == NULL)
+ goto Cleanup;
+
+ hRet = S_OK;
+ if (fBandsAllocated > fBandsCount)
+ {
+ /* Search for a free band object */
+ for (i = 0; i < fBandsAllocated; i++)
+ {
+ if (fBands[i].DeskBand == NULL)
+ {
+ NewBand = &fBands[i];
+ break;
+ }
+ }
+ }
+ else if (fBandsAllocated > 0)
+ {
+ ASSERT (fBands != NULL);
+
+ /* Reallocate the band object array */
+ NewAllocated = fBandsAllocated + 8;
+ if (NewAllocated > 0xFFFF)
+ NewAllocated = 0xFFFF;
+ if (NewAllocated == fBandsAllocated)
+ {
+ hRet = E_OUTOFMEMORY;
+ goto Cleanup;
+ }
+
+
+ NewBand = reinterpret_cast<struct BandObject *>(CoTaskMemAlloc(NewAllocated * sizeof(struct BandObject)));
+ if (NewBand == NULL)
+ {
+ hRet = E_OUTOFMEMORY;
+ goto Cleanup;
+ }
+
+ /* Copy the old array */
+ memcpy(NewBand, fBands, fBandsAllocated * sizeof(struct BandObject));
+
+ /* Initialize the added bands */
+ memset(&NewBand[fBandsAllocated], 0, (NewAllocated - fBandsAllocated) * sizeof(struct BandObject));
+
+ NewBand = &fBands[fBandsAllocated];
+ fBandsAllocated = NewAllocated;
+ CoTaskMemFree(fBands);
+ fBands = NewBand;
+ }
+ else
+ {
+ ASSERT(fBands == NULL);
+ ASSERT(fBandsAllocated == 0);
+ ASSERT(fBandsCount == 0);
+
+ /* Allocate new array */
+ fBands = reinterpret_cast<struct BandObject *>(CoTaskMemAlloc(8 * sizeof(struct BandObject)));
+ if (fBands == NULL)
+ {
+ hRet = E_OUTOFMEMORY;
+ goto Cleanup;
+ }
+
+ /* Initialize the added bands */
+ memset(fBands, 0, 8 * sizeof(struct BandObject));
+
+ fBandsAllocated += 8;
+ NewBand = &fBands[0];
+ }
+
+ if (SUCCEEDED(hRet))
+ {
+ ASSERT(NewBand != NULL);
+
+ fBandsCount++;
+ NewBand->DeskBand = DeskBand.Detach();
+ NewBand->OleWindow = OleWindow.Detach();
+ NewBand->WndEvtHandler = WndEvtHandler.Detach();
+
+ /* Create the ReBar band */
+ hRet = ObjWithSite->SetSite((IOleWindow *)this);
+ if (SUCCEEDED(hRet))
+ {
+ uBand = 0xffffffff;
+ if (SUCCEEDED(UpdateSingleBand(NewBand)))
+ {
+ if (NewBand->dbi.dwMask & DBIM_MODEFLAGS)
+ {
+ if (NewBand->dbi.dwModeFlags & DBIMF_ADDTOFRONT)
+ uBand = 0;
+ }
+ }
+
+ BuildRebarBandInfo(NewBand, &rbi);
+
+ if (SUCCEEDED(NewBand->OleWindow->GetWindow(&rbi.hwndChild)) &&
+ rbi.hwndChild != NULL)
+ {
+ rbi.fMask |= RBBIM_CHILD;
+ WARN ("ReBar band uses child window 0x%p\n", rbi.hwndChild);
+ }
+
+ if (!SendMessageW(fRebarWindow, RB_INSERTBANDW, (WPARAM)uBand, (LPARAM)&rbi))
+ return E_FAIL;
+
+ hRet = (HRESULT)((USHORT)GetBandID(NewBand));
+ }
+ else
+ {
+ WARN("IBandSite::AddBand(): Call to IDeskBand::SetSite() failed: %x\n", hRet);
+
+ /* Remove the band from the ReBar control */
+ uBand = (UINT)SendMessageW(fRebarWindow, RB_IDTOINDEX, (WPARAM)rbi.wID, 0);
+ if (uBand != (UINT)-1)
+ {
+ if (!SendMessageW(fRebarWindow, RB_DELETEBAND, (WPARAM)uBand, 0))
+ {
+ ERR("Failed to delete band!\n");
+ }
+ }
+ else
+ ERR("Failed to map band id to index!\n");
+
+ FreeBand(NewBand);
+
+ hRet = E_FAIL;
+ /* goto Cleanup; */
+ }
+ }
+Cleanup:
+ return hRet;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::EnumBands(UINT uBand, DWORD *pdwBandID)
+{
+ DWORD i;
+
+ TRACE("(%p, %u, %p)\n", this, uBand, pdwBandID);
+
+ if (uBand == 0xffffffff)
+ return (UINT)fBandsCount;
+
+ if (uBand >= (UINT)fBandsCount)
+ return E_FAIL;
+
+ for (i = 0; i < (DWORD)fBandsAllocated; i++)
+ {
+ if (fBands[i].DeskBand != NULL)
+ {
+ if (uBand == 0)
+ {
+ *pdwBandID = i;
+ return S_OK;
+ }
+
+ uBand--;
+ }
+ }
+
+ return E_FAIL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::QueryBand(DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState, LPWSTR pszName, int cchName)
+{
+ struct BandObject *Band;
+
+ TRACE("(%p, %u, %p, %p, %p, %d)\n", this, dwBandID, ppstb, pdwState, pszName, cchName);
+
+ Band = GetBandByID(dwBandID);
+ if (Band == NULL)
+ return E_FAIL;
+
+ if (ppstb != NULL)
+ {
+ Band->DeskBand->AddRef();
+ *ppstb = Band->DeskBand;
+ }
+
+ if (pdwState != NULL)
+ {
+ FIXME("IBandSite::QueryBand() requests band state!\n");
+ *pdwState = 0;
+ }
+
+ if (pszName != NULL && cchName > 0)
+ {
+ FIXME("IBandSite::QueryBand() requests band name!\n");
+ pszName[0] = 0;
+ }
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::SetBandState(DWORD dwBandID, DWORD dwMask, DWORD dwState)
+{
+ struct BandObject *Band;
+
+ TRACE("(%p, %u, %x, %x)\n", this, dwBandID, dwMask, dwState);
+
+ Band = GetBandByID(dwBandID);
+ if (Band == NULL)
+ return E_FAIL;
+
+ FIXME("Stub\n");
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::RemoveBand(DWORD dwBandID)
+{
+ struct BandObject *Band;
+ UINT uBand;
+
+ TRACE("(%p, %u)\n", this, dwBandID);
+
+ if (fRebarWindow == NULL)
+ return E_FAIL;
+
+ Band = GetBandByID(dwBandID);
+ if (Band == NULL)
+ return E_FAIL;
+
+ uBand = (UINT)SendMessageW(fRebarWindow, RB_IDTOINDEX, (WPARAM)GetBandID(Band), 0);
+ if (uBand != (UINT)-1)
+ {
+ if (!SendMessageW(fRebarWindow, RB_DELETEBAND, (WPARAM)uBand, 0))
+ {
+ ERR("Could not delete band!\n");
+ }
+ }
+ else
+ ERR("Could not map band id to index!\n");
+
+ FreeBand(Band);
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::GetBandObject(DWORD dwBandID, REFIID riid, VOID **ppv)
+{
+ struct BandObject *Band;
+
+ TRACE("(%p, %u, %s, %p)\n", this, dwBandID, debugstr_guid(&riid), ppv);
+
+ Band = GetBandByID(dwBandID);
+ if (Band == NULL)
+ {
+ *ppv = NULL;
+ return E_FAIL;
+ }
+
+ return Band->DeskBand->QueryInterface(riid, ppv);
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::SetBandSiteInfo(const BANDSITEINFO *pbsinfo)
+{
+ FIXME("(%p, %p)\n", this, pbsinfo);
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::GetBandSiteInfo(BANDSITEINFO *pbsinfo)
+{
+ FIXME("(%p, %p)\n", this, pbsinfo);
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plrResult)
+{
+ struct BandObject *Band;
+
+ TRACE("(%p, %p, %u, %p, %p, %p)\n", this, hWnd, uMsg, wParam, lParam, plrResult);
+
+ *plrResult = 0;
+ if (fRebarWindow == NULL)
+ return E_FAIL;
+
+ if (hWnd == fRebarWindow)
+ {
+ /* FIXME: Just send the message? */
+ *plrResult = SendMessageW(hWnd, uMsg, wParam, lParam);
+ return S_OK;
+ }
+
+ Band = GetBandFromHwnd(hWnd);
+ if (Band != NULL)
+ {
+ return Band->WndEvtHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, plrResult);
+ }
+
+ return E_FAIL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::IsWindowOwner(HWND hWnd)
+{
+ struct BandObject *Band;
+
+ TRACE("(%p, %p)\n", this, hWnd);
+
+ if (fRebarWindow == NULL)
+ return E_FAIL;
+
+ Band = GetBandFromHwnd(hWnd);
+ if (Band != NULL)
+ return S_OK;
+
+ return S_FALSE;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::GetWindow(HWND *phWnd)
+{
+ TRACE("(%p, %p)\n", this, phWnd);
+
+ *phWnd = fRebarWindow;
+ if (fRebarWindow != NULL)
+ return S_OK;
+
+ return E_FAIL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::ContextSensitiveHelp(BOOL fEnterMode)
+{
+ FIXME("(%p, %d)\n", this, fEnterMode);
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::SetDeskBarSite(IUnknown *pUnk)
+{
+ HWND hWndParent;
+ HRESULT hRet;
+
+ TRACE("(%p, %p)\n", this, pUnk);
+
+ fOleWindow.Release();
+
+ hRet = pUnk->QueryInterface(IID_IOleWindow, (PVOID *)&fOleWindow);
+ if (!SUCCEEDED(hRet))
+ return E_FAIL;
+
+ hRet = fOleWindow->GetWindow(&hWndParent);
+ if (!SUCCEEDED(hRet))
+ return E_FAIL;
+
+ fRebarWindow = CreateWindowExW(WS_EX_TOOLWINDOW,
+ REBARCLASSNAMEW,
+ NULL,
+ WS_CHILD | WS_CLIPSIBLINGS |
+ WS_CLIPCHILDREN | RBS_VARHEIGHT |
+ RBS_BANDBORDERS | CCS_NODIVIDER |
+ CCS_NORESIZE | CCS_NOPARENTALIGN,
+ 0,
+ 0,
+ 0,
+ 0,
+ hWndParent,
+ NULL,
+ _AtlBaseModule.GetModuleInstance(),
+ NULL);
+ if (fRebarWindow == NULL)
+ {
+ fOleWindow.Release();
+ WARN("IDeskbarClient::SetDeskBarSite() failed to create ReBar control!\n");
+ return E_FAIL;
+ }
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::SetModeDBC(DWORD dwMode)
+{
+ LONG dwStyle;
+ LONG dwPrevStyle;
+
+ TRACE("(%p, %x)\n", this, dwMode);
+
+ if (fRebarWindow == NULL)
+ return E_FAIL;
+
+ dwStyle = dwPrevStyle = GetWindowLongPtr(fRebarWindow, GWL_STYLE);
+ if (dwMode & DBIF_VIEWMODE_VERTICAL)
+ dwStyle |= CCS_VERT;
+
+ if (dwMode & ~DBIF_VIEWMODE_VERTICAL)
+ FIXME("IDeskBarClient::SetModeDBC() unhandled modes: %x\n", dwStyle & ~DBIF_VIEWMODE_VERTICAL);
+
+ if (dwStyle != dwPrevStyle)
+ {
+ SetWindowLongPtr(fRebarWindow, GWL_STYLE, dwPrevStyle);
+ }
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::UIActivateDBC(DWORD dwState)
+{
+ TRACE("(%p, %x)\n", this, dwState);
+
+ if (fRebarWindow == NULL)
+ return E_FAIL;
+
+ ShowWindow(fRebarWindow, (dwState & DBC_SHOW) ? SW_SHOW : SW_HIDE);
+ FIXME("IDeskBarClient::UIActivateDBC() Properly notify bands?\n");
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::GetSize(DWORD unknown1, LPRECT unknown2)
+{
+ FIXME("(%p, %x, %p)\n", this, unknown1, unknown2);
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::QueryStatus(const GUID *pguidCmdGroup, DWORD cCmds, OLECMD *prgCmds, OLECMDTEXT *pCmdText)
+{
+ FIXME("(%p, %p, %u, %p, %p)\n", this, pguidCmdGroup, cCmds, prgCmds, pCmdText);
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdExecOpt, VARIANTARG *pvaIn, VARIANTARG *pvaOut)
+{
+ HRESULT hRet = S_OK;
+
+ TRACE("(%p, %p, %u, %u, %p, %p)\n", this, pguidCmdGroup, nCmdID, nCmdExecOpt, pvaIn, pvaOut);
+
+ if (fRebarWindow == NULL)
+ return E_FAIL;
+
+ if (IsEqualIID(pguidCmdGroup, IID_IDeskBand))
+ {
+ switch (nCmdID)
+ {
+ case DBID_BANDINFOCHANGED:
+ if (pvaIn == NULL)
+ hRet = UpdateAllBands();
+ else
+ {
+ /* Update a single band */
+ if (pvaIn->n1.n2.vt == VT_I4)
+ hRet = UpdateBand(pvaIn->n1.n2.n3.lVal);
+ else
+ hRet = E_FAIL;
+ }
+ break;
+
+ case DBID_SHOWONLY:
+ case DBID_MAXIMIZEBAND:
+ case DBID_PUSHCHEVRON:
+ FIXME("IOleCommandTarget::Exec(): Unsupported command ID %d\n", nCmdID);
+ return E_NOTIMPL;
+ default:
+ return E_FAIL;
+ }
+ return S_OK;
+ }
+ else
+ WARN("IOleCommandTarget::Exec(): Unsupported command group GUID\n");
+
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::UIActivateIO(BOOL fActivate, LPMSG lpMsg)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::HasFocusIO()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::TranslateAcceleratorIO(LPMSG lpMsg)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::OnFocusChangeIS(struct IUnknown *paramC, int param10)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::GetClassID(CLSID *pClassID)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::IsDirty()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::Load(IStream *pStm)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::Save(IStream *pStm, BOOL fClearDirty)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::GetSizeMax(ULARGE_INTEGER *pcbSize)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::DragLeave()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::LoadFromStreamBS(IStream *, const GUID &, void **)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteBase::SaveToStreamBS(IUnknown *, IStream *)
+{
+ return E_NOTIMPL;
+}
--- /dev/null
+/*
+ * Rebar band site
+ *
+ * Copyright 2007 Hervé Poussineau
+ * Copyright 2009 Andrew Hill
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _bandsite_h
+#define _bandsite_h
+
+class CBandSiteBase :
+ public CComObjectRootEx<CComMultiThreadModelNoCS>,
+ public IBandSite,
+ public IWinEventHandler,
+ public IDeskBarClient,
+ public IOleCommandTarget,
+ public IInputObject,
+ public IInputObjectSite,
+ public IServiceProvider,
+ public IPersistStream,
+ public IDropTarget,
+ public IBandSiteHelper
+{
+private:
+ struct BandObject
+ {
+ IDeskBand *DeskBand;
+ IOleWindow *OleWindow;
+ IWinEventHandler *WndEvtHandler;
+ DESKBANDINFO dbi;
+ };
+
+ LONG fBandsCount;
+ LONG fBandsAllocated;
+ struct BandObject *fBands;
+ HWND fRebarWindow;
+ CComPtr<IOleWindow> fOleWindow;
+public:
+ CBandSiteBase();
+ ~CBandSiteBase();
+
+ // *** IBandSite methods ***
+ virtual HRESULT STDMETHODCALLTYPE AddBand(IUnknown *punk);
+ virtual HRESULT STDMETHODCALLTYPE EnumBands(UINT uBand, DWORD *pdwBandID);
+ virtual HRESULT STDMETHODCALLTYPE QueryBand(DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState, LPWSTR pszName, int cchName);
+ virtual HRESULT STDMETHODCALLTYPE SetBandState(DWORD dwBandID, DWORD dwMask, DWORD dwState);
+ virtual HRESULT STDMETHODCALLTYPE RemoveBand(DWORD dwBandID);
+ virtual HRESULT STDMETHODCALLTYPE GetBandObject(DWORD dwBandID, REFIID riid, void **ppv);
+ virtual HRESULT STDMETHODCALLTYPE SetBandSiteInfo(const BANDSITEINFO *pbsinfo);
+ virtual HRESULT STDMETHODCALLTYPE GetBandSiteInfo(BANDSITEINFO *pbsinfo);
+
+ // *** IWinEventHandler methods ***
+ virtual HRESULT STDMETHODCALLTYPE OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult);
+ virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND hWnd);
+
+ // *** IOleWindow methods ***
+ virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd);
+ virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode);
+
+ // *** IDeskBarClient methods ***
+ virtual HRESULT STDMETHODCALLTYPE SetDeskBarSite(IUnknown *punkSite);
+ virtual HRESULT STDMETHODCALLTYPE SetModeDBC(DWORD dwMode);
+ virtual HRESULT STDMETHODCALLTYPE UIActivateDBC(DWORD dwState);
+ virtual HRESULT STDMETHODCALLTYPE GetSize(DWORD dwWhich, LPRECT prc);
+
+ // *** IOleCommandTarget methods ***
+ virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText);
+ virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
+
+ // *** IInputObject methods ***
+ virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg);
+ virtual HRESULT STDMETHODCALLTYPE HasFocusIO();
+ virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg);
+
+ // *** IInputObjectSite methods ***
+ virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(struct IUnknown *paramC, int param10);
+
+ // *** IServiceProvider methods ***
+ virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
+
+ // *** IPersist methods ***
+ virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID);
+
+ // *** IPersistStream methods ***
+ virtual HRESULT STDMETHODCALLTYPE IsDirty();
+ virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm);
+ virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty);
+ virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize);
+
+ // *** IDropTarget methods ***
+ virtual HRESULT STDMETHODCALLTYPE DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
+ virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
+ virtual HRESULT STDMETHODCALLTYPE DragLeave();
+ virtual HRESULT STDMETHODCALLTYPE Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
+
+ // *** IBandSiteHelper methods ***
+ virtual HRESULT STDMETHODCALLTYPE LoadFromStreamBS(IStream *, const GUID &, void **);
+ virtual HRESULT STDMETHODCALLTYPE SaveToStreamBS(IUnknown *, IStream *);
+
+private:
+ UINT GetBandID(struct BandObject *Band);
+ struct BandObject *GetBandByID(DWORD dwBandID);
+ void FreeBand(struct BandObject *Band);
+ DWORD GetBandSiteViewMode();
+ VOID BuildRebarBandInfo(struct BandObject *Band, REBARBANDINFOW *prbi);
+ HRESULT UpdateSingleBand(struct BandObject *Band);
+ HRESULT UpdateAllBands();
+ HRESULT UpdateBand(DWORD dwBandID);
+ struct BandObject *GetBandFromHwnd(HWND hwnd);
+
+BEGIN_COM_MAP(CBandSiteBase)
+ COM_INTERFACE_ENTRY_IID(IID_IBandSite, IBandSite)
+ COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
+ COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
+ COM_INTERFACE_ENTRY_IID(IID_IDeskBarClient, IDeskBarClient)
+ COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
+ COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
+ COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite)
+ COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
+ COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
+ COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
+ COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
+ COM_INTERFACE_ENTRY_IID(IID_IBandSiteHelper, IBandSiteHelper)
+END_COM_MAP()
+};
+
+class CBandSite :
+ public CComCoClass<CBandSite, &CLSID_RebarBandSite>,
+ public CBandSiteBase
+{
+public:
+
+DECLARE_REGISTRY_RESOURCEID(IDR_BANDSITE)
+DECLARE_NOT_AGGREGATABLE(CBandSite)
+
+DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+};
+
+#endif // _bandsite_h
+++ /dev/null
-/*
- * Band site menu
- *
- * Copyright 2007 Hervé Poussineua
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#include "config.h"
-
-#define COBJMACROS
-
-#include "wine/debug.h"
-#include "windef.h"
-#include "winbase.h"
-#include "objbase.h"
-
-#include "shlobj.h"
-#include "shobjidl.h"
-#include "todo.h"
-
-#include "browseui.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(browseui);
-
-typedef struct _tagBandSiteMenu {
- const IShellServiceVtbl *vtbl;
- LONG refCount;
-} BandSiteMenu;
-
-static const IShellServiceVtbl BandSiteMenuVtbl;
-
-static inline BandSiteMenu *impl_from_IShellService(IShellService *iface)
-{
- return (BandSiteMenu *)((char *)iface - FIELD_OFFSET(BandSiteMenu, vtbl));
-}
-
-HRESULT WINAPI BandSiteMenu_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
-{
- BandSiteMenu *This;
-
- if (pUnkOuter)
- return CLASS_E_NOAGGREGATION;
-
- This = CoTaskMemAlloc(sizeof(BandSiteMenu));
- if (This == NULL)
- return E_OUTOFMEMORY;
- ZeroMemory(This, sizeof(*This));
- This->vtbl = &BandSiteMenuVtbl;
- This->refCount = 1;
-
- TRACE("returning %p\n", This);
- *ppOut = (IUnknown *)This;
- BROWSEUI_refCount++;
- return S_OK;
-}
-
-static void WINAPI BandSiteMenu_Destructor(BandSiteMenu *This)
-{
- TRACE("destroying %p\n", This);
- CoTaskMemFree(This);
- BROWSEUI_refCount--;
-}
-
-static HRESULT WINAPI BandSiteMenu_QueryInterface(IShellService *iface, REFIID iid, LPVOID *ppvOut)
-{
- BandSiteMenu *This = impl_from_IShellService(iface);
- *ppvOut = NULL;
-
- TRACE("(%p, %s, %p)\n", iface, debugstr_guid(iid), ppvOut);
-
- if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IShellService))
- {
- *ppvOut = &This->vtbl;
- }
-
- if (*ppvOut)
- {
- IUnknown_AddRef(iface);
- return S_OK;
- }
-
- WARN("unsupported interface: %s\n", debugstr_guid(iid));
- return E_NOINTERFACE;
-}
-
-static ULONG WINAPI BandSiteMenu_AddRef(IShellService *iface)
-{
- BandSiteMenu *This = impl_from_IShellService(iface);
- TRACE("(%p)\n", iface);
- return InterlockedIncrement(&This->refCount);
-}
-
-static ULONG WINAPI BandSiteMenu_Release(IShellService *iface)
-{
- BandSiteMenu *This = impl_from_IShellService(iface);
- ULONG ret;
-
- TRACE("(%p)\n", iface);
-
- ret = InterlockedDecrement(&This->refCount);
- if (ret == 0)
- BandSiteMenu_Destructor(This);
- return ret;
-}
-
-static HRESULT WINAPI BandSiteMenu_SetOwner(IShellService *iface, IUnknown *pOwner)
-{
- FIXME("(%p, %p)\n", iface, pOwner);
- return E_NOTIMPL;
-}
-
-static const IShellServiceVtbl BandSiteMenuVtbl =
-{
- BandSiteMenu_QueryInterface,
- BandSiteMenu_AddRef,
- BandSiteMenu_Release,
-
- BandSiteMenu_SetOwner,
-};
--- /dev/null
+/*
+ * Band site menu
+ *
+ * Copyright 2007 Hervé Poussineua
+ * Copyright 2009 Andrew Hill
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <windows.h>
+#include <shlobj.h>
+#include <shlobj_undoc.h>
+#include <shlguid.h>
+#include <shlguid_undoc.h>
+#include <tchar.h>
+#include <atlbase.h>
+#include <atlcom.h>
+#include <atlwin.h>
+#include "resource.h"
+#include "bandsitemenu.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(browseui);
+
+CBandSiteMenu::CBandSiteMenu()
+{
+}
+
+CBandSiteMenu::~CBandSiteMenu()
+{
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteMenu::SetOwner(IUnknown *pOwner)
+{
+ FIXME("(%p, %p)\n", this, pOwner);
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteMenu::QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
+{
+ FIXME("(%p, %p, %p, %p, %p, %p)\n", this, hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteMenu::InvokeCommand(LPCMINVOKECOMMANDINFO lpici)
+{
+ FIXME("(%p, %p)\n", this, lpici);
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteMenu::GetCommandString(UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax)
+{
+ FIXME("(%p, %p, %p, %p, %p, %p)\n", this, idCmd, uType, pwReserved, pszName, cchMax);
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBandSiteMenu::HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ FIXME("(%p, %p)\n", this, uMsg, wParam, lParam);
+ return E_NOTIMPL;
+}
--- /dev/null
+/*
+ * Band site menu
+ *
+ * Copyright 2007 Hervé Poussineua
+ * Copyright 2009 Andrew Hill
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef _bandsitemenu_h
+#define _bandsitemenu_h
+
+// oddly, this class also responds to QueryInterface for CLSID_BandSiteMenu by returning the vtable at offset 0
+class CBandSiteMenu :
+ public CComCoClass<CBandSiteMenu, &CLSID_BandSiteMenu>,
+ public CComObjectRootEx<CComMultiThreadModelNoCS>,
+ public IShellService,
+ public IContextMenu2
+{
+public:
+ CBandSiteMenu();
+ ~CBandSiteMenu();
+
+ // *** IShellService methods ***
+ virtual HRESULT STDMETHODCALLTYPE SetOwner(IUnknown *);
+
+ // *** IContextMenu methods ***
+ virtual HRESULT STDMETHODCALLTYPE QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags);
+ virtual HRESULT STDMETHODCALLTYPE InvokeCommand(LPCMINVOKECOMMANDINFO lpici);
+ virtual HRESULT STDMETHODCALLTYPE GetCommandString(UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax);
+
+ // *** IContextMenu2 methods ***
+ virtual HRESULT STDMETHODCALLTYPE HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam);
+
+DECLARE_REGISTRY_RESOURCEID(IDR_BANDSITEMENU)
+DECLARE_NOT_AGGREGATABLE(CBandSiteMenu)
+
+DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+BEGIN_COM_MAP(CBandSiteMenu)
+ COM_INTERFACE_ENTRY_IID(IID_IShellService, IShellService)
+ COM_INTERFACE_ENTRY_IID(IID_IContextMenu2, IContextMenu2)
+ COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
+END_COM_MAP()
+
+};
+
+#endif // _bandsitemenu_h
--- /dev/null
+/*
+ * ReactOS Explorer
+ *
+ * Copyright 2009 Andrew Hill <ash77 at domain reactos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+This class knows how to contain base bar site in a cabinet window.
+*/
+#include <windows.h>
+#include <shlobj.h>
+#include <shlobj_undoc.h>
+#include <shlguid.h>
+#include <shlguid_undoc.h>
+#include <tchar.h>
+#include <atlbase.h>
+#include <atlcom.h>
+#include <atlwin.h>
+
+/*
+Base bar that contains a vertical or horizontal explorer band. It also
+provides resizing abilities.
+*/
+/*
+TODO:
+ **Make base bar support resizing
+ Add context menu for base bar
+ Fix base bar to correctly initialize fVertical field
+ Fix base bar to correctly reposition its base bar site when resized
+
+*/
+
+class CBaseBar :
+ public CWindowImpl<CBaseBar, CWindow, CControlWinTraits>,
+ public CComObjectRootEx<CComMultiThreadModelNoCS>,
+ public IInputObjectSite,
+ public IOleCommandTarget,
+ public IServiceProvider,
+ public IInputObject,
+ public IDeskBar,
+ public IDockingWindow,
+ public IPersistStream,
+ public IPersistStreamInit,
+ public IPersistPropertyBag,
+ public IObjectWithSite
+{
+public:
+ CComPtr<IUnknown> fSite;
+ CComPtr<IUnknown> fClient;
+ HWND fClientWindow;
+ bool fVertical;
+ bool fVisible;
+ int fNeededSize; // width or height
+
+ // used by resize tracking loop
+ bool fTracking;
+ POINT fLastLocation;
+public:
+ CBaseBar();
+ ~CBaseBar();
+public:
+ HRESULT ReserveBorderSpace();
+
+ // *** IOleWindow methods ***
+ virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd);
+ virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode);
+
+ // *** IInputObjectSite specific methods ***
+ virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS (IUnknown *punkObj, BOOL fSetFocus);
+
+ // *** IOleCommandTarget specific methods ***
+ virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText);
+ virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
+
+ // *** IServiceProvider methods ***
+ virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
+
+ // *** IInputObject methods ***
+ // forward the methods to the contained active bar
+ virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg);
+ virtual HRESULT STDMETHODCALLTYPE HasFocusIO();
+ virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg);
+
+ // *** IDeskBar methods ***
+ virtual HRESULT STDMETHODCALLTYPE SetClient(IUnknown *punkClient);
+ virtual HRESULT STDMETHODCALLTYPE GetClient(IUnknown **ppunkClient);
+ virtual HRESULT STDMETHODCALLTYPE OnPosRectChangeDB(LPRECT prc);
+
+ // *** IDockingWindow methods ***
+ virtual HRESULT STDMETHODCALLTYPE ShowDW(BOOL fShow);
+ virtual HRESULT STDMETHODCALLTYPE CloseDW(DWORD dwReserved);
+ virtual HRESULT STDMETHODCALLTYPE ResizeBorderDW(LPCRECT prcBorder, IUnknown *punkToolbarSite, BOOL fReserved);
+
+ // *** IObjectWithSite methods ***
+ virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite);
+ virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, void **ppvSite);
+
+ // *** IPersist methods ***
+ virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID);
+
+ // *** IPersistStream methods ***
+ virtual HRESULT STDMETHODCALLTYPE IsDirty();
+ virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm);
+ virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty);
+ virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize);
+
+ // *** IPersistStreamInit methods ***
+ virtual HRESULT STDMETHODCALLTYPE InitNew();
+
+ // *** IPersistPropertyBag methods ***
+ virtual HRESULT STDMETHODCALLTYPE Load(IPropertyBag *pPropBag, IErrorLog *pErrorLog);
+ virtual HRESULT STDMETHODCALLTYPE Save(IPropertyBag *pPropBag, BOOL fClearDirty, BOOL fSaveAllProperties);
+
+ // message handlers
+ LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
+ LRESULT OnSetCursor(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
+ LRESULT OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
+ LRESULT OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
+ LRESULT OnLButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
+ LRESULT OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
+ LRESULT OnCancelMode(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
+ LRESULT OnCaptureChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
+
+DECLARE_WND_CLASS_EX(_T("BaseBar"), 0, COLOR_3DFACE)
+
+BEGIN_MSG_MAP(CBaseBar)
+ MESSAGE_HANDLER(WM_SIZE, OnSize)
+ MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor)
+ MESSAGE_HANDLER(WM_NOTIFY, OnNotify)
+ MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
+ MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp)
+ MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove)
+ MESSAGE_HANDLER(WM_CANCELMODE, OnCancelMode)
+ MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged)
+END_MSG_MAP()
+
+BEGIN_COM_MAP(CBaseBar)
+ COM_INTERFACE_ENTRY2_IID(IID_IOleWindow, IOleWindow, IDockingWindow)
+ COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite)
+ COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
+ COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
+ COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
+ COM_INTERFACE_ENTRY_IID(IID_IDeskBar, IDeskBar)
+ COM_INTERFACE_ENTRY_IID(IID_IDockingWindow, IDockingWindow)
+ COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
+ COM_INTERFACE_ENTRY2_IID(IID_IPersist, IPersist, IPersistStream)
+ COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
+ COM_INTERFACE_ENTRY_IID(IID_IPersistStreamInit, IPersistStreamInit)
+ COM_INTERFACE_ENTRY_IID(IID_IPersistPropertyBag, IPersistPropertyBag)
+END_COM_MAP()
+};
+
+CBaseBar::CBaseBar()
+{
+ fClientWindow = NULL;
+ fVertical = true;
+ fVisible = false;
+ fNeededSize = 200;
+ fTracking = false;
+}
+
+CBaseBar::~CBaseBar()
+{
+}
+
+HRESULT CBaseBar::ReserveBorderSpace()
+{
+ CComPtr<IDockingWindowSite> dockingWindowSite;
+ RECT availableBorderSpace;
+ RECT neededBorderSpace;
+ HRESULT hResult;
+
+ hResult = fSite->QueryInterface(IID_IDockingWindowSite, (void **)&dockingWindowSite);
+ if (FAILED(hResult))
+ return hResult;
+ hResult = dockingWindowSite->GetBorderDW((IDeskBar *)this, &availableBorderSpace);
+ if (FAILED(hResult))
+ return hResult;
+ memset(&neededBorderSpace, 0, sizeof(neededBorderSpace));
+ if (fVisible)
+ {
+ if (fVertical)
+ neededBorderSpace.left = fNeededSize + GetSystemMetrics(SM_CXFRAME);
+ else
+ neededBorderSpace.bottom = fNeededSize + GetSystemMetrics(SM_CXFRAME);
+ }
+ hResult = dockingWindowSite->SetBorderSpaceDW((IDeskBar *)this, &neededBorderSpace);
+ if (FAILED(hResult))
+ return hResult;
+ return S_OK;
+}
+
+// current bar size is stored in the registry under
+// key=HKCU\Software\Microsoft\Internet Explorer\Explorer Bars
+// value=current bar GUID
+// result is 8 bytes of binary data, 2 longs. First is the size, second is reserved and will always be 0
+/*HRESULT CBaseBar::StopCurrentBar()
+{
+ CComPtr<IOleCommandTarget> commandTarget;
+ HRESULT hResult;
+
+ if (fCurrentBar.p != NULL)
+ {
+ hResult = fCurrentBar->QueryInterface(IID_IOleCommandTarget, (void **)&commandTarget);
+ hResult = commandTarget->Exec(NULL, 0x17, 0, NULL, NULL);
+ }
+ // hide the current bar
+ memcpy(&fCurrentActiveClass, &GUID_NULL, sizeof(fCurrentActiveClass));
+ return S_OK;
+}*/
+
+HRESULT STDMETHODCALLTYPE CBaseBar::GetWindow(HWND *lphwnd)
+{
+ if (lphwnd == NULL)
+ return E_POINTER;
+ *lphwnd = m_hWnd;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBar::ContextSensitiveHelp(BOOL fEnterMode)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBar::OnFocusChangeIS (IUnknown *punkObj, BOOL fSetFocus)
+{
+ // forward to owner
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBar::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBar::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
+{
+ if (IsEqualIID(*pguidCmdGroup, CGID_Explorer))
+ {
+ }
+ else if (IsEqualIID(*pguidCmdGroup, IID_IDeskBarClient))
+ {
+ switch (nCmdID)
+ {
+ case 0:
+ // hide current band
+ break;
+ case 2:
+ break;
+ case 3:
+ break;
+ }
+ }
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBar::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
+{
+ CComPtr<IServiceProvider> serviceProvider;
+ HRESULT hResult;
+
+ if (fSite == NULL)
+ return E_FAIL;
+ hResult = fSite->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider);
+ if (FAILED(hResult))
+ return hResult;
+ // called for SID_STopLevelBrowser, IID_IBrowserService to find top level browser
+ // called for SID_IWebBrowserApp, IID_IConnectionPointContainer
+ // connection point called for DIID_DWebBrowserEvents2 to establish connection
+ return serviceProvider->QueryService(guidService, riid, ppvObject);
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBar::UIActivateIO(BOOL fActivate, LPMSG lpMsg)
+{
+ // forward to contained bar
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBar::HasFocusIO()
+{
+ // forward to contained bar
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBar::TranslateAcceleratorIO(LPMSG lpMsg)
+{
+ // forward to contained bar
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBar::SetClient(IUnknown *punkClient)
+{
+ CComPtr<IOleWindow> oleWindow;
+ HWND ownerWindow;
+ HRESULT hResult;
+
+ if (punkClient == NULL)
+ fClient.Release();
+ else
+ {
+ hResult = punkClient->QueryInterface(IID_IUnknown, (void **)&fClient);
+ if (FAILED(hResult))
+ return hResult;
+ hResult = fSite->QueryInterface(IID_IOleWindow, (void **)&oleWindow);
+ if (FAILED(hResult))
+ return hResult;
+ hResult = oleWindow->GetWindow(&ownerWindow);
+ if (FAILED(hResult))
+ return hResult;
+ Create(ownerWindow, 0, NULL, WS_VISIBLE | WS_CHILDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_EX_TOOLWINDOW);
+ ReserveBorderSpace();
+ }
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBar::GetClient(IUnknown **ppunkClient)
+{
+ if (ppunkClient == NULL)
+ return E_POINTER;
+ *ppunkClient = fClient;
+ if (fClient.p != NULL)
+ fClient.p->AddRef();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBar::OnPosRectChangeDB(LPRECT prc)
+{
+ if (prc == NULL)
+ return E_POINTER;
+ if (fVertical)
+ fNeededSize = prc->right - prc->left;
+ else
+ fNeededSize = prc->bottom - prc->top;
+ ReserveBorderSpace();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBar::ShowDW(BOOL fShow)
+{
+ fVisible = fShow ? true : false;
+ ReserveBorderSpace();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBar::CloseDW(DWORD dwReserved)
+{
+ fVisible = false;
+ ReserveBorderSpace();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBar::ResizeBorderDW(LPCRECT prcBorder, IUnknown *punkToolbarSite, BOOL fReserved)
+{
+ ReserveBorderSpace();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBar::SetSite(IUnknown *pUnkSite)
+{
+ fSite = pUnkSite;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBar::GetSite(REFIID riid, void **ppvSite)
+{
+ if (ppvSite == NULL)
+ return E_POINTER;
+ *ppvSite = fSite;
+ if (fSite.p != NULL)
+ fSite.p->AddRef();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBar::GetClassID(CLSID *pClassID)
+{
+ if (pClassID == NULL)
+ return E_POINTER;
+ // TODO: what class to return here?
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBar::IsDirty()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBar::Load(IStream *pStm)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBar::Save(IStream *pStm, BOOL fClearDirty)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBar::GetSizeMax(ULARGE_INTEGER *pcbSize)
+{
+ if (pcbSize == NULL)
+ return E_POINTER;
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBar::InitNew()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBar::Load(IPropertyBag *pPropBag, IErrorLog *pErrorLog)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBar::Save(IPropertyBag *pPropBag, BOOL fClearDirty, BOOL fSaveAllProperties)
+{
+ return E_NOTIMPL;
+}
+
+LRESULT CBaseBar::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
+{
+/* CComPtr<IOleWindow> oleWindow;
+ RECT clientRect;
+ HRESULT hResult;
+
+ if (fClientWindow == NULL && fClient.p != NULL)
+ {
+ hResult = fClient->QueryInterface(IID_IOleWindow, (void **)&oleWindow);
+ hResult = oleWindow->GetWindow(&fClientWindow);
+ }
+ if (fClientWindow != NULL)
+ {
+ GetClientRect(&clientRect);
+ ::SetWindowPos(fClientWindow, NULL, clientRect.left, clientRect.top, clientRect.right - clientRect.left - GetSystemMetrics(SM_CXFRAME),
+ clientRect.bottom - clientRect.top, SWP_NOOWNERZORDER | SWP_NOZORDER);
+ }*/
+ return 0;
+}
+
+LRESULT CBaseBar::OnSetCursor(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
+{
+ if ((short)lParam != HTCLIENT || (HWND)wParam != m_hWnd)
+ {
+ bHandled = FALSE;
+ return 0;
+ }
+ if (fVertical)
+ SetCursor(LoadCursor(NULL, IDC_SIZEWE));
+ else
+ SetCursor(LoadCursor(NULL, IDC_SIZENS));
+ return 1;
+}
+
+LRESULT CBaseBar::OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
+{
+ CComPtr<IWinEventHandler> winEventHandler;
+ LRESULT result;
+ HRESULT hResult;
+
+ result = 0;
+ if (fClient.p != NULL)
+ {
+ hResult = fClient->QueryInterface(IID_IWinEventHandler, (void **)&winEventHandler);
+ if (SUCCEEDED(hResult) && winEventHandler.p != NULL)
+ hResult = winEventHandler->OnWinEvent(NULL, uMsg, wParam, lParam, &result);
+ }
+ return result;
+}
+
+LRESULT CBaseBar::OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
+{
+ SetCapture();
+ fTracking = true;
+ fLastLocation.x = (short)LOWORD(lParam);
+ fLastLocation.y = (short)HIWORD(lParam);
+ return 0;
+}
+
+LRESULT CBaseBar::OnLButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
+{
+ ReleaseCapture();
+ fTracking = false;
+ return 0;
+}
+
+LRESULT CBaseBar::OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
+{
+ POINT newLocation;
+ int delta;
+
+ if (fTracking)
+ {
+ newLocation.x = (short)LOWORD(lParam);
+ newLocation.y = (short)HIWORD(lParam);
+ if (fVertical)
+ delta = newLocation.x - fLastLocation.x;
+ else
+ delta = newLocation.y - fLastLocation.y;
+
+
+ fLastLocation = newLocation;
+ }
+ return 0;
+}
+
+LRESULT CBaseBar::OnCancelMode(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
+{
+ fTracking = false;
+ return 0;
+}
+
+LRESULT CBaseBar::OnCaptureChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
+{
+ fTracking = false;
+ return 0;
+}
+
+HRESULT CreateBaseBar(REFIID riid, void **ppv)
+{
+ CComObject<CBaseBar> *theBaseBar;
+ HRESULT hResult;
+
+ if (ppv == NULL)
+ return E_POINTER;
+ *ppv = NULL;
+ ATLTRY (theBaseBar = new CComObject<CBaseBar>);
+ if (theBaseBar == NULL)
+ return E_OUTOFMEMORY;
+ hResult = theBaseBar->QueryInterface (riid, (void **)ppv);
+ if (FAILED (hResult))
+ {
+ delete theBaseBar;
+ return hResult;
+ }
+ return S_OK;
+}
--- /dev/null
+/*
+ * ReactOS Explorer
+ *
+ * Copyright 2009 Andrew Hill <ash77 at domain reactos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+Base bar that contains a vertical or horizontal explorer band. It also
+provides resizing abilities.
+*/
+#include <windows.h>
+#include <shlobj.h>
+#include <shlobj_undoc.h>
+#include <shlguid.h>
+#include <shlguid_undoc.h>
+#include <tchar.h>
+#include <atlbase.h>
+#include <atlcom.h>
+#include <atlwin.h>
+
+/*
+TODO:
+****Fix so an already created bar will be detected and just shown instead of added again
+****When a new bar is added, initiate a resize
+ **Add owner draw for base bar
+ **Make label text in base bar always draw in black
+ **Make base bar show close box
+ **Create close toolbar button
+ **Fix to delete all CBarInfo on deletion
+
+*/
+
+class CBaseBarSite :
+ public CWindowImpl<CBaseBarSite, CWindow, CControlWinTraits>,
+ public CComObjectRootEx<CComMultiThreadModelNoCS>,
+// public IDockingWindowSite,
+ public IInputObject,
+ public IServiceProvider,
+ public IWinEventHandler,
+ public IInputObjectSite,
+ public IDeskBarClient,
+ public IOleCommandTarget,
+ public IBandSite,
+// public IBandSiteHelper,
+// public IExplorerToolbar,
+ public IPersistStream
+{
+private:
+ class CBarInfo
+ {
+ public:
+ CComPtr<IUnknown> fTheBar;
+ CLSID fBarClass; // class of active bar
+ DWORD fBandID;
+
+ };
+ CBarInfo *fCurrentActiveBar; //
+// HWND fRebarWindow; // rebar for top of window
+ CComPtr<IUnknown> fDeskBarSite;
+ DWORD fNextBandID;
+public:
+ CBaseBarSite();
+ ~CBaseBarSite();
+private:
+ HRESULT InsertBar(IUnknown *newBar);
+
+ // *** IOleWindow methods ***
+ virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd);
+ virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode);
+
+ // *** IInputObject methods ***
+ virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg);
+ virtual HRESULT STDMETHODCALLTYPE HasFocusIO();
+ virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg);
+
+ // *** IServiceProvider methods ***
+ virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
+
+ // *** IWinEventHandler methods ***
+ virtual HRESULT STDMETHODCALLTYPE OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult);
+ virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND hWnd);
+
+ // *** IInputObjectSite specific methods ***
+ virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS (IUnknown *punkObj, BOOL fSetFocus);
+
+ // *** IDeskBarClient methods ***
+ virtual HRESULT STDMETHODCALLTYPE SetDeskBarSite(IUnknown *punkSite);
+ virtual HRESULT STDMETHODCALLTYPE SetModeDBC(DWORD dwMode);
+ virtual HRESULT STDMETHODCALLTYPE UIActivateDBC(DWORD dwState);
+ virtual HRESULT STDMETHODCALLTYPE GetSize(DWORD dwWhich, LPRECT prc);
+
+ // *** IOleCommandTarget methods ***
+ virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText);
+ virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
+
+ // *** IBandSite specific methods ***
+ virtual HRESULT STDMETHODCALLTYPE AddBand(IUnknown *punk);
+ virtual HRESULT STDMETHODCALLTYPE EnumBands(UINT uBand, DWORD *pdwBandID);
+ virtual HRESULT STDMETHODCALLTYPE QueryBand(DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState, LPWSTR pszName, int cchName);
+ virtual HRESULT STDMETHODCALLTYPE SetBandState(DWORD dwBandID, DWORD dwMask, DWORD dwState);
+ virtual HRESULT STDMETHODCALLTYPE RemoveBand(DWORD dwBandID);
+ virtual HRESULT STDMETHODCALLTYPE GetBandObject(DWORD dwBandID, REFIID riid, void **ppv);
+ virtual HRESULT STDMETHODCALLTYPE SetBandSiteInfo(const BANDSITEINFO *pbsinfo);
+ virtual HRESULT STDMETHODCALLTYPE GetBandSiteInfo(BANDSITEINFO *pbsinfo);
+
+ // *** IPersist methods ***
+ virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID);
+
+ // *** IPersistStream methods ***
+ virtual HRESULT STDMETHODCALLTYPE IsDirty();
+ virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm);
+ virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty);
+ virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize);
+
+ // message handlers
+ LRESULT OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
+
+BEGIN_MSG_MAP(CBaseBarSite)
+ MESSAGE_HANDLER(WM_NOTIFY, OnNotify)
+END_MSG_MAP()
+
+BEGIN_COM_MAP(CBaseBarSite)
+ COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
+// COM_INTERFACE_ENTRY_IID(IID_IDockingWindowSite, IDockingWindowSite)
+ COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
+ COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
+ COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
+ COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite)
+ COM_INTERFACE_ENTRY_IID(IID_IDeskBarClient, IDeskBarClient)
+ COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
+ COM_INTERFACE_ENTRY_IID(IID_IBandSite, IBandSite)
+// COM_INTERFACE_ENTRY_IID(IID_IBandSiteHelper, IBandSiteHelper)
+// COM_INTERFACE_ENTRY_IID(IID_IExplorerToolbar, IExplorerToolbar)
+ COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
+ COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
+END_COM_MAP()
+};
+
+CBaseBarSite::CBaseBarSite()
+{
+ fCurrentActiveBar = NULL;
+ fNextBandID = 1;
+}
+
+CBaseBarSite::~CBaseBarSite()
+{
+}
+
+HRESULT CBaseBarSite::InsertBar(IUnknown *newBar)
+{
+ CComPtr<IPersist> persist;
+ CComPtr<IObjectWithSite> site;
+ CComPtr<IOleWindow> oleWindow;
+ CComPtr<IDeskBand> deskBand;
+ CComPtr<IDockingWindow> dockingWindow;
+ CBarInfo *newInfo;
+ REBARBANDINFOW bandInfo;
+ DESKBANDINFO deskBandInfo;
+ DWORD thisBandID;
+ HRESULT hResult;
+
+ hResult = newBar->QueryInterface(IID_IPersist, (void **)&persist);
+ if (FAILED(hResult))
+ return hResult;
+ hResult = newBar->QueryInterface(IID_IObjectWithSite, (void **)&site);
+ if (FAILED(hResult))
+ return hResult;
+ hResult = newBar->QueryInterface(IID_IOleWindow, (void **)&oleWindow);
+ if (FAILED(hResult))
+ return hResult;
+ hResult = newBar->QueryInterface(IID_IDeskBand, (void **)&deskBand);
+ if (FAILED(hResult))
+ return hResult;
+ hResult = newBar->QueryInterface(IID_IDockingWindow, (void **)&dockingWindow);
+ if (FAILED(hResult))
+ return hResult;
+ hResult = site->SetSite((IOleWindow *)this);
+ if (FAILED(hResult))
+ return hResult;
+ newInfo = new CBarInfo;
+ if (newInfo == NULL)
+ return E_OUTOFMEMORY;
+ thisBandID = fNextBandID++;
+ newInfo->fTheBar = newBar;
+ newInfo->fBandID = thisBandID;
+ hResult = persist->GetClassID(&newInfo->fBarClass);
+ deskBandInfo.dwMask = DBIM_MINSIZE | DBIM_ACTUAL | DBIM_TITLE;
+ deskBandInfo.wszTitle[0] = 0;
+ hResult = deskBand->GetBandInfo(0, 0, &deskBandInfo);
+ memset(&bandInfo, 0, sizeof(bandInfo));
+ bandInfo.cbSize = sizeof(bandInfo);
+ bandInfo.fMask = RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE | RBBIM_TEXT | RBBIM_LPARAM | RBBIM_ID;
+ bandInfo.fStyle = RBBS_NOGRIPPER | RBBS_VARIABLEHEIGHT;
+ bandInfo.lpText = deskBandInfo.wszTitle;
+ hResult = oleWindow->GetWindow(&bandInfo.hwndChild);
+ bandInfo.cxMinChild = 200; //deskBandInfo.ptMinSize.x;
+ bandInfo.cyMinChild = 200; //deskBandInfo.ptMinSize.y;
+ bandInfo.cx = 0;
+ bandInfo.wID = thisBandID;
+ bandInfo.cyChild = -1; //deskBandInfo.ptActual.y;
+ bandInfo.cyMaxChild = 32000;
+ bandInfo.cyIntegral = 1;
+ bandInfo.cxIdeal = 0; //deskBandInfo.ptActual.x;
+ bandInfo.lParam = (LPARAM)newInfo;
+ SendMessage(RB_INSERTBANDW, -1, (LPARAM)&bandInfo);
+ hResult = dockingWindow->ShowDW(TRUE); // this call is what makes the tree fill with contents
+ if (FAILED(hResult))
+ return hResult;
+ // for now
+ fCurrentActiveBar = newInfo;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::GetWindow(HWND *lphwnd)
+{
+ if (lphwnd == NULL)
+ return E_POINTER;
+ *lphwnd = m_hWnd;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::ContextSensitiveHelp(BOOL fEnterMode)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::UIActivateIO(BOOL fActivate, LPMSG lpMsg)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::HasFocusIO()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::TranslateAcceleratorIO(LPMSG lpMsg)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
+{
+ CComPtr<IServiceProvider> serviceProvider;
+ HRESULT hResult;
+
+ if (fDeskBarSite == NULL)
+ return E_FAIL;
+ hResult = fDeskBarSite->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider);
+ if (FAILED(hResult))
+ return hResult;
+ // called for SID_STopLevelBrowser, IID_IBrowserService to find top level browser
+ // called for SID_IWebBrowserApp, IID_IConnectionPointContainer
+ // connection point called for DIID_DWebBrowserEvents2 to establish connection
+ return serviceProvider->QueryService(guidService, riid, ppvObject);
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
+{
+ CComPtr<IDeskBar> deskBar;
+ CComPtr<IWinEventHandler> winEventHandler;
+ NMHDR *notifyHeader;
+ RECT newBounds;
+ HRESULT hResult;
+
+ hResult = S_OK;
+ if (uMsg == WM_NOTIFY)
+ {
+ notifyHeader = (NMHDR *)lParam;
+ if (notifyHeader->hwndFrom == m_hWnd && notifyHeader->code == RBN_AUTOSIZE)
+ {
+ hResult = fDeskBarSite->QueryInterface(IID_IDeskBar, (void **)&deskBar);
+ GetClientRect(&newBounds);
+ hResult = deskBar->OnPosRectChangeDB(&newBounds);
+ }
+ }
+ if (fCurrentActiveBar != NULL)
+ {
+ hResult = fCurrentActiveBar->fTheBar->QueryInterface(IID_IWinEventHandler, (void **)&winEventHandler);
+ if (SUCCEEDED(hResult) && winEventHandler.p != NULL)
+ hResult = winEventHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, theResult);
+ }
+ return hResult;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::IsWindowOwner(HWND hWnd)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::OnFocusChangeIS (IUnknown *punkObj, BOOL fSetFocus)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::SetDeskBarSite(IUnknown *punkSite)
+{
+ CComPtr<IOleWindow> oleWindow;
+ HWND ownerWindow;
+ HRESULT hResult;
+
+ if (punkSite == NULL)
+ fDeskBarSite.Release();
+ else
+ {
+ hResult = punkSite->QueryInterface(IID_IOleWindow, (void **)&oleWindow);
+ if (FAILED(hResult))
+ return hResult;
+ hResult = punkSite->QueryInterface(IID_IUnknown, (void **)&fDeskBarSite);
+ if (FAILED(hResult))
+ return hResult;
+ hResult = oleWindow->GetWindow(&ownerWindow);
+ if (FAILED(hResult))
+ return hResult;
+ m_hWnd = CreateWindow(REBARCLASSNAMEW, _T(""), WS_VISIBLE | WS_CHILDWINDOW | WS_CLIPSIBLINGS |
+ WS_CLIPCHILDREN |
+ RBS_VARHEIGHT | RBS_REGISTERDROP | RBS_AUTOSIZE | RBS_VERTICALGRIPPER | RBS_DBLCLKTOGGLE |
+ CCS_LEFT | CCS_NODIVIDER | CCS_NOPARENTALIGN | CCS_NORESIZE, 0, 0, 0, 0, ownerWindow, NULL,
+ _AtlBaseModule.GetModuleInstance(), NULL);
+ SendMessage(RB_SETTEXTCOLOR, 0, CLR_DEFAULT);
+ SendMessage(RB_SETBKCOLOR, 0, CLR_DEFAULT);
+ }
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::SetModeDBC(DWORD dwMode)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::UIActivateDBC(DWORD dwState)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::GetSize(DWORD dwWhich, LPRECT prc)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
+{
+ if (IsEqualIID(*pguidCmdGroup, IID_IDeskBand))
+ {
+ switch (nCmdID)
+ {
+ case 1: // insert a new band
+ if (V_VT(pvaIn) != VT_UNKNOWN)
+ return E_INVALIDARG;
+ return InsertBar(V_UNKNOWN(pvaIn));
+ }
+ }
+ return E_FAIL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::AddBand(IUnknown *punk)
+{
+ return InsertBar(punk);
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::EnumBands(UINT uBand, DWORD *pdwBandID)
+{
+ if (uBand == 0xffffffff)
+ {
+ *pdwBandID = (DWORD)SendMessage(RB_GETBANDCOUNT, 0, 0);
+ return S_OK;
+ }
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::QueryBand(DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState, LPWSTR pszName, int cchName)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::SetBandState(DWORD dwBandID, DWORD dwMask, DWORD dwState)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::RemoveBand(DWORD dwBandID)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::GetBandObject(DWORD dwBandID, REFIID riid, void **ppv)
+{
+ if (ppv == NULL)
+ return E_POINTER;
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::SetBandSiteInfo(const BANDSITEINFO *pbsinfo)
+{
+ if (pbsinfo == NULL)
+ return E_POINTER;
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::GetBandSiteInfo(BANDSITEINFO *pbsinfo)
+{
+ if (pbsinfo == NULL)
+ return E_POINTER;
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::GetClassID(CLSID *pClassID)
+{
+ if (pClassID == NULL)
+ return E_POINTER;
+ // TODO: what class to return here?
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::IsDirty()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::Load(IStream *pStm)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::Save(IStream *pStm, BOOL fClearDirty)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBaseBarSite::GetSizeMax(ULARGE_INTEGER *pcbSize)
+{
+ if (pcbSize == NULL)
+ return E_POINTER;
+ return E_NOTIMPL;
+}
+
+LRESULT CBaseBarSite::OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
+{
+ NMHDR *notifyHeader;
+
+ notifyHeader = (NMHDR *)lParam;
+ if (notifyHeader->hwndFrom == m_hWnd)
+ {
+ }
+ return 0;
+}
+
+HRESULT CreateBaseBarSite(REFIID riid, void **ppv)
+{
+ CComObject<CBaseBarSite> *theBaseBarSite;
+ HRESULT hResult;
+
+ if (ppv == NULL)
+ return E_POINTER;
+ *ppv = NULL;
+ ATLTRY (theBaseBarSite = new CComObject<CBaseBarSite>);
+ if (theBaseBarSite == NULL)
+ return E_OUTOFMEMORY;
+ hResult = theBaseBarSite->QueryInterface (riid, (void **)ppv);
+ if (FAILED (hResult))
+ {
+ delete theBaseBarSite;
+ return hResult;
+ }
+ return S_OK;
+}
--- /dev/null
+/*
+ * ReactOS Explorer
+ *
+ * Copyright 2009 Andrew Hill <ash77 at domain reactos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+Implements the logo band of a cabinet window. Most remarkable feature is the
+animation.
+*/
+#include <windows.h>
+#include <shlobj.h>
+#include <shlobj_undoc.h>
+#include <shlguid.h>
+#include <shlguid_undoc.h>
+#include <tchar.h>
+#include <exdisp.h>
+#include <exdispid.h>
+#include <atlbase.h>
+#include <atlcom.h>
+#include <atlwin.h>
+#include "resource.h"
+#include "brandband.h"
+
+/*
+TODO:
+ Add Exec command handlers
+ Properly implement GetBandInfo
+ Fix SetSite to revoke brand band service when site is cleared
+*/
+
+inline void FillSolidRect(HDC dc, const RECT *bounds)
+{
+ ::ExtTextOut(dc, 0, 0, ETO_OPAQUE, bounds, NULL, 0, NULL);
+}
+
+inline void FillSolidRect(HDC dc, const RECT *bounds, COLORREF clr)
+{
+ ::SetBkColor(dc, clr);
+ ::ExtTextOut(dc, 0, 0, ETO_OPAQUE, bounds, NULL, 0, NULL);
+}
+
+long GetScreenDepth()
+{
+ HDC tempDC;
+ long depth;
+
+ tempDC = GetDC(NULL);
+ depth = GetDeviceCaps(tempDC, BITSPIXEL) * GetDeviceCaps(tempDC, PLANES);
+ ReleaseDC(NULL, tempDC);
+ return depth;
+}
+
+static const int gSmallImageSize = 22;
+static const int gMediumImageSize = 26;
+static const int gLargeImageSize = 38;
+
+static const int gTrueColorResourceBase = 240;
+static const int g256ColorResourceBase = 245;
+
+CBrandBand::CBrandBand()
+{
+ fProfferCookie = 0;
+ fCurrentFrame = 0;
+ fMaxFrameCount = 0;
+ fImageBitmap = NULL;
+ fAdviseCookie = 0;
+}
+
+CBrandBand::~CBrandBand()
+{
+ DeleteObject(fImageBitmap);
+}
+
+void CBrandBand::StartAnimation()
+{
+ fCurrentFrame = 0;
+ SetTimer(5678, 30, NULL);
+}
+
+void CBrandBand::StopAnimation()
+{
+ KillTimer(5678);
+ fCurrentFrame = 0;
+ Invalidate(FALSE);
+}
+
+void CBrandBand::SelectImage()
+{
+ int screenDepth;
+ RECT clientRect;
+ int clientWidth;
+ int clientHeight;
+ int clientSize;
+ HINSTANCE shell32Instance;
+ BITMAP bitmapInfo;
+ int resourceID;
+
+ screenDepth = GetScreenDepth();
+ GetClientRect(&clientRect);
+ clientWidth = clientRect.right - clientRect.left;
+ clientHeight = clientRect.bottom - clientRect.top;
+ clientSize = min(clientWidth, clientHeight);
+ if (screenDepth > 8)
+ resourceID = gTrueColorResourceBase;
+ else
+ resourceID = g256ColorResourceBase;
+ if (clientSize >= gLargeImageSize)
+ resourceID += 2;
+ else if (clientSize >= gMediumImageSize)
+ resourceID += 1;
+ shell32Instance = GetModuleHandle(L"shell32.dll");
+ fImageBitmap = LoadBitmap(shell32Instance, MAKEINTRESOURCE(resourceID));
+ GetObjectW(fImageBitmap, sizeof(bitmapInfo), &bitmapInfo);
+ fBitmapSize = bitmapInfo.bmWidth;
+ fMaxFrameCount = bitmapInfo.bmHeight / fBitmapSize;
+}
+
+HRESULT STDMETHODCALLTYPE CBrandBand::GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO* pdbi)
+{
+ if (pdbi->dwMask & DBIM_MINSIZE)
+ {
+ pdbi->ptMinSize.x = 38;
+ pdbi->ptMinSize.y = 22;
+ }
+ if (pdbi->dwMask & DBIM_MAXSIZE)
+ {
+ pdbi->ptMaxSize.x = 38;
+ pdbi->ptMaxSize.y = 38;
+ }
+ if (pdbi->dwMask & DBIM_INTEGRAL)
+ {
+ pdbi->ptIntegral.x = 38;
+ pdbi->ptIntegral.y = 38;
+ }
+ if (pdbi->dwMask & DBIM_ACTUAL)
+ {
+ pdbi->ptActual.x = 38;
+ pdbi->ptActual.y = 38;
+ }
+ if (pdbi->dwMask & DBIM_TITLE)
+ wcscpy(pdbi->wszTitle, L"");
+ if (pdbi->dwMask & DBIM_MODEFLAGS)
+ pdbi->dwModeFlags = DBIMF_UNDELETEABLE;
+ if (pdbi->dwMask & DBIM_BKCOLOR)
+ pdbi->crBkgnd = 0;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBrandBand::SetSite(IUnknown* pUnkSite)
+{
+ CComPtr<IBrowserService> browserService;
+ CComPtr<IOleWindow> oleWindow;
+ CComPtr<IServiceProvider> serviceProvider;
+ CComPtr<IProfferService> profferService;
+ HWND parentWindow;
+ HWND hwnd;
+ HRESULT hResult;
+
+ fSite.Release();
+ if (pUnkSite == NULL)
+ {
+ hResult = AtlUnadvise(fSite, DIID_DWebBrowserEvents, fAdviseCookie);
+ // TODO: revoke brand band service
+ return S_OK;
+ }
+ hResult = pUnkSite->QueryInterface(IID_IDockingWindowSite, (void **)&fSite);
+ if (FAILED(hResult))
+ return hResult;
+ parentWindow = NULL;
+ hResult = pUnkSite->QueryInterface(IID_IOleWindow, (void **)&oleWindow);
+ if (SUCCEEDED(hResult))
+ hResult = oleWindow->GetWindow(&parentWindow);
+ if (!::IsWindow(parentWindow))
+ return E_FAIL;
+
+ hwnd = SHCreateWorkerWindowW(0, parentWindow, 0, WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, NULL, 0);
+ if (hwnd == NULL)
+ return E_FAIL;
+ SubclassWindow(hwnd);
+ hResult = pUnkSite->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider);
+ if (SUCCEEDED(hResult))
+ {
+ hResult = serviceProvider->QueryService(SID_SBrandBand, IID_IProfferService, (void **)&profferService);
+ if (SUCCEEDED(hResult))
+ hResult = profferService->ProfferService(SID_SBrandBand, (IServiceProvider *)this, &fProfferCookie);
+ hResult = serviceProvider->QueryService(SID_SShellBrowser, IID_IBrowserService, (void **)&browserService);
+ if (SUCCEEDED(hResult))
+ hResult = AtlAdvise(browserService, (IDispatch *)this, DIID_DWebBrowserEvents, &fAdviseCookie);
+ }
+ // ignore any hResult errors up to here - they are nonfatal
+ hResult = S_OK;
+ SelectImage();
+ return hResult;
+}
+
+HRESULT STDMETHODCALLTYPE CBrandBand::GetSite(REFIID riid, void **ppvSite)
+{
+ if (ppvSite == NULL)
+ return E_POINTER;
+ if (fSite.p == NULL)
+ {
+ *ppvSite = NULL;
+ return E_FAIL;
+ }
+ return fSite.p->QueryInterface(riid, ppvSite);
+}
+
+HRESULT STDMETHODCALLTYPE CBrandBand::GetWindow(HWND *lphwnd)
+{
+ if (lphwnd == NULL)
+ return E_POINTER;
+ *lphwnd = m_hWnd;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBrandBand::ContextSensitiveHelp(BOOL fEnterMode)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBrandBand::CloseDW(DWORD dwReserved)
+{
+ ShowDW(FALSE);
+
+ if (IsWindow())
+ DestroyWindow();
+
+ m_hWnd = NULL;
+
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBrandBand::ResizeBorderDW(const RECT* prcBorder, IUnknown* punkToolbarSite, BOOL fReserved)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBrandBand::ShowDW(BOOL fShow)
+{
+ if (m_hWnd)
+ {
+ if (fShow)
+ ShowWindow(SW_SHOW);
+ else
+ ShowWindow(SW_HIDE);
+ }
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBrandBand::HasFocusIO()
+{
+ if (GetFocus() == m_hWnd)
+ return S_OK;
+ return S_FALSE;
+}
+
+HRESULT STDMETHODCALLTYPE CBrandBand::TranslateAcceleratorIO(LPMSG lpMsg)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBrandBand::UIActivateIO(BOOL fActivate, LPMSG lpMsg)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBrandBand::GetClassID(CLSID *pClassID)
+{
+ if (pClassID == NULL)
+ return E_POINTER;
+ *pClassID = CLSID_BrandBand;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CBrandBand::IsDirty()
+{
+ return S_FALSE;
+}
+
+HRESULT STDMETHODCALLTYPE CBrandBand::Load(IStream *pStm)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBrandBand::Save(IStream *pStm, BOOL fClearDirty)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBrandBand::GetSizeMax(ULARGE_INTEGER *pcbSize)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBrandBand::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBrandBand::IsWindowOwner(HWND hWnd)
+{
+ if (hWnd == m_hWnd)
+ return S_OK;
+ return S_FALSE;
+}
+
+HRESULT STDMETHODCALLTYPE CBrandBand::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBrandBand::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
+{
+ if (IsEqualIID(*pguidCmdGroup, CGID_PrivCITCommands))
+ {
+ }
+ else if (IsEqualIID(*pguidCmdGroup, CGID_BrandCmdGroup))
+ {
+ switch (nCmdID)
+ {
+ case BBID_STARTANIMATION:
+ StartAnimation();
+ return S_OK;
+ case BBID_STOPANIMATION:
+ StopAnimation();
+ return S_OK;
+ }
+ }
+ return E_FAIL;
+}
+
+HRESULT STDMETHODCALLTYPE CBrandBand::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
+{
+ CComPtr<IServiceProvider> serviceProvider;
+ HRESULT hResult;
+
+ if (IsEqualIID(guidService, SID_SBrandBand))
+ return this->QueryInterface(riid, ppvObject);
+ hResult = fSite->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider);
+ if (FAILED (hResult))
+ return hResult;
+ return serviceProvider->QueryService(guidService, riid, ppvObject);
+}
+
+HRESULT STDMETHODCALLTYPE CBrandBand::GetTypeInfoCount(UINT *pctinfo)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBrandBand::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBrandBand::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CBrandBand::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
+{
+ if (pDispParams == NULL)
+ return E_INVALIDARG;
+ switch (dispIdMember)
+ {
+ case DISPID_DOWNLOADCOMPLETE:
+ StopAnimation();
+ break;
+ case DISPID_DOWNLOADBEGIN:
+ StartAnimation();
+ break;
+ }
+ return E_INVALIDARG;
+}
+
+LRESULT CBrandBand::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
+{
+ Invalidate(FALSE);
+ return 0;
+}
+
+LRESULT CBrandBand::OnEraseBkgnd (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
+{
+ return 1;
+}
+
+LRESULT CBrandBand::OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
+{
+ PAINTSTRUCT paintInfo;
+ HDC dc;
+ POINT destinationPoint;
+ HDC sourceDC;
+ HBITMAP oldBitmap;
+ RECT clientRect;
+ RECT tempRect;
+
+ dc = BeginPaint(&paintInfo);
+ GetClientRect(&clientRect);
+
+ destinationPoint.x = (clientRect.right - clientRect.left - fBitmapSize) / 2;
+ destinationPoint.y = (clientRect.bottom - clientRect.top - fBitmapSize) / 2;
+
+ ::SetBkColor(dc, RGB(255, 255, 255));
+
+ tempRect.left = 0;
+ tempRect.top = 0;
+ tempRect.right = clientRect.right;
+ tempRect.bottom = destinationPoint.y;
+ FillSolidRect(dc, &tempRect, RGB(255, 255, 255));
+
+ tempRect.left = 0;
+ tempRect.top = destinationPoint.y + fBitmapSize;
+ tempRect.right = clientRect.right;
+ tempRect.bottom = clientRect.bottom;
+ FillSolidRect(dc, &paintInfo.rcPaint, RGB(255, 255, 255));
+
+ tempRect.left = 0;
+ tempRect.top = destinationPoint.y;
+ tempRect.right = destinationPoint.x;
+ tempRect.bottom = destinationPoint.y + fBitmapSize;
+ FillSolidRect(dc, &paintInfo.rcPaint, RGB(255, 255, 255));
+
+ tempRect.left = destinationPoint.x + fBitmapSize;
+ tempRect.top = destinationPoint.y;
+ tempRect.right = clientRect.right;
+ tempRect.bottom = destinationPoint.y + fBitmapSize;
+ FillSolidRect(dc, &paintInfo.rcPaint, RGB(255, 255, 255));
+
+ sourceDC = CreateCompatibleDC(dc);
+ oldBitmap = (HBITMAP)SelectObject(sourceDC, fImageBitmap);
+
+ BitBlt(dc, destinationPoint.x, destinationPoint.y, fBitmapSize, fBitmapSize, sourceDC, 0, fCurrentFrame * fBitmapSize, SRCCOPY);
+
+ SelectObject(sourceDC, oldBitmap);
+ DeleteDC(sourceDC);
+
+ EndPaint(&paintInfo);
+ return 0;
+}
+
+LRESULT CBrandBand::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
+{
+ fCurrentFrame++;
+ if (fCurrentFrame >= fMaxFrameCount)
+ fCurrentFrame = 0;
+ Invalidate(FALSE);
+ return 0;
+}
+
+HRESULT CreateBrandBand(REFIID riid, void **ppv)
+{
+ CComObject<CBrandBand> *theMenuBar;
+ HRESULT hResult;
+
+ if (ppv == NULL)
+ return E_POINTER;
+ *ppv = NULL;
+ ATLTRY (theMenuBar = new CComObject<CBrandBand>);
+ if (theMenuBar == NULL)
+ return E_OUTOFMEMORY;
+ hResult = theMenuBar->QueryInterface (riid, (void **)ppv);
+ if (FAILED (hResult))
+ {
+ delete theMenuBar;
+ return hResult;
+ }
+ return S_OK;
+}
--- /dev/null
+/*
+ * ReactOS Explorer
+ *
+ * Copyright 2009 Andrew Hill <ash77@reactos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _brandband_h
+#define _brandband_h
+
+class CBrandBand :
+ public CWindowImpl<CBrandBand, CWindow, CControlWinTraits>,
+ public CComCoClass<CBrandBand, &CLSID_BrandBand>,
+ public CComObjectRootEx<CComMultiThreadModelNoCS>,
+ public IDeskBand,
+ public IObjectWithSite,
+ public IInputObject,
+ public IPersistStream,
+ public IWinEventHandler,
+ public IOleCommandTarget,
+ public IServiceProvider,
+ public IDispatch
+{
+private:
+ CComPtr<IDockingWindowSite> fSite;
+ DWORD fProfferCookie;
+ int fCurrentFrame;
+ int fMaxFrameCount;
+ HBITMAP fImageBitmap;
+ int fBitmapSize;
+ DWORD fAdviseCookie;
+public:
+ CBrandBand();
+ ~CBrandBand();
+ void StartAnimation();
+ void StopAnimation();
+ void SelectImage();
+public:
+ // *** IDeskBand methods ***
+ virtual HRESULT STDMETHODCALLTYPE GetBandInfo(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO* pdbi);
+
+ // *** IObjectWithSite methods ***
+ virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown* pUnkSite);
+ virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, void **ppvSite);
+
+ // *** IOleWindow methods ***
+ virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd);
+ virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode);
+
+ // *** IDockingWindow methods ***
+ virtual HRESULT STDMETHODCALLTYPE CloseDW(DWORD dwReserved);
+ virtual HRESULT STDMETHODCALLTYPE ResizeBorderDW(const RECT* prcBorder, IUnknown* punkToolbarSite, BOOL fReserved);
+ virtual HRESULT STDMETHODCALLTYPE ShowDW(BOOL fShow);
+
+ // *** IInputObject methods ***
+ virtual HRESULT STDMETHODCALLTYPE HasFocusIO();
+ virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg);
+ virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg);
+
+ // *** IPersist methods ***
+ virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID);
+
+ // *** IPersistStream methods ***
+ virtual HRESULT STDMETHODCALLTYPE IsDirty();
+ virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm);
+ virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty);
+ virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize);
+
+ // *** IWinEventHandler methods ***
+ virtual HRESULT STDMETHODCALLTYPE OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult);
+ virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND hWnd);
+
+ // *** IOleCommandTarget methods ***
+ virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText);
+ virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
+
+ // *** IServiceProvider methods ***
+ virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
+
+ // *** IDispatch methods ***
+ virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo);
+ virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo);
+ virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId);
+ virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr);
+
+ // message handlers
+ LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
+ LRESULT OnEraseBkgnd(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
+ LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
+ LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
+
+BEGIN_MSG_MAP(CBrandBand)
+// MESSAGE_HANDLER(WM_SIZE, OnSize)
+ MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd)
+ MESSAGE_HANDLER(WM_PAINT, OnPaint)
+ MESSAGE_HANDLER(WM_TIMER, OnTimer)
+END_MSG_MAP()
+
+DECLARE_REGISTRY_RESOURCEID(IDR_BRANDBAND)
+DECLARE_NOT_AGGREGATABLE(CBrandBand)
+
+DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+BEGIN_COM_MAP(CBrandBand)
+ COM_INTERFACE_ENTRY_IID(IID_IDeskBand, IDeskBand)
+ COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
+ COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
+ COM_INTERFACE_ENTRY_IID(IID_IDockingWindow, IDockingWindow)
+ COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
+ COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist)
+ COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
+ COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
+ COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
+ COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
+ COM_INTERFACE_ENTRY_IID(IID_IDispatch, IDispatch)
+END_COM_MAP()
+};
+
+#endif // _brandband_h
--- /dev/null
+/*
+ * ReactOS Explorer
+ *
+ * Copyright 2009 Andrew Hill <ash77 at domain reactos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <windows.h>
+#include <shlobj.h>
+#include <shlobj_undoc.h>
+#include <shlguid.h>
+#include <shlguid_undoc.h>
+#include <shlwapi.h>
+#include <tchar.h>
+#include <atlbase.h>
+#include <atlcom.h>
+#include <atlwin.h>
+#include <wine/debug.h>
+#include "resource.h"
+#include "aclmulti.h"
+#include "addressband.h"
+#include "addresseditbox.h"
+#include "bandproxy.h"
+#include "bandsite.h"
+#include "bandsitemenu.h"
+#include "brandband.h"
+#include "internettoolbar.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(browseui);
+
+class CBrowseUIModule : public CComModule
+{
+public:
+};
+
+
+BEGIN_OBJECT_MAP(ObjectMap)
+OBJECT_ENTRY(CLSID_ACLMulti, CACLMulti)
+OBJECT_ENTRY(CLSID_SH_AddressBand, CAddressBand)
+OBJECT_ENTRY(CLSID_AddressEditBox, CAddressEditBox)
+OBJECT_ENTRY(CLSID_BandProxy, CBandProxy)
+OBJECT_ENTRY(CLSID_RebarBandSite, CBandSite)
+OBJECT_ENTRY(CLSID_BandSiteMenu, CBandSiteMenu)
+OBJECT_ENTRY(CLSID_BrandBand, CBrandBand)
+OBJECT_ENTRY(CLSID_InternetToolbar, CInternetToolbar)
+END_OBJECT_MAP()
+
+CBrowseUIModule gModule;
+CAtlWinModule gWinModule;
+
+/*************************************************************************
+ * BROWSEUI DllMain
+ */
+BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID fImpLoad)
+{
+ TRACE("%p 0x%x %p\n", hInstance, dwReason, fImpLoad);
+ if (dwReason == DLL_PROCESS_ATTACH)
+ {
+ gModule.Init(ObjectMap, hInstance, NULL);
+ DisableThreadLibraryCalls (hInstance);
+ }
+ else if (dwReason == DLL_PROCESS_DETACH)
+ {
+ gModule.Term();
+ }
+ return TRUE;
+}
+
+/***********************************************************************
+ * DllCanUnloadNow (BROWSEUI.@)
+ */
+STDAPI DllCanUnloadNow()
+{
+ return gModule.DllCanUnloadNow();
+}
+
+/***********************************************************************
+ * DllGetClassObject (BROWSEUI.@)
+ */
+STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
+{
+ return gModule.DllGetClassObject(rclsid, riid, ppv);
+}
+
+/***********************************************************************
+ * DllRegisterServer (BROWSEUI.@)
+ */
+STDAPI DllRegisterServer()
+{
+ return gModule.DllRegisterServer(FALSE);
+}
+
+/***********************************************************************
+ * DllUnregisterServer (BROWSEUI.@)
+ */
+STDAPI DllUnregisterServer()
+{
+ return gModule.DllUnregisterServer(FALSE);
+}
+
+/***********************************************************************
+ * DllGetVersion (BROWSEUI.@)
+ */
+HRESULT WINAPI DllGetVersion(DLLVERSIONINFO *info)
+{
+ if (info->cbSize != sizeof(DLLVERSIONINFO)) FIXME("support DLLVERSIONINFO2\n");
+
+ /* this is what IE6 on Windows 98 reports */
+ info->dwMajorVersion = 6;
+ info->dwMinorVersion = 0;
+ info->dwBuildNumber = 2600;
+ info->dwPlatformID = DLLVER_PLATFORM_WINDOWS;
+
+ return NOERROR;
+}
+++ /dev/null
-/*
- * Internal header for browseui.dll
- *
- * Copyright 2007 Mikolaj Zalewski
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#ifndef __WINE_BROWSEUI_H
-#define __WINE_BROWSEUI_H
-
-extern LONG BROWSEUI_refCount;
-
-HRESULT WINAPI ACLMulti_Constructor(IUnknown *punkOuter, IUnknown **ppOut);
-HRESULT WINAPI BandSite_Constructor(IUnknown *punkOuter, IUnknown **ppOut);
-HRESULT WINAPI BandSiteMenu_Constructor(IUnknown *punkOuter, IUnknown **ppOut);
-
-#endif /* __WINE_SHDOCVW_H */
<importlibrary definition="browseui.spec" />
<include base="browseui">.</include>
<include base="ReactOS">include/reactos/wine</include>
- <include base="explorer_new">.</include>
+ <include base="atlnew">.</include>
<define name="__WINESRC__" />
+ <define name="UNICODE" />
+ <define name="_UNICODE" />
+ <define name="ROS_Headers" />
<redefine name="_WIN32_WINNT">0x600</redefine>
<library>wine</library>
+ <library>shlwapi</library>
+ <library>shell32</library>
+ <library>comctl32</library>
+ <library>gdi32</library>
<library>ole32</library>
+ <library>oleaut32</library>
<library>user32</library>
<library>advapi32</library>
<library>kernel32</library>
<library>uuid</library>
<library>ntdll</library>
- <file>aclmulti.c</file>
- <file>bandsite.c</file>
- <file>bandsitemenu.c</file>
- <file>browseui_main.c</file>
- <file>regsvr.c</file>
- <file>version.rc</file>
+ <library>atlnew</library>
+ <library>msvcrt</library>
+ <file>aclmulti.cpp</file>
+ <file>addressband.cpp</file>
+ <file>addresseditbox.cpp</file>
+ <file>bandproxy.cpp</file>
+ <file>bandsite.cpp</file>
+ <file>bandsitemenu.cpp</file>
+ <file>basebar.cpp</file>
+ <file>basebarsite.cpp</file>
+ <file>brandband.cpp</file>
+ <file>browseui.cpp</file>
+ <file>browseuiord.cpp</file>
+ <file>commonbrowser.cpp</file>
+ <file>globalfoldersettings.cpp</file>
+ <file>internettoolbar.cpp</file>
+ <file>regtreeoptions.cpp</file>
+ <file>shellbrowser.cpp</file>
+ <file>toolsband.cpp</file>
+ <file>travellog.cpp</file>
+ <file>utility.cpp</file>
+ <file>browseui.rc</file>
</module>
--- /dev/null
+/*
+ * Top level resource file for browseui stuff
+ *
+ * Copyright 2009 Andrew Hill
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <windows.h>
+#include "shlobj.h"
+#include "resource.h"
+
+#include "version.rc"
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// REGISTRY
+//
+IDR_ADDRESSBAND REGISTRY "res\\addressband.rgs"
+IDR_ADDRESSEDITBOX REGISTRY "res\\addresseditbox.rgs"
+IDR_ACLMULTI REGISTRY "res\\autocompletecontainer.rgs"
+IDR_BANDPROXY REGISTRY "res\\bandproxy.rgs"
+IDR_BANDSITE REGISTRY "res\\rebarbandsite.rgs"
+IDR_BANDSITEMENU REGISTRY "res\\bandsitemenu.rgs"
+IDR_BRANDBAND REGISTRY "res\\brandband.rgs"
+IDR_COMMONBROWSER REGISTRY "res\\commonbrowser.rgs"
+IDR_GLOBALFOLDERSETTINGS REGISTRY "res\\globalfoldersettings.rgs"
+IDR_INTERNETTOOLBAR REGISTRY "res\\internettoolbar.rgs"
+IDR_REGTREEOPTIONS REGISTRY "res\\regtreeoptions.rgs"
+
+
+/*
+ * Everything specific to any language goes
+ * in one of the specific files.
+ */
+//#include "lang/bg-BG.rc"
+//#include "lang/ca-ES.rc"
+//#include "lang/cs-CZ.rc"
+//#include "lang/da-DK.rc"
+//#include "lang/de-DE.rc"
+//#include "lang/el-GR.rc"
+//#include "lang/en-GB.rc"
+#include "lang/en-US.rc"
+//#include "lang/es-ES.rc"
+//#include "lang/fi-FI.rc"
+//#include "lang/fr-FR.rc"
+//#include "lang/hu-HU.rc"
+//#include "lang/it-IT.rc"
+//#include "lang/ja-JP.rc"
+//#include "lang/ko-KR.rc"
+//#include "lang/nl-NL.rc"
+//#include "lang/no-NO.rc"
+//#include "lang/pl-PL.rc"
+//#include "lang/pt-BR.rc"
+//#include "lang/pt-PT.rc"
+//#include "lang/ro-RO.rc"
+//#include "lang/ru-RU.rc"
+//#include "lang/sl-SI.rc"
+//#include "lang/sk-SK.rc"
+//#include "lang/sv-SE.rc"
+//#include "lang/tr-TR.rc"
+//#include "lang/uk-UA.rc"
+//#include "lang/zh-CN.rc"
+//#include "lang/zh-TW.rc"
-@ stdcall -private DllCanUnloadNow()
-@ stdcall -private DllGetClassObject(ptr ptr ptr)
-@ stdcall -private DllGetVersion(ptr)
-@ stub DllInstall
-@ stdcall -private DllRegisterServer()
-@ stdcall -private DllUnregisterServer()
+@ stdcall -private DllCanUnloadNow()
+@ stdcall -private DllGetClassObject(ptr ptr ptr)
+@ stdcall -private DllGetVersion(ptr)
+@ stub DllInstall
+@ stdcall -private DllRegisterServer()
+@ stdcall -private DllUnregisterServer()
+101 stdcall -noname InitOCHostClass(long)
+102 stdcall -noname SHOpenFolderWindow(ptr)
+103 stdcall -noname SHOpenNewFrame(ptr ptr long long)
+105 stdcall -noname SHCreateSavedWindows()
+106 stdcall -noname SHCreateFromDesktop(long)
+107 stdcall -noname SHExplorerParseCmdLine(wstr)
+118 stdcall -noname UEMRegisterNotify(long long)
+120 stdcall -noname SHCreateBandForPidl(ptr ptr long)
+121 stdcall -noname SHPidlFromDataObject(ptr ptr long ptr)
+122 stdcall -noname IDataObject_GetDeskBandState(long)
+123 stdcall -noname SHCreateIETHREADPARAM(long long ptr ptr)
+124 stdcall -noname SHCloneIETHREADPARAM(ptr)
+125 stdcall -noname SHParseIECommandLine(long long)
+126 stdcall -noname SHDestroyIETHREADPARAM(ptr)
+127 stdcall -noname SHOnCWMCommandLine(long)
+128 stdcall -noname Channel_GetFolderPidl()
+129 stdcall -noname ChannelBand_Create(ptr)
+130 stdcall -noname Channels_SetBandInfoSFB(ptr)
+131 stdcall -noname IUnknown_SetBandInfoSFB(ptr long)
+133 stdcall -noname Channel_QuickLaunch()
+134 stdcall -noname SHGetNavigateTarget(long long long long)
+135 stdcall -noname GetInfoTip(ptr long wstr long)
+136 stdcall -noname SHEnumClassesOfCategories(long long long long long)
+137 stdcall -noname SHWriteClassesOfCategories(long long long long long long long)
+138 stdcall -noname SHIsExplorerBrowser()
+++ /dev/null
-/*
- * browseui - Internet Explorer / Windows Explorer standard UI
- *
- * Copyright 2001 John R. Sheets (for CodeWeavers)
- * Copyright 2004 Mike McCormack (for CodeWeavers)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#include "config.h"
-
-#include <stdarg.h>
-#include <stdio.h>
-
-#define COBJMACROS
-
-#include "wine/debug.h"
-#include "windef.h"
-#include "winbase.h"
-#include "winreg.h"
-#include "shlwapi.h"
-#include "shlguid.h"
-
-#include "browseui.h"
-#include "shobjidl.h" /* for IShellFolder used in undoc.h */
-#include "initguid.h"
-#include "undoc.h" /* for CLSID_RebarBandSite */
-
-WINE_DEFAULT_DEBUG_CHANNEL(browseui);
-
-LONG BROWSEUI_refCount = 0;
-
-HINSTANCE browseui_hinstance = 0;
-
-typedef HRESULT (WINAPI *LPFNCONSTRUCTOR)(IUnknown *pUnkOuter, IUnknown **ppvOut);
-
-/* undoc GUID */
-DEFINE_GUID(CLSID_RebarBandSite, 0xECD4FC4D, 0x521C, 0x11D0, 0xB7, 0x92, 0x00, 0xA0, 0xC9, 0x03, 0x12, 0xE1);
-
-
-static const struct {
- REFCLSID clsid;
- LPFNCONSTRUCTOR ctor;
-} ClassesTable[] = {
- {&CLSID_ACLMulti, ACLMulti_Constructor},
- {&CLSID_RebarBandSite, BandSite_Constructor},
- {&CLSID_IShellBandSiteMenu, BandSiteMenu_Constructor},
- {NULL, NULL}
-};
-
-typedef struct tagClassFactory
-{
- const IClassFactoryVtbl *vtbl;
- LONG ref;
- LPFNCONSTRUCTOR ctor;
-} ClassFactory;
-static const IClassFactoryVtbl ClassFactoryVtbl;
-
-static HRESULT ClassFactory_Constructor(LPFNCONSTRUCTOR ctor, LPVOID *ppvOut)
-{
- ClassFactory *This = CoTaskMemAlloc(sizeof(ClassFactory));
- This->vtbl = &ClassFactoryVtbl;
- This->ref = 1;
- This->ctor = ctor;
- *ppvOut = (LPVOID)This;
- TRACE("Created class factory %p\n", This);
- BROWSEUI_refCount++;
- return S_OK;
-}
-
-static void ClassFactory_Destructor(ClassFactory *This)
-{
- TRACE("Destroying class factory %p\n", This);
- CoTaskMemFree(This);
- BROWSEUI_refCount--;
-}
-
-static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, LPVOID *ppvOut)
-{
- *ppvOut = NULL;
- if (IsEqualIID(riid, &IID_IClassFactory) || IsEqualIID(riid, &IID_IUnknown)) {
- IClassFactory_AddRef(iface);
- *ppvOut = iface;
- return S_OK;
- }
-
- WARN("Unknown interface %s\n", debugstr_guid(riid));
- return E_NOINTERFACE;
-}
-
-static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
-{
- ClassFactory *This = (ClassFactory *)iface;
- return InterlockedIncrement(&This->ref);
-}
-
-static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
-{
- ClassFactory *This = (ClassFactory *)iface;
- ULONG ret = InterlockedDecrement(&This->ref);
-
- if (ret == 0)
- ClassFactory_Destructor(This);
- return ret;
-}
-
-static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *punkOuter, REFIID iid, LPVOID *ppvOut)
-{
- ClassFactory *This = (ClassFactory *)iface;
- HRESULT ret;
- IUnknown *obj;
-
- TRACE("(%p, %p, %s, %p)\n", iface, punkOuter, debugstr_guid(iid), ppvOut);
- ret = This->ctor(punkOuter, &obj);
- if (FAILED(ret))
- return ret;
- ret = IUnknown_QueryInterface(obj, iid, ppvOut);
- IUnknown_Release(obj);
- return ret;
-}
-
-static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
-{
- ClassFactory *This = (ClassFactory *)iface;
-
- TRACE("(%p)->(%x)\n", This, fLock);
-
- if(fLock)
- InterlockedIncrement(&BROWSEUI_refCount);
- else
- InterlockedDecrement(&BROWSEUI_refCount);
-
- return S_OK;
-}
-
-static const IClassFactoryVtbl ClassFactoryVtbl = {
- /* IUnknown */
- ClassFactory_QueryInterface,
- ClassFactory_AddRef,
- ClassFactory_Release,
-
- /* IClassFactory*/
- ClassFactory_CreateInstance,
- ClassFactory_LockServer
-};
-
-/*************************************************************************
- * BROWSEUI DllMain
- */
-BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID fImpLoad)
-{
- TRACE("%p 0x%x %p\n", hinst, fdwReason, fImpLoad);
- switch (fdwReason)
- {
- case DLL_WINE_PREATTACH:
- return FALSE; /* prefer native version */
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(hinst);
- browseui_hinstance = hinst;
- break;
- }
- return TRUE;
-}
-
-/*************************************************************************
- * DllCanUnloadNow (BROWSEUI.@)
- */
-HRESULT WINAPI DllCanUnloadNow(void)
-{
- return BROWSEUI_refCount ? S_FALSE : S_OK;
-}
-
-/***********************************************************************
- * DllGetVersion (BROWSEUI.@)
- */
-HRESULT WINAPI DllGetVersion(DLLVERSIONINFO *info)
-{
- if (info->cbSize != sizeof(DLLVERSIONINFO)) FIXME("support DLLVERSIONINFO2\n");
-
- /* this is what IE6 on Windows 98 reports */
- info->dwMajorVersion = 6;
- info->dwMinorVersion = 0;
- info->dwBuildNumber = 2600;
- info->dwPlatformID = DLLVER_PLATFORM_WINDOWS;
-
- return NOERROR;
-}
-
-/***********************************************************************
- * DllGetClassObject (BROWSEUI.@)
- */
-HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, LPVOID *ppvOut)
-{
- int i;
-
- *ppvOut = NULL;
- if (!IsEqualIID(iid, &IID_IUnknown) && !IsEqualIID(iid, &IID_IClassFactory))
- return E_NOINTERFACE;
-
- for (i = 0; ClassesTable[i].clsid != NULL; i++)
- if (IsEqualCLSID(ClassesTable[i].clsid, clsid)) {
- return ClassFactory_Constructor(ClassesTable[i].ctor, ppvOut);
- }
- FIXME("CLSID %s not supported\n", debugstr_guid(clsid));
- return CLASS_E_CLASSNOTAVAILABLE;
-}
--- /dev/null
+/*
+ * ReactOS browseui
+ *
+ * Copyright 2009 Andrew Hill <ash77 at domain reactos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <windows.h>
+#include <shlobj.h>
+#include <shlobj_undoc.h>
+#include <shlguid.h>
+#include <shlguid_undoc.h>
+#include <shlwapi_undoc.h>
+
+extern DWORD WINAPI BrowserThreadProc(LPVOID lpThreadParameter);
+
+/*************************************************************************
+ * InitOCHostClass [BROWSEUI.101]
+ */
+extern "C" void WINAPI InitOCHostClass(long param8)
+{
+ // forwards to shdocvw
+}
+
+/*************************************************************************
+ * SHOpenFolderWindow [BROWSEUI.102]
+ */
+extern "C" long WINAPI SHOpenFolderWindow(IEThreadParamBlock *param8)
+{
+ return 0;
+}
+
+/*************************************************************************
+ * SHCreateSavedWindows [BROWSEUI.105]
+ * Called to recreate explorer windows from previous session
+ */
+extern "C" void WINAPI SHCreateSavedWindows()
+{
+}
+
+/*************************************************************************
+ * SHCreateFromDesktop [BROWSEUI.106]
+ * parameter is a FolderInfo
+ */
+extern "C" long WINAPI SHCreateFromDesktop(long param8)
+{
+ return -1;
+}
+
+/*************************************************************************
+ * SHExplorerParseCmdLine [BROWSEUI.107]
+ */
+extern "C" long WINAPI SHExplorerParseCmdLine(LPCTSTR commandLine)
+{
+ return -1;
+}
+
+/*************************************************************************
+ * UEMRegisterNotify [BROWSEUI.118]
+ */
+extern "C" void WINAPI UEMRegisterNotify(long param8, long paramC)
+{
+}
+
+/*************************************************************************
+ * SHCreateBandForPidl [BROWSEUI.120]
+ */
+extern "C" HRESULT WINAPI SHCreateBandForPidl(LPCITEMIDLIST param8, IUnknown *paramC, BOOL param10)
+{
+ return E_NOTIMPL;
+}
+
+/*************************************************************************
+ * SHPidlFromDataObject [BROWSEUI.121]
+ */
+extern "C" HRESULT WINAPI SHPidlFromDataObject(IDataObject *param8, long *paramC, long param10, FILEDESCRIPTORW *param14)
+{
+ return E_NOTIMPL;
+}
+
+/*************************************************************************
+ * IDataObject_GetDeskBandState [BROWSEUI.122]
+ */
+extern "C" long WINAPI IDataObject_GetDeskBandState(long param8)
+{
+ return -1;
+}
+
+/*************************************************************************
+ * SHCreateIETHREADPARAM [BROWSEUI.123]
+ */
+extern "C" IEThreadParamBlock *WINAPI SHCreateIETHREADPARAM(long param8, long paramC, IUnknown *param10, IUnknown *param14)
+{
+ IEThreadParamBlock *result;
+
+ result = (IEThreadParamBlock *)LocalAlloc(LMEM_ZEROINIT, 256);
+ if (result == NULL)
+ return NULL;
+ result->offset0 = param8;
+ result->offset8 = paramC;
+ result->offsetC = param10;
+ if (param10 != NULL)
+ param10->AddRef();
+ result->offset14 = param14;
+ if (param14 != NULL)
+ param14->AddRef();
+ return result;
+}
+
+/*************************************************************************
+ * SHCloneIETHREADPARAM [BROWSEUI.124]
+ */
+extern "C" IEThreadParamBlock *WINAPI SHCloneIETHREADPARAM(IEThreadParamBlock *param)
+{
+ IEThreadParamBlock *result;
+
+ result = (IEThreadParamBlock *)LocalAlloc(LMEM_FIXED, 256);
+ if (result == NULL)
+ return NULL;
+ memcpy(result, param, 0x40 * 4);
+ if (result->directoryPIDL != NULL)
+ result->directoryPIDL = ILClone(result->directoryPIDL);
+ if (result->offset7C != NULL)
+ result->offset7C = ILClone(result->offset7C);
+ if (result->offset80 != NULL)
+ result->offset80 = ILClone(result->offset80);
+ if (result->offset70 != NULL)
+ result->offset70->AddRef();
+#if 0
+ if (result->offsetC != NULL)
+ result->offsetC->Method2C();
+#endif
+ return result;
+}
+
+/*************************************************************************
+ * SHParseIECommandLine [BROWSEUI.125]
+ */
+extern "C" long WINAPI SHParseIECommandLine(long param8, long paramC)
+{
+ return -1;
+}
+
+/*************************************************************************
+ * SHDestroyIETHREADPARAM [BROWSEUI.126]
+ */
+extern "C" void WINAPI SHDestroyIETHREADPARAM(IEThreadParamBlock *param)
+{
+ if (param == NULL)
+ return;
+ if (param->directoryPIDL != NULL)
+ ILFree(param->directoryPIDL);
+ if (param->offset7C != NULL)
+ ILFree(param->offset7C);
+ if ((param->offset4 & 0x80000) == 0 && param->offset80 != NULL)
+ ILFree(param->offset80);
+ if (param->offset14 != NULL)
+ param->offset14->Release();
+ if (param->offset70 != NULL)
+ param->offset70->Release();
+ if (param->offset78 != NULL)
+ param->offset78->Release();
+ if (param->offsetC != NULL)
+ param->offsetC->Release();
+ if (param->offsetF8 != NULL)
+ param->offsetF8->Release();
+ LocalFree(param);
+}
+
+/*************************************************************************
+ * SHOnCWMCommandLine [BROWSEUI.127]
+ */
+extern "C" HRESULT WINAPI SHOnCWMCommandLine(long param8)
+{
+ return E_NOTIMPL;
+}
+
+/*************************************************************************
+ * Channel_GetFolderPidl [BROWSEUI.128]
+ */
+extern "C" LPITEMIDLIST WINAPI Channel_GetFolderPidl()
+{
+ return NULL;
+}
+
+/*************************************************************************
+ * ChannelBand_Create [BROWSEUI.129]
+ */
+extern "C" IUnknown *WINAPI ChannelBand_Create(LPITEMIDLIST pidl)
+{
+ return NULL;
+}
+
+/*************************************************************************
+ * Channels_SetBandInfoSFB [BROWSEUI.130]
+ */
+extern "C" HRESULT WINAPI Channels_SetBandInfoSFB(IUnknown *param8)
+{
+ return E_NOTIMPL;
+}
+
+/*************************************************************************
+ * IUnknown_SetBandInfoSFB [BROWSEUI.131]
+ */
+extern "C" HRESULT WINAPI IUnknown_SetBandInfoSFB(IUnknown *param8, long paramC)
+{
+ return E_NOTIMPL;
+}
+
+/*************************************************************************
+ * Channel_QuickLaunch [BROWSEUI.133]
+ */
+extern "C" HRESULT WINAPI Channel_QuickLaunch()
+{
+ return E_NOTIMPL;
+}
+
+/*************************************************************************
+ * SHGetNavigateTarget [BROWSEUI.134]
+ */
+extern "C" HRESULT WINAPI SHGetNavigateTarget(long param8, long paramC, long param10, long param14)
+{
+ return E_NOTIMPL;
+}
+
+/*************************************************************************
+ * GetInfoTip [BROWSEUI.135]
+ */
+extern "C" HRESULT WINAPI GetInfoTip(IUnknown *param8, long paramC, LPTSTR *param10, long cchMax)
+{
+ return E_NOTIMPL;
+}
+
+/*************************************************************************
+ * SHEnumClassesOfCategories [BROWSEUI.136]
+ */
+extern "C" HRESULT WINAPI SHEnumClassesOfCategories(long param8, long paramC, long param10, long param14, long param18)
+{
+ return E_NOTIMPL;
+}
+
+/*************************************************************************
+ * SHWriteClassesOfCategories [BROWSEUI.137]
+ */
+extern "C" HRESULT WINAPI SHWriteClassesOfCategories(long param8, long paramC, long param10, long param14, long param18, long param1C, long param20)
+{
+ return E_NOTIMPL;
+}
+
+/*************************************************************************
+ * SHIsExplorerBrowser [BROWSEUI.138]
+ */
+extern "C" BOOL WINAPI SHIsExplorerBrowser()
+{
+ return TRUE;
+}
+
+// 75FA56C1h
+// (pidl, 0, -1, 1)
+// this function should handle creating a new process if needed, but I'm leaving that out for now
+// this function always opens a new window - it does NOT check for duplicates
+/*************************************************************************
+ * SHOpenNewFrame [BROWSEUI.103]
+ */
+extern "C" HRESULT WINAPI SHOpenNewFrame(LPITEMIDLIST pidl, IUnknown *paramC, long param10, long param14)
+{
+ IEThreadParamBlock *parameters;
+ HANDLE threadHandle;
+ DWORD threadID;
+
+ parameters = SHCreateIETHREADPARAM(0, 1, paramC, NULL);
+ if (parameters == NULL)
+ {
+ ILFree(pidl);
+ return E_OUTOFMEMORY;
+ }
+ if (paramC != NULL)
+ parameters->offset10 = param10;
+ parameters->directoryPIDL = pidl;
+ parameters->offset4 = param14;
+ threadHandle = CreateThread(NULL, 0x10000, BrowserThreadProc, parameters, 0, &threadID);
+ if (threadHandle != NULL)
+ {
+ CloseHandle(threadHandle);
+ return S_OK;
+ }
+ SHDestroyIETHREADPARAM(parameters);
+ return E_FAIL;
+}
--- /dev/null
+/*
+ * ReactOS Explorer
+ *
+ * Copyright 2009 Andrew Hill <ash77 at domain reactos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <windows.h>
+#include <shlobj.h>
+#include <shlobj_undoc.h>
+#include <shlguid.h>
+#include <shlguid_undoc.h>
+#include <tchar.h>
+#include <exdisp.h>
+#include <exdispid.h>
+#include <atlbase.h>
+#include <atlcom.h>
+#include <atlwin.h>
+#include "resource.h"
+#include "commonbrowser.h"
+
+CCommonBrowser::CCommonBrowser()
+{
+}
+
+CCommonBrowser::~CCommonBrowser()
+{
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::GetParentSite(IOleInPlaceSite **ppipsite)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::SetTitle(IShellView *psv, LPCWSTR pszName)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::GetTitle(IShellView *psv, LPWSTR pszName, DWORD cchName)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::GetOleObject(IOleObject **ppobjv)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::GetTravelLog(ITravelLog **pptl)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::ShowControlWindow(UINT id, BOOL fShow)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::IsControlWindowShown(UINT id, BOOL *pfShown)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::IEGetDisplayName(LPCITEMIDLIST pidl, LPWSTR pwszName, UINT uFlags)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::IEParseDisplayName(UINT uiCP, LPCWSTR pwszPath, LPCITEMIDLIST *ppidlOut)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::DisplayParseError(HRESULT hres, LPCWSTR pwszPath)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::NavigateToPidl(LPCITEMIDLIST pidl, DWORD grfHLNF)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::SetNavigateState(BNSTATE bnstate)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::GetNavigateState(BNSTATE *pbnstate)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::NotifyRedirect(IShellView *psv, LPCITEMIDLIST pidl, BOOL *pfDidBrowse)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::UpdateWindowList()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::UpdateBackForwardState()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::SetFlags(DWORD dwFlags, DWORD dwFlagMask)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::GetFlags(DWORD *pdwFlags)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::CanNavigateNow( void)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::GetPidl(LPCITEMIDLIST *ppidl)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::SetReferrer(LPCITEMIDLIST pidl)
+{
+ return E_NOTIMPL;
+}
+
+DWORD STDMETHODCALLTYPE CCommonBrowser::GetBrowserIndex()
+{
+ return 0;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::GetBrowserByIndex(DWORD dwID, IUnknown **ppunk)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::GetHistoryObject(IOleObject **ppole, IStream **pstm, IBindCtx **ppbc)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::SetHistoryObject(IOleObject *pole, BOOL fIsLocalAnchor)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::CacheOLEServer(IOleObject *pole)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::GetSetCodePage(VARIANT *pvarIn, VARIANT *pvarOut)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::OnHttpEquiv(IShellView *psv, BOOL fDone, VARIANT *pvarargIn, VARIANT *pvarargOut)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::GetPalette(HPALETTE *hpal)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::RegisterWindow(BOOL fForceRegister, int swc)
+{
+ return E_NOTIMPL;
+}
+
+LRESULT STDMETHODCALLTYPE CCommonBrowser::WndProcBS(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ return 0;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::SetAsDefFolderSettings()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::GetViewRect(RECT *prc)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::OnSize(WPARAM wParam)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::OnCreate(struct tagCREATESTRUCTW *pcs)
+{
+ return E_NOTIMPL;
+}
+
+LRESULT STDMETHODCALLTYPE CCommonBrowser::OnCommand(WPARAM wParam, LPARAM lParam)
+{
+ return 0;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::OnDestroy()
+{
+ return E_NOTIMPL;
+}
+
+LRESULT STDMETHODCALLTYPE CCommonBrowser::OnNotify(struct tagNMHDR *pnm)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::OnSetFocus()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::OnFrameWindowActivateBS(BOOL fActive)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::ReleaseShellView()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::ActivatePendingView()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::CreateViewWindow(IShellView *psvNew, IShellView *psvOld, LPRECT prcView, HWND *phwnd)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::CreateBrowserPropSheetExt(REFIID riid, void **ppv)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::GetViewWindow(HWND *phwndView)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::GetBaseBrowserData(LPCBASEBROWSERDATA *pbbd)
+{
+ return E_NOTIMPL;
+}
+
+LPBASEBROWSERDATA CCommonBrowser::PutBaseBrowserData()
+{
+ return NULL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::InitializeTravelLog(ITravelLog *ptl, DWORD dw)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::SetTopBrowser()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::Offline(int iCmd)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::AllowViewResize(BOOL f)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::SetActivateState(UINT u)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::UpdateSecureLockIcon(int eSecureLock)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::InitializeDownloadManager()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::InitializeTransitionSite()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::_Initialize(HWND hwnd, IUnknown *pauto)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::_CancelPendingNavigationAsync( void)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::_CancelPendingView()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::_MaySaveChanges()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::_PauseOrResumeView(BOOL fPaused)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::_DisableModeless()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::_NavigateToPidl(LPCITEMIDLIST pidl, DWORD grfHLNF, DWORD dwFlags)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::_TryShell2Rename(IShellView *psv, LPCITEMIDLIST pidlNew)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::_SwitchActivationNow()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::_ExecChildren(IUnknown *punkBar, BOOL fBroadcast, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvarargIn, VARIANTARG *pvarargOut)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::_SendChildren(HWND hwndBar, BOOL fBroadcast, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::GetFolderSetData(struct tagFolderSetData *pfsd)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::_OnFocusChange(UINT itb)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::v_ShowHideChildWindows(BOOL fChildOnly)
+{
+ return E_NOTIMPL;
+}
+
+UINT STDMETHODCALLTYPE CCommonBrowser::_get_itbLastFocus()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::_put_itbLastFocus(UINT itbLastFocus)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::_UIActivateView(UINT uState)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::_GetViewBorderRect(RECT *prc)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::_UpdateViewRectSize()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::_ResizeNextBorder(UINT itb)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::_ResizeView()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::_GetEffectiveClientArea(LPRECT lprectBorder, HMONITOR hmon)
+{
+ return E_NOTIMPL;
+}
+
+IStream *STDMETHODCALLTYPE CCommonBrowser::v_GetViewStream(LPCITEMIDLIST pidl, DWORD grfMode, LPCWSTR pwszName)
+{
+ return NULL;
+}
+
+LRESULT STDMETHODCALLTYPE CCommonBrowser::ForwardViewMsg(UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::SetAcceleratorMenu(HACCEL hacc)
+{
+ return E_NOTIMPL;
+}
+
+int STDMETHODCALLTYPE CCommonBrowser::_GetToolbarCount()
+{
+ return 0;
+}
+
+LPTOOLBARITEM STDMETHODCALLTYPE CCommonBrowser::_GetToolbarItem(int itb)
+{
+ return NULL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::_SaveToolbars(IStream *pstm)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::_LoadToolbars(IStream *pstm)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::_CloseAndReleaseToolbars(BOOL fClose)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::v_MayGetNextToolbarFocus(LPMSG lpMsg, UINT itbNext, int citb, LPTOOLBARITEM *pptbi, HWND *phwnd)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::_ResizeNextBorderHelper(UINT itb, BOOL bUseHmonitor)
+{
+ return E_NOTIMPL;
+}
+
+UINT STDMETHODCALLTYPE CCommonBrowser::_FindTBar(IUnknown *punkSrc)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::_SetFocus(LPTOOLBARITEM ptbi, HWND hwnd, LPMSG lpMsg)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::v_MayTranslateAccelerator(MSG *pmsg)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::_GetBorderDWHelper(IUnknown *punkSrc, LPRECT lprectBorder, BOOL bUseHmonitor)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::v_CheckZoneCrossing(LPCITEMIDLIST pidl)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::_PositionViewWindow(HWND *, RECT *)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::IEParseDisplayNameEx(unsigned int, const unsigned short *, DWORD, LPITEMIDLIST *)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::InsertMenusSB(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::SetMenuSB(HMENU hmenuShared, HOLEMENU holemenuRes, HWND hwndActiveObject)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::RemoveMenusSB(HMENU hmenuShared)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::SetStatusTextSB(LPCOLESTR pszStatusText)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::EnableModelessSB(BOOL fEnable)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::TranslateAcceleratorSB(MSG *pmsg, WORD wID)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::BrowseObject(LPCITEMIDLIST pidl, UINT wFlags)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::GetViewStateStream(DWORD grfMode, IStream **ppStrm)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::GetControlWindow(UINT id, HWND *lphwnd)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::SendControlMsg(UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::QueryActiveShellView(struct IShellView **ppshv)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::OnViewWindowActive(struct IShellView *ppshv)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::SetToolbarItems(LPTBBUTTON lpButtons, UINT nButtons, UINT uFlags)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::GetPropertyBag(long flags, REFIID riid, void **ppvObject)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::GetWindow(HWND *lphwnd)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::ContextSensitiveHelp(BOOL fEnterMode)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::GetBorderDW(IUnknown* punkObj, LPRECT prcBorder)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::RequestBorderSpaceDW(IUnknown* punkObj, LPCBORDERWIDTHS pbw)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::SetBorderSpaceDW(IUnknown* punkObj, LPCBORDERWIDTHS pbw)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::AddToolbar(IUnknown *punkSrc, LPCWSTR pwszItem, DWORD dwAddFlags)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::RemoveToolbar(IUnknown *punkSrc, DWORD dwRemoveFlags)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::FindToolbar(LPCWSTR pwszItem, REFIID riid, void **ppv)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::OnFocusChangeIS(IUnknown *punkObj, BOOL fSetFocus)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::DragLeave()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CCommonBrowser::Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
+{
+ return E_NOTIMPL;
+}
--- /dev/null
+/*
+ * ReactOS Explorer
+ *
+ * Copyright 2009 Andrew Hill <ash77@reactos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _commonbrowser_h
+#define _commonbrowser_h
+
+class CCommonBrowser :
+ public CComCoClass<CCommonBrowser, &CLSID_ACLMulti>,
+ public CComObjectRootEx<CComMultiThreadModelNoCS>,
+ public IServiceProvider,
+ public IOleCommandTarget,
+ public IBrowserService3,
+ public IShellBrowser,
+ public IShellBrowserService,
+ public IDockingWindowSite,
+ public IDockingWindowFrame,
+ public IInputObjectSite,
+ public IDropTarget
+{
+private:
+public:
+ CCommonBrowser();
+ ~CCommonBrowser();
+
+ // *** IServiceProvider methods ***
+ virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
+
+ // *** IOleCommandTarget methods ***
+ virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText);
+ virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
+
+ // *** IBrowserService methods ***
+ virtual HRESULT STDMETHODCALLTYPE GetParentSite(IOleInPlaceSite **ppipsite);
+ virtual HRESULT STDMETHODCALLTYPE SetTitle(IShellView *psv, LPCWSTR pszName);
+ virtual HRESULT STDMETHODCALLTYPE GetTitle(IShellView *psv, LPWSTR pszName, DWORD cchName);
+ virtual HRESULT STDMETHODCALLTYPE GetOleObject(IOleObject **ppobjv);
+ virtual HRESULT STDMETHODCALLTYPE GetTravelLog(ITravelLog **pptl);
+ virtual HRESULT STDMETHODCALLTYPE ShowControlWindow(UINT id, BOOL fShow);
+ virtual HRESULT STDMETHODCALLTYPE IsControlWindowShown(UINT id, BOOL *pfShown);
+ virtual HRESULT STDMETHODCALLTYPE IEGetDisplayName(LPCITEMIDLIST pidl, LPWSTR pwszName, UINT uFlags);
+ virtual HRESULT STDMETHODCALLTYPE IEParseDisplayName(UINT uiCP, LPCWSTR pwszPath, LPCITEMIDLIST *ppidlOut);
+ virtual HRESULT STDMETHODCALLTYPE DisplayParseError(HRESULT hres, LPCWSTR pwszPath);
+ virtual HRESULT STDMETHODCALLTYPE NavigateToPidl(LPCITEMIDLIST pidl, DWORD grfHLNF);
+ virtual HRESULT STDMETHODCALLTYPE SetNavigateState(BNSTATE bnstate);
+ virtual HRESULT STDMETHODCALLTYPE GetNavigateState(BNSTATE *pbnstate);
+ virtual HRESULT STDMETHODCALLTYPE NotifyRedirect(IShellView *psv, LPCITEMIDLIST pidl, BOOL *pfDidBrowse);
+ virtual HRESULT STDMETHODCALLTYPE UpdateWindowList();
+ virtual HRESULT STDMETHODCALLTYPE UpdateBackForwardState();
+ virtual HRESULT STDMETHODCALLTYPE SetFlags(DWORD dwFlags, DWORD dwFlagMask);
+ virtual HRESULT STDMETHODCALLTYPE GetFlags(DWORD *pdwFlags);
+ virtual HRESULT STDMETHODCALLTYPE CanNavigateNow();
+ virtual HRESULT STDMETHODCALLTYPE GetPidl(LPCITEMIDLIST *ppidl);
+ virtual HRESULT STDMETHODCALLTYPE SetReferrer(LPCITEMIDLIST pidl);
+ virtual DWORD STDMETHODCALLTYPE GetBrowserIndex();
+ virtual HRESULT STDMETHODCALLTYPE GetBrowserByIndex(DWORD dwID, IUnknown **ppunk);
+ virtual HRESULT STDMETHODCALLTYPE GetHistoryObject(IOleObject **ppole, IStream **pstm, IBindCtx **ppbc);
+ virtual HRESULT STDMETHODCALLTYPE SetHistoryObject(IOleObject *pole, BOOL fIsLocalAnchor);
+ virtual HRESULT STDMETHODCALLTYPE CacheOLEServer(IOleObject *pole);
+ virtual HRESULT STDMETHODCALLTYPE GetSetCodePage(VARIANT *pvarIn, VARIANT *pvarOut);
+ virtual HRESULT STDMETHODCALLTYPE OnHttpEquiv(IShellView *psv, BOOL fDone, VARIANT *pvarargIn, VARIANT *pvarargOut);
+ virtual HRESULT STDMETHODCALLTYPE GetPalette(HPALETTE *hpal);
+ virtual HRESULT STDMETHODCALLTYPE RegisterWindow(BOOL fForceRegister, int swc);
+
+ // *** IBrowserService2 methods ***
+ virtual LRESULT STDMETHODCALLTYPE WndProcBS(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+ virtual HRESULT STDMETHODCALLTYPE SetAsDefFolderSettings();
+ virtual HRESULT STDMETHODCALLTYPE GetViewRect(RECT *prc);
+ virtual HRESULT STDMETHODCALLTYPE OnSize(WPARAM wParam);
+ virtual HRESULT STDMETHODCALLTYPE OnCreate(struct tagCREATESTRUCTW *pcs);
+ virtual LRESULT STDMETHODCALLTYPE OnCommand(WPARAM wParam, LPARAM lParam);
+ virtual HRESULT STDMETHODCALLTYPE OnDestroy();
+ virtual LRESULT STDMETHODCALLTYPE OnNotify(struct tagNMHDR *pnm);
+ virtual HRESULT STDMETHODCALLTYPE OnSetFocus();
+ virtual HRESULT STDMETHODCALLTYPE OnFrameWindowActivateBS(BOOL fActive);
+ virtual HRESULT STDMETHODCALLTYPE ReleaseShellView();
+ virtual HRESULT STDMETHODCALLTYPE ActivatePendingView();
+ virtual HRESULT STDMETHODCALLTYPE CreateViewWindow(IShellView *psvNew, IShellView *psvOld, LPRECT prcView, HWND *phwnd);
+ virtual HRESULT STDMETHODCALLTYPE CreateBrowserPropSheetExt(REFIID riid, void **ppv);
+ virtual HRESULT STDMETHODCALLTYPE GetViewWindow(HWND *phwndView);
+ virtual HRESULT STDMETHODCALLTYPE GetBaseBrowserData(LPCBASEBROWSERDATA *pbbd);
+ virtual LPBASEBROWSERDATA STDMETHODCALLTYPE PutBaseBrowserData();
+ virtual HRESULT STDMETHODCALLTYPE InitializeTravelLog(ITravelLog *ptl, DWORD dw);
+ virtual HRESULT STDMETHODCALLTYPE SetTopBrowser();
+ virtual HRESULT STDMETHODCALLTYPE Offline(int iCmd);
+ virtual HRESULT STDMETHODCALLTYPE AllowViewResize(BOOL f);
+ virtual HRESULT STDMETHODCALLTYPE SetActivateState(UINT u);
+ virtual HRESULT STDMETHODCALLTYPE UpdateSecureLockIcon(int eSecureLock);
+ virtual HRESULT STDMETHODCALLTYPE InitializeDownloadManager();
+ virtual HRESULT STDMETHODCALLTYPE InitializeTransitionSite();
+ virtual HRESULT STDMETHODCALLTYPE _Initialize(HWND hwnd, IUnknown *pauto);
+ virtual HRESULT STDMETHODCALLTYPE _CancelPendingNavigationAsync();
+ virtual HRESULT STDMETHODCALLTYPE _CancelPendingView();
+ virtual HRESULT STDMETHODCALLTYPE _MaySaveChanges();
+ virtual HRESULT STDMETHODCALLTYPE _PauseOrResumeView(BOOL fPaused);
+ virtual HRESULT STDMETHODCALLTYPE _DisableModeless();
+ virtual HRESULT STDMETHODCALLTYPE _NavigateToPidl(LPCITEMIDLIST pidl, DWORD grfHLNF, DWORD dwFlags);
+ virtual HRESULT STDMETHODCALLTYPE _TryShell2Rename(IShellView *psv, LPCITEMIDLIST pidlNew);
+ virtual HRESULT STDMETHODCALLTYPE _SwitchActivationNow();
+ virtual HRESULT STDMETHODCALLTYPE _ExecChildren(IUnknown *punkBar, BOOL fBroadcast, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANTARG *pvarargIn, VARIANTARG *pvarargOut);
+ virtual HRESULT STDMETHODCALLTYPE _SendChildren(HWND hwndBar, BOOL fBroadcast, UINT uMsg, WPARAM wParam, LPARAM lParam);
+ virtual HRESULT STDMETHODCALLTYPE GetFolderSetData(struct tagFolderSetData *pfsd);
+ virtual HRESULT STDMETHODCALLTYPE _OnFocusChange(UINT itb);
+ virtual HRESULT STDMETHODCALLTYPE v_ShowHideChildWindows(BOOL fChildOnly);
+ virtual UINT STDMETHODCALLTYPE _get_itbLastFocus();
+ virtual HRESULT STDMETHODCALLTYPE _put_itbLastFocus(UINT itbLastFocus);
+ virtual HRESULT STDMETHODCALLTYPE _UIActivateView(UINT uState);
+ virtual HRESULT STDMETHODCALLTYPE _GetViewBorderRect(RECT *prc);
+ virtual HRESULT STDMETHODCALLTYPE _UpdateViewRectSize();
+ virtual HRESULT STDMETHODCALLTYPE _ResizeNextBorder(UINT itb);
+ virtual HRESULT STDMETHODCALLTYPE _ResizeView();
+ virtual HRESULT STDMETHODCALLTYPE _GetEffectiveClientArea(LPRECT lprectBorder, HMONITOR hmon);
+ virtual IStream *STDMETHODCALLTYPE v_GetViewStream(LPCITEMIDLIST pidl, DWORD grfMode, LPCWSTR pwszName);
+ virtual LRESULT STDMETHODCALLTYPE ForwardViewMsg(UINT uMsg, WPARAM wParam, LPARAM lParam);
+ virtual HRESULT STDMETHODCALLTYPE SetAcceleratorMenu(HACCEL hacc);
+ virtual int STDMETHODCALLTYPE _GetToolbarCount();
+ virtual LPTOOLBARITEM STDMETHODCALLTYPE _GetToolbarItem(int itb);
+ virtual HRESULT STDMETHODCALLTYPE _SaveToolbars(IStream *pstm);
+ virtual HRESULT STDMETHODCALLTYPE _LoadToolbars(IStream *pstm);
+ virtual HRESULT STDMETHODCALLTYPE _CloseAndReleaseToolbars(BOOL fClose);
+ virtual HRESULT STDMETHODCALLTYPE v_MayGetNextToolbarFocus(LPMSG lpMsg, UINT itbNext, int citb, LPTOOLBARITEM *pptbi, HWND *phwnd);
+ virtual HRESULT STDMETHODCALLTYPE _ResizeNextBorderHelper(UINT itb, BOOL bUseHmonitor);
+ virtual UINT STDMETHODCALLTYPE _FindTBar(IUnknown *punkSrc);
+ virtual HRESULT STDMETHODCALLTYPE _SetFocus(LPTOOLBARITEM ptbi, HWND hwnd, LPMSG lpMsg);
+ virtual HRESULT STDMETHODCALLTYPE v_MayTranslateAccelerator(MSG *pmsg);
+ virtual HRESULT STDMETHODCALLTYPE _GetBorderDWHelper(IUnknown *punkSrc, LPRECT lprectBorder, BOOL bUseHmonitor);
+ virtual HRESULT STDMETHODCALLTYPE v_CheckZoneCrossing(LPCITEMIDLIST pidl);
+
+ // *** IBrowserService3 methods ***
+ virtual HRESULT STDMETHODCALLTYPE _PositionViewWindow(HWND *, RECT *);
+ virtual HRESULT STDMETHODCALLTYPE IEParseDisplayNameEx(unsigned int, const unsigned short *, DWORD, LPITEMIDLIST *);
+
+ // *** IShellBrowser methods ***
+ virtual HRESULT STDMETHODCALLTYPE InsertMenusSB(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths);
+ virtual HRESULT STDMETHODCALLTYPE SetMenuSB(HMENU hmenuShared, HOLEMENU holemenuRes, HWND hwndActiveObject);
+ virtual HRESULT STDMETHODCALLTYPE RemoveMenusSB(HMENU hmenuShared);
+ virtual HRESULT STDMETHODCALLTYPE SetStatusTextSB(LPCOLESTR pszStatusText);
+ virtual HRESULT STDMETHODCALLTYPE EnableModelessSB(BOOL fEnable);
+ virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorSB(MSG *pmsg, WORD wID);
+ virtual HRESULT STDMETHODCALLTYPE BrowseObject(LPCITEMIDLIST pidl, UINT wFlags);
+ virtual HRESULT STDMETHODCALLTYPE GetViewStateStream(DWORD grfMode, IStream **ppStrm);
+ virtual HRESULT STDMETHODCALLTYPE GetControlWindow(UINT id, HWND *lphwnd);
+ virtual HRESULT STDMETHODCALLTYPE SendControlMsg(UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret);
+ virtual HRESULT STDMETHODCALLTYPE QueryActiveShellView(struct IShellView **ppshv);
+ virtual HRESULT STDMETHODCALLTYPE OnViewWindowActive(struct IShellView *ppshv);
+ virtual HRESULT STDMETHODCALLTYPE SetToolbarItems(LPTBBUTTON lpButtons, UINT nButtons, UINT uFlags);
+
+ // *** IShellBowserService methods ***
+ virtual HRESULT STDMETHODCALLTYPE GetPropertyBag(long flags, REFIID riid, void **ppvObject);
+
+ // *** IOleWindow methods ***
+ virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd);
+ virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode);
+
+ // *** IDockingWindowSite methods ***
+ virtual HRESULT STDMETHODCALLTYPE GetBorderDW(IUnknown* punkObj, LPRECT prcBorder);
+ virtual HRESULT STDMETHODCALLTYPE RequestBorderSpaceDW(IUnknown* punkObj, LPCBORDERWIDTHS pbw);
+ virtual HRESULT STDMETHODCALLTYPE SetBorderSpaceDW(IUnknown* punkObj, LPCBORDERWIDTHS pbw);
+
+ // *** IDockingWindowFrame methods ***
+ virtual HRESULT STDMETHODCALLTYPE AddToolbar(IUnknown *punkSrc, LPCWSTR pwszItem, DWORD dwAddFlags);
+ virtual HRESULT STDMETHODCALLTYPE RemoveToolbar(IUnknown *punkSrc, DWORD dwRemoveFlags);
+ virtual HRESULT STDMETHODCALLTYPE FindToolbar(LPCWSTR pwszItem, REFIID riid, void **ppv);
+
+ // *** IInputObjectSite specific methods ***
+ virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(IUnknown *punkObj, BOOL fSetFocus);
+
+ // *** IDropTarget methods ***
+ virtual HRESULT STDMETHODCALLTYPE DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
+ virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
+ virtual HRESULT STDMETHODCALLTYPE DragLeave();
+ virtual HRESULT STDMETHODCALLTYPE Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
+
+DECLARE_REGISTRY_RESOURCEID(IDR_COMMONBROWSER)
+
+DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+BEGIN_COM_MAP(CCommonBrowser)
+ COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
+ COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
+ COM_INTERFACE_ENTRY_IID(IID_IBrowserService, IBrowserService)
+ COM_INTERFACE_ENTRY_IID(IID_IBrowserService2, IBrowserService2)
+ COM_INTERFACE_ENTRY_IID(IID_IBrowserService3, IBrowserService3)
+ COM_INTERFACE_ENTRY_IID(IID_IShellBrowser, IShellBrowser)
+ COM_INTERFACE_ENTRY_IID(IID_IShellBrowserService, IShellBrowserService)
+ COM_INTERFACE_ENTRY2_IID(IID_IOleWindow, IOleWindow, IDockingWindowSite)
+ COM_INTERFACE_ENTRY_IID(IID_IDockingWindowSite, IDockingWindowSite)
+ COM_INTERFACE_ENTRY_IID(IID_IDockingWindowFrame, IDockingWindowFrame)
+ COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite)
+ COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget)
+END_COM_MAP()
+};
+
+#endif // _commonbrowser_h
--- /dev/null
+/*
+ * ReactOS Explorer
+ *
+ * Copyright 2009 Andrew Hill <ash77 at domain reactos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <windows.h>
+#include <shlobj.h>
+#include <shlobj_undoc.h>
+#include <shlguid.h>
+#include <shlguid_undoc.h>
+#include <tchar.h>
+#include <exdisp.h>
+#include <exdispid.h>
+#include <atlbase.h>
+#include <atlcom.h>
+#include <atlwin.h>
+#include "resource.h"
+#include "globalfoldersettings.h"
+
+CGlobalFolderSettings::CGlobalFolderSettings()
+{
+}
+
+CGlobalFolderSettings::~CGlobalFolderSettings()
+{
+}
+
+HRESULT STDMETHODCALLTYPE CGlobalFolderSettings::Get(DEFFOLDERSETTINGS *paramC, int param10)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CGlobalFolderSettings::Set(const DEFFOLDERSETTINGS *paramC, int param10, unsigned int param14)
+{
+ return E_NOTIMPL;
+}
--- /dev/null
+/*
+ * ReactOS Explorer
+ *
+ * Copyright 2009 Andrew Hill <ash77@reactos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _globalfoldersettings_h
+#define _globalfoldersettings_h
+
+class CGlobalFolderSettings :
+ public CComCoClass<CGlobalFolderSettings, &CLSID_ACLMulti>,
+ public CComObjectRootEx<CComMultiThreadModelNoCS>,
+ public IGlobalFolderSettings
+{
+private:
+public:
+ CGlobalFolderSettings();
+ ~CGlobalFolderSettings();
+
+ // *** IGlobalFolderSettings methods ***
+ virtual HRESULT STDMETHODCALLTYPE Get(DEFFOLDERSETTINGS *paramC, int param10);
+ virtual HRESULT STDMETHODCALLTYPE Set(const DEFFOLDERSETTINGS *paramC, int param10, unsigned int param14);
+
+DECLARE_REGISTRY_RESOURCEID(IDR_GLOBALFOLDERSETTINGS)
+DECLARE_NOT_AGGREGATABLE(CGlobalFolderSettings)
+
+DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+BEGIN_COM_MAP(CGlobalFolderSettings)
+ COM_INTERFACE_ENTRY_IID(IID_IGlobalFolderSettings, IGlobalFolderSettings)
+END_COM_MAP()
+};
+
+#endif // _globalfoldersettings_h
--- /dev/null
+/*
+ * ReactOS Explorer
+ *
+ * Copyright 2009 Andrew Hill <ash77 at domain reactos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+Implements a class that knows how to hold and manage the menu band, brand band,
+toolbar, and address band for an explorer window
+*/
+#include <windows.h>
+#include <shlobj.h>
+#include <shlobj_undoc.h>
+#include <shlguid.h>
+#include <shlguid_undoc.h>
+#include <tchar.h>
+#include <exdisp.h>
+#include <exdispid.h>
+#include <objbase.h>
+#include <atlbase.h>
+#include <atlcom.h>
+#include <atlwin.h>
+#include "resource.h"
+#include "internettoolbar.h"
+
+// navigation controls and menubar just send a message to parent window
+/*
+TODO:
+****Implement BandProxy methods
+****Add QueryStatus handler for built-in bands
+****Enable/Disable up, search, and folders commands appropriately
+ **Why are explorer toolbar separators a nonstandard width?
+ **Remove "(Empty)" item from Favorites menu. Probably something missing in CMenuCallback::CallbackSM
+ **Chevron menu on menuband doesn't work
+ **Fix CInternetToolbar::QueryBand to be generic
+
+****Fix context menu to strip divider when menu shown for menu band
+****Fix context menu to have items checked appropriately
+****Implement -1 command id update
+****When bands are rearranged, resize the internet toolbar and fix height of brand band
+****Right clicking on the browse back and forward toolbar buttons displays the same as pulldown menus
+ Implement show/hide of bands
+ Why is the background color of my toolbars different from explorer?
+ Internet Toolbar command handler should get the target for the command and call Exec on the target.
+ For commands built in to the Internet Toolbar, its Exec handles the command
+ When window width is changed, brand band flashes badly
+ Add all bands with correct ids (system bands now add with correct ids)
+ Implement IBandSite
+ Implement remaining IExplorerToolbar methods
+ Fix toolbar buttons to enable/disable correctly
+ After toolbar is customized, it may be necessary to patch the widths of separators
+ Add theme support
+ Check sizes and spacing of toolbars against Explorer
+ Implement resizing of the dock bar
+ Add missing icons for toolbar items
+ Draw History item in forward/back dropdown menus with icon
+ Fix toolbar customize dialog to not include separators as possible selections
+ Implement save/restore of toolbar state
+ Refactor drop down menu code to use a common function since code is so similar
+*/
+
+extern HRESULT WINAPI SHBindToFolder(LPITEMIDLIST path, IShellFolder **newFolder);
+extern HRESULT CreateToolsBar(REFIID riid, void **ppv);
+extern HRESULT CreateBrandBand(REFIID riid, void **ppv);
+extern HRESULT CreateBandProxy(REFIID riid, void **ppv);
+extern HRESULT CreateAddressBand(REFIID riid, void **ppv);
+
+class CInternetToolbar;
+
+class CDockSite :
+ public CComObjectRootEx<CComMultiThreadModelNoCS>,
+ public IDockingWindowSite,
+ public IInputObjectSite,
+ public IOleCommandTarget,
+ public IServiceProvider
+{
+public:
+ enum {
+ ITF_NOGRIPPER = 1,
+ ITF_NOTITLE = 2,
+ ITF_NEWBANDALWAYS = 4,
+ ITF_GRIPPERALWAYS = 8,
+ ITF_FIXEDSIZE = 16
+ };
+private:
+ CComPtr<IUnknown> fContainedBand; // the band inside us
+ CInternetToolbar *fToolbar; // our browser
+ HWND fRebarWindow;
+ HWND fChildWindow;
+ int fBandID;
+public:
+ int fFlags;
+private:
+ bool fInitialized;
+ // fields of DESKBANDINFO must be preserved between calls to GetBandInfo
+ DESKBANDINFO fDeskBandInfo;
+public:
+ CDockSite();
+ ~CDockSite();
+ HRESULT Initialize(IUnknown *containedBand, CInternetToolbar *browser, HWND hwnd, int bandID, int flags);
+ HRESULT GetRBBandInfo(REBARBANDINFOW &bandInfo);
+private:
+
+ // *** IOleWindow methods ***
+ virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd);
+ virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode);
+
+ // *** IDockingWindow methods ***
+ virtual HRESULT STDMETHODCALLTYPE GetBorderDW(IUnknown* punkObj, LPRECT prcBorder);
+ virtual HRESULT STDMETHODCALLTYPE RequestBorderSpaceDW(IUnknown* punkObj, LPCBORDERWIDTHS pbw);
+ virtual HRESULT STDMETHODCALLTYPE SetBorderSpaceDW(IUnknown* punkObj, LPCBORDERWIDTHS pbw);
+
+ // *** IInputObjectSite specific methods ***
+ virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(IUnknown *punkObj, BOOL fSetFocus);
+
+ // *** IOleCommandTarget specific methods ***
+ virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText);
+ virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
+
+ // *** IServiceProvider methods ***
+ virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
+
+BEGIN_COM_MAP(CDockSite)
+ COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
+ COM_INTERFACE_ENTRY_IID(IID_IDockingWindowSite, IDockingWindowSite)
+ COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite)
+ COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
+ COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
+END_COM_MAP()
+};
+
+CDockSite::CDockSite()
+{
+ fToolbar = NULL;
+ fRebarWindow = NULL;
+ fChildWindow = NULL;
+ fInitialized = false;
+ memset(&fDeskBandInfo, 0, sizeof(fDeskBandInfo));
+}
+
+CDockSite::~CDockSite()
+{
+}
+
+HRESULT CDockSite::Initialize(IUnknown *containedBand, CInternetToolbar *browser, HWND hwnd, int bandID, int flags)
+{
+ CComPtr<IObjectWithSite> site;
+ CComPtr<IOleWindow> oleWindow;
+ CComPtr<IDeskBand> deskBand;
+ TCHAR textBuffer[40];
+ REBARBANDINFOW bandInfo;
+ int bandCount;
+ HRESULT hResult;
+
+ hResult = containedBand->QueryInterface(IID_IObjectWithSite, (void **)&site);
+ if (FAILED(hResult))
+ return hResult;
+ hResult = containedBand->QueryInterface(IID_IOleWindow, (void **)&oleWindow);
+ if (FAILED(hResult))
+ return hResult;
+ hResult = containedBand->QueryInterface(IID_IDeskBand, (void **)&deskBand);
+ if (FAILED(hResult))
+ return hResult;
+ fContainedBand = containedBand;
+ fToolbar = browser;
+ fRebarWindow = hwnd;
+ fBandID = bandID;
+ fFlags = flags;
+ hResult = site->SetSite((IOleWindow *)this);
+ if (FAILED(hResult))
+ return hResult;
+ hResult = oleWindow->GetWindow(&fChildWindow);
+ if (FAILED(hResult))
+ return hResult;
+
+ memset(&bandInfo, 0, sizeof(bandInfo));
+ bandInfo.cbSize = sizeof(bandInfo);
+ bandInfo.lpText = textBuffer;
+ bandInfo.cch = sizeof(textBuffer) / sizeof(TCHAR);
+ hResult = GetRBBandInfo(bandInfo);
+
+ bandCount = (int)SendMessage(fRebarWindow, RB_GETBANDCOUNT, 0, 0);
+ SendMessage(fRebarWindow, RB_INSERTBANDW, -1, (LPARAM)&bandInfo);
+ fInitialized = true;
+ return S_OK;
+}
+
+HRESULT CDockSite::GetRBBandInfo(REBARBANDINFOW &bandInfo)
+{
+ CComPtr<IDeskBand> deskBand;
+ HRESULT hResult;
+
+ hResult = fContainedBand->QueryInterface(IID_IDeskBand, (void **)&deskBand);
+ if (FAILED(hResult))
+ return hResult;
+
+ fDeskBandInfo.dwMask = DBIM_BKCOLOR | DBIM_MODEFLAGS | DBIM_TITLE | DBIM_ACTUAL | DBIM_INTEGRAL | DBIM_MAXSIZE | DBIM_MINSIZE;
+ hResult = deskBand->GetBandInfo(fBandID, 0, &fDeskBandInfo);
+ // result of call is ignored
+
+ bandInfo.fMask = RBBIM_LPARAM | RBBIM_IDEALSIZE | RBBIM_ID | RBBIM_CHILDSIZE | RBBIM_CHILD | RBBIM_TEXT | RBBIM_STYLE;
+
+ bandInfo.fStyle = RBBS_FIXEDBMP;
+ if (fDeskBandInfo.dwModeFlags & DBIMF_VARIABLEHEIGHT)
+ bandInfo.fStyle |= RBBS_VARIABLEHEIGHT;
+ if (fDeskBandInfo.dwModeFlags & DBIMF_USECHEVRON)
+ bandInfo.fStyle |= RBBS_USECHEVRON;
+ if (fDeskBandInfo.dwModeFlags & DBIMF_BREAK)
+ bandInfo.fStyle |= RBBS_BREAK;
+ if (fDeskBandInfo.dwModeFlags & DBIMF_TOPALIGN)
+ bandInfo.fStyle |= RBBS_TOPALIGN;
+ if (fFlags & ITF_NOGRIPPER || fToolbar->fLocked == true)
+ bandInfo.fStyle |= RBBS_NOGRIPPER;
+ if (fFlags & ITF_NOTITLE)
+ bandInfo.fStyle |= RBBS_HIDETITLE;
+ if (fFlags & ITF_GRIPPERALWAYS && fToolbar->fLocked == false)
+ bandInfo.fStyle |= RBBS_GRIPPERALWAYS;
+ if (fFlags & ITF_FIXEDSIZE)
+ bandInfo.fStyle |= RBBS_FIXEDSIZE;
+
+ if (fDeskBandInfo.dwModeFlags & DBIMF_BKCOLOR)
+ {
+ bandInfo.fMask |= RBBIM_COLORS;
+ bandInfo.clrFore = CLR_DEFAULT;
+ bandInfo.clrBack = fDeskBandInfo.crBkgnd;
+ }
+ wcsncpy(bandInfo.lpText, fDeskBandInfo.wszTitle, bandInfo.cch);
+ bandInfo.hwndChild = fChildWindow;
+ bandInfo.cxMinChild = fDeskBandInfo.ptMinSize.x;
+ bandInfo.cyMinChild = fDeskBandInfo.ptMinSize.y;
+ bandInfo.wID = fBandID;
+ bandInfo.cyChild = fDeskBandInfo.ptActual.y;
+ bandInfo.cyMaxChild = fDeskBandInfo.ptMaxSize.y;
+ bandInfo.cyIntegral = fDeskBandInfo.ptIntegral.y;
+ bandInfo.cxIdeal = fDeskBandInfo.ptActual.x;
+ bandInfo.lParam = (LPARAM)this;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CDockSite::GetWindow(HWND *lphwnd)
+{
+ if (lphwnd == NULL)
+ return E_POINTER;
+ *lphwnd = fRebarWindow;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE CDockSite::ContextSensitiveHelp(BOOL fEnterMode)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CDockSite::GetBorderDW(IUnknown* punkObj, LPRECT prcBorder)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CDockSite::RequestBorderSpaceDW(IUnknown* punkObj, LPCBORDERWIDTHS pbw)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CDockSite::SetBorderSpaceDW(IUnknown* punkObj, LPCBORDERWIDTHS pbw)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CDockSite::OnFocusChangeIS (IUnknown *punkObj, BOOL fSetFocus)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CDockSite::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE CDockSite::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
+{
+ TCHAR textBuffer[40];
+ REBARBANDINFOW bandInfo;
+ int index;
+ HRESULT hResult;
+
+ if (IsEqualIID(*pguidCmdGroup, CGID_DeskBand))
+ {
+ switch (nCmdID)
+ {
+ case DBID_BANDINFOCHANGED:
+ if (fInitialized == false)
+ return S_OK;
+ if (V_VT(pvaIn) != VT_I4)
+ return E_INVALIDARG;
+ if (V_I4(pvaIn) != fBandID)
+ return E_FAIL;
+ // deskband information changed
+ // call GetBandInfo and refresh information in rebar
+ memset(&bandInfo, 0, sizeof(bandInfo));
+ bandInfo.cbSize = sizeof(bandInfo);
+ bandInfo.lpText = textBuffer;
+ bandInfo.cch = sizeof(textBuffer) / sizeof(TCHAR);
+ hResult = GetRBBandInfo(bandInfo);
+ if (FAILED(hResult))
+ return hResult;
+ index = (int)SendMessage(fRebarWindow, RB_IDTOINDEX, fBandID, 0);
+ SendMessage(fRebarWindow, RB_SETBANDINFOW, index, (LPARAM)&bandInfo);
+ return S_OK;
+ }
+ }
+ return E_FAIL;
+}
+
+HRESULT STDMETHODCALLTYPE CDockSite::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
+{
+ CComPtr<IServiceProvider> serviceProvider;
+ HRESULT hResult;
+
+ if (IsEqualIID(guidService, SID_SMenuBandParent))
+ return this->QueryInterface(riid, ppvObject);
+ hResult = fToolbar->QueryInterface(IID_IServiceProvider, (void **)&serviceProvider);
+ if (FAILED (hResult))
+ return hResult;
+ return serviceProvider->QueryService(guidService, riid, ppvObject);
+}
+
+CMenuCallback::CMenuCallback()
+{
+}
+
+CMenuCallback::~CMenuCallback()
+{
+}
+
+HRESULT STDMETHODCALLTYPE CMenuCallback::GetObject(LPSMDATA psmd, REFIID riid, void **ppvObject)
+{
+ CComPtr<IShellMenu> parentMenu;
+ CComPtr<IShellMenu> newMenu;
+ CComPtr<IShellFolder> favoritesFolder;
+ LPITEMIDLIST favoritesPIDL;
+ HWND ownerWindow;
+ HMENU parentHMenu;
+ HMENU favoritesHMenu;
+ HKEY orderRegKey;
+ DWORD disposition;
+ HRESULT hResult;
+
+ if (!IsEqualIID(riid, IID_IShellMenu))
+ return E_FAIL;
+ if (psmd->uId != FCIDM_MENU_FAVORITES)
+ return E_FAIL;
+ if (fFavoritesMenu.p == NULL)
+ {
+ hResult = psmd->punk->QueryInterface(IID_IShellMenu, (void **)&parentMenu);
+ if (FAILED(hResult))
+ return hResult;
+ hResult = parentMenu->GetMenu(&parentHMenu, &ownerWindow, NULL);
+ if (FAILED(hResult))
+ return hResult;
+ favoritesHMenu = GetSubMenu(parentHMenu, 3);
+ if (favoritesHMenu == NULL)
+ return E_FAIL;
+ hResult = CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER, IID_IShellMenu, (void **)&newMenu);
+ if (FAILED(hResult))
+ return hResult;
+ hResult = newMenu->Initialize(this, FCIDM_MENU_FAVORITES, -1, SMINIT_VERTICAL | SMINIT_CACHED);
+ if (FAILED(hResult))
+ return hResult;
+ hResult = newMenu->SetMenu(favoritesHMenu, ownerWindow, SMSET_TOP | SMSET_DONTOWN);
+ if (FAILED(hResult))
+ return hResult;
+ hResult = SHGetSpecialFolderLocation(NULL, CSIDL_FAVORITES, &favoritesPIDL);
+ if (FAILED(hResult))
+ return hResult;
+ hResult = SHBindToFolder(favoritesPIDL, &favoritesFolder);
+ if (FAILED(hResult))
+ return hResult;
+ RegCreateKeyEx(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MenuOrder\\Favorites"),
+ 0, NULL, 0, KEY_READ | KEY_WRITE, NULL, &orderRegKey, &disposition);
+ hResult = newMenu->SetShellFolder(favoritesFolder, favoritesPIDL, orderRegKey, SMSET_BOTTOM | 0x18);
+ ILFree(favoritesPIDL);
+ if (SUCCEEDED(hResult))
+ fFavoritesMenu.Attach(newMenu.Detach());
+ }
+ if (fFavoritesMenu.p == NULL)
+ return E_FAIL;
+ return fFavoritesMenu->QueryInterface(riid, ppvObject);
+}
+
+HRESULT STDMETHODCALLTYPE CMenuCallback::CallbackSM(LPSMDATA psmd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch (uMsg)
+ {
+ case SMC_INITMENU:
+ break;
+ case SMC_CREATE:
+ break;
+ case SMC_EXITMENU:
+ break;
+ case SMC_GETINFO:
+ {
+ SMINFO *infoPtr = (SMINFO *)lParam;
+ if ((infoPtr->dwMask & SMIM_FLAGS) != 0)
+ if (psmd->uId == FCIDM_MENU_FAVORITES)
+ infoPtr->dwFlags |= SMIF_DROPCASCADE;
+ else
+ infoPtr->dwFlags |= SMIF_TRACKPOPUP;
+ if ((infoPtr->dwMask & SMIM_ICON) != 0)
+ infoPtr->iIcon = -1;
+ }
+ return S_OK;
+ case SMC_GETSFINFO:
+ break;
+ case SMC_GETOBJECT:
+ return GetObject(psmd, *(IID *)wParam, (void **)lParam);
+ case SMC_GETSFOBJECT:
+ break;
+ case SMC_SFEXEC:
+ break;
+ case SMC_SFSELECTITEM:
+ break;
+ case 13:
+ // return tooltip
+ break;
+ case SMC_REFRESH:
+ break;
+ case SMC_DEMOTE:
+ break;
+ case SMC_PROMOTE:
+ break;
+ case 0x13:
+ break;
+ case SMC_DEFAULTICON:
+ break;
+ case SMC_NEWITEM:
+ break;
+ case SMC_CHEVRONEXPAND:
+ break;
+ case SMC_DISPLAYCHEVRONTIP:
+ break;
+ case SMC_SETSFOBJECT:
+ break;
+ case SMC_SHCHANGENOTIFY:
+ break;
+ case SMC_CHEVRONGETTIP:
+ break;
+ case SMC_SFDDRESTRICTED:
+ break;
+ case 0x35:
+ break;
+ case 49:
+ break;
+ &nb