ControlHandle Control::GetChildAtPoint(const Point& point) { for(unsigned long i = 0; i < mChilds.GetSize(); ++i) if(mChilds[i]->PointIn(point) && mChilds[i]->GetEnabled() && mChilds[i]->GetVisible()) return mChilds[i]; if(PointIn(point) && GetEnabled() && GetVisible()) return this; return NULL; }
bool Block :: IsIntersect( Block* apBlock ) { float distance = ( apBlock -> GetPosf() - mPosF ).Length(); if ( distance - Geometry :: eps > Block :: SAFETY_DISTANCE ) return false; if ( distance < Block :: NOT_SAFETY_DISTANCE - Geometry :: eps ) return true; for ( unsigned int i = 0; i < BLOCKS_VERTEX_CNT; i++ ) if ( apBlock -> PointIn( mVerticesF[ i ] ) || PointIn( apBlock -> mVerticesF[ i ] ) ) return true; return this -> CheckEdgesAveragePoint( apBlock ) || apBlock -> CheckEdgesAveragePoint( this ); }
bool Block :: PointIn( Point3Di aPoint ) { return PointIn( Point3Df( aPoint ) ); }
bool TrackBar::OnEventMouse(Event event,WPARAM wparam,LPARAM lparam) { if(!GetVisible() || !GetEnabled()) return false; switch(event) { case EventLeftButtonDown: if(PointInTrack(*(Point*)wparam)) { if(!GetFocused()) Focus(); mTracking = true; mTrackingValue = mValue; mTrackingPosition = ((Point*)wparam)->x - GetTrackBox().GetCenter().x; SetCapture(GetKernel()->GetWindowHandle()); return true; } if(PointIn(*(Point*)wparam)) { if(!GetFocused()) Focus(); if(((Point*)wparam)->x > GetTrackBox().GetCenter().x) { if(GetTrackValue() < GetTrackRange()) SetTrackValue(GetTrackValue() + 1); } else { if(GetTrackValue()) SetTrackValue(GetTrackValue() - 1); } return true; } break; case EventLeftButtonUp: if(mTracking) { mTracking = false; ReleaseCapture(); return true; } break; case EventMouseMove: if(mTracking) { Point delta = *(Point*)wparam; delta.x -= GetScreenPosition().x + mTrackingPosition; float val = (float)GetBoundingBox().GetWidth() / (float)GetTrackRange(); if((float)delta.x / val > (float)GetTrackRange()) SetTrackValue(GetTrackRange()); else if((float)delta.x / val < 0.0f) SetTrackValue(0); else SetTrackValue((float)delta.x / val); if(GetParent()) GetParent()->OnEvent(EventChildCommand,ControlEventTrackChange,(LPARAM)this); } break; } return Control::OnEventMouse(event,wparam,lparam); }