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