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