File indexing completed on 2024-04-28 15:51:36

0001 /*
0002     SPDX-FileCopyrightText: 2007 Pino Toscano <pino@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef _OKULAR_GUIINTERFACE_H_
0008 #define _OKULAR_GUIINTERFACE_H_
0009 
0010 #include "../core/okularcore_export.h"
0011 
0012 #include <QObject>
0013 
0014 #include <KXMLGUIClient>
0015 
0016 namespace Okular
0017 {
0018 /**
0019  * @short Abstract interface for user interface control
0020  *
0021  * This interface defines an way to interact with the Okular user interface,
0022  * e.g. adding actions in the menus.
0023  *
0024  * How to use it in a custom Generator:
0025  * @code
0026     class MyGenerator : public Okular::Generator, public Okular::GuiInterface
0027     {
0028         Q_OBJECT
0029         Q_INTERFACES( Okular::GuiInterface )
0030 
0031         ...
0032     };
0033  * @endcode
0034  * and - of course - implementing its methods.
0035  */
0036 class OKULARCORE_EXPORT GuiInterface : protected KXMLGUIClient
0037 {
0038 public:
0039     GuiInterface()
0040     {
0041     }
0042 
0043     /**
0044      * Destroys the gui interface.
0045      */
0046     ~GuiInterface() override
0047     {
0048     }
0049 
0050     GuiInterface(const GuiInterface &) = delete;
0051     GuiInterface &operator=(const GuiInterface &) = delete;
0052 
0053     /**
0054      * This method requests the XML GUI Client provided by the interface.
0055      */
0056     KXMLGUIClient *guiClient()
0057     {
0058         return this;
0059     }
0060 };
0061 
0062 }
0063 
0064 Q_DECLARE_INTERFACE(Okular::GuiInterface, "org.kde.okular.GuiInterface/0.1")
0065 
0066 #endif