Changeset View
Changeset View
Standalone View
Standalone View
src/include/ktexteditor/markinterface.h
Show All 21 Lines | |||||
22 | #ifndef KTEXTEDITOR_MARKINTERFACE_H | 22 | #ifndef KTEXTEDITOR_MARKINTERFACE_H | ||
23 | #define KTEXTEDITOR_MARKINTERFACE_H | 23 | #define KTEXTEDITOR_MARKINTERFACE_H | ||
24 | 24 | | |||
25 | #include <ktexteditor_export.h> | 25 | #include <ktexteditor_export.h> | ||
26 | 26 | | |||
27 | #include <QHash> | 27 | #include <QHash> | ||
28 | #include <QObject> | 28 | #include <QObject> | ||
29 | 29 | | |||
30 | class QIcon; | ||||
30 | class QPixmap; | 31 | class QPixmap; | ||
31 | class QPoint; | 32 | class QPoint; | ||
32 | class QMenu; | 33 | class QMenu; | ||
33 | 34 | | |||
34 | namespace KTextEditor | 35 | namespace KTextEditor | ||
35 | { | 36 | { | ||
36 | class Document; | 37 | class Document; | ||
37 | 38 | | |||
▲ Show 20 Lines • Show All 353 Lines • ▼ Show 20 Line(s) | 366 | Q_SIGNALS: | |||
391 | * \param handled set this to 'true' if this event was handled externally, and kate should not do own handling of the left click. | 392 | * \param handled set this to 'true' if this event was handled externally, and kate should not do own handling of the left click. | ||
392 | */ | 393 | */ | ||
393 | void markClicked(KTextEditor::Document *document, KTextEditor::Mark mark, bool &handled); | 394 | void markClicked(KTextEditor::Document *document, KTextEditor::Mark mark, bool &handled); | ||
394 | 395 | | |||
395 | private: | 396 | private: | ||
396 | class MarkInterfacePrivate *const d = nullptr; | 397 | class MarkInterfacePrivate *const d = nullptr; | ||
397 | }; | 398 | }; | ||
398 | 399 | | |||
400 | /** | ||||
401 | * \brief Mark extension interface for the Document, version 2 | ||||
402 | * | ||||
403 | * \ingroup kte_group_doc_extensions | ||||
404 | * | ||||
405 | * \section markextv2_intro Introduction | ||||
406 | * | ||||
407 | * The MarkInterfaceV2 allows to do the same as MarkInterface | ||||
408 | * and additionally | ||||
409 | * - (1) set an icon for a mark type instead of just a pixmap | ||||
410 | * | ||||
411 | * \section markextv2_access Accessing the Interface | ||||
412 | * | ||||
413 | * The MarkInterfaceV2 is supposed to be an extension interface for a Document, | ||||
414 | * i.e. the Document inherits the interface \e provided that the | ||||
415 | * KTextEditor library in use implements the interface. Use qobject_cast to access | ||||
416 | * the interface: | ||||
417 | * \code | ||||
418 | * // doc is of type KTextEditor::Document* | ||||
419 | * auto iface = qobject_cast<KTextEditor::MarkInterfaceV2*>(doc); | ||||
420 | * | ||||
421 | * if (iface) { | ||||
422 | * // the implementation supports the interface | ||||
423 | * // do stuff | ||||
424 | * } else { | ||||
425 | * // the implementation does not support the interface | ||||
426 | * } | ||||
427 | * \endcode | ||||
428 | * | ||||
429 | * \since 5.69 | ||||
430 | */ | ||||
431 | class KTEXTEDITOR_EXPORT MarkInterfaceV2 : public MarkInterface | ||||
432 | { | ||||
433 | // KF6: Merge KTextEditor::MarkInterfaceV2 into KTextEditor::MarkInterface, drop QPixmap API (kossebau) | ||||
434 | public: | ||||
435 | virtual ~MarkInterfaceV2() | ||||
436 | { | ||||
437 | } | ||||
438 | | ||||
439 | /** | ||||
440 | * Set the \p mark's icon to \p icon. | ||||
441 | * \param markType mark type to which the icon will be attached | ||||
442 | * \param icon new icon | ||||
443 | * \see setMarkDescription() | ||||
444 | */ | ||||
445 | virtual void setMarkIcon(MarkTypes markType, const QIcon &icon) = 0; | ||||
446 | | ||||
447 | /** | ||||
448 | * Get the \p mark's icon. | ||||
449 | * \param markType mark type. If the icon does not exist the resulting is null | ||||
450 | * (check with QIcon::isNull()). | ||||
451 | * \see setMarkDescription() | ||||
452 | */ | ||||
453 | virtual QIcon markIcon(MarkTypes markType) const = 0; | ||||
454 | }; | ||||
455 | | ||||
399 | } | 456 | } | ||
400 | 457 | | |||
401 | Q_DECLARE_INTERFACE(KTextEditor::MarkInterface, "org.kde.KTextEditor.MarkInterface") | 458 | Q_DECLARE_INTERFACE(KTextEditor::MarkInterface, "org.kde.KTextEditor.MarkInterface") | ||
459 | Q_DECLARE_INTERFACE(KTextEditor::MarkInterfaceV2, "org.kde.KTextEditor.MarkInterfaceV2") | ||||
402 | 460 | | |||
403 | #endif | 461 | #endif |