File indexing completed on 2024-06-02 04:08:34

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 1997-04-21
0007  * Description : Date selection table.
0008  *
0009  * SPDX-FileCopyrightText: 2011-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  * SPDX-FileCopyrightText: 1997      by Tim D. Gilman <tdgilman at best dot org>
0011  * SPDX-FileCopyrightText: 1998-2001 by Mirko Boehm <mirko at kde dot org>
0012  * SPDX-FileCopyrightText: 2007      by John Layt <john at layt dot net>
0013  *
0014  * SPDX-License-Identifier: GPL-2.0-or-later
0015  *
0016  * ============================================================ */
0017 
0018 #ifndef DIGIKAM_DDATE_TABLE_PRIVATE_H
0019 #define DIGIKAM_DDATE_TABLE_PRIVATE_H
0020 
0021 #include "ddatetable.h"
0022 
0023 // C++ includes
0024 
0025 #include <cmath>
0026 
0027 // Qt includes
0028 
0029 #include <QObject>
0030 #include <QColor>
0031 #include <QDate>
0032 #include <QRectF>
0033 #include <QHash>
0034 
0035 namespace Digikam
0036 {
0037 
0038 class Q_DECL_HIDDEN DDateTable::Private : public QObject
0039 {
0040     Q_OBJECT
0041 
0042 public:
0043 
0044     class Q_DECL_HIDDEN DatePaintingMode
0045     {
0046     public:
0047 
0048         QColor         fgColor;
0049         QColor         bgColor;
0050         BackgroundMode bgMode;
0051     };
0052 
0053 public:
0054 
0055     explicit Private(DDateTable* const qq);
0056     ~Private() override;
0057 
0058 public Q_SLOTS:
0059 
0060     void setDate(const QDate&);
0061     void nextMonth();
0062     void previousMonth();
0063     void beginningOfMonth();
0064     void endOfMonth();
0065     void beginningOfWeek();
0066     void endOfWeek();
0067 
0068 public:
0069 
0070     DDateTable*                   q;
0071 
0072     /**
0073      * The currently selected date.
0074      */
0075     QDate                         date;
0076 
0077     /**
0078      * The weekday number of the first day in the month [1..daysInWeek()].
0079      */
0080     int                           weekDayFirstOfMonth;
0081 
0082     /**
0083      * The number of days in the current month.
0084      */
0085     int                           numDaysThisMonth;
0086 
0087     /**
0088      * Save the size of the largest used cell content.
0089      */
0090     QRectF                        maxCell;
0091 
0092     /**
0093      * How many week rows we are to draw.
0094      */
0095     int                           numWeekRows;
0096 
0097     /**
0098      * How many day columns we are to draw, i.e. days in a week.
0099      */
0100     int                           numDayColumns;
0101 
0102     /**
0103      * The font size of the displayed text.
0104      */
0105     int                           fontsize;
0106 
0107     bool                          popupMenuEnabled;
0108     bool                          useCustomColors;
0109 
0110     QHash <int, DatePaintingMode> customPaintingModes;
0111 
0112     int                           hoveredPos;
0113 };
0114 
0115 } // namespace Digikam
0116 
0117 #endif // DIGIKAM_DDATE_TABLE_PRIVATE_H