ScummVM API documentation
paperdoll_gump.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 ULTIMA8_GUMPS_PAPERDOLLGUMP_H
23 #define ULTIMA8_GUMPS_PAPERDOLLGUMP_H
24 
25 #include "ultima/shared/std/string.h"
26 #include "ultima/ultima8/gumps/container_gump.h"
27 #include "ultima/ultima8/misc/classtype.h"
28 
29 namespace Ultima {
30 namespace Ultima8 {
31 
32 class RenderedText;
33 
37 class PaperdollGump : public ContainerGump {
38 public:
39  ENABLE_RUNTIME_CLASSTYPE()
40 
41  PaperdollGump();
42  PaperdollGump(const Shape *shape, uint32 frameNum, uint16 owner,
43  uint32 flags = FLAG_DRAGGABLE, int32 layer = LAYER_NORMAL);
44  ~PaperdollGump() override;
45 
46  // Init the gump, call after construction
47  void InitGump(Gump *newparent, bool take_focus = true) override;
48 
49  // Close the gump
50  void Close(bool no_del = false) override;
51 
52  // Paint this Gump
53  void PaintThis(RenderSurface *, int32 lerp_factor, bool scaled) override;
54 
55  void ChildNotify(Gump *child, uint32 message) override;
56 
57  // Trace a click, and return ObjId
58  uint16 TraceObjId(int32 mx, int32 my) override;
59 
60  // Get the location of an item in the gump (coords relative to this).
61  // Returns false on failure.
62  bool GetLocationOfItem(uint16 itemid, int32 &gx, int32 &gy,
63  int32 lerp_factor = 256) override;
64 
65  bool StartDraggingItem(Item *item, int mx, int my) override;
66  bool DraggingItem(Item *item, int mx, int my) override;
67  void DropItem(Item *item, int mx, int my) override;
68 
69  bool loadData(Common::ReadStream *rs, uint32 version);
70  void saveData(Common::WriteStream *ws) override;
71 
72 protected:
74  void PaintStats(RenderSurface *, int32 lerp_factor);
75 
77  void PaintStat(RenderSurface *surf, unsigned int n,
78  Std::string text, int val);
79 
80  RenderedText *_cachedText[14]; // constant!!
81  int _cachedVal[7]; // constant!!
82 
83  uint16 _statButtonId;
84 
85  uint32 _draggingArmourClass;
86  uint32 _draggingWeight;
87 
88 private:
89  const Rect _backpackRect;
90 };
91 
92 } // End of namespace Ultima8
93 } // End of namespace Ultima
94 
95 #endif
void InitGump(Gump *newparent, bool take_focus=true) override
bool StartDraggingItem(Item *item, int mx, int my) override
Definition: stream.h:77
Definition: container_gump.h:37
Definition: rect.h:32
Definition: item.h:42
void PaintStat(RenderSurface *surf, unsigned int n, Std::string text, int val)
Paint a single stat.
void Close(bool no_del=false) override
void PaintThis(RenderSurface *, int32 lerp_factor, bool scaled) override
Overloadable method to Paint just this Gump (RenderSurface is relative to this)
Definition: render_surface.h:40
Definition: gump.h:47
Definition: rendered_text.h:30
bool GetLocationOfItem(uint16 itemid, int32 &gx, int32 &gy, int32 lerp_factor=256) override
Definition: detection.h:27
Definition: paperdoll_gump.h:37
bool DraggingItem(Item *item, int mx, int my) override
void DropItem(Item *item, int mx, int my) override
Definition: string.h:30
void PaintStats(RenderSurface *, int32 lerp_factor)
Paint the stats.
Definition: stream.h:385
Definition: shape.h:38
uint16 TraceObjId(int32 mx, int32 my) override
Trace a click, and return ObjId.
void ChildNotify(Gump *child, uint32 message) override