54 lines
1.6 KiB
C++
54 lines
1.6 KiB
C++
#pragma once
|
|
#include "core.h"
|
|
#include <filesystem>
|
|
#include <objbase.h>
|
|
#include <span>
|
|
#include <stdexcept>
|
|
|
|
namespace ks
|
|
{
|
|
using Bytes = std::vector<unsigned char>;
|
|
struct Format
|
|
{
|
|
UINT id{};
|
|
std::wstring name;
|
|
Bytes data;
|
|
};
|
|
struct Clip
|
|
{
|
|
std::vector<Format> formats;
|
|
std::wstring text() const;
|
|
size_t size() const;
|
|
};
|
|
std::vector<Layout> readLayouts();
|
|
const Layout &physicalLayout();
|
|
wchar_t physicalKey(DWORD scan, bool shift);
|
|
HKL windowLayout(HWND);
|
|
bool switchWindowLayout(HWND, HKL, const std::function<bool()> &valid);
|
|
bool activateWindow(HWND);
|
|
void showRequestedWindow(HWND);
|
|
bool ownsClipboard(HWND);
|
|
bool webViewDescendant(DWORD owner, DWORD host,
|
|
const std::function<std::optional<std::pair<DWORD, std::wstring>>(DWORD)> &read);
|
|
std::wstring processName(HWND);
|
|
Clip readClipboard(HWND, size_t limit = 32 * 1024 * 1024);
|
|
DWORD writeClipboard(HWND, const Clip &);
|
|
Clip textClip(const std::wstring &);
|
|
bool chord(WORD key, UINT modifiers = 0);
|
|
bool needsSelectionDelay(HWND);
|
|
bool selectPrevious(size_t count, const std::function<bool()> &valid);
|
|
bool modifiersReleased();
|
|
void releaseModifiers();
|
|
std::filesystem::path dataDirectory();
|
|
void atomicWrite(const std::filesystem::path &, const Bytes &);
|
|
Bytes readFile(const std::filesystem::path &, size_t limit);
|
|
Bytes protect(const Bytes &);
|
|
Bytes unprotect(const Bytes &);
|
|
void setAutostart(bool, bool elevated = false);
|
|
std::wstring currentUserSid();
|
|
void configureAutostart(int mode);
|
|
std::wstring executable();
|
|
std::wstring lastError(const std::wstring &context);
|
|
void log(const std::wstring &message);
|
|
} // namespace ks
|