From 526a716948910056e2786d07fe074af4a5a7fc97 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Thu, 3 Mar 2016 00:00:30 +0200 Subject: [PATCH] Merge with develop --- code/nel/include/nel/gui/dbgroup_combo_box.h | 3 +++ code/nel/src/gui/dbgroup_combo_box.cpp | 25 +++++++++++++++++++- code/nel/src/gui/group_html.cpp | 5 ++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/code/nel/include/nel/gui/dbgroup_combo_box.h b/code/nel/include/nel/gui/dbgroup_combo_box.h index e7be1de4b..1aac8bb1f 100644 --- a/code/nel/include/nel/gui/dbgroup_combo_box.h +++ b/code/nel/include/nel/gui/dbgroup_combo_box.h @@ -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 > _Texts; std::vector _Textures; + std::vector _Grayed; // Action Handler called on combo click std::string _AHOnSelectStart; diff --git a/code/nel/src/gui/dbgroup_combo_box.cpp b/code/nel/src/gui/dbgroup_combo_box.cpp index dd30957b8..572d69ad4 100644 --- a/code/nel/src/gui/dbgroup_combo_box.cpp +++ b/code/nel/src/gui/dbgroup_combo_box.cpp @@ -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)); } diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index 3b2cfa877..7ae9870e5 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -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 {