LunaSysMgr
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
IMEView.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 IMEVIEW_H
23 #define IMEVIEW_H
24 
25 #include <QGraphicsObject>
26 
27 #include "IMEDataInterface.h"
28 #include <stdint.h>
29 
30 class QTapGesture;
32 
33 class IMEView : public QGraphicsObject
34 {
35  Q_OBJECT
36 
37 public:
38  IMEView(QGraphicsItem* parent = 0);
39 
40  void attach(IMEDataInterface* imeDataInterface);
41 
42  void setBoundingRect(const QRectF& r);
43  QRectF boundingRect() const;
44 
45  void paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*);
46 
47 public Q_SLOTS:
48  void invalidateRect(const QRect & rect);
49 
50 protected:
51  virtual void mousePressEvent(QGraphicsSceneMouseEvent* event);
52  virtual bool sceneEvent(QEvent* event);
53 
54  void touchBegin(QTouchEvent* te);
55  void touchUpdate(QTouchEvent* te);
56  void touchEnd(QTouchEvent* te);
57 
58  void tapEvent(QTapGesture* tap);
60 
61 public:
62  bool acceptPoint(const QPointF& pt);
63 
64 private:
65  QRectF m_bounds;
66  IMEDataInterface* m_imeDataInterface;
67  bool m_acceptingInput;
68  uint64_t m_lastTouchBegin;
69 };
70 
71 #endif
72