| 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 |
no test coverage detected