/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
*/
#ifndef MM1_VIEWS_ENH_SCROLL_VIEW_H
#define MM1_VIEWS_ENH_SCROLL_VIEW_H
#include "mm/mm1/views_enh/text_view.h"
namespace MM {
namespace MM1 {
namespace ViewsEnh {
#define FRAME_BORDER_SIZE 8
#define GLYPH_W 24
#define GLYPH_H 20
#ifdef MM1_NEW_GFX
constexpr int SCROLL_BG_COLOR = 0;
#else
constexpr int SCROLL_BG_COLOR = 153;
#endif
class ScrollView : public TextView {
struct Button {
Shared::Xeen::SpriteResource *_sprites;
Common::Rect _bounds;
int _frame = -1;
Common::KeyState _key;
KeybindingAction _action = KEYBIND_NONE;
bool _enabled = true;
bool _halfSize = false;
Button(Shared::Xeen::SpriteResource *sprites,
const Common::Point &pos, int frame,
const Common::KeyState &key, bool halfSize = false) :
_sprites(sprites), _frame(frame), _key(key), _halfSize(halfSize),
_bounds(Common::Rect(pos.x, pos.y,
pos.x + (halfSize ? GLYPH_W / 2 : GLYPH_W),
pos.y + (halfSize ? GLYPH_H / 2 : GLYPH_H))
) {
}
Button(Shared::Xeen::SpriteResource *sprites,
const Common::Point &pos, int frame,
KeybindingAction action, bool halfSize = false) :
_sprites(sprites), _frame(frame), _action(action), _halfSize(halfSize),
_bounds(Common::Rect(pos.x, pos.y,
pos.x + (halfSize ? GLYPH_W / 2 : GLYPH_W),
pos.y + (halfSize ? GLYPH_H / 2 : GLYPH_H))
) {
}
Button(const Common::Rect &r, const Common::KeyState &key) :
_sprites(nullptr), _bounds(r), _key(key) {
}
Button(const Common::Rect &r, const KeybindingAction action) :
_sprites(nullptr), _bounds(r), _action(action) {
}
};
private:
Common::Array