1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
// menu.h
//
// (c) Robert Schuster, 2007
//
// Licensed under GNU GPL version 2 or, at your option, any later version.
#ifndef MENU_H
#define MENU_H
#include <vector>
#include "guichan/guichan.hpp"
class MenuSystem;
class MenuEntry;
class MenuAction;
class Menu
{
public:
enum Id
{
NONE, MAIN, SINGLEPLAYER, MULTIPLAYER, OPTIONS, AUDIO_OPTIONS, VIDEO_OPTIONS,
CONTROL_OPTIONS
};
private:
Id parentMenuId;
gcn::Container *container;
int selected;
gcn::Label *title;
std::vector < MenuEntry * > *entries;
MenuSystem *menuSystem;
int locx;
public:
Menu(Id, std::string, int = 0);
~Menu();
void addEntry(MenuEntry *);
void addAction(std::string, MenuAction *);
void addLink(std::string, Menu::Id);
void addBackLink();
void registered(MenuSystem *);
/** Unconditionally make this menu visible.
*/
void enter();
/** Unconditionally make this menu invisible.
*/
void leave();
gcn::Container *getContainer() const;
void resize(int, int);
void up();
void down();
/** Cancels the operation of the currently selected widget. If there
* was no operation activate the parent menu.
*/
void cancel();
void invoke();
void next();
void previous();
void reset();
};
#endif
|