--Boundary-00=_rx35Ht918j5WiQk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Sun 23 Mar 2008, Michel Ludwig wrote: > Attached is a proposal for a ActionAccessInterface: the underlying > rationale is that applications may want more control over which actions a > KTextEditor part is going to present. Actually reconsidering, we would also need the possibility to specify which features a new view should *not* display once it is created. I propose a "FeatureControlInterface" for this purpose; a first draft is attached. Thanks, Michel --Boundary-00=_rx35Ht918j5WiQk Content-Type: text/x-c++hdr; charset="utf-8"; name="featurecontrolinterface.h" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="featurecontrolinterface.h" /* This file is part of the KDE libraries Copyright (C) 2008 Michel Ludwig This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. 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 GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KDELIBS_KTEXTEDITOR_FEATURECONTROLINTERFACE_H #define KDELIBS_KTEXTEDITOR_FEATURECONTROLINTERFACE_H #include class KConfigGroup; #include namespace KTextEditor { /** * \brief Feature control interface options. */ namespace FeatureControl { /** * \brief A type representing specific actions. * */ enum ExludedFeaturesOptionsEnum { NoExclusion = 0 ///< No feature should be excluded NoSpellchecking = 1 << 0 ///< No spell checking features }; Q_DECLARE_FLAGS(ExludedFeaturesOptions, ExludedFeaturesOptionsEnum) Q_DECLARE_OPERATORS_FOR_FLAGS(ExludedFeaturesOptions) } /** * \brief Feature control interface extension for the Document. * * \ingroup kte_group_doc_extensions * * \section featurecontrol_intro Introduction * * The FeatureControlInterface is an extension for Documents which allows features to be omitted * in newly created Views. * * \section featurecontrol_support Adding Feature Control Support * * To add support for feature control a KTextEditor implementation has to derive the * Document class from FeatureControlInterface and reimplement the purely virtual methods defined * in this interfaces. * * \section featurecontrol_access Accessing the FeatureControlInterface * * The FeatureControlInterface is supposed to be an extension interface for a Document, i.e. the * Document inherits the interface \e provided that it implements the interface. Use qobject_cast to * access the implementation: * \code * // object is of type KTextEditor::Document* * KTextEditor::FeatureControlInterface *iface = * qobject_cast( object ); * * if( iface ) { * // interface is supported * // do stuff * } * \endcode * * \see KTextEditor::Document * \author Michel Ludwig \ */ class KTEXTEDITOR_EXPORT FeatureControlInterface { public: /** * Constructor. */ FeatureControlInterface(); /** * Virtual destructor. */ virtual ~FeatureControlInterface() {} public: /** * Create a new view which is attached to \p parent and which does not display the * features specified in \p options. Different values for \p options can be logically * ORed together. * * \param parent Parent of the view returned * \param options Features that should \e not be present in the view * returned * \return A newly created view */ virtual View* createView(QWidget *parent, FeatureControl::ExludedFeaturesOptions options) = 0 private: class FeatureControlInterfacePrivate* const d; }; } Q_DECLARE_INTERFACE(KTextEditor::FeatureControlInterface, "org.kde.KTextEditor.FeatureControlInterface") #endif // kate: space-indent on; indent-width 2; replace-tabs on; --Boundary-00=_rx35Ht918j5WiQk Content-Type: text/x-c++hdr; charset="utf-8"; name="actionaccessinterface.h" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="actionaccessinterface.h" /* This file is part of the KDE libraries Copyright (C) 2008 Michel Ludwig This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. 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 GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KDELIBS_KTEXTEDITOR_ACTIONACCESSINTERFACE_H #define KDELIBS_KTEXTEDITOR_ACTIONACCESSINTERFACE_H #include class KConfigGroup; #include namespace KTextEditor { /** * \brief Action types. */ namespace ActionAccess { /** * \brief A type representing specific actions. * */ enum ActionType { Save = 0, ///< "Save" action SaveAs = 1 << 0 ///< "Save As" action }; /** * \brief A type representing sets of actions. * */ enum ActionSetType { Spellchecking = 0 ///< All the actions related to spell checking }; } /** * \brief Action access interface extension for the View. * * \ingroup kte_group_view_extensions * * \section actionaccess_intro Introduction * * The ActionAccessInterface is an extension for Views which allows access to the QAction objects * used by the View for specific tasks. * * \section actionaccess_support Adding Action Access Support * * To add support for action access a KTextEditor implementation has to derive the * View class from ActionAccessInterface and reimplement the purely virtual methods defined * in this interfaces. * * \section actionaccess_access Accessing the ActionAccessInterface * * The ActionAccessInterface is supposed to be an extension interface for a View, i.e. the * View inherits the interface \e provided that it implements the interface. Use qobject_cast to * access the implementation: * \code * // object is of type KTextEditor::View* * KTextEditor::ActionAccessInterface *iface = * qobject_cast( object ); * * if( iface ) { * // interface is supported * // do stuff * } * \endcode * * \see KTextEditor::View, QAction * \author Michel Ludwig \ */ class KTEXTEDITOR_EXPORT ActionAccessInterface { public: /** * Constructor. */ ActionAccessInterface(); /** * Virtual destructor. */ virtual ~ActionAccessInterface() {} public: /** * Get the pointer to the QAction object associated to the task \p type. * * \param type Considered action task * \return Pointer to the QAction object representing \p type, or * NULL if the task \p type is not implemented in the view */ virtual QAction* getAction(ActionAccess::ActionType type) = 0;# /** * Get the list of pointers to the QAction objects associated to the * task \p type. * * \param type Considered action task * \return List of pointers to the QAction objects representing * \p type, or an empty list if the task \p type is not * implemented in the view */ virtual QList getActions(ActionAccess::ActionSetType type) = 0; private: class ActionAccessInterfacePrivate* const d; }; } Q_DECLARE_INTERFACE(KTextEditor::ActionAccessInterface, "org.kde.KTextEditor.ActionAccessInterface") #endif // kate: space-indent on; indent-width 2; replace-tabs on; --Boundary-00=_rx35Ht918j5WiQk Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ KTextEditor-Devel mailing list KTextEditor-Devel@kde.org https://mail.kde.org/mailman/listinfo/ktexteditor-devel --Boundary-00=_rx35Ht918j5WiQk--