#pragma region CPL License /* Nuclex Native Framework Copyright (C) 2002-2023 Nuclex Development Labs This library is free software; you can redistribute it and/or modify it under the terms of the IBM Common Public License as published by the IBM Corporation; either version 1.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the IBM Common Public License for more details. You should have received a copy of the IBM Common Public License along with this library */ #pragma endregion // CPL License #ifndef NUCLEX_PLATFORM_INTERACTION_GUIMESSAGESERVICE_H #define NUCLEX_PLATFORM_INTERACTION_GUIMESSAGESERVICE_H #include "Nuclex/Platform/Config.h" #include "Nuclex/Platform/Interaction/MessageService.h" #include // for std::shared_ptr namespace Nuclex { namespace Platform { namespace Interaction { // ------------------------------------------------------------------------------------------- // class ActiveWindowTracker; // ------------------------------------------------------------------------------------------- // }}} // namespace Nuclex::Platform::Interaction namespace Nuclex { namespace Platform { namespace Interaction { // ------------------------------------------------------------------------------------------- // /// Shows notifications and questions to be displayed to an interactive user class NUCLEX_PLATFORM_TYPE GuiMessageService : public MessageService { /// Initializes a new GUI-based message service /// /// Used to obtain the active top-level window that should become the owner of any /// message boxes that are displayed. /// public: NUCLEX_PLATFORM_API GuiMessageService( const std::shared_ptr &activeWindowTracker = ( std::shared_ptr() ) ); /// Frees all resources owned by the GUI-based message service public: NUCLEX_PLATFORM_API ~GuiMessageService() override; /// Displays a notification containing information to the user /// Topic of the information (normally used as the window title) /// Headline of the message (normally written in bold) /// Message text containing detailed informations public: NUCLEX_PLATFORM_API void Inform( const std::string &topic, const std::string &heading, const std::string &message ) override; /// Displays a warning to the user /// Topic of the warning (normally used as the window title) /// Headline of the message (normally written in bold) /// Message text containing more details public: NUCLEX_PLATFORM_API void Warn( const std::string &topic, const std::string &heading, const std::string &message ) override; /// Displays an error message to the user /// Topic of the error (normally used as the window title) /// Headline of the message (normally written in bold) /// Message text containing more details public: NUCLEX_PLATFORM_API void Complain( const std::string &topic, const std::string &heading, const std::string &message ) override; /// Displays a question to the user, answerable with either yes or no /// Topic of the question (normally used as the window title) /// Basic question being asked (normally written in bold) /// Message text elaborating in the question and actions /// True if the user answered yes, false if the user answered no public: NUCLEX_PLATFORM_API bool AskYesNo( const std::string &topic, const std::string &heading, const std::string &message ) override; /// /// Displays a confirmation prompt to the user, answerable with either ok or cancel /// /// Topic of the conformation (normally used as the window title) /// What the user has to confirm (normally written in bold) /// Message text elaborating the action to be confirmed /// True if the user answered ok, false if the user answered cancel public: NUCLEX_PLATFORM_API bool AskOkCancel( const std::string &topic, const std::string &heading, const std::string &message ) override; /// Displays a question to the user, answerable with yes, no or cancel /// Topic of the question (normally used as the window title) /// Basic question being asked (normally written in bold) /// Message text elaborating in the question and actions /// /// True if the user answered yes, false if the user answered no and nothing if /// the user wishes to cancel /// public: NUCLEX_PLATFORM_API std::optional AskYesNoCancel( const std::string &topic, const std::string &heading, const std::string &message ) override; /// Provides the currently active top-level window private: std::shared_ptr activeWindowTracker; // Stores private, portentially platform-specific implementation details of the class private: struct PrivateImplementationData; /// Holds private and platform-specific implementation data private: std::unique_ptr implementationData; }; // ------------------------------------------------------------------------------------------- // }}} // namespace Nuclex::Platform::Interaction #endif // NUCLEX_PLATFORM_INTERACTION_MESSAGESERVICE_H // Support native platform MessageBox // Support task bar notification // Support command line output