root/trunk/qt4-gui/src/widgets/calendar.h

Revision 6448, 1.9 kB (checked in by flynd, 5 months ago)

Searching in history dialog will now mark all dates with matching entries in green.

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