Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
blob: b4d9b172fb6181cb3d72629a6bc3f60b54ca2a8c (plain)
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
90
91
92
93
94
95
96
/*
   client/mainmenu.h
   This file is part of the Osirion project and is distributed under
   the terms and conditions of the GNU General Public License version 2
*/

#ifndef __INCLUDED_CLIENT_MAINMENU_H__
#define __INCLUDED_CLIENT_MAINMENU_H__

#include "ui/window.h"
#include "ui/bitmap.h"

namespace client
{
	
/**
 * @brief the client's main menu window
 * The MainMenu contains a number of child menu windows,
 * of which only one at a time will be visible
 * */
class MainMenu : public ui::Window
{
public:
	MainMenu(ui::Widget *parent = 0);
	virtual ~MainMenu();
	
	virtual void show();
	
	virtual void hide();
	
	/**
	 * @brief show the main or game menu, depending on the application state
	 * */
	void show_default();
	
	/// show a submenu
	void show_menu(const char * label);	
	
	inline void show_menu(const std::string & label) {
		show_menu(label.c_str());
	}
	
	/// load menu definitions
	void load();
	

protected:
	
	virtual void draw();
	
	virtual void draw_background();
	
	virtual void resize();
	
	virtual bool on_keypress(const int key, const unsigned int modifier);
	
private:
	/// load menu definitions
	void load_definitions();

	/// show the main, game or join menu
	void show_menu();
	
	void show_menu(const Widget *widget);
	
	/// the current active menu
	ui::Widget	*mainmenu_activemenu;
	
	/// the menu to show if the application is not connected
	ui::Widget	*mainmenu_mainmenu;
	
	/// the menu to show if the application is connected but the player has not joined yet
	ui::Widget	*mainmenu_joinmenu;
	
	/// the menu the show if the application is connected and the player has joined
	ui::Widget	*mainmenu_gamemenu;
	
	/// the options menu
	ui::Widget	*mainmenu_optionsmenu;
	
	/// the load game menu
	ui::Widget	*mainmenu_loadmenu;
	
	/// the save game menu
	ui::Widget	*mainmenu_savemenu;
	
	/// the connect to server menu
	ui::Widget	*mainmenu_connectmenu;
	
	std::string	mainmenu_background;
};

}

#endif // __INCLUDED_CLIENT_MAINMENU_H__