diff options
author | sapier <Sapier at GMX dot net> | 2013-12-11 23:07:38 +0100 |
---|---|---|
committer | sapier <Sapier at GMX dot net> | 2013-12-11 23:07:38 +0100 |
commit | 4ccaa6d0af852d0aada01f341a61290a3760cffa (patch) | |
tree | 2fe3ee091345d154eb173223fc332754734e7a0c /src/guiFormSpecMenu.cpp | |
parent | dfd1f87762ca17b4839f87ab62a53fa2f64cf2c8 (diff) | |
download | minetest-4ccaa6d0af852d0aada01f341a61290a3760cffa.tar.gz minetest-4ccaa6d0af852d0aada01f341a61290a3760cffa.tar.bz2 minetest-4ccaa6d0af852d0aada01f341a61290a3760cffa.zip |
Implement search tab and version picker
Diffstat (limited to 'src/guiFormSpecMenu.cpp')
-rw-r--r-- | src/guiFormSpecMenu.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp index 82def7411..87a46d9c9 100644 --- a/src/guiFormSpecMenu.cpp +++ b/src/guiFormSpecMenu.cpp @@ -1856,7 +1856,7 @@ void GUIFormSpecMenu::drawMenu() v2u32 screenSize = driver->getScreenSize(); core::rect<s32> allbg(0, 0, screenSize.X , screenSize.Y); - if (m_bgfullscreen) + if (m_bgfullscreen) driver->draw2DRectangle(m_bgcolor, allbg, &allbg); else driver->draw2DRectangle(m_bgcolor, AbsoluteRect, &AbsoluteClippingRect); @@ -1959,7 +1959,7 @@ void GUIFormSpecMenu::drawMenu() IItemDefManager *idef = m_gamedef->idef(); ItemStack item; item.deSerialize(spec.name, idef); - video::ITexture *texture = idef->getInventoryTexture(item.getDefinition(idef).name, m_gamedef); + video::ITexture *texture = idef->getInventoryTexture(item.getDefinition(idef).name, m_gamedef); // Image size on screen core::rect<s32> imgrect(0, 0, spec.geom.X, spec.geom.Y); // Image rectangle on screen @@ -1998,7 +1998,7 @@ void GUIFormSpecMenu::drawMenu() if (spec.tooltip != "") { core::rect<s32> rect = spec.rect; - if (rect.isPointInside(m_pointer)) + if (rect.isPointInside(m_pointer)) { m_tooltip_element->setVisible(true); this->bringToFront(m_tooltip_element); @@ -2168,7 +2168,7 @@ void GUIFormSpecMenu::acceptInput(bool quit=false) for(u32 i=0; i<m_fields.size(); i++) { const FieldSpec &s = m_fields[i]; - if(s.send) + if(s.send) { if(s.ftype == f_Button) { @@ -2194,8 +2194,11 @@ void GUIFormSpecMenu::acceptInput(bool quit=false) if ((element) && (element->getType() == gui::EGUIET_COMBO_BOX)) { e = static_cast<gui::IGUIComboBox*>(element); } - fields[wide_to_narrow(s.fname.c_str())] = - wide_to_narrow(e->getItem(e->getSelected())); + s32 selected = e->getSelected(); + if (selected >= 0) { + fields[wide_to_narrow(s.fname.c_str())] = + wide_to_narrow(e->getItem(selected)); + } } else if (s.ftype == f_TabHeader) { // no dynamic cast possible due to some distributions shipped @@ -2662,7 +2665,7 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event) for(u32 i=0; i<m_fields.size(); i++) { FieldSpec &s = m_fields[i]; - // if its a button, set the send field so + // if its a button, set the send field so // lua knows which button was pressed if (((s.ftype == f_Button) || (s.ftype == f_CheckBox)) && (s.fid == event.GUIEvent.Caller->getID())) |