Rect FalagardSystemButton::getPixelRect(void) const { // clip to grand-parent as needed if (d_parent && d_parent->getParent() && isClippedByParent()) { return d_parent->getParent()->getInnerRect().getIntersection(getUnclippedPixelRect()); } // clip to screen if no grand-parent, or if clipping has been disabled for us. else { return System::getSingleton().getRenderer()->getRect().getIntersection(getUnclippedPixelRect()); } }
void FrameWindow::populateRenderCache() { Rect unclipped_rect = getUnclippedPixelRect(); Rect rect(Point(0.0f, 0.0f), Size(unclipped_rect.getWidth(), unclipped_rect.getHeight())); ColourRect colours(Colour(1.0f, 1.0f, 1.0f, getEffectiveAlpha())); if (d_section_images[TopLeft]) d_renderCache.cacheImage(*d_section_images[TopLeft], Rect(Point(0.0f, 0.0f), Size(d_width_left, d_height_top)), colours); if (d_section_images[TopMiddle]) d_renderCache.cacheImage(*d_section_images[TopMiddle], Rect(Point(d_width_left, 0.0f), Size(d_width_middle, d_height_top)), colours); if (d_section_images[TopRight]) d_renderCache.cacheImage(*d_section_images[TopRight], Rect(Point(d_width_left + d_width_middle, 0.0f), Size(d_width_right, d_height_top)), colours); if (d_section_images[MiddleLeft]) d_renderCache.cacheImage(*d_section_images[MiddleLeft], Rect(Point(0.0f, d_height_top), Size(d_width_left, d_height_middle)), colours); if (d_section_images[MiddleMiddle]) d_renderCache.cacheImage(*d_section_images[MiddleMiddle], Rect(Point(d_width_left, d_height_top), Size(d_width_middle, d_height_middle)), colours); if (d_section_images[MiddleRight]) d_renderCache.cacheImage(*d_section_images[MiddleRight], Rect(Point(d_width_left + d_width_middle, d_height_top), Size(d_width_right, d_height_middle)), colours); if (d_section_images[BottomLeft]) d_renderCache.cacheImage(*d_section_images[BottomLeft], Rect(Point(0.0f, d_height_top + d_height_middle), Size(d_width_left, d_height_bottom)), colours); if (d_section_images[BottomMiddle]) d_renderCache.cacheImage(*d_section_images[BottomMiddle], Rect(Point(d_width_left, d_height_top + d_height_middle), Size(d_width_middle, d_height_bottom)), colours); if (d_section_images[BottomRight]) d_renderCache.cacheImage(*d_section_images[BottomRight], Rect(Point(d_width_left + d_width_middle, d_height_top + d_height_middle), Size(d_width_right, d_height_bottom)), colours); }
Rect FalagardStaticImage::getUnclippedInnerRect(void) const { // get WidgetLookFeel for the assigned look. const WidgetLookFeel& wlf = WidgetLookManager::getSingleton().getWidgetLook(d_lookName); String area_name(isFrameEnabled() ? "WithFrame" : "NoFrame"); area_name += "ImageRenderArea"; if (wlf.isNamedAreaDefined(area_name)) return wlf.getNamedArea(area_name).getArea().getPixelRect(*this).offset(getUnclippedPixelRect().getPosition()); else return StaticImage::getUnclippedInnerRect(); }
/************************************************************************* Handler for when frame state changes. *************************************************************************/ void StaticImage::onStaticFrameChanged(WindowEventArgs& e) { // base class processing Static::onStaticFrameChanged(e); // update the size and position of the image to reflect changes made // to the frame in the base class Rect absRect(getUnclippedPixelRect()); Rect innerRect(getUnclippedInnerRect()); d_image.setSize(innerRect.getSize()); d_image.setPosition(Point(innerRect.d_left - absRect.d_left, innerRect.d_top - absRect.d_top)); e.handled = true; }