MyGUI  3.2.0
MyGUI_BackwardCompatibility.cpp
Go to the documentation of this file.
1 
6 /*
7  This file is part of MyGUI.
8 
9  MyGUI is free software: you can redistribute it and/or modify
10  it under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  MyGUI is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
21 */
22 #include "MyGUI_Precompiled.h"
24 #include "MyGUI_Button.h"
25 #include "MyGUI_ComboBox.h"
26 #include "MyGUI_EditBox.h"
27 #include "MyGUI_ItemBox.h"
28 #include "MyGUI_ListBox.h"
29 #include "MyGUI_MenuControl.h"
30 #include "MyGUI_MenuItem.h"
31 #include "MyGUI_MultiListBox.h"
32 #include "MyGUI_ProgressBar.h"
33 #include "MyGUI_ScrollView.h"
34 #include "MyGUI_TabControl.h"
35 #include "MyGUI_Widget.h"
36 #include "MyGUI_Window.h"
37 #include "MyGUI_TabItem.h"
38 #include "MyGUI_Canvas.h"
39 #include "MyGUI_LayoutManager.h"
40 #include "MyGUI_FontManager.h"
41 #include "MyGUI_ResourceManager.h"
42 #include "MyGUI_Gui.h"
43 #include "MyGUI_PointerManager.h"
44 #include "MyGUI_InputManager.h"
45 #include "MyGUI_RenderManager.h"
46 #include "MyGUI_LanguageManager.h"
47 #include "MyGUI_LayoutManager.h"
48 #include "MyGUI_PluginManager.h"
49 #include "MyGUI_SkinManager.h"
50 #include "MyGUI_WidgetManager.h"
51 #include "MyGUI_FactoryManager.h"
53 
54 namespace MyGUI
55 {
56 
57 #ifndef MYGUI_DONT_USE_OBSOLETE
58 
60  {
61  static_cast<Button*>(this)->setStateSelected(_value);
62  }
64  {
65  return static_cast<Button*>(this)->getStateSelected();
66  }
68  {
69  static_cast<Button*>(this)->setStateSelected(_value);
70  }
72  {
73  return static_cast<Button*>(this)->getStateSelected();
74  }
76  {
77  return static_cast<Button*>(this)->_getImageBox();
78  }
80  {
81  if (static_cast<Button*>(this)->_getImageBox())
82  static_cast<Button*>(this)->_getImageBox()->setImageIndex(_index);
83  }
85  {
86  if (static_cast<Button*>(this)->_getImageBox())
87  return static_cast<Button*>(this)->_getImageBox()->getImageIndex();
88  return ITEM_NONE;
89  }
90 
91 
93  {
94  return static_cast<ComboBox*>(this)->getIndexSelected();
95  }
97  {
98  static_cast<ComboBox*>(this)->setIndexSelected(_index);
99  }
101  {
102  static_cast<ComboBox*>(this)->clearIndexSelected();
103  }
104 
105  void MemberObsolete<ComboBox>::insertItem(size_t _index, const UString& _name)
106  {
107  static_cast<ComboBox*>(this)->insertItemAt(_index, _name);
108  }
109  void MemberObsolete<ComboBox>::setItem(size_t _index, const UString& _item)
110  {
111  static_cast<ComboBox*>(this)->setItemNameAt(_index, _item);
112  }
114  {
115  return static_cast<ComboBox*>(this)->getItemNameAt(_index);
116  }
118  {
119  static_cast<ComboBox*>(this)->removeItemAt(_index);
120  }
122  {
123  static_cast<ComboBox*>(this)->removeAllItems();
124  }
126  {
127  return static_cast<ComboBox*>(this)->getIndexSelected();
128  }
130  {
131  static_cast<ComboBox*>(this)->clearIndexSelected();
132  }
134  {
135  static_cast<ComboBox*>(this)->setIndexSelected(_index);
136  }
137 
139  {
140  static_cast<ComboBox*>(this)->setMaxListLength(_value);
141  }
143  {
144  return static_cast<ComboBox*>(this)->getMaxListLength();
145  }
146 
147 
149  {
150  static_cast<EditBox*>(this)->setVisibleVScroll(_visible);
151  }
153  {
154  return static_cast<EditBox*>(this)->isVisibleVScroll();
155  }
157  {
158  static_cast<EditBox*>(this)->setVisibleHScroll(_visible);
159  }
161  {
162  return static_cast<EditBox*>(this)->isVisibleHScroll();
163  }
164 
165  void MemberObsolete<EditBox>::setTextColour(size_t _start, size_t _count, const Colour& _colour)
166  {
167  static_cast<EditBox*>(this)->setTextIntervalColour(_start, _count, _colour);
168  }
169  void MemberObsolete<EditBox>::getTextSelect(size_t& _start, size_t& _end)
170  {
171  _start = static_cast<EditBox*>(this)->getTextSelectionStart();
172  _end = static_cast<EditBox*>(this)->getTextSelectionEnd();
173  }
174  UString MemberObsolete<EditBox>::getText(size_t _start, size_t _count)
175  {
176  return static_cast<EditBox*>(this)->getTextInterval(_start, _count);
177  }
178  void MemberObsolete<EditBox>::setTextSelect(size_t _start, size_t _end)
179  {
180  static_cast<EditBox*>(this)->setTextSelection(_start, _end);
181  }
183  {
184  static_cast<EditBox*>(this)->deleteTextSelection();
185  }
187  {
188  return static_cast<EditBox*>(this)->getTextSelection();
189  }
191  {
192  return static_cast<EditBox*>(this)->isTextSelection();
193  }
195  {
196  static_cast<EditBox*>(this)->setTextSelectionColour(_colour);
197  }
198 
199 
201  {
202  return static_cast<ItemBox*>(this)->getIndexSelected();
203  }
205  {
206  static_cast<ItemBox*>(this)->setIndexSelected(_index);
207  }
209  {
210  static_cast<ItemBox*>(this)->clearIndexSelected();
211  }
212 
213  void MemberObsolete<ItemBox>::insertItem(size_t _index, Any _data)
214  {
215  static_cast<ItemBox*>(this)->insertItemAt(_index, _data);
216  }
217  void MemberObsolete<ItemBox>::setItemData(size_t _index, Any _data)
218  {
219  static_cast<ItemBox*>(this)->setItemDataAt(_index, _data);
220  }
222  {
223  static_cast<ItemBox*>(this)->removeItemAt(_index);
224  }
226  {
227  static_cast<ItemBox*>(this)->removeAllItems();
228  }
230  {
231  return static_cast<ItemBox*>(this)->getIndexSelected();
232  }
234  {
235  static_cast<ItemBox*>(this)->clearIndexSelected();
236  }
238  {
239  static_cast<ItemBox*>(this)->setIndexSelected(_index);
240  }
241 
243  {
244  return static_cast<ItemBox*>(this)->getWidgetDrag();
245  }
247  {
248  static_cast<ItemBox*>(this)->resetDrag();
249  }
250 
252  {
253  static_cast<ItemBox*>(this)->setVerticalAlignment(_value);
254  }
256  {
257  return static_cast<ItemBox*>(this)->getVerticalAlignment();
258  }
259 
260 
262  {
263  return static_cast<ListBox*>(this)->getIndexSelected();
264  }
266  {
267  static_cast<ListBox*>(this)->setIndexSelected(_index);
268  }
270  {
271  static_cast<ListBox*>(this)->clearIndexSelected();
272  }
273 
274  void MemberObsolete<ListBox>::insertItem(size_t _index, const UString& _item)
275  {
276  static_cast<ListBox*>(this)->insertItemAt(_index, _item);
277  }
278  void MemberObsolete<ListBox>::setItem(size_t _index, const UString& _item)
279  {
280  static_cast<ListBox*>(this)->setItemNameAt(_index, _item);
281  }
283  {
284  return static_cast<ListBox*>(this)->getItemNameAt(_index);
285  }
287  {
288  static_cast<ListBox*>(this)->removeItemAt(_index);
289  }
291  {
292  static_cast<ListBox*>(this)->removeAllItems();
293  }
295  {
296  return static_cast<ListBox*>(this)->findItemIndexWith(_item);
297  }
299  {
300  return static_cast<ListBox*>(this)->getIndexSelected();
301  }
303  {
304  static_cast<ListBox*>(this)->clearIndexSelected();
305  }
307  {
308  static_cast<ListBox*>(this)->setIndexSelected(_index);
309  }
311  {
312  static_cast<ListBox*>(this)->beginToItemAt(_index);
313  }
315  {
316  static_cast<ListBox*>(this)->beginToItemFirst();
317  }
319  {
320  static_cast<ListBox*>(this)->beginToItemLast();
321  }
323  {
324  static_cast<ListBox*>(this)->beginToItemSelected();
325  }
326  bool MemberObsolete<ListBox>::isItemVisible(size_t _index, bool _fill)
327  {
328  return static_cast<ListBox*>(this)->isItemVisibleAt(_index, _fill);
329  }
331  {
332  return static_cast<ListBox*>(this)->isItemSelectedVisible(_fill);
333  }
334 
335 
337  {
338  static_cast<MenuControl*>(this)->setVisible(true);
339  }
341  {
342  static_cast<MenuControl*>(this)->setVisible(false);
343  }
345  {
346  return static_cast<MenuControl*>(this)->getVisible();
347  }
348 
350  {
351  static_cast<MenuControl*>(this)->setItemChildVisibleAt(_index, true);
352  }
354  {
355  static_cast<MenuControl*>(this)->setItemChildVisible(_item, true);
356  }
358  {
359  static_cast<MenuControl*>(this)->setItemChildVisibleAt(_index, false);
360  }
362  {
363  static_cast<MenuControl*>(this)->setItemChildVisible(_item, false);
364  }
365 
367  {
368  static_cast<MenuControl*>(this)->setVerticalAlignment(_value);
369  }
371  {
372  return static_cast<MenuControl*>(this)->getVerticalAlignment();
373  }
374 
376  {
377  static_cast<MenuItem*>(this)->setItemChildVisible(true);
378  }
380  {
381  static_cast<MenuItem*>(this)->setItemChildVisible(false);
382  }
383 
384 
386  {
387  return static_cast<MultiListBox*>(this)->getIndexSelected();
388  }
390  {
391  static_cast<MultiListBox*>(this)->setIndexSelected(_index);
392  }
394  {
395  static_cast<MultiListBox*>(this)->clearIndexSelected();
396  }
397 
398  size_t MemberObsolete<MultiListBox>::findItem(size_t _column, const UString& _name)
399  {
400  return static_cast<MultiListBox*>(this)->findSubItemWith(_column, _name);
401  }
402  const UString& MemberObsolete<MultiListBox>::getSubItem(size_t _column, size_t _index)
403  {
404  return static_cast<MultiListBox*>(this)->getSubItemNameAt(_column, _index);
405  }
406  void MemberObsolete<MultiListBox>::setSubItem(size_t _column, size_t _index, const UString& _name)
407  {
408  static_cast<MultiListBox*>(this)->setSubItemNameAt(_column, _index, _name);
409  }
411  {
412  static_cast<MultiListBox*>(this)->removeColumnAt(_column);
413  }
415  {
416  static_cast<MultiListBox*>(this)->removeAllColumns();
417  }
419  {
420  return static_cast<MultiListBox*>(this)->getColumnWidthAt(_column);
421  }
423  {
424  return static_cast<MultiListBox*>(this)->getColumnNameAt(_column);
425  }
426  void MemberObsolete<MultiListBox>::setColumnWidth(size_t _column, int _width)
427  {
428  static_cast<MultiListBox*>(this)->setColumnWidthAt(_column, _width);
429  }
430  void MemberObsolete<MultiListBox>::addColumn(int _width, const UString& _name)
431  {
432  static_cast<MultiListBox*>(this)->addColumn(_name, _width);
433  }
434  void MemberObsolete<MultiListBox>::setColumnName(size_t _column, const UString& _name)
435  {
436  static_cast<MultiListBox*>(this)->setColumnNameAt(_column, _name);
437  }
438  void MemberObsolete<MultiListBox>::insertColumn(size_t _column, int _width, const UString& _name)
439  {
440  static_cast<MultiListBox*>(this)->insertColumnAt(_column, _name, _width);
441  }
443  {
444  return static_cast<MultiListBox*>(this)->getIndexSelected();
445  }
447  {
448  static_cast<MultiListBox*>(this)->clearIndexSelected();
449  }
451  {
452  static_cast<MultiListBox*>(this)->setIndexSelected(_index);
453  }
454  void MemberObsolete<MultiListBox>::insertItem(size_t _index, const UString& _name)
455  {
456  static_cast<MultiListBox*>(this)->insertItemAt(_index, _name);
457  }
458  void MemberObsolete<MultiListBox>::setItem(size_t _index, const UString& _name)
459  {
460  static_cast<MultiListBox*>(this)->setItemNameAt(_index, _name);
461  }
463  {
464  return static_cast<MultiListBox*>(this)->getItemNameAt(_index);
465  }
467  {
468  static_cast<MultiListBox*>(this)->removeItemAt(_index);
469  }
471  {
472  static_cast<MultiListBox*>(this)->removeAllItems();
473  }
474 
475 
477  {
478  if (_value == Align::Right)
479  static_cast<ProgressBar*>(this)->setFlowDirection(FlowDirection::RightToLeft);
480  else if (_value == Align::Top)
481  static_cast<ProgressBar*>(this)->setFlowDirection(FlowDirection::TopToBottom);
482  else if (_value == Align::Bottom)
483  static_cast<ProgressBar*>(this)->setFlowDirection(FlowDirection::BottomToTop);
484  else
485  static_cast<ProgressBar*>(this)->setFlowDirection(FlowDirection::LeftToRight);
486  }
487 
489  {
490  if (static_cast<ProgressBar*>(this)->getFlowDirection() == FlowDirection::RightToLeft)
491  return Align::Right;
492  else if (static_cast<ProgressBar*>(this)->getFlowDirection() == FlowDirection::TopToBottom)
493  return Align::Top;
494  else if (static_cast<ProgressBar*>(this)->getFlowDirection() == FlowDirection::BottomToTop)
495  return Align::Bottom;
496 
497  return Align::Left;
498  }
499 
500 
502  {
503  static_cast<ScrollView*>(this)->setVisibleVScroll(_visible);
504  }
506  {
507  return static_cast<ScrollView*>(this)->isVisibleVScroll();
508  }
510  {
511  static_cast<ScrollView*>(this)->setVisibleHScroll(_visible);
512  }
514  {
515  return static_cast<ScrollView*>(this)->isVisibleHScroll();
516  }
517 
518 
520  {
521  return static_cast<TabControl*>(this)->getButtonWidthAt(_index);
522  }
524  {
525  return static_cast<TabControl*>(this)->getButtonWidth(_sheet);
526  }
528  {
529  static_cast<TabControl*>(this)->setButtonWidthAt(_index, _width);
530  }
532  {
533  static_cast<TabControl*>(this)->setButtonWidth(_sheet, _width);
534  }
536  {
537  static_cast<TabControl*>(this)->beginToItemAt(_index);
538  }
540  {
541  static_cast<TabControl*>(this)->beginToItemSelected();
542  }
544  {
545  return static_cast<TabControl*>(this)->getItemCount();
546  }
548  {
549  return static_cast<TabControl*>(this)->getItemName(_sheet);
550  }
552  {
553  return static_cast<TabControl*>(this)->getItemNameAt(_index);
554  }
556  {
557  return static_cast<TabControl*>(this)->getItemAt(_index);
558  }
559  void MemberObsolete<TabControl>::setSheetNameIndex(size_t _index, const UString& _name, int _width)
560  {
561  static_cast<TabControl*>(this)->setItemNameAt(_index, _name);
562  }
563  void MemberObsolete<TabControl>::setSheetName(TabItem* _sheet, const UString& _name, int _width)
564  {
565  static_cast<TabControl*>(this)->setItemName(_sheet, _name);
566  }
568  {
569  return static_cast<TabControl*>(this)->addItem(_name, _width);
570  }
571  TabItem* MemberObsolete<TabControl>::insertSheet(size_t _index, const UString& _name, int _width)
572  {
573  return static_cast<TabControl*>(this)->insertItemAt(_index, _name);
574  }
576  {
577  static_cast<TabControl*>(this)->removeItemAt(_index);
578  }
580  {
581  static_cast<TabControl*>(this)->removeItem(_sheet);
582  }
583  void MemberObsolete<TabControl>::selectSheetIndex(size_t _index, bool _smooth)
584  {
585  static_cast<TabControl*>(this)->setIndexSelected(_index);
586  }
588  {
589  static_cast<TabControl*>(this)->setItemSelected(_sheet);
590  }
592  {
593  return static_cast<TabControl*>(this)->getIndexSelected();
594  }
595 
597  {
598  return static_cast<TabControl*>(this)->getIndexSelected();
599  }
601  {
602  static_cast<TabControl*>(this)->setIndexSelected(_index);
603  }
604 
605 
607  {
608  return static_cast<Widget*>(this)->getEnabled();
609  }
611  {
612  return static_cast<Widget*>(this)->getInheritsAlpha();
613  }
615  {
616  return static_cast<Widget*>(this)->getNeedKeyFocus();
617  }
619  {
620  return static_cast<Widget*>(this)->getNeedMouseFocus();
621  }
623  {
624  return static_cast<Widget*>(this)->getInheritsPick();
625  }
627  {
628  return static_cast<Widget*>(this)->getVisible();
629  }
630 
631 
633  {
634  static_cast<Window*>(this)->setVisibleSmooth(true);
635  }
637  {
638  static_cast<Window*>(this)->setVisibleSmooth(false);
639  }
641  {
642  static_cast<Window*>(this)->setMinSize(_minmax.left, _minmax.top);
643  static_cast<Window*>(this)->setMaxSize(_minmax.right, _minmax.bottom);
644  }
645  void MemberObsolete<Window>::setMinMax(int _min_w, int _min_h, int _max_w, int _max_h)
646  {
647  static_cast<Window*>(this)->setMinSize(_min_w, _min_h);
648  static_cast<Window*>(this)->setMaxSize(_max_w, _max_h);
649  }
651  {
652  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);
653  }
654 
655  bool MemberObsolete<FontManager>::load(const std::string& _file)
656  {
657  return ResourceManager::getInstance().load(_file);
658  }
659 
661  {
662  static_cast<Gui*>(this)->destroyWidgets(_widgets);
663  }
664 
665  bool MemberObsolete<Gui>::injectMouseMove( int _absx, int _absy, int _absz)
666  {
667  return InputManager::getInstance().injectMouseMove(_absx, _absy, _absz);
668  }
669  bool MemberObsolete<Gui>::injectMousePress( int _absx, int _absy, MouseButton _id )
670  {
671  return InputManager::getInstance().injectMousePress(_absx, _absy, _id);
672  }
673  bool MemberObsolete<Gui>::injectMouseRelease( int _absx, int _absy, MouseButton _id )
674  {
675  return InputManager::getInstance().injectMouseRelease(_absx, _absy, _id);
676  }
678  {
679  return InputManager::getInstance().injectKeyPress(_key, _text);
680  }
682  {
684  }
685 
687  {
689  }
691  {
693  }
695  {
697  }
698 
699  bool MemberObsolete<Gui>::load(const std::string& _file)
700  {
701  return ResourceManager::getInstance().load(_file);
702  }
703 
705  {
707  }
709  {
711  }
713  {
715  }
716 
718  {
720  }
722  {
724  }
725 
727  {
728  Gui::getInstance().frameEvent(_time);
729  }
730 
732  {
734  }
735 
737  {
739  }
740 
742  {
744  }
745 
746  bool MemberObsolete<LanguageManager>::load(const std::string& _file)
747  {
748  return ResourceManager::getInstance().load(_file);
749  }
750 
751  bool MemberObsolete<LayerManager>::load(const std::string& _file)
752  {
753  return ResourceManager::getInstance().load(_file);
754  }
755 
757  {
758  return static_cast<LayoutManager*>(this)->loadLayout(_file);
759  }
760 
761  bool MemberObsolete<PluginManager>::load(const std::string& _file)
762  {
763  return ResourceManager::getInstance().load(_file);
764  }
765 
767  {
768  static_cast<PointerManager*>(this)->setDefaultPointer(_value);
769  }
771  {
772  static_cast<PointerManager*>(this)->setVisible(true);
773  }
775  {
776  static_cast<PointerManager*>(this)->setVisible(false);
777  }
779  {
780  return static_cast<PointerManager*>(this)->isVisible();
781  }
782  bool MemberObsolete<PointerManager>::load(const std::string& _file)
783  {
784  return ResourceManager::getInstance().load(_file);
785  }
786 
788  {
789  return static_cast<ResourceManager*>(this)->getCount();
790  }
791  IResourcePtr MemberObsolete<ResourceManager>::getResource(const std::string& _name, bool _throw)
792  {
793  return static_cast<ResourceManager*>(this)->getByName(_name, _throw);
794  }
795 
797  {
798  return static_cast<SkinManager*>(this)->getByName(_name);
799  }
800  bool MemberObsolete<SkinManager>::load(const std::string& _file)
801  {
802  return ResourceManager::getInstance().load(_file);
803  }
804 
805 
807  {
808  static_cast<WidgetManager*>(this)->destroyWidgets(_widgets);
809  }
810  Widget* MemberObsolete<WidgetManager>::findWidgetT(const std::string& _name, bool _throw)
811  {
812  return Gui::getInstance().findWidgetT(_name, _throw);
813  }
814  Widget* MemberObsolete<WidgetManager>::findWidgetT(const std::string& _name, const std::string& _prefix, bool _throw)
815  {
816  return Gui::getInstance().findWidgetT(_name, _prefix, _throw);
817  }
818  void MemberObsolete<WidgetManager>::parse(Widget* _widget, const std::string& _key, const std::string& _value)
819  {
820  _widget->setProperty(_key, _value);
821  }
822 
823 
824 #endif // MYGUI_DONT_USE_OBSOLETE
825 
826 #ifndef MYGUI_DONT_USE_OBSOLETE
827 
828  std::string convertAlignToDirection(const std::string& _value)
829  {
830  Align align = utility::parseValue<Align>(_value);
831  if (align == Align::Right)
833  else if (align == Align::Top)
835  else if (align == Align::Bottom)
838  }
839 
840  std::string convertRectToCoord(const std::string& _value)
841  {
842  IntRect rect = IntRect::parse(_value);
843  IntCoord coord(rect.left, rect.top, rect.width(), rect.height());
844  return coord.print();
845  }
846 
847  typedef std::set<std::string> SetString;
851 
852 #endif // MYGUI_DONT_USE_OBSOLETE
853 
854  bool BackwardCompatibility::isIgnoreProperty(const std::string& _key)
855  {
856 #ifndef MYGUI_DONT_USE_OBSOLETE
857  if (mPropertyIgnore.find(_key) != mPropertyIgnore.end())
858  return true;
859 #endif // MYGUI_DONT_USE_OBSOLETE
860  return false;
861  }
862 
863  bool BackwardCompatibility::checkProperty(Widget* _owner, std::string& _key, std::string& _value)
864  {
865 #ifndef MYGUI_DONT_USE_OBSOLETE
866  if (mPropertyIgnore.find(_key) != mPropertyIgnore.end())
867  return false;
868 
869  MapString::iterator item = mPropertyRename.find(_key);
870  if (item != mPropertyRename.end())
871  {
872  MYGUI_LOG(Warning, (*item).first << " is deprecated, use " << (*item).second << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
873  _key = (*item).second;
874  }
875  else if (_key == "Progress_StartPoint")
876  {
877  MYGUI_LOG(Warning, "Progress_StartPoint is deprecated, use Progress_FlowDirection" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
878  _key = "Progress_FlowDirection";
879  _value = convertAlignToDirection(_value);
880  }
881  else if (_key == "ComboBox_AddItem")
882  {
883  MYGUI_LOG(Warning, "ComboBox_AddItem is deprecated" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
884  ComboBox* widget = _owner->castType<ComboBox>(false);
885  if (widget != nullptr)
886  widget->addItem(_value);
887  return false;
888  }
889  else if (_key == "List_AddItem")
890  {
891  MYGUI_LOG(Warning, "List_AddItem is deprecated" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
892  ListBox* widget = _owner->castType<ListBox>(false);
893  if (widget != nullptr)
894  widget->addItem(_value);
895  return false;
896  }
897  else if (_key == "Tab_AddSheet")
898  {
899  MYGUI_LOG(Warning, "Tab_AddSheet is deprecated" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
900  TabControl* widget = _owner->castType<TabControl>(false);
901  if (widget != nullptr)
902  widget->addItem(_value);
903  return false;
904  }
905  else if (_key == "Tab_AddItem")
906  {
907  MYGUI_LOG(Warning, "Tab_AddItem is deprecated" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
908  TabControl* widget = _owner->castType<TabControl>(false);
909  if (widget != nullptr)
910  widget->addItem(_value);
911  return false;
912  }
913  else if (_key == "Window_MinMax")
914  {
915  MYGUI_LOG(Warning, "Window_MinMax is deprecated, use Window_MinSize or Window_MaxSize" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
916  Window* widget = _owner->castType<Window>(false);
917  if (widget != nullptr)
918  {
919  IntRect rect = IntRect::parse(_value);
920  widget->setMinSize(rect.left, rect.top);
921  widget->setMaxSize(rect.right, rect.bottom);
922  }
923  return false;
924  }
925  else if (_key == "ImageRect")
926  {
927  MYGUI_LOG(Warning, "ImageRect is deprecated, use ImageCoord" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
928  _key = "ImageCoord";
929  _value = convertRectToCoord(_value);
930  }
931  else if (_key == "StartPoint")
932  {
933  MYGUI_LOG(Warning, "StartPoint is deprecated, use FlowDirection" << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
934  _key = "FlowDirection";
935  _value = convertAlignToDirection(_value);
936  }
937 
938 #endif // MYGUI_DONT_USE_OBSOLETE
939  return true;
940  }
941 
943  {
944 #ifndef MYGUI_DONT_USE_OBSOLETE
945  mPropertyRename["Widget_Caption"] = "Caption";
946  mPropertyRename["Button_Pressed"] = "StateSelected";
947  mPropertyRename["ButtonPressed"] = "StateSelected";
948  mPropertyRename["StateCheck"] = "StateSelected";
949  mPropertyRename["Edit_ShowVScroll"] = "VisibleVScroll";
950  mPropertyRename["Edit_ShowHScroll"] = "VisibleHScroll";
951  mPropertyRename["ScrollView_VScroll"] = "VisibleVScroll";
952  mPropertyRename["ScrollView_HScroll"] = "VisibleHScroll";
953  mPropertyRename["Progress_Position"] = "RangePosition";
954  mPropertyRename["Scroll_Position"] = "RangePosition";
955  mPropertyRename["Tab_SelectSheet"] = "SelectItem";
956  mPropertyRename["Image_Texture"] = "ImageTexture";
957  mPropertyRename["Image_Coord"] = "ImageRegion";
958  mPropertyRename["Image_Tile"] = "ImageTile";
959  mPropertyRename["Image_Index"] = "ImageIndex";
960  mPropertyRename["Image_Resource"] = "ImageResource";
961  mPropertyRename["Image_Group"] = "ImageGroup";
962  mPropertyRename["Image_Name"] = "ImageName";
963  mPropertyRename["MenuItem_Id"] = "MenuItemId";
964  mPropertyRename["MenuItem_Type"] = "MenuItemType";
965  mPropertyRename["Combo_MaxLength"] = "MaxListLength";
966  mPropertyRename["AlignText"] = "TextAlign";
967  mPropertyRename["ToStick"] = "Snap";
968  mPropertyRename["ListSmoothShow"] = "SmoothShow";
969  mPropertyRename["HeightList"] = "MaxListLength";
970  mPropertyRename["AlignVert"] = "VerticalAlignment";
971 
972  mPropertyIgnore.insert("DragLayer");
973  mPropertyIgnore.insert("SkinLine");
974  mPropertyIgnore.insert("HeightLine");
975  mPropertyIgnore.insert("SkinLine");
976  mPropertyIgnore.insert("HeightLine");
977  mPropertyIgnore.insert("SeparatorHeight");
978  mPropertyIgnore.insert("SeparatorSkin");
979  mPropertyIgnore.insert("SubmenuImageSize");
980  mPropertyIgnore.insert("SubMenuSkin");
981  mPropertyIgnore.insert("SubMenuLayer");
982  mPropertyIgnore.insert("DistanceButton");
983  mPropertyIgnore.insert("ButtonSkin");
984  mPropertyIgnore.insert("ButtonType");
985  mPropertyIgnore.insert("ButtonSize");
986  mPropertyIgnore.insert("ButtonOffset");
987  mPropertyIgnore.insert("DefaultLayer");
988  mPropertyIgnore.insert("FadeSkin");
989  mPropertyIgnore.insert("FadeLayer");
990  mPropertyIgnore.insert("SkinButton");
991  mPropertyIgnore.insert("HeightButton");
992  mPropertyIgnore.insert("SkinList");
993  mPropertyIgnore.insert("SkinButtonEmpty");
994  mPropertyIgnore.insert("WidthSeparator");
995  mPropertyIgnore.insert("SkinSeparator");
996  mPropertyIgnore.insert("TrackSkin");
997  mPropertyIgnore.insert("TrackWidth");
998  mPropertyIgnore.insert("TrackMin");
999  mPropertyIgnore.insert("TrackStep");
1000  mPropertyIgnore.insert("TrackFill");
1001  mPropertyIgnore.insert("OffsetBar");
1002  mPropertyIgnore.insert("ButtonSkin");
1003  mPropertyIgnore.insert("EmptyBarSkin");
1004  mPropertyIgnore.insert("TrackRangeMargins");
1005  mPropertyIgnore.insert("MinTrackSize");
1006  mPropertyIgnore.insert("MainMove");
1007  mPropertyIgnore.insert("LevelOffset");
1008  mPropertyIgnore.insert("State");
1009 
1010  mSkinRename["StaticImage"] = "ImageBox";
1011  mSkinRename["StaticText"] = "TextBox";
1012  mSkinRename["HScroll"] = "ScrollBarH";
1013  mSkinRename["VScroll"] = "ScrollBarV";
1014  mSkinRename["ItemBoxH"] = "ItemBox";
1015  mSkinRename["ItemBoxV"] = "ItemBox";
1016  mSkinRename["VSlider"] = "SliderV";
1017  mSkinRename["HSlider"] = "SliderH";
1018  mSkinRename["Progress"] = "ProgressBar";
1019  mSkinRename["ProgressFill"] = "ProgressBarFill";
1020  mSkinRename["List"] = "ListBox";
1021  mSkinRename["MultiList"] = "MultiListBox";
1022  mSkinRename["Edit"] = "EditBox";
1023  mSkinRename["EditStretch"] = "EditBoxStretch";
1024  mSkinRename["EditEmpty"] = "EditBoxEmpty";
1025  mSkinRename["RadioBox"] = "RadioButton";
1026  mSkinRename["Tab"] = "TabControl";
1027  mSkinRename["WordWrap"] = "WordWrapEmpty";
1028  mSkinRename["WordWrapSimple"] = "WordWrapEmpty";
1029  mSkinRename["ButtonSmall"] = "Button";
1030  mSkinRename["ButtonImageText"] = "ButtonImage";
1031 
1032  mSkinRename["TileClient"] = "ClientTileSkin";
1033  mSkinRename["DefaultClient"] = "ClientDefaultSkin";
1034  mSkinRename["Panel"] = "PanelSkin";
1035  mSkinRename["PanelSmall"] = "PanelSkin";
1036  mSkinRename["Separator1"] = "SepUpVSkin";
1037  mSkinRename["Separator2"] = "SepDownVSkin";
1038  mSkinRename["Separator3"] = "SepUpHSkin";
1039  mSkinRename["Separator4"] = "SepDownHSkin";
1040  mSkinRename["MarkerWhite"] = "WhiteSkin";
1041  mSkinRename["ButtonLeft"] = "ButtonLeftSkin";
1042  mSkinRename["ButtonRight"] = "ButtonRightSkin";
1043  mSkinRename["ButtonUp"] = "ButtonUpSkin";
1044  mSkinRename["ButtonDown"] = "ButtonDownSkin";
1045  mSkinRename["ButtonV"] = "ButtonAcceptSkin";
1046  mSkinRename["ButtonX"] = "ButtonCloseSkin";
1047  mSkinRename["ButtonMinusPlus"] = "ButtonExpandSkin";
1048 #endif // MYGUI_DONT_USE_OBSOLETE
1049  }
1050 
1051  std::string BackwardCompatibility::getPropertyRename(const std::string& _propertyName)
1052  {
1053 #ifndef MYGUI_DONT_USE_OBSOLETE
1054  MapString::const_iterator item = mPropertyRename.find(_propertyName);
1055  if (item != mPropertyRename.end())
1056  return (*item).second;
1057 #endif // MYGUI_DONT_USE_OBSOLETE
1058  return _propertyName;
1059  }
1060 
1061  std::string BackwardCompatibility::getFactoryRename(const std::string& _categoryName, const std::string& _factoryName)
1062  {
1063 #ifndef MYGUI_DONT_USE_OBSOLETE
1064  if (_categoryName == "Widget")
1065  {
1066  if (_factoryName == "HScroll")
1067  {
1068  MYGUI_LOG(Warning, "HScroll factory is deprecated, use " << ScrollBar::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1069  }
1070  else if (_factoryName == "VScroll")
1071  {
1072  MYGUI_LOG(Warning, "VScroll factory is deprecated, use " << ScrollBar::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1073  }
1074  else if (_factoryName == "RenderBox")
1075  {
1076  MYGUI_LOG(Warning, "RenderBox factory is deprecated, use " << Canvas::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1077  }
1078  else if (_factoryName == "Sheet")
1079  {
1080  MYGUI_LOG(Warning, "Sheet factory is deprecated, use " << TabItem::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1081  }
1082  else if (_factoryName == "StaticImage")
1083  {
1084  MYGUI_LOG(Warning, "StaticImage factory is deprecated, use " << ImageBox::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1085  }
1086  else if (_factoryName == "StaticText")
1087  {
1088  MYGUI_LOG(Warning, "StaticText factory is deprecated, use " << TextBox::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1089  }
1090  else if (_factoryName == "Progress")
1091  {
1092  MYGUI_LOG(Warning, "Progress factory is deprecated, use " << ProgressBar::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1093  }
1094  else if (_factoryName == "List")
1095  {
1096  MYGUI_LOG(Warning, "List factory is deprecated, use " << ListBox::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1097  }
1098  else if (_factoryName == "Edit")
1099  {
1100  MYGUI_LOG(Warning, "Edit factory is deprecated, use " << EditBox::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1101  }
1102  else if (_factoryName == "Tab")
1103  {
1104  MYGUI_LOG(Warning, "Tab factory is deprecated, use " << TabControl::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1105  }
1106  else if (_factoryName == "MultiList")
1107  {
1108  MYGUI_LOG(Warning, "MultiList factory is deprecated, use " << MultiListBox::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1109  }
1110  else if (_factoryName == "MenuCtrl")
1111  {
1112  MYGUI_LOG(Warning, "MenuCtrl factory is deprecated, use " << MenuControl::getClassTypeName() << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1113  }
1114  }
1115 #endif // MYGUI_DONT_USE_OBSOLETE
1116  return _factoryName;
1117  }
1118 
1119  std::string BackwardCompatibility::getSkinRename(const std::string& _skinName)
1120  {
1121 #ifndef MYGUI_DONT_USE_OBSOLETE
1122  MapString::iterator item = mSkinRename.find(_skinName);
1123  if (item != mSkinRename.end())
1124  {
1125  MYGUI_LOG(Warning, (*item).first << " skin is deprecated, use " << (*item).second << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1126  return (*item).second;
1127  }
1128 #endif // MYGUI_DONT_USE_OBSOLETE
1129  return _skinName;
1130  }
1131 
1133  {
1134 #ifndef MYGUI_DONT_USE_OBSOLETE
1135  mPropertyRename.clear();
1136 #endif // MYGUI_DONT_USE_OBSOLETE
1137  }
1138 
1140  {
1141 #ifndef MYGUI_DONT_USE_OBSOLETE
1143  factory.registerFactory<HScroll>("Widget");
1144  factory.registerFactory<VScroll>("Widget");
1145  factory.registerFactory<Canvas>("Widget", "RenderBox");
1146  factory.registerFactory<TabItem>("Widget", "Sheet");
1147  factory.registerFactory<ImageBox>("Widget", "StaticImage");
1148  factory.registerFactory<TextBox>("Widget", "StaticText");
1149  factory.registerFactory<ProgressBar>("Widget", "Progress");
1150  factory.registerFactory<ListBox>("Widget", "List");
1151  factory.registerFactory<EditBox>("Widget", "Edit");
1152  factory.registerFactory<TabControl>("Widget", "Tab");
1153  factory.registerFactory<MultiListBox>("Widget", "MultiList");
1154  factory.registerFactory<MenuControl>("Widget", "MenuCtrl");
1155 #endif // MYGUI_DONT_USE_OBSOLETE
1156  }
1157 
1158 } // namespace MyGUI
static const std::string & getClassTypeName()
std::string print() const
Definition: MyGUI_TCoord.h:215
types::TRect< int > IntRect
Definition: MyGUI_Types.h:47
static const std::string & getClassTypeName()
static const std::string & getClassTypeName()
const IntPoint & getLastPressedPosition(MouseButton _id) const
static SetString mPropertyIgnore
static ResourceManager & getInstance()
static const std::string & getClassTypeName()
Definition: MyGUI_TextBox.h:34
bool injectMouseMove(int _absx, int _absy, int _absz)
const size_t ITEM_NONE
Definition: MyGUI_Macros.h:32
Widget * findWidgetT(const std::string &_name, bool _throw=true)
Definition: MyGUI_Gui.cpp:207
bool injectMousePress(int _absx, int _absy, MouseButton _id)
void setVisible(bool _visible)
void frameEvent(float _time)
Definition: MyGUI_Gui.cpp:345
void setMinSize(const IntSize &_value)
virtual const IntSize & getViewSize() const =0
static MapString mSkinRename
static const std::string & getClassTypeName()
static TRect< int > parse(const std::string &_value)
Definition: MyGUI_TRect.h:178
static std::string getSkinRename(const std::string &_skinName)
static const std::string & getClassTypeName()
Definition: MyGUI_TabItem.h:35
std::string convertRectToCoord(const std::string &_value)
#define MYGUI_LOG(level, text)
void resizeView(const IntSize &_viewSize)
static bool checkProperty(Widget *_owner, std::string &_key, std::string &_value)
static MapString mPropertyRename
bool injectKeyRelease(KeyCode _key)
bool load(const std::string &_file)
std::vector< Widget * > VectorWidgetPtr
unsigned int Char
Definition: MyGUI_Types.h:66
std::map< std::string, std::string > MapString
Definition: MyGUI_Types.h:53
static std::string getFactoryRename(const std::string &_categoryName, const std::string &_factoryName)
static const std::string & getClassTypeName()
static const std::string & getClassTypeName()
Definition: MyGUI_EditBox.h:42
Type * castType(bool _throw=true)
Definition: MyGUI_IObject.h:33
TabItem * addItem(const UString &_name, Any _data=Any::Null)
Add an item to the end of a array.
static bool isIgnoreProperty(const std::string &_key)
void registerFactory(const std::string &_category, const std::string &_type, Delegate::IDelegate *_delegate)
static const std::string & getClassTypeName()
Definition: MyGUI_Canvas.h:40
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
bool injectMouseRelease(int _absx, int _absy, MouseButton _id)
void setMaxSize(const IntSize &_value)
const std::string & getCurrentLayout() const
static const std::string & getClassTypeName()
Definition: MyGUI_ListBox.h:42
void addItem(const UString &_name, Any _data=Any::Null)
Add an item to the end of a array.
std::set< std::string > SetString
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.
std::string print() const
static const std::string & getClassTypeName()
void setProperty(const std::string &_key, const std::string &_value)
std::string convertAlignToDirection(const std::string &_value)