author | zautrix <zautrix> | 2005-02-16 22:38:07 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-16 22:38:07 (UTC) |
commit | 0eca506b6b4c7d7ef52bcecc5ad64193698dc3f3 (patch) (unidiff) | |
tree | 5bc6d924f1a71cc04cb8f1ee0001fce7cde0fa71 /libkdepim/kdatepicker.h | |
parent | f33a37a0f7c9b37cfea1346ed373ce1c27c1d6ba (diff) | |
download | kdepimpi-0eca506b6b4c7d7ef52bcecc5ad64193698dc3f3.zip kdepimpi-0eca506b6b4c7d7ef52bcecc5ad64193698dc3f3.tar.gz kdepimpi-0eca506b6b4c7d7ef52bcecc5ad64193698dc3f3.tar.bz2 |
added today but to datepicker
-rw-r--r-- | libkdepim/kdatepicker.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libkdepim/kdatepicker.h b/libkdepim/kdatepicker.h index 6625357..3db9a89 100644 --- a/libkdepim/kdatepicker.h +++ b/libkdepim/kdatepicker.h | |||
@@ -1,181 +1,183 @@ | |||
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 <qframe.h> |
24 | #include <qevent.h> | 24 | #include <qevent.h> |
25 | 25 | ||
26 | class QLineEdit; | 26 | class QLineEdit; |
27 | class QToolButton; | 27 | class QToolButton; |
28 | class KDateValidator; | 28 | class KDateValidator; |
29 | class KDateTable; | 29 | class KDateTable; |
30 | class KDateEdit; | 30 | class KDateEdit; |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * Provides a widget for calendar date input. | 33 | * Provides a widget for calendar date input. |
34 | * | 34 | * |
35 | * Different from the | 35 | * Different from the |
36 | * previous versions, it now emits two types of signals, either | 36 | * previous versions, it now emits two types of signals, either |
37 | * @ref dateSelected() or @ref dateEntered() (see documentation for both | 37 | * @ref dateSelected() or @ref dateEntered() (see documentation for both |
38 | * signals). | 38 | * signals). |
39 | * | 39 | * |
40 | * A line edit has been added in the newer versions to allow the user | 40 | * 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 | 41 | * to select a date directly by entering numbers like 19990101 |
42 | * or 990101. | 42 | * or 990101. |
43 | * | 43 | * |
44 | * @image kdatepicker.png KDatePicker | 44 | * @image kdatepicker.png KDatePicker |
45 | * | 45 | * |
46 | * @version $Id$ | 46 | * @version $Id$ |
47 | * @author Tim Gilman, Mirko Boehm | 47 | * @author Tim Gilman, Mirko Boehm |
48 | * | 48 | * |
49 | * @short A date selection widget. | 49 | * @short A date selection widget. |
50 | **/ | 50 | **/ |
51 | class KDatePicker: public QFrame | 51 | class KDatePicker: public QFrame |
52 | { | 52 | { |
53 | Q_OBJECT | 53 | Q_OBJECT |
54 | public: | 54 | public: |
55 | /** The usual constructor. The given date will be displayed | 55 | /** The usual constructor. The given date will be displayed |
56 | * initially. | 56 | * initially. |
57 | **/ | 57 | **/ |
58 | KDatePicker(QWidget *parent=0, | 58 | KDatePicker(QWidget *parent=0, |
59 | QDate=QDate::currentDate(), | 59 | QDate=QDate::currentDate(), |
60 | const char *name=0); | 60 | const char *name=0); |
61 | /** | 61 | /** |
62 | * The destructor. | 62 | * The destructor. |
63 | **/ | 63 | **/ |
64 | virtual ~KDatePicker(); | 64 | virtual ~KDatePicker(); |
65 | 65 | ||
66 | /** The size hint for date pickers. The size hint recommends the | 66 | /** The size hint for date pickers. The size hint recommends the |
67 | * minimum size of the widget so that all elements may be placed | 67 | * minimum size of the widget so that all elements may be placed |
68 | * without clipping. This sometimes looks ugly, so when using the | 68 | * without clipping. This sometimes looks ugly, so when using the |
69 | * size hint, try adding 28 to each of the reported numbers of | 69 | * size hint, try adding 28 to each of the reported numbers of |
70 | * pixels. | 70 | * pixels. |
71 | **/ | 71 | **/ |
72 | QSize sizeHint() const; | 72 | QSize sizeHint() const; |
73 | 73 | ||
74 | /** | 74 | /** |
75 | * Sets the date. | 75 | * Sets the date. |
76 | * | 76 | * |
77 | * @returns @p false and does not change anything | 77 | * @returns @p false and does not change anything |
78 | * if the date given is invalid. | 78 | * if the date given is invalid. |
79 | **/ | 79 | **/ |
80 | bool setDate(const QDate&); | 80 | bool setDate(const QDate&); |
81 | 81 | ||
82 | /** | 82 | /** |
83 | * Returns the selected date. | 83 | * Returns the selected date. |
84 | * @deprecated | 84 | * @deprecated |
85 | **/ | 85 | **/ |
86 | const QDate& getDate() const; | 86 | const QDate& getDate() const; |
87 | 87 | ||
88 | /** | 88 | /** |
89 | * @returns the selected date. | 89 | * @returns the selected date. |
90 | */ | 90 | */ |
91 | const QDate &date() const; | 91 | const QDate &date() const; |
92 | 92 | ||
93 | /** | 93 | /** |
94 | * Enables or disables the widget. | 94 | * Enables or disables the widget. |
95 | **/ | 95 | **/ |
96 | void setEnabled(bool); | 96 | void setEnabled(bool); |
97 | 97 | ||
98 | /** | 98 | /** |
99 | * Sets the font size of the widgets elements. | 99 | * Sets the font size of the widgets elements. |
100 | **/ | 100 | **/ |
101 | void setFontSize(int); | 101 | void setFontSize(int); |
102 | /** | 102 | /** |
103 | * Returns the font size of the widget elements. | 103 | * Returns the font size of the widget elements. |
104 | */ | 104 | */ |
105 | int fontSize() const | 105 | int fontSize() const |
106 | { return fontsize; } | 106 | { return fontsize; } |
107 | protected: | 107 | protected: |
108 | /// the resize event | 108 | /// the resize event |
109 | void resizeEvent(QResizeEvent*); | 109 | void resizeEvent(QResizeEvent*); |
110 | QToolButton *todayBut; | ||
110 | /// the year forward button | 111 | /// the year forward button |
111 | QToolButton *yearForward; | 112 | QToolButton *yearForward; |
112 | /// the year backward button | 113 | /// the year backward button |
113 | QToolButton *yearBackward; | 114 | QToolButton *yearBackward; |
114 | /// the month forward button | 115 | /// the month forward button |
115 | QToolButton *monthForward; | 116 | QToolButton *monthForward; |
116 | /// the month backward button | 117 | /// the month backward button |
117 | QToolButton *monthBackward; | 118 | QToolButton *monthBackward; |
118 | /// the button for selecting the month directly | 119 | /// the button for selecting the month directly |
119 | QToolButton *selectMonth; | 120 | QToolButton *selectMonth; |
120 | /// the button for selecting the year directly | 121 | /// the button for selecting the year directly |
121 | QToolButton *selectYear; | 122 | QToolButton *selectYear; |
122 | /// the line edit to enter the date directly | 123 | /// the line edit to enter the date directly |
123 | //QLineEdit *line; | 124 | //QLineEdit *line; |
124 | KDateEdit *lineDate; | 125 | KDateEdit *lineDate; |
125 | /// the validator for the line edit: | 126 | /// the validator for the line edit: |
126 | KDateValidator *val; | 127 | KDateValidator *val; |
127 | /// the date table | 128 | /// the date table |
128 | KDateTable *table; | 129 | KDateTable *table; |
129 | /// the size calculated during resize events | 130 | /// the size calculated during resize events |
130 | // QSize sizehint; | 131 | // QSize sizehint; |
131 | /// the widest month string in pixels: | 132 | /// the widest month string in pixels: |
132 | QSize maxMonthRect; | 133 | QSize maxMonthRect; |
133 | protected slots: | 134 | protected slots: |
134 | void dateChangedSlot(QDate); | 135 | void dateChangedSlot(QDate); |
135 | void tableClickedSlot(); | 136 | void tableClickedSlot(); |
136 | void monthForwardClicked(); | 137 | void monthForwardClicked(); |
137 | void monthBackwardClicked(); | 138 | void monthBackwardClicked(); |
138 | void yearForwardClicked(); | 139 | void yearForwardClicked(); |
139 | void yearBackwardClicked(); | 140 | void yearBackwardClicked(); |
140 | void selectMonthClicked(); | 141 | void selectMonthClicked(); |
141 | void selectYearClicked(); | 142 | void selectYearClicked(); |
142 | void lineEnterPressed(); | 143 | void lineEnterPressed(); |
143 | void slotSetDate(QDate); | 144 | void slotSetDate(QDate); |
145 | void goToday(); | ||
144 | signals: | 146 | signals: |
145 | /** This signal is emitted each time the selected date is changed. | 147 | /** This signal is emitted each time the selected date is changed. |
146 | * Usually, this does not mean that the date has been entered, | 148 | * Usually, this does not mean that the date has been entered, |
147 | * since the date also changes, for example, when another month is | 149 | * since the date also changes, for example, when another month is |
148 | * selected. | 150 | * selected. |
149 | * @see dateSelected | 151 | * @see dateSelected |
150 | */ | 152 | */ |
151 | void dateChanged(QDate); | 153 | void dateChanged(QDate); |
152 | /** This signal is emitted each time a day has been selected by | 154 | /** This signal is emitted each time a day has been selected by |
153 | * clicking on the table (hitting a day in the current month). It | 155 | * clicking on the table (hitting a day in the current month). It |
154 | * has the same meaning as dateSelected() in older versions of | 156 | * has the same meaning as dateSelected() in older versions of |
155 | * KDatePicker. | 157 | * KDatePicker. |
156 | */ | 158 | */ |
157 | void dateSelected(QDate); | 159 | void dateSelected(QDate); |
158 | /** This signal is emitted when enter is pressed and a VALID date | 160 | /** This signal is emitted when enter is pressed and a VALID date |
159 | * has been entered before into the line edit. Connect to both | 161 | * has been entered before into the line edit. Connect to both |
160 | * dateEntered() and dateSelected() to receive all events where the | 162 | * dateEntered() and dateSelected() to receive all events where the |
161 | * user really enters a date. | 163 | * user really enters a date. |
162 | */ | 164 | */ |
163 | void dateEntered(QDate); | 165 | void dateEntered(QDate); |
164 | /** This signal is emitted when the day has been selected by | 166 | /** This signal is emitted when the day has been selected by |
165 | * clicking on it in the table. | 167 | * clicking on it in the table. |
166 | */ | 168 | */ |
167 | void tableClicked(); | 169 | void tableClicked(); |
168 | 170 | ||
169 | private: | 171 | private: |
170 | /// the font size for the widget | 172 | /// the font size for the widget |
171 | int fontsize; | 173 | int fontsize; |
172 | 174 | ||
173 | protected: | 175 | protected: |
174 | virtual void virtual_hook( int id, void* data ); | 176 | virtual void virtual_hook( int id, void* data ); |
175 | private: | 177 | private: |
176 | class KDatePickerPrivate; | 178 | class KDatePickerPrivate; |
177 | KDatePickerPrivate *d; | 179 | KDatePickerPrivate *d; |
178 | void keyPressEvent ( QKeyEvent * ) ; | 180 | void keyPressEvent ( QKeyEvent * ) ; |
179 | }; | 181 | }; |
180 | 182 | ||
181 | #endif // KDATEPICKER_H | 183 | #endif // KDATEPICKER_H |