webappmanager
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RemoteWindowData.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 REMOTEWINDOWDATA_H
23 #define REMOTEWINDOWDATA_H
24 
25 #include "Common.h"
26 
27 #include <QRect>
28 
29 #include "CardWebApp.h"
30 
31 class PIpcChannel;
32 class PGContext;
33 class PIpcBuffer;
34 class QPainter;
35 namespace Palm {
36  class WebGLES2Context;
37 }
38 
40 {
41 public:
42 
44  , m_metaDataBuffer(0)
46  {}
47 
48  virtual ~RemoteWindowData() {}
49 
50  virtual void setWindowMetaDataBuffer(PIpcBuffer* metaDataBuffer) = 0;
51 
52  virtual bool isValid() const { return true; }
53  virtual int key() const = 0;
54  virtual int width() const = 0;
55  virtual int height() const = 0;
56  virtual bool hasAlpha() const = 0;
57  virtual bool needsClear() const = 0;
58  virtual bool supportsPartialUpdates() const { return true; }
59 
60  virtual void flip() = 0;
61 
62  virtual PGContext* renderingContext() = 0;
63  virtual QPainter* qtRenderingContext() { return 0; }
64  virtual Palm::WebGLES2Context* getGLES2Context() { return 0; }
65  virtual void translate(int x, int y) { }
66  virtual void rotate(int degrees) { }
67  virtual void beginPaint() = 0;
68  virtual void endPaint(bool preserveOnFlip, const QRect& rect, bool flipBuffers = true) = 0;
69  virtual void sendWindowUpdate(int x, int y, int w, int h) = 0;
70 
71  virtual bool hasDirectRendering() const { return false; }
72  virtual bool directRenderingAllowed(bool val) = 0;
73 
74  void setChannel(PIpcChannel* channel) { m_channel = channel; }
75 
76  virtual void resize(int newWidth, int newHeight) = 0;
77  virtual void clear() = 0;
78 
79  void setSupportsDirectRendering(bool val);
80  bool supportsDirectRendering() const;
81 
82 protected:
83 
84  PIpcChannel* m_channel;
85  PIpcBuffer* m_metaDataBuffer;
87 };
88 
90 {
91 public:
92 
93  static RemoteWindowData* generate(int width, int height, bool hasAlpha);
94 };
95 
96 #endif /* REMOTEWINDOWDATA_H */