LunaSysMgr
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CardHostWindow.h
Go to the documentation of this file.
1 /* @@@LICENSE
2 *
3 * Copyright (c) 2009-2012 Hewlett-Packard Development Company, L.P.
4 * Copyright (c) 2013 LG Electronics
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 * LICENSE@@@ */
19 
20 
21 
22 
23 #ifndef CARDHOSTWINDOW_H
24 #define CARDHOSTWINDOW_H
25 
26 #include "Common.h"
27 
28 #include "CardWindow.h"
29 
30 #include "AnimationEquations.h"
31 #include "Timer.h"
32 
33 class PIpcBuffer;
34 class PIpcChannel;
35 class IpcClientHost;
36 
37 class CardHostWindow : public CardWindow
38 {
39 Q_OBJECT
40 
41 public:
42 
44  virtual ~CardHostWindow();
45 
46  virtual void resizeEvent(int w, int h);
47  virtual void resizeEventSync(int w, int h);
48  virtual void resizeWindowBufferEvent(int w, int h, QRect windowScreenBounds, bool forceSync);
49  virtual void focusEvent(bool enable);
50  virtual void aboutToFocusEvent(bool enable);
51 
52  virtual bool isHost() const { return true; }
53  virtual bool supportsPause() const { return true; }
54  virtual void pause();
55  bool paused() const { return m_paused; }
56 
57 protected:
58 
59  virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
60  virtual void paintBase(QPainter* painter, bool maximized);
61  virtual void paintOverlay(QPainter* painter, bool maximized);
62 
63  virtual void fullScreenEnabled(bool enabled);
64 
65 #if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
66  virtual bool touchEvent(QTouchEvent* event);
67 #endif
68  virtual void mousePressEvent(QGraphicsSceneMouseEvent* event);
69  virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event);
70  virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
71  virtual void hoverMoveEvent(QGraphicsSceneHoverEvent* event);
72  virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
73  virtual void refreshAdjustmentAngle();
74  virtual void onSetAppFixedOrientation(int orientation, bool isPortrait);
75 
76  virtual void initializeRoundedCornerStage();
77 
78 private:
79 
80  virtual void displayOff();
81  virtual void displayDimmed();
82 
83  void pauseCard();
84  void resumeCard();
85 
86  bool rotateTimerTicked();
87 
88  bool isOrientationPortrait(Event::Orientation orient);
89 
90  bool m_paused;
91  bool m_pausedDueToDisplayOff;
92  bool m_penDownInPlayButton;
93  bool m_penInPlayButton;
94 
95  bool m_inRotateAnim;
96  int m_rotateAngleStart;
97  int m_rotateAngleTarget;
98  PValue m_rotateScaleStart;
99  PValue m_rotateScaleTarget;
100  uint32_t m_rotateTimerStart;
101  AnimationEquation m_rotateEquation;
102  Timer<CardHostWindow> m_rotateAnimTimer;
103 
104 };
105 
106 #endif /* CARDHOSTWINDOW_H */