mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +01:00
* Order PowerToys aplhabetically in both Settings list and General Settings enable's list * Remove uneeded include
54 lines
1.2 KiB
C++
54 lines
1.2 KiB
C++
#pragma once
|
|
#include "powertoys_events.h"
|
|
#include "system_menu_helper.h"
|
|
#include <interface/powertoy_module_interface.h>
|
|
#include <string>
|
|
#include <memory>
|
|
#include <mutex>
|
|
#include <vector>
|
|
#include <functional>
|
|
|
|
#include <common/json.h>
|
|
|
|
struct PowertoyModuleDeleter
|
|
{
|
|
void operator()(PowertoyModuleIface* module) const
|
|
{
|
|
if (module)
|
|
{
|
|
powertoys_events().unregister_system_menu_action(module);
|
|
powertoys_events().unregister_receiver(module);
|
|
module->destroy();
|
|
}
|
|
}
|
|
};
|
|
|
|
struct PowertoyModuleDLLDeleter
|
|
{
|
|
using pointer = HMODULE;
|
|
void operator()(HMODULE handle) const
|
|
{
|
|
FreeLibrary(handle);
|
|
}
|
|
};
|
|
|
|
class PowertoyModule
|
|
{
|
|
public:
|
|
PowertoyModule(PowertoyModuleIface* module, HMODULE handle);
|
|
|
|
inline PowertoyModuleIface* operator->()
|
|
{
|
|
return module.get();
|
|
}
|
|
|
|
json::JsonObject json_config() const;
|
|
|
|
private:
|
|
std::unique_ptr<HMODULE, PowertoyModuleDLLDeleter> handle;
|
|
std::unique_ptr<PowertoyModuleIface, PowertoyModuleDeleter> module;
|
|
};
|
|
|
|
PowertoyModule load_powertoy(const std::wstring& filename);
|
|
std::map<std::wstring, PowertoyModule>& modules();
|