1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date        : 1997-04-21
7  * Description : Date selection table.
8  *
9  * Copyright (C) 2011-2021 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 1997      by Tim D. Gilman <tdgilman at best dot org>
11  * Copyright (C) 1998-2001 by Mirko Boehm <mirko at kde dot org>
12  * Copyright (C) 2007      by John Layt <john at layt dot net>
13  *
14  * This program is free software; you can redistribute it
15  * and/or modify it under the terms of the GNU General
16  * Public License as published by the Free Software Foundation;
17  * either version 2, or (at your option)
18  * any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23  * GNU General Public License for more details.
24  *
25  * ============================================================ */
26 
27 #ifndef DIGIKAM_DDATE_TABLE_PRIVATE_H
28 #define DIGIKAM_DDATE_TABLE_PRIVATE_H
29 
30 #include "ddatetable.h"
31 
32 // C++ includes
33 
34 #include <cmath>
35 
36 // Qt includes
37 
38 #include <QObject>
39 #include <QColor>
40 #include <QDate>
41 #include <QRectF>
42 #include <QHash>
43 
44 namespace Digikam
45 {
46 
47 class Q_DECL_HIDDEN DDateTable::Private : public QObject
48 {
49     Q_OBJECT
50 
51 public:
52 
53     class Q_DECL_HIDDEN DatePaintingMode
54     {
55     public:
56 
57         QColor         fgColor;
58         QColor         bgColor;
59         BackgroundMode bgMode;
60     };
61 
62 public:
63 
64     explicit Private(DDateTable* const qq);
65     ~Private() override;
66 
67 public Q_SLOTS:
68 
69     void setDate(const QDate&);
70     void nextMonth();
71     void previousMonth();
72     void beginningOfMonth();
73     void endOfMonth();
74     void beginningOfWeek();
75     void endOfWeek();
76 
77 public:
78 
79     DDateTable*                   q;
80 
81     /**
82      * The currently selected date.
83      */
84     QDate                         date;
85 
86     /**
87      * The weekday number of the first day in the month [1..daysInWeek()].
88      */
89     int                           weekDayFirstOfMonth;
90 
91     /**
92      * The number of days in the current month.
93      */
94     int                           numDaysThisMonth;
95 
96     /**
97      * Save the size of the largest used cell content.
98      */
99     QRectF                        maxCell;
100 
101     /**
102      * How many week rows we are to draw.
103      */
104     int                           numWeekRows;
105 
106     /**
107      * How many day columns we are to draw, i.e. days in a week.
108      */
109     int                           numDayColumns;
110 
111     /**
112      * The font size of the displayed text.
113      */
114     int                           fontsize;
115 
116     bool                          popupMenuEnabled;
117     bool                          useCustomColors;
118 
119     QHash <int, DatePaintingMode> customPaintingModes;
120 
121     int                           hoveredPos;
122 };
123 
124 } // namespace Digikam
125 
126 #endif // DIGIKAM_DDATE_TABLE_PRIVATE_H
127