void ListImageItem::onDraw() { Brush* brush = Brush::getSingletonPtr(); brush->setFilterMode(mDesc->widget_brushFilterMode); brush->drawSkinElement(Rect(mTexturePosition,mWidgetDesc->widget_dimensions.size),mSkinElement); ColourValue prevColor = brush->getColour(); Rect prevClipRegion = brush->getClipRegion(); if(mDesc->listimageitem_imageName != "") { ColourValue prevColor = brush->getColour(); Rect prevClipRegion = brush->getClipRegion(); Rect clipRegion = mClientDimensions; clipRegion.translate(mTexturePosition); brush->setClipRegion(prevClipRegion.getIntersection(clipRegion)); brush->setTexture(mDesc->listimageitem_imageName); if(mDesc->listimageitem_tileImage) brush->drawTiledRectangle(clipRegion,UVRect(0,0,1,1)); else brush->drawRectangle(clipRegion,UVRect(0,0,1,1)); brush->setClipRegion(prevClipRegion); Brush::getSingleton().setColor(prevColor); } }
void ListTextItem::onDraw() { Brush* brush = Brush::getSingletonPtr(); brush->setFilterMode(mDesc->widget_brushFilterMode); brush->drawSkinElement(Rect(mTexturePosition,mWidgetDesc->widget_dimensions.size),mSkinElement); ColourValue prevColor = brush->getColour(); Rect prevClipRegion = brush->getClipRegion(); // Clip to client dimensions Rect clipRegion(mClientDimensions); clipRegion.translate(mTexturePosition); brush->setClipRegion(prevClipRegion.getIntersection(clipRegion)); // Adjust Rect to Text drawing region clipRegion = mClientDimensions; clipRegion.translate(mTexturePosition); mText->draw(clipRegion.position); brush->setClipRegion(prevClipRegion); brush->setColor(prevColor); }
void ComponentWidget::draw() { // check visibility if( !mWidgetDesc->widget_visible ) return; Brush* brush = Brush::getSingletonPtr(); // check and store clip region Rect prevClipRegion = brush->getClipRegion(); if ( prevClipRegion.getIntersection(Rect(mTexturePosition,mWidgetDesc->widget_dimensions.size)) == Rect::ZERO ) return; // set clip region to dimensions brush->setClipRegion(Rect(mTexturePosition,mWidgetDesc->widget_dimensions.size).getIntersection(prevClipRegion)); // Set color before drawing operations brush->setColor(mWidgetDesc->widget_baseColor); // Set opacity before drawing operations brush->setOpacity(getAbsoluteOpacity()); // draw self onDraw(); if(!dynamic_cast<ComponentWidgetDesc*>(mWidgetDesc)->componentwidget_clipComponentsToDimensions) brush->setClipRegion(prevClipRegion); // draw components for(std::map<Ogre::String,Widget*>::iterator it = mComponents.begin(); it != mComponents.end(); ++it) (*it).second->draw(); // restore clip region brush->setClipRegion(prevClipRegion); }
void TreeView::onDraw() { Brush* brush = Brush::getSingletonPtr(); brush->setFilterMode(mWidgetDesc->widget_brushFilterMode); Rect clipRegion(mTexturePosition,Size(mWidgetDesc->widget_dimensions.size)); Rect prevClipRegion = brush->getClipRegion(); brush->setClipRegion(prevClipRegion.getIntersection(clipRegion)); brush->drawSkinElement(Rect(mTexturePosition,mWidgetDesc->widget_dimensions.size),mSkinElement); brush->setClipRegion(prevClipRegion); }
void TreeViewCheckBoxNode::onDraw() { Brush* brush = Brush::getSingletonPtr(); brush->setFilterMode(mDesc->widget_brushFilterMode); // Draw Background Point backgroundPosition(mTexturePosition); backgroundPosition.x += mWidgetDesc->widget_dimensions.size.height; brush->drawSkinElement(Rect(backgroundPosition,mWidgetDesc->widget_dimensions.size),mSkinElement); // if Selected, draw Selected SkinElement if(mDesc->treeviewnode_selected) brush->drawSkinElement(Rect(backgroundPosition,mWidgetDesc->widget_dimensions.size),mSkinType->getSkinElement(SELECTED)); ColourValue prevColor = brush->getColour(); Rect prevClipRegion = brush->getClipRegion(); // Draw Icon Point iconPosition(mTexturePosition.x + (mWidgetDesc->widget_dimensions.size.height * 2),mTexturePosition.y); brush->drawSkinElement(Rect(iconPosition,Size(mWidgetDesc->widget_dimensions.size.height)),mSkinType->getSkinElement(ICON)); // Clip to client dimensions Rect clipRegion(mTexturePosition,Size(mWidgetDesc->widget_dimensions.size.width - mWidgetDesc->widget_dimensions.size.height,mWidgetDesc->widget_dimensions.size.height)); clipRegion.translate(Point(mWidgetDesc->widget_dimensions.size.height * 3,0)); brush->setClipRegion(prevClipRegion.getIntersection(clipRegion)); // Adjust Rect to Text drawing region Point textPosition = clipRegion.position; mText->draw(textPosition); // Restore Clipping brush->setClipRegion(prevClipRegion); brush->setColor(prevColor); }