LunaSysMgr
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
scrollinglayoutrenderer.h
Go to the documentation of this file.
1 /* @@@LICENSE
2 *
3 * Copyright (c) 2011-2012 Hewlett-Packard Development Company, L.P.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 * LICENSE@@@ */
18 
19 
20 
21 
22 #ifndef SCROLLINGLAYOUTRENDERER_H_
23 #define SCROLLINGLAYOUTRENDERER_H_
24 
25 #include "scrollableobject.h"
26 #include <QPointer>
27 
28 class IconLayout;
30 {
31  Q_OBJECT
32  Q_INTERFACES(QGraphicsItem)
33 
34 public:
35  ScrollingLayoutRenderer(const QRectF& geometry,IconLayout& layout);
36  virtual ~ScrollingLayoutRenderer();
37 
38  virtual qint32 scrollValue() const;
39  virtual void setScrollValue(qint32 v);
40  virtual qint32 rawScrollValue() const;
41  virtual bool inOverscroll() const;
42  virtual qint32 scrollValueNeededToEscapeOverscroll();
43  virtual quint32 scrollAmountUntilTopOverscroll();
44  virtual quint32 scrollAmountUntilBottomOverscroll();
45 
46  virtual qint32 topLimit() const;
47  virtual qint32 bottomLimit() const;
48 
49  virtual QPointF mapToContentSpace(const QPointF& scrollerSpacePointF);
50  virtual QPointF mapToContentSpace(const QPoint& scrollerSpacePoint);
51  virtual QPointF mapFromContentSpace(const QPointF& contentSpacePointF);
52 
53  virtual bool mapToContentSpace(const QPointF& scrollerSpacePointF,QPointF& r_mappedPointF);
54  virtual bool mapToContentSpace(const QPoint& scrollerSpacePoint,QPointF& r_mappedPointF);
55  virtual bool mapFromContentSpace(const QPointF& contentSpacePointF,QPointF& r_mappedScrollerSpacePointF);
56 
57  virtual bool resize(quint32 w,quint32 h);
58 
59 protected Q_SLOTS:
60 
61  virtual void slotSourceGeomChanged(const QRectF& newGeom);
62  virtual void slotSourceContentSizeChanged(const QSizeF& newContentSize);
63  virtual void slotSourceContentSizeChanged(const QSize& newContentSize);
64 
65 protected:
66 
67  virtual void resetToInitialSourceArea();
68  virtual void resetToInitialTargetArea();
69 
70  //used in the case where the content size is smaller than the screen size
71  virtual void setScrollValueSmallContent(qint32);
72 
73  virtual void setSourceContentGeom(const QRectF& newContentGeom);
74 
75  virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option=0,QWidget *widget=0);
76 
77  QPointer<IconLayout> m_qp_layoutObject;
78  QSize m_sourceContentSize; //in pixels, for comparison to screen geom
79 };
80 
81 #endif /* SCROLLINGLAYOUTRENDERER_H_ */