Ginga  0.13.6
 All Classes Namespaces Functions Variables
FormatterRegion.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 FORMATTERREGION_H_
51 #define FORMATTERREGION_H_
52 
53 #include "util/Color.h"
54 #include "util/functions.h"
55 using namespace ::br::pucrio::telemidia::util;
56 
57 #include "ncl/layout/LayoutRegion.h"
58 using namespace ::br::pucrio::telemidia::ncl::layout;
59 
60 #include "ncl/descriptor/Descriptor.h"
61 #include "ncl/descriptor/DescriptorUtil.h"
62 using namespace ::br::pucrio::telemidia::ncl::descriptor;
63 
64 #include "ncl/transition/Transition.h"
65 #include "ncl/transition/TransitionUtil.h"
66 using namespace ::br::pucrio::telemidia::ncl::transition;
67 
68 #include "mb/IInputManager.h"
69 #include "mb/ILocalScreenManager.h"
70 #include "mb/interface/IWindow.h"
71 using namespace ::br::pucrio::telemidia::ginga::core::mb;
72 
73 #include "FocusSourceManager.h"
74 using namespace ::br::pucrio::telemidia::ginga::ncl::model::presentation::focus;
75 
76 #include <vector>
77 #include <string>
78 using namespace std;
79 
80 namespace br {
81 namespace pucrio {
82 namespace telemidia {
83 namespace ginga {
84 namespace ncl {
85 namespace model {
86 namespace presentation {
88  private:
89  void* layoutManager; //FormatterLayout
90  void* descriptor; //CascadingDescriptor
91 
92  string objectId;
93  LayoutRegion* ncmRegion;
94  LayoutRegion* originalRegion;
95  bool externHandler;
96  IWindow* outputDisplay;
97 
98  ISurface* renderedSurface;
99 
100  bool imVisible;
101 
102  short focusState;
103  Color* focusBorderColor;
104  int focusBorderWidth;
105  string focusComponentSrc;
106  Color* selBorderColor;
107  string selComponentSrc;
108  int selBorderWidth;
109 
110  int zIndex;
111 
112  Color* bgColor;
113  float transparency;
114  short fit;
115  short scroll;
116  Color* chromaKey;
117  string transitionIn;
118  string transitionOut;
119  bool abortTransitionIn;
120  bool abortTransitionOut;
121  pthread_mutex_t mutex;
122  pthread_mutex_t mutexT;
123  pthread_mutex_t mutexFI;
124 
125  string focusIndex;
126  string moveUp;
127  string moveDown;
128  string moveLeft;
129  string moveRight;
130 
131  string plan;
132 
133  public:
134  static const short UNSELECTED = 0;
135  static const short FOCUSED = 1;
136  static const short SELECTED = 2;
137 
139  string objectId, void* descriptor, void* layoutManager);
140 
141  virtual ~FormatterRegion();
142 
143  private:
144  void initializeNCMRegion();
145 
146  public:
147  void setZIndex(int zIndex);
148  int getZIndex();
149 
150  void setPlan(string plan);
151  string getPlan();
152 
153  void setFocusIndex(string focusIndex);
154  string getFocusIndex();
155 
156  void setMoveUp(string moveUp);
157  string getMoveUp();
158 
159  void setMoveDown(string moveDown);
160  string getMoveDown();
161 
162  void setMoveLeft(string moveLeft);
163  string getMoveLeft();
164 
165  void setMoveRight(string moveRight);
166  string getMoveRight();
167 
168  void setFocusBorderColor(Color* focusBorderColor);
169  Color* getFocusBorderColor();
170 
171  void setFocusBorderWidth(int focusBorderWidth);
172  int getFocusBorderWidth();
173 
174  void setFocusComponentSrc(string focusComponentSrc);
175  string getFocusComponentSrc();
176 
177  void setSelBorderColor(Color* selBorderColor);
178  Color* getSelBorderColor();
179 
180  void setSelBorderWidth(int selBorderWidth);
181  int getSelBorderWidth();
182 
183  void setSelComponentSrc(string selComponentSrc);
184  string getSelComponentSrc();
185 
186  void setFocusInfo(
187  Color* focusBorderColor,
188  int focusBorderWidth,
189  string focusComponentSrc,
190  Color* selBorderColor,
191  int selBorderWidth,
192  string selComponentSrc);
193 
194  void* getLayoutManager();
195  GingaWindowID getOutputId();
196 
197  private:
198  void meetComponent(
199  int width,
200  int height,
201  int prefWidth,
202  int prefHeight,
203  ISurface* component);
204 
205  void sliceComponent(
206  int width,
207  int height,
208  int prefWidth,
209  int prefHeight,
210  ISurface* component);
211 
212  void updateCurrentComponentSize();
213 
214  public:
215  void updateRegionBounds();
216 
217  private:
218  void sizeRegion();
219 
220  public:
221  bool intersects(int x, int y);
222  LayoutRegion* getLayoutRegion();
223  LayoutRegion* getOriginalRegion();
224 
225  GingaWindowID prepareOutputDisplay(
226  ISurface* renderedSurface, float cvtIndex);
227 
228  void showContent();
229  void hideContent();
230 
231  void performOutTrans();
232  double getOutTransDur();
233 
234  void setRegionVisibility(bool visible);
235 
236  private:
237  void disposeOutputDisplay();
238 
239  public:
240  void toFront();
241 
242  private:
243  void bringChildrenToFront(LayoutRegion* parentRegion);
244  void traverseFormatterRegions(
245  LayoutRegion *region, LayoutRegion* baseRegion);
246 
247  void bringHideWindowToFront(
248  LayoutRegion* baseRegion, LayoutRegion* hideRegion);
249 
250  void bringSiblingToFront(FormatterRegion *region);
251 
252  public:
253  void setGhostRegion(bool ghost);
254  bool isVisible();
255  short getFocusState();
256  bool setSelection(bool selOn);
257  void setFocus(bool focusOn);
258  void unselect();
259 
260  Color* getBackgroundColor();
261 
262  float getTransparency();
263  void setTransparency(string strTrans);
264  void setTransparency(float transparency);
265  void setBackgroundColor(string color);
266  void setBackgroundColor(Color *color);
267  void setChromaKey(string value);
268  void setRgbChromaKey(string value);
269  void setFit(string value);
270  void setFit(short value);
271  void setScroll(string value);
272  void setScroll(short value);
273 
274  private:
275  void barWipe(Transition* transition, bool isShowEffect);
276  static void* barWipeT(void* ptr);
277  void fade(Transition* transition, bool isShowEffect);
278  static void* fadeT(void* ptr);
279  void lock();
280  void unlock();
281  void lockTransition();
282  void unlockTransition();
283  void lockFocusInfo();
284  void unlockFocusInfo();
285  };
286 }
287 }
288 }
289 }
290 }
291 }
292 }
293 
294 typedef struct {
296  Transition* t;
297 } TransInfo;
298 
299 #endif /*FORMATTERREGION_H_*/
Definition: Color.h:62
Definition: FormatterRegion.h:294