2007-05-30 21:56:52 +00:00
|
|
|
/* 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.
|
2006-02-11 12:54:56 +00:00
|
|
|
*
|
|
|
|
* 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 2
|
|
|
|
* 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
|
2008-01-05 12:45:14 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2006-02-11 12:54:56 +00:00
|
|
|
* 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, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2006-07-23 15:32:14 +00:00
|
|
|
#ifndef LURE_MENU_H
|
|
|
|
#define LURE_MENU_H
|
2006-02-11 12:54:56 +00:00
|
|
|
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2006-02-11 12:54:56 +00:00
|
|
|
#include "common/str.h"
|
|
|
|
#include "lure/luredefs.h"
|
|
|
|
#include "lure/disk.h"
|
|
|
|
#include "lure/screen.h"
|
|
|
|
#include "lure/surface.h"
|
|
|
|
#include "lure/events.h"
|
|
|
|
|
|
|
|
#define NUM_MENUS 3
|
|
|
|
|
|
|
|
namespace Lure {
|
|
|
|
|
2007-09-30 10:51:33 +00:00
|
|
|
struct MenuRecordBounds {
|
|
|
|
uint16 left, right;
|
|
|
|
uint16 contentsX, contentsWidth;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct MenuRecordLanguage {
|
|
|
|
Common::Language language;
|
|
|
|
MenuRecordBounds menus[3];
|
|
|
|
};
|
|
|
|
|
2006-02-11 12:54:56 +00:00
|
|
|
class MenuRecord {
|
|
|
|
private:
|
|
|
|
uint16 _xstart, _width;
|
|
|
|
uint16 _hsxstart, _hsxend;
|
2006-09-07 11:21:20 +00:00
|
|
|
const char **_entries;
|
2006-02-11 12:54:56 +00:00
|
|
|
uint8 _numEntries;
|
|
|
|
public:
|
2007-09-30 10:51:33 +00:00
|
|
|
MenuRecord(const MenuRecordBounds *bounds, int numParams, ...);
|
2008-05-28 23:28:11 +00:00
|
|
|
~MenuRecord();
|
2006-02-11 12:54:56 +00:00
|
|
|
|
|
|
|
uint16 xstart() { return _xstart; }
|
|
|
|
uint16 width() { return _width; }
|
|
|
|
uint16 hsxstart() { return _hsxstart; }
|
|
|
|
uint16 hsxend() { return _hsxend; }
|
|
|
|
uint8 numEntries() { return _numEntries; }
|
2006-09-07 11:21:20 +00:00
|
|
|
const char **entries() { return _entries; }
|
|
|
|
const char *getEntry(uint8 index);
|
2006-02-11 12:54:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class Menu {
|
|
|
|
private:
|
|
|
|
MemoryBlock *_menu;
|
|
|
|
MenuRecord *_menus[NUM_MENUS];
|
|
|
|
MenuRecord *_selectedMenu;
|
|
|
|
Surface *_surfaceMenu;
|
|
|
|
uint8 _selectedIndex;
|
|
|
|
|
|
|
|
MenuRecord *getMenuAt(int x);
|
2007-09-19 08:40:12 +00:00
|
|
|
uint8 getIndexAt(uint16 x, uint16 y);
|
2006-02-11 12:54:56 +00:00
|
|
|
void toggleHighlight(MenuRecord *menuRec);
|
|
|
|
void toggleHighlightItem(uint8 index);
|
|
|
|
public:
|
2006-02-19 04:04:07 +00:00
|
|
|
Menu();
|
2006-02-11 12:54:56 +00:00
|
|
|
~Menu();
|
|
|
|
static Menu &getReference();
|
|
|
|
uint8 execute();
|
|
|
|
MenuRecord &getMenu(uint8 index) { return *_menus[index]; }
|
|
|
|
};
|
|
|
|
|
|
|
|
class PopupMenu {
|
|
|
|
public:
|
|
|
|
static Action Show(uint32 actionMask);
|
|
|
|
static Action Show(int numEntries, Action *actions);
|
|
|
|
static uint16 Show(int numEntries, const char *actions[]);
|
|
|
|
static uint16 ShowInventory();
|
2007-06-22 12:36:04 +00:00
|
|
|
static uint16 ShowItems(Action contextAction, uint16 roomNumber);
|
2006-02-11 12:54:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Lure
|
|
|
|
|
|
|
|
#endif
|