mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-06 14:00:39 +00:00
whitespace
This commit is contained in:
parent
6164f36c47
commit
bcc5459818
50 changed files with 2111 additions and 2111 deletions
|
|
@ -52,9 +52,9 @@ IMPLEMENT_CALLBACK( GuiListBoxCtrl, onMouseDragged, void, (),(),
|
|||
"@tsexample\n"
|
||||
"// Mouse is dragged across the control, causing the callback to occur.\n"
|
||||
"GuiListBoxCtrl::onMouseDragged(%this)\n"
|
||||
" {\n"
|
||||
" // Code to run whenever the mouse is dragged across the control\n"
|
||||
" }\n"
|
||||
" {\n"
|
||||
" // Code to run whenever the mouse is dragged across the control\n"
|
||||
" }\n"
|
||||
"@endtsexample\n\n"
|
||||
"@see GuiControl\n\n"
|
||||
);
|
||||
|
|
@ -64,9 +64,9 @@ IMPLEMENT_CALLBACK( GuiListBoxCtrl, onClearSelection, void, (),(),
|
|||
"@tsexample\n"
|
||||
"// A selected item is cleared, causing the callback to occur.\n"
|
||||
"GuiListBoxCtrl::onClearSelection(%this)\n"
|
||||
" {\n"
|
||||
" // Code to run whenever a selected item is cleared\n"
|
||||
" }\n"
|
||||
" {\n"
|
||||
" // Code to run whenever a selected item is cleared\n"
|
||||
" }\n"
|
||||
"@endtsexample\n\n"
|
||||
"@see GuiControl\n\n"
|
||||
);
|
||||
|
|
@ -78,9 +78,9 @@ IMPLEMENT_CALLBACK( GuiListBoxCtrl, onUnSelect, void, ( S32 index, const char* i
|
|||
"@tsexample\n"
|
||||
"// A selected item is unselected, causing the callback to occur\n"
|
||||
"GuiListBoxCtrl::onUnSelect(%this, %indexId, %itemText)\n"
|
||||
" {\n"
|
||||
" // Code to run whenever a selected list item is unselected\n"
|
||||
" }\n"
|
||||
" {\n"
|
||||
" // Code to run whenever a selected list item is unselected\n"
|
||||
" }\n"
|
||||
"@endtsexample\n\n"
|
||||
"@see GuiControl\n\n"
|
||||
);
|
||||
|
|
@ -92,9 +92,9 @@ IMPLEMENT_CALLBACK( GuiListBoxCtrl, onSelect, void, ( S32 index , const char* it
|
|||
"@tsexample\n"
|
||||
"// An item in the list is selected, causing the callback to occur\n"
|
||||
"GuiListBoxCtrl::onSelect(%this, %index, %itemText)\n"
|
||||
" {\n"
|
||||
" // Code to run whenever an item in the list is selected\n"
|
||||
" }\n"
|
||||
" {\n"
|
||||
" // Code to run whenever an item in the list is selected\n"
|
||||
" }\n"
|
||||
"@endtsexample\n\n"
|
||||
"@see GuiControl\n\n"
|
||||
);
|
||||
|
|
@ -104,9 +104,9 @@ IMPLEMENT_CALLBACK( GuiListBoxCtrl, onDoubleClick, void, (),(),
|
|||
"@tsexample\n"
|
||||
"// An item in the list is double clicked, causing the callback to occur.\n"
|
||||
"GuiListBoxCtrl::onDoubleClick(%this)\n"
|
||||
" {\n"
|
||||
" // Code to run whenever an item in the control has been double clicked\n"
|
||||
" }\n"
|
||||
" {\n"
|
||||
" // Code to run whenever an item in the control has been double clicked\n"
|
||||
" }\n"
|
||||
"@endtsexample\n\n"
|
||||
"@see GuiControl\n\n"
|
||||
);
|
||||
|
|
@ -121,9 +121,9 @@ IMPLEMENT_CALLBACK( GuiListBoxCtrl, onMouseUp, void, ( S32 itemHit, S32 mouseCli
|
|||
"@tsexample\n"
|
||||
"// Mouse was previously clicked down, and now has been released, causing the callback to occur.\n"
|
||||
"GuiListBoxCtrl::onMouseUp(%this, %itemHit, %mouseClickCount)\n"
|
||||
" {\n"
|
||||
" // Code to call whenever the mouse has been clicked and released on the control\n"
|
||||
" }\n"
|
||||
" {\n"
|
||||
" // Code to call whenever the mouse has been clicked and released on the control\n"
|
||||
" }\n"
|
||||
"@endtsexample\n\n"
|
||||
"@see GuiControl\n\n"
|
||||
);
|
||||
|
|
@ -133,9 +133,9 @@ IMPLEMENT_CALLBACK( GuiListBoxCtrl, onDeleteKey, void, (),(),
|
|||
"@tsexample\n"
|
||||
"// The delete key on the keyboard has been pressed while this control is in focus, causing the callback to occur.\n"
|
||||
"GuiListBoxCtrl::onDeleteKey(%this)\n"
|
||||
" {\n"
|
||||
" // Code to call whenever the delete key is pressed\n"
|
||||
" }\n"
|
||||
" {\n"
|
||||
" // Code to call whenever the delete key is pressed\n"
|
||||
" }\n"
|
||||
"@endtsexample\n\n"
|
||||
"@see GuiControl\n\n"
|
||||
);
|
||||
|
|
@ -146,10 +146,10 @@ IMPLEMENT_CALLBACK( GuiListBoxCtrl, isObjectMirrored, bool, ( const char* indexI
|
|||
"@tsexample\n"
|
||||
"// Engine has requested of the script level to determine if a list entry is mirrored or not.\n"
|
||||
"GuiListBoxCtrl::isObjectMirrored(%this, %indexIdString)\n"
|
||||
" {\n"
|
||||
" // Perform code required to check and see if the list item at the index id is mirrored or not.\n"
|
||||
" return %isMirrored;\n"
|
||||
" }\n"
|
||||
" {\n"
|
||||
" // Perform code required to check and see if the list item at the index id is mirrored or not.\n"
|
||||
" return %isMirrored;\n"
|
||||
" }\n"
|
||||
"@endtsexample\n\n"
|
||||
"@return A boolean value on if the list item is mirrored or not.\n\n"
|
||||
"@see GuiControl\n\n"
|
||||
|
|
@ -234,7 +234,7 @@ void GuiListBoxCtrl::clearItems()
|
|||
// Free our vector lists
|
||||
mItems.clear();
|
||||
mSelectedItems.clear();
|
||||
mFilteredItems.clear();
|
||||
mFilteredItems.clear();
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiListBoxCtrl, clearSelection, void, (),,
|
||||
|
|
@ -1511,8 +1511,8 @@ void GuiListBoxCtrl::_mirror()
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for ( U32 j = 0; j < mFilteredItems.size(); j++ )
|
||||
|
||||
for ( U32 j = 0; j < mFilteredItems.size(); j++ )
|
||||
{
|
||||
if ( (SimObjectId)(uintptr_t)(mFilteredItems[j]->itemData) == curId )
|
||||
{
|
||||
|
|
@ -1571,37 +1571,37 @@ DefineEngineMethod( GuiListBoxCtrl, addFilteredItem, void, (const char* newItem)
|
|||
"@endtsexample\n\n"
|
||||
"@see GuiControl")
|
||||
{
|
||||
String item(newItem);
|
||||
if( item == String::EmptyString )
|
||||
return;
|
||||
String item(newItem);
|
||||
if( item == String::EmptyString )
|
||||
return;
|
||||
|
||||
object->addFilteredItem( item );
|
||||
object->addFilteredItem( item );
|
||||
}
|
||||
|
||||
void GuiListBoxCtrl::addFilteredItem( String item )
|
||||
{
|
||||
// Delete from selected items list
|
||||
for ( S32 i = 0; i < mSelectedItems.size(); i++ )
|
||||
{
|
||||
String itemText = mSelectedItems[i]->itemText;
|
||||
if ( dStrcmp( itemText.c_str(), item.c_str() ) == 0 )
|
||||
{
|
||||
mSelectedItems.erase_fast( i );
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Delete from selected items list
|
||||
for ( S32 i = 0; i < mSelectedItems.size(); i++ )
|
||||
{
|
||||
String itemText = mSelectedItems[i]->itemText;
|
||||
if ( dStrcmp( itemText.c_str(), item.c_str() ) == 0 )
|
||||
{
|
||||
mSelectedItems.erase_fast( i );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for ( S32 i = 0; i < mItems.size(); i++ )
|
||||
{
|
||||
String itemText = mItems[i]->itemText;
|
||||
if( dStrcmp( itemText.c_str(), item.c_str() ) == 0 )
|
||||
{
|
||||
mItems[i]->isSelected = false;
|
||||
mFilteredItems.push_front( mItems[i] );
|
||||
mItems.erase( &mItems[i] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
for ( S32 i = 0; i < mItems.size(); i++ )
|
||||
{
|
||||
String itemText = mItems[i]->itemText;
|
||||
if( dStrcmp( itemText.c_str(), item.c_str() ) == 0 )
|
||||
{
|
||||
mItems[i]->isSelected = false;
|
||||
mFilteredItems.push_front( mItems[i] );
|
||||
mItems.erase( &mItems[i] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiListBoxCtrl, removeFilteredItem, void, ( const char* itemName ),,
|
||||
|
|
@ -1615,23 +1615,23 @@ DefineEngineMethod( GuiListBoxCtrl, removeFilteredItem, void, ( const char* item
|
|||
"@endtsexample\n\n"
|
||||
"@see GuiControl")
|
||||
{
|
||||
String item(itemName);
|
||||
if( item == String::EmptyString )
|
||||
return;
|
||||
String item(itemName);
|
||||
if( item == String::EmptyString )
|
||||
return;
|
||||
|
||||
object->removeFilteredItem( item );
|
||||
object->removeFilteredItem( item );
|
||||
}
|
||||
|
||||
void GuiListBoxCtrl::removeFilteredItem( String item )
|
||||
{
|
||||
for ( S32 i = 0; i < mFilteredItems.size(); i++ )
|
||||
{
|
||||
String itemText = mFilteredItems[i]->itemText;
|
||||
if( dStrcmp( itemText.c_str(), item.c_str() ) == 0 )
|
||||
{
|
||||
mItems.push_front( mFilteredItems[i] );
|
||||
mFilteredItems.erase( &mFilteredItems[i] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
for ( S32 i = 0; i < mFilteredItems.size(); i++ )
|
||||
{
|
||||
String itemText = mFilteredItems[i]->itemText;
|
||||
if( dStrcmp( itemText.c_str(), item.c_str() ) == 0 )
|
||||
{
|
||||
mItems.push_front( mFilteredItems[i] );
|
||||
mFilteredItems.erase( &mFilteredItems[i] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -66,9 +66,9 @@ IMPLEMENT_CALLBACK( GuiMLTextCtrl, onURL, void, ( const char* url ),( url ),
|
|||
"@tsexample\n"
|
||||
"// A URL address was clicked on in the control, causing the callback to occur.\n"
|
||||
"GuiMLTextCtrl::onUrl(%this,%url)\n"
|
||||
" {\n"
|
||||
" // Code to run whenever a URL was clicked on\n"
|
||||
" }\n"
|
||||
" {\n"
|
||||
" // Code to run whenever a URL was clicked on\n"
|
||||
" }\n"
|
||||
"@endtsexample\n\n"
|
||||
"@see GuiControl\n\n"
|
||||
);
|
||||
|
|
@ -80,9 +80,9 @@ IMPLEMENT_CALLBACK( GuiMLTextCtrl, onResize, void, ( S32 width, S32 maxY ),( wid
|
|||
"@tsexample\n"
|
||||
"// Control size changed, causing the callback to occur.\n"
|
||||
"GuiMLTextCtrl::onResize(%this,%width,%maxY)\n"
|
||||
" {\n"
|
||||
" // Code to call when the control size changes\n"
|
||||
" }\n"
|
||||
" {\n"
|
||||
" // Code to call when the control size changes\n"
|
||||
" }\n"
|
||||
"@endtsexample\n\n"
|
||||
"@see GuiControl\n\n"
|
||||
);
|
||||
|
|
@ -191,17 +191,17 @@ DefineEngineMethod( GuiMLTextCtrl, scrollToBottom, void, (),,
|
|||
}
|
||||
|
||||
DefineEngineFunction(StripMLControlChars, const char*, (const char* inString),,
|
||||
"@brief Strip TorqueML control characters from the specified string, returning a 'clean' version.\n\n"
|
||||
"@param inString String to strip TorqueML control characters from.\n"
|
||||
"@tsexample\n"
|
||||
"// Define the string to strip TorqueML control characters from\n"
|
||||
"%string = \"<font:Arial:24>How Now <color:c43c12>Brown <color:000000>Cow\";\n\n"
|
||||
"// Request the stripped version of the string\n"
|
||||
"%strippedString = StripMLControlChars(%string);\n"
|
||||
"@endtsexample\n\n"
|
||||
"@return Version of the inputted string with all TorqueML characters removed.\n\n"
|
||||
"@see References\n\n"
|
||||
"@ingroup GuiCore")
|
||||
"@brief Strip TorqueML control characters from the specified string, returning a 'clean' version.\n\n"
|
||||
"@param inString String to strip TorqueML control characters from.\n"
|
||||
"@tsexample\n"
|
||||
"// Define the string to strip TorqueML control characters from\n"
|
||||
"%string = \"<font:Arial:24>How Now <color:c43c12>Brown <color:000000>Cow\";\n\n"
|
||||
"// Request the stripped version of the string\n"
|
||||
"%strippedString = StripMLControlChars(%string);\n"
|
||||
"@endtsexample\n\n"
|
||||
"@return Version of the inputted string with all TorqueML characters removed.\n\n"
|
||||
"@see References\n\n"
|
||||
"@ingroup GuiCore")
|
||||
{
|
||||
return GuiMLTextCtrl::stripControlChars(inString);
|
||||
}
|
||||
|
|
@ -293,7 +293,7 @@ void GuiMLTextCtrl::initPersistFields()
|
|||
addField("deniedSound", TypeSFXTrackName, Offset(mDeniedSound, GuiMLTextCtrl), "If the text will not fit in the control, the deniedSound is played.");
|
||||
addField("text", TypeCaseString, Offset( mInitialText, GuiMLTextCtrl ), "Text to display in this control.");
|
||||
addField("useURLMouseCursor", TypeBool, Offset(mUseURLMouseCursor, GuiMLTextCtrl), "If true, the mouse cursor will turn into a hand cursor while over a link in the text.\n"
|
||||
"This is dependant on the markup language used by the GuiMLTextCtrl\n");
|
||||
"This is dependant on the markup language used by the GuiMLTextCtrl\n");
|
||||
|
||||
endGroup( "Text" );
|
||||
|
||||
|
|
@ -649,9 +649,9 @@ void GuiMLTextCtrl::ensureCursorOnScreen()
|
|||
// If our parent isn't a scroll control, or we're not the only control
|
||||
// in the content region, bail...
|
||||
GuiControl* pParent = getParent();
|
||||
GuiScrollCtrl *sc = dynamic_cast<GuiScrollCtrl*>(pParent);
|
||||
if(!sc)
|
||||
return;
|
||||
GuiScrollCtrl *sc = dynamic_cast<GuiScrollCtrl*>(pParent);
|
||||
if(!sc)
|
||||
return;
|
||||
|
||||
// Ok. Now we know that our parent is a scroll control. Let's find the
|
||||
// top of the cursor, and it's bottom. We can then scroll the parent control
|
||||
|
|
@ -661,7 +661,7 @@ void GuiMLTextCtrl::ensureCursorOnScreen()
|
|||
ColorI color;
|
||||
getCursorPositionAndColor(cursorTopP, cursorBottomP, color);
|
||||
|
||||
sc->scrollRectVisible(RectI(cursorTopP.x, cursorTopP.y, 1, cursorBottomP.y - cursorTopP.y));
|
||||
sc->scrollRectVisible(RectI(cursorTopP.x, cursorTopP.y, 1, cursorBottomP.y - cursorTopP.y));
|
||||
}
|
||||
|
||||
//--------------------------------------
|
||||
|
|
@ -840,7 +840,7 @@ void GuiMLTextCtrl::onMouseUp(const GuiEvent& event)
|
|||
|
||||
// Convert URL from UTF16 to UTF8.
|
||||
UTF8* url = mTextBuffer.createSubstring8(mHitURL->textStart, mHitURL->len);
|
||||
onURL_callback(url);
|
||||
onURL_callback(url);
|
||||
|
||||
delete[] url;
|
||||
mHitURL = NULL;
|
||||
|
|
@ -1018,7 +1018,7 @@ void GuiMLTextCtrl::scrollToTag( U32 id )
|
|||
Con::warnf( ConsoleLogEntry::General, "GuiMLTextCtrl::scrollToTag - tag id %d not found!", id );
|
||||
return;
|
||||
}
|
||||
pappy->scrollRectVisible(RectI(0, tag->y, 1, 1));
|
||||
pappy->scrollRectVisible(RectI(0, tag->y, 1, 1));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
|
@ -1028,7 +1028,7 @@ void GuiMLTextCtrl::scrollToTop()
|
|||
GuiScrollCtrl *pappy = dynamic_cast<GuiScrollCtrl*>(getParent());
|
||||
if ( !pappy )
|
||||
return;
|
||||
pappy->scrollRectVisible(RectI(0,0,0,0));
|
||||
pappy->scrollRectVisible(RectI(0,0,0,0));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
|
@ -2134,7 +2134,7 @@ textemit:
|
|||
emitNewLine(mScanPos);
|
||||
setHeight( mMaxY );
|
||||
onResize_callback( getWidth(), mMaxY );
|
||||
|
||||
|
||||
//make sure the cursor is still visible - this handles if we're a child of a scroll ctrl...
|
||||
ensureCursorOnScreen();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -233,31 +233,31 @@ void GuiPopupTextListCtrl::onRenderCell(Point2I offset, Point2I cell, bool selec
|
|||
IMPLEMENT_CONOBJECT(GuiPopUpMenuCtrl);
|
||||
|
||||
ConsoleDocClass( GuiPopUpMenuCtrl,
|
||||
"@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"
|
||||
|
||||
"For a nearly identical GUI with additional features, use GuiPopUpMenuCtrlEx.\n\n"
|
||||
"For a nearly identical GUI with additional features, use GuiPopUpMenuCtrlEx.\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"new GuiPopUpMenuCtrl()\n"
|
||||
"{\n"
|
||||
" maxPopupHeight = \"200\";\n"
|
||||
" sbUsesNAColor = \"0\";\n"
|
||||
" reverseTextList = \"0\";\n"
|
||||
" bitmapBounds = \"16 16\";\n"
|
||||
" maxLength = \"1024\";\n"
|
||||
" position = \"56 31\";\n"
|
||||
" extent = \"64 64\";\n"
|
||||
" minExtent = \"8 2\";\n"
|
||||
" profile = \"GuiPopUpMenuProfile\";\n"
|
||||
" tooltipProfile = \"GuiToolTipProfile\";\n"
|
||||
"};\n"
|
||||
"@endtsexample\n\n"
|
||||
"@tsexample\n"
|
||||
"new GuiPopUpMenuCtrl()\n"
|
||||
"{\n"
|
||||
" maxPopupHeight = \"200\";\n"
|
||||
" sbUsesNAColor = \"0\";\n"
|
||||
" reverseTextList = \"0\";\n"
|
||||
" bitmapBounds = \"16 16\";\n"
|
||||
" maxLength = \"1024\";\n"
|
||||
" position = \"56 31\";\n"
|
||||
" extent = \"64 64\";\n"
|
||||
" minExtent = \"8 2\";\n"
|
||||
" profile = \"GuiPopUpMenuProfile\";\n"
|
||||
" tooltipProfile = \"GuiToolTipProfile\";\n"
|
||||
"};\n"
|
||||
"@endtsexample\n\n"
|
||||
|
||||
"@note This is definitely going to be deprecated soon.\n\n"
|
||||
"@note This is definitely going to be deprecated soon.\n\n"
|
||||
|
||||
"@see GuiPopUpMenuCtrlEx for more features and better explanations.\n"
|
||||
"@see GuiPopUpMenuCtrlEx for more features and better explanations.\n"
|
||||
|
||||
"@ingroup GuiControls\n");
|
||||
"@ingroup GuiControls\n");
|
||||
|
||||
GuiPopUpMenuCtrl::GuiPopUpMenuCtrl(void)
|
||||
{
|
||||
|
|
@ -279,7 +279,7 @@ GuiPopUpMenuCtrl::GuiPopUpMenuCtrl(void)
|
|||
mReverseTextList = false; // Added - Don't reverse text list if displaying up
|
||||
mBitmapName = StringTable->insert(""); // Added
|
||||
mBitmapBounds.set(16, 16); // Added
|
||||
mIdMax = -1;
|
||||
mIdMax = -1;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
@ -302,11 +302,11 @@ void GuiPopUpMenuCtrl::initPersistFields(void)
|
|||
//------------------------------------------------------------------------------
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrl, add, void, (const char * name, S32 idNum, U32 scheme), ("", -1, 0), "(string name, int idNum, int scheme=0)")
|
||||
{
|
||||
object->addEntry(name, idNum, scheme);
|
||||
object->addEntry(name, idNum, scheme);
|
||||
}
|
||||
|
||||
DefineConsoleMethod( GuiPopUpMenuCtrl, addScheme, void, (U32 id, ColorI fontColor, ColorI fontColorHL, ColorI fontColorSEL), ,
|
||||
"(int id, ColorI fontColor, ColorI fontColorHL, ColorI fontColorSEL)")
|
||||
"(int id, ColorI fontColor, ColorI fontColorHL, ColorI fontColorSEL)")
|
||||
{
|
||||
|
||||
object->addScheme( id, fontColor, fontColorHL, fontColorSEL );
|
||||
|
|
@ -492,43 +492,43 @@ void GuiPopUpMenuCtrl::clear()
|
|||
setText("");
|
||||
mSelIndex = -1;
|
||||
mRevNum = 0;
|
||||
mIdMax = -1;
|
||||
mIdMax = -1;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void GuiPopUpMenuCtrl::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)
|
||||
{
|
||||
mSelIndex--;
|
||||
}
|
||||
else if( entry == mSelIndex )
|
||||
{
|
||||
setText("");
|
||||
mSelIndex = -1;
|
||||
}
|
||||
}
|
||||
if( mEntries.size() <= 0 )
|
||||
{
|
||||
mEntries.setSize(0);
|
||||
setText("");
|
||||
mSelIndex = -1;
|
||||
mRevNum = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (entry < mSelIndex)
|
||||
{
|
||||
mSelIndex--;
|
||||
}
|
||||
else if( entry == mSelIndex )
|
||||
{
|
||||
setText("");
|
||||
mSelIndex = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
@ -620,21 +620,21 @@ void GuiPopUpMenuCtrl::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 );
|
||||
|
|
@ -802,28 +802,28 @@ void GuiPopUpMenuCtrl::setFirstSelected( bool bNotifyScript )
|
|||
setText( mEntries[0].buf );
|
||||
}
|
||||
|
||||
// Execute the popup console command:
|
||||
if( bNotifyScript )
|
||||
// Execute the popup console command:
|
||||
if( bNotifyScript )
|
||||
{
|
||||
if ( isMethod( "onSelect" ) )
|
||||
Con::executef( this, "onSelect", Con::getIntArg( mEntries[ mSelIndex ].id ), mEntries[mSelIndex].buf );
|
||||
|
||||
execConsoleCallback();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( mReplaceText ) // Only change the displayed text if appropriate.
|
||||
setText("");
|
||||
|
||||
mSelIndex = -1;
|
||||
|
||||
if( bNotifyScript )
|
||||
{
|
||||
Con::executef( this, "onCancel" );
|
||||
execConsoleCallback();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( mReplaceText ) // Only change the displayed text if appropriate.
|
||||
setText("");
|
||||
|
||||
mSelIndex = -1;
|
||||
|
||||
if( bNotifyScript )
|
||||
{
|
||||
Con::executef( this, "onCancel" );
|
||||
execConsoleCallback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
@ -1278,11 +1278,11 @@ void GuiPopUpMenuCtrl::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 ) );
|
||||
|
|
@ -1315,7 +1315,7 @@ void GuiPopUpMenuCtrl::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" );
|
||||
|
|
|
|||
|
|
@ -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" );
|
||||
|
|
|
|||
|
|
@ -37,13 +37,13 @@ ConsoleDocClass( GuiTextCtrl,
|
|||
"@brief GUI control object this displays a single line of text, without TorqueML.\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
" new GuiTextCtrl()\n"
|
||||
" {\n"
|
||||
" text = \"Hello World\";\n"
|
||||
" textID = \"\"STR_HELLO\"\";\n"
|
||||
" maxlength = \"1024\";\n"
|
||||
" //Properties not specific to this control have been omitted from this example.\n"
|
||||
" };\n"
|
||||
" new GuiTextCtrl()\n"
|
||||
" {\n"
|
||||
" text = \"Hello World\";\n"
|
||||
" textID = \"\"STR_HELLO\"\";\n"
|
||||
" maxlength = \"1024\";\n"
|
||||
" //Properties not specific to this control have been omitted from this example.\n"
|
||||
" };\n"
|
||||
"@endtsexample\n\n"
|
||||
|
||||
"@see GuiControl\n"
|
||||
|
|
@ -84,7 +84,7 @@ DefineEngineMethod( GuiTextCtrl, setTextID, void, (const char* textID),,
|
|||
"@see GuiControl"
|
||||
"@see Localization")
|
||||
{
|
||||
object->setTextID( textID );
|
||||
object->setTextID( textID );
|
||||
}
|
||||
|
||||
void GuiTextCtrl::initPersistFields()
|
||||
|
|
@ -117,7 +117,7 @@ void GuiTextCtrl::inspectPostApply()
|
|||
{
|
||||
Parent::inspectPostApply();
|
||||
if(mInitialTextID && *mInitialTextID != 0)
|
||||
setTextID(mInitialTextID);
|
||||
setTextID(mInitialTextID);
|
||||
else if( mConsoleVariable[ 0 ] )
|
||||
setText( getVariable() );
|
||||
else
|
||||
|
|
@ -135,7 +135,7 @@ bool GuiTextCtrl::onWake()
|
|||
return false;
|
||||
}
|
||||
if(mInitialTextID && *mInitialTextID != 0)
|
||||
setTextID(mInitialTextID);
|
||||
setTextID(mInitialTextID);
|
||||
|
||||
if ( mConsoleVariable[0] )
|
||||
{
|
||||
|
|
@ -202,19 +202,19 @@ void GuiTextCtrl::setText(const char *txt)
|
|||
|
||||
void GuiTextCtrl::setTextID(const char *id)
|
||||
{
|
||||
S32 n = Con::getIntVariable(id, -1);
|
||||
if(n != -1)
|
||||
{
|
||||
mInitialTextID = StringTable->insert(id);
|
||||
setTextID(n);
|
||||
}
|
||||
S32 n = Con::getIntVariable(id, -1);
|
||||
if(n != -1)
|
||||
{
|
||||
mInitialTextID = StringTable->insert(id);
|
||||
setTextID(n);
|
||||
}
|
||||
}
|
||||
void GuiTextCtrl::setTextID(S32 id)
|
||||
{
|
||||
const UTF8 *str = getGUIString(id);
|
||||
if(str)
|
||||
setText((const char*)str);
|
||||
//mInitialTextID = id;
|
||||
const UTF8 *str = getGUIString(id);
|
||||
if(str)
|
||||
setText((const char*)str);
|
||||
//mInitialTextID = id;
|
||||
}
|
||||
|
||||
void GuiTextCtrl::onPreRender()
|
||||
|
|
|
|||
|
|
@ -46,17 +46,17 @@ ConsoleDocClass( GuiTextEditCtrl,
|
|||
|
||||
"@tsexample\n"
|
||||
" new GuiTextEditCtrl(MessageHud_Edit)\n"
|
||||
" {\n"
|
||||
" text = \"Hello World\";\n"
|
||||
" validate = \"validateCommand();\"\n"
|
||||
" escapeCommand = \"escapeCommand();\";\n"
|
||||
" historySize = \"5\";\n"
|
||||
" tabComplete = \"true\";\n"
|
||||
" deniedSound = \"DeniedSoundProfile\";\n"
|
||||
" sinkAllKeyEvents = \"true\";\n"
|
||||
" password = \"true\";\n"
|
||||
" passwordMask = \"*\";\n"
|
||||
" //Properties not specific to this control have been omitted from this example.\n"
|
||||
" {\n"
|
||||
" text = \"Hello World\";\n"
|
||||
" validate = \"validateCommand();\"\n"
|
||||
" escapeCommand = \"escapeCommand();\";\n"
|
||||
" historySize = \"5\";\n"
|
||||
" tabComplete = \"true\";\n"
|
||||
" deniedSound = \"DeniedSoundProfile\";\n"
|
||||
" sinkAllKeyEvents = \"true\";\n"
|
||||
" password = \"true\";\n"
|
||||
" passwordMask = \"*\";\n"
|
||||
" //Properties not specific to this control have been omitted from this example.\n"
|
||||
" };\n"
|
||||
"@endtsexample\n\n"
|
||||
|
||||
|
|
@ -72,9 +72,9 @@ IMPLEMENT_CALLBACK( GuiTextEditCtrl, onTabComplete, void, (const char* val),( va
|
|||
"@tsexample\n"
|
||||
"// Tab key has been pressed, causing the callback to occur.\n"
|
||||
"GuiTextEditCtrl::onTabComplete(%this,%val)\n"
|
||||
" {\n"
|
||||
" //Code to run when the onTabComplete callback occurs\n"
|
||||
" }\n"
|
||||
" {\n"
|
||||
" //Code to run when the onTabComplete callback occurs\n"
|
||||
" }\n"
|
||||
"@endtsexample\n\n"
|
||||
"@see GuiTextCtrl\n"
|
||||
"@see GuiControl\n\n"
|
||||
|
|
@ -85,9 +85,9 @@ IMPLEMENT_CALLBACK( GuiTextEditCtrl, onReturn, void, (),(),
|
|||
"@tsexample\n"
|
||||
"// Return or Enter key was pressed, causing the callback to occur.\n"
|
||||
"GuiTextEditCtrl::onReturn(%this)\n"
|
||||
" {\n"
|
||||
" // Code to run when the onReturn callback occurs\n"
|
||||
" }\n"
|
||||
" {\n"
|
||||
" // Code to run when the onReturn callback occurs\n"
|
||||
" }\n"
|
||||
"@endtsexample\n\n"
|
||||
"@see GuiTextCtrl\n"
|
||||
"@see GuiControl\n\n"
|
||||
|
|
@ -98,9 +98,9 @@ IMPLEMENT_CALLBACK( GuiTextEditCtrl, onValidate, void, (),(),
|
|||
"@tsexample\n"
|
||||
"// The control gets validated, causing the callback to occur\n"
|
||||
"GuiTextEditCtrl::onValidated(%this)\n"
|
||||
" {\n"
|
||||
" // Code to run when the control is validated\n"
|
||||
" }\n"
|
||||
" {\n"
|
||||
" // Code to run when the control is validated\n"
|
||||
" }\n"
|
||||
"@endtsexample\n\n"
|
||||
"@see GuiTextCtrl\n"
|
||||
"@see GuiControl\n\n"
|
||||
|
|
@ -139,7 +139,7 @@ GuiTextEditCtrl::GuiTextEditCtrl()
|
|||
mHistoryBuf = NULL;
|
||||
|
||||
#if defined(__MACOSX__)
|
||||
UTF8 bullet[4] = { 0xE2, 0x80, 0xA2, 0 };
|
||||
UTF8 bullet[4] = { 0xE2, 0x80, 0xA2, 0 };
|
||||
|
||||
mPasswordMask = StringTable->insert( bullet );
|
||||
#else
|
||||
|
|
@ -710,10 +710,10 @@ bool GuiTextEditCtrl::onKeyDown(const GuiEvent &event)
|
|||
case KEY_TAB:
|
||||
if ( mTabComplete )
|
||||
{
|
||||
onTabComplete_callback("1");
|
||||
onTabComplete_callback("1");
|
||||
return true;
|
||||
}
|
||||
break; // We don't want to fall through if we don't handle the TAB here.
|
||||
break; // We don't want to fall through if we don't handle the TAB here.
|
||||
|
||||
case KEY_HOME:
|
||||
mBlockStart = 0;
|
||||
|
|
@ -779,10 +779,10 @@ bool GuiTextEditCtrl::onKeyDown(const GuiEvent &event)
|
|||
}
|
||||
return true;
|
||||
|
||||
case KEY_RETURN:
|
||||
case KEY_NUMPADENTER:
|
||||
case KEY_RETURN:
|
||||
case KEY_NUMPADENTER:
|
||||
|
||||
return dealWithEnter(false);
|
||||
return dealWithEnter(false);
|
||||
|
||||
default:
|
||||
break;
|
||||
|
|
@ -998,7 +998,7 @@ bool GuiTextEditCtrl::onKeyDown(const GuiEvent &event)
|
|||
case KEY_RETURN:
|
||||
case KEY_NUMPADENTER:
|
||||
|
||||
return dealWithEnter(true);
|
||||
return dealWithEnter(true);
|
||||
|
||||
case KEY_UP:
|
||||
{
|
||||
|
|
@ -1155,7 +1155,7 @@ dealWithBackspace:
|
|||
case KEY_TAB:
|
||||
if ( mTabComplete )
|
||||
{
|
||||
onTabComplete_callback("0");
|
||||
onTabComplete_callback("0");
|
||||
return( true );
|
||||
}
|
||||
case KEY_UP:
|
||||
|
|
@ -1208,9 +1208,9 @@ bool GuiTextEditCtrl::dealWithEnter( bool clearResponder )
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if( clearResponder )
|
||||
clearFirstResponder();
|
||||
|
||||
if( clearResponder )
|
||||
clearFirstResponder();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1222,13 +1222,13 @@ void GuiTextEditCtrl::setFirstResponder()
|
|||
GuiCanvas *root = getRoot();
|
||||
if (root != NULL)
|
||||
{
|
||||
root->enableKeyboardTranslation();
|
||||
root->enableKeyboardTranslation();
|
||||
|
||||
|
||||
// If the native OS accelerator keys are not disabled
|
||||
// then some key events like Delete, ctrl+V, etc may
|
||||
// not make it down to us.
|
||||
root->setNativeAcceleratorsEnabled( false );
|
||||
// If the native OS accelerator keys are not disabled
|
||||
// then some key events like Delete, ctrl+V, etc may
|
||||
// not make it down to us.
|
||||
root->setNativeAcceleratorsEnabled( false );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1237,8 +1237,8 @@ void GuiTextEditCtrl::onLoseFirstResponder()
|
|||
GuiCanvas *root = getRoot();
|
||||
if( root )
|
||||
{
|
||||
root->setNativeAcceleratorsEnabled( true );
|
||||
root->disableKeyboardTranslation();
|
||||
root->setNativeAcceleratorsEnabled( true );
|
||||
root->disableKeyboardTranslation();
|
||||
}
|
||||
|
||||
//execute the validate command
|
||||
|
|
@ -1546,29 +1546,29 @@ void GuiTextEditCtrl::handleCharInput( U16 ascii )
|
|||
//see if it's a number field
|
||||
if ( mProfile->mNumbersOnly )
|
||||
{
|
||||
if (ascii == '-')
|
||||
{
|
||||
//a minus sign only exists at the beginning, and only a single minus sign
|
||||
if (mCursorPos != 0 && !isAllTextSelected())
|
||||
{
|
||||
invalidText();
|
||||
return;
|
||||
}
|
||||
if (ascii == '-')
|
||||
{
|
||||
//a minus sign only exists at the beginning, and only a single minus sign
|
||||
if (mCursorPos != 0 && !isAllTextSelected())
|
||||
{
|
||||
invalidText();
|
||||
return;
|
||||
}
|
||||
|
||||
if (mInsertOn && (mTextBuffer.getChar(0) == '-'))
|
||||
{
|
||||
invalidText();
|
||||
return;
|
||||
}
|
||||
}
|
||||
// BJTODO: This is probably not unicode safe.
|
||||
else if (ascii != '.' && (ascii < '0' || ascii > '9'))
|
||||
{
|
||||
invalidText();
|
||||
return;
|
||||
}
|
||||
else
|
||||
validText();
|
||||
if (mInsertOn && (mTextBuffer.getChar(0) == '-'))
|
||||
{
|
||||
invalidText();
|
||||
return;
|
||||
}
|
||||
}
|
||||
// BJTODO: This is probably not unicode safe.
|
||||
else if (ascii != '.' && (ascii < '0' || ascii > '9'))
|
||||
{
|
||||
invalidText();
|
||||
return;
|
||||
}
|
||||
else
|
||||
validText();
|
||||
}
|
||||
|
||||
//save the current state
|
||||
|
|
@ -1778,22 +1778,22 @@ DefineEngineMethod( GuiTextEditCtrl, forceValidateText, void, (),,
|
|||
}
|
||||
|
||||
DefineEngineMethod(GuiTextEditCtrl, invalidText, void, (bool playSound), (true),
|
||||
"@brief Trigger the invalid sound and make the box red.nn"
|
||||
"@param playSound Play the invalid text sound or not.n")
|
||||
"@brief Trigger the invalid sound and make the box red.nn"
|
||||
"@param playSound Play the invalid text sound or not.n")
|
||||
{
|
||||
object->invalidText(playSound);
|
||||
object->invalidText(playSound);
|
||||
}
|
||||
|
||||
|
||||
DefineEngineMethod(GuiTextEditCtrl, validText, void, (), ,
|
||||
"@brief Restores the box to normal color.nn")
|
||||
"@brief Restores the box to normal color.nn")
|
||||
{
|
||||
object->validText();
|
||||
object->validText();
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiTextEditCtrl, isValidText, bool, (), ,
|
||||
"@brief Returns if the text is set to valid or not.n"
|
||||
"@Return true if text is set to valid, false if not.nn")
|
||||
"@brief Returns if the text is set to valid or not.n"
|
||||
"@Return true if text is set to valid, false if not.nn")
|
||||
{
|
||||
return object->isValidText();
|
||||
return object->isValidText();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,9 +43,9 @@
|
|||
IMPLEMENT_CONOBJECT(GuiTreeViewCtrl);
|
||||
|
||||
ConsoleDocClass( GuiTreeViewCtrl,
|
||||
"@brief Hierarchical list of text items with optional icons.\n\n"
|
||||
"@brief Hierarchical list of text items with optional icons.\n\n"
|
||||
|
||||
"Can also be used to inspect SimObject hierarchies, primarily within editors.\n\n"
|
||||
"Can also be used to inspect SimObject hierarchies, primarily within editors.\n\n"
|
||||
|
||||
"GuiTreeViewCtrls can either display arbitrary user-defined trees or can be used to display SimObject hierarchies where "
|
||||
"each parent node in the tree is a SimSet or SimGroup and each leaf node is a SimObject.\n\n"
|
||||
|
|
@ -59,30 +59,30 @@ ConsoleDocClass( GuiTreeViewCtrl,
|
|||
"Each item in the tree has a distinct numeric ID that is unique within its tree. The ID of the root item, which is always "
|
||||
"present on a tree, is 0.\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"new GuiTreeViewCtrl(DatablockEditorTree)\n"
|
||||
"{\n"
|
||||
" tabSize = \"16\";\n"
|
||||
" textOffset = \"2\";\n"
|
||||
" fullRowSelect = \"0\";\n"
|
||||
" itemHeight = \"21\";\n"
|
||||
" destroyTreeOnSleep = \"0\";\n"
|
||||
" MouseDragging = \"0\";\n"
|
||||
" MultipleSelections = \"1\";\n"
|
||||
" DeleteObjectAllowed = \"1\";\n"
|
||||
" DragToItemAllowed = \"0\";\n"
|
||||
" ClearAllOnSingleSelection = \"1\";\n"
|
||||
" showRoot = \"1\";\n"
|
||||
" internalNamesOnly = \"0\";\n"
|
||||
" objectNamesOnly = \"0\";\n"
|
||||
" compareToObjectID = \"0\";\n"
|
||||
" Profile = \"GuiTreeViewProfile\";\n"
|
||||
" tooltipprofile = \"GuiToolTipProfile\";\n"
|
||||
" hovertime = \"1000\";\n"
|
||||
"};\n"
|
||||
"@endtsexample\n\n"
|
||||
"@tsexample\n"
|
||||
"new GuiTreeViewCtrl(DatablockEditorTree)\n"
|
||||
"{\n"
|
||||
" tabSize = \"16\";\n"
|
||||
" textOffset = \"2\";\n"
|
||||
" fullRowSelect = \"0\";\n"
|
||||
" itemHeight = \"21\";\n"
|
||||
" destroyTreeOnSleep = \"0\";\n"
|
||||
" MouseDragging = \"0\";\n"
|
||||
" MultipleSelections = \"1\";\n"
|
||||
" DeleteObjectAllowed = \"1\";\n"
|
||||
" DragToItemAllowed = \"0\";\n"
|
||||
" ClearAllOnSingleSelection = \"1\";\n"
|
||||
" showRoot = \"1\";\n"
|
||||
" internalNamesOnly = \"0\";\n"
|
||||
" objectNamesOnly = \"0\";\n"
|
||||
" compareToObjectID = \"0\";\n"
|
||||
" Profile = \"GuiTreeViewProfile\";\n"
|
||||
" tooltipprofile = \"GuiToolTipProfile\";\n"
|
||||
" hovertime = \"1000\";\n"
|
||||
"};\n"
|
||||
"@endtsexample\n\n"
|
||||
|
||||
"@ingroup GuiContainers\n");
|
||||
"@ingroup GuiContainers\n");
|
||||
|
||||
IMPLEMENT_CALLBACK( GuiTreeViewCtrl, onDeleteObject, bool, ( SimObject* object ), ( object ), "" );
|
||||
IMPLEMENT_CALLBACK( GuiTreeViewCtrl, isValidDragTarget, bool, ( S32 id, const char* value ), ( id, value ), "" );
|
||||
|
|
@ -511,7 +511,7 @@ void GuiTreeViewCtrl::Item::getDisplayText(U32 bufLen, char *buf)
|
|||
|
||||
if( showInternalNameOnly() )
|
||||
dSprintf( buf, bufLen, "%s", hasInternalName ? pInternalName : "(none)" );
|
||||
else if( showObjectNameOnly() )
|
||||
else if( showObjectNameOnly() )
|
||||
{
|
||||
if( !hasObjectName && mState.test( ShowClassNameForUnnamed ) )
|
||||
dSprintf( buf, bufLen, "%s", pClassName );
|
||||
|
|
@ -801,7 +801,7 @@ GuiTreeViewCtrl::GuiTreeViewCtrl()
|
|||
mStart = 0;
|
||||
mPossibleRenameItem = NULL;
|
||||
mRenamingItem = NULL;
|
||||
mTempItem = NULL;
|
||||
mTempItem = NULL;
|
||||
mRenameCtrl = NULL;
|
||||
|
||||
mDraggedToItem = 0;
|
||||
|
|
@ -1902,7 +1902,7 @@ void GuiTreeViewCtrl::onPreRender()
|
|||
if(mFlags.test(RebuildVisible))
|
||||
{
|
||||
buildVisibleTree();
|
||||
mFlags.clear(RebuildVisible);
|
||||
mFlags.clear(RebuildVisible);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2084,39 +2084,39 @@ void GuiTreeViewCtrl::syncSelection()
|
|||
}
|
||||
else if (mVisibleItems[i]->isInspectorData())
|
||||
{
|
||||
if(mCompareToObjectID)
|
||||
{
|
||||
if (mVisibleItems[i]->getObject() && mVisibleItems[i]->getObject()->getId() == mSelected[j])
|
||||
{
|
||||
// check to see if it is on the visible items list.
|
||||
bool addToSelectedItems = true;
|
||||
for (S32 k = 0; k < mSelectedItems.size(); k++)
|
||||
{
|
||||
if (mSelectedItems[k]->isInspectorData() && mSelectedItems[k]->getObject() )
|
||||
{
|
||||
if (mSelected[j] == mSelectedItems[k]->getObject()->getId())
|
||||
{
|
||||
// don't add it
|
||||
addToSelectedItems = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mSelected[j] == mSelectedItems[k]->mId)
|
||||
{
|
||||
// don't add it
|
||||
addToSelectedItems = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (addToSelectedItems)
|
||||
{
|
||||
mVisibleItems[i]->mState.set(Item::Selected, true);
|
||||
mSelectedItems.push_front(mVisibleItems[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(mCompareToObjectID)
|
||||
{
|
||||
if (mVisibleItems[i]->getObject() && mVisibleItems[i]->getObject()->getId() == mSelected[j])
|
||||
{
|
||||
// check to see if it is on the visible items list.
|
||||
bool addToSelectedItems = true;
|
||||
for (S32 k = 0; k < mSelectedItems.size(); k++)
|
||||
{
|
||||
if (mSelectedItems[k]->isInspectorData() && mSelectedItems[k]->getObject() )
|
||||
{
|
||||
if (mSelected[j] == mSelectedItems[k]->getObject()->getId())
|
||||
{
|
||||
// don't add it
|
||||
addToSelectedItems = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mSelected[j] == mSelectedItems[k]->mId)
|
||||
{
|
||||
// don't add it
|
||||
addToSelectedItems = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (addToSelectedItems)
|
||||
{
|
||||
mVisibleItems[i]->mState.set(Item::Selected, true);
|
||||
mSelectedItems.push_front(mVisibleItems[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2200,14 +2200,14 @@ void GuiTreeViewCtrl::addSelection( S32 itemOrObjectId, bool update, bool isLast
|
|||
}
|
||||
|
||||
const S32 itemId = item->getID();
|
||||
|
||||
// Ok, we have an item to select which isn't already selected....
|
||||
|
||||
// Ok, we have an item to select which isn't already selected....
|
||||
|
||||
// Do we want to allow more than one selected item?
|
||||
if( !mMultipleSelections )
|
||||
clearSelection();
|
||||
|
||||
// Add this object id to the vector of selected objectIds
|
||||
// Add this object id to the vector of selected objectIds
|
||||
// if it is not already.
|
||||
bool foundMatch = false;
|
||||
for ( S32 i = 0; i < mSelected.size(); i++)
|
||||
|
|
@ -2228,21 +2228,21 @@ void GuiTreeViewCtrl::addSelection( S32 itemOrObjectId, bool update, bool isLast
|
|||
|
||||
// Callback Start
|
||||
// Set and add the selection to the selected items group
|
||||
item->mState.set(Item::Selected, true);
|
||||
mSelectedItems.push_front(item);
|
||||
item->mState.set(Item::Selected, true);
|
||||
mSelectedItems.push_front(item);
|
||||
|
||||
if ( item->isInspectorData() &&
|
||||
item->getObject() )
|
||||
{
|
||||
SimObject *obj = item->getObject();
|
||||
|
||||
|
||||
onAddSelection_callback( obj->getId(), isLastSelection );
|
||||
}
|
||||
else
|
||||
{
|
||||
onAddSelection_callback( item->mId, isLastSelection );
|
||||
}
|
||||
// Callback end
|
||||
// Callback end
|
||||
|
||||
mFlags.set( RebuildVisible );
|
||||
if( update )
|
||||
|
|
@ -2262,7 +2262,7 @@ void GuiTreeViewCtrl::onItemSelected( Item *item )
|
|||
if (item->isInspectorData())
|
||||
{
|
||||
SimObject* object = item->getObject();
|
||||
if( object )
|
||||
if( object )
|
||||
onSelect_callback( object->getId() );
|
||||
if( !item->isParent() && object )
|
||||
onInspect_callback( object->getId() );
|
||||
|
|
@ -2590,9 +2590,9 @@ void GuiTreeViewCtrl::deleteSelection()
|
|||
}
|
||||
else
|
||||
{
|
||||
Vector<Item*> delSelection;
|
||||
delSelection = mSelectedItems;
|
||||
mSelectedItems.clear();
|
||||
Vector<Item*> delSelection;
|
||||
delSelection = mSelectedItems;
|
||||
mSelectedItems.clear();
|
||||
while (!delSelection.empty())
|
||||
{
|
||||
Item * item = delSelection.front();
|
||||
|
|
@ -2600,7 +2600,7 @@ void GuiTreeViewCtrl::deleteSelection()
|
|||
if ( item->mParent )
|
||||
_deleteItem( item );
|
||||
|
||||
delSelection.pop_front();
|
||||
delSelection.pop_front();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2642,7 +2642,7 @@ bool GuiTreeViewCtrl::onKeyDown( const GuiEvent& event )
|
|||
return true;
|
||||
}
|
||||
|
||||
//call a generic bit of script that will let the subclass know that a key was pressed
|
||||
//call a generic bit of script that will let the subclass know that a key was pressed
|
||||
onKeyDown_callback( event.modifier, event.keyCode );
|
||||
}
|
||||
|
||||
|
|
@ -3028,29 +3028,29 @@ void GuiTreeViewCtrl::onMouseUp(const GuiEvent &event)
|
|||
return;
|
||||
}
|
||||
|
||||
BitSet32 hitFlags = 0;
|
||||
BitSet32 hitFlags = 0;
|
||||
Item *item;
|
||||
bool hitCheck = _hitTest( event.mousePoint, item, hitFlags );
|
||||
bool hitCheck = _hitTest( event.mousePoint, item, hitFlags );
|
||||
mRenamingItem = NULL;
|
||||
|
||||
if( hitCheck )
|
||||
{
|
||||
if ( event.mouseClickCount == 1 && !mMouseDragged && mPossibleRenameItem != NULL )
|
||||
{
|
||||
if ( item == mPossibleRenameItem )
|
||||
if( hitCheck )
|
||||
{
|
||||
if ( event.mouseClickCount == 1 && !mMouseDragged && mPossibleRenameItem != NULL )
|
||||
{
|
||||
if ( item == mPossibleRenameItem )
|
||||
showItemRenameCtrl( item );
|
||||
}
|
||||
else // If mouseUp occurs on the same item as mouse down
|
||||
{
|
||||
bool wasSelected = isSelected( item );
|
||||
bool multiSelect = getSelectedItemsCount() > 1;
|
||||
if( wasSelected && multiSelect && item == mTempItem )
|
||||
{
|
||||
clearSelection();
|
||||
addSelection( item->mId );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else // If mouseUp occurs on the same item as mouse down
|
||||
{
|
||||
bool wasSelected = isSelected( item );
|
||||
bool multiSelect = getSelectedItemsCount() > 1;
|
||||
if( wasSelected && multiSelect && item == mTempItem )
|
||||
{
|
||||
clearSelection();
|
||||
addSelection( item->mId );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mPossibleRenameItem = NULL;
|
||||
|
||||
|
|
@ -3482,7 +3482,7 @@ void GuiTreeViewCtrl::onMouseDragged(const GuiEvent &event)
|
|||
if( mDragStartInSelection )
|
||||
onMouseDragged_callback();
|
||||
|
||||
if(!mSupportMouseDragging)
|
||||
if(!mSupportMouseDragging)
|
||||
return;
|
||||
|
||||
if( !mActive || !mAwake || !mVisible )
|
||||
|
|
@ -3652,7 +3652,7 @@ void GuiTreeViewCtrl::onMouseDown(const GuiEvent & event)
|
|||
|
||||
mPossibleRenameItem = NULL;
|
||||
mRenamingItem = NULL;
|
||||
mTempItem = NULL;
|
||||
mTempItem = NULL;
|
||||
|
||||
//
|
||||
if( event.modifier & SI_MULTISELECT )
|
||||
|
|
@ -3704,10 +3704,10 @@ void GuiTreeViewCtrl::onMouseDown(const GuiEvent & event)
|
|||
//select up
|
||||
for (S32 j = (mCurrentDragCell); j < firstSelectedIndex; j++)
|
||||
{
|
||||
if( j != (firstSelectedIndex - 1) )
|
||||
addSelection(mVisibleItems[j]->mId, false, false);
|
||||
else
|
||||
addSelection(mVisibleItems[j]->mId, false);
|
||||
if( j != (firstSelectedIndex - 1) )
|
||||
addSelection(mVisibleItems[j]->mId, false, false);
|
||||
else
|
||||
addSelection(mVisibleItems[j]->mId, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -3715,10 +3715,10 @@ void GuiTreeViewCtrl::onMouseDown(const GuiEvent & event)
|
|||
// select down
|
||||
for (S32 j = firstSelectedIndex+1; j < (mCurrentDragCell+1); j++)
|
||||
{
|
||||
if( j != mCurrentDragCell )
|
||||
addSelection(mVisibleItems[j]->mId, false, false);
|
||||
else
|
||||
addSelection(mVisibleItems[j]->mId, false);
|
||||
if( j != mCurrentDragCell )
|
||||
addSelection(mVisibleItems[j]->mId, false, false);
|
||||
else
|
||||
addSelection(mVisibleItems[j]->mId, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3736,39 +3736,39 @@ void GuiTreeViewCtrl::onMouseDown(const GuiEvent & event)
|
|||
}
|
||||
else if ( !hitFlags.test(OnImage) )
|
||||
{
|
||||
mTempItem = item;
|
||||
mTempItem = item;
|
||||
|
||||
bool wasSelected = isSelected( item );
|
||||
bool multiSelect = getSelectedItemsCount() > 1;
|
||||
|
||||
if( !wasSelected || !multiSelect )
|
||||
{
|
||||
if ( mClearAllOnSingleSelection )
|
||||
clearSelection();
|
||||
|
||||
if( !wasSelected || !multiSelect )
|
||||
{
|
||||
if ( mClearAllOnSingleSelection )
|
||||
clearSelection();
|
||||
|
||||
if ( !wasSelected || mClearAllOnSingleSelection )
|
||||
addSelection( item->mId );
|
||||
if ( !wasSelected || mClearAllOnSingleSelection )
|
||||
addSelection( item->mId );
|
||||
|
||||
if ( wasSelected &&
|
||||
!multiSelect &&
|
||||
mCanRenameObjects &&
|
||||
hitFlags.test(OnText) &&
|
||||
mFlags.test(IsEditable) &&
|
||||
item->isInspectorData() &&
|
||||
item->getObject() &&
|
||||
if ( wasSelected &&
|
||||
!multiSelect &&
|
||||
mCanRenameObjects &&
|
||||
hitFlags.test(OnText) &&
|
||||
mFlags.test(IsEditable) &&
|
||||
item->isInspectorData() &&
|
||||
item->getObject() &&
|
||||
item->getObject()->isNameChangeAllowed() &&
|
||||
item != mRoot &&
|
||||
event.mouseClickCount == 1 )
|
||||
{
|
||||
mPossibleRenameItem = item;
|
||||
item != mRoot &&
|
||||
event.mouseClickCount == 1 )
|
||||
{
|
||||
mPossibleRenameItem = item;
|
||||
|
||||
if ( isMethod( "canRenameObject" ) )
|
||||
{
|
||||
if( canRenameObject_callback( item->getObject() ) )
|
||||
mPossibleRenameItem = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( isMethod( "canRenameObject" ) )
|
||||
{
|
||||
if( canRenameObject_callback( item->getObject() ) )
|
||||
mPossibleRenameItem = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -4221,7 +4221,7 @@ void GuiTreeViewCtrl::onRenderCell(Point2I offset, Point2I cell, bool, bool )
|
|||
|
||||
if( item->mState.test(Item::MouseOverText) )
|
||||
{
|
||||
fontColor = mProfile->mFontColorHL;
|
||||
fontColor = mProfile->mFontColorHL;
|
||||
}
|
||||
|
||||
drawer->setBitmapModulation( fontColor );
|
||||
|
|
@ -4551,9 +4551,9 @@ void GuiTreeViewCtrl::inspectorSearch(Item * item, Item * parent, SimSet * paren
|
|||
|
||||
bool GuiTreeViewCtrl::objectSearch( const SimObject *object, Item **item )
|
||||
{
|
||||
for ( U32 i = 0; i < mItems.size(); i++ )
|
||||
{
|
||||
Item *pItem = mItems[i];
|
||||
for ( U32 i = 0; i < mItems.size(); i++ )
|
||||
{
|
||||
Item *pItem = mItems[i];
|
||||
|
||||
if ( !pItem )
|
||||
continue;
|
||||
|
|
@ -4565,16 +4565,16 @@ bool GuiTreeViewCtrl::objectSearch( const SimObject *object, Item **item )
|
|||
continue;
|
||||
#endif
|
||||
|
||||
SimObject *pObj = pItem->getObject();
|
||||
SimObject *pObj = pItem->getObject();
|
||||
|
||||
if ( pObj && pObj == object )
|
||||
{
|
||||
*item = pItem;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if ( pObj && pObj == object )
|
||||
{
|
||||
*item = pItem;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -4592,7 +4592,7 @@ bool GuiTreeViewCtrl::onVirtualParentBuild(Item *item, bool bForceFullUpdate)
|
|||
}
|
||||
|
||||
// Skip the next stuff unless we're expanded...
|
||||
if(!item->isExpanded() && !bForceFullUpdate && !( item == mRoot && !mShowRoot ) )
|
||||
if(!item->isExpanded() && !bForceFullUpdate && !( item == mRoot && !mShowRoot ) )
|
||||
return true;
|
||||
|
||||
// Verify that we have all the kids we should in here...
|
||||
|
|
@ -4704,8 +4704,8 @@ S32 GuiTreeViewCtrl::findItemByName(const char *name)
|
|||
{
|
||||
if ( !mItems[i] )
|
||||
continue;
|
||||
if( mItems[i]->mState.test( Item::InspectorData ) )
|
||||
continue;
|
||||
if( mItems[i]->mState.test( Item::InspectorData ) )
|
||||
continue;
|
||||
if (mItems[i] && dStrcmp(mItems[i]->getText(),name) == 0)
|
||||
return mItems[i]->mId;
|
||||
}
|
||||
|
|
@ -4721,10 +4721,10 @@ S32 GuiTreeViewCtrl::findItemByValue(const char *name)
|
|||
{
|
||||
if (!mItems[i])
|
||||
continue;
|
||||
if( mItems[i]->mState.test( Item::InspectorData ) )
|
||||
continue;
|
||||
if (mItems[i] && dStrcmp(mItems[i]->getValue(),name) == 0)
|
||||
return mItems[i]->mId;
|
||||
if( mItems[i]->mState.test( Item::InspectorData ) )
|
||||
continue;
|
||||
if (mItems[i] && dStrcmp(mItems[i]->getValue(),name) == 0)
|
||||
return mItems[i]->mId;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -4874,7 +4874,7 @@ DefineEngineMethod( GuiTreeViewCtrl, insertItem, S32, ( S32 parentId, const char
|
|||
|
||||
DefineEngineMethod( GuiTreeViewCtrl, insertObject, S32, ( S32 parentId, SimObject* obj, bool OKToEdit ), (false), "Inserts object as a child to the given parent." )
|
||||
{
|
||||
return object->insertObject(parentId, obj, OKToEdit);
|
||||
return object->insertObject(parentId, obj, OKToEdit);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -4967,10 +4967,10 @@ DefineEngineMethod( GuiTreeViewCtrl, removeChildSelectionByValue, void, ( S32 pa
|
|||
if(parentItem)
|
||||
{
|
||||
GuiTreeViewCtrl::Item* child = parentItem->findChildByValue(value);
|
||||
if(child)
|
||||
{
|
||||
if(child)
|
||||
{
|
||||
object->removeSelection(child->getID());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -5038,7 +5038,7 @@ DefineEngineMethod( GuiTreeViewCtrl, open, void, ( const char * objName, bool ok
|
|||
DefineEngineMethod( GuiTreeViewCtrl, setItemTooltip, bool, ( S32 itemId, const char* tooltip), ,
|
||||
"Set the tooltip to show for the given item.\n\n"
|
||||
"@param itemId TreeItemID of item to set the tooltip for.\n"
|
||||
"@param tooltip String tooltip to set for the item."
|
||||
"@param tooltip String tooltip to set for the item."
|
||||
"@return True if successfully found the item, false if not")
|
||||
{
|
||||
GuiTreeViewCtrl::Item* item = object->getItem( itemId );
|
||||
|
|
@ -5228,11 +5228,11 @@ const char* GuiTreeViewCtrl::getSelectedObjectList()
|
|||
{
|
||||
S32 id = item->getObject()->getId();
|
||||
//get the current length of the buffer
|
||||
U32 len = dStrlen(buff);
|
||||
U32 len = dStrlen(buff);
|
||||
//the start of the buffer where we want to write
|
||||
char* buffPart = buff+len;
|
||||
//the size of the remaining buffer (-1 cause dStrlen doesn't count the \0)
|
||||
S32 size = bufSize-len-1;
|
||||
S32 size = bufSize-len-1;
|
||||
//write it:
|
||||
if(size < 1)
|
||||
{
|
||||
|
|
@ -5283,7 +5283,7 @@ DefineEngineMethod( GuiTreeViewCtrl, getTextToRoot, const char*, (S32 itemId, co
|
|||
"@param delimiter (Optional) delimiter to use between each branch concatenation."
|
||||
"@return text from the current node to the root.")
|
||||
{
|
||||
if (!dStrcmp(delimiter, "" ))
|
||||
if (!dStrcmp(delimiter, "" ))
|
||||
{
|
||||
Con::warnf("GuiTreeViewCtrl::getTextToRoot - Invalid number of arguments!");
|
||||
return ("");
|
||||
|
|
@ -5296,31 +5296,31 @@ DefineEngineMethod( GuiTreeViewCtrl, getSelectedItemList, const char*, (), ,
|
|||
"@return space separated list of selected item ids.")
|
||||
{
|
||||
const U32 bufSize = 1024;
|
||||
char* buff = Con::getReturnBuffer(bufSize);
|
||||
dSprintf(buff, bufSize, "");
|
||||
char* buff = Con::getReturnBuffer(bufSize);
|
||||
dSprintf(buff, bufSize, "");
|
||||
|
||||
const Vector< S32 >& selected = object->getSelected();
|
||||
for(int i = 0; i < selected.size(); i++)
|
||||
{
|
||||
S32 id = selected[i];
|
||||
//get the current length of the buffer
|
||||
U32 len = dStrlen(buff);
|
||||
//the start of the buffer where we want to write
|
||||
char* buffPart = buff+len;
|
||||
//the size of the remaining buffer (-1 cause dStrlen doesn't count the \0)
|
||||
S32 size = bufSize-len-1;
|
||||
//write it:
|
||||
if(size < 1)
|
||||
{
|
||||
Con::errorf("GuiTreeViewCtrl::getSelectedItemList - Not enough room to return our object list");
|
||||
return buff;
|
||||
}
|
||||
for(int i = 0; i < selected.size(); i++)
|
||||
{
|
||||
S32 id = selected[i];
|
||||
//get the current length of the buffer
|
||||
U32 len = dStrlen(buff);
|
||||
//the start of the buffer where we want to write
|
||||
char* buffPart = buff+len;
|
||||
//the size of the remaining buffer (-1 cause dStrlen doesn't count the \0)
|
||||
S32 size = bufSize-len-1;
|
||||
//write it:
|
||||
if(size < 1)
|
||||
{
|
||||
Con::errorf("GuiTreeViewCtrl::getSelectedItemList - Not enough room to return our object list");
|
||||
return buff;
|
||||
}
|
||||
|
||||
dSprintf(buffPart,size,"%d ", id);
|
||||
}
|
||||
dSprintf(buffPart,size,"%d ", id);
|
||||
}
|
||||
//mSelected
|
||||
|
||||
return buff;
|
||||
return buff;
|
||||
}
|
||||
|
||||
S32 GuiTreeViewCtrl::findItemByObjectId(S32 iObjId)
|
||||
|
|
@ -5331,8 +5331,8 @@ S32 GuiTreeViewCtrl::findItemByObjectId(S32 iObjId)
|
|||
continue;
|
||||
|
||||
SimObject* pObj = mItems[i]->getObject();
|
||||
if( pObj && pObj->getId() == iObjId )
|
||||
return mItems[i]->mId;
|
||||
if( pObj && pObj->getId() == iObjId )
|
||||
return mItems[i]->mId;
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
|
@ -5341,7 +5341,7 @@ S32 GuiTreeViewCtrl::findItemByObjectId(S32 iObjId)
|
|||
//------------------------------------------------------------------------------
|
||||
DefineEngineMethod( GuiTreeViewCtrl, findItemByObjectId, S32, (S32 objectId), ,
|
||||
"Find an item by its object id and returns the Tree Item ID for it.\n\n"
|
||||
"@param objectId Object id you want the item id for."
|
||||
"@param objectId Object id you want the item id for."
|
||||
"@return Tree Item Id for the given object ID.")
|
||||
{
|
||||
return(object->findItemByObjectId(objectId));
|
||||
|
|
@ -5389,7 +5389,7 @@ bool GuiTreeViewCtrl::scrollVisibleByObjectId(S32 objID)
|
|||
//------------------------------------------------------------------------------
|
||||
DefineEngineMethod( GuiTreeViewCtrl, scrollVisibleByObjectId, S32, (S32 objectId), ,
|
||||
"Show item by object id.\n\n"
|
||||
"@param objectId Object id you want to scroll to."
|
||||
"@param objectId Object id you want to scroll to."
|
||||
"@return True if successful, false if not.")
|
||||
{
|
||||
return(object->scrollVisibleByObjectId(objectId));
|
||||
|
|
@ -5400,7 +5400,7 @@ DefineEngineMethod( GuiTreeViewCtrl, scrollVisibleByObjectId, S32, (S32 objectId
|
|||
//FIXME: this clashes with SimSet.sort()
|
||||
DefineEngineMethod( GuiTreeViewCtrl, sort, void, (S32 parentId, bool traverseHierarchy, bool parentsFirst, bool caseSensitive), (0, false, false, true),
|
||||
"Sorts all items of the given parent (or root). With 'hierarchy', traverses hierarchy."
|
||||
"@param parentId TreeItemID of parent/root to sort all the items under. Use 0 to sort the entire tree."
|
||||
"@param parentId TreeItemID of parent/root to sort all the items under. Use 0 to sort the entire tree."
|
||||
"@param traverseHierarchy True to traverse the hierarchy, false to not."
|
||||
"@param parentsFirst True to sort the parents first."
|
||||
"@param caseSensitive True to pay attention to case, false to ignore it.")
|
||||
|
|
@ -5531,7 +5531,7 @@ DefineEngineMethod( GuiTreeViewCtrl, isItemSelected, bool, ( S32 id ),,
|
|||
"@return True if the given item/object is currently selected in the tree." )
|
||||
{
|
||||
const Vector< GuiTreeViewCtrl::Item* >& selectedItems = object->getSelectedItems();
|
||||
for( S32 i = 0; i < selectedItems.size(); ++ i )
|
||||
for( S32 i = 0; i < selectedItems.size(); ++ i )
|
||||
if( selectedItems[ i ]->mId == id )
|
||||
return true;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue