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: Grid of month view. |
14 * Description: CalenMonthGrid class definition. |
15 * |
15 * |
16 */ |
16 */ |
17 |
|
18 |
|
19 |
17 |
20 #ifndef CALENMONTHGRID_H |
18 #ifndef CALENMONTHGRID_H |
21 #define CALENMONTHGRID_H |
19 #define CALENMONTHGRID_H |
22 |
20 |
23 // INCLUDES |
21 // System includes |
24 #include <AknGrid.h> |
22 #include <hbview.h> |
|
23 #include <QGraphicsWidget> |
|
24 #include <QAbstractItemModel> |
|
25 #include <QtGui> |
|
26 #include <hbgridviewitem.h> |
|
27 #include <hbgridview.h> |
|
28 #include <hbframebackground.h> |
|
29 #include <hbframedrawer.h> |
25 |
30 |
26 class CCalenMonthContainer; |
31 // Forward declarations |
|
32 class QStandardItemModel; |
|
33 class CalenGridItemPrototype; |
|
34 class CalenMonthData; |
|
35 class CalenMonthView; |
27 |
36 |
28 // CLASS DECLARATION |
37 #ifdef CALENVIEWS_DLL |
|
38 #define CALENGRID_EXPORT Q_DECL_EXPORT |
|
39 #else |
|
40 #define CALENGRID_EXPORT Q_DECL_IMPORT |
|
41 #endif |
29 |
42 |
30 /** |
43 // enums |
31 * Grid of month view |
44 enum scrollDirection{ |
32 */ |
45 up, |
33 NONSHARABLE_CLASS( CCalenMonthGrid ) : public CAknGrid |
46 down, |
34 { |
47 invalid |
35 public: // Constructors and destructor |
48 }; |
36 |
49 |
37 /** |
50 class CALENGRID_EXPORT CalenMonthGrid : public HbGridView |
38 * C++ constructor. |
51 { |
39 * @param aFirstDayOfGrid first day of grid |
52 Q_OBJECT |
40 */ |
|
41 CCalenMonthGrid(TTime aFirstDayOfGrid, CCalenMonthContainer* aMonthCont); |
|
42 /** |
|
43 * Destructor. |
|
44 */ |
|
45 virtual ~CCalenMonthGrid(); |
|
46 public: // new functions |
|
47 /** |
|
48 * Return first day of grid |
|
49 * @return first day of grid |
|
50 */ |
|
51 TTime FirstDayOfGrid(); |
|
52 /** |
|
53 * Set argument aDay to first day of Grid |
|
54 * @param aDay New first day of grid |
|
55 */ |
|
56 void SetFirstDayOfGrid(TTime aDay); |
|
57 |
53 |
58 protected: // From CAknGrid |
54 public: |
59 /** |
55 CalenMonthGrid(QGraphicsItem *parent = NULL); |
60 * From CAknGrid Creates CFormattedCellListBoxItemDrawer, |
56 ~CalenMonthGrid(); |
61 * actually CCalenMonthCellListBoxItemDrawer. |
57 void setView(CalenMonthView *view); |
62 */ |
58 void updateMonthGridModel(QList<CalenMonthData> &monthDataArray, |
63 void CreateItemDrawerL(); |
59 int indexToBeScrolled); |
|
60 void setCurrentIdex(int index); |
|
61 int getCurrentIndex(); |
64 |
62 |
65 /** |
63 protected: |
66 * Override default scrollbar implementation to prevent scrollbar |
64 void orientationChanged(Qt::Orientation newOrientation); |
67 * to be drawn. |
65 |
68 */ |
66 private: |
69 void UpdateScrollBarsL(); |
67 void mousePressEvent(QGraphicsSceneMouseEvent* event); |
|
68 void mouseReleaseEvent(QGraphicsSceneMouseEvent* event); |
|
69 void setFocusToProperDay(); |
|
70 void setActiveDates(QDateTime activeDate); |
|
71 |
|
72 public slots: |
|
73 void scrollingFinished(); |
|
74 void prependRows(); |
|
75 void appendRows(); |
|
76 void itemActivated(const QModelIndex &index); |
70 |
77 |
71 private: // new data |
78 protected slots: |
72 |
79 void downGesture(int value); |
73 /** |
80 void upGesture(int value); |
74 * From CCoeControl drawing month view |
81 void panGesture(const QPointF &delta); |
75 */ |
82 void timerExpired(); |
76 void Draw(const TRect& /*aRect*/) const; |
|
77 |
|
78 /** |
|
79 * Draw secondary grid lines. |
|
80 */ |
|
81 void DrawGridLines() const; |
|
82 |
|
83 TTime iFirstDayOfGrid; |
|
84 |
|
85 CCalenMonthContainer* iMonthContainer; |
|
86 |
|
87 |
83 |
88 }; |
84 private: |
|
85 QStandardItemModel *mModel; |
|
86 QList<CalenMonthData> mMonthDataArray; |
|
87 scrollDirection mDirection; |
|
88 bool mIsPanGesture; |
|
89 bool mIsAtomicScroll; |
|
90 CalenMonthView *mView; |
|
91 int mCurrentRow; |
|
92 bool mIsNonActiveDayFocused; |
|
93 QDateTime mNonActiveFocusedDay; |
|
94 bool mIgnoreItemActivated; |
|
95 QPointF mPressedPos; |
|
96 }; |
89 |
97 |
90 #endif // CALENMONTHGRID_H |
98 #endif // CALENMONTHGRID_H |
91 |
99 |
92 |
100 // End of file --Don't remove this. |
93 // End of File |
|