ScummVM API documentation
base_pda.h
1 
2 /* ScummVM - Graphic Adventure Engine
3  *
4  * ScummVM is the legal property of its developers, whose names
5  * are too numerous to list here. Please refer to the COPYRIGHT
6  * file distributed with this source distribution.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #ifndef BAGEL_BAGLIB_BASE_PDA_H
24 #define BAGEL_BAGLIB_BASE_PDA_H
25 
26 #include "bagel/baglib/storage_dev_bmp.h"
27 
28 namespace Bagel {
29 
30 #define PDA_MAP (100)
31 #define PDA_STASH (101)
32 #define PDA_ZOOM (102)
33 #define PDA_SYSTEM (103)
34 #define PDA_LOG (104)
35 #define PDA_OFF (105)
36 #define PDA_MSGLIGHT (110)
37 #define PDA_ZOOMFLASH "ZOOMFLASH"
38 
39 enum PdaMode {
40  PDA_NO_MODE,
41  PDA_MAP_MODE,
42  PDA_INV_MODE,
43  PDA_LOG_MODE,
44  PDA_MOO_MODE
45 };
46 enum PdaPos {
47  PDA_POS_UNINITIALIZED,
48  PDA_UP,
49  PDA_DOWN
50 };
51 
52 class SBBasePda {
53 protected:
54  // All PDA's in the game should share the same mode
55  static PdaMode _pdaMode;
56  static PdaPos _pdaPos;
57  int _numMoves;
58  int _activating;
59  bool _activated;
60  int _moveDist;
61  CBagStorageDevBmp *_mooWnd; // Pointer to the PDAMOVIE object
62  CBagStorageDevBmp *_invWnd; // Pointer to the inventory object
63  CBagStorageDevBmp *_mapWnd; // Pointer to the Map object
64  CBagStorageDevBmp *_logWnd; // Pointer to the Map object
65  CBagStorageDevBmp *_curDisplay; // Pointer to the object currently displayed in PDA
66  CBofWindow *_parent;
67  bool _zoomedFl;
68  bool _deactivateFl; // should we deactivate when done w/movie?
69 
70  // hold this info for restore method
71  CBagStorageDevBmp *_holdDisplay;
72  static PdaMode _holdMode;
73 
74 public:
75  SBBasePda(CBofWindow *parent = nullptr, const CBofRect &rect = CBofRect(), bool activated = false);
76  virtual ~SBBasePda();
77  static void initialize();
78 
82  static void setPdaMode(PdaMode pdaMode) {
83  _pdaMode = pdaMode;
84  }
85  static PdaMode getPdaMode() {
86  return _pdaMode;
87  }
88  bool isActivated() const {
89  return _activating ? !_activated : _activated;
90  }
91  bool isActivating() const {
92  return _activating;
93  }
94 
95  virtual ErrorCode attachActiveObjects();
96  virtual ErrorCode detachActiveObjects();
97 
101  void synchronizePdaState();
102 
103  void activate();
104  void deactivate();
105 
109  virtual bool showInventory();
110 
114  virtual bool hideInventory();
115 
119  virtual bool showMovie();
120 
124  virtual bool hideMovie();
125 
131  bool setMovie(CBofString &movieName) const;
132 
136  void stopMovie(bool bResetPDA) const;
137 
138  void setDeactivate(bool b) {
139  _deactivateFl = b;
140  }
141 
142  bool getDeactivate() const {
143  return _deactivateFl;
144  }
145 
149  virtual bool showMap();
150 
154  virtual bool hideMap();
155 
159  virtual bool zoom() {
160  return true;
161  }
162 
163  virtual bool showLog();
164 
165  virtual bool msgLight();
166 
171  virtual bool hideCurDisplay();
172 
177  virtual bool restoreCurDisplay();
178 
179  static void *pdaButtonHandler(int refId, void *info);
180 
181  void setPdaState();
182  void getPdaState();
183 
184  void setZoomed(bool newVal) {
185  _zoomedFl = newVal;
186  }
187  bool getZoomed() const {
188  return _zoomedFl;
189  }
190 
191  int getProperCursor(const CBofPoint &pos, CBofRect &pdaRect) const;
192 
196  CBofRect getViewRect() const;
197 };
198 
199 } // namespace Bagel
200 
201 #endif
Definition: base_pda.h:52
Definition: window.h:50
virtual bool showMovie()
static void setPdaMode(PdaMode pdaMode)
Definition: base_pda.h:82
void synchronizePdaState()
CBofRect getViewRect() const
Definition: rect.h:36
virtual bool showInventory()
virtual bool showMap()
virtual bool hideMovie()
virtual bool hideMap()
virtual bool hideCurDisplay()
void stopMovie(bool bResetPDA) const
Definition: string.h:38
Definition: bagel.h:31
Definition: point.h:34
virtual bool hideInventory()
virtual bool restoreCurDisplay()
virtual bool zoom()
Definition: base_pda.h:159
Definition: storage_dev_bmp.h:31
bool setMovie(CBofString &movieName) const