ScummVM API documentation
ui_image_picker.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 BLADERUNNER_UI_IMAGE_PICKER_H
23#define BLADERUNNER_UI_IMAGE_PICKER_H
24
25#include "common/array.h"
26#include "common/rect.h"
27#include "common/str.h"
28
29namespace Graphics {
30struct Surface;
31}
32
33namespace BladeRunner {
34
35class BladeRunnerEngine;
36class Shape;
37
38typedef void UIImagePickerCallback(int, void *);
39
41 struct Image {
42 int active;
43 Common::Rect rect;
44 const Shape *shapeUp;
45 const Shape *shapeHovered;
46 const Shape *shapeDown;
47 Common::String tooltip;
48 };
49
51
52 int _isVisible;
53 int _imageCount;
54 int _hoveredImageIndex;
55 int _pressedImageIndex;
56 uint32 _hoverStartTimestamp;
57 int _isButtonDown;
59
60 UIImagePickerCallback *_mouseInCallback;
61 UIImagePickerCallback *_mouseOutCallback;
62 UIImagePickerCallback *_mouseDownCallback;
63 UIImagePickerCallback *_mouseUpCallback;
64 void *_callbackData;
65
66public:
67 UIImagePicker(BladeRunnerEngine *vm, int imageCount);
69
70 void resetImages();
71 bool defineImage(int i, Common::Rect rect, const Shape *shapeUp, const Shape *shapeHovered, const Shape *shapeDown, const char *tooltip);
72
73 bool setImageTop(int i, int top);
74 bool setImageLeft(int i, int left);
75 bool setImageWidth(int i, int16 width);
76 bool setImageShapeUp(int i, const Shape *shapeUp);
77 bool setImageShapeHovered(int i, const Shape *shapeHovered);
78 bool setImageShapeDown(int i, const Shape *shapeDown);
79 bool setImageTooltip(int i, const char *tooltip);
80
81 int getImageTop(int i);
82 int getImageLeft(int i);
83 int getImageWidth(int i);
84
85 bool resetActiveImage(int i);
86
87 void activate(UIImagePickerCallback *mouseInCallback,
88 UIImagePickerCallback *mouseOutCallback,
89 UIImagePickerCallback *mouseDownCallback,
90 UIImagePickerCallback *mouseUpCallback,
91 void *callbackData);
92
93 void deactivate();
94
95 void draw(Graphics::Surface &surface);
96 void drawTooltip(Graphics::Surface &surface, int x, int y);
97
98 bool handleMouseAction(int x, int y, bool down, bool up, bool ignore = false);
99
100 void resetImage(int i);
101 bool hasHoveredImage();
102
103 void reset();
104};
105
106} // End of namespace BladeRunner
107
108#endif
Definition: bladerunner.h:113
Definition: shape.h:41
Definition: ui_image_picker.h:40
Definition: str.h:59
Definition: formatinfo.h:28
Definition: rect.h:536
Definition: surface.h:67