MyGUI 3.5.3
MyGUI_BackwardCompatibility.cpp
Go to the documentation of this file.
1/*
2 * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3 * Distributed under the MIT License
4 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5 */
6
7#include "MyGUI_Precompiled.h"
9#include "MyGUI_Button.h"
10#include "MyGUI_ComboBox.h"
11#include "MyGUI_EditBox.h"
12#include "MyGUI_ItemBox.h"
13#include "MyGUI_ListBox.h"
14#include "MyGUI_MenuControl.h"
15#include "MyGUI_MenuItem.h"
16#include "MyGUI_MultiListBox.h"
17#include "MyGUI_ProgressBar.h"
18#include "MyGUI_ScrollView.h"
19#include "MyGUI_TabControl.h"
20#include "MyGUI_Widget.h"
21#include "MyGUI_Window.h"
22#include "MyGUI_TabItem.h"
23#include "MyGUI_Canvas.h"
24#include "MyGUI_LayoutManager.h"
25#include "MyGUI_FontManager.h"
28#include "MyGUI_Gui.h"
29#include "MyGUI_ILayer.h"
31#include "MyGUI_InputManager.h"
32#include "MyGUI_RenderManager.h"
34#include "MyGUI_SkinManager.h"
35#include "MyGUI_WidgetManager.h"
38
39#include <pugixml.hpp>
40
41namespace MyGUI
42{
43
44#ifndef MYGUI_DONT_USE_OBSOLETE
45
47 MYGUI_SUPPRESS_GCC("-Wdeprecated-declarations")
48
49 void MemberObsolete<Button>::setButtonPressed(bool _value)
50 {
51 static_cast<Button*>(this)->setStateSelected(_value);
52 }
54 {
55 return static_cast<const Button*>(this)->getStateSelected();
56 }
58 {
59 static_cast<Button*>(this)->setStateSelected(_value);
60 }
62 {
63 return static_cast<const Button*>(this)->getStateSelected();
64 }
66 {
67 return static_cast<const Button*>(this)->_getImageBox();
68 }
70 {
71 if (static_cast<Button*>(this)->_getImageBox())
72 static_cast<Button*>(this)->_getImageBox()->setImageIndex(_index);
73 }
75 {
76 if (static_cast<const Button*>(this)->_getImageBox())
77 return static_cast<const Button*>(this)->_getImageBox()->getImageIndex();
78 return ITEM_NONE;
79 }
80
81 void MemberObsolete<ImageBox>::addItemFrameDublicate(size_t _index, size_t _indexSourceFrame)
82 {
83 static_cast<ImageBox*>(this)->addItemFrameDuplicate(_index, _indexSourceFrame);
84 }
85 void MemberObsolete<ImageBox>::insertItemFrameDublicate(size_t _index, size_t _indexFrame, size_t _indexSourceFrame)
86 {
87 static_cast<ImageBox*>(this)->insertItemFrameDuplicate(_index, _indexFrame, _indexSourceFrame);
88 }
89
90
92 {
93 return static_cast<const ComboBox*>(this)->getIndexSelected();
94 }
96 {
97 static_cast<ComboBox*>(this)->setIndexSelected(_index);
98 }
100 {
101 static_cast<ComboBox*>(this)->clearIndexSelected();
102 }
103
104 void MemberObsolete<ComboBox>::insertItem(size_t _index, const UString& _name)
105 {
106 static_cast<ComboBox*>(this)->insertItemAt(_index, _name);
107 }
108 void MemberObsolete<ComboBox>::setItem(size_t _index, const UString& _item)
109 {
110 static_cast<ComboBox*>(this)->setItemNameAt(_index, _item);
111 }
112 const UString& MemberObsolete<ComboBox>::getItem(size_t _index) const
113 {
114 return static_cast<const ComboBox*>(this)->getItemNameAt(_index);
115 }
116 void MemberObsolete<ComboBox>::deleteItem(size_t _index)
117 {
118 static_cast<ComboBox*>(this)->removeItemAt(_index);
119 }
121 {
122 static_cast<ComboBox*>(this)->removeAllItems();
123 }
125 {
126 return static_cast<const ComboBox*>(this)->getIndexSelected();
127 }
129 {
130 static_cast<ComboBox*>(this)->clearIndexSelected();
131 }
133 {
134 static_cast<ComboBox*>(this)->setIndexSelected(_index);
135 }
136
138 {
139 static_cast<ComboBox*>(this)->setMaxListLength(_value);
140 }
142 {
143 return static_cast<const ComboBox*>(this)->getMaxListLength();
144 }
145
146
147 void MemberObsolete<EditBox>::showVScroll(bool _visible)
148 {
149 static_cast<EditBox*>(this)->setVisibleVScroll(_visible);
150 }
152 {
153 return static_cast<EditBox*>(this)->isVisibleVScroll();
154 }
155 void MemberObsolete<EditBox>::showHScroll(bool _visible)
156 {
157 static_cast<EditBox*>(this)->setVisibleHScroll(_visible);
158 }
160 {
161 return static_cast<EditBox*>(this)->isVisibleHScroll();
162 }
163
164 void MemberObsolete<EditBox>::setTextColour(size_t _start, size_t _count, const Colour& _colour)
165 {
166 static_cast<EditBox*>(this)->setTextIntervalColour(_start, _count, _colour);
167 }
168 void MemberObsolete<EditBox>::getTextSelect(size_t& _start, size_t& _end) const
169 {
170 _start = static_cast<const EditBox*>(this)->getTextSelectionStart();
171 _end = static_cast<const EditBox*>(this)->getTextSelectionEnd();
172 }
173 UString MemberObsolete<EditBox>::getText(size_t _start, size_t _count) const
174 {
175 return static_cast<const EditBox*>(this)->getTextInterval(_start, _count);
176 }
177 void MemberObsolete<EditBox>::setTextSelect(size_t _start, size_t _end)
178 {
179 static_cast<EditBox*>(this)->setTextSelection(_start, _end);
180 }
182 {
183 static_cast<EditBox*>(this)->deleteTextSelection();
184 }
186 {
187 return static_cast<const EditBox*>(this)->getTextSelection();
188 }
190 {
191 return static_cast<EditBox*>(this)->isTextSelection();
192 }
193 void MemberObsolete<EditBox>::setTextSelectColour(const Colour& _colour)
194 {
195 static_cast<EditBox*>(this)->setTextSelectionColour(_colour);
196 }
197
198
200 {
201 return static_cast<const ItemBox*>(this)->getIndexSelected();
202 }
204 {
205 static_cast<ItemBox*>(this)->setIndexSelected(_index);
206 }
208 {
209 static_cast<ItemBox*>(this)->clearIndexSelected();
210 }
211
212 void MemberObsolete<ItemBox>::insertItem(size_t _index, Any _data)
213 {
214 static_cast<ItemBox*>(this)->insertItemAt(_index, _data);
215 }
216 void MemberObsolete<ItemBox>::setItemData(size_t _index, Any _data)
217 {
218 static_cast<ItemBox*>(this)->setItemDataAt(_index, _data);
219 }
220 void MemberObsolete<ItemBox>::deleteItem(size_t _index)
221 {
222 static_cast<ItemBox*>(this)->removeItemAt(_index);
223 }
225 {
226 static_cast<ItemBox*>(this)->removeAllItems();
227 }
229 {
230 return static_cast<const ItemBox*>(this)->getIndexSelected();
231 }
233 {
234 static_cast<ItemBox*>(this)->clearIndexSelected();
235 }
237 {
238 static_cast<ItemBox*>(this)->setIndexSelected(_index);
239 }
240
242 {
243 return static_cast<const ItemBox*>(this)->getWidgetDrag();
244 }
246 {
247 static_cast<ItemBox*>(this)->resetDrag();
248 }
249
251 {
252 static_cast<ItemBox*>(this)->setVerticalAlignment(_value);
253 }
255 {
256 return static_cast<const ItemBox*>(this)->getVerticalAlignment();
257 }
258
259
261 {
262 return static_cast<const ListBox*>(this)->getIndexSelected();
263 }
265 {
266 static_cast<ListBox*>(this)->setIndexSelected(_index);
267 }
269 {
270 static_cast<ListBox*>(this)->clearIndexSelected();
271 }
272
273 void MemberObsolete<ListBox>::insertItem(size_t _index, const UString& _item)
274 {
275 static_cast<ListBox*>(this)->insertItemAt(_index, _item);
276 }
277 void MemberObsolete<ListBox>::setItem(size_t _index, const UString& _item)
278 {
279 static_cast<ListBox*>(this)->setItemNameAt(_index, _item);
280 }
281 const UString& MemberObsolete<ListBox>::getItem(size_t _index) const
282 {
283 return static_cast<const ListBox*>(this)->getItemNameAt(_index);
284 }
285 void MemberObsolete<ListBox>::deleteItem(size_t _index)
286 {
287 static_cast<ListBox*>(this)->removeItemAt(_index);
288 }
290 {
291 static_cast<ListBox*>(this)->removeAllItems();
292 }
293 size_t MemberObsolete<ListBox>::findItem(const UString& _item)
294 {
295 return static_cast<ListBox*>(this)->findItemIndexWith(_item);
296 }
298 {
299 return static_cast<const ListBox*>(this)->getIndexSelected();
300 }
302 {
303 static_cast<ListBox*>(this)->clearIndexSelected();
304 }
306 {
307 static_cast<ListBox*>(this)->setIndexSelected(_index);
308 }
309 void MemberObsolete<ListBox>::beginToIndex(size_t _index)
310 {
311 static_cast<ListBox*>(this)->beginToItemAt(_index);
312 }
314 {
315 static_cast<ListBox*>(this)->beginToItemFirst();
316 }
318 {
319 static_cast<ListBox*>(this)->beginToItemLast();
320 }
322 {
323 static_cast<ListBox*>(this)->beginToItemSelected();
324 }
325 bool MemberObsolete<ListBox>::isItemVisible(size_t _index, bool _fill)
326 {
327 return static_cast<ListBox*>(this)->isItemVisibleAt(_index, _fill);
328 }
330 {
331 return static_cast<ListBox*>(this)->isItemSelectedVisible(_fill);
332 }
333
334
336 {
337 static_cast<MenuControl*>(this)->setVisible(true);
338 }
340 {
341 static_cast<MenuControl*>(this)->setVisible(false);
342 }
344 {
345 return static_cast<MenuControl*>(this)->getVisible();
346 }
347
349 {
350 static_cast<MenuControl*>(this)->setItemChildVisibleAt(_index, true);
351 }
353 {
354 static_cast<MenuControl*>(this)->setItemChildVisible(_item, true);
355 }
357 {
358 static_cast<MenuControl*>(this)->setItemChildVisibleAt(_index, false);
359 }
361 {
362 static_cast<MenuControl*>(this)->setItemChildVisible(_item, false);
363 }
364
366 {
367 static_cast<MenuControl*>(this)->setVerticalAlignment(_value);
368 }
370 {
371 return static_cast<const MenuControl*>(this)->getVerticalAlignment();
372 }
373
375 {
376 static_cast<MenuItem*>(this)->setItemChildVisible(true);
377 }
379 {
380 static_cast<MenuItem*>(this)->setItemChildVisible(false);
381 }
382
383
385 {
386 return static_cast<const MultiListBox*>(this)->getIndexSelected();
387 }
389 {
390 static_cast<MultiListBox*>(this)->setIndexSelected(_index);
391 }
393 {
394 static_cast<MultiListBox*>(this)->clearIndexSelected();
395 }
396
397 size_t MemberObsolete<MultiListBox>::findItem(size_t _column, const UString& _name)
398 {
399 return static_cast<MultiListBox*>(this)->findSubItemWith(_column, _name);
400 }
401 const UString& MemberObsolete<MultiListBox>::getSubItem(size_t _column, size_t _index) const
402 {
403 return static_cast<const MultiListBox*>(this)->getSubItemNameAt(_column, _index);
404 }
405 void MemberObsolete<MultiListBox>::setSubItem(size_t _column, size_t _index, const UString& _name)
406 {
407 static_cast<MultiListBox*>(this)->setSubItemNameAt(_column, _index, _name);
408 }
410 {
411 static_cast<MultiListBox*>(this)->removeColumnAt(_column);
412 }
414 {
415 static_cast<MultiListBox*>(this)->removeAllColumns();
416 }
417 int MemberObsolete<MultiListBox>::getColumnWidth(size_t _column) const
418 {
419 return static_cast<const MultiListBox*>(this)->getColumnWidthAt(_column);
420 }
421 const UString& MemberObsolete<MultiListBox>::getColumnName(size_t _column) const
422 {
423 return static_cast<const MultiListBox*>(this)->getColumnNameAt(_column);
424 }
425 void MemberObsolete<MultiListBox>::setColumnWidth(size_t _column, int _width)
426 {
427 static_cast<MultiListBox*>(this)->setColumnWidthAt(_column, _width);
428 }
429 void MemberObsolete<MultiListBox>::addColumn(int _width, const UString& _name)
430 {
431 static_cast<MultiListBox*>(this)->addColumn(_name, _width);
432 }
433 void MemberObsolete<MultiListBox>::setColumnName(size_t _column, const UString& _name)
434 {
435 static_cast<MultiListBox*>(this)->setColumnNameAt(_column, _name);
436 }
437 void MemberObsolete<MultiListBox>::insertColumn(size_t _column, int _width, const UString& _name)
438 {
439 static_cast<MultiListBox*>(this)->insertColumnAt(_column, _name, _width);
440 }
442 {
443 return static_cast<const MultiListBox*>(this)->getIndexSelected();
444 }
446 {
447 static_cast<MultiListBox*>(this)->clearIndexSelected();
448 }
450 {
451 static_cast<MultiListBox*>(this)->setIndexSelected(_index);
452 }
453 void MemberObsolete<MultiListBox>::insertItem(size_t _index, const UString& _name)
454 {
455 static_cast<MultiListBox*>(this)->insertItemAt(_index, _name);
456 }
457 void MemberObsolete<MultiListBox>::setItem(size_t _index, const UString& _name)
458 {
459 static_cast<MultiListBox*>(this)->setItemNameAt(_index, _name);
460 }
461 const UString& MemberObsolete<MultiListBox>::getItem(size_t _index) const
462 {
463 return static_cast<const MultiListBox*>(this)->getItemNameAt(_index);
464 }
466 {
467 static_cast<MultiListBox*>(this)->removeItemAt(_index);
468 }
470 {
471 static_cast<MultiListBox*>(this)->removeAllItems();
472 }
473
474
476 {
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);
483 else
484 static_cast<ProgressBar*>(this)->setFlowDirection(FlowDirection::LeftToRight);
485 }
486
488 {
489 if (static_cast<const ProgressBar*>(this)->getFlowDirection() == FlowDirection::RightToLeft)
490 return Align::Right;
491 if (static_cast<const ProgressBar*>(this)->getFlowDirection() == FlowDirection::TopToBottom)
492 return Align::Top;
493 if (static_cast<const ProgressBar*>(this)->getFlowDirection() == FlowDirection::BottomToTop)
494 return Align::Bottom;
495
496 return Align::Left;
497 }
498
499
501 {
502 static_cast<ScrollView*>(this)->setVisibleVScroll(_visible);
503 }
505 {
506 return static_cast<ScrollView*>(this)->isVisibleVScroll();
507 }
509 {
510 static_cast<ScrollView*>(this)->setVisibleHScroll(_visible);
511 }
513 {
514 return static_cast<ScrollView*>(this)->isVisibleHScroll();
515 }
516
517
519 {
520 return static_cast<const TabControl*>(this)->getButtonWidthAt(_index);
521 }
522 int MemberObsolete<TabControl>::getSheetButtonWidth(TabItem* _sheet) const
523 {
524 return static_cast<const TabControl*>(this)->getButtonWidth(_sheet);
525 }
526 void MemberObsolete<TabControl>::setSheetButtonWidthIndex(size_t _index, int _width)
527 {
528 static_cast<TabControl*>(this)->setButtonWidthAt(_index, _width);
529 }
530 void MemberObsolete<TabControl>::setSheetButtonWidth(TabItem* _sheet, int _width)
531 {
532 static_cast<TabControl*>(this)->setButtonWidth(_sheet, _width);
533 }
535 {
536 static_cast<TabControl*>(this)->beginToItemAt(_index);
537 }
539 {
540 static_cast<TabControl*>(this)->beginToItemSelected();
541 }
543 {
544 return static_cast<const TabControl*>(this)->getItemCount();
545 }
546 const UString& MemberObsolete<TabControl>::getSheetName(TabItem* _sheet) const
547 {
548 return static_cast<const TabControl*>(this)->getItemName(_sheet);
549 }
550 const UString& MemberObsolete<TabControl>::getSheetNameIndex(size_t _index) const
551 {
552 return static_cast<const TabControl*>(this)->getItemNameAt(_index);
553 }
554 TabItem* MemberObsolete<TabControl>::getSheet(size_t _index) const
555 {
556 return static_cast<const TabControl*>(this)->getItemAt(_index);
557 }
558 void MemberObsolete<TabControl>::setSheetNameIndex(size_t _index, const UString& _name, int _width)
559 {
560 static_cast<TabControl*>(this)->setItemNameAt(_index, _name);
561 }
562 void MemberObsolete<TabControl>::setSheetName(TabItem* _sheet, const UString& _name, int _width)
563 {
564 static_cast<TabControl*>(this)->setItemName(_sheet, _name);
565 }
566 TabItem* MemberObsolete<TabControl>::addSheet(const UString& _name, int _width)
567 {
568 return static_cast<TabControl*>(this)->addItem(_name, _width);
569 }
570 TabItem* MemberObsolete<TabControl>::insertSheet(size_t _index, const UString& _name, int _width)
571 {
572 return static_cast<TabControl*>(this)->insertItemAt(_index, _name);
573 }
575 {
576 static_cast<TabControl*>(this)->removeItemAt(_index);
577 }
578 void MemberObsolete<TabControl>::removeSheet(TabItem* _sheet)
579 {
580 static_cast<TabControl*>(this)->removeItem(_sheet);
581 }
582 void MemberObsolete<TabControl>::selectSheetIndex(size_t _index, bool _smooth)
583 {
584 static_cast<TabControl*>(this)->setIndexSelected(_index);
585 }
586 void MemberObsolete<TabControl>::selectSheet(TabItem* _sheet, bool _smooth)
587 {
588 static_cast<TabControl*>(this)->setItemSelected(_sheet);
589 }
591 {
592 return static_cast<const TabControl*>(this)->getIndexSelected();
593 }
594
596 {
597 return static_cast<const TabControl*>(this)->getIndexSelected();
598 }
600 {
601 static_cast<TabControl*>(this)->setIndexSelected(_index);
602 }
603
604
606 {
607 return static_cast<Widget*>(this)->getEnabled();
608 }
610 {
611 return static_cast<Widget*>(this)->getInheritsAlpha();
612 }
614 {
615 return static_cast<Widget*>(this)->getNeedKeyFocus();
616 }
618 {
619 return static_cast<Widget*>(this)->getNeedMouseFocus();
620 }
622 {
623 return static_cast<Widget*>(this)->getInheritsPick();
624 }
626 {
627 return static_cast<Widget*>(this)->getVisible();
628 }
629
631 {
632 return EnumeratorWidgetPtr(static_cast<const Widget*>(this)->getChildWidgets());
633 }
634
635
636 void MemberObsolete<Window>::showSmooth(bool _reset)
637 {
638 static_cast<Window*>(this)->setVisibleSmooth(true);
639 }
641 {
642 static_cast<Window*>(this)->setVisibleSmooth(false);
643 }
644 void MemberObsolete<Window>::setMinMax(const IntRect& _minmax)
645 {
646 static_cast<Window*>(this)->setMinSize(_minmax.left, _minmax.top);
647 static_cast<Window*>(this)->setMaxSize(_minmax.right, _minmax.bottom);
648 }
649 void MemberObsolete<Window>::setMinMax(int _min_w, int _min_h, int _max_w, int _max_h)
650 {
651 static_cast<Window*>(this)->setMinSize(_min_w, _min_h);
652 static_cast<Window*>(this)->setMaxSize(_max_w, _max_h);
653 }
655 {
656 return {
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};
661 }
662
663 bool MemberObsolete<FontManager>::load(const std::string& _file)
664 {
665 return ResourceManager::getInstance().load(_file);
666 }
667
669 xml::ElementPtr _node2,
670 std::string_view _file,
671 Version _version,
672 std::string_view _tag)
673 {
674 for (auto _node : _node2.node())
675 {
676 if (_node.name() != _tag)
677 continue;
678
679 std::string_view name{_node.attribute("name").value()};
680 if (name.empty())
681 return;
682
683 std::string_view type;
684 if (_node.attribute("resolution").empty())
685 type = "ResourceManualFont";
686 else
687 type = "ResourceTrueTypeFont";
688
689 xml::Document doc;
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();
694
695 auto attr = _node.attribute("source");
696 if (attr)
697 {
698 pugi::xml_node prop = node.append_child("Property");
699 prop.append_attribute("key") = "Source";
700 prop.append_attribute("value") = attr.value();
701 }
702
703 attr = _node.attribute("size");
704 if (attr)
705 {
706 pugi::xml_node prop = node.append_child("Property");
707 prop.append_attribute("key") = "Size";
708 prop.append_attribute("value") = attr.value();
709 }
710
711 attr = _node.attribute("resolution");
712 if (attr)
713 {
714 pugi::xml_node prop = node.append_child("Property");
715 prop.append_attribute("key") = "Resolution";
716 prop.append_attribute("value") = attr.value();
717 }
718
719 attr = _node.attribute("antialias_colour");
720 if (attr)
721 {
722 pugi::xml_node prop = node.append_child("Property");
723 prop.append_attribute("key") = "Antialias";
724 prop.append_attribute("value") = attr.value();
725 }
726
727 attr = _node.attribute("space_width");
728 if (attr)
729 {
730 pugi::xml_node prop = node.append_child("Property");
731 prop.append_attribute("key") = "SpaceWidth";
732 prop.append_attribute("value") = attr.value();
733 }
734
735 attr = _node.attribute("tab_width");
736 if (attr)
737 {
738 pugi::xml_node prop = node.append_child("Property");
739 prop.append_attribute("key") = "TabWidth";
740 prop.append_attribute("value") = attr.value();
741 }
742
743 attr = _node.attribute("cursor_width");
744 if (attr)
745 {
746 pugi::xml_node prop = node.append_child("Property");
747 prop.append_attribute("key") = "CursorWidth";
748 prop.append_attribute("value") = attr.value();
749 }
750
751 attr = _node.attribute("distance");
752 if (attr)
753 {
754 pugi::xml_node prop = node.append_child("Property");
755 prop.append_attribute("key") = "Distance";
756 prop.append_attribute("value") = attr.value();
757 }
758
759 attr = _node.attribute("offset_height");
760 if (attr)
761 {
762 pugi::xml_node prop = node.append_child("Property");
763 prop.append_attribute("key") = "OffsetHeight";
764 prop.append_attribute("value") = attr.value();
765 }
766
767 attr = _node.attribute("default_height");
768 if (attr)
769 {
770 pugi::xml_node prop = node.append_child("Property");
771 prop.append_attribute("key") = "DefaultHeight";
772 prop.append_attribute("value") = attr.value();
773 }
774
775 pugi::xml_node codes = node.append_child("Codes");
776
777 for (auto codeold : _node.children("Code"))
778 {
779 pugi::xml_node codenew = codes.append_child("Code");
780
781 attr = codeold.attribute("range");
782 if (attr)
783 codenew.append_attribute("range") = attr.value();
784
785 attr = codeold.attribute("hide");
786 if (attr)
787 codenew.append_attribute("hide") = attr.value();
788
789 attr = codeold.attribute("index");
790 if (attr)
791 codenew.append_attribute("index") = attr.value();
792
793 attr = codeold.attribute("coord");
794 if (attr)
795 codenew.append_attribute("coord") = attr.value();
796 }
797
798 ResourceManager::getInstance().loadFromXmlNode(root, _file, _version);
799 }
800 }
801
802 void MemberObsolete<Gui>::initialise(const std::string& _core, std::string_view _logFileName)
803 {
804 static_cast<Gui*>(this)->initialise(_core);
805 }
806
808 {
809 VectorWidgetPtr widgets;
810 while (_widgets.next())
811 widgets.push_back(_widgets.current());
812 static_cast<Gui*>(this)->destroyWidgets(widgets);
813 }
814
815 Widget* MemberObsolete<Gui>::findWidgetT(std::string_view _name, std::string_view _prefix, bool _throw) const
816 {
817 std::string name{_prefix};
818 name += _name;
819 return static_cast<const Gui*>(this)->findWidgetT(name, _throw);
820 }
821
822 Widget* MemberObsolete<Gui>::findWidgetHelper(std::string_view _name, bool _throw) const
823 {
824 return static_cast<const Gui*>(this)->findWidgetT(_name, _throw);
825 }
826
828 {
829 static_cast<Gui*>(this)->destroyWidgets(_widgets);
830 }
831
832 bool MemberObsolete<Gui>::injectMouseMove(int _absx, int _absy, int _absz)
833 {
834 return InputManager::getInstance().injectMouseMove(_absx, _absy, _absz);
835 }
836 bool MemberObsolete<Gui>::injectMousePress(int _absx, int _absy, MouseButton _id)
837 {
838 return InputManager::getInstance().injectMousePress(_absx, _absy, _id);
839 }
840 bool MemberObsolete<Gui>::injectMouseRelease(int _absx, int _absy, MouseButton _id)
841 {
842 return InputManager::getInstance().injectMouseRelease(_absx, _absy, _id);
843 }
844 bool MemberObsolete<Gui>::injectKeyPress(KeyCode _key, Char _text)
845 {
846 return InputManager::getInstance().injectKeyPress(_key, _text);
847 }
849 {
850 return InputManager::getInstance().injectKeyRelease(_key);
851 }
852
854 {
855 PointerManager::getInstance().setVisible(false);
856 }
858 {
859 PointerManager::getInstance().setVisible(true);
860 }
862 {
863 return PointerManager::getInstance().isVisible();
864 }
865
866 bool MemberObsolete<Gui>::load(const std::string& _file)
867 {
868 return ResourceManager::getInstance().load(_file);
869 }
870
872 {
873 return RenderManager::getInstance().getViewSize();
874 }
876 {
877 return RenderManager::getInstance().getViewSize().width;
878 }
880 {
881 return RenderManager::getInstance().getViewSize().height;
882 }
883
885 {
886 PointerManager::getInstance().setVisible(_value);
887 }
889 {
890 return PointerManager::getInstance().isVisible();
891 }
892
894 {
895 Gui::getInstance().frameEvent(_time);
896 }
897
899 {
900 LayerManager::getInstance().resizeView(_size);
901 }
902
904 {
905 return InputManager::getInstance().getLastPressedPosition(MouseButton::Left);
906 }
907
909 {
910 return InputManager::getInstance().getLastPressedPosition(MouseButton::Right);
911 }
912
913 bool MemberObsolete<LanguageManager>::load(const std::string& _file)
914 {
915 return ResourceManager::getInstance().load(_file);
916 }
917
918 bool MemberObsolete<LayerManager>::load(const std::string& _file)
919 {
920 return ResourceManager::getInstance().load(_file);
921 }
922
924 {
925 return EnumeratorLayer(static_cast<const LayerManager*>(this)->getLayers());
926 }
927
929 {
930 return static_cast<LayoutManager*>(this)->loadLayout(_file);
931 }
932
933 void MemberObsolete<PointerManager>::setDeafultPointer(std::string_view _value)
934 {
935 static_cast<PointerManager*>(this)->setDefaultPointer(_value);
936 }
938 {
939 static_cast<PointerManager*>(this)->setVisible(true);
940 }
942 {
943 static_cast<PointerManager*>(this)->setVisible(false);
944 }
946 {
947 return static_cast<PointerManager*>(this)->isVisible();
948 }
949 bool MemberObsolete<PointerManager>::load(const std::string& _file)
950 {
951 return ResourceManager::getInstance().load(_file);
952 }
954 xml::ElementPtr _node,
955 std::string_view _file,
956 Version _version,
957 std::string_view _tag)
958 {
959 std::string_view pointer;
960 std::string_view layer;
961
962 for (auto node : _node.node())
963 {
964 if (node.name() != _tag)
965 continue;
966
967 layer = node.attribute("layer").value();
968 pointer = node.attribute("default").value();
969
970 std::string_view shared_text{node.attribute("texture").value()};
971
972 // iterate children, main loop
973 for (auto info : node.children("Info"))
974 {
975 std::string_view name{info.attribute("name").value()};
976 if (name.empty())
977 continue;
978
979 std::string_view texture{info.attribute("texture").value()};
980
981 std::string_view type =
982 (shared_text.empty() && texture.empty()) ? "ResourceImageSetPointer" : "ResourceManualPointer";
983
984 xml::Document doc;
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();
989
990 auto attr = info.attribute("point");
991 if (attr)
992 {
993 pugi::xml_node prop = newnode.append_child("Property");
994 prop.append_attribute("key") = "Point";
995 prop.append_attribute("value") = attr.value();
996 }
997
998 attr = info.attribute("size");
999 if (attr)
1000 {
1001 pugi::xml_node prop = newnode.append_child("Property");
1002 prop.append_attribute("key") = "Size";
1003 prop.append_attribute("value") = attr.value();
1004 }
1005
1006 attr = info.attribute("resource");
1007 if (attr)
1008 {
1009 pugi::xml_node prop = newnode.append_child("Property");
1010 prop.append_attribute("key") = "Resource";
1011 prop.append_attribute("value") = attr.value();
1012 }
1013
1014 attr = info.attribute("offset");
1015 if (attr)
1016 {
1017 pugi::xml_node prop = newnode.append_child("Property");
1018 prop.append_attribute("key") = "Coord";
1019 prop.append_attribute("value") = attr.value();
1020 }
1021
1022 if (!shared_text.empty() || !texture.empty())
1023 {
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();
1027 }
1028
1029 ResourceManager::getInstance().loadFromXmlNode(root, _file, _version);
1030 }
1031 }
1032
1033 if (!layer.empty())
1034 static_cast<PointerManager*>(this)->setLayerName(layer);
1035
1036 if (!pointer.empty())
1037 static_cast<PointerManager*>(this)->setDefaultPointer(pointer);
1038 }
1039
1041 {
1042 return EnumeratorPtr(static_cast<const ResourceManager*>(this)->getResources());
1043 }
1044
1046 {
1047 return EnumeratorILayerNode(static_cast<const ILayer*>(this)->getChildItems());
1048 }
1049
1051 {
1052 return static_cast<const ResourceManager*>(this)->getCount();
1053 }
1054 IResourcePtr MemberObsolete<ResourceManager>::getResource(std::string_view _name, bool _throw) const
1055 {
1056 return static_cast<const ResourceManager*>(this)->getByName(_name, _throw);
1057 }
1058
1059 ResourceSkin* MemberObsolete<SkinManager>::getSkin(std::string_view _name) const
1060 {
1061 return static_cast<const SkinManager*>(this)->getByName(_name);
1062 }
1063 bool MemberObsolete<SkinManager>::load(const std::string& _file)
1064 {
1065 return ResourceManager::getInstance().load(_file);
1066 }
1068 xml::ElementPtr _node,
1069 std::string_view /*_file*/,
1070 Version _version,
1071 std::string_view _tag)
1072 {
1073 const std::string& resourceCategory = ResourceManager::getInstance().getCategoryName();
1074
1075 // iterate children, main loop with skins
1076 for (auto skin : _node.node().children(_tag.data()))
1077 {
1078 std::string_view type = skin.attribute("type").value();
1079 if (type.empty())
1080 type = "ResourceSkin";
1081
1082 IObject* object = FactoryManager::getInstance().createObject(resourceCategory, type);
1083 if (object != nullptr)
1084 {
1085 ResourceSkin* data = object->castType<ResourceSkin>();
1086 data->deserialization(skin, _version);
1087
1088 ResourceManager::getInstance().addResource(data);
1089 }
1090 }
1091 }
1092
1093
1095 {
1096 Gui::getInstance().destroyWidgets(_widgets);
1097 }
1098
1100 {
1101 static_cast<WidgetManager*>(this)->destroyWidgets(_widgets);
1102 }
1103 Widget* MemberObsolete<WidgetManager>::findWidgetT(std::string_view _name, bool _throw)
1104 {
1105 return Gui::getInstance().findWidgetT(_name, _throw);
1106 }
1107 Widget* MemberObsolete<WidgetManager>::findWidgetT(std::string_view _name, std::string_view _prefix, bool _throw)
1108 {
1109 std::string name{_prefix};
1110 name += _name;
1111 return Gui::getInstance().findWidgetT(name, _throw);
1112 }
1113 void MemberObsolete<WidgetManager>::parse(Widget* _widget, std::string_view _key, std::string_view _value)
1114 {
1115 _widget->setProperty(_key, _value);
1116 }
1117
1119 ITexture* _texture,
1120 bool _firstQueue,
1121 bool /*_manualRender*/)
1122 {
1123 return static_cast<ILayerNode*>(this)->addToRenderItem(_texture, _firstQueue);
1124 }
1125
1127 {
1128 return EnumeratorILayerNode(static_cast<const ILayerNode*>(this)->getChildItems());
1129 }
1130
1132 {
1133 return EnumeratorGroupImage(static_cast<const ResourceImageSet*>(this)->getGroups());
1134 }
1135
1136 xml::ElementPtr MemberObsolete<xml::Document>::createInfo(std::string_view _version, std::string_view _encoding)
1137 {
1138 return static_cast<xml::Document*>(this)->createDeclaration(_version, _encoding);
1139 }
1140
1141 static std::string_view convertAlignToDirection(std::string_view _value)
1142 {
1143 Align align = utility::parseValue<Align>(_value);
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();
1151 }
1152
1153 static std::string convertRectToCoord(std::string_view _value)
1154 {
1155 IntRect rect = IntRect::parse(_value);
1156 IntCoord coord(rect.left, rect.top, rect.width(), rect.height());
1157 return coord.print();
1158 }
1159
1160 using SetString = std::set<std::string, std::less<>>;
1164
1167
1168#endif // MYGUI_DONT_USE_OBSOLETE
1169
1170 bool BackwardCompatibility::isIgnoreProperty(std::string_view _key)
1171 {
1172#ifndef MYGUI_DONT_USE_OBSOLETE
1173 return mPropertyIgnore.find(_key) != mPropertyIgnore.end();
1174#else
1175 return false;
1176#endif // MYGUI_DONT_USE_OBSOLETE
1177 }
1178
1179 VectorStringPairs BackwardCompatibility::upgradeProperty(std::string_view _key, std::string_view _value)
1180 {
1181#ifndef MYGUI_DONT_USE_OBSOLETE
1182 if (_key == "Progress_StartPoint" || _key == "StartPoint")
1183 return {{"FlowDirection", std::string{convertAlignToDirection(_value)}}};
1184 if (_key == "ImageRect")
1185 return {{"ImageCoord", convertRectToCoord(_value)}};
1186 if (_key == "Window_MinMax")
1187 {
1188 IntRect rect = IntRect::parse(_value);
1189 return {
1190 {"MinSize", IntSize(rect.left, rect.top).print()},
1191 {"MaxSize", IntSize(rect.right, rect.bottom).print()}};
1192 }
1193 std::string_view renamed = getPropertyRename(_key, false);
1194 if (renamed != _key)
1195 return {{std::string{renamed}, std::string{_value}}};
1196#endif // MYGUI_DONT_USE_OBSOLETE
1197 return {{std::string{_key}, std::string{_value}}};
1198 }
1199
1200 bool BackwardCompatibility::processDeprecatedProperty(Widget* _owner, std::string& _key, std::string& _value)
1201 {
1202#ifndef MYGUI_DONT_USE_OBSOLETE
1203 if (mPropertyIgnore.find(_key) != mPropertyIgnore.end())
1204 return false;
1205
1206 if (_key == "ComboBox_AddItem")
1207 {
1208 MYGUI_LOG(
1209 Warning,
1210 "ComboBox_AddItem is deprecated" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1211 ComboBox* widget = _owner->castType<ComboBox>(false);
1212 if (widget != nullptr)
1213 widget->addItem(_value);
1214 return false;
1215 }
1216 else if (_key == "List_AddItem")
1217 {
1218 MYGUI_LOG(
1219 Warning,
1220 "List_AddItem is deprecated" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1221 ListBox* widget = _owner->castType<ListBox>(false);
1222 if (widget != nullptr)
1223 widget->addItem(_value);
1224 return false;
1225 }
1226 else if (_key == "Tab_AddSheet")
1227 {
1228 MYGUI_LOG(
1229 Warning,
1230 "Tab_AddSheet is deprecated" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1231 TabControl* widget = _owner->castType<TabControl>(false);
1232 if (widget != nullptr)
1233 widget->addItem(_value);
1234 return false;
1235 }
1236 else if (_key == "Tab_AddItem")
1237 {
1238 MYGUI_LOG(
1239 Warning,
1240 "Tab_AddItem is deprecated" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1241 TabControl* widget = _owner->castType<TabControl>(false);
1242 if (widget != nullptr)
1243 widget->addItem(_value);
1244 return false;
1245 }
1246 else if (_key == "Window_MinMax" && !_owner->isType<Window>())
1247 return false;
1248
1249 auto properties = upgradeProperty(_key, _value);
1250 if (properties.size() != 1 || properties.front().first != _key || properties.front().second != _value)
1251 {
1252 std::string replacements;
1253 for (const auto& property : properties)
1254 {
1255 if (!replacements.empty())
1256 replacements += ", ";
1257 replacements += property.first;
1258 }
1259 MYGUI_LOG(
1260 Warning,
1261 _key << " is deprecated, use " << replacements << " ["
1262 << LayoutManager::getInstance().getCurrentLayout() << "]");
1263 if (properties.size() == 1)
1264 {
1265 _key = std::move(properties.front().first);
1266 _value = std::move(properties.front().second);
1267 }
1268 else
1269 {
1270 for (const auto& property : properties)
1271 _owner->setProperty(property.first, property.second);
1272 return false;
1273 }
1274 }
1275
1276#endif // MYGUI_DONT_USE_OBSOLETE
1277 std::string_view renamed = getPropertyRename(_key);
1278 if (renamed != _key)
1279 {
1280 MYGUI_LOG(
1281 Warning,
1282 "Widget property '" << _key << "' have type prefix - use '" << renamed << "' instead ["
1283 << LayoutManager::getInstance().getCurrentLayout() << "]");
1284 _key = std::string{renamed};
1285 }
1286
1287 return true;
1288 }
1289
1290 void BackwardCompatibility::initialise()
1291 {
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"},
1320 };
1321 for (const auto& [from, to] : propertyRenames)
1322 mPropertyRename[std::string{from}] = to;
1323
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",
1332 };
1333 for (const auto property : ignoredProperties)
1334 mPropertyIgnore.insert(std::string{property});
1335
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"},
1374 };
1375 for (const auto& [from, to] : skinRenames)
1376 mSkinRename[std::string{from}] = to;
1377#endif // MYGUI_DONT_USE_OBSOLETE
1378 }
1379
1380 std::string_view BackwardCompatibility::getPropertyRename(std::string_view _propertyName, bool _trimTypePrefix)
1381 {
1382#ifndef MYGUI_DONT_USE_OBSOLETE
1383 MapString::const_iterator item = mPropertyRename.find(_propertyName);
1384 if (item != mPropertyRename.end())
1385 return (*item).second;
1386#endif // MYGUI_DONT_USE_OBSOLETE
1387 if (_trimTypePrefix)
1388 {
1389 size_t index = _propertyName.find('_');
1390 if (index != std::string_view::npos)
1391 return _propertyName.substr(index + 1);
1392 }
1393 return _propertyName;
1394 }
1395
1396 std::string_view BackwardCompatibility::getFactoryRename(
1397 std::string_view _categoryName,
1398 std::string_view _factoryName)
1399 {
1400#ifndef MYGUI_DONT_USE_OBSOLETE
1401 if (_categoryName == "Widget")
1402 {
1403 if (_factoryName == "HScroll")
1404 {
1405 MYGUI_LOG(
1406 Warning,
1407 "HScroll factory is deprecated, use " << ScrollBar::getClassTypeName() << " ["
1408 << LayoutManager::getInstance().getCurrentLayout() << "]");
1409 }
1410 else if (_factoryName == "VScroll")
1411 {
1412 MYGUI_LOG(
1413 Warning,
1414 "VScroll factory is deprecated, use " << ScrollBar::getClassTypeName() << " ["
1415 << LayoutManager::getInstance().getCurrentLayout() << "]");
1416 }
1417 else if (_factoryName == "RenderBox")
1418 {
1419 MYGUI_LOG(
1420 Warning,
1421 "RenderBox factory is deprecated, use " << Canvas::getClassTypeName() << " ["
1422 << LayoutManager::getInstance().getCurrentLayout() << "]");
1423 }
1424 else if (_factoryName == "Sheet")
1425 {
1426 MYGUI_LOG(
1427 Warning,
1428 "Sheet factory is deprecated, use " << TabItem::getClassTypeName() << " ["
1429 << LayoutManager::getInstance().getCurrentLayout() << "]");
1430 }
1431 else if (_factoryName == "StaticImage")
1432 {
1433 MYGUI_LOG(
1434 Warning,
1435 "StaticImage factory is deprecated, use "
1436 << ImageBox::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout()
1437 << "]");
1438 }
1439 else if (_factoryName == "StaticText")
1440 {
1441 MYGUI_LOG(
1442 Warning,
1443 "StaticText factory is deprecated, use " << TextBox::getClassTypeName() << " ["
1444 << LayoutManager::getInstance().getCurrentLayout() << "]");
1445 }
1446 else if (_factoryName == "Progress")
1447 {
1448 MYGUI_LOG(
1449 Warning,
1450 "Progress factory is deprecated, use " << ProgressBar::getClassTypeName() << " ["
1451 << LayoutManager::getInstance().getCurrentLayout() << "]");
1452 }
1453 else if (_factoryName == "List")
1454 {
1455 MYGUI_LOG(
1456 Warning,
1457 "List factory is deprecated, use " << ListBox::getClassTypeName() << " ["
1458 << LayoutManager::getInstance().getCurrentLayout() << "]");
1459 }
1460 else if (_factoryName == "Edit")
1461 {
1462 MYGUI_LOG(
1463 Warning,
1464 "Edit factory is deprecated, use " << EditBox::getClassTypeName() << " ["
1465 << LayoutManager::getInstance().getCurrentLayout() << "]");
1466 }
1467 else if (_factoryName == "Tab")
1468 {
1469 MYGUI_LOG(
1470 Warning,
1471 "Tab factory is deprecated, use " << TabControl::getClassTypeName() << " ["
1472 << LayoutManager::getInstance().getCurrentLayout() << "]");
1473 }
1474 else if (_factoryName == "MultiList")
1475 {
1476 MYGUI_LOG(
1477 Warning,
1478 "MultiList factory is deprecated, use " << MultiListBox::getClassTypeName() << " ["
1479 << LayoutManager::getInstance().getCurrentLayout() << "]");
1480 }
1481 else if (_factoryName == "MenuCtrl")
1482 {
1483 MYGUI_LOG(
1484 Warning,
1485 "MenuCtrl factory is deprecated, use " << MenuControl::getClassTypeName() << " ["
1486 << LayoutManager::getInstance().getCurrentLayout() << "]");
1487 }
1488 }
1489#endif // MYGUI_DONT_USE_OBSOLETE
1490 return _factoryName;
1491 }
1492
1493 std::string_view BackwardCompatibility::getSkinRename(std::string_view _skinName)
1494 {
1495#ifndef MYGUI_DONT_USE_OBSOLETE
1496 MapString::iterator item = mSkinRename.find(_skinName);
1497 if (item != mSkinRename.end())
1498 {
1499 MYGUI_LOG(
1500 Warning,
1501 (*item).first << " skin is deprecated, use " << (*item).second << " ["
1502 << LayoutManager::getInstance().getCurrentLayout() << "]");
1503 return (*item).second;
1504 }
1505#endif // MYGUI_DONT_USE_OBSOLETE
1506 return _skinName;
1507 }
1508
1509 void BackwardCompatibility::shutdown()
1510 {
1511#ifndef MYGUI_DONT_USE_OBSOLETE
1512 mPropertyRename.clear();
1513#endif // MYGUI_DONT_USE_OBSOLETE
1514 }
1515
1516 void BackwardCompatibility::registerWidgetTypes()
1517 {
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");
1533#endif // MYGUI_DONT_USE_OBSOLETE
1534 }
1535
1536} // namespace MyGUI
#define MYGUI_LOG(level, text)
#define MYGUI_SUPPRESS_MSVC(disabledWarning)
#define MYGUI_UNSUPPRESS_MSVC()
#define MYGUI_SUPPRESS_GCC(disabledWarning)
#define MYGUI_UNSUPPRESS_GCC()
T parseValue(std::string_view value)
std::set< std::string, std::less<> > SetString
types::TRect< int > IntRect
Definition MyGUI_Types.h:32
static MapString mPropertyRename
types::TPoint< int > IntPoint
Definition MyGUI_Types.h:26
Enumerator< std::vector< ILayerNode * > > EnumeratorILayerNode
static std::string_view convertAlignToDirection(std::string_view _value)
std::map< std::string, std::string, std::less<> > MapString
Definition MyGUI_Types.h:39
Enumerator< VectorWidgetPtr > EnumeratorWidgetPtr
std::vector< PairString > VectorStringPairs
Definition MyGUI_Types.h:42
static std::string convertRectToCoord(std::string_view _value)
IResource * IResourcePtr
static SetString mPropertyIgnore
unsigned int Char
Definition MyGUI_Types.h:49
constexpr size_t ITEM_NONE
types::TCoord< int > IntCoord
Definition MyGUI_Types.h:35
types::TSize< int > IntSize
Definition MyGUI_Types.h:29
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
Definition MyGUI_TSize.h:95