|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (developer.feedback@nokia.com) |
|
6 ** |
|
7 ** This file is part of the HbWidgets module of the UI Extensions for Mobile. |
|
8 ** |
|
9 ** GNU Lesser General Public License Usage |
|
10 ** This file may be used under the terms of the GNU Lesser General Public |
|
11 ** License version 2.1 as published by the Free Software Foundation and |
|
12 ** appearing in the file LICENSE.LGPL included in the packaging of this file. |
|
13 ** Please review the following information to ensure the GNU Lesser General |
|
14 ** Public License version 2.1 requirements will be met: |
|
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
16 ** |
|
17 ** In addition, as a special exception, Nokia gives you certain additional |
|
18 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
20 ** |
|
21 ** If you have questions regarding the use of this file, please contact |
|
22 ** Nokia at developer.feedback@nokia.com. |
|
23 ** |
|
24 ****************************************************************************/ |
|
25 |
|
26 #ifndef HBDATETIMEPICKER_H |
|
27 #define HBDATETIMEPICKER_H |
|
28 |
|
29 #include <hbwidget.h> |
|
30 |
|
31 #include <QString> |
|
32 |
|
33 class HbDateTimePickerPrivate; |
|
34 |
|
35 class HB_WIDGETS_EXPORT HbDateTimePicker : public HbWidget |
|
36 { |
|
37 Q_OBJECT |
|
38 Q_PROPERTY(QString displayFormat READ displayFormat WRITE setDisplayFormat) |
|
39 Q_PROPERTY(QDate date READ date WRITE setDate) |
|
40 Q_PROPERTY(QDateTime dateTime READ dateTime WRITE setDateTime) |
|
41 Q_PROPERTY(QTime time READ time WRITE setTime) |
|
42 Q_PROPERTY(QDate minimumDate READ minimumDate WRITE setMinimumDate) |
|
43 Q_PROPERTY(QDate maximumDate READ maximumDate WRITE setMaximumDate) |
|
44 Q_PROPERTY(QTime minimumTime READ minimumTime WRITE setMinimumTime) |
|
45 Q_PROPERTY(QTime maximumTime READ maximumTime WRITE setMaximumTime) |
|
46 Q_PROPERTY(QDateTime minimumDateTime READ minimumDateTime WRITE setMinimumDateTime) |
|
47 Q_PROPERTY(QDateTime maximumDateTime READ maximumDateTime WRITE setMaximumDateTime) |
|
48 |
|
49 public: |
|
50 explicit HbDateTimePicker(QGraphicsItem *parent = 0); |
|
51 explicit HbDateTimePicker(const QDateTime & datetime, QGraphicsItem * parent = 0); |
|
52 explicit HbDateTimePicker(const QDate & date, QGraphicsItem * parent = 0); |
|
53 explicit HbDateTimePicker(const QTime & time, QGraphicsItem * parent = 0); |
|
54 ~HbDateTimePicker(); |
|
55 |
|
56 QString displayFormat() const; |
|
57 void setDisplayFormat(const QString &displayFormat); |
|
58 |
|
59 QDate date() const; |
|
60 |
|
61 QDate minimumDate()const; |
|
62 void setMinimumDate(const QDate &date); |
|
63 |
|
64 QDate maximumDate()const; |
|
65 void setMaximumDate(const QDate &date); |
|
66 |
|
67 void setDateRange(const QDate &minDate, const QDate &maxDate); |
|
68 |
|
69 QDateTime dateTime()const; |
|
70 |
|
71 QDateTime minimumDateTime()const; |
|
72 void setMinimumDateTime(const QDateTime &date); |
|
73 |
|
74 QDateTime maximumDateTime()const; |
|
75 void setMaximumDateTime(const QDateTime &date); |
|
76 |
|
77 void setDateTimeRange(const QDateTime &minDateTime, const QDateTime &maxDateTime); |
|
78 |
|
79 QTime time() const; |
|
80 |
|
81 QTime minimumTime()const; |
|
82 void setMinimumTime(const QTime &date); |
|
83 |
|
84 QTime maximumTime()const; |
|
85 void setMaximumTime(const QTime &date); |
|
86 |
|
87 void setTimeRange(const QTime &minTime, const QTime &maxTime); |
|
88 |
|
89 enum { Type = Hb::ItemType_DateTimePicker }; |
|
90 int type() const { return Type; } |
|
91 |
|
92 QGraphicsItem *primitive(HbStyle::Primitive primitive) const; |
|
93 |
|
94 void setGeometry(const QRectF &rect); |
|
95 |
|
96 public slots: |
|
97 void setDate(const QDate &date); |
|
98 void setDateTime(const QDateTime &datetime); |
|
99 void setTime(const QTime&); |
|
100 void updatePrimitives(); |
|
101 |
|
102 signals: |
|
103 void dateChanged(const QDate &date); |
|
104 void dateTimeChanged(const QDateTime &dateTime); |
|
105 void timeChanged(const QTime &time); |
|
106 |
|
107 protected: |
|
108 HbDateTimePicker(HbDateTimePickerPrivate &dd, QGraphicsItem *parent = 0); |
|
109 bool event(QEvent *e); |
|
110 |
|
111 private: |
|
112 Q_DISABLE_COPY(HbDateTimePicker) |
|
113 Q_DECLARE_PRIVATE_D(d_ptr, HbDateTimePicker) |
|
114 Q_PRIVATE_SLOT(d_func(), void _q_dayChanged(int index)) |
|
115 Q_PRIVATE_SLOT(d_func(), void _q_monthChanged(int index)) |
|
116 Q_PRIVATE_SLOT(d_func(), void _q_yearChanged(int index)) |
|
117 Q_PRIVATE_SLOT(d_func(), void _q_hoursChanged(int index)) |
|
118 Q_PRIVATE_SLOT(d_func(), void _q_minutesChanged(int index)) |
|
119 Q_PRIVATE_SLOT(d_func(), void _q_secondsChanged(int index)) |
|
120 Q_PRIVATE_SLOT(d_func(), void _q_ampmChanged(int index)) |
|
121 }; |
|
122 |
|
123 #endif //HBDATETIMEPICKER_H |