| 26 | } |
| 27 | |
| 28 | void TextureBrowseCell::update(const MyGUI::IBDrawItemInfo& _info, std::string _data) |
| 29 | { |
| 30 | if (_info.update) |
| 31 | { |
| 32 | mTextureName->setCaption(_data); |
| 33 | const MyGUI::IntSize& textureSize = MyGUI::texture_utility::getTextureSize(_data); |
| 34 | |
| 35 | if (textureSize.width != 0 && textureSize.height != 0) |
| 36 | { |
| 37 | mBack->setVisible(true); |
| 38 | mImage->setImageTexture(_data); |
| 39 | |
| 40 | const MyGUI::IntSize& targetSize = mParentBack->getSize(); |
| 41 | |
| 42 | float k1 = (float)targetSize.width / textureSize.width; |
| 43 | float k2 = (float)targetSize.height / textureSize.height; |
| 44 | float k = std::min(k1, k2); |
| 45 | MyGUI::IntSize size = |
| 46 | MyGUI::IntSize((int)(k * (float)textureSize.width), (int)(k * (float)textureSize.height)); |
| 47 | |
| 48 | MyGUI::IntSize parentSize = mBack->getParent()->getSize(); |
| 49 | mBack->setCoord( |
| 50 | (parentSize.width - size.width) / 2, |
| 51 | (parentSize.height - size.height) / 2, |
| 52 | size.width, |
| 53 | size.height); |
| 54 | } |
| 55 | else |
| 56 | { |
| 57 | mBack->setVisible(false); |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | if (_info.select) |
| 62 | mSelector->setAlpha(1); |
| 63 | else |
| 64 | mSelector->setAlpha(0); |
| 65 | } |
| 66 | |
| 67 | } |
nothing calls this directly
no test coverage detected