MyGUI  3.2.2
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"
26 #include "MyGUI_ResourceManager.h"
27 #include "MyGUI_Gui.h"
28 #include "MyGUI_PointerManager.h"
29 #include "MyGUI_InputManager.h"
30 #include "MyGUI_RenderManager.h"
31 #include "MyGUI_LanguageManager.h"
32 #include "MyGUI_LayoutManager.h"
33 #include "MyGUI_PluginManager.h"
34 #include "MyGUI_SkinManager.h"
35 #include "MyGUI_WidgetManager.h"
36 #include "MyGUI_FactoryManager.h"
38 
39 namespace MyGUI
40 {
41 
42 #ifndef MYGUI_DONT_USE_OBSOLETE
43 
45  {
46  static_cast<Button*>(this)->setStateSelected(_value);
47  }
49  {
50  return static_cast<Button*>(this)->getStateSelected();
51  }
53  {
54  static_cast<Button*>(this)->setStateSelected(_value);
55  }
57  {
58  return static_cast<Button*>(this)->getStateSelected();
59  }
61  {
62  return static_cast<Button*>(this)->_getImageBox();
63  }
65  {
66  if (static_cast<Button*>(this)->_getImageBox())
67  static_cast<Button*>(this)->_getImageBox()->setImageIndex(_index);
68  }
70  {
71  if (static_cast<Button*>(this)->_getImageBox())
72  return static_cast<Button*>(this)->_getImageBox()->getImageIndex();
73  return ITEM_NONE;
74  }
75 
76  void MemberObsolete<ImageBox>::addItemFrameDublicate(size_t _index, size_t _indexSourceFrame)
77  {
78  static_cast<ImageBox*>(this)->addItemFrameDuplicate(_index, _indexSourceFrame);
79  }
80  void MemberObsolete<ImageBox>::insertItemFrameDublicate(size_t _index, size_t _indexFrame, size_t _indexSourceFrame)
81  {
82  static_cast<ImageBox*>(this)->insertItemFrameDuplicate(_index, _indexFrame, _indexSourceFrame);
83  }
84 
85 
87  {
88  return static_cast<ComboBox*>(this)->getIndexSelected();
89  }
91  {
92  static_cast<ComboBox*>(this)->setIndexSelected(_index);
93  }
95  {
96  static_cast<ComboBox*>(this)->clearIndexSelected();
97  }
98 
99  void MemberObsolete<ComboBox>::insertItem(size_t _index, const UString& _name)
100  {
101  static_cast<ComboBox*>(this)->insertItemAt(_index, _name);
102  }
103  void MemberObsolete<ComboBox>::setItem(size_t _index, const UString& _item)
104  {
105  static_cast<ComboBox*>(this)->setItemNameAt(_index, _item);
106  }
108  {
109  return static_cast<ComboBox*>(this)->getItemNameAt(_index);
110  }
112  {
113  static_cast<ComboBox*>(this)->removeItemAt(_index);
114  }
116  {
117  static_cast<ComboBox*>(this)->removeAllItems();
118  }
120  {
121  return static_cast<ComboBox*>(this)->getIndexSelected();
122  }
124  {
125  static_cast<ComboBox*>(this)->clearIndexSelected();
126  }
128  {
129  static_cast<ComboBox*>(this)->setIndexSelected(_index);
130  }
131 
133  {
134  static_cast<ComboBox*>(this)->setMaxListLength(_value);
135  }
137  {
138  return static_cast<ComboBox*>(this)->getMaxListLength();
139  }
140 
141 
143  {
144  static_cast<EditBox*>(this)->setVisibleVScroll(_visible);
145  }
147  {
148  return static_cast<EditBox*>(this)->isVisibleVScroll();
149  }
151  {
152  static_cast<EditBox*>(this)->setVisibleHScroll(_visible);
153  }
155  {
156  return static_cast<EditBox*>(this)->isVisibleHScroll();
157  }
158 
159  void MemberObsolete<EditBox>::setTextColour(size_t _start, size_t _count, const Colour& _colour)
160  {
161  static_cast<EditBox*>(this)->setTextIntervalColour(_start, _count, _colour);
162  }
163  void MemberObsolete<EditBox>::getTextSelect(size_t& _start, size_t& _end)
164  {
165  _start = static_cast<EditBox*>(this)->getTextSelectionStart();
166  _end = static_cast<EditBox*>(this)->getTextSelectionEnd();
167  }
168  UString MemberObsolete<EditBox>::getText(size_t _start, size_t _count)
169  {
170  return static_cast<EditBox*>(this)->getTextInterval(_start, _count);
171  }
172  void MemberObsolete<EditBox>::setTextSelect(size_t _start, size_t _end)
173  {
174  static_cast<EditBox*>(this)->setTextSelection(_start, _end);
175  }
177  {
178  static_cast<EditBox*>(this)->deleteTextSelection();
179  }
181  {
182  return static_cast<EditBox*>(this)->getTextSelection();
183  }
185  {
186  return static_cast<EditBox*>(this)->isTextSelection();
187  }
189  {
190  static_cast<EditBox*>(this)->setTextSelectionColour(_colour);
191  }
192 
193 
195  {
196  return static_cast<ItemBox*>(this)->getIndexSelected();
197  }
199  {
200  static_cast<ItemBox*>(this)->setIndexSelected(_index);
201  }
203  {
204  static_cast<ItemBox*>(this)->clearIndexSelected();
205  }
206 
207  void MemberObsolete<ItemBox>::insertItem(size_t _index, Any _data)
208  {
209  static_cast<ItemBox*>(this)->insertItemAt(_index, _data);
210  }
211  void MemberObsolete<ItemBox>::setItemData(size_t _index, Any _data)
212  {
213  static_cast<ItemBox*>(this)->setItemDataAt(_index, _data);
214  }
216  {
217  static_cast<ItemBox*>(this)->removeItemAt(_index);
218  }
220  {
221  static_cast<ItemBox*>(this)->removeAllItems();
222  }
224  {
225  return static_cast<ItemBox*>(this)->getIndexSelected();
226  }
228  {
229  static_cast<ItemBox*>(this)->clearIndexSelected();
230  }
232  {
233  static_cast<ItemBox*>(this)->setIndexSelected(_index);
234  }
235 
237  {
238  return static_cast<ItemBox*>(this)->getWidgetDrag();
239  }
241  {
242  static_cast<ItemBox*>(this)->resetDrag();
243  }
244 
246  {
247  static_cast<ItemBox*>(this)->setVerticalAlignment(_value);
248  }
250  {
251  return static_cast<ItemBox*>(this)->getVerticalAlignment();
252  }
253 
254 
256  {
257  return static_cast<ListBox*>(this)->getIndexSelected();
258  }
260  {
261  static_cast<ListBox*>(this)->setIndexSelected(_index);
262  }
264  {
265  static_cast<ListBox*>(this)->clearIndexSelected();
266  }
267 
268  void MemberObsolete<ListBox>::insertItem(size_t _index, const UString& _item)
269  {
270  static_cast<ListBox*>(this)->insertItemAt(_index, _item);
271  }
272  void MemberObsolete<ListBox>::setItem(size_t _index, const UString& _item)
273  {
274  static_cast<ListBox*>(this)->setItemNameAt(_index, _item);
275  }
277  {
278  return static_cast<ListBox*>(this)->getItemNameAt(_index);
279  }
281  {
282  static_cast<ListBox*>(this)->removeItemAt(_index);
283  }
285  {
286  static_cast<ListBox*>(this)->removeAllItems();
287  }
289  {
290  return static_cast<ListBox*>(this)->findItemIndexWith(_item);
291  }
293  {
294  return static_cast<ListBox*>(this)->getIndexSelected();
295  }
297  {
298  static_cast<ListBox*>(this)->clearIndexSelected();
299  }
301  {
302  static_cast<ListBox*>(this)->setIndexSelected(_index);
303  }
305  {
306  static_cast<ListBox*>(this)->beginToItemAt(_index);
307  }
309  {
310  static_cast<ListBox*>(this)->beginToItemFirst();
311  }
313  {
314  static_cast<ListBox*>(this)->beginToItemLast();
315  }
317  {
318  static_cast<ListBox*>(this)->beginToItemSelected();
319  }
320  bool MemberObsolete<ListBox>::isItemVisible(size_t _index, bool _fill)
321  {
322  return static_cast<ListBox*>(this)->isItemVisibleAt(_index, _fill);
323  }
325  {
326  return static_cast<ListBox*>(this)->isItemSelectedVisible(_fill);
327  }
328 
329 
331  {
332  static_cast<MenuControl*>(this)->setVisible(true);
333  }
335  {
336  static_cast<MenuControl*>(this)->setVisible(false);
337  }
339  {
340  return static_cast<MenuControl*>(this)->getVisible();
341  }
342 
344  {
345  static_cast<MenuControl*>(this)->setItemChildVisibleAt(_index, true);
346  }
348  {
349  static_cast<MenuControl*>(this)->setItemChildVisible(_item, true);
350  }
352  {
353  static_cast<MenuControl*>(this)->setItemChildVisibleAt(_index, false);
354  }
356  {
357  static_cast<MenuControl*>(this)->setItemChildVisible(_item, false);
358  }
359 
361  {
362  static_cast<MenuControl*>(this)->setVerticalAlignment(_value);
363  }
365  {
366  return static_cast<MenuControl*>(this)->getVerticalAlignment();
367  }
368 
370  {
371  static_cast<MenuItem*>(this)->setItemChildVisible(true);
372  }
374  {
375  static_cast<MenuItem*>(this)->setItemChildVisible(false);
376  }
377 
378 
380  {
381  return static_cast<MultiListBox*>(this)->getIndexSelected();
382  }
384  {
385  static_cast<MultiListBox*>(this)->setIndexSelected(_index);
386  }
388  {
389  static_cast<MultiListBox*>(this)->clearIndexSelected();
390  }
391 
392  size_t MemberObsolete<MultiListBox>::findItem(size_t _column, const UString& _name)
393  {
394  return static_cast<MultiListBox*>(this)->findSubItemWith(_column, _name);
395  }
396  const UString& MemberObsolete<MultiListBox>::getSubItem(size_t _column, size_t _index)
397  {
398  return static_cast<MultiListBox*>(this)->getSubItemNameAt(_column, _index);
399  }
400  void MemberObsolete<MultiListBox>::setSubItem(size_t _column, size_t _index, const UString& _name)
401  {
402  static_cast<MultiListBox*>(this)->setSubItemNameAt(_column, _index, _name);
403  }
405  {
406  static_cast<MultiListBox*>(this)->removeColumnAt(_column);
407  }
409  {
410  static_cast<MultiListBox*>(this)->removeAllColumns();
411  }
413  {
414  return static_cast<MultiListBox*>(this)->getColumnWidthAt(_column);
415  }
417  {
418  return static_cast<MultiListBox*>(this)->getColumnNameAt(_column);
419  }
420  void MemberObsolete<MultiListBox>::setColumnWidth(size_t _column, int _width)
421  {
422  static_cast<MultiListBox*>(this)->setColumnWidthAt(_column, _width);
423  }
424  void MemberObsolete<MultiListBox>::addColumn(int _width, const UString& _name)
425  {
426  static_cast<MultiListBox*>(this)->addColumn(_name, _width);
427  }
428  void MemberObsolete<MultiListBox>::setColumnName(size_t _column, const UString& _name)
429  {
430  static_cast<MultiListBox*>(this)->setColumnNameAt(_column, _name);
431  }
432  void MemberObsolete<MultiListBox>::insertColumn(size_t _column, int _width, const UString& _name)
433  {
434  static_cast<MultiListBox*>(this)->insertColumnAt(_column, _name, _width);
435  }
437  {
438  return static_cast<MultiListBox*>(this)->getIndexSelected();
439  }
441  {
442  static_cast<MultiListBox*>(this)->clearIndexSelected();
443  }
445  {
446  static_cast<MultiListBox*>(this)->setIndexSelected(_index);
447  }
448  void MemberObsolete<MultiListBox>::insertItem(size_t _index, const UString& _name)
449  {
450  static_cast<MultiListBox*>(this)->insertItemAt(_index, _name);
451  }
452  void MemberObsolete<MultiListBox>::setItem(size_t _index, const UString& _name)
453  {
454  static_cast<MultiListBox*>(this)->setItemNameAt(_index, _name);
455  }
457  {
458  return static_cast<MultiListBox*>(this)->getItemNameAt(_index);
459  }
461  {
462  static_cast<MultiListBox*>(this)->removeItemAt(_index);
463  }
465  {
466  static_cast<MultiListBox*>(this)->removeAllItems();
467  }
468 
469 
471  {
472  if (_value == Align::Right)
473  static_cast<ProgressBar*>(this)->setFlowDirection(FlowDirection::RightToLeft);
474  else if (_value == Align::Top)
475  static_cast<ProgressBar*>(this)->setFlowDirection(FlowDirection::TopToBottom);
476  else if (_value == Align::Bottom)
477  static_cast<ProgressBar*>(this)->setFlowDirection(FlowDirection::BottomToTop);
478  else
479  static_cast<ProgressBar*>(this)->setFlowDirection(FlowDirection::LeftToRight);
480  }
481 
483  {
484  if (static_cast<ProgressBar*>(this)->getFlowDirection() == FlowDirection::RightToLeft)
485  return Align::Right;
486  else if (static_cast<ProgressBar*>(this)->getFlowDirection() == FlowDirection::TopToBottom)
487  return Align::Top;
488  else if (static_cast<ProgressBar*>(this)->getFlowDirection() == FlowDirection::BottomToTop)
489  return Align::Bottom;
490 
491  return Align::Left;
492  }
493 
494 
496  {
497  static_cast<ScrollView*>(this)->setVisibleVScroll(_visible);
498  }
500  {
501  return static_cast<ScrollView*>(this)->isVisibleVScroll();
502  }
504  {
505  static_cast<ScrollView*>(this)->setVisibleHScroll(_visible);
506  }
508  {
509  return static_cast<ScrollView*>(this)->isVisibleHScroll();
510  }
511 
512 
514  {
515  return static_cast<TabControl*>(this)->getButtonWidthAt(_index);
516  }
518  {
519  return static_cast<TabControl*>(this)->getButtonWidth(_sheet);
520  }
522  {
523  static_cast<TabControl*>(this)->setButtonWidthAt(_index, _width);
524  }
526  {
527  static_cast<TabControl*>(this)->setButtonWidth(_sheet, _width);
528  }
530  {
531  static_cast<TabControl*>(this)->beginToItemAt(_index);
532  }
534  {
535  static_cast<TabControl*>(this)->beginToItemSelected();
536  }
538  {
539  return static_cast<TabControl*>(this)->getItemCount();
540  }
542  {
543  return static_cast<TabControl*>(this)->getItemName(_sheet);
544  }
546  {
547  return static_cast<TabControl*>(this)->getItemNameAt(_index);
548  }
550  {
551  return static_cast<TabControl*>(this)->getItemAt(_index);
552  }
553  void MemberObsolete<TabControl>::setSheetNameIndex(size_t _index, const UString& _name, int _width)
554  {
555  static_cast<TabControl*>(this)->setItemNameAt(_index, _name);
556  }
557  void MemberObsolete<TabControl>::setSheetName(TabItem* _sheet, const UString& _name, int _width)
558  {
559  static_cast<TabControl*>(this)->setItemName(_sheet, _name);
560  }
562  {
563  return static_cast<TabControl*>(this)->addItem(_name, _width);
564  }
565  TabItem* MemberObsolete<TabControl>::insertSheet(size_t _index, const UString& _name, int _width)
566  {
567  return static_cast<TabControl*>(this)->insertItemAt(_index, _name);
568  }
570  {
571  static_cast<TabControl*>(this)->removeItemAt(_index);
572  }
574  {
575  static_cast<TabControl*>(this)->removeItem(_sheet);
576  }
577  void MemberObsolete<TabControl>::selectSheetIndex(size_t _index, bool _smooth)
578  {
579  static_cast<TabControl*>(this)->setIndexSelected(_index);
580  }
582  {
583  static_cast<TabControl*>(this)->setItemSelected(_sheet);
584  }
586  {
587  return static_cast<TabControl*>(this)->getIndexSelected();
588  }
589 
591  {
592  return static_cast<TabControl*>(this)->getIndexSelected();
593  }
595  {
596  static_cast<TabControl*>(this)->setIndexSelected(_index);
597  }
598 
599 
601  {
602  return static_cast<Widget*>(this)->getEnabled();
603  }
605  {
606  return static_cast<Widget*>(this)->getInheritsAlpha();
607  }
609  {
610  return static_cast<Widget*>(this)->getNeedKeyFocus();
611  }
613  {
614  return static_cast<Widget*>(this)->getNeedMouseFocus();
615  }
617  {
618  return static_cast<Widget*>(this)->getInheritsPick();
619  }
621  {
622  return static_cast<Widget*>(this)->getVisible();
623  }
624 
625 
627  {
628  static_cast<Window*>(this)->setVisibleSmooth(true);
629  }
631  {
632  static_cast<Window*>(this)->setVisibleSmooth(false);
633  }
635  {
636  static_cast<Window*>(this)->setMinSize(_minmax.left, _minmax.top);
637  static_cast<Window*>(this)->setMaxSize(_minmax.right, _minmax.bottom);
638  }
639  void MemberObsolete<Window>::setMinMax(int _min_w, int _min_h, int _max_w, int _max_h)
640  {
641  static_cast<Window*>(this)->setMinSize(_min_w, _min_h);
642  static_cast<Window*>(this)->setMaxSize(_max_w, _max_h);
643  }
645  {
646  return IntRect(static_cast<Window*>(this)->getMinSize().width, static_cast<Window*>(this)->getMinSize().height, static_cast<Window*>(this)->getMaxSize().width, static_cast<Window*>(this)->getMaxSize().height);
647  }
648 
649  bool MemberObsolete<FontManager>::load(const std::string& _file)
650  {
651  return ResourceManager::getInstance().load(_file);
652  }
653 
654  void MemberObsolete<FontManager>::loadOldFontFormat(xml::ElementPtr _node2, const std::string& _file, Version _version, const std::string& _tag)
655  {
657  while (_node.next())
658  {
659  if (_node->getName() == _tag)
660  {
661  std::string name;
662  if (!_node->findAttribute("name", name))
663  return;
664 
665  std::string type;
666  if (type.empty())
667  {
668  if (_node->findAttribute("resolution").empty())
669  type = "ResourceManualFont";
670  else
671  type = "ResourceTrueTypeFont";
672  }
673 
674  xml::Document doc;
675  xml::ElementPtr root = doc.createRoot("MyGUI");
676  xml::ElementPtr node = root->createChild("Resource");
677  node->addAttribute("type", type);
678  node->addAttribute("name", name);
679 
680  std::string tmp;
681  if (_node->findAttribute("source", tmp))
682  {
683  xml::ElementPtr prop = node->createChild("Property");
684  prop->addAttribute("key", "Source");
685  prop->addAttribute("value", tmp);
686  }
687 
688  if (_node->findAttribute("size", tmp))
689  {
690  xml::ElementPtr prop = node->createChild("Property");
691  prop->addAttribute("key", "Size");
692  prop->addAttribute("value", tmp);
693  }
694 
695  if (_node->findAttribute("resolution", tmp))
696  {
697  xml::ElementPtr prop = node->createChild("Property");
698  prop->addAttribute("key", "Resolution");
699  prop->addAttribute("value", tmp);
700  }
701 
702  if (_node->findAttribute("antialias_colour", tmp))
703  {
704  xml::ElementPtr prop = node->createChild("Property");
705  prop->addAttribute("key", "Antialias");
706  prop->addAttribute("value", tmp);
707  }
708 
709  if (_node->findAttribute("space_width", tmp))
710  {
711  xml::ElementPtr prop = node->createChild("Property");
712  prop->addAttribute("key", "SpaceWidth");
713  prop->addAttribute("value", tmp);
714  }
715 
716  if (_node->findAttribute("tab_width", tmp))
717  {
718  xml::ElementPtr prop = node->createChild("Property");
719  prop->addAttribute("key", "TabWidth");
720  prop->addAttribute("value", tmp);
721  }
722 
723  if (_node->findAttribute("cursor_width", tmp))
724  {
725  xml::ElementPtr prop = node->createChild("Property");
726  prop->addAttribute("key", "CursorWidth");
727  prop->addAttribute("value", tmp);
728  }
729 
730  if (_node->findAttribute("distance", tmp))
731  {
732  xml::ElementPtr prop = node->createChild("Property");
733  prop->addAttribute("key", "Distance");
734  prop->addAttribute("value", tmp);
735  }
736 
737  if (_node->findAttribute("offset_height", tmp))
738  {
739  xml::ElementPtr prop = node->createChild("Property");
740  prop->addAttribute("key", "OffsetHeight");
741  prop->addAttribute("value", tmp);
742  }
743 
744  if (_node->findAttribute("default_height", tmp))
745  {
746  xml::ElementPtr prop = node->createChild("Property");
747  prop->addAttribute("key", "DefaultHeight");
748  prop->addAttribute("value", tmp);
749  }
750 
751  xml::ElementPtr codes = node->createChild("Codes");
752 
753  xml::ElementEnumerator codeold = _node->getElementEnumerator();
754  while (codeold.next("Code"))
755  {
756  xml::ElementPtr codenew = codes->createChild("Code");
757 
758  if (codeold->findAttribute("range", tmp))
759  codenew->addAttribute("range", tmp);
760 
761  if (codeold->findAttribute("hide", tmp))
762  codenew->addAttribute("hide", tmp);
763 
764  if (codeold->findAttribute("index", tmp))
765  codenew->addAttribute("index", tmp);
766 
767  if (codeold->findAttribute("coord", tmp))
768  codenew->addAttribute("coord", tmp);
769  }
770 
771  ResourceManager::getInstance().loadFromXmlNode(root, _file, _version);
772  }
773  }
774  }
775 
777  {
778  static_cast<Gui*>(this)->destroyWidgets(_widgets);
779  }
780 
781  bool MemberObsolete<Gui>::injectMouseMove( int _absx, int _absy, int _absz)
782  {
783  return InputManager::getInstance().injectMouseMove(_absx, _absy, _absz);
784  }
785  bool MemberObsolete<Gui>::injectMousePress( int _absx, int _absy, MouseButton _id )
786  {
787  return InputManager::getInstance().injectMousePress(_absx, _absy, _id);
788  }
789  bool MemberObsolete<Gui>::injectMouseRelease( int _absx, int _absy, MouseButton _id )
790  {
791  return InputManager::getInstance().injectMouseRelease(_absx, _absy, _id);
792  }
794  {
795  return InputManager::getInstance().injectKeyPress(_key, _text);
796  }
798  {
800  }
801 
803  {
805  }
807  {
809  }
811  {
813  }
814 
815  bool MemberObsolete<Gui>::load(const std::string& _file)
816  {
817  return ResourceManager::getInstance().load(_file);
818  }
819 
821  {
823  }
825  {
827  }
829  {
831  }
832 
834  {
836  }
838  {
840  }
841 
843  {
844  Gui::getInstance().frameEvent(_time);
845  }
846 
848  {
850  }
851 
853  {
855  }
856 
858  {
860  }
861 
862  bool MemberObsolete<LanguageManager>::load(const std::string& _file)
863  {
864  return ResourceManager::getInstance().load(_file);
865  }
866 
867  bool MemberObsolete<LayerManager>::load(const std::string& _file)
868  {
869  return ResourceManager::getInstance().load(_file);
870  }
871 
873  {
874  return static_cast<LayoutManager*>(this)->loadLayout(_file);
875  }
876 
877  bool MemberObsolete<PluginManager>::load(const std::string& _file)
878  {
879  return ResourceManager::getInstance().load(_file);
880  }
881 
883  {
884  static_cast<PointerManager*>(this)->setDefaultPointer(_value);
885  }
887  {
888  static_cast<PointerManager*>(this)->setVisible(true);
889  }
891  {
892  static_cast<PointerManager*>(this)->setVisible(false);
893  }
895  {
896  return static_cast<PointerManager*>(this)->isVisible();
897  }
898  bool MemberObsolete<PointerManager>::load(const std::string& _file)
899  {
900  return ResourceManager::getInstance().load(_file);
901  }
902  void MemberObsolete<PointerManager>::loadOldPointerFormat(xml::ElementPtr _node, const std::string& _file, Version _version, const std::string& _tag)
903  {
904  std::string pointer;
905  std::string layer;
906 
908  while (node.next())
909  {
910  if (node->getName() == _tag)
911  {
912  layer = node->findAttribute("layer");
913  pointer = node->findAttribute("default");
914 
915  // ñîõðàíÿåì
916  std::string shared_text = node->findAttribute("texture");
917 
918  // áåðåì äåòåé è êðóòèìñÿ, îñíîâíîé öèêë
920  while (info.next("Info"))
921  {
922  std::string name = info->findAttribute("name");
923  if (name.empty())
924  continue;
925 
926  std::string texture = info->findAttribute("texture");
927 
928  std::string type = (shared_text.empty() && texture.empty()) ? "ResourceImageSetPointer" : "ResourceManualPointer";
929 
930  xml::Document doc;
931  xml::ElementPtr root = doc.createRoot("MyGUI");
932  xml::ElementPtr newnode = root->createChild("Resource");
933  newnode->addAttribute("type", type);
934  newnode->addAttribute("name", name);
935 
936  std::string tmp;
937  if (info->findAttribute("point", tmp))
938  {
939  xml::ElementPtr prop = newnode->createChild("Property");
940  prop->addAttribute("key", "Point");
941  prop->addAttribute("value", tmp);
942  }
943 
944  if (info->findAttribute("size", tmp))
945  {
946  xml::ElementPtr prop = newnode->createChild("Property");
947  prop->addAttribute("key", "Size");
948  prop->addAttribute("value", tmp);
949  }
950 
951  if (info->findAttribute("resource", tmp))
952  {
953  xml::ElementPtr prop = newnode->createChild("Property");
954  prop->addAttribute("key", "Resource");
955  prop->addAttribute("value", tmp);
956  }
957 
958  if (info->findAttribute("offset", tmp))
959  {
960  xml::ElementPtr prop = newnode->createChild("Property");
961  prop->addAttribute("key", "Coord");
962  prop->addAttribute("value", tmp);
963  }
964 
965  if (!shared_text.empty() || !texture.empty())
966  {
967  xml::ElementPtr prop = newnode->createChild("Property");
968  prop->addAttribute("key", "Texture");
969  prop->addAttribute("value", shared_text.empty() ? texture : shared_text);
970  }
971 
972  ResourceManager::getInstance().loadFromXmlNode(root, _file, _version);
973  }
974  }
975  }
976 
977  if (!layer.empty())
978  static_cast<PointerManager*>(this)->setLayerName(layer);
979 
980  if (!pointer.empty())
981  static_cast<PointerManager*>(this)->setDefaultPointer(pointer);
982  }
983 
985  {
986  return static_cast<ResourceManager*>(this)->getCount();
987  }
988  IResourcePtr MemberObsolete<ResourceManager>::getResource(const std::string& _name, bool _throw)
989  {
990  return static_cast<ResourceManager*>(this)->getByName(_name, _throw);
991  }
992 
994  {
995  return static_cast<SkinManager*>(this)->getByName(_name);
996  }
997  bool MemberObsolete<SkinManager>::load(const std::string& _file)
998  {
999  return ResourceManager::getInstance().load(_file);
1000  }
1001  void MemberObsolete<SkinManager>::loadOldSkinFormat(xml::ElementPtr _node, const std::string& _file, Version _version, const std::string& _tag)
1002  {
1003  std::string resourceCategory = ResourceManager::getInstance().getCategoryName();
1004 
1005  // áåðåì äåòåé è êðóòèìñÿ, îñíîâíîé öèêë ñî ñêèíàìè xml::ElementEnumerator skin = _node->getElementEnumerator(); while (skin.next(_tag)) { std::string type = skin->findAttribute("type"); if (type.empty()) type = "ResourceSkin"; IObject* object = FactoryManager::getInstance().createObject(resourceCategory, type); if (object != nullptr) { ResourceSkin* data = object->castType<ResourceSkin>(); data->deserialization(skin.current(), _version); ResourceManager::getInstance().addResource(data); } } } void MemberObsolete<WidgetManager>::destroyWidgetsVector(VectorWidgetPtr& _widgets) { static_cast<WidgetManager*>(this)->destroyWidgets(_widgets); } Widget* MemberObsolete<WidgetManager>::findWidgetT(const std::string& _name, bool _throw) { return Gui::getInstance().findWidgetT(_name, _throw); } Widget* MemberObsolete<WidgetManager>::findWidgetT(const std::string& _name, const std::string& _prefix, bool _throw) { return Gui::getInstance().findWidgetT(_name, _prefix, _throw); } void MemberObsolete<WidgetManager>::parse(Widget* _widget, const std::string& _key, const std::string& _value) { _widget->setProperty(_key, _value); } #endif // MYGUI_DONT_USE_OBSOLETE #ifndef MYGUI_DONT_USE_OBSOLETE static std::string convertAlignToDirection(const std::string& _value) { Align align = utility::parseValue<Align>(_value); if (align == Align::Right) return FlowDirection(FlowDirection::RightToLeft).print(); else if (align == Align::Top) return FlowDirection(FlowDirection::TopToBottom).print(); else if (align == Align::Bottom) return FlowDirection(FlowDirection::BottomToTop).print(); return FlowDirection(FlowDirection::LeftToRight).print(); } static std::string convertRectToCoord(const std::string& _value) { IntRect rect = IntRect::parse(_value); IntCoord coord(rect.left, rect.top, rect.width(), rect.height()); return coord.print(); } typedef std::set<std::string> SetString; static MapString mPropertyRename; static SetString mPropertyIgnore; static MapString mSkinRename; #endif // MYGUI_DONT_USE_OBSOLETE bool BackwardCompatibility::isIgnoreProperty(const std::string& _key) { #ifndef MYGUI_DONT_USE_OBSOLETE if (mPropertyIgnore.find(_key) != mPropertyIgnore.end()) return true; #endif // MYGUI_DONT_USE_OBSOLETE return false; } bool BackwardCompatibility::checkProperty(Widget* _owner, std::string& _key, std::string& _value) { #ifndef MYGUI_DONT_USE_OBSOLETE if (mPropertyIgnore.find(_key) != mPropertyIgnore.end()) return false; MapString::iterator item = mPropertyRename.find(_key); if (item != mPropertyRename.end()) { MYGUI_LOG(Warning, (*item).first << " is deprecated, use " << (*item).second << " [" << LayoutManager::getInstance().getCurrentLayout() << "]"); _key = (*item).second; } else if (_key == "Progress_StartPoint") { MYGUI_LOG(Warning, "Progress_StartPoint is deprecated, use Progress_FlowDirection" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]"); _key = "Progress_FlowDirection"; _value = convertAlignToDirection(_value); } else if (_key == "ComboBox_AddItem") { MYGUI_LOG(Warning, "ComboBox_AddItem is deprecated" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]"); ComboBox* widget = _owner->castType<ComboBox>(false); if (widget != nullptr) widget->addItem(_value); return false; } else if (_key == "List_AddItem") { MYGUI_LOG(Warning, "List_AddItem is deprecated" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]"); ListBox* widget = _owner->castType<ListBox>(false); if (widget != nullptr) widget->addItem(_value); return false; } else if (_key == "Tab_AddSheet") { MYGUI_LOG(Warning, "Tab_AddSheet is deprecated" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]"); TabControl* widget = _owner->castType<TabControl>(false); if (widget != nullptr) widget->addItem(_value); return false; } else if (_key == "Tab_AddItem") { MYGUI_LOG(Warning, "Tab_AddItem is deprecated" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]"); TabControl* widget = _owner->castType<TabControl>(false); if (widget != nullptr) widget->addItem(_value); return false; } else if (_key == "Window_MinMax") { MYGUI_LOG(Warning, "Window_MinMax is deprecated, use Window_MinSize or Window_MaxSize" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]"); Window* widget = _owner->castType<Window>(false); if (widget != nullptr) { IntRect rect = IntRect::parse(_value); widget->setMinSize(rect.left, rect.top); widget->setMaxSize(rect.right, rect.bottom); } return false; } else if (_key == "ImageRect") { MYGUI_LOG(Warning, "ImageRect is deprecated, use ImageCoord" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]"); _key = "ImageCoord"; _value = convertRectToCoord(_value); } else if (_key == "StartPoint") { MYGUI_LOG(Warning, "StartPoint is deprecated, use FlowDirection" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]"); _key = "FlowDirection"; _value = convertAlignToDirection(_value); } #endif // MYGUI_DONT_USE_OBSOLETE return true; } void BackwardCompatibility::initialise() { #ifndef MYGUI_DONT_USE_OBSOLETE mPropertyRename["Widget_Caption"] = "Caption"; mPropertyRename["Button_Pressed"] = "StateSelected"; mPropertyRename["ButtonPressed"] = "StateSelected"; mPropertyRename["StateCheck"] = "StateSelected"; mPropertyRename["Edit_ShowVScroll"] = "VisibleVScroll"; mPropertyRename["Edit_ShowHScroll"] = "VisibleHScroll"; mPropertyRename["ScrollView_VScroll"] = "VisibleVScroll"; mPropertyRename["ScrollView_HScroll"] = "VisibleHScroll"; mPropertyRename["Progress_Position"] = "RangePosition"; mPropertyRename["Scroll_Position"] = "RangePosition"; mPropertyRename["Tab_SelectSheet"] = "SelectItem"; mPropertyRename["Image_Texture"] = "ImageTexture"; mPropertyRename["Image_Coord"] = "ImageRegion"; mPropertyRename["Image_Tile"] = "ImageTile"; mPropertyRename["Image_Index"] = "ImageIndex"; mPropertyRename["Image_Resource"] = "ImageResource"; mPropertyRename["Image_Group"] = "ImageGroup"; mPropertyRename["Image_Name"] = "ImageName"; mPropertyRename["MenuItem_Id"] = "MenuItemId"; mPropertyRename["MenuItem_Type"] = "MenuItemType"; mPropertyRename["Combo_MaxLength"] = "MaxListLength"; mPropertyRename["AlignText"] = "TextAlign"; mPropertyRename["ToStick"] = "Snap"; mPropertyRename["ListSmoothShow"] = "SmoothShow"; mPropertyRename["HeightList"] = "MaxListLength"; mPropertyRename["AlignVert"] = "VerticalAlignment"; mPropertyIgnore.insert("DragLayer"); mPropertyIgnore.insert("SkinLine"); mPropertyIgnore.insert("HeightLine"); mPropertyIgnore.insert("SkinLine"); mPropertyIgnore.insert("HeightLine"); mPropertyIgnore.insert("SeparatorHeight"); mPropertyIgnore.insert("SeparatorSkin"); mPropertyIgnore.insert("SubmenuImageSize"); mPropertyIgnore.insert("SubMenuSkin"); mPropertyIgnore.insert("SubMenuLayer"); mPropertyIgnore.insert("DistanceButton"); mPropertyIgnore.insert("ButtonSkin"); mPropertyIgnore.insert("ButtonType"); mPropertyIgnore.insert("ButtonSize"); mPropertyIgnore.insert("ButtonOffset"); mPropertyIgnore.insert("DefaultLayer"); mPropertyIgnore.insert("FadeSkin"); mPropertyIgnore.insert("FadeLayer"); mPropertyIgnore.insert("SkinButton"); mPropertyIgnore.insert("HeightButton"); mPropertyIgnore.insert("SkinList"); mPropertyIgnore.insert("SkinButtonEmpty"); mPropertyIgnore.insert("WidthSeparator"); mPropertyIgnore.insert("SkinSeparator"); mPropertyIgnore.insert("TrackSkin"); mPropertyIgnore.insert("TrackWidth"); mPropertyIgnore.insert("TrackMin"); mPropertyIgnore.insert("TrackStep"); mPropertyIgnore.insert("TrackFill"); mPropertyIgnore.insert("OffsetBar"); mPropertyIgnore.insert("ButtonSkin"); mPropertyIgnore.insert("EmptyBarSkin"); mPropertyIgnore.insert("TrackRangeMargins"); mPropertyIgnore.insert("MinTrackSize"); mPropertyIgnore.insert("MainMove"); mPropertyIgnore.insert("LevelOffset"); mPropertyIgnore.insert("State"); mSkinRename["StaticImage"] = "ImageBox"; mSkinRename["StaticText"] = "TextBox"; mSkinRename["HScroll"] = "ScrollBarH"; mSkinRename["VScroll"] = "ScrollBarV"; mSkinRename["ItemBoxH"] = "ItemBox"; mSkinRename["ItemBoxV"] = "ItemBox"; mSkinRename["VSlider"] = "SliderV"; mSkinRename["HSlider"] = "SliderH"; mSkinRename["Progress"] = "ProgressBar"; mSkinRename["ProgressFill"] = "ProgressBarFill"; mSkinRename["List"] = "ListBox"; mSkinRename["MultiList"] = "MultiListBox"; mSkinRename["Edit"] = "EditBox"; mSkinRename["EditStretch"] = "EditBoxStretch"; mSkinRename["EditEmpty"] = "EditBoxEmpty"; mSkinRename["RadioBox"] = "RadioButton"; mSkinRename["Tab"] = "TabControl"; mSkinRename["WordWrap"] = "WordWrapEmpty"; mSkinRename["WordWrapSimple"] = "WordWrapEmpty"; mSkinRename["ButtonSmall"] = "Button"; mSkinRename["ButtonImageText"] = "ButtonImage"; mSkinRename["TileClient"] = "ClientTileSkin"; mSkinRename["DefaultClient"] = "ClientDefaultSkin"; mSkinRename["Panel"] = "PanelSkin"; mSkinRename["PanelSmall"] = "PanelSkin"; mSkinRename["Separator1"] = "SepUpVSkin"; mSkinRename["Separator2"] = "SepDownVSkin"; mSkinRename["Separator3"] = "SepUpHSkin"; mSkinRename["Separator4"] = "SepDownHSkin"; mSkinRename["MarkerWhite"] = "WhiteSkin"; mSkinRename["ButtonLeft"] = "ButtonLeftSkin"; mSkinRename["ButtonRight"] = "ButtonRightSkin"; mSkinRename["ButtonUp"] = "ButtonUpSkin"; mSkinRename["ButtonDown"] = "ButtonDownSkin"; mSkinRename["ButtonV"] = "ButtonAcceptSkin"; mSkinRename["ButtonX"] = "ButtonCloseSkin"; mSkinRename["ButtonMinusPlus"] = "ButtonExpandSkin"; #endif // MYGUI_DONT_USE_OBSOLETE } std::string BackwardCompatibility::getPropertyRename(const std::string& _propertyName) { #ifndef MYGUI_DONT_USE_OBSOLETE MapString::const_iterator item = mPropertyRename.find(_propertyName); if (item != mPropertyRename.end()) return (*item).second; #endif // MYGUI_DONT_USE_OBSOLETE return _propertyName; } std::string BackwardCompatibility::getFactoryRename(const std::string& _categoryName, const std::string& _factoryName) { #ifndef MYGUI_DONT_USE_OBSOLETE if (_categoryName == "Widget") { if (_factoryName == "HScroll") { MYGUI_LOG(Warning, "HScroll factory is deprecated, use " << ScrollBar::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]"); } else if (_factoryName == "VScroll") { MYGUI_LOG(Warning, "VScroll factory is deprecated, use " << ScrollBar::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]"); } else if (_factoryName == "RenderBox") { MYGUI_LOG(Warning, "RenderBox factory is deprecated, use " << Canvas::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]"); } else if (_factoryName == "Sheet") { MYGUI_LOG(Warning, "Sheet factory is deprecated, use " << TabItem::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]"); } else if (_factoryName == "StaticImage") { MYGUI_LOG(Warning, "StaticImage factory is deprecated, use " << ImageBox::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]"); } else if (_factoryName == "StaticText") { MYGUI_LOG(Warning, "StaticText factory is deprecated, use " << TextBox::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]"); } else if (_factoryName == "Progress") { MYGUI_LOG(Warning, "Progress factory is deprecated, use " << ProgressBar::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]"); } else if (_factoryName == "List") { MYGUI_LOG(Warning, "List factory is deprecated, use " << ListBox::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]"); } else if (_factoryName == "Edit") { MYGUI_LOG(Warning, "Edit factory is deprecated, use " << EditBox::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]"); } else if (_factoryName == "Tab") { MYGUI_LOG(Warning, "Tab factory is deprecated, use " << TabControl::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]"); } else if (_factoryName == "MultiList") { MYGUI_LOG(Warning, "MultiList factory is deprecated, use " << MultiListBox::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]"); } else if (_factoryName == "MenuCtrl") { MYGUI_LOG(Warning, "MenuCtrl factory is deprecated, use " << MenuControl::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]"); } } #endif // MYGUI_DONT_USE_OBSOLETE return _factoryName; } std::string BackwardCompatibility::getSkinRename(const std::string& _skinName) { #ifndef MYGUI_DONT_USE_OBSOLETE MapString::iterator item = mSkinRename.find(_skinName); if (item != mSkinRename.end()) { MYGUI_LOG(Warning, (*item).first << " skin is deprecated, use " << (*item).second << " [" << LayoutManager::getInstance().getCurrentLayout() << "]"); return (*item).second; } #endif // MYGUI_DONT_USE_OBSOLETE return _skinName; } void BackwardCompatibility::shutdown() { #ifndef MYGUI_DONT_USE_OBSOLETE mPropertyRename.clear(); #endif // MYGUI_DONT_USE_OBSOLETE } void BackwardCompatibility::registerWidgetTypes() { #ifndef MYGUI_DONT_USE_OBSOLETE FactoryManager& factory = FactoryManager::getInstance(); std::string widgetCategory = MyGUI::WidgetManager::getInstance().getCategoryName(); factory.registerFactory<HScroll>(widgetCategory); factory.registerFactory<VScroll>(widgetCategory); factory.registerFactory<Canvas>(widgetCategory, "RenderBox"); factory.registerFactory<TabItem>(widgetCategory, "Sheet"); factory.registerFactory<ImageBox>(widgetCategory, "StaticImage"); factory.registerFactory<TextBox>(widgetCategory, "StaticText"); factory.registerFactory<ProgressBar>(widgetCategory, "Progress"); factory.registerFactory<ListBox>(widgetCategory, "List"); factory.registerFactory<EditBox>(widgetCategory, "Edit"); factory.registerFactory<TabControl>(widgetCategory, "Tab"); factory.registerFactory<MultiListBox>(widgetCategory, "MultiList"); factory.registerFactory<MenuControl>(widgetCategory, "MenuCtrl"); #endif // MYGUI_DONT_USE_OBSOLETE } } // namespace MyGUI
1007  while (skin.next(_tag))
1008  {
1009  std::string type = skin->findAttribute("type");
1010  if (type.empty())
1011  type = "ResourceSkin";
1012 
1013  IObject* object = FactoryManager::getInstance().createObject(resourceCategory, type);
1014  if (object != nullptr)
1015  {
1016  ResourceSkin* data = object->castType<ResourceSkin>();
1017  data->deserialization(skin.current(), _version);
1018 
1020  }
1021  }
1022  }
1023 
1024 
1026  {
1027  static_cast<WidgetManager*>(this)->destroyWidgets(_widgets);
1028  }
1029  Widget* MemberObsolete<WidgetManager>::findWidgetT(const std::string& _name, bool _throw)
1030  {
1031  return Gui::getInstance().findWidgetT(_name, _throw);
1032  }
1033  Widget* MemberObsolete<WidgetManager>::findWidgetT(const std::string& _name, const std::string& _prefix, bool _throw)
1034  {
1035  return Gui::getInstance().findWidgetT(_name, _prefix, _throw);
1036  }
1037  void MemberObsolete<WidgetManager>::parse(Widget* _widget, const std::string& _key, const std::string& _value)
1038  {
1039  _widget->setProperty(_key, _value);
1040  }
1041 
1042 
1043 #endif // MYGUI_DONT_USE_OBSOLETE
1044 
1045 #ifndef MYGUI_DONT_USE_OBSOLETE
1046 
1047  static std::string convertAlignToDirection(const std::string& _value)
1048  {
1049  Align align = utility::parseValue<Align>(_value);
1050  if (align == Align::Right)
1052  else if (align == Align::Top)
1054  else if (align == Align::Bottom)
1057  }
1058 
1059  static std::string convertRectToCoord(const std::string& _value)
1060  {
1061  IntRect rect = IntRect::parse(_value);
1062  IntCoord coord(rect.left, rect.top, rect.width(), rect.height());
1063  return coord.print();
1064  }
1065 
1066  typedef std::set<std::string> SetString;
1070 
1071 #endif // MYGUI_DONT_USE_OBSOLETE
1072 
1073  bool BackwardCompatibility::isIgnoreProperty(const std::string& _key)
1074  {
1075 #ifndef MYGUI_DONT_USE_OBSOLETE
1076  if (mPropertyIgnore.find(_key) != mPropertyIgnore.end())
1077  return true;
1078 #endif // MYGUI_DONT_USE_OBSOLETE
1079  return false;
1080  }
1081 
1082  bool BackwardCompatibility::checkProperty(Widget* _owner, std::string& _key, std::string& _value)
1083  {
1084 #ifndef MYGUI_DONT_USE_OBSOLETE
1085  if (mPropertyIgnore.find(_key) != mPropertyIgnore.end())
1086  return false;
1087 
1088  MapString::iterator item = mPropertyRename.find(_key);
1089  if (item != mPropertyRename.end())
1090  {
1091  MYGUI_LOG(Warning, (*item).first << " is deprecated, use " << (*item).second << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1092  _key = (*item).second;
1093  }
1094  else if (_key == "Progress_StartPoint")
1095  {
1096  MYGUI_LOG(Warning, "Progress_StartPoint is deprecated, use Progress_FlowDirection" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1097  _key = "Progress_FlowDirection";
1098  _value = convertAlignToDirection(_value);
1099  }
1100  else if (_key == "ComboBox_AddItem")
1101  {
1102  MYGUI_LOG(Warning, "ComboBox_AddItem is deprecated" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1103  ComboBox* widget = _owner->castType<ComboBox>(false);
1104  if (widget != nullptr)
1105  widget->addItem(_value);
1106  return false;
1107  }
1108  else if (_key == "List_AddItem")
1109  {
1110  MYGUI_LOG(Warning, "List_AddItem is deprecated" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1111  ListBox* widget = _owner->castType<ListBox>(false);
1112  if (widget != nullptr)
1113  widget->addItem(_value);
1114  return false;
1115  }
1116  else if (_key == "Tab_AddSheet")
1117  {
1118  MYGUI_LOG(Warning, "Tab_AddSheet is deprecated" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1119  TabControl* widget = _owner->castType<TabControl>(false);
1120  if (widget != nullptr)
1121  widget->addItem(_value);
1122  return false;
1123  }
1124  else if (_key == "Tab_AddItem")
1125  {
1126  MYGUI_LOG(Warning, "Tab_AddItem is deprecated" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1127  TabControl* widget = _owner->castType<TabControl>(false);
1128  if (widget != nullptr)
1129  widget->addItem(_value);
1130  return false;
1131  }
1132  else if (_key == "Window_MinMax")
1133  {
1134  MYGUI_LOG(Warning, "Window_MinMax is deprecated, use Window_MinSize or Window_MaxSize" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1135  Window* widget = _owner->castType<Window>(false);
1136  if (widget != nullptr)
1137  {
1138  IntRect rect = IntRect::parse(_value);
1139  widget->setMinSize(rect.left, rect.top);
1140  widget->setMaxSize(rect.right, rect.bottom);
1141  }
1142  return false;
1143  }
1144  else if (_key == "ImageRect")
1145  {
1146  MYGUI_LOG(Warning, "ImageRect is deprecated, use ImageCoord" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1147  _key = "ImageCoord";
1148  _value = convertRectToCoord(_value);
1149  }
1150  else if (_key == "StartPoint")
1151  {
1152  MYGUI_LOG(Warning, "StartPoint is deprecated, use FlowDirection" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1153  _key = "FlowDirection";
1154  _value = convertAlignToDirection(_value);
1155  }
1156 
1157 #endif // MYGUI_DONT_USE_OBSOLETE
1158  return true;
1159  }
1160 
1162  {
1163 #ifndef MYGUI_DONT_USE_OBSOLETE
1164  mPropertyRename["Widget_Caption"] = "Caption";
1165  mPropertyRename["Button_Pressed"] = "StateSelected";
1166  mPropertyRename["ButtonPressed"] = "StateSelected";
1167  mPropertyRename["StateCheck"] = "StateSelected";
1168  mPropertyRename["Edit_ShowVScroll"] = "VisibleVScroll";
1169  mPropertyRename["Edit_ShowHScroll"] = "VisibleHScroll";
1170  mPropertyRename["ScrollView_VScroll"] = "VisibleVScroll";
1171  mPropertyRename["ScrollView_HScroll"] = "VisibleHScroll";
1172  mPropertyRename["Progress_Position"] = "RangePosition";
1173  mPropertyRename["Scroll_Position"] = "RangePosition";
1174  mPropertyRename["Tab_SelectSheet"] = "SelectItem";
1175  mPropertyRename["Image_Texture"] = "ImageTexture";
1176  mPropertyRename["Image_Coord"] = "ImageRegion";
1177  mPropertyRename["Image_Tile"] = "ImageTile";
1178  mPropertyRename["Image_Index"] = "ImageIndex";
1179  mPropertyRename["Image_Resource"] = "ImageResource";
1180  mPropertyRename["Image_Group"] = "ImageGroup";
1181  mPropertyRename["Image_Name"] = "ImageName";
1182  mPropertyRename["MenuItem_Id"] = "MenuItemId";
1183  mPropertyRename["MenuItem_Type"] = "MenuItemType";
1184  mPropertyRename["Combo_MaxLength"] = "MaxListLength";
1185  mPropertyRename["AlignText"] = "TextAlign";
1186  mPropertyRename["ToStick"] = "Snap";
1187  mPropertyRename["ListSmoothShow"] = "SmoothShow";
1188  mPropertyRename["HeightList"] = "MaxListLength";
1189  mPropertyRename["AlignVert"] = "VerticalAlignment";
1190 
1191  mPropertyIgnore.insert("DragLayer");
1192  mPropertyIgnore.insert("SkinLine");
1193  mPropertyIgnore.insert("HeightLine");
1194  mPropertyIgnore.insert("SkinLine");
1195  mPropertyIgnore.insert("HeightLine");
1196  mPropertyIgnore.insert("SeparatorHeight");
1197  mPropertyIgnore.insert("SeparatorSkin");
1198  mPropertyIgnore.insert("SubmenuImageSize");
1199  mPropertyIgnore.insert("SubMenuSkin");
1200  mPropertyIgnore.insert("SubMenuLayer");
1201  mPropertyIgnore.insert("DistanceButton");
1202  mPropertyIgnore.insert("ButtonSkin");
1203  mPropertyIgnore.insert("ButtonType");
1204  mPropertyIgnore.insert("ButtonSize");
1205  mPropertyIgnore.insert("ButtonOffset");
1206  mPropertyIgnore.insert("DefaultLayer");
1207  mPropertyIgnore.insert("FadeSkin");
1208  mPropertyIgnore.insert("FadeLayer");
1209  mPropertyIgnore.insert("SkinButton");
1210  mPropertyIgnore.insert("HeightButton");
1211  mPropertyIgnore.insert("SkinList");
1212  mPropertyIgnore.insert("SkinButtonEmpty");
1213  mPropertyIgnore.insert("WidthSeparator");
1214  mPropertyIgnore.insert("SkinSeparator");
1215  mPropertyIgnore.insert("TrackSkin");
1216  mPropertyIgnore.insert("TrackWidth");
1217  mPropertyIgnore.insert("TrackMin");
1218  mPropertyIgnore.insert("TrackStep");
1219  mPropertyIgnore.insert("TrackFill");
1220  mPropertyIgnore.insert("OffsetBar");
1221  mPropertyIgnore.insert("ButtonSkin");
1222  mPropertyIgnore.insert("EmptyBarSkin");
1223  mPropertyIgnore.insert("TrackRangeMargins");
1224  mPropertyIgnore.insert("MinTrackSize");
1225  mPropertyIgnore.insert("MainMove");
1226  mPropertyIgnore.insert("LevelOffset");
1227  mPropertyIgnore.insert("State");
1228 
1229  mSkinRename["StaticImage"] = "ImageBox";
1230  mSkinRename["StaticText"] = "TextBox";
1231  mSkinRename["HScroll"] = "ScrollBarH";
1232  mSkinRename["VScroll"] = "ScrollBarV";
1233  mSkinRename["ItemBoxH"] = "ItemBox";
1234  mSkinRename["ItemBoxV"] = "ItemBox";
1235  mSkinRename["VSlider"] = "SliderV";
1236  mSkinRename["HSlider"] = "SliderH";
1237  mSkinRename["Progress"] = "ProgressBar";
1238  mSkinRename["ProgressFill"] = "ProgressBarFill";
1239  mSkinRename["List"] = "ListBox";
1240  mSkinRename["MultiList"] = "MultiListBox";
1241  mSkinRename["Edit"] = "EditBox";
1242  mSkinRename["EditStretch"] = "EditBoxStretch";
1243  mSkinRename["EditEmpty"] = "EditBoxEmpty";
1244  mSkinRename["RadioBox"] = "RadioButton";
1245  mSkinRename["Tab"] = "TabControl";
1246  mSkinRename["WordWrap"] = "WordWrapEmpty";
1247  mSkinRename["WordWrapSimple"] = "WordWrapEmpty";
1248  mSkinRename["ButtonSmall"] = "Button";
1249  mSkinRename["ButtonImageText"] = "ButtonImage";
1250 
1251  mSkinRename["TileClient"] = "ClientTileSkin";
1252  mSkinRename["DefaultClient"] = "ClientDefaultSkin";
1253  mSkinRename["Panel"] = "PanelSkin";
1254  mSkinRename["PanelSmall"] = "PanelSkin";
1255  mSkinRename["Separator1"] = "SepUpVSkin";
1256  mSkinRename["Separator2"] = "SepDownVSkin";
1257  mSkinRename["Separator3"] = "SepUpHSkin";
1258  mSkinRename["Separator4"] = "SepDownHSkin";
1259  mSkinRename["MarkerWhite"] = "WhiteSkin";
1260  mSkinRename["ButtonLeft"] = "ButtonLeftSkin";
1261  mSkinRename["ButtonRight"] = "ButtonRightSkin";
1262  mSkinRename["ButtonUp"] = "ButtonUpSkin";
1263  mSkinRename["ButtonDown"] = "ButtonDownSkin";
1264  mSkinRename["ButtonV"] = "ButtonAcceptSkin";
1265  mSkinRename["ButtonX"] = "ButtonCloseSkin";
1266  mSkinRename["ButtonMinusPlus"] = "ButtonExpandSkin";
1267 #endif // MYGUI_DONT_USE_OBSOLETE
1268  }
1269 
1270  std::string BackwardCompatibility::getPropertyRename(const std::string& _propertyName)
1271  {
1272 #ifndef MYGUI_DONT_USE_OBSOLETE
1273  MapString::const_iterator item = mPropertyRename.find(_propertyName);
1274  if (item != mPropertyRename.end())
1275  return (*item).second;
1276 #endif // MYGUI_DONT_USE_OBSOLETE
1277  return _propertyName;
1278  }
1279 
1280  std::string BackwardCompatibility::getFactoryRename(const std::string& _categoryName, const std::string& _factoryName)
1281  {
1282 #ifndef MYGUI_DONT_USE_OBSOLETE
1283  if (_categoryName == "Widget")
1284  {
1285  if (_factoryName == "HScroll")
1286  {
1287  MYGUI_LOG(Warning, "HScroll factory is deprecated, use " << ScrollBar::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1288  }
1289  else if (_factoryName == "VScroll")
1290  {
1291  MYGUI_LOG(Warning, "VScroll factory is deprecated, use " << ScrollBar::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1292  }
1293  else if (_factoryName == "RenderBox")
1294  {
1295  MYGUI_LOG(Warning, "RenderBox factory is deprecated, use " << Canvas::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1296  }
1297  else if (_factoryName == "Sheet")
1298  {
1299  MYGUI_LOG(Warning, "Sheet factory is deprecated, use " << TabItem::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1300  }
1301  else if (_factoryName == "StaticImage")
1302  {
1303  MYGUI_LOG(Warning, "StaticImage factory is deprecated, use " << ImageBox::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1304  }
1305  else if (_factoryName == "StaticText")
1306  {
1307  MYGUI_LOG(Warning, "StaticText factory is deprecated, use " << TextBox::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1308  }
1309  else if (_factoryName == "Progress")
1310  {
1311  MYGUI_LOG(Warning, "Progress factory is deprecated, use " << ProgressBar::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1312  }
1313  else if (_factoryName == "List")
1314  {
1315  MYGUI_LOG(Warning, "List factory is deprecated, use " << ListBox::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1316  }
1317  else if (_factoryName == "Edit")
1318  {
1319  MYGUI_LOG(Warning, "Edit factory is deprecated, use " << EditBox::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1320  }
1321  else if (_factoryName == "Tab")
1322  {
1323  MYGUI_LOG(Warning, "Tab factory is deprecated, use " << TabControl::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1324  }
1325  else if (_factoryName == "MultiList")
1326  {
1327  MYGUI_LOG(Warning, "MultiList factory is deprecated, use " << MultiListBox::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1328  }
1329  else if (_factoryName == "MenuCtrl")
1330  {
1331  MYGUI_LOG(Warning, "MenuCtrl factory is deprecated, use " << MenuControl::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1332  }
1333  }
1334 #endif // MYGUI_DONT_USE_OBSOLETE
1335  return _factoryName;
1336  }
1337 
1338  std::string BackwardCompatibility::getSkinRename(const std::string& _skinName)
1339  {
1340 #ifndef MYGUI_DONT_USE_OBSOLETE
1341  MapString::iterator item = mSkinRename.find(_skinName);
1342  if (item != mSkinRename.end())
1343  {
1344  MYGUI_LOG(Warning, (*item).first << " skin is deprecated, use " << (*item).second << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1345  return (*item).second;
1346  }
1347 #endif // MYGUI_DONT_USE_OBSOLETE
1348  return _skinName;
1349  }
1350 
1352  {
1353 #ifndef MYGUI_DONT_USE_OBSOLETE
1354  mPropertyRename.clear();
1355 #endif // MYGUI_DONT_USE_OBSOLETE
1356  }
1357 
1359  {
1360 #ifndef MYGUI_DONT_USE_OBSOLETE
1362  std::string widgetCategory = MyGUI::WidgetManager::getInstance().getCategoryName();
1363  factory.registerFactory<HScroll>(widgetCategory);
1364  factory.registerFactory<VScroll>(widgetCategory);
1365  factory.registerFactory<Canvas>(widgetCategory, "RenderBox");
1366  factory.registerFactory<TabItem>(widgetCategory, "Sheet");
1367  factory.registerFactory<ImageBox>(widgetCategory, "StaticImage");
1368  factory.registerFactory<TextBox>(widgetCategory, "StaticText");
1369  factory.registerFactory<ProgressBar>(widgetCategory, "Progress");
1370  factory.registerFactory<ListBox>(widgetCategory, "List");
1371  factory.registerFactory<EditBox>(widgetCategory, "Edit");
1372  factory.registerFactory<TabControl>(widgetCategory, "Tab");
1373  factory.registerFactory<MultiListBox>(widgetCategory, "MultiList");
1374  factory.registerFactory<MenuControl>(widgetCategory, "MenuCtrl");
1375 #endif // MYGUI_DONT_USE_OBSOLETE
1376  }
1377 
1378 } // namespace MyGUI
static const std::string & getClassTypeName()
Widget properties. Skin childs. Widget widget description should be here.
Definition: MyGUI_Widget.h:29
ComboBox properties. Skin childs. ComboBox widget description should be here.
types::TRect< int > IntRect
Definition: MyGUI_Types.h:32
static const std::string & getClassTypeName()
TabItem properties. Skin childs. TabItem widget description should be here.
Definition: MyGUI_TabItem.h:20
ImageBox properties. Skin childs. ImageBox widget description should be here.
ElementPtr createRoot(const std::string &_name)
static const std::string & getClassTypeName()
MenuControl properties. Skin childs. MenuControl widget description should be here.
static SetString mPropertyIgnore
ItemBox properties. Skin childs. ItemBox widget description should be here.
Definition: MyGUI_ItemBox.h:29
static ResourceManager & getInstance()
void loadFromXmlNode(xml::ElementPtr _node, const std::string &_file, Version _version)
static const std::string & getClassTypeName()
Definition: MyGUI_TextBox.h:22
bool injectMouseMove(int _absx, int _absy, int _absz)
const size_t ITEM_NONE
Definition: MyGUI_Macros.h:17
bool findAttribute(const std::string &_name, std::string &_value)
Widget * findWidgetT(const std::string &_name, bool _throw=true)
Definition: MyGUI_Gui.cpp:188
bool injectMousePress(int _absx, int _absy, MouseButton _id)
void setVisible(bool _visible)
void frameEvent(float _time)
Definition: MyGUI_Gui.cpp:326
void setMinSize(const IntSize &_value)
ListBox properties. Skin childs. ListBox widget description should be here.
Definition: MyGUI_ListBox.h:27
virtual const IntSize & getViewSize() const =0
static std::string convertRectToCoord(const std::string &_value)
static MapString mSkinRename
virtual void deserialization(xml::ElementPtr _node, Version _version)
static const std::string & getClassTypeName()
static TRect< int > parse(const std::string &_value)
Definition: MyGUI_TRect.h:163
Button properties. Skin childs. Button widget description should be here.
Definition: MyGUI_Button.h:19
static std::string getSkinRename(const std::string &_skinName)
static const std::string & getClassTypeName()
Definition: MyGUI_TabItem.h:23
#define MYGUI_LOG(level, text)
EditBox properties. Skin childs. EditBox widget description should be here.
Definition: MyGUI_EditBox.h:25
void resizeView(const IntSize &_viewSize)
static bool checkProperty(Widget *_owner, std::string &_key, std::string &_value)
static MapString mPropertyRename
bool injectKeyRelease(KeyCode _key)
const std::string & getCategoryName() const
ProgressBar properties. Skin childs. ProgressBar widget description should be here.
bool load(const std::string &_file)
const IntPoint & getLastPressedPosition(MouseButton _id) const
ScrollView properties. Skin childs. ScrollView widget description should be here. ...
std::vector< Widget * > VectorWidgetPtr
unsigned int Char
Definition: MyGUI_Types.h:51
std::map< std::string, std::string > MapString
Definition: MyGUI_Types.h:38
static std::string getFactoryRename(const std::string &_categoryName, const std::string &_factoryName)
const std::string & getCategoryName() const
static const std::string & getClassTypeName()
static const std::string & getClassTypeName()
Definition: MyGUI_EditBox.h:30
Type * castType(bool _throw=true)
Definition: MyGUI_IObject.h:18
TabItem * addItem(const UString &_name, Any _data=Any::Null)
Add an item to the end of a array.
std::string print() const
Definition: MyGUI_TCoord.h:200
static bool isIgnoreProperty(const std::string &_key)
std::string print() const
void registerFactory(const std::string &_category, const std::string &_type, Delegate::IDelegate *_delegate)
static const std::string & getClassTypeName()
Definition: MyGUI_Canvas.h:25
ElementEnumerator getElementEnumerator()
MultiListBox properties. Skin childs. MultiListBox widget description should be here.
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
void addResource(IResourcePtr _item)
TextBox properties. Skin childs. TextBox widget description should be here.
Definition: MyGUI_TextBox.h:19
Canvas properties. Skin childs. Widget wrapper over Texture - shows the texture. Implemented: resizin...
Definition: MyGUI_Canvas.h:21
bool injectMouseRelease(int _absx, int _absy, MouseButton _id)
void setMaxSize(const IntSize &_value)
Window properties. Skin childs. Window widget description should be here.
Definition: MyGUI_Window.h:27
static const std::string & getClassTypeName()
Definition: MyGUI_ListBox.h:32
MenuItem properties. Skin childs. MenuItem widget description should be here.
const std::string & getName() const
void addItem(const UString &_name, Any _data=Any::Null)
Add an item to the end of a array.
std::set< std::string > SetString
TabControl properties. Skin childs. TabControl widget description should be here. ...
void addAttribute(const std::string &_key, const T &_value)
static std::string convertAlignToDirection(const std::string &_value)
bool injectKeyPress(KeyCode _key, Char _text=0)
static std::string getPropertyRename(const std::string &_propertyName)
void addItem(const UString &_name, Any _data=Any::Null)
Add an item to the end of a array.
IObject * createObject(const std::string &_category, const std::string &_type)
static const std::string & getClassTypeName()
const std::string & getCurrentLayout() const
void setProperty(const std::string &_key, const std::string &_value)
ElementPtr createChild(const std::string &_name, const std::string &_content="", ElementType _type=ElementType::Normal)