MultiCraft2/src/gui/modalMenu.h

82 lines
2.4 KiB
C
Raw Normal View History

2010-12-23 05:31:50 -08:00
/*
2013-02-24 09:40:43 -08:00
Minetest
2013-02-24 10:38:45 -08:00
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
2010-12-23 05:31:50 -08:00
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3.0 of the License, or
2010-12-23 05:31:50 -08:00
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
2010-12-23 05:31:50 -08:00
You should have received a copy of the GNU Lesser General Public License along
2010-12-23 05:31:50 -08:00
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
2010-12-23 05:31:50 -08:00
2012-06-16 18:00:31 -07:00
#include "irrlichttypes_extrabloated.h"
#include "util/string.h"
2010-12-23 05:31:50 -08:00
2011-01-23 07:29:15 -08:00
class GUIModalMenu;
class IMenuManager
{
public:
// A GUIModalMenu calls these when this class is passed as a parameter
2016-02-27 12:51:09 -08:00
virtual void createdMenu(gui::IGUIElement *menu) = 0;
virtual void deletingMenu(gui::IGUIElement *menu) = 0;
2011-01-23 07:29:15 -08:00
};
// Remember to drop() the menu after creating, so that it can
// remove itself when it wants to.
2010-12-23 05:31:50 -08:00
class GUIModalMenu : public gui::IGUIElement
{
public:
GUIModalMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent, s32 id,
IMenuManager *menumgr);
virtual ~GUIModalMenu();
void allowFocusRemoval(bool allow);
bool canTakeFocus(gui::IGUIElement *e);
void draw();
void quitMenu();
void removeChildren();
2011-01-23 07:29:15 -08:00
virtual void regenerateGui(v2u32 screensize) = 0;
virtual void drawMenu() = 0;
virtual bool preprocessEvent(const SEvent& event);
2010-12-23 05:31:50 -08:00
virtual bool OnEvent(const SEvent& event) { return false; };
virtual bool pausesGame() { return false; } // Used for pause menu
2020-09-04 11:07:19 -07:00
#if defined(__ANDROID__) || defined(__IOS__)
virtual bool getAndroidUIInput() { return false; }
bool hasAndroidUIInput();
#endif
protected:
virtual std::wstring getLabelByID(s32 id) = 0;
virtual std::string getNameByID(s32 id) = 0;
v2s32 m_pointer;
v2s32 m_old_pointer; // Mouse position after previous mouse event
v2u32 m_screensize_old;
float m_gui_scale;
2020-09-04 11:07:19 -07:00
#if defined(__ANDROID__) || defined(__IOS__)
v2s32 m_down_pos;
std::string m_jni_field_name;
#endif
#ifdef HAVE_TOUCHSCREENGUI
bool m_touchscreen_visible = true;
#endif
2010-12-23 05:31:50 -08:00
private:
2011-01-23 07:29:15 -08:00
IMenuManager *m_menumgr;
// This might be necessary to expose to the implementation if it
// wants to launch other menus
bool m_allow_focus_removal = false;
2010-12-23 05:31:50 -08:00
};