LunaSysMgr
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TouchPlot.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 TOUCHPLOT_H
23 #define TOUCHPLOT_H
24 
25 #include <stdint.h>
26 #include "Common.h"
27 
28 #include <QGraphicsObject>
29 #include <QTouchEvent>
30 
31 class TouchPlot : public QGraphicsItem
32 {
33 public:
34 
35  TouchPlot();
36  virtual ~TouchPlot();
37 
38  void setSize(uint32_t width, uint32_t height);
39  void updateTouches(QTouchEvent* touchEvents);
40 
45  };
46 
47  void enableTouchPlotOption(TouchPlotOption_t TouchPlotOption, bool enable);
48 
49  bool hasOptionsEnabled();
50 
51 private:
52 
53  virtual QRectF boundingRect () const;
54  virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*);
55  QBrush stateToBrush(Qt::TouchPointState state);
56 
57 private:
58  static const int m_max_touches = 10;
59  uint32_t m_width, m_height;
60  int m_plotRectSize;
61 
62  bool m_render_trails;
63  bool m_render_crosshairs;
64  bool m_collecting;
65 
66  QList<QTouchEvent::TouchPoint> m_touchPointHistory[m_max_touches];
67  int m_touches_down;
68 
69 };
70 
71 #endif /* TOUCHPLOT_H */