1 /*
2  * OpenClonk, http://www.openclonk.org
3  *
4  * Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de/
5  * Copyright (c) 2009-2016, The OpenClonk Team and contributors
6  *
7  * Distributed under the terms of the ISC license; see accompanying file
8  * "COPYING" for details.
9  *
10  * "Clonk" is a registered trademark of Matthes Bender, used with permission.
11  * See accompanying file "TRADEMARK" for details.
12  *
13  * To redistribute this file separately, substitute the full license texts
14  * for the above references.
15  */
16 // Engine internal C4Menus: Main menu, Options, Player join, Hostility, etc.
17 
18 #ifndef INC_C4MainMenu
19 #define INC_C4MainMenu
20 
21 #include "gui/C4Menu.h"
22 
23 // Menu identification constants for main menus
24 enum
25 {
26 	C4MN_Hostility    = 1, // identification for hostility menu
27 	C4MN_Main         = 2, // identification for all other menus
28 	C4MN_TeamSelection= 3,
29 	C4MN_TeamSwitch   = 4,
30 	C4MN_Observer     = 5
31 };
32 
33 class C4MainMenu : public C4Menu
34 {
35 public:
36 	C4MainMenu();
37 
38 	void Default() override;
39 
40 protected:
41 	int32_t Player;
42 
43 public:
44 	bool Init(C4FacetSurface &fctSymbol, const char *szEmpty, int32_t iPlayer, int32_t iExtra=C4MN_Extra_None, int32_t iExtraData=0, int32_t iId=0, int32_t iStyle=C4MN_Style_Normal);
45 	bool InitRefSym(const C4Facet &fctSymbol, const char *szEmpty, int32_t iPlayer, int32_t iExtra=C4MN_Extra_None, int32_t iExtraData=0, int32_t iId=0, int32_t iStyle=C4MN_Style_Normal);
46 
47 	bool ActivateMain(int32_t iPlayer);
48 	bool ActivateNewPlayer(int32_t iPlayer);
49 	bool ActivateHostility(int32_t iPlayer);
50 	bool ActivateGoals(int32_t iPlayer, bool fDoActivate);
51 	bool ActivateRules(int32_t iPlayer);
52 	bool ActivateSavegame(int32_t iPlayer);
53 	bool ActivateHost(int32_t iPlayer);
54 	bool ActivateClient(int32_t iPlayer);
55 	bool ActivateOptions(int32_t iPlayer, int32_t selection = 0);
56 	bool ActivateDisplay(int32_t iPlayer, int32_t selection = 0);
57 	bool ActivateSurrender(int32_t iPlayer);
58 	bool ActivateObserver();
59 
60 protected:
61 	bool MenuCommand(const char *szCommand, bool fIsCloseCommand) override;
62 
63 	bool DoRefillInternal(bool &rfRefilled) override;
64 
65 	void OnSelectionChanged(int32_t iNewSelection) override;
66 	void OnUserSelectItem(int32_t Player, int32_t iIndex) override;
67 	void OnUserEnter(int32_t Player, int32_t iIndex, bool fRight) override;
68 	void OnUserClose() override;
GetControllingPlayer()69 	int32_t GetControllingPlayer() override { return Player; }
70 
71 public:
72 	bool ActivateCommand(int32_t iPlayer, const char *szCommand);
73 };
74 
75 #endif
76