calendarui/views/inc/calenmonthgrid.h
branchRCL_3
changeset 29 12af337248b1
parent 0 f979ecb2b13e
child 30 bd7edf625bdd
equal deleted inserted replaced
28:96907930389d 29:12af337248b1
     1 /*
     1 /*
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2009 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".
     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, bool isFirstTime);
       
    60 	void updateMonthGridWithInActiveMonths(
       
    61 										QList<CalenMonthData> &monthDataArray);
       
    62 	void updateMonthGridWithEventIndicators(
       
    63 										QList<CalenMonthData> &monthDataArray);
       
    64 	void setCurrentIdex(int index);
       
    65 	int getCurrentIndex();
    64 
    66 
    65     /**
    67 protected:
    66      * Override default scrollbar implementation to prevent scrollbar 
    68 	void orientationChanged(Qt::Orientation newOrientation);
    67      * to be drawn.
    69 	void gestureEvent(QGestureEvent *event);
    68      */
    70 		
    69     void UpdateScrollBarsL();
    71 private:
       
    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);
    70 
    89 
    71 private: // new data
    90 private slots:
    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      
       
    87 
    91 
    88     };
    92 	void handleThemeChange();
       
    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 };
    89 
   110 
    90 #endif // CALENMONTHGRID_H
   111 #endif // CALENMONTHGRID_H
    91 
   112 
    92 
   113 // End of file  --Don't remove this.
    93 // End of File