LunaSysMgr
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
scrollingsurface.h
Go to the documentation of this file.
1 /* @@@LICENSE
2 *
3 * Copyright (c) 2010-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 SCROLLINGSURFACE_H_
23 #define SCROLLINGSURFACE_H_
24 
25 #include "scrollableobject.h"
26 #include <QRectF>
27 #include <QRect>
28 #include <QPointer>
29 
30 class PixmapObject;
31 class QPainter;
32 class QGraphicsSceneMouseEvent;
33 
35 {
36  Q_OBJECT
37  Q_INTERFACES(QGraphicsItem)
38 
39 public:
40 
41  ScrollingSurface(const QRectF& geometry);
42  virtual ~ScrollingSurface();
43 
44  void setPixmapObject(PixmapObject * p_pmo);
45 
46  bool testAndtranslateScrollSurfacePointToPixmapPoint(const QPointF& point,QPoint& r_translatedPoint);
47 
48  virtual qint32 scrollValue() const;
49  virtual void setScrollValue(qint32 v);
50  virtual qint32 rawScrollValue() const;
51 
52 public Q_SLOTS:
53 
54  //this one ignores content geom changes because it's bound to the pixmap.
55  //TODO: revisit this idea; perhaps some tricky cool things can be done by messing
56  // with the geom despite a fixed pixmap size
57  virtual void slotSourceGeomChanged(const QRectF& newGeom);
58  virtual void slotSourceContentSizeChanged(const QSizeF& newContentSize);
59  virtual void slotSourceContentSizeChanged(const QSize& newContentSize);
60 
61 protected:
62 
63  virtual void resetTargetRectValid();
64 
65  virtual void setSourceContentGeom(const QRectF& newContentGeom);
66 
67  virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option=0,QWidget *widget=0);
68 
69  QPointer<PixmapObject> m_qp_surfacePmo;
70 };
71 
72 #endif /* SCROLLINGSURFACE_H_ */