CPoint CuStaticRuler::RemoveHeaderMarker(CPoint p) { CPoint point = p; if (ExistHeaderMarker(point)) { point = p; AdjustPoint(point); CaHeaderMarker* pHeader = NULL; POSITION px, pos = m_listHeader.GetHeadPosition(); while (pos != NULL) { px = pos; pHeader = m_listHeader.GetNext (pos); CPoint c = pHeader->GetPoint(); if (c.x == point.x) { m_listHeader.RemoveAt (px); delete pHeader; Invalidate(); return c; } } } Invalidate(); return point; }
CPoint CuStaticRuler::ChangePoint(CaHeaderMarker* pHeader, CPoint newPoint) { CPoint point = newPoint; AdjustPoint(point); pHeader->SetPoint (point); return point; }
//寻找在某个坐标上的控件 XUI_Wnd* XUI_Wnd::FindChildInPoint(const iPoint &pt ) { if( !IsVisible() ) return NULL; iPoint adjust( pt ); AdjustPoint( adjust, true ); for( size_t i = 0; i < m_pChildren.size(); ++i ) { XUI_Wnd* pElement = m_pChildren[i]; if( pElement->IsPointIn(adjust) ) return pElement->FindChildInPoint( adjust - m_WindowPosition ); } return this; }
CPoint CuStaticRuler::AddHeaderMarker(CPoint p) { CPoint point = p; if (!ExistHeaderMarker(point)) { point = p; AdjustPoint(point); CaHeaderMarker* pHeader = new CaHeaderMarker(point); m_listHeader.AddTail (pHeader); CClientDC dc(this); DrawHeaderMarker(&dc, pHeader); } return point; }
BOOL CuStaticRuler::ExistHeaderMarker(CPoint& point) { CPoint p = point; AdjustPoint (p); CaHeaderMarker* pHeader = NULL; POSITION pos = m_listHeader.GetHeadPosition(); while (pos != NULL) { pHeader = m_listHeader.GetNext (pos); CPoint c = pHeader->GetPoint(); if (c.x == p.x) return TRUE; } return FALSE; }
CaHeaderMarker* CuStaticRuler::GetHeaderMarkerAt(CPoint point) { AdjustPoint(point); CaHeaderMarker* pHeader = NULL; POSITION pos = m_listHeader.GetHeadPosition(); while (pos != NULL) { pHeader = m_listHeader.GetNext (pos); CPoint c(pHeader->GetPoint()); if (c.x == point.x) { return pHeader; } } return NULL; }