mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-01 19:43:49 +00:00
Adds ability to utilize bitmap arrays and set entry indexes for popup menus
Also enables the ability to fetch the text of a popup menu item
This commit is contained in:
parent
67dbe4dfe2
commit
a5404ad216
2 changed files with 26 additions and 7 deletions
|
|
@ -139,7 +139,7 @@ GuiMenuBar* PopupMenu::getMenuBarCtrl()
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
// Public Methods
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
S32 PopupMenu::insertItem(S32 pos, const char *title, const char* accelerator, const char* cmd)
|
||||
S32 PopupMenu::insertItem(S32 pos, const char *title, const char* accelerator, const char* cmd, S32 bitmapIndex)
|
||||
{
|
||||
String titleString = title;
|
||||
|
||||
|
|
@ -147,6 +147,7 @@ S32 PopupMenu::insertItem(S32 pos, const char *title, const char* accelerator, c
|
|||
newItem.mID = pos;
|
||||
newItem.mText = titleString;
|
||||
newItem.mCMD = cmd;
|
||||
newItem.mBitmapIndex = bitmapIndex;
|
||||
|
||||
if (titleString.isEmpty() || titleString == String("-"))
|
||||
newItem.mIsSpacer = true;
|
||||
|
|
@ -269,6 +270,14 @@ void PopupMenu::clearItems()
|
|||
mMenuItems.clear();
|
||||
}
|
||||
|
||||
String PopupMenu::getItemText(S32 pos)
|
||||
{
|
||||
if (mMenuItems.empty() || mMenuItems.size() < pos || pos < 0)
|
||||
return String::EmptyString;
|
||||
|
||||
return mMenuItems[pos].mText;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool PopupMenu::canHandleID(U32 id)
|
||||
{
|
||||
|
|
@ -468,9 +477,9 @@ void PopupMenu::hidePopupSubmenus()
|
|||
//-----------------------------------------------------------------------------
|
||||
// Console Methods
|
||||
//-----------------------------------------------------------------------------
|
||||
DefineEngineMethod(PopupMenu, insertItem, S32, (S32 pos, const char * title, const char * accelerator, const char* cmd), ("", "", ""), "(pos[, title][, accelerator][, cmd])")
|
||||
DefineEngineMethod(PopupMenu, insertItem, S32, (S32 pos, const char * title, const char * accelerator, const char* cmd, S32 bitmapIndex), ("", "", "", -1), "(pos[, title][, accelerator][, cmd][, bitmapIndex])")
|
||||
{
|
||||
return object->insertItem(pos, title, accelerator, cmd);
|
||||
return object->insertItem(pos, title, accelerator, cmd, bitmapIndex);
|
||||
}
|
||||
|
||||
DefineEngineMethod(PopupMenu, removeItem, void, (S32 pos), , "(pos)")
|
||||
|
|
@ -506,6 +515,12 @@ DefineEngineMethod(PopupMenu, checkItem, void, (S32 pos, bool checked), , "(pos,
|
|||
object->checkItem(pos, checked);
|
||||
}
|
||||
|
||||
DefineEngineMethod(PopupMenu, getItemText, const char*, (S32 pos), , "(pos)")
|
||||
{
|
||||
return object->getItemText(pos).c_str();
|
||||
}
|
||||
|
||||
|
||||
DefineEngineMethod(PopupMenu, checkRadioItem, void, (S32 firstPos, S32 lastPos, S32 checkPos), , "(firstPos, lastPos, checkPos)")
|
||||
{
|
||||
object->checkRadioItem(firstPos, lastPos, checkPos);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue