ScummVM API documentation
maciconbar.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 SCI_GRAPHICS_MACICONBAR_H
23 #define SCI_GRAPHICS_MACICONBAR_H
24 
25 #include "common/array.h"
26 
27 #include "sci/engine/vm.h"
28 #include "sci/event.h"
29 
30 namespace Graphics {
31 struct Surface;
32 }
33 
34 namespace Sci {
35 
37 public:
38  GfxMacIconBar(ResourceManager *resMan, EventManager *eventMan, SegManager *segMan, GfxScreen *screen, GfxPalette *palette);
39  ~GfxMacIconBar();
40 
41  void initIcons(uint16 count, reg_t *objs);
42  void drawIcons();
43  void setIconEnabled(int16 index, bool enabled);
44  void setInventoryIcon(int16 icon);
45  bool handleEvents(SciEvent evt, reg_t &iconObj);
46 
47 private:
48  ResourceManager *_resMan;
49  EventManager *_eventMan;
50  SegManager *_segMan;
51  GfxScreen *_screen;
52  GfxPalette *_palette;
53 
54  struct IconBarItem {
55  reg_t object;
56  Graphics::Surface *nonSelectedImage;
57  Graphics::Surface *selectedImage;
58  Common::Rect rect;
59  bool enabled;
60  };
61 
62  Common::Array<IconBarItem> _iconBarItems;
63  uint16 _inventoryIndex;
64  Graphics::Surface *_inventoryIcon;
65  bool _allDisabled;
66 
67  bool _isUpscaled;
68  Common::SpanOwner<SciSpan<byte> > _upscaleBuffer;
69 
70  Graphics::Surface *loadPict(ResourceId id);
71  Graphics::Surface *createImage(uint32 iconIndex, bool isSelected);
72  void remapColors(Graphics::Surface *surf, const byte *palette);
73 
74  void freeIcons();
75  void addIcon(reg_t obj);
76  void drawIcon(uint16 index, bool selected);
77  bool isIconEnabled(uint16 index) const;
78  void drawDisabledPattern(Graphics::Surface &surface, const Common::Rect &rect);
79  void drawImage(Graphics::Surface *surface, const Common::Rect &rect, bool enabled);
80  bool pointOnIcon(uint32 iconIndex, Common::Point point);
81 };
82 
83 } // End of namespace Sci
84 
85 #endif // SCI_GRAPHICS_MACICONBAR_H
Definition: surface.h:66
Definition: rect.h:144
Definition: span.h:892
Definition: resource.h:327
Definition: palette.h:41
Definition: event.h:120
Definition: formatinfo.h:28
Definition: rect.h:45
Definition: console.h:28
Definition: seg_manager.h:48
Definition: resource.h:161
Definition: screen.h:68
Definition: maciconbar.h:36
Definition: event.h:151
Definition: vm_types.h:39