mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-12 19:31:41 +00:00
whitespace
This commit is contained in:
parent
6164f36c47
commit
bcc5459818
50 changed files with 2111 additions and 2111 deletions
|
|
@ -30,27 +30,27 @@
|
|||
#include "console/engineAPI.h"
|
||||
|
||||
ConsoleDocClass( GuiPopUpMenuCtrlEx,
|
||||
"@brief A control that allows to select a value from a drop-down list.\n\n"
|
||||
"@brief A control that allows to select a value from a drop-down list.\n\n"
|
||||
|
||||
"This is essentially a GuiPopUpMenuCtrl, but with quite a few more features.\n\n"
|
||||
"This is essentially a GuiPopUpMenuCtrl, but with quite a few more features.\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"new GuiPopUpMenuCtrlEx()\n"
|
||||
"{\n"
|
||||
" maxPopupHeight = \"200\";\n"
|
||||
" sbUsesNAColor = \"0\";\n"
|
||||
" reverseTextList = \"0\";\n"
|
||||
" bitmapBounds = \"16 16\";\n"
|
||||
" hotTrackCallback = \"0\";\n"
|
||||
" extent = \"64 64\";\n"
|
||||
" profile = \"GuiDefaultProfile\";\n"
|
||||
" tooltipProfile = \"GuiToolTipProfile\";\n"
|
||||
"};\n"
|
||||
"@endtsexample\n\n"
|
||||
"@tsexample\n"
|
||||
"new GuiPopUpMenuCtrlEx()\n"
|
||||
"{\n"
|
||||
" maxPopupHeight = \"200\";\n"
|
||||
" sbUsesNAColor = \"0\";\n"
|
||||
" reverseTextList = \"0\";\n"
|
||||
" bitmapBounds = \"16 16\";\n"
|
||||
" hotTrackCallback = \"0\";\n"
|
||||
" extent = \"64 64\";\n"
|
||||
" profile = \"GuiDefaultProfile\";\n"
|
||||
" tooltipProfile = \"GuiToolTipProfile\";\n"
|
||||
"};\n"
|
||||
"@endtsexample\n\n"
|
||||
|
||||
"@see GuiPopUpMenuCtrl\n"
|
||||
"@see GuiPopUpMenuCtrl\n"
|
||||
|
||||
"@ingroup GuiControls\n");
|
||||
"@ingroup GuiControls\n");
|
||||
|
||||
static ColorI colorWhite(255,255,255); // Added
|
||||
|
||||
|
|
@ -331,7 +331,7 @@ GuiPopUpMenuCtrlEx::GuiPopUpMenuCtrlEx(void)
|
|||
mBitmapName = StringTable->insert(""); // Added
|
||||
mBitmapBounds.set(16, 16); // Added
|
||||
mHotTrackItems = false;
|
||||
mIdMax = -1;
|
||||
mIdMax = -1;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
@ -355,13 +355,13 @@ void GuiPopUpMenuCtrlEx::initPersistFields(void)
|
|||
|
||||
//------------------------------------------------------------------------------
|
||||
ConsoleDocFragment _GuiPopUpMenuCtrlExAdd(
|
||||
"@brief Adds an entry to the list\n\n"
|
||||
"@param name String containing the name of the entry\n"
|
||||
"@param idNum Numerical value assigned to the name\n"
|
||||
"@param scheme Optional ID associated with a scheme "
|
||||
"for font coloring, highlight coloring, and selection coloring\n\n",
|
||||
"GuiPopUpMenuCtrlEx",
|
||||
"void add(string name, S32 idNum, S32 scheme=0);"
|
||||
"@brief Adds an entry to the list\n\n"
|
||||
"@param name String containing the name of the entry\n"
|
||||
"@param idNum Numerical value assigned to the name\n"
|
||||
"@param scheme Optional ID associated with a scheme "
|
||||
"for font coloring, highlight coloring, and selection coloring\n\n",
|
||||
"GuiPopUpMenuCtrlEx",
|
||||
"void add(string name, S32 idNum, S32 scheme=0);"
|
||||
);
|
||||
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrlEx, add, void, (const char * name, S32 idNum, U32 scheme), ("", -1, 0), "(string name, int idNum, int scheme=0)")
|
||||
|
|
@ -370,23 +370,23 @@ DefineConsoleMethod( GuiPopUpMenuCtrlEx, add, void, (const char * name, S32 idNu
|
|||
}
|
||||
|
||||
DefineEngineMethod( GuiPopUpMenuCtrlEx, addCategory, void, (const char* text),,
|
||||
"@brief Add a category to the list.\n\n"
|
||||
"@brief Add a category to the list.\n\n"
|
||||
|
||||
"Acts as a separator between entries, allowing for sub-lists\n\n"
|
||||
"Acts as a separator between entries, allowing for sub-lists\n\n"
|
||||
|
||||
"@param text Name of the new category\n\n")
|
||||
"@param text Name of the new category\n\n")
|
||||
{
|
||||
object->addEntry(text, -1, 0);
|
||||
object->addEntry(text, -1, 0);
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiPopUpMenuCtrlEx, addScheme, void, (S32 id, ColorI fontColor, ColorI fontColorHL, ColorI fontColorSEL),,
|
||||
"@brief Create a new scheme and add it to the list of choices for when a new text entry is added.\n\n"
|
||||
"@param id Numerical id associated with this scheme\n"
|
||||
"@param fontColor The base text font color. Formatted as \"Red Green Blue\", each a numerical between 0 and 255.\n"
|
||||
"@param fontColorHL Color of text when being highlighted. Formatted as \"Red Green Blue\", each a numerical between 0 and 255.\n"
|
||||
"@param fontColorSel Color of text when being selected. Formatted as \"Red Green Blue\", each a numerical between 0 and 255.\n")
|
||||
"@brief Create a new scheme and add it to the list of choices for when a new text entry is added.\n\n"
|
||||
"@param id Numerical id associated with this scheme\n"
|
||||
"@param fontColor The base text font color. Formatted as \"Red Green Blue\", each a numerical between 0 and 255.\n"
|
||||
"@param fontColorHL Color of text when being highlighted. Formatted as \"Red Green Blue\", each a numerical between 0 and 255.\n"
|
||||
"@param fontColorSel Color of text when being selected. Formatted as \"Red Green Blue\", each a numerical between 0 and 255.\n")
|
||||
{
|
||||
/*ColorI fontColor, fontColorHL, fontColorSEL;
|
||||
/*ColorI fontColor, fontColorHL, fontColorSEL;
|
||||
U32 r, g, b;
|
||||
char buf[64];
|
||||
|
||||
|
|
@ -457,127 +457,127 @@ DefineEngineMethod( GuiPopUpMenuCtrlEx, addScheme, void, (S32 id, ColorI fontCol
|
|||
//}
|
||||
|
||||
DefineEngineMethod( GuiPopUpMenuCtrlEx, setText, void, ( const char* text),,
|
||||
"@brief Set the current text to a specified value.\n\n"
|
||||
"@param text String containing new text to set\n\n")
|
||||
"@brief Set the current text to a specified value.\n\n"
|
||||
"@param text String containing new text to set\n\n")
|
||||
{
|
||||
object->setText(text);
|
||||
object->setText(text);
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiPopUpMenuCtrlEx, getText, const char*, (),,
|
||||
"@brief Get the.\n\n"
|
||||
"@brief Get the.\n\n"
|
||||
|
||||
"Detailed description\n\n"
|
||||
"Detailed description\n\n"
|
||||
|
||||
"@param param Description\n\n"
|
||||
"@param param Description\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"// Comment\n"
|
||||
"code();\n"
|
||||
"@endtsexample\n\n"
|
||||
"@tsexample\n"
|
||||
"// Comment\n"
|
||||
"code();\n"
|
||||
"@endtsexample\n\n"
|
||||
|
||||
"@return Returns current text in string format")
|
||||
"@return Returns current text in string format")
|
||||
{
|
||||
return object->getText();
|
||||
return object->getText();
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiPopUpMenuCtrlEx, clear, void, (),,
|
||||
"@brief Clear the popup list.\n\n")
|
||||
"@brief Clear the popup list.\n\n")
|
||||
{
|
||||
object->clear();
|
||||
object->clear();
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiPopUpMenuCtrlEx, sort, void, (),,
|
||||
"@brief Sort the list alphabetically.\n\n")
|
||||
"@brief Sort the list alphabetically.\n\n")
|
||||
{
|
||||
object->sort();
|
||||
object->sort();
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiPopUpMenuCtrlEx, sortID, void, (),,
|
||||
"@brief Sort the list by ID.\n\n")
|
||||
"@brief Sort the list by ID.\n\n")
|
||||
{
|
||||
object->sortID();
|
||||
object->sortID();
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiPopUpMenuCtrlEx, forceOnAction, void, (),,
|
||||
"@brief Manually for the onAction function, which updates everything in this control.\n\n")
|
||||
"@brief Manually for the onAction function, which updates everything in this control.\n\n")
|
||||
{
|
||||
object->onAction();
|
||||
object->onAction();
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiPopUpMenuCtrlEx, forceClose, void, (),,
|
||||
"@brief Manually force this control to collapse and close.\n\n")
|
||||
"@brief Manually force this control to collapse and close.\n\n")
|
||||
{
|
||||
object->closePopUp();
|
||||
object->closePopUp();
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiPopUpMenuCtrlEx, getSelected, S32, (),,
|
||||
"@brief Get the current selection of the menu.\n\n"
|
||||
"@return Returns the ID of the currently selected entry")
|
||||
"@brief Get the current selection of the menu.\n\n"
|
||||
"@return Returns the ID of the currently selected entry")
|
||||
{
|
||||
return object->getSelected();
|
||||
return object->getSelected();
|
||||
}
|
||||
|
||||
ConsoleDocFragment _GuiPopUpMenuCtrlExsetSelected(
|
||||
"brief Manually set an entry as selected int his control\n\n"
|
||||
"@param id The ID of the entry to select\n"
|
||||
"@param scripCallback Optional boolean that forces the script callback if true\n",
|
||||
"GuiPopUpMenuCtrlEx",
|
||||
"setSelected(int id, bool scriptCallback=true);"
|
||||
"brief Manually set an entry as selected int his control\n\n"
|
||||
"@param id The ID of the entry to select\n"
|
||||
"@param scripCallback Optional boolean that forces the script callback if true\n",
|
||||
"GuiPopUpMenuCtrlEx",
|
||||
"setSelected(int id, bool scriptCallback=true);"
|
||||
);
|
||||
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrlEx, setSelected, void, (S32 id, bool scriptCallback), (true), "(int id, [scriptCallback=true])"
|
||||
"@hide")
|
||||
"@hide")
|
||||
{
|
||||
object->setSelected( id, scriptCallback );
|
||||
}
|
||||
|
||||
ConsoleDocFragment _GuiPopUpMenuCtrlExsetFirstSelected(
|
||||
"brief Manually set the selection to the first entry\n\n"
|
||||
"@param scripCallback Optional boolean that forces the script callback if true\n",
|
||||
"GuiPopUpMenuCtrlEx",
|
||||
"setSelected(bool scriptCallback=true);"
|
||||
"brief Manually set the selection to the first entry\n\n"
|
||||
"@param scripCallback Optional boolean that forces the script callback if true\n",
|
||||
"GuiPopUpMenuCtrlEx",
|
||||
"setSelected(bool scriptCallback=true);"
|
||||
);
|
||||
|
||||
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrlEx, setFirstSelected, void, (bool scriptCallback), (true), "([scriptCallback=true])"
|
||||
"@hide")
|
||||
"@hide")
|
||||
{
|
||||
object->setFirstSelected( scriptCallback );
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiPopUpMenuCtrlEx, setNoneSelected, void, ( S32 param),,
|
||||
"@brief Clears selection in the menu.\n\n")
|
||||
"@brief Clears selection in the menu.\n\n")
|
||||
{
|
||||
object->setNoneSelected();
|
||||
object->setNoneSelected();
|
||||
}
|
||||
|
||||
|
||||
DefineEngineMethod( GuiPopUpMenuCtrlEx, getTextById, const char*, (S32 id),,
|
||||
"@brief Get the text of an entry based on an ID.\n\n"
|
||||
"@param id The ID assigned to the entry being queried\n\n"
|
||||
"@return String contained by the specified entry, NULL if empty or bad ID")
|
||||
"@brief Get the text of an entry based on an ID.\n\n"
|
||||
"@param id The ID assigned to the entry being queried\n\n"
|
||||
"@return String contained by the specified entry, NULL if empty or bad ID")
|
||||
{
|
||||
return(object->getTextById(id));
|
||||
return(object->getTextById(id));
|
||||
}
|
||||
|
||||
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrlEx, getColorById, ColorI, (S32 id), ,
|
||||
"@brief Get color of an entry's box\n\n"
|
||||
"@param id ID number of entry to query\n\n"
|
||||
"@return ColorI in the format of \"Red Green Blue Alpha\", each of with is a value between 0 - 255")
|
||||
"@brief Get color of an entry's box\n\n"
|
||||
"@param id ID number of entry to query\n\n"
|
||||
"@return ColorI in the format of \"Red Green Blue Alpha\", each of with is a value between 0 - 255")
|
||||
{
|
||||
ColorI color;
|
||||
object->getColoredBox(color, id);
|
||||
return color;
|
||||
return color;
|
||||
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrlEx, setEnumContent, void, ( const char * className, const char * enumName ), ,
|
||||
"@brief This fills the popup with a classrep's field enumeration type info.\n\n"
|
||||
"@brief This fills the popup with a classrep's field enumeration type info.\n\n"
|
||||
"More of a helper function than anything. If console access to the field list is added, "
|
||||
"at least for the enumerated types, then this should go away.\n\n"
|
||||
"@param class Name of the class containing the enum\n"
|
||||
"@param enum Name of the enum value to acces\n")
|
||||
"@param class Name of the class containing the enum\n"
|
||||
"@param enum Name of the enum value to acces\n")
|
||||
{
|
||||
AbstractClassRep * classRep = AbstractClassRep::getClassList();
|
||||
|
||||
|
|
@ -630,24 +630,24 @@ DefineConsoleMethod( GuiPopUpMenuCtrlEx, setEnumContent, void, ( const char * cl
|
|||
//------------------------------------------------------------------------------
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrlEx, findText, S32, (const char * text), , "(string text)"
|
||||
"Returns the id of the first entry containing the specified text or -1 if not found."
|
||||
"@param text String value used for the query\n\n"
|
||||
"@return Numerical ID of entry containing the text.")
|
||||
"@param text String value used for the query\n\n"
|
||||
"@return Numerical ID of entry containing the text.")
|
||||
{
|
||||
return( object->findText( text ) );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrlEx, size, S32, (), ,
|
||||
"@brief Get the size of the menu\n\n"
|
||||
"@return Number of entries in the menu\n")
|
||||
"@brief Get the size of the menu\n\n"
|
||||
"@return Number of entries in the menu\n")
|
||||
{
|
||||
return( object->getNumEntries() );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrlEx, replaceText, void, (S32 boolVal), ,
|
||||
"@brief Flag that causes each new text addition to replace the current entry\n\n"
|
||||
"@param True to turn on replacing, false to disable it")
|
||||
"@brief Flag that causes each new text addition to replace the current entry\n\n"
|
||||
"@param True to turn on replacing, false to disable it")
|
||||
{
|
||||
object->replaceText(boolVal);
|
||||
}
|
||||
|
|
@ -697,43 +697,43 @@ void GuiPopUpMenuCtrlEx::clear()
|
|||
setText("");
|
||||
mSelIndex = -1;
|
||||
mRevNum = 0;
|
||||
mIdMax = -1;
|
||||
mIdMax = -1;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void GuiPopUpMenuCtrlEx::clearEntry( S32 entry )
|
||||
{
|
||||
if( entry == -1 )
|
||||
return;
|
||||
if( entry == -1 )
|
||||
return;
|
||||
|
||||
U32 i = 0;
|
||||
for ( ; i < mEntries.size(); i++ )
|
||||
U32 i = 0;
|
||||
for ( ; i < mEntries.size(); i++ )
|
||||
{
|
||||
if ( mEntries[i].id == entry )
|
||||
break;
|
||||
}
|
||||
|
||||
mEntries.erase( i );
|
||||
mEntries.erase( i );
|
||||
|
||||
if( mEntries.size() <= 0 )
|
||||
{
|
||||
mEntries.setSize(0);
|
||||
setText("");
|
||||
mSelIndex = -1;
|
||||
mRevNum = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( entry == mSelIndex )
|
||||
{
|
||||
setText("");
|
||||
mSelIndex = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
mSelIndex--;
|
||||
}
|
||||
}
|
||||
if( mEntries.size() <= 0 )
|
||||
{
|
||||
mEntries.setSize(0);
|
||||
setText("");
|
||||
mSelIndex = -1;
|
||||
mRevNum = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( entry == mSelIndex )
|
||||
{
|
||||
setText("");
|
||||
mSelIndex = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
mSelIndex--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
@ -797,9 +797,9 @@ void GuiPopUpMenuCtrlEx::sort()
|
|||
if( size > 0 )
|
||||
dQsort( mEntries.address(), size, sizeof(Entry), textCompare);
|
||||
|
||||
// Entries need to re-Id themselves
|
||||
for( U32 i = 0; i < mEntries.size(); i++ )
|
||||
mEntries[i].id = i;
|
||||
// Entries need to re-Id themselves
|
||||
for( U32 i = 0; i < mEntries.size(); i++ )
|
||||
mEntries[i].id = i;
|
||||
}
|
||||
|
||||
// Added to sort by entry ID
|
||||
|
|
@ -810,9 +810,9 @@ void GuiPopUpMenuCtrlEx::sortID()
|
|||
if( size > 0 )
|
||||
dQsort( mEntries.address(), size, sizeof(Entry), idCompare);
|
||||
|
||||
// Entries need to re-Id themselves
|
||||
for( U32 i = 0; i < mEntries.size(); i++ )
|
||||
mEntries[i].id = i;
|
||||
// Entries need to re-Id themselves
|
||||
for( U32 i = 0; i < mEntries.size(); i++ )
|
||||
mEntries[i].id = i;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
@ -823,21 +823,21 @@ void GuiPopUpMenuCtrlEx::addEntry(const char *buf, S32 id, U32 scheme)
|
|||
//Con::printf( "GuiPopupMenuCtrlEx::addEntry - Invalid buffer!" );
|
||||
return;
|
||||
}
|
||||
|
||||
// Ensure that there are no other entries with exactly the same name
|
||||
for ( U32 i = 0; i < mEntries.size(); i++ )
|
||||
|
||||
// Ensure that there are no other entries with exactly the same name
|
||||
for ( U32 i = 0; i < mEntries.size(); i++ )
|
||||
{
|
||||
if ( dStrcmp( mEntries[i].buf, buf ) == 0 )
|
||||
return;
|
||||
}
|
||||
|
||||
// If we don't give an id, create one from mIdMax
|
||||
if( id == -1 )
|
||||
id = mIdMax + 1;
|
||||
|
||||
// Increase mIdMax when an id is greater than it
|
||||
if( id > mIdMax )
|
||||
mIdMax = id;
|
||||
// If we don't give an id, create one from mIdMax
|
||||
if( id == -1 )
|
||||
id = mIdMax + 1;
|
||||
|
||||
// Increase mIdMax when an id is greater than it
|
||||
if( id > mIdMax )
|
||||
mIdMax = id;
|
||||
|
||||
Entry e;
|
||||
dStrcpy( e.buf, buf );
|
||||
|
|
@ -992,20 +992,20 @@ void GuiPopUpMenuCtrlEx::setFirstSelected( bool bNotifyScript )
|
|||
if ( isMethod( "onSelect" ) )
|
||||
Con::executef( this, "onSelect", idval, mEntries[mSelIndex].buf );
|
||||
|
||||
// Execute the popup console command:
|
||||
if ( bNotifyScript )
|
||||
execConsoleCallback();
|
||||
// Execute the popup console command:
|
||||
if ( bNotifyScript )
|
||||
execConsoleCallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( mReplaceText ) // Only change the displayed text if appropriate.
|
||||
setText("");
|
||||
|
||||
mSelIndex = -1;
|
||||
else
|
||||
{
|
||||
if ( mReplaceText ) // Only change the displayed text if appropriate.
|
||||
setText("");
|
||||
|
||||
mSelIndex = -1;
|
||||
|
||||
if ( bNotifyScript )
|
||||
Con::executef( this, "onCancel" );
|
||||
}
|
||||
if ( bNotifyScript )
|
||||
Con::executef( this, "onCancel" );
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
@ -1500,11 +1500,11 @@ void GuiPopUpMenuCtrlEx::onAction()
|
|||
if ( setScroll )
|
||||
{
|
||||
// Resize the text list
|
||||
Point2I cellSize;
|
||||
mTl->getCellSize( cellSize );
|
||||
cellSize.x = width - mSc->scrollBarThickness() - sbBorder;
|
||||
mTl->setCellSize( cellSize );
|
||||
mTl->setWidth( cellSize.x );
|
||||
Point2I cellSize;
|
||||
mTl->getCellSize( cellSize );
|
||||
cellSize.x = width - mSc->scrollBarThickness() - sbBorder;
|
||||
mTl->setCellSize( cellSize );
|
||||
mTl->setWidth( cellSize.x );
|
||||
|
||||
if ( mSelIndex )
|
||||
mTl->scrollCellVisible( Point2I( 0, mSelIndex ) );
|
||||
|
|
@ -1536,7 +1536,7 @@ void GuiPopUpMenuCtrlEx::addChildren()
|
|||
else
|
||||
{
|
||||
// Use the children's profile rather than the parent's profile, if it exists.
|
||||
mSc->setControlProfile( mProfile->getChildrenProfile() ? mProfile->getChildrenProfile() : mProfile );
|
||||
mSc->setControlProfile( mProfile->getChildrenProfile() ? mProfile->getChildrenProfile() : mProfile );
|
||||
}
|
||||
mSc->setField( "hScrollBar", "AlwaysOff" );
|
||||
mSc->setField( "vScrollBar", "dynamic" );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue