diff -r ca625f2108c7 lib/irrlicht/include/IGUIContextMenu.h --- a/lib/irrlicht/include/IGUIContextMenu.h Wed Sep 23 00:11:38 2009 +0200 +++ b/lib/irrlicht/include/IGUIContextMenu.h Wed Sep 23 00:19:32 2009 +0200 @@ -50,6 +50,12 @@ namespace gui \param text: New text of the item. */ virtual void setItemText(u32 idx, const wchar_t* text) = 0; + //! get a textID which can be used for stringtables + virtual const wchar_t* getItemTextID(u32 idx) const = 0; + + //! set a textID which can be used for stringtables + virtual void setItemTextID(u32 idx, const wchar_t* text) = 0; + //! Check if a menu item is enabled /** \param idx: Zero based index of the menu item */ virtual bool isItemEnabled(u32 idx) const = 0; diff -r ca625f2108c7 lib/irrlicht/source/Irrlicht/CGUIContextMenu.cpp --- a/lib/irrlicht/source/Irrlicht/CGUIContextMenu.cpp Wed Sep 23 00:11:38 2009 +0200 +++ b/lib/irrlicht/source/Irrlicht/CGUIContextMenu.cpp Wed Sep 23 00:19:32 2009 +0200 @@ -138,6 +138,24 @@ void CGUIContextMenu::setItemText(u32 id recalculateSize(); } +//! get a textID which can be used for stringtables +const wchar_t* CGUIContextMenu::getItemTextID(u32 idx) const +{ + if (idx >= Items.size()) + return 0; + + return Items[idx].TextID.c_str(); +} + + +//! set a textID which can be used for stringtables +void CGUIContextMenu::setItemTextID(u32 idx, const wchar_t* text) +{ + if (idx >= Items.size()) + return; + + Items[idx].TextID = text; +} //! Returns if a menu item is enabled bool CGUIContextMenu::isItemEnabled(u32 idx) const @@ -658,6 +676,8 @@ void CGUIContextMenu::serializeAttribute { tmp = "Text"; tmp += i; out->addString(tmp.c_str(), Items[i].Text.c_str()); + tmp = "TextID"; tmp += i; + out->addString(tmp.c_str(), Items[i].TextID.c_str()); tmp = "CommandID"; tmp += i; out->addInt(tmp.c_str(), Items[i].CommandId); tmp = "Enabled"; tmp += i; @@ -688,6 +708,7 @@ void CGUIContextMenu::deserializeAttribu { core::stringc tmp; core::stringw txt; + core::stringw txtID; s32 commandid; bool enabled; bool checked; @@ -700,6 +721,9 @@ void CGUIContextMenu::deserializeAttribu tmp = "Text"; tmp += i; txt = in->getAttributeAsStringW(tmp.c_str()); + tmp = "TextID"; tmp += i; + txtID = in->getAttributeAsStringW(tmp.c_str()); + tmp = "CommandID"; tmp += i; commandid = in->getAttributeAsInt(tmp.c_str()); @@ -710,6 +734,7 @@ void CGUIContextMenu::deserializeAttribu checked = in->getAttributeAsBool(tmp.c_str()); addItem(core::stringw(txt.c_str()).c_str(), commandid, enabled, false, checked); + Items[i].TextID = txtID; } } diff -r ca625f2108c7 lib/irrlicht/source/Irrlicht/CGUIContextMenu.h --- a/lib/irrlicht/source/Irrlicht/CGUIContextMenu.h Wed Sep 23 00:11:38 2009 +0200 +++ b/lib/irrlicht/source/Irrlicht/CGUIContextMenu.h Wed Sep 23 00:19:32 2009 +0200 @@ -46,6 +46,12 @@ namespace gui //! Sets text of the menu item. virtual void setItemText(u32 idx, const wchar_t* text); + + //! get a textID which can be used for stringtables + virtual const wchar_t* getItemTextID(u32 idx) const; + + //! set a textID which can be used for stringtables + virtual void setItemTextID(u32 idx, const wchar_t* text); //! Returns if a menu item is enabled virtual bool isItemEnabled(u32 idx) const; @@ -104,6 +110,7 @@ namespace gui struct SItem { core::stringw Text; + core::stringw TextID; bool IsSeparator; bool Enabled; bool Checked;