This commit is contained in:
Benau 2020-09-11 10:14:38 +08:00
parent 7eb896fe7f
commit ac832caaeb
4 changed files with 19 additions and 2 deletions

View File

@ -59,6 +59,7 @@ CGUISTKListBox::CGUISTKListBox(IGUIEnvironment* environment, IGUIElement* parent
setTabOrder(-1);
updateAbsolutePosition();
m_disactivated = false;
}
@ -298,6 +299,8 @@ bool CGUISTKListBox::OnEvent(const SEvent& event)
if (Selected<0)
Selected = 0;
if (m_disactivated)
Selected = -1;
recalculateScrollPos();
// post the news
@ -427,7 +430,7 @@ void CGUISTKListBox::selectNew(s32 ypos, bool onlyHover)
s32 oldSelected = Selected;
Selected = getItemAt(AbsoluteRect.UpperLeftCorner.X, ypos);
if (Selected == -1 || Items.empty())
if (Selected == -1 || Items.empty() || m_disactivated)
{
Selected = -1;
return;

View File

@ -172,6 +172,12 @@ namespace irr
void setAlternatingDarkness(bool val) { m_alternating_darkness = val; }
gui::IGUIScrollBar* getScrollBar() const { return ScrollBar; }
void setDisactivated(bool val)
{
m_disactivated = val;
if (m_disactivated)
Selected = -1;
}
private:
void recalculateItemHeight();
@ -200,6 +206,7 @@ namespace irr
bool AutoScroll;
bool HighlightWhenNotFocused;
bool m_alternating_darkness;
bool m_disactivated;
};

View File

@ -664,3 +664,10 @@ int ListWidget::getItemID(const std::string &internalName) const
assert(list != NULL);
return list->getRowByInternalName(internalName);
}
// -----------------------------------------------------------------------------
void ListWidget::setActive(bool active)
{
Widget::setActive(active);
getIrrlichtElement<CGUISTKListBox>()->setDisactivated(!active);
}

View File

@ -301,7 +301,7 @@ namespace GUIEngine
void setSortable(bool sortable) { m_sortable = sortable; }
void focusHeader(const NavigationDirection nav);
virtual void setActive(bool active=true);
};
}