aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_settings.cpp
Commit message (Expand)AuthorAge
* Settings: Add get_flags API for mapgen flags (mg_flags, mgv6_spflags, ...) (#...SmallJoker2020-01-25
* Modernize lua read (part 2 & 3): C++ templating assurance (#7410)Loïc Blot2018-06-30
* Allow 'default' parameter in 'settings:get_bool' functionJordan Irwin2017-12-17
* Improvements/fixes for noise parameter input in advanced settingsMuhammad Rifqi Priyo Susanto2017-10-23
* Code modernization: subfolders (#6283)Loïc Blot2017-08-19
* C++11 cleanup on constructors (#6000)Vincent Glize2017-06-19
* Use a settings object for the main settingsShadowNinja2017-05-06
* Replace luaL_reg with luaL_Reg as recent LuaJIT dropped the Lua 5.0 compat (#...Loïc Blot2017-04-08
* Fix warning reported by clang (possible bug in Settings lua api)sfan52016-12-21
* Mod security: Allow read-only access to all mod pathsShadowNinja2016-12-20
* Add mod securityShadowNinja2015-05-16
* Settings: Fail on invalid sequence and throw exception for LuaSettingskwolekr2014-12-12
* Settings: Sanitize setting name everywhere, not just LuaSettingskwolekr2014-12-09
* LuaSettings: Sanitize setting name stringskwolekr2014-11-30
* Add Settings interface for LuaPilzAdam2013-09-10
="hl pps">"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 = narrow_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 != "")){ std::map<std::string, std::string> fields; if (m_accepted) fields[m_formname + "_accepted"] = wide_to_narrow(m_fileOpenDialog->getFileName()); else fields[m_formname + "_canceled"] = m_formname; this->m_text_dst->gotText(fields); } } bool GUIFileSelectMenu::OnEvent(const SEvent& event) { if (event.EventType == irr::EET_GUI_EVENT) { switch (event.GUIEvent.EventType) { case gui::EGET_ELEMENT_CLOSED: case gui::EGET_FILE_CHOOSE_DIALOG_CANCELLED: m_accepted=false; acceptInput(); quitMenu(); return true; break; case gui::EGET_DIRECTORY_SELECTED: case gui::EGET_FILE_SELECTED: m_accepted=true; acceptInput(); quitMenu(); return true; break; default: //ignore this event break; } } return Parent ? Parent->OnEvent(event) : false; }