mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 19:26:39 +02:00
powerrename: implement shellext support for UWP
This commit is contained in:
@@ -105,7 +105,7 @@ IFACEMETHODIMP_(ULONG) CPowerRenameUI::Release()
|
||||
return refCount;
|
||||
}
|
||||
|
||||
HRESULT CPowerRenameUI::s_CreateInstance(_In_ IPowerRenameManager* psrm, _In_opt_ IDataObject* pdo, _In_ bool enableDragDrop, _Outptr_ IPowerRenameUI** ppsrui)
|
||||
HRESULT CPowerRenameUI::s_CreateInstance(_In_ IPowerRenameManager* psrm, _In_opt_ IUnknown* dataSource, _In_ bool enableDragDrop, _Outptr_ IPowerRenameUI** ppsrui)
|
||||
{
|
||||
*ppsrui = nullptr;
|
||||
CPowerRenameUI *prui = new CPowerRenameUI();
|
||||
@@ -113,7 +113,7 @@ HRESULT CPowerRenameUI::s_CreateInstance(_In_ IPowerRenameManager* psrm, _In_opt
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
// Pass the IPowerRenameManager to the IPowerRenameUI so it can subscribe to events
|
||||
hr = prui->_Initialize(psrm, pdo, enableDragDrop);
|
||||
hr = prui->_Initialize(psrm, dataSource, enableDragDrop);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = prui->QueryInterface(IID_PPV_ARGS(ppsrui));
|
||||
@@ -276,13 +276,13 @@ IFACEMETHODIMP CPowerRenameUI::Drop(_In_ IDataObject* pdtobj, DWORD, POINTL pt,
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CPowerRenameUI::_Initialize(_In_ IPowerRenameManager* psrm, _In_opt_ IDataObject* pdo, _In_ bool enableDragDrop)
|
||||
HRESULT CPowerRenameUI::_Initialize(_In_ IPowerRenameManager* psrm, _In_opt_ IUnknown* dataSource, _In_ bool enableDragDrop)
|
||||
{
|
||||
// Cache the rename manager
|
||||
m_spsrm = psrm;
|
||||
|
||||
// Cache the data object for enumeration later
|
||||
m_spdo = pdo;
|
||||
// Cache the data source for enumeration later
|
||||
m_dataSource = dataSource;
|
||||
|
||||
m_enableDragDrop = enableDragDrop;
|
||||
|
||||
@@ -350,7 +350,7 @@ void CPowerRenameUI::_Cleanup()
|
||||
m_spsrm = nullptr;
|
||||
}
|
||||
|
||||
m_spdo = nullptr;
|
||||
m_dataSource = nullptr;
|
||||
m_spdth = nullptr;
|
||||
|
||||
if (m_enableDragDrop)
|
||||
@@ -361,7 +361,7 @@ void CPowerRenameUI::_Cleanup()
|
||||
m_hwnd = NULL;
|
||||
}
|
||||
|
||||
void CPowerRenameUI::_EnumerateItems(_In_ IDataObject* pdtobj)
|
||||
void CPowerRenameUI::_EnumerateItems(_In_ IUnknown* pdtobj)
|
||||
{
|
||||
// Enumerate the data object and popuplate the manager
|
||||
if (m_spsrm)
|
||||
@@ -615,10 +615,10 @@ void CPowerRenameUI::_OnInitDlg()
|
||||
_SetCheckboxesFromFlags(flags);
|
||||
}
|
||||
|
||||
if (m_spdo)
|
||||
if (m_dataSource)
|
||||
{
|
||||
// Populate the manager from the data object
|
||||
_EnumerateItems(m_spdo);
|
||||
_EnumerateItems(m_dataSource);
|
||||
}
|
||||
|
||||
// Load the main icon
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
#include <PowerRenameInterfaces.h>
|
||||
#include <shldisp.h>
|
||||
|
||||
void ModuleAddRef();
|
||||
void ModuleRelease();
|
||||
|
||||
class CPowerRenameListView
|
||||
{
|
||||
public:
|
||||
@@ -38,6 +41,7 @@ public:
|
||||
m_refCount(1)
|
||||
{
|
||||
(void)OleInitialize(nullptr);
|
||||
ModuleAddRef();
|
||||
}
|
||||
|
||||
// IUnknown
|
||||
@@ -68,13 +72,14 @@ public:
|
||||
IFACEMETHODIMP DragLeave();
|
||||
IFACEMETHODIMP Drop(_In_ IDataObject* pdtobj, DWORD grfKeyState, POINTL pt, _Inout_ DWORD* pdwEffect);
|
||||
|
||||
static HRESULT s_CreateInstance(_In_ IPowerRenameManager* psrm, _In_opt_ IDataObject* pdo, _In_ bool enableDragDrop, _Outptr_ IPowerRenameUI** ppsrui);
|
||||
static HRESULT s_CreateInstance(_In_ IPowerRenameManager* psrm, _In_opt_ IUnknown* dataSource, _In_ bool enableDragDrop, _Outptr_ IPowerRenameUI** ppsrui);
|
||||
|
||||
private:
|
||||
~CPowerRenameUI()
|
||||
{
|
||||
DeleteObject(m_iconMain);
|
||||
OleUninitialize();
|
||||
ModuleRelease();
|
||||
}
|
||||
|
||||
HRESULT _DoModal(__in_opt HWND hwnd);
|
||||
@@ -92,7 +97,7 @@ private:
|
||||
return pDlg ? pDlg->_DlgProc(uMsg, wParam, lParam) : FALSE;
|
||||
}
|
||||
|
||||
HRESULT _Initialize(_In_ IPowerRenameManager* psrm, _In_opt_ IDataObject* pdo, _In_ bool enableDragDrop);
|
||||
HRESULT _Initialize(_In_ IPowerRenameManager* psrm, _In_opt_ IUnknown* dataSource, _In_ bool enableDragDrop);
|
||||
HRESULT _InitAutoComplete();
|
||||
void _Cleanup();
|
||||
|
||||
@@ -116,7 +121,7 @@ private:
|
||||
void _SetCheckboxesFromFlags(_In_ DWORD flags);
|
||||
void _ValidateFlagCheckbox(_In_ DWORD checkBoxId);
|
||||
|
||||
void _EnumerateItems(_In_ IDataObject* pdtobj);
|
||||
void _EnumerateItems(_In_ IUnknown* pdtobj);
|
||||
void _UpdateCounts();
|
||||
|
||||
long m_refCount = 0;
|
||||
@@ -136,7 +141,7 @@ private:
|
||||
int m_lastWidth = 0;
|
||||
int m_lastHeight = 0;
|
||||
CComPtr<IPowerRenameManager> m_spsrm;
|
||||
CComPtr<IDataObject> m_spdo;
|
||||
CComPtr<IUnknown> m_dataSource;
|
||||
CComPtr<IDropTargetHelper> m_spdth;
|
||||
CComPtr<IAutoComplete2> m_spSearchAC;
|
||||
CComPtr<IUnknown> m_spSearchACL;
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0"
|
||||
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
@@ -26,19 +19,6 @@
|
||||
<ProjectName>PowerRenameUI</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
@@ -162,6 +142,12 @@
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<Lib>
|
||||
<!-- link-time polymorpism -->
|
||||
<ForceSymbolReferences>ModuleAddRef,ModuleRelease</ForceSymbolReferences>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="PowerRenameUI.h" />
|
||||
<ClInclude Include="Resource.h" />
|
||||
|
||||
@@ -11,4 +11,3 @@
|
||||
#include <malloc.h>
|
||||
#include <memory.h>
|
||||
#include <wchar.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user