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

Method show

Tools/LayoutEditor/EditorToolTip.cpp:36–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34 }
35
36 void EditorToolTip::show(const SkinInfo& _data)
37 {
38 const std::string& colour_error = MyGUI::LanguageManager::getInstance().getTag("ColourError");
39 const std::string& colour_success = MyGUI::LanguageManager::getInstance().getTag("ColourSuccess");
40
41 const std::string& skin = _data.widget_skin;
42 std::string_view widget = _data.widget_type;
43
44 MyGUI::ResourceSkin* skinInfo = MyGUI::SkinManager::getInstance().getByName(skin);
45 MyGUI::ResourceLayout* templateInfo = MyGUI::LayoutManager::getInstance().getByName(skin, false);
46
47 bool templateRootFound = false;
48
49 MyGUI::IntSize skinDefaultSize;
50 if (skinInfo != nullptr)
51 {
52 skinDefaultSize = skinInfo->getSize();
53 templateRootFound = true;
54
55 if (widget.empty())
56 {
57 WidgetStyle* style = WidgetTypes::getInstance().findWidgetStyleBySkin(skin);
58 if (style != nullptr)
59 widget = style->name;
60 }
61 }
62 else if (templateInfo != nullptr)
63 {
64 const MyGUI::VectorWidgetInfo& data = templateInfo->getLayoutData();
65 for (const auto& container : data)
66 {
67 if (container.name == "Root")
68 {
69 skinDefaultSize = container.intCoord.size();
70 templateRootFound = true;
71
72 MyGUI::MapString::const_iterator item = container.userStrings.find("LE_TargetWidgetType");
73 if (item != container.userStrings.end())
74 widget = (*item).second;
75
76 break;
77 }
78 }
79 }
80
81 bool exist = MyGUI::WidgetManager::getInstance().isFactoryExist(widget);
82 std::string text = "Widget: " + (exist ? colour_success : colour_error);
83 text += widget;
84 text += colour_success + "\nSkin: " + skin + "\nDefaultSize: " +
85 (templateRootFound ? MyGUI::utility::toString(skinDefaultSize.width, " x ", skinDefaultSize.height)
86 : (colour_error + "'Root' widget not found"));
87
88 mText->setCaption(text);
89
90 const int MARGIN = 5;
91 const int LINE_HEIGHT = 22;
92 const int LINES = 3;
93

Callers 3

notifyToolTipMethod · 0.45
notifyToolTipMethod · 0.45
notifyToolTipMethod · 0.45

Calls 15

toStringFunction · 0.85
maxFunction · 0.85
getTagMethod · 0.80
findWidgetStyleBySkinMethod · 0.80
getByNameMethod · 0.45
getSizeMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
findMethod · 0.45
endMethod · 0.45
isFactoryExistMethod · 0.45
setCaptionMethod · 0.45

Tested by

no test coverage detected