ScummVM API documentation
channel.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef DIRECTOR_CHANNEL_H
23 #define DIRECTOR_CHANNEL_H
24 
25 #include "director/cursor.h"
26 #include "director/sprite.h"
27 
28 namespace Graphics {
29  struct Surface;
30  class ManagedSurface;
31  class MacWidget;
32 }
33 
34 namespace Director {
35 
36 class Sprite;
37 class Cursor;
38 class Score;
39 
40 class Channel {
41 public:
42  Channel(Score *sc, Sprite *sp, int priority = 0);
43  Channel(const Channel &channel);
44  Channel& operator=(const Channel &channel);
45  ~Channel();
46 
47  DirectorPlotData getPlotData();
48  const Graphics::Surface *getMask(bool forceMatte = false);
49 
50  inline int getWidth() { return _sprite->_width; };
51  inline int getHeight() { return _sprite->_height; };
52  inline Common::Point getPosition() { return _sprite->getPosition(); };
53  // Return the area of screen to be used for drawing content.
54  inline Common::Rect getBbox(bool unstretched = false) { return _sprite->getBbox(unstretched); };
55 
56  bool isStretched();
57  bool isDirty(Sprite *nextSprite = nullptr);
58  bool isEmpty();
59  bool isActiveText();
60  bool isMouseIn(const Common::Point &pos);
61  bool isMatteIntersect(Channel *channel);
62  bool isMatteWithin(Channel *channel);
63  bool isActiveVideo();
64  bool isVideoDirectToStage();
65 
66  inline void setWidth(int w) { _sprite->setWidth(w); replaceWidget(); _dirty = true; };
67  inline void setHeight(int h) { _sprite->setHeight(h); replaceWidget(); _dirty = true; };
68  inline void setBbox(int l, int t, int r, int b) { _sprite->setBbox(l, t, r, b); replaceWidget(); _dirty = true; };
69  void setPosition(int x, int y, bool force = false);
70  void setCast(CastMemberID memberID);
71  void setClean(Sprite *nextSprite, bool partial = false);
72  void setStretch(bool enabled);
73  bool getEditable();
74  void setEditable(bool editable);
75  void replaceSprite(Sprite *nextSprite);
76  void replaceWidget(CastMemberID previousCastId = CastMemberID(0, 0), bool force = false);
77  bool updateWidget();
78  void updateTextCast();
79 
80  bool isTrail();
81 
82  void updateGlobalAttr();
83 
84  bool canKeepWidget(CastMemberID castId);
85  bool canKeepWidget(Sprite *currentSprite, Sprite *nextSprite);
86 
87  int getMouseChar(int x, int y);
88  int getMouseWord(int x, int y);
89  int getMouseItem(int x, int y);
90  int getMouseLine(int x, int y);
91 
92  void updateVideoTime();
93 
94  // used for film loops
95  bool hasSubChannels();
96  Common::Array<Channel> *getSubChannels();
97 
98 public:
99  Sprite *_sprite;
100  Cursor _cursor;
101  Graphics::MacWidget *_widget;
102 
103  bool _dirty;
104  bool _visible;
105  uint _constraint;
107 
108  int _priority;
109 
110  // Used in digital movie sprites
111  double _movieRate;
112  int _movieTime;
113  int _startTime;
114  int _stopTime;
115 
116  // Used in film loops
117  uint _filmLoopFrame;
118 
119 private:
120  Graphics::ManagedSurface *getSurface();
121  Score *_score;
122 };
123 
124 } // End of namespace Director
125 
126 #endif
Definition: managed_surface.h:51
Definition: surface.h:67
Definition: channel.h:40
Definition: array.h:52
Definition: rect.h:144
Definition: archive.h:35
Definition: cursor.h:40
Definition: atari-cursor.h:38
Definition: sprite.h:56
Definition: formatinfo.h:28
Definition: score.h:63
Definition: rect.h:45
Definition: macwidget.h:39
Definition: types.h:413
Definition: director.h:330