| 127 | } |
| 128 | |
| 129 | void GuiDecoyCtrl::onMouseMove(const GuiEvent &event) |
| 130 | { |
| 131 | //if this control is a dead end, make sure the event stops here |
| 132 | if ( !mVisible || !mAwake ) |
| 133 | return; |
| 134 | |
| 135 | //pass the event to the parent |
| 136 | GuiControl *parent = getParent(); |
| 137 | if ( parent ) |
| 138 | parent->onMouseMove( event ); |
| 139 | |
| 140 | Point2I localPoint = parent->globalToLocalCoord(event.mousePoint); |
| 141 | |
| 142 | //also pretty hacky. since guiCanvas, *NOT* GuiControl, distributes the calls for onMouseEnter |
| 143 | //and onMouseLeave, we simulate those calls here through a series of checks. |
| 144 | if(mIsDecoy == true) |
| 145 | { |
| 146 | mVisible = false; |
| 147 | GuiControl *tempControl = parent->findHitControl(localPoint); |
| 148 | |
| 149 | //the decoy control has the responsibility of keeping track of the decoyed controls status |
| 150 | if(mMouseOverDecoy == false && mDecoyReference != NULL && |
| 151 | !mDecoyReference->isDeleted() && !mDecoyReference->isRemoved()) |
| 152 | { |
| 153 | tempControl->onMouseEnter(event); |
| 154 | mMouseOverDecoy = true; |
| 155 | } |
| 156 | else if(tempControl != mDecoyReference && mDecoyReference != NULL && |
| 157 | !mDecoyReference->isDeleted() && !mDecoyReference->isRemoved()) |
| 158 | { |
| 159 | mDecoyReference->onMouseLeave(event); |
| 160 | mMouseOverDecoy = false; |
| 161 | } |
| 162 | |
| 163 | mDecoyReference = tempControl; |
| 164 | mVisible = true; |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | void GuiDecoyCtrl::onMouseDragged(const GuiEvent &event) |
| 169 | { |
no test coverage detected