1 /* 2 * This file is part of Licq, an instant messaging client for UNIX. 3 * Copyright (C) 2007-2009 Licq developers 4 * 5 * Licq is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * Licq is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with Licq; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 */ 19 20 #ifndef CALENDARWIDGET_H 21 #define CALENDARWIDGET_H 22 23 #include "config.h" 24 25 #include <QCalendarWidget> 26 #include <QDate> 27 #include <QList> 28 29 namespace LicqQtGui 30 { 31 32 /** 33 * A calendar widget extended with function to mark dates 34 */ 35 class Calendar : public QCalendarWidget 36 { 37 Q_OBJECT 38 39 public: 40 /** 41 * Contstructor 42 * 43 * @param parent Parent widget 44 */ 45 Calendar(QWidget* parent = 0); 46 47 /** 48 * Destructor 49 */ ~Calendar()50 virtual ~Calendar() {} 51 52 /** 53 * Mark a date in the calendar 54 * 55 * @param date Date to mark 56 */ 57 void markDate(const QDate& date); 58 59 /** 60 * Mark a search match in the calendar 61 * Note: Date must already be marked with markDate() 62 * 63 * @param date Date of the match 64 */ 65 void addMatch(const QDate& date); 66 67 /** 68 * Clear all search matches 69 */ 70 void clearMatches(); 71 72 protected: 73 /** 74 * Draw contents of a date cell in the calendar 75 * 76 * @param painter Painter object 77 * @param rect Cell area to draw in 78 * @param date Date to draw 79 */ 80 virtual void paintCell(QPainter* painter, const QRect& rect, const QDate& date) const; 81 82 private: 83 QList<QDate> myMatches; 84 }; 85 86 } // namespace LicqQtGui 87 88 #endif 89