Ginga  0.13.6
 All Classes Namespaces Functions Variables
DFBWindow.h
1 /******************************************************************************
2 Este arquivo eh parte da implementacao do ambiente declarativo do middleware
3 Ginga (Ginga-NCL).
4 
5 Direitos Autorais Reservados (c) 1989-2007 PUC-Rio/Laboratorio TeleMidia
6 
7 Este programa eh software livre; voce pode redistribui-lo e/ou modificah-lo sob
8 os termos da Licenca Publica Geral GNU versao 2 conforme publicada pela Free
9 Software Foundation.
10 
11 Este programa eh distribuido na expectativa de que seja util, porem, SEM
12 NENHUMA GARANTIA; nem mesmo a garantia implicita de COMERCIABILIDADE OU
13 ADEQUACAO A UMA FINALIDADE ESPECIFICA. Consulte a Licenca Publica Geral do
14 GNU versao 2 para mais detalhes.
15 
16 Voce deve ter recebido uma copia da Licenca Publica Geral do GNU versao 2 junto
17 com este programa; se nao, escreva para a Free Software Foundation, Inc., no
18 endereco 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
19 
20 Para maiores informacoes:
21 ncl @ telemidia.puc-rio.br
22 http://www.ncl.org.br
23 http://www.ginga.org.br
24 http://www.telemidia.puc-rio.br
25 ******************************************************************************
26 This file is part of the declarative environment of middleware Ginga (Ginga-NCL)
27 
28 Copyright: 1989-2007 PUC-RIO/LABORATORIO TELEMIDIA, All Rights Reserved.
29 
30 This program is free software; you can redistribute it and/or modify it under
31 the terms of the GNU General Public License version 2 as published by
32 the Free Software Foundation.
33 
34 This program is distributed in the hope that it will be useful, but WITHOUT ANY
35 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
36 PARTICULAR PURPOSE. See the GNU General Public License version 2 for more
37 details.
38 
39 You should have received a copy of the GNU General Public License version 2
40 along with this program; if not, write to the Free Software
41 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
42 
43 For further information contact:
44 ncl @ telemidia.puc-rio.br
45 http://www.ncl.org.br
46 http://www.ginga.org.br
47 http://www.telemidia.puc-rio.br
48 *******************************************************************************/
49 
50 #ifndef DFBWINDOW_H_
51 #define DFBWINDOW_H_
52 
53 #include "util/IColor.h"
54 using namespace ::br::pucrio::telemidia::util;
55 
56 #include "mb/interface/IWindow.h"
57 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 #include <directfb.h>
62 #ifdef __cplusplus
63 }
64 #endif
65 
66 #include <iostream>
67 #include <vector>
68 using namespace std;
69 
70 namespace br {
71 namespace pucrio {
72 namespace telemidia {
73 namespace ginga {
74 namespace core {
75 namespace mb {
76  class DFBWindow : public IWindow {
77  private:
78  IDirectFBWindow* win;
79  IDirectFBSurface* winSur;
80 
81  int borderWidth;
82  IColor* bgColor;
83  IColor* borderColor;
84  IColor* winColor;
85  IColor* colorKey;
86 
87  GingaScreenID myScreen;
88  DFBWindowID windowId;
89  DFBWindowID parentId;
90  int x;
91  int y;
92  int width;
93  int height;
94 
95  int transparencyValue;
96  bool visible;
97  bool ghost;
98 
99  ISurface* childSurface;
100  bool fit;
101  bool stretch;
102  int caps;
103 
104  pthread_mutex_t mutex;
105  pthread_mutex_t mutexC;
106 
107  public:
108  DFBWindow(
109  GingaWindowID underlyingWindowID,
110  GingaWindowID parentWindowID,
111  GingaScreenID screenId,
112  int x, int y, int width, int height);
113 
114  virtual ~DFBWindow();
115 
116  private:
117  void initialize(
118  GingaWindowID underlyingWindowID,
119  GingaWindowID parentWindowID,
120  GingaScreenID screenId,
121  int x, int y, int width, int height);
122 
123  void releaseBGColor();
124  void releaseWinColor();
125  void releaseColorKey();
126  void releaseBorderColor();
127 
128  void setBgColor();
129 
130  public:
131  void setBgColor(int r, int g, int b, int alpha);
132  IColor* getBgColor();
133  void setColorKey(int r, int g, int b);
134  IColor* getColorKey();
135  void setWindowColor(int r, int g, int b, int alpha);
136  IColor* getWindowColor();
137  void setBorder(int r, int g, int b, int alpha=255, int bWidth=0);
138  void getBorder(int* r, int* g, int* b, int* alpha, int* bWidth);
139 
140  GingaScreenID getScreen();
141  void revertContent();
142  void setChildSurface(ISurface* iSur);
143  int getCap(string cap);
144  void setCaps(int caps);
145  void addCaps(int capability);
146  int getCaps();
147 
148  void draw();
149  void setBounds(int x, int y, int width, int height);
150  void moveTo(int x, int y);
151  void resize(int width, int height);
152  void raiseToTop();
153  void lowerToBottom();
154  void setCurrentTransparency(int alpha);
155  int getTransparencyValue();
156  GingaWindowID getId();
157  void show();
158  void hide();
159 
160  int getX();
161  int getY();
162  int getW();
163  int getH();
164  float getZ(){return -1.0;};
165 
166  void setX(int x);
167  void setY(int y);
168  void setW(int w);
169  void setH(int h);
170  void setZ(float z){};
171 
172  void* getContent();
173 
174  bool isGhostWindow();
175  void setGhostWindow(bool ghost);
176  bool isVisible();
177  void validate();
178 
179  private:
180  void unprotectedValidate();
181 
182  public:
183  void setStretch(bool stretchTo);
184  bool getStretch();
185  void setFit(bool fitTo);
186  bool getFit();
187  void clearContent();
188 
189  private:
190  bool isMine(ISurface* surface);
191 
192  public:
193  void renderImgFile(string serializedImageUrl);
194  void renderFrom(ISurface* s);
195 
196  private:
197  void renderFrom(IDirectFBSurface* contentSurface);
198 
199  public:
200  void blit(IWindow* src);
201  void stretchBlit(IWindow* src);
202  string getDumpFileUri(int quality, int dumpW, int dumpH);
203  void lock();
204  void unlock();
205  void lockChilds();
206  void unlockChilds();
207  };
208 }
209 }
210 }
211 }
212 }
213 }
214 
215 #endif /*WINDOW_H_*/
Definition: IColor.h:64