2009-11-02 17:59:19 +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.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* 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, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-01-05 01:37:57 +00:00
|
|
|
#ifndef SCI_GRAPHICS_MENU_H
|
|
|
|
#define SCI_GRAPHICS_MENU_H
|
2009-11-02 17:59:19 +00:00
|
|
|
|
|
|
|
namespace Sci {
|
|
|
|
|
2009-11-03 19:33:31 +00:00
|
|
|
enum {
|
|
|
|
SCI_MENU_ATTRIBUTE_SAID = 0x6d,
|
|
|
|
SCI_MENU_ATTRIBUTE_TEXT = 0x6e,
|
2009-11-04 16:11:44 +00:00
|
|
|
SCI_MENU_ATTRIBUTE_KEYPRESS = 0x6f,
|
2009-11-03 19:33:31 +00:00
|
|
|
SCI_MENU_ATTRIBUTE_ENABLED = 0x70,
|
|
|
|
SCI_MENU_ATTRIBUTE_TAG = 0x71
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
SCI_MENU_REPLACE_ONCONTROL = 0x03,
|
|
|
|
SCI_MENU_REPLACE_ONALT = 0x02,
|
|
|
|
SCI_MENU_REPLACE_ONFUNCTION = 'F'
|
|
|
|
};
|
|
|
|
|
|
|
|
struct GuiMenuEntry {
|
|
|
|
uint16 id;
|
|
|
|
Common::String text;
|
2009-11-04 21:03:57 +00:00
|
|
|
int16 textWidth;
|
2009-11-03 19:33:31 +00:00
|
|
|
|
2009-11-04 16:11:44 +00:00
|
|
|
GuiMenuEntry(uint16 curId)
|
2009-11-04 21:03:57 +00:00
|
|
|
: id(curId), textWidth(0) { }
|
2009-11-03 19:33:31 +00:00
|
|
|
};
|
|
|
|
typedef Common::List<GuiMenuEntry *> GuiMenuList;
|
|
|
|
|
|
|
|
struct GuiMenuItemEntry {
|
|
|
|
uint16 menuId;
|
|
|
|
uint16 id;
|
|
|
|
bool enabled;
|
|
|
|
uint16 tag;
|
|
|
|
uint16 keyPress;
|
|
|
|
uint16 keyModifier;
|
|
|
|
bool separatorLine;
|
2009-11-04 16:11:44 +00:00
|
|
|
reg_t saidVmPtr;
|
2009-11-03 19:33:31 +00:00
|
|
|
Common::String text;
|
2009-11-04 16:11:44 +00:00
|
|
|
reg_t textVmPtr;
|
2009-11-04 21:03:57 +00:00
|
|
|
int16 textWidth;
|
2009-11-03 19:33:31 +00:00
|
|
|
Common::String textRightAligned;
|
2009-11-11 19:43:51 +00:00
|
|
|
int16 textRightAlignedWidth;
|
2009-11-03 19:33:31 +00:00
|
|
|
|
2009-11-04 16:11:44 +00:00
|
|
|
GuiMenuItemEntry(uint16 curMenuId, uint16 curId)
|
|
|
|
: menuId(curMenuId), id(curId),
|
2009-11-11 19:43:51 +00:00
|
|
|
enabled(true), tag(0), keyPress(0), keyModifier(0), separatorLine(false), textWidth(0), textRightAlignedWidth(0) {
|
2009-11-04 16:11:44 +00:00
|
|
|
saidVmPtr = NULL_REG;
|
|
|
|
textVmPtr = NULL_REG;
|
|
|
|
}
|
2009-11-03 19:33:31 +00:00
|
|
|
};
|
|
|
|
typedef Common::List<GuiMenuItemEntry *> GuiMenuItemList;
|
|
|
|
|
2010-01-05 01:47:44 +00:00
|
|
|
class Menu {
|
2009-11-02 17:59:19 +00:00
|
|
|
public:
|
2010-01-31 16:21:11 +00:00
|
|
|
Menu(SciEvent *event, SegManager *segMan, SciGui *gui, GfxPorts *ports, GfxPaint16 *paint16, Text *text, GfxScreen *screen, Cursor *cursor);
|
2010-01-05 01:47:44 +00:00
|
|
|
~Menu();
|
2009-11-02 17:59:19 +00:00
|
|
|
|
2009-11-11 21:22:04 +00:00
|
|
|
void reset();
|
2009-11-04 16:11:44 +00:00
|
|
|
void add(Common::String title, Common::String content, reg_t contentVmPtr);
|
2009-11-03 19:33:31 +00:00
|
|
|
void setAttribute(uint16 menuId, uint16 itemId, uint16 attributeId, reg_t value);
|
|
|
|
reg_t getAttribute(uint16 menuId, uint16 itemId, uint16 attributeId);
|
|
|
|
|
|
|
|
void drawBar();
|
2009-11-04 16:16:55 +00:00
|
|
|
reg_t select(reg_t eventObject);
|
2009-11-02 17:59:19 +00:00
|
|
|
|
|
|
|
private:
|
2009-11-04 16:11:44 +00:00
|
|
|
GuiMenuItemEntry *findItem(uint16 menuId, uint16 itemId);
|
2009-11-04 21:03:57 +00:00
|
|
|
void calculateTextWidth();
|
2009-11-11 21:02:49 +00:00
|
|
|
void drawMenu(uint16 oldMenuId, uint16 newMenuId);
|
2009-11-11 20:08:55 +00:00
|
|
|
void invertMenuSelection(uint16 itemId);
|
2010-01-12 19:52:43 +00:00
|
|
|
void interactiveShowMouse();
|
|
|
|
void interactiveRestoreMouse();
|
2009-11-04 21:03:57 +00:00
|
|
|
GuiMenuItemEntry *interactiveWithKeyboard();
|
|
|
|
GuiMenuItemEntry *interactiveWithMouse();
|
2010-01-12 19:52:43 +00:00
|
|
|
uint16 mouseFindMenuSelection(Common::Point mousePosition);
|
2010-01-12 20:38:57 +00:00
|
|
|
uint16 mouseFindMenuItemSelection(Common::Point mousePosition, uint16 menuId);
|
2009-11-11 20:29:39 +00:00
|
|
|
GuiMenuItemEntry *interactiveGetItem(uint16 menuId, uint16 itemId, bool menuChanged);
|
2009-11-02 17:59:19 +00:00
|
|
|
|
2009-12-04 17:38:24 +00:00
|
|
|
SciEvent *_event;
|
2009-11-04 16:11:44 +00:00
|
|
|
SegManager *_segMan;
|
2010-01-19 18:11:09 +00:00
|
|
|
SciGui *_gui;
|
2010-01-31 12:35:15 +00:00
|
|
|
GfxPorts *_ports;
|
|
|
|
GfxPaint16 *_paint16;
|
2010-01-05 01:37:57 +00:00
|
|
|
Text *_text;
|
2010-01-31 16:21:11 +00:00
|
|
|
GfxScreen *_screen;
|
2010-01-05 01:37:57 +00:00
|
|
|
Cursor *_cursor;
|
2009-11-03 19:33:31 +00:00
|
|
|
|
|
|
|
uint16 _listCount;
|
|
|
|
GuiMenuList _list;
|
|
|
|
GuiMenuItemList _itemList;
|
2009-11-05 07:28:44 +00:00
|
|
|
|
|
|
|
uint16 _curMenuId;
|
|
|
|
uint16 _curItemId;
|
|
|
|
|
2010-01-05 01:37:57 +00:00
|
|
|
Port *_oldPort;
|
2010-01-06 17:25:54 +00:00
|
|
|
reg_t _barSaveHandle;
|
|
|
|
reg_t _menuSaveHandle;
|
2009-11-11 19:43:51 +00:00
|
|
|
Common::Rect _menuRect;
|
2010-01-12 19:52:43 +00:00
|
|
|
|
|
|
|
bool _mouseOldState;
|
2009-11-02 17:59:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Sci
|
|
|
|
|
|
|
|
#endif
|