-rw-r--r-- | libkdepim/kdatepicker.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libkdepim/kdatepicker.h b/libkdepim/kdatepicker.h index 3db9a89..4d904da 100644 --- a/libkdepim/kdatepicker.h +++ b/libkdepim/kdatepicker.h | |||
@@ -1,183 +1,186 @@ | |||
1 | /* -*- C++ -*- | 1 | /* -*- C++ -*- |
2 | This file is part of the KDE libraries | 2 | This file is part of the KDE libraries |
3 | Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org) | 3 | Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org) |
4 | (C) 1998-2001 Mirko Boehm (mirko@kde.org) | 4 | (C) 1998-2001 Mirko Boehm (mirko@kde.org) |
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | #ifndef MICROKDE_KDATEPICKER_H | 20 | #ifndef MICROKDE_KDATEPICKER_H |
21 | #define MICROKDE_KDATEPICKER_H | 21 | #define MICROKDE_KDATEPICKER_H |
22 | #include <qdatetime.h> | 22 | #include <qdatetime.h> |
23 | #include <qframe.h> | 23 | #include <q3frame.h> |
24 | #include <qevent.h> | 24 | #include <qevent.h> |
25 | //Added by qt3to4: | ||
26 | #include <QResizeEvent> | ||
27 | #include <QKeyEvent> | ||
25 | 28 | ||
26 | class QLineEdit; | 29 | class QLineEdit; |
27 | class QToolButton; | 30 | class QToolButton; |
28 | class KDateValidator; | 31 | class KDateValidator; |
29 | class KDateTable; | 32 | class KDateTable; |
30 | class KDateEdit; | 33 | class KDateEdit; |
31 | 34 | ||
32 | /** | 35 | /** |
33 | * Provides a widget for calendar date input. | 36 | * Provides a widget for calendar date input. |
34 | * | 37 | * |
35 | * Different from the | 38 | * Different from the |
36 | * previous versions, it now emits two types of signals, either | 39 | * previous versions, it now emits two types of signals, either |
37 | * @ref dateSelected() or @ref dateEntered() (see documentation for both | 40 | * @ref dateSelected() or @ref dateEntered() (see documentation for both |
38 | * signals). | 41 | * signals). |
39 | * | 42 | * |
40 | * A line edit has been added in the newer versions to allow the user | 43 | * A line edit has been added in the newer versions to allow the user |
41 | * to select a date directly by entering numbers like 19990101 | 44 | * to select a date directly by entering numbers like 19990101 |
42 | * or 990101. | 45 | * or 990101. |
43 | * | 46 | * |
44 | * @image kdatepicker.png KDatePicker | 47 | * @image kdatepicker.png KDatePicker |
45 | * | 48 | * |
46 | * @version $Id$ | 49 | * @version $Id$ |
47 | * @author Tim Gilman, Mirko Boehm | 50 | * @author Tim Gilman, Mirko Boehm |
48 | * | 51 | * |
49 | * @short A date selection widget. | 52 | * @short A date selection widget. |
50 | **/ | 53 | **/ |
51 | class KDatePicker: public QFrame | 54 | class KDatePicker: public Q3Frame |
52 | { | 55 | { |
53 | Q_OBJECT | 56 | Q_OBJECT |
54 | public: | 57 | public: |
55 | /** The usual constructor. The given date will be displayed | 58 | /** The usual constructor. The given date will be displayed |
56 | * initially. | 59 | * initially. |
57 | **/ | 60 | **/ |
58 | KDatePicker(QWidget *parent=0, | 61 | KDatePicker(QWidget *parent=0, |
59 | QDate=QDate::currentDate(), | 62 | QDate=QDate::currentDate(), |
60 | const char *name=0); | 63 | const char *name=0); |
61 | /** | 64 | /** |
62 | * The destructor. | 65 | * The destructor. |
63 | **/ | 66 | **/ |
64 | virtual ~KDatePicker(); | 67 | virtual ~KDatePicker(); |
65 | 68 | ||
66 | /** The size hint for date pickers. The size hint recommends the | 69 | /** The size hint for date pickers. The size hint recommends the |
67 | * minimum size of the widget so that all elements may be placed | 70 | * minimum size of the widget so that all elements may be placed |
68 | * without clipping. This sometimes looks ugly, so when using the | 71 | * without clipping. This sometimes looks ugly, so when using the |
69 | * size hint, try adding 28 to each of the reported numbers of | 72 | * size hint, try adding 28 to each of the reported numbers of |
70 | * pixels. | 73 | * pixels. |
71 | **/ | 74 | **/ |
72 | QSize sizeHint() const; | 75 | QSize sizeHint() const; |
73 | 76 | ||
74 | /** | 77 | /** |
75 | * Sets the date. | 78 | * Sets the date. |
76 | * | 79 | * |
77 | * @returns @p false and does not change anything | 80 | * @returns @p false and does not change anything |
78 | * if the date given is invalid. | 81 | * if the date given is invalid. |
79 | **/ | 82 | **/ |
80 | bool setDate(const QDate&); | 83 | bool setDate(const QDate&); |
81 | 84 | ||
82 | /** | 85 | /** |
83 | * Returns the selected date. | 86 | * Returns the selected date. |
84 | * @deprecated | 87 | * @deprecated |
85 | **/ | 88 | **/ |
86 | const QDate& getDate() const; | 89 | const QDate& getDate() const; |
87 | 90 | ||
88 | /** | 91 | /** |
89 | * @returns the selected date. | 92 | * @returns the selected date. |
90 | */ | 93 | */ |
91 | const QDate &date() const; | 94 | const QDate &date() const; |
92 | 95 | ||
93 | /** | 96 | /** |
94 | * Enables or disables the widget. | 97 | * Enables or disables the widget. |
95 | **/ | 98 | **/ |
96 | void setEnabled(bool); | 99 | void setEnabled(bool); |
97 | 100 | ||
98 | /** | 101 | /** |
99 | * Sets the font size of the widgets elements. | 102 | * Sets the font size of the widgets elements. |
100 | **/ | 103 | **/ |
101 | void setFontSize(int); | 104 | void setFontSize(int); |
102 | /** | 105 | /** |
103 | * Returns the font size of the widget elements. | 106 | * Returns the font size of the widget elements. |
104 | */ | 107 | */ |
105 | int fontSize() const | 108 | int fontSize() const |
106 | { return fontsize; } | 109 | { return fontsize; } |
107 | protected: | 110 | protected: |
108 | /// the resize event | 111 | /// the resize event |
109 | void resizeEvent(QResizeEvent*); | 112 | void resizeEvent(QResizeEvent*); |
110 | QToolButton *todayBut; | 113 | QToolButton *todayBut; |
111 | /// the year forward button | 114 | /// the year forward button |
112 | QToolButton *yearForward; | 115 | QToolButton *yearForward; |
113 | /// the year backward button | 116 | /// the year backward button |
114 | QToolButton *yearBackward; | 117 | QToolButton *yearBackward; |
115 | /// the month forward button | 118 | /// the month forward button |
116 | QToolButton *monthForward; | 119 | QToolButton *monthForward; |
117 | /// the month backward button | 120 | /// the month backward button |
118 | QToolButton *monthBackward; | 121 | QToolButton *monthBackward; |
119 | /// the button for selecting the month directly | 122 | /// the button for selecting the month directly |
120 | QToolButton *selectMonth; | 123 | QToolButton *selectMonth; |
121 | /// the button for selecting the year directly | 124 | /// the button for selecting the year directly |
122 | QToolButton *selectYear; | 125 | QToolButton *selectYear; |
123 | /// the line edit to enter the date directly | 126 | /// the line edit to enter the date directly |
124 | //QLineEdit *line; | 127 | //QLineEdit *line; |
125 | KDateEdit *lineDate; | 128 | KDateEdit *lineDate; |
126 | /// the validator for the line edit: | 129 | /// the validator for the line edit: |
127 | KDateValidator *val; | 130 | KDateValidator *val; |
128 | /// the date table | 131 | /// the date table |
129 | KDateTable *table; | 132 | KDateTable *table; |
130 | /// the size calculated during resize events | 133 | /// the size calculated during resize events |
131 | // QSize sizehint; | 134 | // QSize sizehint; |
132 | /// the widest month string in pixels: | 135 | /// the widest month string in pixels: |
133 | QSize maxMonthRect; | 136 | QSize maxMonthRect; |
134 | protected slots: | 137 | protected slots: |
135 | void dateChangedSlot(QDate); | 138 | void dateChangedSlot(QDate); |
136 | void tableClickedSlot(); | 139 | void tableClickedSlot(); |
137 | void monthForwardClicked(); | 140 | void monthForwardClicked(); |
138 | void monthBackwardClicked(); | 141 | void monthBackwardClicked(); |
139 | void yearForwardClicked(); | 142 | void yearForwardClicked(); |
140 | void yearBackwardClicked(); | 143 | void yearBackwardClicked(); |
141 | void selectMonthClicked(); | 144 | void selectMonthClicked(); |
142 | void selectYearClicked(); | 145 | void selectYearClicked(); |
143 | void lineEnterPressed(); | 146 | void lineEnterPressed(); |
144 | void slotSetDate(QDate); | 147 | void slotSetDate(QDate); |
145 | void goToday(); | 148 | void goToday(); |
146 | signals: | 149 | signals: |
147 | /** This signal is emitted each time the selected date is changed. | 150 | /** This signal is emitted each time the selected date is changed. |
148 | * Usually, this does not mean that the date has been entered, | 151 | * Usually, this does not mean that the date has been entered, |
149 | * since the date also changes, for example, when another month is | 152 | * since the date also changes, for example, when another month is |
150 | * selected. | 153 | * selected. |
151 | * @see dateSelected | 154 | * @see dateSelected |
152 | */ | 155 | */ |
153 | void dateChanged(QDate); | 156 | void dateChanged(QDate); |
154 | /** This signal is emitted each time a day has been selected by | 157 | /** This signal is emitted each time a day has been selected by |
155 | * clicking on the table (hitting a day in the current month). It | 158 | * clicking on the table (hitting a day in the current month). It |
156 | * has the same meaning as dateSelected() in older versions of | 159 | * has the same meaning as dateSelected() in older versions of |
157 | * KDatePicker. | 160 | * KDatePicker. |
158 | */ | 161 | */ |
159 | void dateSelected(QDate); | 162 | void dateSelected(QDate); |
160 | /** This signal is emitted when enter is pressed and a VALID date | 163 | /** This signal is emitted when enter is pressed and a VALID date |
161 | * has been entered before into the line edit. Connect to both | 164 | * has been entered before into the line edit. Connect to both |
162 | * dateEntered() and dateSelected() to receive all events where the | 165 | * dateEntered() and dateSelected() to receive all events where the |
163 | * user really enters a date. | 166 | * user really enters a date. |
164 | */ | 167 | */ |
165 | void dateEntered(QDate); | 168 | void dateEntered(QDate); |
166 | /** This signal is emitted when the day has been selected by | 169 | /** This signal is emitted when the day has been selected by |
167 | * clicking on it in the table. | 170 | * clicking on it in the table. |
168 | */ | 171 | */ |
169 | void tableClicked(); | 172 | void tableClicked(); |
170 | 173 | ||
171 | private: | 174 | private: |
172 | /// the font size for the widget | 175 | /// the font size for the widget |
173 | int fontsize; | 176 | int fontsize; |
174 | 177 | ||
175 | protected: | 178 | protected: |
176 | virtual void virtual_hook( int id, void* data ); | 179 | virtual void virtual_hook( int id, void* data ); |
177 | private: | 180 | private: |
178 | class KDatePickerPrivate; | 181 | class KDatePickerPrivate; |
179 | KDatePickerPrivate *d; | 182 | KDatePickerPrivate *d; |
180 | void keyPressEvent ( QKeyEvent * ) ; | 183 | void keyPressEvent ( QKeyEvent * ) ; |
181 | }; | 184 | }; |
182 | 185 | ||
183 | #endif // KDATEPICKER_H | 186 | #endif // KDATEPICKER_H |