Point View::ConvertFromWindow( Point p ) { Point sam = p; View *parent = this; // I am my own parent. while ( parent != NULL ) { sam.x -= parent->Frame().left; sam.y -= parent->Frame().top; parent = parent->GetParent(); } return sam; }
Rect View::ConvertToWindow( Rect box ) { Rect sam = box; View *parent = this; // I am my own parent. while ( parent != NULL ) { sam.left += parent->Frame().left; sam.right += parent->Frame().left; sam.bottom += parent->Frame().top; sam.top += parent->Frame().top; parent = parent->GetParent(); } return sam; }