File indexing completed on 2024-05-19 05:08:27

0001 /*
0002     SPDX-FileCopyrightText: 2015-2019 Thomas Baumgart <tbaumgart@kde.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef SPECIALDATEDELEGATE_H
0007 #define SPECIALDATEDELEGATE_H
0008 
0009 // ----------------------------------------------------------------------------
0010 // QT Includes
0011 
0012 class QColor;
0013 
0014 // ----------------------------------------------------------------------------
0015 // KDE Includes
0016 
0017 // ----------------------------------------------------------------------------
0018 // Project Includes
0019 
0020 #include "mymoneyenums.h"
0021 #include "kmmstyleditemdelegate.h"
0022 
0023 class LedgerView;
0024 class MyMoneyMoney;
0025 
0026 class SpecialDateDelegate : public KMMStyledItemDelegate
0027 {
0028     Q_OBJECT
0029 public:
0030     explicit SpecialDateDelegate(LedgerView* parent = 0);
0031     virtual ~SpecialDateDelegate();
0032 
0033     void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const final override;
0034     QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const final override;
0035 
0036     void setOnlineBalance(const QDate& date, const MyMoneyMoney& amount, int fraction = 0);
0037 
0038     /**
0039      * Which data (@a role) shall be displayed in the detail column
0040      * when only a single line is shown. The default is the payee.
0041      */
0042     void setSingleLineRole(eMyMoney::Model::Roles role);
0043 
0044 
0045 protected:
0046     bool eventFilter(QObject* o, QEvent* event) final override;
0047 
0048 private:
0049     class Private;
0050     Private * const d;
0051 
0052     static QColor m_separatorColor;
0053 };
0054 
0055 #endif // SPECIALDATEDELEGATE_H
0056