mirror of
https://github.com/reactos/reactos.git
synced 2024-07-29 23:58:44 +00:00
[QCKLNCH]
-Added IShellFolderBand and stubbed its methods. -Implemented InitializeSFB. -Tested enumeration of IShellFolder within CISFBand. svn path=/branches/GSoC_2017/shellext/; revision=75169
This commit is contained in:
parent
aa5d11c9c2
commit
ba53ff00eb
|
@ -14,25 +14,45 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(qcklnch);
|
||||
|
||||
//Toolbar
|
||||
//Misc Methods:
|
||||
//Subclassing Button
|
||||
|
||||
HWND CreateSimpleToolbar(HWND hWndParent, HINSTANCE hInst)
|
||||
LRESULT CALLBACK MyWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
|
||||
{
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
{
|
||||
MessageBox(0, L"Button Clicked!!", L"Testing", MB_OK | MB_ICONINFORMATION);
|
||||
}
|
||||
}
|
||||
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
//*****************************************************************************************
|
||||
//CISFBand
|
||||
|
||||
CISFBand::CISFBand() : m_hWnd(NULL), m_BandID(0) {}
|
||||
|
||||
CISFBand::~CISFBand() {}
|
||||
|
||||
//ToolbarTest
|
||||
|
||||
HWND CISFBand::CreateSimpleToolbar(HWND hWndParent, HINSTANCE hInst)
|
||||
{
|
||||
//This ought to be global.. (currently testing)
|
||||
//HIMAGELIST g_hImageList = NULL;
|
||||
|
||||
// Declare and initialize local constants.
|
||||
const int ImageListID = 0;
|
||||
const int numButtons = 3;
|
||||
const int bitmapSize = 16;
|
||||
|
||||
const DWORD buttonStyles = BTNS_AUTOSIZE;
|
||||
|
||||
// Create the toolbar.
|
||||
HWND hWndToolbar = CreateWindowEx(0, TOOLBARCLASSNAME, NULL,
|
||||
WS_CHILD | TBSTYLE_WRAPABLE | TBSTYLE_FLAT | CCS_NORESIZE, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0,
|
||||
WS_CHILD | TBSTYLE_WRAPABLE | TBSTYLE_LIST | CCS_NORESIZE, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0,
|
||||
hWndParent, NULL, hInst, NULL);
|
||||
|
||||
if (hWndToolbar == NULL)
|
||||
return NULL;
|
||||
|
||||
|
@ -53,47 +73,47 @@ HWND CreateSimpleToolbar(HWND hWndParent, HINSTANCE hInst)
|
|||
|
||||
// Initialize button info.
|
||||
// IDM_NEW, IDM_OPEN, and IDM_SAVE are application-defined command constants.
|
||||
|
||||
TBBUTTON tbButtons[numButtons] =
|
||||
{
|
||||
/*{
|
||||
{ MAKELONG(STD_FILENEW, ImageListID), IDM_NEW, TBSTATE_ENABLED, buttonStyles,{ 0 }, 0, (INT_PTR)L"New" },
|
||||
{ MAKELONG(STD_FILEOPEN, ImageListID), IDM_OPEN, TBSTATE_ENABLED, buttonStyles,{ 0 }, 0, (INT_PTR)L"Open" },
|
||||
{ MAKELONG(STD_FILESAVE, ImageListID), IDM_SAVE, 0, buttonStyles,{ 0 }, 0, (INT_PTR)L"Save" }
|
||||
};
|
||||
|
||||
};*/
|
||||
// Add buttons.
|
||||
SendMessage(hWndToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
|
||||
SendMessage(hWndToolbar, TB_ADDBUTTONS, (WPARAM)numButtons, (LPARAM)&tbButtons);
|
||||
/*SendMessage(hWndToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
|
||||
SendMessage(hWndToolbar, TB_ADDBUTTONS, (WPARAM)nb, (LPARAM)&tbButtons);*/
|
||||
|
||||
//SendMessage(hWndToolbar, TB_INSERTBUTTON, /*(WPARAM)numButtons*/ 0, (LPARAM)&tbButtons[0]);
|
||||
//Enumerate objects
|
||||
CComPtr<IEnumIDList> pedl;
|
||||
HRESULT hr = m_pISF->EnumObjects(0, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, &pedl);
|
||||
LPITEMIDLIST pidl = NULL;
|
||||
STRRET stret;
|
||||
//LPWSTR pstr = NULL;
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
for (int i=0; pedl->Next(MAX_PATH, &pidl, 0) != S_FALSE; i++)
|
||||
{
|
||||
WCHAR sz[MAX_PATH];
|
||||
m_pISF->GetDisplayNameOf(pidl, SHGDN_NORMAL, &stret);
|
||||
//StrRetToStr(&stret, pidl, &pstr);
|
||||
StrRetToBuf(&stret, pidl, sz, sizeof(sz));
|
||||
//MessageBox(0, sz, L"Namespace Object Found!", MB_OK | MB_ICONINFORMATION);
|
||||
|
||||
TBBUTTON tb = { MAKELONG(I_IMAGENONE, ImageListID), i, TBSTATE_ENABLED, buttonStyles,{ 0 }, 0, (INT_PTR)sz };
|
||||
SendMessage(hWndToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
|
||||
SendMessage(hWndToolbar, TB_INSERTBUTTONW, 0, (LPARAM)&tb);
|
||||
}
|
||||
}
|
||||
|
||||
// Resize the toolbar, and then show it.
|
||||
SendMessage(hWndToolbar, TB_AUTOSIZE, 0, 0);
|
||||
ShowWindow(hWndToolbar, TRUE);
|
||||
|
||||
CoTaskMemFree((void*)pidl);
|
||||
//CoTaskMemFree((void*)pstr);
|
||||
return hWndToolbar;
|
||||
}
|
||||
|
||||
//Subclassing Button
|
||||
|
||||
LRESULT CALLBACK MyWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
|
||||
{
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
{
|
||||
MessageBox(0, L"Button Clicked!!", L"Testing", MB_OK | MB_ICONINFORMATION);
|
||||
}
|
||||
}
|
||||
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
//CISFBand
|
||||
|
||||
CISFBand::CISFBand() : m_hWnd(NULL), m_BandID(0) {}
|
||||
|
||||
CISFBand::~CISFBand() {}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
//IObjectWithSite
|
||||
|
@ -118,6 +138,7 @@ HWND CreateSimpleToolbar(HWND hWndParent, HINSTANCE hInst)
|
|||
//SetWindowSubclass(hwndParent, MyWndProc, 0, 0); //when button is clicked, parent receives WM_COMMAND, and thus subclassed to show a test message box
|
||||
|
||||
m_hWnd = CreateSimpleToolbar(hwndParent, m_hInstance);
|
||||
SetWindowSubclass(hwndParent, MyWndProc, 0, 0);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -257,7 +278,7 @@ HWND CreateSimpleToolbar(HWND hWndParent, HINSTANCE hInst)
|
|||
pdbi->ptActual = actualSize;
|
||||
}
|
||||
if (pdbi->dwMask & DBIM_TITLE)
|
||||
wcscpy(pdbi->wszTitle, L"");
|
||||
wcscpy(pdbi->wszTitle, L"Quick Launch");
|
||||
if (pdbi->dwMask & DBIM_MODEFLAGS)
|
||||
{
|
||||
pdbi->dwModeFlags = DBIMF_NORMAL | DBIMF_VARIABLEHEIGHT;
|
||||
|
@ -429,9 +450,36 @@ HWND CreateSimpleToolbar(HWND hWndParent, HINSTANCE hInst)
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
//IShellFolderBand
|
||||
HRESULT STDMETHODCALLTYPE CISFBand::GetBandInfoSFB(PBANDINFOSFB pbi)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CISFBand::InitializeSFB(IShellFolder *psf, PCIDLIST_ABSOLUTE pidl)
|
||||
{
|
||||
if (pidl != NULL)
|
||||
{
|
||||
psf->BindToObject(pidl, 0, IID_IShellFolder, (void**)&m_pISF);
|
||||
m_pidl = pidl;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pISF = psf;
|
||||
m_pidl = pidl;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CISFBand::SetBandInfoSFB( PBANDINFOSFB pbi)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
//C Constructor
|
||||
extern "C"
|
||||
HRESULT WINAPI CIFSBand_CreateInstance(REFIID riid, void** ppv)
|
||||
HRESULT WINAPI CISFBand_CreateInstance(REFIID riid, void** ppv)
|
||||
{
|
||||
return ShellObjectCreator<CISFBand>(riid, ppv);
|
||||
}
|
||||
|
|
|
@ -16,11 +16,13 @@ class CISFBand :
|
|||
public IDeskBar,
|
||||
public IPersistStream,
|
||||
public IWinEventHandler,
|
||||
public IOleCommandTarget
|
||||
public IOleCommandTarget,
|
||||
public IShellFolderBand
|
||||
{
|
||||
HINSTANCE m_hInstance;
|
||||
CComPtr<IUnknown> m_Site;
|
||||
CComPtr<IShellFolder> m_pISF;
|
||||
PCIDLIST_ABSOLUTE m_pidl;
|
||||
HWND m_hWnd;
|
||||
HWND m_hWndStartButton;
|
||||
DWORD m_BandID;
|
||||
|
@ -30,6 +32,9 @@ public:
|
|||
CISFBand();
|
||||
virtual ~CISFBand();
|
||||
|
||||
//Personal Methods
|
||||
HWND CreateSimpleToolbar(HWND hWndParent, HINSTANCE hInst);
|
||||
|
||||
//IObjectWithSite
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE GetSite(
|
||||
|
@ -149,6 +154,20 @@ public:
|
|||
/*[in, out]*/ OLECMDTEXT *pCmdText
|
||||
);
|
||||
|
||||
//IShellFolderBand
|
||||
virtual HRESULT STDMETHODCALLTYPE GetBandInfoSFB(
|
||||
PBANDINFOSFB pbi
|
||||
);
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE InitializeSFB(
|
||||
IShellFolder *psf,
|
||||
PCIDLIST_ABSOLUTE pidl
|
||||
);
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE SetBandInfoSFB(
|
||||
PBANDINFOSFB pbi
|
||||
);
|
||||
|
||||
//*****************************************************************************************************
|
||||
|
||||
DECLARE_NOT_AGGREGATABLE(CISFBand)
|
||||
|
@ -162,9 +181,10 @@ public:
|
|||
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_IShellFolderBand, IShellFolderBand)
|
||||
END_COM_MAP()
|
||||
};
|
||||
|
||||
//C Constructor
|
||||
extern "C"
|
||||
HRESULT WINAPI CIFSBand_CreateInstance(REFIID riid, void** ppv);
|
||||
HRESULT WINAPI CISFBand_CreateInstance(REFIID riid, void** ppv);
|
Loading…
Reference in a new issue