mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-17 13:01:41 +00:00
Added: Possibility to set text as grayed in combo box
This commit is contained in:
parent
3b9da62b2e
commit
14f1fa63fe
3 changed files with 32 additions and 1 deletions
|
@ -63,6 +63,8 @@ namespace NLGUI
|
||||||
uint getTextId(uint i) const;
|
uint getTextId(uint i) const;
|
||||||
uint getTextPos(uint nId) const;
|
uint getTextPos(uint nId) const;
|
||||||
const ucstring &getTexture(uint i) const;
|
const ucstring &getTexture(uint i) const;
|
||||||
|
void setGrayed(uint i, bool g);
|
||||||
|
const bool getGrayed(uint i) const;
|
||||||
void removeText(uint nPos);
|
void removeText(uint nPos);
|
||||||
uint getNumTexts() const {return (uint)_Texts.size();}
|
uint getNumTexts() const {return (uint)_Texts.size();}
|
||||||
void sortText();
|
void sortText();
|
||||||
|
@ -132,6 +134,7 @@ namespace NLGUI
|
||||||
sint32 _NotLinkedToDBSelection;
|
sint32 _NotLinkedToDBSelection;
|
||||||
std::vector<std::pair<uint, ucstring> > _Texts;
|
std::vector<std::pair<uint, ucstring> > _Texts;
|
||||||
std::vector<ucstring> _Textures;
|
std::vector<ucstring> _Textures;
|
||||||
|
std::vector<bool> _Grayed;
|
||||||
|
|
||||||
// Action Handler called on combo click
|
// Action Handler called on combo click
|
||||||
std::string _AHOnSelectStart;
|
std::string _AHOnSelectStart;
|
||||||
|
|
|
@ -262,6 +262,7 @@ namespace NLGUI
|
||||||
dirt();
|
dirt();
|
||||||
_Texts.clear();
|
_Texts.clear();
|
||||||
_Textures.clear();
|
_Textures.clear();
|
||||||
|
_Grayed.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
@ -270,6 +271,7 @@ namespace NLGUI
|
||||||
dirt();
|
dirt();
|
||||||
_Texts.push_back(make_pair((uint)_Texts.size(), text));
|
_Texts.push_back(make_pair((uint)_Texts.size(), text));
|
||||||
_Textures.push_back(std::string());
|
_Textures.push_back(std::string());
|
||||||
|
_Grayed.push_back(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
@ -292,9 +294,11 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
_Texts[t+1] = _Texts[t];
|
_Texts[t+1] = _Texts[t];
|
||||||
_Textures[t+1] = _Textures[t];
|
_Textures[t+1] = _Textures[t];
|
||||||
|
_Grayed[t+1] = _Grayed[t];
|
||||||
}
|
}
|
||||||
_Texts[i] = make_pair(i, text);
|
_Texts[i] = make_pair(i, text);
|
||||||
_Textures[i] = std::string();
|
_Textures[i] = std::string();
|
||||||
|
_Grayed[i] = false;
|
||||||
}
|
}
|
||||||
else if(i==_Texts.size())
|
else if(i==_Texts.size())
|
||||||
addText(text);
|
addText(text);
|
||||||
|
@ -308,6 +312,24 @@ namespace NLGUI
|
||||||
_Textures[i]= texture;
|
_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)
|
void CDBGroupComboBox::removeText(uint nPos)
|
||||||
{
|
{
|
||||||
|
@ -316,6 +338,7 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
_Texts.erase( _Texts.begin()+nPos );
|
_Texts.erase( _Texts.begin()+nPos );
|
||||||
_Textures.erase( _Textures.begin()+nPos );
|
_Textures.erase( _Textures.begin()+nPos );
|
||||||
|
_Grayed.erase ( _Grayed.begin()+nPos );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,7 +388,6 @@ namespace NLGUI
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
void CDBGroupComboBox::setSelection(sint32 val)
|
void CDBGroupComboBox::setSelection(sint32 val)
|
||||||
{
|
{
|
||||||
|
@ -619,6 +641,7 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
groupMenu->addLine(getText(i), "combo_box_select_end", toString(i),
|
groupMenu->addLine(getText(i), "combo_box_select_end", toString(i),
|
||||||
"", std::string(), getTexture(i).toString(), checkable);
|
"", std::string(), getTexture(i).toString(), checkable);
|
||||||
|
groupMenu->setGrayedLine(i, getGrayed(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2309,7 +2309,12 @@ namespace NLGUI
|
||||||
CDBGroupComboBox *cb = _Forms.back().Entries.back().ComboBox;
|
CDBGroupComboBox *cb = _Forms.back().Entries.back().ComboBox;
|
||||||
if (cb)
|
if (cb)
|
||||||
{
|
{
|
||||||
|
uint lineIndex = cb->getNumTexts();
|
||||||
cb->addText(_SelectOptionStr);
|
cb->addText(_SelectOptionStr);
|
||||||
|
if (_Forms.back().Entries.back().sbOptionDisabled == lineIndex)
|
||||||
|
{
|
||||||
|
cb->setGrayed(lineIndex, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue