- return false;
-}
-
-gui::IGUIScrollBar* GUIFormSpecMenu::getListboxScrollbar(
- gui::IGUIListBox *listbox)
-{
- // WARNING: BLACK IRRLICHT MAGIC
- // Ordinarily, due to how formspecs work (recreating the entire GUI
- // when something changes), when you select an item in a textlist
- // with more items than fit in the visible area, the newly selected
- // item is scrolled to the bottom of the visible area. This is
- // annoying and breaks GUI designs that use double clicks.
-
- // This function helps fixing this problem by giving direct access
- // to a listbox's scrollbar. This works because CGUIListBox doesn't
- // cache the scrollbar position anywhere.
-
- // If this stops working in a future irrlicht version, consider
- // maintaining a local copy of irr::gui::CGUIListBox, possibly also
- // fixing the other reasons why black irrlicht magic is needed.
-
- core::list<gui::IGUIElement*> children = listbox->getChildren();
- for(core::list<gui::IGUIElement*>::Iterator it = children.begin();
- it != children.end(); ++it) {
- gui::IGUIElement* child = *it;
- if (child && child->getType() == gui::EGUIET_SCROLL_BAR) {
- return static_cast<gui::IGUIScrollBar*>(child);
- }
- }
-
- verbosestream<<"getListboxScrollbar: WARNING: "
- <<"listbox has no scrollbar"<<std::endl;
- return NULL;