File indexing completed on 2024-05-12 09:57:14
0001 /* 0002 SPDX-FileCopyrightText: 2020-2020 Gustavo Carneiro <gcarneiroa@hotmail.com> 0003 SPDX-FileCopyrightText: 2012-2020 Kurt Hindenburg <kurt.hindenburg@gmail.com> 0004 SPDX-FileCopyrightText: 2020-2020 Tomaz Canabrava <tcanabrava@kde.org> 0005 0006 SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #ifndef KONSOLEPRINTMANAGER_H 0010 #define KONSOLEPRINTMANAGER_H 0011 0012 #include <functional> 0013 0014 class QFont; 0015 class QRect; 0016 class QColor; 0017 class QPoint; 0018 class QWidget; 0019 class QPainter; 0020 0021 namespace Konsole 0022 { 0023 class KonsolePrintManager 0024 { 0025 public: 0026 typedef std::function<void(QPainter &, bool)> pPrintContent; 0027 typedef std::function<QFont()> pVTFontGet; 0028 typedef std::function<void(const QFont)> pVTFontSet; 0029 typedef std::function<void(QPainter &painter, const QRect &rect, const QColor &backgroundColor, bool useOpacitySetting)> pDrawBackground; 0030 typedef std::function<void(QPainter &paint, const QRect &rect, bool friendly)> pDrawContents; 0031 typedef std::function<QColor()> pColorGet; 0032 0033 KonsolePrintManager(pDrawBackground drawBackground, pDrawContents drawContents, pColorGet colorGet); 0034 ~KonsolePrintManager() = default; 0035 0036 void printRequest(pPrintContent pContent, QWidget *parent); 0037 void printContent(QPainter &painter, bool friendly, QPoint columnsLines, pVTFontGet vtFontGet, pVTFontSet vtFontSet); 0038 0039 private: 0040 pDrawBackground _drawBackground; 0041 pDrawContents _drawContents; 0042 pColorGet _backgroundColor; 0043 }; 0044 } 0045 0046 #endif