ScummVM API documentation
pet_element.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 TITANIC_PET_ELEMENT_H
23 #define TITANIC_PET_ELEMENT_H
24 
25 #include "titanic/support/simple_file.h"
26 #include "titanic/support/string.h"
27 #include "titanic/core/link_item.h"
28 #include "titanic/messages/mouse_messages.h"
29 
30 namespace Titanic {
31 
32 enum PetElementMode { MODE_UNSELECTED = 0, MODE_SELECTED = 1, MODE_FOCUSED = 2 };
33 
34 class CGameObject;
35 class CPetControl;
36 
37 class CPetElement {
38 protected:
39  Rect _bounds;
40  PetElementMode _mode;
41 public:
42  CPetElement();
43  virtual ~CPetElement() {}
44 
48  virtual void setup(PetElementMode mode, const CString &name,
49  CPetControl *petControl) {}
50 
54  virtual void reset(const CString &name, CPetControl *petControl, PetElementMode mode) {}
55 
59  virtual void draw(CScreenManager *screenManager) {}
60 
64  virtual void draw(CScreenManager *screenManager, const Point &destPos) {}
65 
69  virtual Rect getBounds() const;
70 
74  virtual bool MouseButtonDownMsg(const Point &pt);
75 
79  virtual bool MouseButtonUpMsg(const Point &pt);
80 
84  virtual bool MouseDoubleClickMsg(const Point &pt) const;
85 
89  virtual bool MouseMoveMsg(const Point &pt);
90 
94  virtual bool contains2(const Point &pt) const;
95 
99  virtual void playMovie(uint startFrame, uint endFrame) const;
100 
104  virtual void changeStatus(int newStatus) const;
105 
109  virtual bool hasActiveMovie() const;
110 
114  virtual void loadFrame(int frameNumber);
115 
119  virtual int getMovieFrame() const;
120 
124  virtual CGameObject *getObject() const { return nullptr; }
125 
126  virtual void changeMode(PetElementMode newMode) { _mode = newMode; }
127 
128  void setMode(PetElementMode mode);
129 
133  void setSelected(bool flag);
134 
138  void setBounds(const Rect &r) { _bounds = r; }
139 
143  void translate(int deltaX, int deltaY) { _bounds.translate(deltaX, deltaY); }
144 
148  void translate(const Point &delta) { _bounds.translate(delta.x, delta.y); }
149 };
150 
151 } // End of namespace Titanic
152 
153 #endif /* TITANIC_PET_ELEMENT_H */
void translate(int deltaX, int deltaY)
Definition: pet_element.h:143
void translate(const Point &delta)
Definition: pet_element.h:148
virtual bool contains2(const Point &pt) const
virtual bool MouseButtonUpMsg(const Point &pt)
Definition: screen_manager.h:49
Definition: game_object.h:79
virtual void reset(const CString &name, CPetControl *petControl, PetElementMode mode)
Definition: pet_element.h:54
virtual void setup(PetElementMode mode, const CString &name, CPetControl *petControl)
Definition: pet_element.h:48
virtual void draw(CScreenManager *screenManager, const Point &destPos)
Definition: pet_element.h:64
virtual CGameObject * getObject() const
Definition: pet_element.h:124
Definition: rect.h:35
Definition: rect.h:45
Definition: arm.h:30
Definition: string.h:40
virtual void loadFrame(int frameNumber)
virtual bool hasActiveMovie() const
void setBounds(const Rect &r)
Definition: pet_element.h:138
virtual bool MouseButtonDownMsg(const Point &pt)
virtual Rect getBounds() const
int16 x
Definition: rect.h:46
void setSelected(bool flag)
virtual void playMovie(uint startFrame, uint endFrame) const
int16 y
Definition: rect.h:47
virtual bool MouseMoveMsg(const Point &pt)
virtual int getMovieFrame() const
virtual bool MouseDoubleClickMsg(const Point &pt) const
virtual void changeStatus(int newStatus) const
virtual void draw(CScreenManager *screenManager)
Definition: pet_element.h:59
Definition: pet_control.h:45