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: CalenMonthGrid class definition. |
14 * Description: Grid of month view. |
15 * |
15 * |
16 */ |
16 */ |
|
17 |
|
18 |
17 |
19 |
18 #ifndef CALENMONTHGRID_H |
20 #ifndef CALENMONTHGRID_H |
19 #define CALENMONTHGRID_H |
21 #define CALENMONTHGRID_H |
20 |
22 |
21 // System includes |
23 // INCLUDES |
22 #include <hbview.h> |
24 #include <AknGrid.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> |
|
30 |
25 |
31 // Forward declarations |
26 class CCalenMonthContainer; |
32 class QStandardItemModel; |
|
33 class CalenGridItemPrototype; |
|
34 class CalenMonthData; |
|
35 class CalenMonthView; |
|
36 |
27 |
37 #ifdef CALENVIEWS_DLL |
28 // CLASS DECLARATION |
38 #define CALENGRID_EXPORT Q_DECL_EXPORT |
|
39 #else |
|
40 #define CALENGRID_EXPORT Q_DECL_IMPORT |
|
41 #endif |
|
42 |
29 |
43 // enums |
30 /** |
44 enum scrollDirection{ |
31 * Grid of month view |
45 up, |
32 */ |
46 down, |
33 NONSHARABLE_CLASS( CCalenMonthGrid ) : public CAknGrid |
47 invalid |
34 { |
48 }; |
35 public: // Constructors and destructor |
49 |
36 |
50 class CALENGRID_EXPORT CalenMonthGrid : public HbGridView |
37 /** |
51 { |
38 * C++ constructor. |
52 Q_OBJECT |
39 * @param aFirstDayOfGrid first day of grid |
|
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); |
53 |
57 |
54 public: |
58 protected: // From CAknGrid |
55 CalenMonthGrid(QGraphicsItem *parent = NULL); |
59 /** |
56 ~CalenMonthGrid(); |
60 * From CAknGrid Creates CFormattedCellListBoxItemDrawer, |
57 void setView(CalenMonthView *view); |
61 * actually CCalenMonthCellListBoxItemDrawer. |
58 void updateMonthGridModel(QList<CalenMonthData> &monthDataArray, |
62 */ |
59 int indexToBeScrolled, bool isFirstTime); |
63 void CreateItemDrawerL(); |
60 void updateMonthGridWithInActiveMonths( |
|
61 QList<CalenMonthData> &monthDataArray); |
|
62 void updateMonthGridWithEventIndicators( |
|
63 QList<CalenMonthData> &monthDataArray); |
|
64 void setCurrentIdex(int index); |
|
65 int getCurrentIndex(); |
|
66 |
64 |
67 protected: |
65 /** |
68 void orientationChanged(Qt::Orientation newOrientation); |
66 * Override default scrollbar implementation to prevent scrollbar |
69 void gestureEvent(QGestureEvent *event); |
67 * to be drawn. |
70 |
68 */ |
71 private: |
69 void UpdateScrollBarsL(); |
72 void downGesture(); |
|
73 void upGesture(); |
|
74 void handlePrependingRows(QList<CalenMonthData > &monthDataList); |
|
75 void handleAppendingRows(QList<CalenMonthData > &monthDataList); |
|
76 void handlePanGestureFinished(); |
|
77 void mousePressEvent(QGraphicsSceneMouseEvent* event); |
|
78 void mouseReleaseEvent(QGraphicsSceneMouseEvent* event); |
|
79 void setFocusToProperDay(); |
|
80 void setActiveDates(QDate activeDate); |
|
81 void paint(QPainter* painter, |
|
82 const QStyleOptionGraphicsItem* option, QWidget* widget); |
|
83 |
|
84 public slots: |
|
85 void scrollingFinished(); |
|
86 void prependRows(); |
|
87 void appendRows(); |
|
88 void itemActivated(const QModelIndex &index); |
|
89 |
70 |
90 private slots: |
71 private: // new data |
|
72 |
|
73 /** |
|
74 * From CCoeControl drawing month view |
|
75 */ |
|
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 |
91 |
87 |
92 void handleThemeChange(); |
88 }; |
93 |
|
94 private: |
|
95 QStandardItemModel *mModel; |
|
96 scrollDirection mDirection; |
|
97 bool mIsPanGesture; |
|
98 bool mIsAtomicScroll; |
|
99 CalenMonthView *mView; |
|
100 int mCurrentRow; |
|
101 bool mIsNonActiveDayFocused; |
|
102 bool mIgnoreItemActivated; |
|
103 QPointF mPressedPos; |
|
104 QGraphicsWidget* mContentWidget; |
|
105 QList<QString> mLocalisedDates; |
|
106 QPointF mStartPos; |
|
107 QColor mGridLineColor; |
|
108 bool mActiveDatesSet; |
|
109 }; |
|
110 |
89 |
111 #endif // CALENMONTHGRID_H |
90 #endif // CALENMONTHGRID_H |
112 |
91 |
113 // End of file --Don't remove this. |
92 |
|
93 // End of File |