void AbstractWindow::updateClipBounds(void) { Pnt2f TopLeft, BottomRight; if( getParentDrawingSurface() == NULL ) { //If I have no parent container use my bounds getBounds(TopLeft, BottomRight); } else { //Get the intersection of: //My Bounds //My Parent Containers Clip Bounds //My Parent Containers Inset Bounds Pnt2f MyTopLeft,MyBottomRight; getBounds(MyTopLeft,MyBottomRight); //Get Parent Container's Clip Bounds Pnt2f ContainerClipTopLeft(0,0), ContainerClipBottomRight(getParentDrawingSurface()->getSize()); //Parent Container's Clip Bounds are in the Parent Container's Coordinate space //We need to convert them to this Components Coordinate space ContainerClipTopLeft -= Vec2f(getPosition()); ContainerClipBottomRight -= Vec2f(getPosition()); //Get the intersection of my bounds with my parent containers clip bounds quadIntersection(MyTopLeft,MyBottomRight, ContainerClipTopLeft,ContainerClipBottomRight, TopLeft, BottomRight); } //The Clip Bounds calculated are in my Parent Containers coordinate space //Translate these bounds into my own coordinate space setClipTopLeft(TopLeft); setClipBottomRight(BottomRight); }
void Component::updateClipBounds(void) { Pnt2f TopLeft, BottomRight; if((getParentContainer() == NULL && useBoundsForClipping()) || (getParentContainer() && getParentContainer()->getType() == RotatedComponent::getClassType())) { //If I have no parent container use my bounds getBounds(TopLeft, BottomRight); } else if(getParentContainer() != NULL) { //Get the intersection of: // My Bounds // My Parent Containers Clip Bounds // My Parent Containers Inset Bounds Pnt2f MyTopLeft,MyBottomRight; getBounds(MyTopLeft,MyBottomRight); //Get Parent ComponentContainer's Clip Bounds Pnt2f ContainerClipTopLeft, ContainerClipBottomRight; dynamic_cast<ComponentContainer*>(getParentContainer())->getClipBounds(ContainerClipTopLeft,ContainerClipBottomRight); //Parent ComponentContainer's Clip Bounds are in the Parent ComponentContainer's Coordinate space //We need to convert them to this Components Coordinate space ContainerClipTopLeft -= Vec2f(getPosition()); ContainerClipBottomRight -= Vec2f(getPosition()); //Get Parent ComponentContainer's Inset Bounds Pnt2f ContainerInsetTopLeft, ContainerInsetBottomRight; dynamic_cast<ComponentContainer*>(getParentContainer())->getInsideInsetsBounds(ContainerInsetTopLeft, ContainerInsetBottomRight); //Parent ComponentContainer's Inset Bounds are in the Parent ComponentContainer's Coordinate space //We need to convert them to this Components Coordinate space ContainerInsetTopLeft -= Vec2f(getPosition()); ContainerInsetBottomRight -= Vec2f(getPosition()); //Get the intersection of my bounds with my parent containers clip bounds quadIntersection(MyTopLeft,MyBottomRight, ContainerClipTopLeft,ContainerClipBottomRight, TopLeft, BottomRight); quadIntersection(TopLeft,BottomRight, ContainerInsetTopLeft,ContainerInsetBottomRight, TopLeft, BottomRight); } //The Clip Bounds calculated are in my Parent Containers coordinate space //Translate these bounds into my own coordinate space if(getClipTopLeft() != TopLeft) { setClipTopLeft(TopLeft); } if(getClipBottomRight() != BottomRight) { setClipBottomRight(BottomRight); } }
void PopupMenu::updateClipBounds(void) { Pnt2f TopLeft, BottomRight; //Treat myself as having no Parent getBounds(TopLeft, BottomRight); //The Clip Bounds calculated are in my Parent Containers coordinate space //Translate these bounds into my own coordinate space setClipTopLeft(TopLeft); setClipBottomRight(BottomRight); }
void MenuBar::updateClipBounds(void) { Pnt2f TopLeft, BottomRight; if(getParentWindow() == NULL) { //If I have no parent container use my bounds getBounds(TopLeft, BottomRight); } else { //Get the intersection of: //My Bounds //My Parent Containers Clip Bounds //My Parent Containers Inset Bounds Pnt2f MyTopLeft,MyBottomRight; getBounds(MyTopLeft,MyBottomRight); //Update my Parent ComponentContainer's Clip Bounds //dynamic_cast<ComponentContainer*>(getParentWindow())->updateClipBounds(); //Get Parent ComponentContainer's Clip Bounds Pnt2f ContainerClipTopLeft, ContainerClipBottomRight; dynamic_cast<InternalWindow*>(getParentContainer())->getMenuBarBounds(ContainerClipTopLeft,ContainerClipBottomRight); //Parent ComponentContainer's Clip Bounds are in the Parent ComponentContainer's Coordinate space //We need to convert them to this Components Coordinate space ContainerClipTopLeft -= Vec2f(getPosition()); ContainerClipBottomRight -= Vec2f(getPosition()); //Get Parent ComponentContainer's MenuBar Bounds Pnt2f ContainerInsetTopLeft, ContainerInsetBottomRight; dynamic_cast<InternalWindow*>(getParentContainer())->getMenuBarBounds(ContainerInsetTopLeft, ContainerInsetBottomRight); //Parent ComponentContainer's Inset Bounds are in the Parent ComponentContainer's Coordinate space //We need to convert them to this Components Coordinate space ContainerInsetTopLeft -= Vec2f(getPosition()); ContainerInsetBottomRight -= Vec2f(getPosition()); //Get the intersection of my bounds with my parent containers clip bounds quadIntersection(MyTopLeft,MyBottomRight, ContainerClipTopLeft,ContainerClipBottomRight, TopLeft, BottomRight); quadIntersection(TopLeft,BottomRight, ContainerInsetTopLeft,ContainerInsetBottomRight, TopLeft, BottomRight); } //The Clip Bounds calculated are in my Parent Containers coordinate space //Translate these bounds into my own coordinate space setClipTopLeft(TopLeft); setClipBottomRight(BottomRight); }