ScummVM API documentation
container_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_CONTAINERGUMP_H
23#define ULTIMA8_GUMPS_CONTAINERGUMP_H
24
25#include "ultima/ultima8/gumps/item_relative_gump.h"
26#include "ultima/ultima8/misc/classtype.h"
27
28namespace Ultima {
29namespace Ultima8 {
30
31class Shape;
32class Container;
33
38public:
39 ENABLE_RUNTIME_CLASSTYPE()
40
42 ContainerGump(const Shape *shape, uint32 frameNum, uint16 owner,
43 uint32 flags = FLAG_DRAGGABLE, int32 layer = LAYER_NORMAL);
44 ~ContainerGump() override;
45
46 void setItemArea(Common::Rect32 *itemArea) {
47 _itemArea = *itemArea;
48 }
49
50 // Close the gump
51 void Close(bool no_del = false) override;
52
53 // Init the gump, call after construction
54 void InitGump(Gump *newparent, bool take_focus = true) override;
55
56 void run() override;
57
58 // Paint the Gump
59 void PaintThis(RenderSurface *, int32 lerp_factor, bool scaled) override;
60
61 // Trace a click, and return ObjId
62 uint16 TraceObjId(int32 mx, int32 my) override;
63
64 // Get the location of an item in the gump (coords relative to this).
65 // Returns false on failure.
66 bool GetLocationOfItem(uint16 itemid, int32 &gx, int32 &gy,
67 int32 lerp_factor = 256) override;
68
69
70 bool StartDraggingItem(Item *item, int mx, int my) override;
71 bool DraggingItem(Item *item, int mx, int my) override;
72 void DraggingItemLeftGump(Item *item) override;
73 void StopDraggingItem(Item *item, bool moved) override;
74 void DropItem(Item *item, int mx, int my) override;
75
76 Gump *onMouseDown(int button, int32 mx, int32 my) override;
77 void onMouseClick(int button, int32 mx, int32 my) override;
78 void onMouseDouble(int button, int32 mx, int32 my) override;
79
80 bool loadData(Common::ReadStream *rs, uint32 version);
81 void saveData(Common::WriteStream *ws) override;
82
83protected:
84 void GetItemLocation(int32 lerp_factor) override;
85
86 virtual Container *getTargetContainer(Item *item, int mx, int my);
87
88 void getItemCoords(Item *item, int32 &itemx, int32 &itemy);
89
90 Common::Rect32 _itemArea;
91
92 bool _displayDragging;
93 uint32 _draggingShape;
94 uint32 _draggingFrame;
95 uint32 _draggingFlags;
96 int32 _draggingX, _draggingY;
97};
98
99} // End of namespace Ultima8
100} // End of namespace Ultima
101
102#endif
Definition: stream.h:385
Definition: stream.h:77
Definition: container_gump.h:37
bool StartDraggingItem(Item *item, int mx, int my) override
void PaintThis(RenderSurface *, int32 lerp_factor, bool scaled) override
Overloadable method to Paint just this Gump (RenderSurface is relative to this)
void InitGump(Gump *newparent, bool take_focus=true) override
void DropItem(Item *item, int mx, int my) override
bool DraggingItem(Item *item, int mx, int my) override
uint16 TraceObjId(int32 mx, int32 my) override
Trace a click, and return ObjId.
void Close(bool no_del=false) override
void StopDraggingItem(Item *item, bool moved) override
void run() override
Run the gump.
void DraggingItemLeftGump(Item *item) override
Called when an item that was being dragged over the gump left the gump.
bool GetLocationOfItem(uint16 itemid, int32 &gx, int32 &gy, int32 lerp_factor=256) override
Definition: container.h:35
Definition: gump.h:46
Definition: item.h:42
Definition: item_relative_gump.h:34
Definition: render_surface.h:37
Definition: shape.h:36
Definition: rect.h:538