Warning, file /frameworks/ktexteditor/src/include/ktexteditor/inlinenoteinterface.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2018 Sven Brauch <mail@svenbrauch.de> 0003 SPDX-FileCopyrightText: 2018 Michal Srb <michalsrb@gmail.com> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef KTEXTEDITOR_INLINENOTEINTERFACE_H 0009 #define KTEXTEDITOR_INLINENOTEINTERFACE_H 0010 0011 #include <QString> 0012 0013 #include <ktexteditor_export.h> 0014 0015 #include <ktexteditor/cursor.h> 0016 #include <ktexteditor/view.h> 0017 0018 class QPainter; 0019 0020 namespace KTextEditor 0021 { 0022 class InlineNoteProvider; 0023 0024 /** 0025 * @class InlineNoteInterface inlinenoteinterface.h <KTextEditor/InlineNoteInterface> 0026 * 0027 * @brief Inline notes interface for rendering notes in the text. 0028 * 0029 * @ingroup kte_group_view_extensions 0030 * 0031 * @section inlinenote_introduction Introduction 0032 * 0033 * The inline notes interface provides a way to render arbitrary things in 0034 * the text. The text layout of the line is adapted to create space for the 0035 * note. Possible applications include showing a name of a function parameter 0036 * in a function call or rendering a square with a color preview next to CSS 0037 * color property. 0038 * 0039 * \image html inlinenote.png "Inline note showing a CSS color preview" 0040 * 0041 * To register as inline note provider, call registerInlineNoteProvider() with 0042 * an instance that inherits InlineNoteProvider. Finally, make sure you remove 0043 * your inline note provider by calling unregisterInlineNoteProvider(). 0044 * 0045 * @section inlinenote_access Accessing the InlineNoteInterface 0046 * 0047 * The InlineNoteInterface is an extension interface for a 0048 * View, i.e. the View inherits the interface. Use qobject_cast to access the 0049 * interface: 0050 * @code 0051 * // view is of type KTextEditor::View* 0052 * auto iface = qobject_cast<KTextEditor::InlineNoteInterface*>(view); 0053 * 0054 * if (iface) { 0055 * // the implementation supports the interface 0056 * // myProvider inherits KTextEditor::InlineNoteProvider 0057 * iface->registerInlineNoteProvider(myProvider); 0058 * } else { 0059 * // the implementation does not support the interface 0060 * } 0061 * @endcode 0062 * 0063 * @see InlineNoteProvider 0064 * @see InlineNote 0065 * 0066 * @author Sven Brauch, Michal Srb 0067 * @since 5.50 0068 */ 0069 class KTEXTEDITOR_EXPORT InlineNoteInterface 0070 { 0071 public: 0072 InlineNoteInterface(); 0073 virtual ~InlineNoteInterface(); 0074 0075 /** 0076 * Register the inline note provider @p provider. 0077 * 0078 * Whenever a line is painted, the @p provider will be queried for notes 0079 * that should be painted in it. When the provider is about to be 0080 * destroyed, make sure to call unregisterInlineNoteProvider() to avoid a 0081 * dangling pointer. 0082 * 0083 * @param provider inline note provider 0084 * @see unregisterInlineNoteProvider(), InlineNoteProvider 0085 */ 0086 virtual void registerInlineNoteProvider(KTextEditor::InlineNoteProvider *provider) = 0; 0087 0088 /** 0089 * Unregister the inline note provider @p provider. 0090 * 0091 * @param provider inline note provider to unregister 0092 * @see registerInlineNoteProvider(), InlineNoteProvider 0093 */ 0094 virtual void unregisterInlineNoteProvider(KTextEditor::InlineNoteProvider *provider) = 0; 0095 }; 0096 0097 } 0098 0099 Q_DECLARE_INTERFACE(KTextEditor::InlineNoteInterface, "org.kde.KTextEditor.InlineNoteInterface") 0100 0101 #endif