ScummVM API documentation
menu.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 LURE_MENU_H
23 #define LURE_MENU_H
24 
25 
26 #include "common/str.h"
27 #include "lure/luredefs.h"
28 #include "lure/disk.h"
29 #include "lure/screen.h"
30 #include "lure/surface.h"
31 #include "lure/events.h"
32 
33 #define NUM_MENUS 3
34 
35 namespace Lure {
36 
38  uint16 left, right;
39  uint16 contentsX, contentsWidth;
40 };
41 
43  Common::Language language;
44  MenuRecordBounds menus[3];
45 };
46 
47 class MenuRecord {
48 private:
49  uint16 _xstart, _width;
50  uint16 _hsxstart, _hsxend;
51  const char **_entries;
52  uint8 _numEntries;
53 public:
54  MenuRecord(const MenuRecordBounds *bounds, int numParams, ...);
55  ~MenuRecord();
56 
57  uint16 xstart() { return _xstart; }
58  uint16 width() { return _width; }
59  uint16 hsxstart() { return _hsxstart; }
60  uint16 hsxend() { return _hsxend; }
61  uint8 numEntries() { return _numEntries; }
62  const char **entries() { return _entries; }
63  const char *getEntry(uint8 index);
64 };
65 
66 class Menu {
67 private:
68  MemoryBlock *_menu;
69  MenuRecord *_menus[NUM_MENUS];
70  MenuRecord *_selectedMenu;
71  Surface *_surfaceMenu;
72  uint8 _selectedIndex;
73 
74  MenuRecord *getMenuAt(int x);
75  uint8 getIndexAt(uint16 x, uint16 y);
76  void toggleHighlight(MenuRecord *menuRec);
77  void toggleHighlightItem(uint8 index);
78 public:
79  Menu();
80  ~Menu();
81  static Menu &getReference();
82  uint8 execute();
83  MenuRecord &getMenu(uint8 index) { return *_menus[index]; }
84 };
85 
86 class PopupMenu {
87 public:
88  static Action Show(uint32 actionMask);
89  static Action Show(int numEntries, Action *actions);
90  static uint16 Show(int numEntries, const char *actions[]);
91  static uint16 ShowInventory();
92  static uint16 ShowItems(Action contextAction, uint16 roomNumber);
93 };
94 
95 } // End of namespace Lure
96 
97 #endif
Definition: menu.h:66
Definition: menu.h:86
Definition: menu.h:47
Definition: menu.h:37
Definition: animseq.h:27
Definition: memory.h:31
Definition: surface.h:35
Definition: menu.h:42
Language
Definition: language.h:45