If you have comments or questions concerning this source file, discuss them in the forum.
/*
Copyright (c) 2002 Nicolai Haehnle
See the license.txt for details. If that file was not included in the
source distributions, please email <prefect@rtts.org>
*/
// gui_menu.h
#ifndef GUI_MENU_H
#define GUI_MENU_H
#include "gui_panel.h"
class GMenuItem {
friend class GMenu;
public:
typedef std::vector<GMenuItem*>::iterator v_it;
GMenuItem(const char *pszString);
~GMenuItem();
LSignal signaled;
inline const char *GetString() const { return m_pszString; }
int GetWidth();
int GetHeight();
void Draw(int ofsx, int ofsy, bool highlighted);
private:
HFont *m_pFont;
char *m_pszString;
};
/*
A menu presents the user with a list of choices which he can click on
to trigger an action (this uses a signal)
*/
class GMenu : public GPanel {
public:
GMenu(GPanel *pParent, int x, int y, int w, int h);
virtual ~GMenu();
GMenuItem *AddItem(const char *pszString);
void RemoveItem(GMenuItem *pItem);
protected:
std::vector<GMenuItem*> m_MenuItems;
virtual void Draw() = 0;
};
#endif
// GUI_MENU_H