MCPcopy Create free account
hub / github.com/MyGUI/mygui / update

Method update

Tools/EditorFramework/TextureBrowseCell.cpp:28–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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}

Callers

nothing calls this directly

Calls 9

minFunction · 0.85
setImageTextureMethod · 0.80
IntSizeFunction · 0.50
setCaptionMethod · 0.45
setVisibleMethod · 0.45
getSizeMethod · 0.45
getParentMethod · 0.45
setCoordMethod · 0.45
setAlphaMethod · 0.45

Tested by

no test coverage detected