ScummVM API documentation
doll_widget.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 NUVIE_VIEWS_DOLL_WIDGET_H
23 #define NUVIE_VIEWS_DOLL_WIDGET_H
24 
25 #include "ultima/nuvie/gui/widgets/gui_widget.h"
26 #include "ultima/nuvie/core/tile_manager.h"
27 #include "ultima/nuvie/core/obj_manager.h"
28 #include "ultima/nuvie/views/inventory_message.h"
29 
30 namespace Ultima {
31 namespace Nuvie {
32 
33 class Configuration;
34 class Actor;
35 class U6Shape;
36 
37 class DollWidget : public GUI_Widget {
38 
39  const Configuration *config;
40  TileManager *tile_manager;
41  ObjManager *obj_manager;
42 
43  Actor *actor;
44  bool use_new_dolls, old_use_new_dolls;
45 
46  Obj *selected_obj, *unready_obj;
47 
48  uint8 bg_color;
49  bool is_in_portrait_view;
50  bool need_to_free_tiles;
51  Tile *empty_tile, *blocked_tile;
52 
53  U6Shape *md_doll_shp;
54  Graphics::ManagedSurface *actor_doll, *doll_bg;
55 
56 public:
57  DollWidget(const Configuration *cfg, GUI_CallBack *callback = nullptr);
58  ~DollWidget() override;
59 
60  bool init(Actor *a, uint16 x, uint16 y, TileManager *tm, ObjManager *om, bool in_portrat_view = false);
61  void free_doll_shapes();
62  void setColorKey(Graphics::ManagedSurface *image);
63  void set_actor(Actor *a);
64  void Display(bool full_redraw) override;
65 
66  GUI_status MouseDown(int x, int y, Shared::MouseButton button) override;
67  GUI_status MouseUp(int x, int y, Shared::MouseButton button) override;
68  GUI_status MouseMotion(int x, int y, uint8 state) override;
69  GUI_status MouseDouble(int x, int y, Shared::MouseButton button) override;
70  GUI_status MouseClick(int x, int y, Shared::MouseButton button) override;
71  GUI_status MouseDelayed(int x, int y, Shared::MouseButton button) override;
72 
73  void drag_drop_success(int x, int y, int message, void *data) override;
74  void drag_drop_failed(int x, int y, int message, void *data) override;
75 
76  bool drag_accept_drop(int x, int y, int message, void *data) override;
77  void drag_perform_drop(int x, int y, int message, void *data) override;
78 
79  void drag_draw(int x, int y, int message, void *data) override;
80 
81  const Common::Rect *get_item_hit_rect(uint8 location) const;
82 
83 protected:
84 
85  GUI_CallBack *callback_object; // object-selected callback
86 
87  void display_doll();
88  void display_old_doll();
89  void display_new_doll();
90  void display_readied_object(uint8 location, uint16 x, uint16 y, Actor *actor, Tile *emptyTile);
91 
92 private:
93  Common::Rect item_hit_rects[8];
94 
95  void load_md_doll_shp();
96 };
97 
98 } // End of namespace Nuvie
99 } // End of namespace Ultima
100 
101 #endif
Definition: managed_surface.h:51
Definition: actor.h:178
Definition: gui_widget.h:38
Definition: obj.h:84
Definition: configuration.h:61
Definition: rect.h:144
Definition: tile_manager.h:145
Definition: u6_shape.h:47
Definition: detection.h:27
Definition: obj_manager.h:75
Definition: doll_widget.h:37
Definition: tile_manager.h:113
Definition: gui_callback.h:31