Added: Possibility to set text as grayed in combo box

--HG--
branch : develop
feature/pipeline-tools
Nimetu 9 years ago
parent bc8fd9fe2b
commit 1d0d1a505c

@ -63,6 +63,8 @@ namespace NLGUI
uint getTextId(uint i) const;
uint getTextPos(uint nId) const;
const ucstring &getTexture(uint i) const;
void setGrayed(uint i, bool g);
const bool getGrayed(uint i) const;
void removeText(uint nPos);
uint getNumTexts() const {return (uint)_Texts.size();}
void sortText();
@ -132,6 +134,7 @@ namespace NLGUI
sint32 _NotLinkedToDBSelection;
std::vector<std::pair<uint, ucstring> > _Texts;
std::vector<ucstring> _Textures;
std::vector<bool> _Grayed;
// Action Handler called on combo click
std::string _AHOnSelectStart;

@ -262,6 +262,7 @@ namespace NLGUI
dirt();
_Texts.clear();
_Textures.clear();
_Grayed.clear();
}
// ***************************************************************************
@ -270,6 +271,7 @@ namespace NLGUI
dirt();
_Texts.push_back(make_pair((uint)_Texts.size(), text));
_Textures.push_back(std::string());
_Grayed.push_back(false);
}
// ***************************************************************************
@ -292,9 +294,11 @@ namespace NLGUI
{
_Texts[t+1] = _Texts[t];
_Textures[t+1] = _Textures[t];
_Grayed[t+1] = _Grayed[t];
}
_Texts[i] = make_pair(i, text);
_Textures[i] = std::string();
_Grayed[i] = false;
}
else if(i==_Texts.size())
addText(text);
@ -308,6 +312,24 @@ namespace NLGUI
_Textures[i]= texture;
}
// ***************************************************************************
void CDBGroupComboBox::setGrayed(uint i, bool g)
{
dirt();
if(i<_Grayed.size())
_Grayed[i] = g;
}
// ***************************************************************************
const bool CDBGroupComboBox::getGrayed(uint i) const
{
if(i<_Grayed.size())
return _Grayed[i];
else
return false;
}
// ***************************************************************************
void CDBGroupComboBox::removeText(uint nPos)
{
@ -316,6 +338,7 @@ namespace NLGUI
{
_Texts.erase( _Texts.begin()+nPos );
_Textures.erase( _Textures.begin()+nPos );
_Grayed.erase ( _Grayed.begin()+nPos );
}
}
@ -365,7 +388,6 @@ namespace NLGUI
return null;
}
// ***************************************************************************
void CDBGroupComboBox::setSelection(sint32 val)
{
@ -619,6 +641,7 @@ namespace NLGUI
}
groupMenu->addLine(getText(i), "combo_box_select_end", toString(i),
"", std::string(), getTexture(i).toString(), checkable);
groupMenu->setGrayedLine(i, getGrayed(i));
}

@ -2309,7 +2309,12 @@ namespace NLGUI
CDBGroupComboBox *cb = _Forms.back().Entries.back().ComboBox;
if (cb)
{
uint lineIndex = cb->getNumTexts();
cb->addText(_SelectOptionStr);
if (_Forms.back().Entries.back().sbOptionDisabled == lineIndex)
{
cb->setGrayed(lineIndex, true);
}
}
else
{

Loading…
Cancel
Save