44#ifndef MYGUI_DONT_USE_OBSOLETE
51 static_cast<Button*
>(
this)->setStateSelected(_value);
55 return static_cast<const Button*
>(
this)->getStateSelected();
59 static_cast<Button*
>(
this)->setStateSelected(_value);
63 return static_cast<const Button*
>(
this)->getStateSelected();
67 return static_cast<const Button*
>(
this)->_getImageBox();
71 if (
static_cast<Button*
>(
this)->_getImageBox())
72 static_cast<Button*
>(
this)->_getImageBox()->setImageIndex(_index);
76 if (
static_cast<const Button*
>(
this)->_getImageBox())
77 return static_cast<const Button*
>(
this)->_getImageBox()->getImageIndex();
83 static_cast<ImageBox*
>(
this)->addItemFrameDuplicate(_index, _indexSourceFrame);
87 static_cast<ImageBox*
>(
this)->insertItemFrameDuplicate(_index, _indexFrame, _indexSourceFrame);
93 return static_cast<const ComboBox*
>(
this)->getIndexSelected();
97 static_cast<ComboBox*
>(
this)->setIndexSelected(_index);
101 static_cast<ComboBox*
>(
this)->clearIndexSelected();
106 static_cast<ComboBox*
>(
this)->insertItemAt(_index, _name);
110 static_cast<ComboBox*
>(
this)->setItemNameAt(_index, _item);
114 return static_cast<const ComboBox*
>(
this)->getItemNameAt(_index);
118 static_cast<ComboBox*
>(
this)->removeItemAt(_index);
122 static_cast<ComboBox*
>(
this)->removeAllItems();
126 return static_cast<const ComboBox*
>(
this)->getIndexSelected();
130 static_cast<ComboBox*
>(
this)->clearIndexSelected();
134 static_cast<ComboBox*
>(
this)->setIndexSelected(_index);
139 static_cast<ComboBox*
>(
this)->setMaxListLength(_value);
143 return static_cast<const ComboBox*
>(
this)->getMaxListLength();
149 static_cast<EditBox*
>(
this)->setVisibleVScroll(_visible);
153 return static_cast<EditBox*
>(
this)->isVisibleVScroll();
157 static_cast<EditBox*
>(
this)->setVisibleHScroll(_visible);
161 return static_cast<EditBox*
>(
this)->isVisibleHScroll();
166 static_cast<EditBox*
>(
this)->setTextIntervalColour(_start, _count, _colour);
170 _start =
static_cast<const EditBox*
>(
this)->getTextSelectionStart();
171 _end =
static_cast<const EditBox*
>(
this)->getTextSelectionEnd();
175 return static_cast<const EditBox*
>(
this)->getTextInterval(_start, _count);
179 static_cast<EditBox*
>(
this)->setTextSelection(_start, _end);
183 static_cast<EditBox*
>(
this)->deleteTextSelection();
187 return static_cast<const EditBox*
>(
this)->getTextSelection();
191 return static_cast<EditBox*
>(
this)->isTextSelection();
195 static_cast<EditBox*
>(
this)->setTextSelectionColour(_colour);
201 return static_cast<const ItemBox*
>(
this)->getIndexSelected();
205 static_cast<ItemBox*
>(
this)->setIndexSelected(_index);
209 static_cast<ItemBox*
>(
this)->clearIndexSelected();
214 static_cast<ItemBox*
>(
this)->insertItemAt(_index, _data);
218 static_cast<ItemBox*
>(
this)->setItemDataAt(_index, _data);
222 static_cast<ItemBox*
>(
this)->removeItemAt(_index);
226 static_cast<ItemBox*
>(
this)->removeAllItems();
230 return static_cast<const ItemBox*
>(
this)->getIndexSelected();
234 static_cast<ItemBox*
>(
this)->clearIndexSelected();
238 static_cast<ItemBox*
>(
this)->setIndexSelected(_index);
243 return static_cast<const ItemBox*
>(
this)->getWidgetDrag();
247 static_cast<ItemBox*
>(
this)->resetDrag();
252 static_cast<ItemBox*
>(
this)->setVerticalAlignment(_value);
256 return static_cast<const ItemBox*
>(
this)->getVerticalAlignment();
262 return static_cast<const ListBox*
>(
this)->getIndexSelected();
266 static_cast<ListBox*
>(
this)->setIndexSelected(_index);
270 static_cast<ListBox*
>(
this)->clearIndexSelected();
275 static_cast<ListBox*
>(
this)->insertItemAt(_index, _item);
279 static_cast<ListBox*
>(
this)->setItemNameAt(_index, _item);
283 return static_cast<const ListBox*
>(
this)->getItemNameAt(_index);
287 static_cast<ListBox*
>(
this)->removeItemAt(_index);
291 static_cast<ListBox*
>(
this)->removeAllItems();
295 return static_cast<ListBox*
>(
this)->findItemIndexWith(_item);
299 return static_cast<const ListBox*
>(
this)->getIndexSelected();
303 static_cast<ListBox*
>(
this)->clearIndexSelected();
307 static_cast<ListBox*
>(
this)->setIndexSelected(_index);
311 static_cast<ListBox*
>(
this)->beginToItemAt(_index);
315 static_cast<ListBox*
>(
this)->beginToItemFirst();
319 static_cast<ListBox*
>(
this)->beginToItemLast();
323 static_cast<ListBox*
>(
this)->beginToItemSelected();
327 return static_cast<ListBox*
>(
this)->isItemVisibleAt(_index, _fill);
331 return static_cast<ListBox*
>(
this)->isItemSelectedVisible(_fill);
337 static_cast<MenuControl*
>(
this)->setVisible(
true);
341 static_cast<MenuControl*
>(
this)->setVisible(
false);
345 return static_cast<MenuControl*
>(
this)->getVisible();
350 static_cast<MenuControl*
>(
this)->setItemChildVisibleAt(_index,
true);
354 static_cast<MenuControl*
>(
this)->setItemChildVisible(_item,
true);
358 static_cast<MenuControl*
>(
this)->setItemChildVisibleAt(_index,
false);
362 static_cast<MenuControl*
>(
this)->setItemChildVisible(_item,
false);
367 static_cast<MenuControl*
>(
this)->setVerticalAlignment(_value);
371 return static_cast<const MenuControl*
>(
this)->getVerticalAlignment();
376 static_cast<MenuItem*
>(
this)->setItemChildVisible(
true);
380 static_cast<MenuItem*
>(
this)->setItemChildVisible(
false);
386 return static_cast<const MultiListBox*
>(
this)->getIndexSelected();
390 static_cast<MultiListBox*
>(
this)->setIndexSelected(_index);
394 static_cast<MultiListBox*
>(
this)->clearIndexSelected();
399 return static_cast<MultiListBox*
>(
this)->findSubItemWith(_column, _name);
403 return static_cast<const MultiListBox*
>(
this)->getSubItemNameAt(_column, _index);
407 static_cast<MultiListBox*
>(
this)->setSubItemNameAt(_column, _index, _name);
411 static_cast<MultiListBox*
>(
this)->removeColumnAt(_column);
415 static_cast<MultiListBox*
>(
this)->removeAllColumns();
419 return static_cast<const MultiListBox*
>(
this)->getColumnWidthAt(_column);
423 return static_cast<const MultiListBox*
>(
this)->getColumnNameAt(_column);
427 static_cast<MultiListBox*
>(
this)->setColumnWidthAt(_column, _width);
431 static_cast<MultiListBox*
>(
this)->addColumn(_name, _width);
435 static_cast<MultiListBox*
>(
this)->setColumnNameAt(_column, _name);
439 static_cast<MultiListBox*
>(
this)->insertColumnAt(_column, _name, _width);
443 return static_cast<const MultiListBox*
>(
this)->getIndexSelected();
447 static_cast<MultiListBox*
>(
this)->clearIndexSelected();
451 static_cast<MultiListBox*
>(
this)->setIndexSelected(_index);
455 static_cast<MultiListBox*
>(
this)->insertItemAt(_index, _name);
459 static_cast<MultiListBox*
>(
this)->setItemNameAt(_index, _name);
463 return static_cast<const MultiListBox*
>(
this)->getItemNameAt(_index);
467 static_cast<MultiListBox*
>(
this)->removeItemAt(_index);
471 static_cast<MultiListBox*
>(
this)->removeAllItems();
477 if (_value == Align::Right)
478 static_cast<ProgressBar*
>(
this)->setFlowDirection(FlowDirection::RightToLeft);
479 else if (_value == Align::Top)
480 static_cast<ProgressBar*
>(
this)->setFlowDirection(FlowDirection::TopToBottom);
481 else if (_value == Align::Bottom)
482 static_cast<ProgressBar*
>(
this)->setFlowDirection(FlowDirection::BottomToTop);
484 static_cast<ProgressBar*
>(
this)->setFlowDirection(FlowDirection::LeftToRight);
489 if (
static_cast<const ProgressBar*
>(
this)->getFlowDirection() == FlowDirection::RightToLeft)
491 if (
static_cast<const ProgressBar*
>(
this)->getFlowDirection() == FlowDirection::TopToBottom)
493 if (
static_cast<const ProgressBar*
>(
this)->getFlowDirection() == FlowDirection::BottomToTop)
494 return Align::Bottom;
502 static_cast<ScrollView*
>(
this)->setVisibleVScroll(_visible);
506 return static_cast<ScrollView*
>(
this)->isVisibleVScroll();
510 static_cast<ScrollView*
>(
this)->setVisibleHScroll(_visible);
514 return static_cast<ScrollView*
>(
this)->isVisibleHScroll();
520 return static_cast<const TabControl*
>(
this)->getButtonWidthAt(_index);
524 return static_cast<const TabControl*
>(
this)->getButtonWidth(_sheet);
528 static_cast<TabControl*
>(
this)->setButtonWidthAt(_index, _width);
532 static_cast<TabControl*
>(
this)->setButtonWidth(_sheet, _width);
536 static_cast<TabControl*
>(
this)->beginToItemAt(_index);
540 static_cast<TabControl*
>(
this)->beginToItemSelected();
544 return static_cast<const TabControl*
>(
this)->getItemCount();
548 return static_cast<const TabControl*
>(
this)->getItemName(_sheet);
552 return static_cast<const TabControl*
>(
this)->getItemNameAt(_index);
556 return static_cast<const TabControl*
>(
this)->getItemAt(_index);
560 static_cast<TabControl*
>(
this)->setItemNameAt(_index, _name);
564 static_cast<TabControl*
>(
this)->setItemName(_sheet, _name);
568 return static_cast<TabControl*
>(
this)->addItem(_name, _width);
572 return static_cast<TabControl*
>(
this)->insertItemAt(_index, _name);
576 static_cast<TabControl*
>(
this)->removeItemAt(_index);
580 static_cast<TabControl*
>(
this)->removeItem(_sheet);
584 static_cast<TabControl*
>(
this)->setIndexSelected(_index);
588 static_cast<TabControl*
>(
this)->setItemSelected(_sheet);
592 return static_cast<const TabControl*
>(
this)->getIndexSelected();
597 return static_cast<const TabControl*
>(
this)->getIndexSelected();
601 static_cast<TabControl*
>(
this)->setIndexSelected(_index);
607 return static_cast<Widget*
>(
this)->getEnabled();
611 return static_cast<Widget*
>(
this)->getInheritsAlpha();
615 return static_cast<Widget*
>(
this)->getNeedKeyFocus();
619 return static_cast<Widget*
>(
this)->getNeedMouseFocus();
623 return static_cast<Widget*
>(
this)->getInheritsPick();
627 return static_cast<Widget*
>(
this)->getVisible();
638 static_cast<Window*
>(
this)->setVisibleSmooth(
true);
642 static_cast<Window*
>(
this)->setVisibleSmooth(
false);
646 static_cast<Window*
>(
this)->setMinSize(_minmax.left, _minmax.top);
647 static_cast<Window*
>(
this)->setMaxSize(_minmax.right, _minmax.bottom);
651 static_cast<Window*
>(
this)->setMinSize(_min_w, _min_h);
652 static_cast<Window*
>(
this)->setMaxSize(_max_w, _max_h);
657 static_cast<const Window*
>(
this)->getMinSize().width,
658 static_cast<const Window*
>(
this)->getMinSize().height,
659 static_cast<const Window*
>(
this)->getMaxSize().width,
660 static_cast<const Window*
>(
this)->getMaxSize().height};
665 return ResourceManager::getInstance().load(_file);
669 xml::ElementPtr _node2,
670 std::string_view _file,
672 std::string_view _tag)
674 for (
auto _node : _node2.node())
676 if (_node.name() != _tag)
679 std::string_view name{_node.attribute(
"name").value()};
683 std::string_view type;
684 if (_node.attribute(
"resolution").empty())
685 type =
"ResourceManualFont";
687 type =
"ResourceTrueTypeFont";
690 pugi::xml_node root = doc.createRoot(
"MyGUI");
691 pugi::xml_node node = root.append_child(
"Resource");
692 node.append_attribute(
"type") = type.data();
693 node.append_attribute(
"name") = name.data();
695 auto attr = _node.attribute(
"source");
698 pugi::xml_node prop = node.append_child(
"Property");
699 prop.append_attribute(
"key") =
"Source";
700 prop.append_attribute(
"value") = attr.value();
703 attr = _node.attribute(
"size");
706 pugi::xml_node prop = node.append_child(
"Property");
707 prop.append_attribute(
"key") =
"Size";
708 prop.append_attribute(
"value") = attr.value();
711 attr = _node.attribute(
"resolution");
714 pugi::xml_node prop = node.append_child(
"Property");
715 prop.append_attribute(
"key") =
"Resolution";
716 prop.append_attribute(
"value") = attr.value();
719 attr = _node.attribute(
"antialias_colour");
722 pugi::xml_node prop = node.append_child(
"Property");
723 prop.append_attribute(
"key") =
"Antialias";
724 prop.append_attribute(
"value") = attr.value();
727 attr = _node.attribute(
"space_width");
730 pugi::xml_node prop = node.append_child(
"Property");
731 prop.append_attribute(
"key") =
"SpaceWidth";
732 prop.append_attribute(
"value") = attr.value();
735 attr = _node.attribute(
"tab_width");
738 pugi::xml_node prop = node.append_child(
"Property");
739 prop.append_attribute(
"key") =
"TabWidth";
740 prop.append_attribute(
"value") = attr.value();
743 attr = _node.attribute(
"cursor_width");
746 pugi::xml_node prop = node.append_child(
"Property");
747 prop.append_attribute(
"key") =
"CursorWidth";
748 prop.append_attribute(
"value") = attr.value();
751 attr = _node.attribute(
"distance");
754 pugi::xml_node prop = node.append_child(
"Property");
755 prop.append_attribute(
"key") =
"Distance";
756 prop.append_attribute(
"value") = attr.value();
759 attr = _node.attribute(
"offset_height");
762 pugi::xml_node prop = node.append_child(
"Property");
763 prop.append_attribute(
"key") =
"OffsetHeight";
764 prop.append_attribute(
"value") = attr.value();
767 attr = _node.attribute(
"default_height");
770 pugi::xml_node prop = node.append_child(
"Property");
771 prop.append_attribute(
"key") =
"DefaultHeight";
772 prop.append_attribute(
"value") = attr.value();
775 pugi::xml_node codes = node.append_child(
"Codes");
777 for (
auto codeold : _node.children(
"Code"))
779 pugi::xml_node codenew = codes.append_child(
"Code");
781 attr = codeold.attribute(
"range");
783 codenew.append_attribute(
"range") = attr.value();
785 attr = codeold.attribute(
"hide");
787 codenew.append_attribute(
"hide") = attr.value();
789 attr = codeold.attribute(
"index");
791 codenew.append_attribute(
"index") = attr.value();
793 attr = codeold.attribute(
"coord");
795 codenew.append_attribute(
"coord") = attr.value();
798 ResourceManager::getInstance().loadFromXmlNode(root, _file, _version);
804 static_cast<Gui*
>(
this)->initialise(_core);
810 while (_widgets.next())
811 widgets.push_back(_widgets.current());
812 static_cast<Gui*
>(
this)->destroyWidgets(widgets);
817 std::string name{_prefix};
819 return static_cast<const Gui*
>(
this)->findWidgetT(name, _throw);
824 return static_cast<const Gui*
>(
this)->findWidgetT(_name, _throw);
829 static_cast<Gui*
>(
this)->destroyWidgets(_widgets);
834 return InputManager::getInstance().injectMouseMove(_absx, _absy, _absz);
838 return InputManager::getInstance().injectMousePress(_absx, _absy, _id);
842 return InputManager::getInstance().injectMouseRelease(_absx, _absy, _id);
846 return InputManager::getInstance().injectKeyPress(_key, _text);
850 return InputManager::getInstance().injectKeyRelease(_key);
855 PointerManager::getInstance().setVisible(
false);
859 PointerManager::getInstance().setVisible(
true);
863 return PointerManager::getInstance().isVisible();
868 return ResourceManager::getInstance().load(_file);
873 return RenderManager::getInstance().getViewSize();
877 return RenderManager::getInstance().getViewSize().width;
881 return RenderManager::getInstance().getViewSize().height;
886 PointerManager::getInstance().setVisible(_value);
890 return PointerManager::getInstance().isVisible();
895 Gui::getInstance().frameEvent(_time);
900 LayerManager::getInstance().resizeView(_size);
905 return InputManager::getInstance().getLastPressedPosition(MouseButton::Left);
910 return InputManager::getInstance().getLastPressedPosition(MouseButton::Right);
915 return ResourceManager::getInstance().load(_file);
920 return ResourceManager::getInstance().load(_file);
925 return EnumeratorLayer(
static_cast<const LayerManager*
>(
this)->getLayers());
930 return static_cast<LayoutManager*
>(
this)->loadLayout(_file);
935 static_cast<PointerManager*
>(
this)->setDefaultPointer(_value);
939 static_cast<PointerManager*
>(
this)->setVisible(
true);
943 static_cast<PointerManager*
>(
this)->setVisible(
false);
947 return static_cast<PointerManager*
>(
this)->isVisible();
951 return ResourceManager::getInstance().load(_file);
954 xml::ElementPtr _node,
955 std::string_view _file,
957 std::string_view _tag)
959 std::string_view pointer;
960 std::string_view layer;
962 for (
auto node : _node.node())
964 if (node.name() != _tag)
967 layer = node.attribute(
"layer").value();
968 pointer = node.attribute(
"default").value();
970 std::string_view shared_text{node.attribute(
"texture").value()};
973 for (
auto info : node.children(
"Info"))
975 std::string_view name{info.attribute(
"name").value()};
979 std::string_view texture{info.attribute(
"texture").value()};
981 std::string_view type =
982 (shared_text.empty() && texture.empty()) ?
"ResourceImageSetPointer" :
"ResourceManualPointer";
985 pugi::xml_node root = doc.createRoot(
"MyGUI");
986 pugi::xml_node newnode = root.append_child(
"Resource");
987 newnode.append_attribute(
"type") = type.data();
988 newnode.append_attribute(
"name") = name.data();
990 auto attr = info.attribute(
"point");
993 pugi::xml_node prop = newnode.append_child(
"Property");
994 prop.append_attribute(
"key") =
"Point";
995 prop.append_attribute(
"value") = attr.value();
998 attr = info.attribute(
"size");
1001 pugi::xml_node prop = newnode.append_child(
"Property");
1002 prop.append_attribute(
"key") =
"Size";
1003 prop.append_attribute(
"value") = attr.value();
1006 attr = info.attribute(
"resource");
1009 pugi::xml_node prop = newnode.append_child(
"Property");
1010 prop.append_attribute(
"key") =
"Resource";
1011 prop.append_attribute(
"value") = attr.value();
1014 attr = info.attribute(
"offset");
1017 pugi::xml_node prop = newnode.append_child(
"Property");
1018 prop.append_attribute(
"key") =
"Coord";
1019 prop.append_attribute(
"value") = attr.value();
1022 if (!shared_text.empty() || !texture.empty())
1024 pugi::xml_node prop = newnode.append_child(
"Property");
1025 prop.append_attribute(
"key") =
"Texture";
1026 prop.append_attribute(
"value") = (shared_text.empty() ? texture : shared_text).data();
1029 ResourceManager::getInstance().loadFromXmlNode(root, _file, _version);
1034 static_cast<PointerManager*
>(
this)->setLayerName(layer);
1036 if (!pointer.empty())
1037 static_cast<PointerManager*
>(
this)->setDefaultPointer(pointer);
1042 return EnumeratorPtr(
static_cast<const ResourceManager*
>(
this)->getResources());
1052 return static_cast<const ResourceManager*
>(
this)->getCount();
1056 return static_cast<const ResourceManager*
>(
this)->getByName(_name, _throw);
1061 return static_cast<const SkinManager*
>(
this)->getByName(_name);
1065 return ResourceManager::getInstance().load(_file);
1068 xml::ElementPtr _node,
1071 std::string_view _tag)
1073 const std::string& resourceCategory = ResourceManager::getInstance().getCategoryName();
1076 for (
auto skin : _node.node().children(_tag.data()))
1078 std::string_view type = skin.attribute(
"type").value();
1080 type =
"ResourceSkin";
1082 IObject*
object = FactoryManager::getInstance().createObject(resourceCategory, type);
1083 if (
object !=
nullptr)
1085 ResourceSkin* data =
object->castType<ResourceSkin>();
1086 data->deserialization(skin, _version);
1088 ResourceManager::getInstance().addResource(data);
1096 Gui::getInstance().destroyWidgets(_widgets);
1101 static_cast<WidgetManager*
>(
this)->destroyWidgets(_widgets);
1105 return Gui::getInstance().findWidgetT(_name, _throw);
1109 std::string name{_prefix};
1111 return Gui::getInstance().findWidgetT(name, _throw);
1115 _widget->setProperty(_key, _value);
1123 return static_cast<ILayerNode*
>(
this)->addToRenderItem(_texture, _firstQueue);
1138 return static_cast<xml::Document*
>(
this)->createDeclaration(_version, _encoding);
1144 if (align == Align::Right)
1145 return FlowDirection(FlowDirection::RightToLeft).print();
1146 if (align == Align::Top)
1147 return FlowDirection(FlowDirection::TopToBottom).print();
1148 if (align == Align::Bottom)
1149 return FlowDirection(FlowDirection::BottomToTop).print();
1150 return FlowDirection(FlowDirection::LeftToRight).print();
1157 return coord.
print();
1170 bool BackwardCompatibility::isIgnoreProperty(std::string_view _key)
1172#ifndef MYGUI_DONT_USE_OBSOLETE
1179 VectorStringPairs BackwardCompatibility::upgradeProperty(std::string_view _key, std::string_view _value)
1181#ifndef MYGUI_DONT_USE_OBSOLETE
1182 if (_key ==
"Progress_StartPoint" || _key ==
"StartPoint")
1184 if (_key ==
"ImageRect")
1186 if (_key ==
"Window_MinMax")
1191 {
"MaxSize",
IntSize(rect.right, rect.bottom).
print()}};
1193 std::string_view renamed = getPropertyRename(_key,
false);
1194 if (renamed != _key)
1195 return {{std::string{renamed}, std::string{_value}}};
1197 return {{std::string{_key}, std::string{_value}}};
1200 bool BackwardCompatibility::processDeprecatedProperty(Widget* _owner, std::string& _key, std::string& _value)
1202#ifndef MYGUI_DONT_USE_OBSOLETE
1206 if (_key ==
"ComboBox_AddItem")
1210 "ComboBox_AddItem is deprecated" <<
" [" << LayoutManager::getInstance().getCurrentLayout() <<
"]");
1211 ComboBox* widget = _owner->castType<ComboBox>(
false);
1212 if (widget !=
nullptr)
1213 widget->addItem(_value);
1216 else if (_key ==
"List_AddItem")
1220 "List_AddItem is deprecated" <<
" [" << LayoutManager::getInstance().getCurrentLayout() <<
"]");
1221 ListBox* widget = _owner->castType<ListBox>(
false);
1222 if (widget !=
nullptr)
1223 widget->addItem(_value);
1226 else if (_key ==
"Tab_AddSheet")
1230 "Tab_AddSheet is deprecated" <<
" [" << LayoutManager::getInstance().getCurrentLayout() <<
"]");
1231 TabControl* widget = _owner->castType<TabControl>(
false);
1232 if (widget !=
nullptr)
1233 widget->addItem(_value);
1236 else if (_key ==
"Tab_AddItem")
1240 "Tab_AddItem is deprecated" <<
" [" << LayoutManager::getInstance().getCurrentLayout() <<
"]");
1241 TabControl* widget = _owner->castType<TabControl>(
false);
1242 if (widget !=
nullptr)
1243 widget->addItem(_value);
1246 else if (_key ==
"Window_MinMax" && !_owner->isType<Window>())
1249 auto properties = upgradeProperty(_key, _value);
1250 if (properties.size() != 1 || properties.front().first != _key || properties.front().second != _value)
1252 std::string replacements;
1253 for (
const auto& property : properties)
1255 if (!replacements.empty())
1256 replacements +=
", ";
1257 replacements +=
property.first;
1261 _key <<
" is deprecated, use " << replacements <<
" ["
1262 << LayoutManager::getInstance().getCurrentLayout() <<
"]");
1263 if (properties.size() == 1)
1265 _key = std::move(properties.front().first);
1266 _value = std::move(properties.front().second);
1270 for (
const auto& property : properties)
1271 _owner->setProperty(property.first, property.second);
1277 std::string_view renamed = getPropertyRename(_key);
1278 if (renamed != _key)
1282 "Widget property '" << _key <<
"' have type prefix - use '" << renamed <<
"' instead ["
1283 << LayoutManager::getInstance().getCurrentLayout() <<
"]");
1284 _key = std::string{renamed};
1290 void BackwardCompatibility::initialise()
1292#ifndef MYGUI_DONT_USE_OBSOLETE
1293 static constexpr std::pair<std::string_view, std::string_view> propertyRenames[] = {
1294 {
"Widget_Caption",
"Caption"},
1295 {
"Button_Pressed",
"StateSelected"},
1296 {
"ButtonPressed",
"StateSelected"},
1297 {
"StateCheck",
"StateSelected"},
1298 {
"Edit_ShowVScroll",
"VisibleVScroll"},
1299 {
"Edit_ShowHScroll",
"VisibleHScroll"},
1300 {
"ScrollView_VScroll",
"VisibleVScroll"},
1301 {
"ScrollView_HScroll",
"VisibleHScroll"},
1302 {
"Progress_Position",
"RangePosition"},
1303 {
"Scroll_Position",
"RangePosition"},
1304 {
"Tab_SelectSheet",
"SelectItem"},
1305 {
"Image_Texture",
"ImageTexture"},
1306 {
"Image_Coord",
"ImageCoord"},
1307 {
"Image_Tile",
"ImageTile"},
1308 {
"Image_Index",
"ImageIndex"},
1309 {
"Image_Resource",
"ImageResource"},
1310 {
"Image_Group",
"ImageGroup"},
1311 {
"Image_Name",
"ImageName"},
1312 {
"MenuItem_Id",
"MenuItemId"},
1313 {
"MenuItem_Type",
"MenuItemType"},
1314 {
"Combo_MaxLength",
"MaxListLength"},
1315 {
"AlignText",
"TextAlign"},
1316 {
"ToStick",
"Snap"},
1317 {
"ListSmoothShow",
"SmoothShow"},
1318 {
"HeightList",
"MaxListLength"},
1319 {
"AlignVert",
"VerticalAlignment"},
1321 for (
const auto& [from, to] : propertyRenames)
1324 static constexpr std::string_view ignoredProperties[] = {
1325 "DragLayer",
"SkinLine",
"HeightLine",
"SeparatorHeight",
"SeparatorSkin",
1326 "SubmenuImageSize",
"SubMenuSkin",
"SubMenuLayer",
"DistanceButton",
"ButtonSkin",
1327 "ButtonType",
"ButtonSize",
"ButtonOffset",
"DefaultLayer",
"FadeSkin",
1328 "FadeLayer",
"SkinButton",
"HeightButton",
"SkinList",
"SkinButtonEmpty",
1329 "WidthSeparator",
"SkinSeparator",
"TrackSkin",
"TrackWidth",
"TrackMin",
1330 "TrackStep",
"TrackFill",
"OffsetBar",
"EmptyBarSkin",
"TrackRangeMargins",
1331 "MinTrackSize",
"MainMove",
"LevelOffset",
"State",
1333 for (
const auto property : ignoredProperties)
1336 static constexpr std::pair<std::string_view, std::string_view> skinRenames[] = {
1337 {
"StaticImage",
"ImageBox"},
1338 {
"StaticText",
"TextBox"},
1339 {
"HScroll",
"ScrollBarH"},
1340 {
"VScroll",
"ScrollBarV"},
1341 {
"ItemBoxH",
"ItemBox"},
1342 {
"ItemBoxV",
"ItemBox"},
1343 {
"VSlider",
"SliderV"},
1344 {
"HSlider",
"SliderH"},
1345 {
"Progress",
"ProgressBar"},
1346 {
"ProgressFill",
"ProgressBarFill"},
1347 {
"List",
"ListBox"},
1348 {
"MultiList",
"MultiListBox"},
1349 {
"Edit",
"EditBox"},
1350 {
"EditStretch",
"EditBoxStretch"},
1351 {
"EditEmpty",
"EditBoxEmpty"},
1352 {
"RadioBox",
"RadioButton"},
1353 {
"Tab",
"TabControl"},
1354 {
"WordWrap",
"WordWrapEmpty"},
1355 {
"WordWrapSimple",
"WordWrapEmpty"},
1356 {
"ButtonSmall",
"Button"},
1357 {
"ButtonImageText",
"ButtonImage"},
1358 {
"TileClient",
"ClientTileSkin"},
1359 {
"DefaultClient",
"ClientDefaultSkin"},
1360 {
"Panel",
"PanelSkin"},
1361 {
"PanelSmall",
"PanelSkin"},
1362 {
"Separator1",
"SepUpVSkin"},
1363 {
"Separator2",
"SepDownVSkin"},
1364 {
"Separator3",
"SepUpHSkin"},
1365 {
"Separator4",
"SepDownHSkin"},
1366 {
"MarkerWhite",
"WhiteSkin"},
1367 {
"ButtonLeft",
"ButtonLeftSkin"},
1368 {
"ButtonRight",
"ButtonRightSkin"},
1369 {
"ButtonUp",
"ButtonUpSkin"},
1370 {
"ButtonDown",
"ButtonDownSkin"},
1371 {
"ButtonV",
"ButtonAcceptSkin"},
1372 {
"ButtonX",
"ButtonCloseSkin"},
1373 {
"ButtonMinusPlus",
"ButtonExpandSkin"},
1375 for (
const auto& [from, to] : skinRenames)
1380 std::string_view BackwardCompatibility::getPropertyRename(std::string_view _propertyName,
bool _trimTypePrefix)
1382#ifndef MYGUI_DONT_USE_OBSOLETE
1385 return (*item).second;
1387 if (_trimTypePrefix)
1389 size_t index = _propertyName.find(
'_');
1390 if (index != std::string_view::npos)
1391 return _propertyName.substr(index + 1);
1393 return _propertyName;
1396 std::string_view BackwardCompatibility::getFactoryRename(
1397 std::string_view _categoryName,
1398 std::string_view _factoryName)
1400#ifndef MYGUI_DONT_USE_OBSOLETE
1401 if (_categoryName ==
"Widget")
1403 if (_factoryName ==
"HScroll")
1407 "HScroll factory is deprecated, use " << ScrollBar::getClassTypeName() <<
" ["
1408 << LayoutManager::getInstance().getCurrentLayout() <<
"]");
1410 else if (_factoryName ==
"VScroll")
1414 "VScroll factory is deprecated, use " << ScrollBar::getClassTypeName() <<
" ["
1415 << LayoutManager::getInstance().getCurrentLayout() <<
"]");
1417 else if (_factoryName ==
"RenderBox")
1421 "RenderBox factory is deprecated, use " << Canvas::getClassTypeName() <<
" ["
1422 << LayoutManager::getInstance().getCurrentLayout() <<
"]");
1424 else if (_factoryName ==
"Sheet")
1428 "Sheet factory is deprecated, use " << TabItem::getClassTypeName() <<
" ["
1429 << LayoutManager::getInstance().getCurrentLayout() <<
"]");
1431 else if (_factoryName ==
"StaticImage")
1435 "StaticImage factory is deprecated, use "
1436 << ImageBox::getClassTypeName() <<
" [" << LayoutManager::getInstance().getCurrentLayout()
1439 else if (_factoryName ==
"StaticText")
1443 "StaticText factory is deprecated, use " << TextBox::getClassTypeName() <<
" ["
1444 << LayoutManager::getInstance().getCurrentLayout() <<
"]");
1446 else if (_factoryName ==
"Progress")
1450 "Progress factory is deprecated, use " << ProgressBar::getClassTypeName() <<
" ["
1451 << LayoutManager::getInstance().getCurrentLayout() <<
"]");
1453 else if (_factoryName ==
"List")
1457 "List factory is deprecated, use " << ListBox::getClassTypeName() <<
" ["
1458 << LayoutManager::getInstance().getCurrentLayout() <<
"]");
1460 else if (_factoryName ==
"Edit")
1464 "Edit factory is deprecated, use " << EditBox::getClassTypeName() <<
" ["
1465 << LayoutManager::getInstance().getCurrentLayout() <<
"]");
1467 else if (_factoryName ==
"Tab")
1471 "Tab factory is deprecated, use " << TabControl::getClassTypeName() <<
" ["
1472 << LayoutManager::getInstance().getCurrentLayout() <<
"]");
1474 else if (_factoryName ==
"MultiList")
1478 "MultiList factory is deprecated, use " << MultiListBox::getClassTypeName() <<
" ["
1479 << LayoutManager::getInstance().getCurrentLayout() <<
"]");
1481 else if (_factoryName ==
"MenuCtrl")
1485 "MenuCtrl factory is deprecated, use " << MenuControl::getClassTypeName() <<
" ["
1486 << LayoutManager::getInstance().getCurrentLayout() <<
"]");
1490 return _factoryName;
1493 std::string_view BackwardCompatibility::getSkinRename(std::string_view _skinName)
1495#ifndef MYGUI_DONT_USE_OBSOLETE
1496 MapString::iterator item =
mSkinRename.find(_skinName);
1501 (*item).first <<
" skin is deprecated, use " << (*item).second <<
" ["
1502 << LayoutManager::getInstance().getCurrentLayout() <<
"]");
1503 return (*item).second;
1509 void BackwardCompatibility::shutdown()
1511#ifndef MYGUI_DONT_USE_OBSOLETE
1516 void BackwardCompatibility::registerWidgetTypes()
1518#ifndef MYGUI_DONT_USE_OBSOLETE
1519 FactoryManager& factory = FactoryManager::getInstance();
1520 const std::string& widgetCategory = MyGUI::WidgetManager::getInstance().getCategoryName();
1521 factory.registerFactory<HScroll>(widgetCategory);
1522 factory.registerFactory<VScroll>(widgetCategory);
1523 factory.registerFactory<Canvas>(widgetCategory,
"RenderBox");
1524 factory.registerFactory<TabItem>(widgetCategory,
"Sheet");
1525 factory.registerFactory<ImageBox>(widgetCategory,
"StaticImage");
1526 factory.registerFactory<TextBox>(widgetCategory,
"StaticText");
1527 factory.registerFactory<ProgressBar>(widgetCategory,
"Progress");
1528 factory.registerFactory<ListBox>(widgetCategory,
"List");
1529 factory.registerFactory<EditBox>(widgetCategory,
"Edit");
1530 factory.registerFactory<TabControl>(widgetCategory,
"Tab");
1531 factory.registerFactory<MultiListBox>(widgetCategory,
"MultiList");
1532 factory.registerFactory<MenuControl>(widgetCategory,
"MenuCtrl");
#define MYGUI_LOG(level, text)
T parseValue(std::string_view value)
std::set< std::string, std::less<> > SetString
types::TRect< int > IntRect
static MapString mPropertyRename
types::TPoint< int > IntPoint
Enumerator< std::vector< ILayerNode * > > EnumeratorILayerNode
static std::string_view convertAlignToDirection(std::string_view _value)
std::map< std::string, std::string, std::less<> > MapString
Enumerator< VectorWidgetPtr > EnumeratorWidgetPtr
std::vector< PairString > VectorStringPairs
static std::string convertRectToCoord(std::string_view _value)
static SetString mPropertyIgnore
constexpr size_t ITEM_NONE
types::TCoord< int > IntCoord
types::TSize< int > IntSize
static MapString mSkinRename
std::vector< Widget * > VectorWidgetPtr
Enumerator< VectorGroupImage > EnumeratorGroupImage
std::string print() const
static TRect< int > parse(std::string_view _value)
std::string print() const