diff -r 98ac7e17e725 lib/irrlicht/include/IGUIContextMenu.h --- a/lib/irrlicht/include/IGUIContextMenu.h Wed Aug 27 00:22:50 2008 +0200 +++ b/lib/irrlicht/include/IGUIContextMenu.h Wed Aug 27 00:37:55 2008 +0200 @@ -51,6 +51,12 @@ /** \param idx: Zero based index of the menu item \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 */ diff -r 98ac7e17e725 lib/irrlicht/source/Irrlicht/CGUIContextMenu.cpp --- a/lib/irrlicht/source/Irrlicht/CGUIContextMenu.cpp Wed Aug 27 00:22:50 2008 +0200 +++ b/lib/irrlicht/source/Irrlicht/CGUIContextMenu.cpp Wed Aug 27 00:37:55 2008 +0200 @@ -135,6 +135,26 @@ Items[idx].Text = text; 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; } @@ -658,6 +678,8 @@ { 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 +710,7 @@ { core::stringc tmp; core::stringw txt; + core::stringw txtID; s32 commandid; bool enabled; bool checked; @@ -699,6 +722,9 @@ { 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 +736,7 @@ checked = in->getAttributeAsBool(tmp.c_str()); addItem(core::stringw(txt.c_str()).c_str(), commandid, enabled, false, checked); + Items[i].TextID = txtID; } } diff -r 98ac7e17e725 lib/irrlicht/source/Irrlicht/CGUIContextMenu.h --- a/lib/irrlicht/source/Irrlicht/CGUIContextMenu.h Wed Aug 27 00:22:50 2008 +0200 +++ b/lib/irrlicht/source/Irrlicht/CGUIContextMenu.h Wed Aug 27 00:37:55 2008 +0200 @@ -46,6 +46,12 @@ //! 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 @@ struct SItem { core::stringw Text; + core::stringw TextID; bool IsSeparator; bool Enabled; bool Checked;