MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / closePopUp

Method closePopUp

Engine/source/gui/controls/guiPopUpCtrl.cpp:1147–1199  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1145
1146//------------------------------------------------------------------------------
1147void GuiPopUpMenuCtrl::closePopUp()
1148{
1149 if ( !mInAction )
1150 return;
1151
1152 // Get the selection from the text list:
1153
1154 if( !mBackgroundCancel )
1155 {
1156 mSelIndex = mTl->getSelectedCell().y;
1157 mSelIndex = ( mRevNum >= mSelIndex && mSelIndex != -1 ) ? mRevNum - mSelIndex : mSelIndex;
1158 if ( mSelIndex != -1 )
1159 {
1160 if ( mReplaceText )
1161 setText( mEntries[mSelIndex].buf );
1162 setIntVariable( mEntries[mSelIndex].id );
1163 }
1164 }
1165
1166 // Release the mouse:
1167 mInAction = false;
1168 mTl->mouseUnlock();
1169
1170 // Now perform the popup action:
1171 if( mSelIndex != -1 && !mBackgroundCancel )
1172 {
1173 if ( isMethod( "onSelect" ) )
1174 Con::executef( this, "onSelect", Con::getIntArg( mEntries[ mSelIndex ].id ), mEntries[mSelIndex].buf );
1175
1176 // Execute the popup console command:
1177 execConsoleCallback();
1178 }
1179 else if ( isMethod( "onCancel" ) )
1180 Con::executef( this, "onCancel" );
1181
1182 // Pop the background:
1183 GuiCanvas *root = getRoot();
1184 if ( root )
1185 root->popDialogControl(mBackground);
1186
1187 // Kill the popup:
1188 mBackground->removeObject( mSc );
1189 mTl->deleteObject();
1190 mSc->deleteObject();
1191 mBackground->deleteObject();
1192
1193 mBackground = NULL;
1194 mTl = NULL;
1195 mSc = NULL;
1196
1197 // Set this as the first responder:
1198 setFirstResponder();
1199}
1200
1201//------------------------------------------------------------------------------
1202bool GuiPopUpMenuCtrl::onKeyDown(const GuiEvent &event)

Callers 4

onMouseDownMethod · 0.45
onKeyDownMethod · 0.45
onMouseUpMethod · 0.45
DefineEngineMethodFunction · 0.45

Calls 9

setIntVariableFunction · 0.85
executefFunction · 0.85
getIntArgFunction · 0.85
getSelectedCellMethod · 0.80
popDialogControlMethod · 0.80
setTextFunction · 0.70
mouseUnlockMethod · 0.45
removeObjectMethod · 0.45
deleteObjectMethod · 0.45

Tested by

no test coverage detected