From 6dfefaf22962e1040dfe4c568d6d0598f46bb70d Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sun, 22 Jul 2012 17:28:09 +0300 Subject: Formspec button_exit[] and image_button_exit[] --- src/guiFormSpecMenu.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/guiFormSpecMenu.cpp') diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp index 02a4fcaad..b2fee9c0d 100644 --- a/src/guiFormSpecMenu.cpp +++ b/src/guiFormSpecMenu.cpp @@ -149,6 +149,7 @@ GUIFormSpecMenu::~GUIFormSpecMenu() delete m_selected_item; delete m_form_src; + delete m_text_dst; } void GUIFormSpecMenu::removeChildren() @@ -398,7 +399,7 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize) Environment->addStaticText(spec.flabel.c_str(), rect, false, true, this, spec.fid); m_fields.push_back(spec); } - else if(type == "button") + else if(type == "button" || type == "button_exit") { v2s32 pos; pos.X = stof(f.next(",")) * (float)spacing.X; @@ -421,10 +422,12 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize) 258+m_fields.size() ); spec.is_button = true; + if(type == "button_exit") + spec.is_exit = true; Environment->addButton(rect, this, spec.fid, spec.flabel.c_str()); m_fields.push_back(spec); } - else if(type == "image_button") + else if(type == "image_button" || type == "image_button_exit") { v2s32 pos; pos.X = stof(f.next(",")) * (float)spacing.X; @@ -448,6 +451,8 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize) 258+m_fields.size() ); spec.is_button = true; + if(type == "image_button_exit") + spec.is_exit = true; video::ITexture *texture = m_gamedef->tsrc()->getTextureRaw(fimage); gui::IGUIButton *e = Environment->addButton(rect, this, spec.fid, spec.flabel.c_str()); @@ -813,8 +818,6 @@ void GUIFormSpecMenu::acceptInput() } } m_text_dst->gotText(fields); - delete m_text_dst; - m_text_dst = NULL; } } @@ -1152,8 +1155,13 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event) { s.send = true; acceptInput(); - quitMenu(); - return true; + if(s.is_exit){ + quitMenu(); + return true; + }else{ + s.send = false; + return true; + } } } } -- cgit v1.2.3