aboutsummaryrefslogtreecommitdiff
path: root/src/mapgen/mapgen_flat.cpp
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2021-04-29 20:38:35 +0200
committerLoïc Blot <nerzhul@users.noreply.github.com>2021-05-03 19:49:19 +0200
commit48d5abd5bee7a3f956cb2b92745bed6313cf5d8a (patch)
tree3ecf00918b1011dbe9e141e38eb989e8d0152335 /src/mapgen/mapgen_flat.cpp
parenta93712458b2f8914fdb43ec436c5caf908ba93b8 (diff)
downloadminetest-48d5abd5bee7a3f956cb2b92745bed6313cf5d8a.tar.gz
minetest-48d5abd5bee7a3f956cb2b92745bed6313cf5d8a.tar.bz2
minetest-48d5abd5bee7a3f956cb2b92745bed6313cf5d8a.zip
refacto: remove get_gui_env & draw_load_screen from RenderingEngine singleton
Diffstat (limited to 'src/mapgen/mapgen_flat.cpp')
0 files changed, 0 insertions, 0 deletions
25'>125
/*
 Minetest
 Copyright (C) 2013 sapier

 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 2.1 of the License, or
 (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.

 You should have received a copy of the GNU Lesser General Public License along
 with this program; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#include "guiFileSelectMenu.h"
#include "util/string.h"
#include <locale.h>

GUIFileSelectMenu::GUIFileSelectMenu(gui::IGUIEnvironment* env,
				gui::IGUIElement* parent, s32 id, IMenuManager *menumgr,
				std::string title, std::string formname) :
GUIModalMenu(env, parent, id, menumgr)
{
	m_title = utf8_to_wide(title);
	m_parent = parent;
	m_formname = formname;
	m_text_dst = 0;
	m_accepted = false;
}

GUIFileSelectMenu::~GUIFileSelectMenu()
{
	removeChildren();
}

void GUIFileSelectMenu::removeChildren()
{
	const core::list<gui::IGUIElement*> &children = getChildren();
	core::list<gui::IGUIElement*> children_copy;
	for (core::list<gui::IGUIElement*>::ConstIterator i = children.begin(); i
		 != children.end(); i++)
	{
		children_copy.push_back(*i);
	}
	for (core::list<gui::IGUIElement*>::Iterator i = children_copy.begin(); i
		 != children_copy.end(); i++)
	{
		(*i)->remove();
	}
}

void GUIFileSelectMenu::regenerateGui(v2u32 screensize)
{
	removeChildren();
	m_fileOpenDialog = 0;

	core::dimension2du size(600,400);
	core::rect < s32 > rect(0,0,screensize.X,screensize.Y);

	DesiredRect = rect;
	recalculateAbsolutePosition(false);

	m_fileOpenDialog =
			Environment->addFileOpenDialog(m_title.c_str(),false,this,-1);

	core::position2di pos = core::position2di(screensize.X/2 - size.Width/2,screensize.Y/2 -size.Height/2);
	m_fileOpenDialog->setRelativePosition(pos);
	m_fileOpenDialog->setMinSize(size);
}

void GUIFileSelectMenu::drawMenu()
{
	gui::IGUISkin* skin = Environment->getSkin();
	if (!skin)
		return;

	gui::IGUIElement::draw();
}

void GUIFileSelectMenu::acceptInput() {
	if ((m_text_dst != 0) && (this->m_formname != "")){