ScummVM API documentation
cursor.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 #ifndef DIRECTOR_CURSOR_H
22 #define DIRECTOR_CURSOR_H
23 
24 #include "graphics/maccursor.h"
25 
26 #include "graphics/macgui/macwindowmanager.h"
27 
28 #include "engines/director/lingo/lingo.h"
29 
30 namespace Graphics {
31 class ManagedSurface;
32 class MacCursor;
33 }
34 
35 namespace Director {
36 
37 class Archive;
38 struct CursorRef;
39 
40 class Cursor : public Graphics::MacCursor {
41  public:
42  Cursor();
43 
44  CursorRef getRef();
45 
46  void readFromCast(Datum casts);
47  void readFromResource(Datum resourceId);
48  void readBuiltinType(Datum resourceId);
49  bool readFromArchive(Archive *archive, uint16 resourceId);
50 
51  bool isEmpty() {return Datum(0).equalTo(_cursorResId);}
52  bool operator==(const Cursor &c);
53  bool operator==(const CursorRef &c);
54 
55  byte getKeyColor() const override { return _keyColor; }
56  const byte *getPalette() const override { return _usePalette ? _palette : nullptr; }
57 
58  public:
59  Graphics::MacCursorType _cursorType;
60  Datum _cursorResId;
61 
62 private:
63  void resetCursor(Graphics::MacCursorType type, bool shouldClear = false, Datum resId = Datum(0));
64 
65 private:
66  bool _usePalette;
67  byte _keyColor;
68 };
69 
70 // CursorRef acts as a reference to a cursor.
71 // Doesn't contain a surface, palette, etc. like the cursor itself.
72 struct CursorRef {
73  CursorRef();
74  bool operator==(const Cursor &c);
75  bool operator==(const CursorRef &c);
76 
77  Graphics::MacCursorType _cursorType;
78  Datum _cursorResId;
79 };
80 
81 } // End of namespace Director
82 
83 #endif
byte getKeyColor() const override
Definition: cursor.h:55
Definition: cursor.h:72
Definition: archive.h:35
Definition: cursor.h:40
Definition: archive.h:53
Definition: formatinfo.h:28
const byte * getPalette() const override
Definition: cursor.h:56
Definition: lingo.h:129
Definition: maccursor.h:48