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