// WARNING: Please don't edit this file. It was generated by C++/WinRT v2.0.240405.15 #pragma once #ifndef WINRT_Windows_UI_Popups_H #define WINRT_Windows_UI_Popups_H #include "winrt/base.h" static_assert(winrt::check_version(CPPWINRT_VERSION, "2.0.240405.15"), "Mismatched C++/WinRT headers."); #define CPPWINRT_VERSION "2.0.240405.15" #include "winrt/Windows.UI.h" #include "winrt/impl/Windows.Foundation.2.h" #include "winrt/impl/Windows.Foundation.Collections.2.h" #include "winrt/impl/Windows.UI.Popups.2.h" namespace winrt::impl { template auto consume_Windows_UI_Popups_IMessageDialog::Title() const { void* value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::UI::Popups::IMessageDialog)->get_Title(&value)); return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_UI_Popups_IMessageDialog::Title(param::hstring const& value) const { check_hresult(WINRT_IMPL_SHIM(winrt::Windows::UI::Popups::IMessageDialog)->put_Title(*(void**)(&value))); } template auto consume_Windows_UI_Popups_IMessageDialog::Commands() const { void* value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::UI::Popups::IMessageDialog)->get_Commands(&value)); return winrt::Windows::Foundation::Collections::IVector{ value, take_ownership_from_abi }; } template auto consume_Windows_UI_Popups_IMessageDialog::DefaultCommandIndex() const { uint32_t value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::UI::Popups::IMessageDialog)->get_DefaultCommandIndex(&value)); return value; } template auto consume_Windows_UI_Popups_IMessageDialog::DefaultCommandIndex(uint32_t value) const { check_hresult(WINRT_IMPL_SHIM(winrt::Windows::UI::Popups::IMessageDialog)->put_DefaultCommandIndex(value)); } template auto consume_Windows_UI_Popups_IMessageDialog::CancelCommandIndex() const { uint32_t value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::UI::Popups::IMessageDialog)->get_CancelCommandIndex(&value)); return value; } template auto consume_Windows_UI_Popups_IMessageDialog::CancelCommandIndex(uint32_t value) const { check_hresult(WINRT_IMPL_SHIM(winrt::Windows::UI::Popups::IMessageDialog)->put_CancelCommandIndex(value)); } template auto consume_Windows_UI_Popups_IMessageDialog::Content() const { void* value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::UI::Popups::IMessageDialog)->get_Content(&value)); return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_UI_Popups_IMessageDialog::Content(param::hstring const& value) const { check_hresult(WINRT_IMPL_SHIM(winrt::Windows::UI::Popups::IMessageDialog)->put_Content(*(void**)(&value))); } template auto consume_Windows_UI_Popups_IMessageDialog::ShowAsync() const { void* messageDialogAsyncOperation{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::UI::Popups::IMessageDialog)->ShowAsync(&messageDialogAsyncOperation)); return winrt::Windows::Foundation::IAsyncOperation{ messageDialogAsyncOperation, take_ownership_from_abi }; } template auto consume_Windows_UI_Popups_IMessageDialog::Options() const { winrt::Windows::UI::Popups::MessageDialogOptions value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::UI::Popups::IMessageDialog)->get_Options(reinterpret_cast(&value))); return value; } template auto consume_Windows_UI_Popups_IMessageDialog::Options(winrt::Windows::UI::Popups::MessageDialogOptions const& value) const { check_hresult(WINRT_IMPL_SHIM(winrt::Windows::UI::Popups::IMessageDialog)->put_Options(static_cast(value))); } template auto consume_Windows_UI_Popups_IMessageDialogFactory::Create(param::hstring const& content) const { void* messageDialog{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::UI::Popups::IMessageDialogFactory)->Create(*(void**)(&content), &messageDialog)); return winrt::Windows::UI::Popups::MessageDialog{ messageDialog, take_ownership_from_abi }; } template auto consume_Windows_UI_Popups_IMessageDialogFactory::CreateWithTitle(param::hstring const& content, param::hstring const& title) const { void* messageDialog{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::UI::Popups::IMessageDialogFactory)->CreateWithTitle(*(void**)(&content), *(void**)(&title), &messageDialog)); return winrt::Windows::UI::Popups::MessageDialog{ messageDialog, take_ownership_from_abi }; } template auto consume_Windows_UI_Popups_IPopupMenu::Commands() const { void* value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::UI::Popups::IPopupMenu)->get_Commands(&value)); return winrt::Windows::Foundation::Collections::IVector{ value, take_ownership_from_abi }; } template auto consume_Windows_UI_Popups_IPopupMenu::ShowAsync(winrt::Windows::Foundation::Point const& invocationPoint) const { void* asyncOperation{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::UI::Popups::IPopupMenu)->ShowAsync(impl::bind_in(invocationPoint), &asyncOperation)); return winrt::Windows::Foundation::IAsyncOperation{ asyncOperation, take_ownership_from_abi }; } template auto consume_Windows_UI_Popups_IPopupMenu::ShowForSelectionAsync(winrt::Windows::Foundation::Rect const& selection) const { void* asyncOperation{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::UI::Popups::IPopupMenu)->ShowAsyncWithRect(impl::bind_in(selection), &asyncOperation)); return winrt::Windows::Foundation::IAsyncOperation{ asyncOperation, take_ownership_from_abi }; } template auto consume_Windows_UI_Popups_IPopupMenu::ShowForSelectionAsync(winrt::Windows::Foundation::Rect const& selection, winrt::Windows::UI::Popups::Placement const& preferredPlacement) const { void* asyncOperation{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::UI::Popups::IPopupMenu)->ShowAsyncWithRectAndPlacement(impl::bind_in(selection), static_cast(preferredPlacement), &asyncOperation)); return winrt::Windows::Foundation::IAsyncOperation{ asyncOperation, take_ownership_from_abi }; } template auto consume_Windows_UI_Popups_IUICommand::Label() const { void* value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::UI::Popups::IUICommand)->get_Label(&value)); return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_UI_Popups_IUICommand::Label(param::hstring const& value) const { check_hresult(WINRT_IMPL_SHIM(winrt::Windows::UI::Popups::IUICommand)->put_Label(*(void**)(&value))); } template auto consume_Windows_UI_Popups_IUICommand::Invoked() const { void* value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::UI::Popups::IUICommand)->get_Invoked(&value)); return winrt::Windows::UI::Popups::UICommandInvokedHandler{ value, take_ownership_from_abi }; } template auto consume_Windows_UI_Popups_IUICommand::Invoked(winrt::Windows::UI::Popups::UICommandInvokedHandler const& value) const { check_hresult(WINRT_IMPL_SHIM(winrt::Windows::UI::Popups::IUICommand)->put_Invoked(*(void**)(&value))); } template auto consume_Windows_UI_Popups_IUICommand::Id() const { void* value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::UI::Popups::IUICommand)->get_Id(&value)); return winrt::Windows::Foundation::IInspectable{ value, take_ownership_from_abi }; } template auto consume_Windows_UI_Popups_IUICommand::Id(winrt::Windows::Foundation::IInspectable const& value) const { check_hresult(WINRT_IMPL_SHIM(winrt::Windows::UI::Popups::IUICommand)->put_Id(*(void**)(&value))); } template auto consume_Windows_UI_Popups_IUICommandFactory::Create(param::hstring const& label) const { void* instance{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::UI::Popups::IUICommandFactory)->Create(*(void**)(&label), &instance)); return winrt::Windows::UI::Popups::UICommand{ instance, take_ownership_from_abi }; } template auto consume_Windows_UI_Popups_IUICommandFactory::CreateWithHandler(param::hstring const& label, winrt::Windows::UI::Popups::UICommandInvokedHandler const& action) const { void* instance{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::UI::Popups::IUICommandFactory)->CreateWithHandler(*(void**)(&label), *(void**)(&action), &instance)); return winrt::Windows::UI::Popups::UICommand{ instance, take_ownership_from_abi }; } template auto consume_Windows_UI_Popups_IUICommandFactory::CreateWithHandlerAndId(param::hstring const& label, winrt::Windows::UI::Popups::UICommandInvokedHandler const& action, winrt::Windows::Foundation::IInspectable const& commandId) const { void* instance{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::UI::Popups::IUICommandFactory)->CreateWithHandlerAndId(*(void**)(&label), *(void**)(&action), *(void**)(&commandId), &instance)); return winrt::Windows::UI::Popups::UICommand{ instance, take_ownership_from_abi }; } template struct delegate final : implements_delegate { delegate(H&& handler) : implements_delegate(std::forward(handler)) {} int32_t __stdcall Invoke(void* command) noexcept final try { (*this)(*reinterpret_cast(&command)); return 0; } catch (...) { return to_hresult(); } }; #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall get_Title(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Title()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_Title(void* value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Title(*reinterpret_cast(&value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Commands(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from>(this->shim().Commands()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_DefaultCommandIndex(uint32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().DefaultCommandIndex()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_DefaultCommandIndex(uint32_t value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().DefaultCommandIndex(value); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_CancelCommandIndex(uint32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().CancelCommandIndex()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_CancelCommandIndex(uint32_t value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().CancelCommandIndex(value); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Content(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Content()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_Content(void* value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Content(*reinterpret_cast(&value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall ShowAsync(void** messageDialogAsyncOperation) noexcept final try { clear_abi(messageDialogAsyncOperation); typename D::abi_guard guard(this->shim()); *messageDialogAsyncOperation = detach_from>(this->shim().ShowAsync()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Options(uint32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Options()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_Options(uint32_t value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Options(*reinterpret_cast(&value)); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall Create(void* content, void** messageDialog) noexcept final try { clear_abi(messageDialog); typename D::abi_guard guard(this->shim()); *messageDialog = detach_from(this->shim().Create(*reinterpret_cast(&content))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateWithTitle(void* content, void* title, void** messageDialog) noexcept final try { clear_abi(messageDialog); typename D::abi_guard guard(this->shim()); *messageDialog = detach_from(this->shim().CreateWithTitle(*reinterpret_cast(&content), *reinterpret_cast(&title))); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall get_Commands(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from>(this->shim().Commands()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall ShowAsync(winrt::Windows::Foundation::Point invocationPoint, void** asyncOperation) noexcept final try { clear_abi(asyncOperation); typename D::abi_guard guard(this->shim()); *asyncOperation = detach_from>(this->shim().ShowAsync(*reinterpret_cast(&invocationPoint))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall ShowAsyncWithRect(winrt::Windows::Foundation::Rect selection, void** asyncOperation) noexcept final try { clear_abi(asyncOperation); typename D::abi_guard guard(this->shim()); *asyncOperation = detach_from>(this->shim().ShowForSelectionAsync(*reinterpret_cast(&selection))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall ShowAsyncWithRectAndPlacement(winrt::Windows::Foundation::Rect selection, int32_t preferredPlacement, void** asyncOperation) noexcept final try { clear_abi(asyncOperation); typename D::abi_guard guard(this->shim()); *asyncOperation = detach_from>(this->shim().ShowForSelectionAsync(*reinterpret_cast(&selection), *reinterpret_cast(&preferredPlacement))); return 0; } catch (...) { return to_hresult(); } }; #endif template struct produce : produce_base { int32_t __stdcall get_Label(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Label()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_Label(void* value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Label(*reinterpret_cast(&value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Invoked(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Invoked()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_Invoked(void* value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Invoked(*reinterpret_cast(&value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Id(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Id()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall put_Id(void* value) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().Id(*reinterpret_cast(&value)); return 0; } catch (...) { return to_hresult(); } }; #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall Create(void* label, void** instance) noexcept final try { clear_abi(instance); typename D::abi_guard guard(this->shim()); *instance = detach_from(this->shim().Create(*reinterpret_cast(&label))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateWithHandler(void* label, void* action, void** instance) noexcept final try { clear_abi(instance); typename D::abi_guard guard(this->shim()); *instance = detach_from(this->shim().CreateWithHandler(*reinterpret_cast(&label), *reinterpret_cast(&action))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateWithHandlerAndId(void* label, void* action, void* commandId, void** instance) noexcept final try { clear_abi(instance); typename D::abi_guard guard(this->shim()); *instance = detach_from(this->shim().CreateWithHandlerAndId(*reinterpret_cast(&label), *reinterpret_cast(&action), *reinterpret_cast(&commandId))); return 0; } catch (...) { return to_hresult(); } }; #endif } WINRT_EXPORT namespace winrt::Windows::UI::Popups { constexpr auto operator|(MessageDialogOptions const left, MessageDialogOptions const right) noexcept { return static_cast(impl::to_underlying_type(left) | impl::to_underlying_type(right)); } constexpr auto operator|=(MessageDialogOptions& left, MessageDialogOptions const right) noexcept { left = left | right; return left; } constexpr auto operator&(MessageDialogOptions const left, MessageDialogOptions const right) noexcept { return static_cast(impl::to_underlying_type(left) & impl::to_underlying_type(right)); } constexpr auto operator&=(MessageDialogOptions& left, MessageDialogOptions const right) noexcept { left = left & right; return left; } constexpr auto operator~(MessageDialogOptions const value) noexcept { return static_cast(~impl::to_underlying_type(value)); } constexpr auto operator^(MessageDialogOptions const left, MessageDialogOptions const right) noexcept { return static_cast(impl::to_underlying_type(left) ^ impl::to_underlying_type(right)); } constexpr auto operator^=(MessageDialogOptions& left, MessageDialogOptions const right) noexcept { left = left ^ right; return left; } inline MessageDialog::MessageDialog(param::hstring const& content) : MessageDialog(impl::call_factory([&](IMessageDialogFactory const& f) { return f.Create(content); })) { } inline MessageDialog::MessageDialog(param::hstring const& content, param::hstring const& title) : MessageDialog(impl::call_factory([&](IMessageDialogFactory const& f) { return f.CreateWithTitle(content, title); })) { } inline PopupMenu::PopupMenu() : PopupMenu(impl::call_factory_cast([](winrt::Windows::Foundation::IActivationFactory const& f) { return f.template ActivateInstance(); })) { } inline UICommand::UICommand() : UICommand(impl::call_factory_cast([](winrt::Windows::Foundation::IActivationFactory const& f) { return f.template ActivateInstance(); })) { } inline UICommand::UICommand(param::hstring const& label) : UICommand(impl::call_factory([&](IUICommandFactory const& f) { return f.Create(label); })) { } inline UICommand::UICommand(param::hstring const& label, winrt::Windows::UI::Popups::UICommandInvokedHandler const& action) : UICommand(impl::call_factory([&](IUICommandFactory const& f) { return f.CreateWithHandler(label, action); })) { } inline UICommand::UICommand(param::hstring const& label, winrt::Windows::UI::Popups::UICommandInvokedHandler const& action, winrt::Windows::Foundation::IInspectable const& commandId) : UICommand(impl::call_factory([&](IUICommandFactory const& f) { return f.CreateWithHandlerAndId(label, action, commandId); })) { } inline UICommandSeparator::UICommandSeparator() : UICommandSeparator(impl::call_factory_cast([](winrt::Windows::Foundation::IActivationFactory const& f) { return f.template ActivateInstance(); })) { } template UICommandInvokedHandler::UICommandInvokedHandler(L handler) : UICommandInvokedHandler(impl::make_delegate(std::forward(handler))) { } template UICommandInvokedHandler::UICommandInvokedHandler(F* handler) : UICommandInvokedHandler([=](auto&&... args) { return handler(args...); }) { } template UICommandInvokedHandler::UICommandInvokedHandler(O* object, M method) : UICommandInvokedHandler([=](auto&&... args) { return ((*object).*(method))(args...); }) { } template UICommandInvokedHandler::UICommandInvokedHandler(com_ptr&& object, M method) : UICommandInvokedHandler([o = std::move(object), method](auto&&... args) { return ((*o).*(method))(args...); }) { } template UICommandInvokedHandler::UICommandInvokedHandler(weak_ref&& object, LM&& lambda_or_method) : UICommandInvokedHandler([o = std::move(object), lm = std::forward(lambda_or_method)](auto&&... args) { if (auto s = o.get()) { if constexpr (std::is_member_function_pointer_v) ((*s).*(lm))(args...); else lm(args...); } }) { } template UICommandInvokedHandler::UICommandInvokedHandler(std::shared_ptr&& object, M method) : UICommandInvokedHandler([o = std::move(object), method](auto&&... args) { return ((*o).*(method))(args...); }) { } template UICommandInvokedHandler::UICommandInvokedHandler(std::weak_ptr&& object, LM&& lambda_or_method) : UICommandInvokedHandler([o = std::move(object), lm = std::forward(lambda_or_method)](auto&&... args) { if (auto s = o.lock()) { if constexpr (std::is_member_function_pointer_v) ((*s).*(lm))(args...); else lm(args...); } }) { } inline auto UICommandInvokedHandler::operator()(winrt::Windows::UI::Popups::IUICommand const& command) const { check_hresult((*(impl::abi_t**)this)->Invoke(*(void**)(&command))); } } namespace std { #ifndef WINRT_LEAN_AND_MEAN template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; #endif #ifdef __cpp_lib_format #endif } #endif