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

Method onMouseUp

Engine/source/gui/controls/guiDecoyCtrl.cpp:74–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74void GuiDecoyCtrl::onMouseUp(const GuiEvent &event)
75{
76 mouseUnlock();
77 setUpdate();
78
79 //this code is pretty hacky. right now there is no way that guiCanvas will allow sending more than
80 //one signal to one gui control at a time.
81 if(mIsDecoy == true)
82 {
83 mVisible = false;
84
85 GuiControl *parent = getParent();
86 Point2I localPoint = parent->globalToLocalCoord(event.mousePoint);
87 GuiControl *tempControl = parent->findHitControl(localPoint);
88
89 //the decoy control has the responsibility of keeping track of the decoyed controls status
90 if( mDecoyReference != NULL && tempControl == mDecoyReference)
91 tempControl->onMouseUp(event);
92 else if(mDecoyReference != NULL && tempControl != mDecoyReference)
93 {
94 //as explained earlier, this control was written in the mindset for buttons.
95 //nothing bad should ever happen if not a button due to the checks in this function though.
96 GuiButtonBaseCtrl *unCastCtrl = NULL;
97 unCastCtrl = dynamic_cast<GuiButtonBaseCtrl *>( mDecoyReference );
98 if(unCastCtrl != NULL)
99 unCastCtrl->resetState();
100 }
101 mVisible = true;
102 }
103}
104
105void GuiDecoyCtrl::onMouseDown(const GuiEvent &event)
106{

Callers

nothing calls this directly

Calls 3

globalToLocalCoordMethod · 0.80
findHitControlMethod · 0.45
resetStateMethod · 0.45

Tested by

no test coverage detected