OpenMoHAA 0.83.0
Loading...
Searching...
No Matches
uimenu.h
1/*
2===========================================================================
3Copyright (C) 2024 the OpenMoHAA team
4
5This file is part of OpenMoHAA source code.
6
7OpenMoHAA source code is free software; you can redistribute it
8and/or modify it under the terms of the GNU General Public License as
9published by the Free Software Foundation; either version 2 of the License,
10or (at your option) any later version.
11
12OpenMoHAA source code is distributed in the hope that it will be
13useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with OpenMoHAA source code; if not, write to the Free Software
19Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20===========================================================================
21*/
22
23#pragma once
24
25#include "../corepp/listener.h"
26#include "../corepp/stack.h"
27
28class Menu : public Listener
29{
30 qboolean m_fullscreen;
31 int m_vidmode;
32
33public:
34 CLASS_PROTOTYPE(Menu);
35
36public:
37 Container<UIWidget *> m_itemlist;
38 str m_name;
39
40public:
41 Menu();
42 Menu(str name);
43
44 void AddMenuItem(UIWidget *item);
45 void DeleteMenuItem(UIWidget *item);
46 void setName(str name);
47 void ShowMenu(Event *ev);
48 void HideMenu(Event *ev);
49 void ForceShow(void);
50 void ForceHide(void);
51 UIWidget *GetContainerWidget(void);
52 UIWidget *GetNamedWidget(const char *pszName);
53 void Update(void);
54 void RealignWidgets(void);
55 float GetMaxMotionTime(void);
56 void ActivateMenu(void);
57 qboolean isFullscreen(void);
58 void setFullscreen(qboolean bFullScreen);
59 int getVidMode(void);
60 void setVidMode(int iMode);
61 qboolean isVisible(void);
62 void SaveCVars(void);
63 void RestoreCVars(void);
64 void ResetCVars(void);
65 void PassEventToWidget(str name, Event *ev);
66 void PassEventToAllWidgets(Event& ev);
67 void CheckRestart(void);
68};
69
70class MenuManager : public Listener
71{
72 Container<Menu *> m_menulist;
73 Stack<Menu *> m_showmenustack;
74 Stack<Menu *> m_menustack;
75 bool m_lock;
76
77public:
78 CLASS_PROTOTYPE(MenuManager);
79
80public:
81 MenuManager();
82
83 void RealignMenus(void);
84 void AddMenu(Menu *m);
85 void DeleteMenu(Menu *m);
86 void DeleteAllMenus(void);
87 Menu *FindMenu(str name);
88 bool PushMenu(str name);
89 bool ShowMenu(str name);
90 void PushMenu(Event *ev);
91 void PopMenu(qboolean restore_cvars);
92 Menu *CurrentMenu(void);
93 bool ClearMenus(bool force);
94 void ListMenus(void);
95 void UpdateAllMenus(void);
96 void Lock(Event *ev);
97 void Unlock(Event *ev);
98 void PassEventToWidget(str name, Event *ev);
99 void PassEventToAllWidgets(Event& ev);
100 void ResetCVars(void);
101 void CheckRestart(void);
102 bool ForceMenu(str name);
103};
104
105extern MenuManager menuManager;
106
107extern Event EV_PushMenu;
108extern Event EV_LockMenus;
109extern Event EV_UnlockMenus;
110extern Event EV_ShowMenu;
111extern Event EV_HideMenu;
Definition g_local.h:81
Definition uimenu.h:71
Definition uimenu.h:29
Definition stack.h:50
Definition uiwidget.h:103
Definition uiconsole.h:28