calendarui/views/dayview/inc/calendaycontainer.h
changeset 58 ef813d54df51
parent 50 579cc610882e
--- a/calendarui/views/dayview/inc/calendaycontainer.h	Tue Jul 06 14:14:56 2010 +0300
+++ b/calendarui/views/dayview/inc/calendaycontainer.h	Wed Aug 18 09:47:38 2010 +0300
@@ -1,191 +1,134 @@
 /*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Day view control of calendar
-*
-*/
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Day view container - parent widget for events (CalenDayItem) and
+ * hours area widgets (CalenDayEventsPane)
+ * Responsible for positioning and resizing events widgets.
+ *
+ */
 
 #ifndef CALENDAYCONTAINER_H
 #define CALENDAYCONTAINER_H
 
-//System includes
+// System includes
 #include <QDateTime>
-
 #include "../../../../../mw/hb/src/hbwidgets/itemviews/hbabstractitemcontainer_p.h"
 
-//User includes
-
-//Forward declarations
+// Forward declarations
 class CalenDayInfo;
 class TouchEventAbsorber;
 
+// Class declaration
 class CalenDayContainer : public HbAbstractItemContainer
 {
     Q_OBJECT
 
 public:
-    
-    /**
-     * Constructor. 
-     */
     CalenDayContainer(QGraphicsItem *parent = 0);
-
-    /**
-     * Destructor.
-     */
     ~CalenDayContainer();
 
-    /**
-     * 
-     */
-    void itemAdded (int index, HbAbstractViewItem *item, bool animate);
-    
-    /**
-     * 
-     */
-    void itemRemoved (HbAbstractViewItem *item, bool animate);
-    
-    /**
-     * 
-     */
+    void itemAdded(int index, HbAbstractViewItem *item, bool animate);
+    void itemRemoved(HbAbstractViewItem *item, bool animate);
     void reset();
-    
-    /**
-     * 
-     */
-    void viewResized (const QSizeF &size);
-    
-    /**
-     * Sets day's info structer to the container.
-     * 
-     * @param dayInfo Day info.
-     */
-    void setDayInfo( CalenDayInfo* dayInfo );
-    
+    void viewResized(const QSizeF &size);
+
+    void setDayInfo(CalenDayInfo* dayInfo);
+    CalenDayInfo* dayInfo();
+    void setDate(const QDate &date);
+    const QDate &date() const;
+
 public slots:
+    void orientationChanged(Qt::Orientation orientation);
 
-    /**
-     * Slot handles layout switch.
-     * @param orientation Current device orientation
-     */
-    void orientationChanged(Qt::Orientation orientation);
-    
 protected:
-
-    /**
-     * 
-     */
     HbAbstractViewItem * createDefaultPrototype() const;
-    
-    /**
-     * 
-     */
     void setItemModelIndex(HbAbstractViewItem *item, const QModelIndex &index);
-    
-    /**
-     * Updates geometry of a timed event.
-     */
-    void updateTimedEventGeometry(HbAbstractViewItem *item, 
-                                  const QModelIndex &index);
-    
-    /**
-     * Updates geometry of a all-day events	
+
+    void updateTimedEventGeometry(
+        HbAbstractViewItem *item,
+        const QModelIndex &index);
+    void updateAllDayEventGeometry(
+        HbAbstractViewItem *item,
+        const QModelIndex &index);
+
+    /*!
+     \class LayoutValues
+     \brief Structure with event layout values.
+     
+     eventAreaX X value for event area start.
+     eventAreaWidth The width of event area.
+     eventMargin Margins between the multiple events.
+     slotHeight Half hour slot's height.
+     unitInPixels No. of pixels in 1un
+     maxColumns Max. no. of touchable overlapping timed events
      */
-    void updateAllDayEventGeometry(HbAbstractViewItem *item, 
-                                  const QModelIndex &index);
-    
-    /**
-     * Structure with event layout values.
-     * 
-     * eventAreaX X value for event area start.
-     * eventAreaWidth The width of event area.
-     * eventMargin Margins between the multiple events.
-     * slotHeight Half hour slot's height.
-     * unitInPixels no. of pixels in 1un
-     */
+    class LayoutValues
+    {
+    public:
+        LayoutValues() :
+            eventAreaX(0), eventAreaWidth(0), eventMargin(0), slotHeight(0),
+                unitInPixels(0), maxColumns(0)
+        {
+        }
 
-    struct LayoutValues {
-					LayoutValues()
-						:eventAreaX(0),
-						 eventAreaWidth(0),
-						 eventMargin(0),
-						 slotHeight(0),
-						 unitInPixels(0),
-						 maxColumns(0)
-						 {}
-						
-    	qreal eventAreaX;
-    	qreal eventAreaWidth;
-    	qreal eventMargin;
-    	qreal slotHeight;
-    	qreal unitInPixels;
-    	int maxColumns;
+        qreal eventAreaX;
+        qreal eventAreaWidth;
+        qreal eventMargin;
+        qreal slotHeight;
+        qreal unitInPixels;
+        int maxColumns;
     };
-    
-    /**
-     * Gets event layout values.
-     * 
-     * @param layoutValues structure to be filled with layout data
-     */
+
     void getTimedEventLayoutValues(LayoutValues& layoutValues);
-    
-    
-    /**
-     *  creates absorbers which prevent touching to small items
-     *  (according to UI spec items smaller than ... are untouchable)
-     */
     void createTouchEventAbsorbers();
-    
-    /**
-     * 
-     */
-    TouchEventAbsorber* crateAbsorberBetweenSlots(int startSlot, int endSlot);
-    
-private:
-    
-    bool mGeometryUpdated;
+    TouchEventAbsorber* crateAbsorberBetweenSlots(
+        int startSlot,
+        int endSlot,
+        bool forAllDayEvents);
 
-    QDateTime mDateTime;
-    
-    /**
-     * Day event info.
-     * Not own.
-     */
-    CalenDayInfo* mInfo;
-    
-    LayoutValues mLayoutValues;
-    QList<TouchEventAbsorber*> mAbsorbers;
+private:
+    bool mGeometryUpdated;  //!< Indicates if geometry needs to be updated
+    CalenDayInfo* mInfo; //!< Day event info. Not owned.
+    LayoutValues mLayoutValues; //!< Keeps layout values, see LayoutValues class
+    QList<TouchEventAbsorber*> mAbsorbers; //!< Keeps needed touch absorbers
+    QDate mDate; //!< Keeps date currently associated with this container
 };
 
 
 
+/*!
+ \class TouchEventAbsorber
+ \brief TouchEventAbsorber objects are used to catch touch events.
+ \brief Used when event widgets are to small (see UI spec.) 
+ */
 class TouchEventAbsorber : public HbWidget
-    	{
-	Q_OBJECT
-    public:
-    	TouchEventAbsorber(QGraphicsItem *parent=0);
-    	~TouchEventAbsorber();
-    	
-    protected:
-        void gestureEvent(QGestureEvent *event);
-        
+{
+    Q_OBJECT
+    
+public:
+    TouchEventAbsorber(QGraphicsItem *parent = 0);
+    ~TouchEventAbsorber();
+    
+protected:
+    void gestureEvent(QGestureEvent *event);
+
 #ifdef _DEBUG
-        void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
-				QWidget *widget);
-#endif
-        
-    	};
+    void paint(
+        QPainter *painter,
+        const QStyleOptionGraphicsItem *option,
+        QWidget *widget);
+#endif       
+};
 
 #endif // CALENDAYCONTAINER_H
-
 // End of File