| 1 |
// NS_MenuGeneric.h: interface for the NS_MenuGeneric class. |
| 2 |
// |
| 3 |
////////////////////////////////////////////////////////////////////// |
| 4 |
|
| 5 |
#if !defined(AFX_NS_MENUGENERIC_H__15FC6E14_CE64_4603_96A7_7A10E4350EE4__INCLUDED_) |
| 6 |
#define AFX_NS_MENUGENERIC_H__15FC6E14_CE64_4603_96A7_7A10E4350EE4__INCLUDED_ |
| 7 |
|
| 8 |
#if _MSC_VER > 1000 |
| 9 |
#pragma once |
| 10 |
#endif // _MSC_VER > 1000 |
| 11 |
|
| 12 |
#include <ClanLib/gui.h> |
| 13 |
#include <ClanLib/gui.h> |
| 14 |
#include <ClanLib/signals.h> |
| 15 |
#include <ClanLib/signals.h> |
| 16 |
|
| 17 |
#include <string> |
| 18 |
|
| 19 |
class NS_MenuManager; |
| 20 |
class CL_StyleManager; |
| 21 |
class CL_ComponentManager; |
| 22 |
|
| 23 |
// Generic menu class, serves as base of all other menus in |
| 24 |
// the game. Derive from it and overload virtual methods if |
| 25 |
// you want to add a new menu. |
| 26 |
|
| 27 |
class NS_MenuGeneric : public CL_GUIManager |
| 28 |
{ |
| 29 |
public: |
| 30 |
NS_MenuGeneric(NS_MenuManager & menu_manager, |
| 31 |
CL_StyleManager & style_manager, |
| 32 |
std::string const & path_to_resource); |
| 33 |
virtual ~NS_MenuGeneric(); |
| 34 |
public: |
| 35 |
NS_MenuManager & get_menu_manager() const; |
| 36 |
public: |
| 37 |
virtual void on_begin_paint(); |
| 38 |
// Exit from app |
| 39 |
void on_exit(); |
| 40 |
virtual void switch_to(std::string const & menu) = 0; |
| 41 |
virtual void on_focus_changed(CL_Component * new_comp_focus); |
| 42 |
void run(); |
| 43 |
void show(); |
| 44 |
// Menu manager loops a current menu, and so here should be |
| 45 |
// a things which usualy doing in main loop in games |
| 46 |
// Do a whatever calculations you need in this method. |
| 47 |
// Standard implementation just clears the screen |
| 48 |
virtual void run_task(); |
| 49 |
void quit(); |
| 50 |
private: |
| 51 |
NS_MenuManager & menu_manager; |
| 52 |
volatile bool quit_run; |
| 53 |
protected: |
| 54 |
CL_SlotContainer slots; |
| 55 |
CL_ComponentManager * comp_manager; |
| 56 |
}; |
| 57 |
|
| 58 |
#endif // !defined(AFX_NS_MENUGENERIC_H__15FC6E14_CE64_4603_96A7_7A10E4350EE4__INCLUDED_) |