1 /* |
1 /* |
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
8 * |
8 * |
9 * Initial Contributors: |
9 * Initial Contributors: |
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: Day view container - parent widget for events (CalenDayItem) and |
14 * Description: Day view container - parent widget for events (CalenDayItem) and |
15 * hours area widgets (CalenDayEventsPane) |
15 * hours area widgets (CalenDayEventsPane) |
16 * Responsible for positioning and resizing events widgets. |
16 * Responsible for positioning and resizing events widgets. |
17 * |
17 * |
18 */ |
18 */ |
19 |
19 |
20 #ifndef CALENDAYCONTAINER_H |
20 #ifndef CALENDAYCONTAINER_H |
21 #define CALENDAYCONTAINER_H |
21 #define CALENDAYCONTAINER_H |
22 |
22 |
23 //System includes |
23 // System includes |
24 #include <QDateTime> |
24 #include <QDateTime> |
25 #include "../../../../../mw/hb/src/hbwidgets/itemviews/hbabstractitemcontainer_p.h" |
25 #include "../../../../../mw/hb/src/hbwidgets/itemviews/hbabstractitemcontainer_p.h" |
26 |
26 |
27 |
27 // Forward declarations |
28 //Forward declarations |
|
29 class CalenDayInfo; |
28 class CalenDayInfo; |
30 class TouchEventAbsorber; |
29 class TouchEventAbsorber; |
31 |
30 |
|
31 // Class declaration |
32 class CalenDayContainer : public HbAbstractItemContainer |
32 class CalenDayContainer : public HbAbstractItemContainer |
33 { |
33 { |
34 Q_OBJECT |
34 Q_OBJECT |
35 |
35 |
36 public: |
36 public: |
37 CalenDayContainer(QGraphicsItem *parent = 0); |
37 CalenDayContainer(QGraphicsItem *parent = 0); |
38 ~CalenDayContainer(); |
38 ~CalenDayContainer(); |
39 |
39 |
40 void itemAdded (int index, HbAbstractViewItem *item, bool animate); |
40 void itemAdded(int index, HbAbstractViewItem *item, bool animate); |
41 void itemRemoved (HbAbstractViewItem *item, bool animate); |
41 void itemRemoved(HbAbstractViewItem *item, bool animate); |
42 void reset(); |
42 void reset(); |
43 void viewResized (const QSizeF &size); |
43 void viewResized(const QSizeF &size); |
44 |
|
45 void setDayInfo( CalenDayInfo* dayInfo ); |
|
46 |
44 |
47 void setDate( const QDate &date ); |
45 void setDayInfo(CalenDayInfo* dayInfo); |
|
46 CalenDayInfo* dayInfo(); |
|
47 void setDate(const QDate &date); |
48 const QDate &date() const; |
48 const QDate &date() const; |
49 |
49 |
50 public slots: |
50 public slots: |
51 void orientationChanged(Qt::Orientation orientation); |
51 void orientationChanged(Qt::Orientation orientation); |
52 |
52 |
53 protected: |
53 protected: |
54 HbAbstractViewItem * createDefaultPrototype() const; |
54 HbAbstractViewItem * createDefaultPrototype() const; |
55 void setItemModelIndex(HbAbstractViewItem *item, const QModelIndex &index); |
55 void setItemModelIndex(HbAbstractViewItem *item, const QModelIndex &index); |
56 |
56 |
57 void updateTimedEventGeometry(HbAbstractViewItem *item, |
57 void updateTimedEventGeometry( |
58 const QModelIndex &index); |
58 HbAbstractViewItem *item, |
59 void updateAllDayEventGeometry(HbAbstractViewItem *item, |
59 const QModelIndex &index); |
60 const QModelIndex &index); |
60 void updateAllDayEventGeometry( |
|
61 HbAbstractViewItem *item, |
|
62 const QModelIndex &index); |
61 |
63 |
62 /*! |
64 /*! |
63 \class LayoutValues |
65 \class LayoutValues |
64 \brief Structure with event layout values. |
66 \brief Structure with event layout values. |
65 |
67 |
67 eventAreaWidth The width of event area. |
69 eventAreaWidth The width of event area. |
68 eventMargin Margins between the multiple events. |
70 eventMargin Margins between the multiple events. |
69 slotHeight Half hour slot's height. |
71 slotHeight Half hour slot's height. |
70 unitInPixels No. of pixels in 1un |
72 unitInPixels No. of pixels in 1un |
71 maxColumns Max. no. of touchable overlapping timed events |
73 maxColumns Max. no. of touchable overlapping timed events |
72 |
|
73 */ |
74 */ |
74 class LayoutValues { |
75 class LayoutValues |
75 public: |
76 { |
76 LayoutValues() |
77 public: |
77 :eventAreaX(0), |
78 LayoutValues() : |
78 eventAreaWidth(0), |
79 eventAreaX(0), eventAreaWidth(0), eventMargin(0), slotHeight(0), |
79 eventMargin(0), |
80 unitInPixels(0), maxColumns(0) |
80 slotHeight(0), |
81 { |
81 unitInPixels(0), |
82 } |
82 maxColumns(0) |
83 |
83 {} |
84 qreal eventAreaX; |
84 qreal eventAreaX; |
85 qreal eventAreaWidth; |
85 qreal eventAreaWidth; |
86 qreal eventMargin; |
86 qreal eventMargin; |
87 qreal slotHeight; |
87 qreal slotHeight; |
88 qreal unitInPixels; |
88 qreal unitInPixels; |
89 int maxColumns; |
89 int maxColumns; |
|
90 }; |
90 }; |
91 |
91 |
92 void getTimedEventLayoutValues(LayoutValues& layoutValues); |
92 void getTimedEventLayoutValues(LayoutValues& layoutValues); |
93 void createTouchEventAbsorbers(); |
93 void createTouchEventAbsorbers(); |
94 TouchEventAbsorber* crateAbsorberBetweenSlots(int startSlot, int endSlot, bool forAllDayEvents); |
94 TouchEventAbsorber* crateAbsorberBetweenSlots( |
95 |
95 int startSlot, |
|
96 int endSlot, |
|
97 bool forAllDayEvents); |
|
98 |
96 private: |
99 private: |
97 bool mGeometryUpdated; |
100 bool mGeometryUpdated; //!< Indicates if geometry needs to be updated |
98 |
101 CalenDayInfo* mInfo; //!< Day event info. Not owned. |
99 CalenDayInfo* mInfo; //!<Day event info. Not owned. |
102 LayoutValues mLayoutValues; //!< Keeps layout values, see LayoutValues class |
100 LayoutValues mLayoutValues; //!<Keeps layout values, see LayoutValues class |
103 QList<TouchEventAbsorber*> mAbsorbers; //!< Keeps needed touch absorbers |
101 QList<TouchEventAbsorber*> mAbsorbers; //!<Keeps needed touch absorbers. |
104 QDate mDate; //!< Keeps date currently associated with this container |
102 QDate mDate; //!<Keeps date currently associated with this container. |
|
103 }; |
105 }; |
104 |
106 |
105 |
107 |
106 |
108 |
107 /*! |
109 /*! |
108 \class TouchEventAbsorber |
110 \class TouchEventAbsorber |
109 \brief TouchEventAbsorber objects are used to catch touch events. |
111 \brief TouchEventAbsorber objects are used to catch touch events. |
110 \brief Used when event widgets are to small (see UI spec.) |
112 \brief Used when event widgets are to small (see UI spec.) |
111 */ |
113 */ |
112 class TouchEventAbsorber : public HbWidget |
114 class TouchEventAbsorber : public HbWidget |
113 { |
115 { |
114 Q_OBJECT |
116 Q_OBJECT |
115 public: |
117 |
116 TouchEventAbsorber(QGraphicsItem *parent=0); |
118 public: |
117 ~TouchEventAbsorber(); |
119 TouchEventAbsorber(QGraphicsItem *parent = 0); |
118 protected: |
120 ~TouchEventAbsorber(); |
119 void gestureEvent(QGestureEvent *event); |
121 |
120 |
122 protected: |
|
123 void gestureEvent(QGestureEvent *event); |
|
124 |
121 #ifdef _DEBUG |
125 #ifdef _DEBUG |
122 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, |
126 void paint( |
123 QWidget *widget); |
127 QPainter *painter, |
|
128 const QStyleOptionGraphicsItem *option, |
|
129 QWidget *widget); |
124 #endif |
130 #endif |
125 }; |
131 }; |
126 |
132 |
127 #endif // CALENDAYCONTAINER_H |
133 #endif // CALENDAYCONTAINER_H |
128 // End of File |
134 // End of File |