MyGUI  3.4.1
MyGUI_Widget.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"
8 #include "MyGUI_Widget.h"
9 #include "MyGUI_Gui.h"
10 #include "MyGUI_InputManager.h"
11 #include "MyGUI_SkinManager.h"
12 #include "MyGUI_SubWidgetManager.h"
13 #include "MyGUI_WidgetManager.h"
14 #include "MyGUI_ResourceSkin.h"
15 #include "MyGUI_WidgetDefines.h"
16 #include "MyGUI_LayerItem.h"
17 #include "MyGUI_LayerManager.h"
18 #include "MyGUI_RenderItem.h"
19 #include "MyGUI_ISubWidget.h"
20 #include "MyGUI_ISubWidgetText.h"
21 #include "MyGUI_TextBox.h"
22 #include "MyGUI_FactoryManager.h"
23 #include "MyGUI_CoordConverter.h"
24 #include "MyGUI_RenderManager.h"
25 #include "MyGUI_ToolTipManager.h"
26 #include "MyGUI_LayoutManager.h"
27 
28 namespace MyGUI
29 {
30 
32  mWidgetClient(nullptr),
33  mEnabled(true),
34  mInheritedEnabled(true),
35  mInheritedVisible(true),
36  mAlpha(ALPHA_MAX),
37  mRealAlpha(ALPHA_MAX),
38  mInheritsAlpha(true),
39  mParent(nullptr),
40  mWidgetStyle(WidgetStyle::Child),
41  mContainer(nullptr),
42  mAlign(Align::Default),
43  mVisible(true),
44  mDepth(0)
45  {
46  }
47 
48  void Widget::_initialise(WidgetStyle _style, const IntCoord& _coord, const std::string& _skinName, Widget* _parent, ICroppedRectangle* _croppedParent, const std::string& _name)
49  {
50  ResourceSkin* skinInfo = nullptr;
51  ResourceLayout* templateInfo = nullptr;
52 
53  if (LayoutManager::getInstance().isExist(_skinName))
54  templateInfo = LayoutManager::getInstance().getByName(_skinName);
55  else
56  skinInfo = SkinManager::getInstance().getByName(_skinName);
57 
58  mCoord = _coord;
59 
60  mAlign = Align::Default;
61  mWidgetStyle = _style;
62  mName = _name;
63 
64  mCroppedParent = _croppedParent;
65  mParent = _parent;
66 
67 
68 #if MYGUI_DEBUG_MODE == 1
69  // проверяем соответсвие входных данных
70  if (mWidgetStyle == WidgetStyle::Child)
71  {
72  MYGUI_ASSERT(mCroppedParent, "must be cropped");
73  MYGUI_ASSERT(mParent, "must be parent");
74  }
75  else if (mWidgetStyle == WidgetStyle::Overlapped)
76  {
77  MYGUI_ASSERT((mParent == nullptr) == (mCroppedParent == nullptr), "error cropped");
78  }
79  else if (mWidgetStyle == WidgetStyle::Popup)
80  {
81  MYGUI_ASSERT(!mCroppedParent, "cropped must be nullptr");
82  MYGUI_ASSERT(mParent, "must be parent");
83  }
84 #endif
85 
86  // корректируем абсолютные координаты
87  mAbsolutePosition = _coord.point();
88 
89  if (nullptr != mCroppedParent)
91 
92  const WidgetInfo* root = initialiseWidgetSkinBase(skinInfo, templateInfo);
93 
94  // дочернее окно обыкновенное
95  if (mWidgetStyle == WidgetStyle::Child)
96  {
97  if (mParent)
98  mParent->addChildItem(this);
99  }
100  // дочернее нуно перекрывающееся
101  else if (mWidgetStyle == WidgetStyle::Overlapped)
102  {
103  // дочернее перекрывающееся
104  if (mParent)
105  mParent->addChildNode(this);
106  }
107 
108  // витр метод для наследников
110 
111  if (skinInfo != nullptr)
112  setSkinProperty(skinInfo);
113 
114  if (root != nullptr)
115  {
116  for (VectorStringPairs::const_iterator iter = root->properties.begin(); iter != root->properties.end(); ++iter)
117  {
118  setProperty(iter->first, iter->second);
119  }
120  }
121  }
122 
124  {
125  eventWidgetDestroyed(this);
126 
128 
129  // витр метод для наследников
131 
132  shutdownWidgetSkinBase();
133 
135 
136  // дочернее окно обыкновенное
137  if (mWidgetStyle == WidgetStyle::Child)
138  {
139  if (mParent)
140  mParent->removeChildItem(this);
141  }
142  // дочернее нуно перекрывающееся
143  else if (mWidgetStyle == WidgetStyle::Overlapped)
144  {
145  // дочернее перекрывающееся
146  if (mParent)
147  mParent->removeChildNode(this);
148  }
149 
150  mParent = nullptr;
151  mCroppedParent = nullptr;
152  }
153 
154  void Widget::changeWidgetSkin(const std::string& _skinName)
155  {
156  ResourceSkin* skinInfo = nullptr;
157  ResourceLayout* templateInfo = nullptr;
158 
159  if (LayoutManager::getInstance().isExist(_skinName))
160  templateInfo = LayoutManager::getInstance().getByName(_skinName);
161  else
162  skinInfo = SkinManager::getInstance().getByName(_skinName);
163 
165 
166  saveLayerItem();
167 
168  shutdownWidgetSkinBase();
169  const WidgetInfo* root = initialiseWidgetSkinBase(skinInfo, templateInfo);
170 
172 
174 
175  if (skinInfo != nullptr)
176  setSkinProperty(skinInfo);
177 
178  if (root != nullptr)
179  {
180  for (VectorStringPairs::const_iterator iter = root->properties.begin(); iter != root->properties.end(); ++iter)
181  {
182  setProperty(iter->first, iter->second);
183  }
184  }
185  }
186 
187  const WidgetInfo* Widget::initialiseWidgetSkinBase(ResourceSkin* _skinInfo, ResourceLayout* _templateInfo)
188  {
189  const WidgetInfo* root = nullptr;
190  bool skinOnly = false;
191 
192  if (_skinInfo == nullptr)
193  {
194  skinOnly = true;
195  std::string skinName;
196 
197  const VectorWidgetInfo& data = _templateInfo->getLayoutData();
198  for (VectorWidgetInfo::const_iterator item = data.begin(); item != data.end(); ++item)
199  {
200  if ((*item).name == "Root")
201  {
202  skinName = (*item).skin;
203  root = &(*item);
204  break;
205  }
206  }
207 
208  _skinInfo = SkinManager::getInstance().getByName(skinName);
209  }
210 
211  //SAVE
212  const IntSize& _size = mCoord.size();
213 
214  if (_skinInfo != nullptr)
215  {
216  //FIXME - явный вызов
217  Widget::setSize(_skinInfo->getSize());
218 
219  _createSkinItem(_skinInfo);
220  }
221 
222  // выставляем альфу, корректировка по отцу автоматически
223  _updateAlpha();
224  _updateEnabled();
225  _updateVisible();
226 
227  if (!skinOnly)
228  {
229  const MapString& properties = _skinInfo->getProperties();
230  for (MapString::const_iterator item = properties.begin(); item != properties.end(); ++item)
231  {
232  if (BackwardCompatibility::isIgnoreProperty((*item).first))
233  setUserString((*item).first, (*item).second);
234  }
235 
236  // создаем детей скина
237  const VectorChildSkinInfo& child = _skinInfo->getChild();
238  for (VectorChildSkinInfo::const_iterator iter = child.begin(); iter != child.end(); ++iter)
239  {
240  Widget* widget = baseCreateWidget(iter->style, iter->type, iter->skin, iter->coord, iter->align, iter->layer, iter->name, true);
241  // заполняем UserString пропертями
242  for (MapString::const_iterator prop = iter->params.begin(); prop != iter->params.end(); ++prop)
243  widget->setUserString(prop->first, prop->second);
244  }
245  }
246 
247  if (root != nullptr)
248  {
249  //FIXME - явный вызов
250  Widget::setSize(root->intCoord.size());
251 
252  for (MapString::const_iterator iter = root->userStrings.begin(); iter != root->userStrings.end(); ++iter)
253  {
254  setUserString(iter->first, iter->second);
255  }
256 
257  for (VectorWidgetInfo::const_iterator iter = root->childWidgetsInfo.begin(); iter != root->childWidgetsInfo.end(); ++iter)
258  {
259  _templateInfo->createWidget(*iter, "", this, true);
260  }
261  }
262 
263  //FIXME - явный вызов
264  Widget::setSize(_size);
265 
266  return root;
267  }
268 
269  void Widget::shutdownWidgetSkinBase()
270  {
271  setMaskPick("");
272 
273  _deleteSkinItem();
274 
275  // удаляем виджеты чтобы ли в скине
276  for (VectorWidgetPtr::iterator iter = mWidgetChildSkin.begin(); iter != mWidgetChildSkin.end(); ++iter)
277  {
278  // Добавляем себя чтобы удалилось
279  mWidgetChild.push_back(*iter);
280  _destroyChildWidget(*iter);
281  }
282  mWidgetChildSkin.clear();
283 
284  mWidgetClient = nullptr;
285  }
286 
287  Widget* Widget::baseCreateWidget(WidgetStyle _style, const std::string& _type, const std::string& _skin, const IntCoord& _coord, Align _align, const std::string& _layer, const std::string& _name, bool _template)
288  {
289  Widget* widget = nullptr;
290 
291  if (_template)
292  {
293  widget = WidgetManager::getInstance().createWidget(_style, _type, _skin, _coord, this, _style == WidgetStyle::Popup ? nullptr : this, _name);
294  mWidgetChildSkin.push_back(widget);
295  }
296  else
297  {
298  if (mWidgetClient != nullptr)
299  {
300  widget = mWidgetClient->baseCreateWidget(_style, _type, _skin, _coord, _align, _layer, _name, _template);
301  onWidgetCreated(widget);
302  return widget;
303  }
304  else
305  {
306  widget = WidgetManager::getInstance().createWidget(_style, _type, _skin, _coord, this, _style == WidgetStyle::Popup ? nullptr : this, _name);
307  addWidget(widget);
308  }
309  }
310 
311  widget->setAlign(_align);
312 
313  // присоединяем виджет с уровню
314  if (!_layer.empty() && widget->isRootWidget())
316 
317  onWidgetCreated(widget);
318 
319  return widget;
320  }
321 
322  Widget* Widget::createWidgetRealT(const std::string& _type, const std::string& _skin, const FloatCoord& _coord, Align _align, const std::string& _name)
323  {
324  return createWidgetT(_type, _skin, CoordConverter::convertFromRelative(_coord, getSize()), _align, _name);
325  }
326 
328  {
329  bool margin = mCroppedParent ? _checkMargin() : false;
330 
331  // вьюпорт стал битым
332  if (margin)
333  {
334  // проверка на полный выход за границу
335  if (_checkOutside())
336  {
337  // запоминаем текущее состояние
338  mIsMargin = margin;
339 
340  // скрываем
341  _setSubSkinVisible(false);
342 
343  // вся иерархия должна быть проверенна
344  for (VectorWidgetPtr::iterator widget = mWidgetChild.begin(); widget != mWidgetChild.end(); ++widget)
345  (*widget)->_updateView();
346  for (VectorWidgetPtr::iterator widget = mWidgetChildSkin.begin(); widget != mWidgetChildSkin.end(); ++widget)
347  (*widget)->_updateView();
348 
349  return;
350  }
351  }
352  // мы не обрезаны и были нормальные
353  else if (!mIsMargin)
354  {
356  return;
357  }
358 
359  // запоминаем текущее состояние
360  mIsMargin = margin;
361 
362  // если скин был скрыт, то покажем
363  _setSubSkinVisible(true);
364 
365  // обновляем наших детей, а они уже решат обновлять ли своих детей
366  for (VectorWidgetPtr::iterator widget = mWidgetChild.begin(); widget != mWidgetChild.end(); ++widget)
367  (*widget)->_updateView();
368  for (VectorWidgetPtr::iterator widget = mWidgetChildSkin.begin(); widget != mWidgetChildSkin.end(); ++widget)
369  (*widget)->_updateView();
370 
372  }
373 
374  bool Widget::_setWidgetState(const std::string& _state)
375  {
376  return _setSkinItemState(_state);
377  }
378 
380  {
381  MYGUI_ASSERT(nullptr != _widget, "invalid widget pointer");
382 
383  if (mParent != nullptr && mParent->getClientWidget() == this)
384  mParent->onWidgetDestroy(_widget);
385 
386  onWidgetDestroy(_widget);
387 
388  VectorWidgetPtr::iterator iter = std::find(mWidgetChild.begin(), mWidgetChild.end(), _widget);
389  if (iter != mWidgetChild.end())
390  {
391  // сохраняем указатель
392  MyGUI::Widget* widget = *iter;
393 
394  // удаляем из списка
395  mWidgetChild.erase(iter);
396 
397  // отписываем от всех
399 
400  // непосредственное удаление
402  }
403  else
404  {
405  MYGUI_EXCEPT("Widget '" << _widget->getName() << "' not found");
406  }
407  }
408 
409  // удаляет всех детей
411  {
413  while (!mWidgetChild.empty())
414  {
415  // сразу себя отписывем, иначе вложенной удаление убивает все
416  Widget* widget = mWidgetChild.back();
417  mWidgetChild.pop_back();
418 
419  // отписываем от всех
420  manager.unlinkFromUnlinkers(widget);
421 
422  // и сами удалим, так как его больше в списке нет
424  }
425  }
426 
428  {
429  if (mWidgetClient != nullptr)
430  return mWidgetClient->getCoord();
431  return IntCoord(0, 0, mCoord.width, mCoord.height);
432  }
433 
434  void Widget::setAlpha(float _alpha)
435  {
436  if (mAlpha == _alpha)
437  return;
438  mAlpha = _alpha;
439 
440  _updateAlpha();
441  }
442 
443  void Widget::_updateAlpha()
444  {
445  if (nullptr != mParent)
446  mRealAlpha = mAlpha * (mInheritsAlpha ? mParent->_getRealAlpha() : ALPHA_MAX);
447  else
448  mRealAlpha = mAlpha;
449 
450  for (VectorWidgetPtr::iterator widget = mWidgetChild.begin(); widget != mWidgetChild.end(); ++widget)
451  (*widget)->_updateAlpha();
452  for (VectorWidgetPtr::iterator widget = mWidgetChildSkin.begin(); widget != mWidgetChildSkin.end(); ++widget)
453  (*widget)->_updateAlpha();
454 
455  _setSkinItemAlpha(mRealAlpha);
456  }
457 
458  void Widget::setInheritsAlpha(bool _inherits)
459  {
460  mInheritsAlpha = _inherits;
461  _updateAlpha();
462  }
463 
464  ILayerItem* Widget::getLayerItemByPoint(int _left, int _top) const
465  {
466  // проверяем попадание
467  if (!mEnabled
468  || !mInheritedVisible
469  || (!getNeedMouseFocus() && !getInheritsPick())
470  || !_checkPoint(_left, _top)
471  // если есть маска, проверяем еще и по маске
472  || !isMaskPickInside(IntPoint(_left - mCoord.left, _top - mCoord.top), mCoord)
473  )
474  return nullptr;
475 
476  // спрашиваем у детишек
477  for (VectorWidgetPtr::const_reverse_iterator widget = mWidgetChild.rbegin(); widget != mWidgetChild.rend(); ++widget)
478  {
479  // общаемся только с послушными детьми
480  if ((*widget)->mWidgetStyle == WidgetStyle::Popup)
481  continue;
482 
483  ILayerItem* item = (*widget)->getLayerItemByPoint(_left - mCoord.left, _top - mCoord.top);
484  if (item != nullptr)
485  return item;
486  }
487  // спрашиваем у детишек скина
488  for (VectorWidgetPtr::const_reverse_iterator widget = mWidgetChildSkin.rbegin(); widget != mWidgetChildSkin.rend(); ++widget)
489  {
490  ILayerItem* item = (*widget)->getLayerItemByPoint(_left - mCoord.left, _top - mCoord.top);
491  if (item != nullptr)
492  return item;
493  }
494 
495  // непослушные дети
496  return getInheritsPick() ? nullptr : const_cast<Widget*>(this);
497  }
498 
499  void Widget::_updateAbsolutePoint()
500  {
501  // мы рут, нам не надо
502  if (!mCroppedParent)
503  return;
504 
506 
507  for (VectorWidgetPtr::iterator widget = mWidgetChild.begin(); widget != mWidgetChild.end(); ++widget)
508  (*widget)->_updateAbsolutePoint();
509  for (VectorWidgetPtr::iterator widget = mWidgetChildSkin.begin(); widget != mWidgetChildSkin.end(); ++widget)
510  (*widget)->_updateAbsolutePoint();
511 
513  }
514 
515  void Widget::_forcePick(Widget* _widget)
516  {
517  if (mWidgetClient != nullptr)
518  {
519  mWidgetClient->_forcePick(_widget);
520  return;
521  }
522 
523  VectorWidgetPtr::iterator iter = std::find(mWidgetChild.begin(), mWidgetChild.end(), _widget);
524  if (iter == mWidgetChild.end())
525  return;
526 
527  VectorWidgetPtr copy = mWidgetChild;
528  for (VectorWidgetPtr::iterator widget = copy.begin(); widget != copy.end(); ++widget)
529  {
530  if ((*widget) == _widget)
531  (*widget)->setDepth(-1);
532  else if ((*widget)->getDepth() == -1)
533  (*widget)->setDepth(0);
534  }
535  }
536 
537  Widget* Widget::findWidget(const std::string& _name)
538  {
539  if (_name == mName)
540  return this;
541  if (mWidgetClient != nullptr)
542  return mWidgetClient->findWidget(_name);
543 
544  for (VectorWidgetPtr::iterator widget = mWidgetChild.begin(); widget != mWidgetChild.end(); ++widget)
545  {
546  Widget* find = (*widget)->findWidget(_name);
547  if (nullptr != find)
548  return find;
549  }
550  return nullptr;
551  }
552 
554  {
556  }
557 
558  void Widget::setRealSize(const FloatSize& _size)
559  {
561  }
562 
563  void Widget::setRealCoord(const FloatCoord& _coord)
564  {
566  }
567 
568  void Widget::_setAlign(const IntSize& _oldsize, const IntSize& _newSize)
569  {
570  const IntSize& size = _newSize;//getParentSize();
571 
572  bool need_move = false;
573  bool need_size = false;
574  IntCoord coord = mCoord;
575 
576  // первоначальное выравнивание
577  if (mAlign.isHStretch())
578  {
579  // растягиваем
580  coord.width = mCoord.width + (size.width - _oldsize.width);
581  need_size = true;
582  }
583  else if (mAlign.isRight())
584  {
585  // двигаем по правому краю
586  coord.left = mCoord.left + (size.width - _oldsize.width);
587  need_move = true;
588  }
589  else if (mAlign.isHCenter())
590  {
591  // выравнивание по горизонтали без растяжения
592  coord.left = (size.width - mCoord.width) / 2;
593  need_move = true;
594  }
595 
596  if (mAlign.isVStretch())
597  {
598  // растягиваем
599  coord.height = mCoord.height + (size.height - _oldsize.height);
600  need_size = true;
601  }
602  else if (mAlign.isBottom())
603  {
604  // двигаем по нижнему краю
605  coord.top = mCoord.top + (size.height - _oldsize.height);
606  need_move = true;
607  }
608  else if (mAlign.isVCenter())
609  {
610  // выравнивание по вертикали без растяжения
611  coord.top = (size.height - mCoord.height) / 2;
612  need_move = true;
613  }
614 
615  if (need_move)
616  {
617  if (need_size)
618  setCoord(coord);
619  else
620  setPosition(coord.point());
621  }
622  else if (need_size)
623  {
624  setSize(coord.size());
625  }
626  else
627  {
628  _updateView(); // только если не вызвано передвижение и сайз
629  }
630  }
631 
632  void Widget::setPosition(const IntPoint& _point)
633  {
634  // обновляем абсолютные координаты
635  mAbsolutePosition += _point - mCoord.point();
636 
637  for (VectorWidgetPtr::iterator widget = mWidgetChild.begin(); widget != mWidgetChild.end(); ++widget)
638  (*widget)->_updateAbsolutePoint();
639  for (VectorWidgetPtr::iterator widget = mWidgetChildSkin.begin(); widget != mWidgetChildSkin.end(); ++widget)
640  (*widget)->_updateAbsolutePoint();
641 
642  mCoord = _point;
643 
644  _updateView();
645 
646  eventChangeCoord(this);
647  }
648 
649  void Widget::setSize(const IntSize& _size)
650  {
651  // устанавливаем новую координату а старую пускаем в расчеты
652  IntSize old = mCoord.size();
653  mCoord = _size;
654 
655  bool visible = true;
656 
657  // обновляем выравнивание
658  bool margin = mCroppedParent ? _checkMargin() : false;
659 
660  if (margin)
661  {
662  // проверка на полный выход за границу
663  if (_checkOutside())
664  {
665  // скрываем
666  visible = false;
667  }
668  }
669 
670  _setSubSkinVisible(visible);
671 
672  // передаем старую координату , до вызова, текущая координата отца должна быть новой
673  for (VectorWidgetPtr::iterator widget = mWidgetChild.begin(); widget != mWidgetChild.end(); ++widget)
674  (*widget)->_setAlign(old, getSize());
675  for (VectorWidgetPtr::iterator widget = mWidgetChildSkin.begin(); widget != mWidgetChildSkin.end(); ++widget)
676  (*widget)->_setAlign(old, getSize());
677 
678  _setSkinItemAlign(old);
679 
680  // запоминаем текущее состояние
681  mIsMargin = margin;
682 
683  eventChangeCoord(this);
684  }
685 
686  void Widget::setCoord(const IntCoord& _coord)
687  {
688  // обновляем абсолютные координаты
689  mAbsolutePosition += _coord.point() - mCoord.point();
690 
691  for (VectorWidgetPtr::iterator widget = mWidgetChild.begin(); widget != mWidgetChild.end(); ++widget)
692  (*widget)->_updateAbsolutePoint();
693  for (VectorWidgetPtr::iterator widget = mWidgetChildSkin.begin(); widget != mWidgetChildSkin.end(); ++widget)
694  (*widget)->_updateAbsolutePoint();
695 
696  // устанавливаем новую координату а старую пускаем в расчеты
697  IntCoord old = mCoord;
698  mCoord = _coord;
699 
700  bool visible = true;
701 
702  // обновляем выравнивание
703  bool margin = mCroppedParent ? _checkMargin() : false;
704 
705  if (margin)
706  {
707  // проверка на полный выход за границу
708  if (_checkOutside())
709  {
710  // скрываем
711  visible = false;
712  }
713  }
714 
715  _setSubSkinVisible(visible);
716 
717  // передаем старую координату , до вызова, текущая координата отца должна быть новой
718  for (VectorWidgetPtr::iterator widget = mWidgetChild.begin(); widget != mWidgetChild.end(); ++widget)
719  (*widget)->_setAlign(old.size(), getSize());
720  for (VectorWidgetPtr::iterator widget = mWidgetChildSkin.begin(); widget != mWidgetChildSkin.end(); ++widget)
721  (*widget)->_setAlign(old.size(), getSize());
722 
723  _setSkinItemAlign(old.size());
724 
725  // запоминаем текущее состояние
726  mIsMargin = margin;
727 
728  eventChangeCoord(this);
729  }
730 
731  void Widget::setAlign(Align _value)
732  {
733  mAlign = _value;
734  }
735 
736  void Widget::detachFromWidget(const std::string& _layer)
737  {
738  std::string oldlayer = getLayer() != nullptr ? getLayer()->getName() : "";
739 
740  Widget* parent = getParent();
741  if (parent)
742  {
743  // отдетачиваемся от лееров
744  if ( ! isRootWidget() )
745  {
747 
748  if (mWidgetStyle == WidgetStyle::Child)
749  {
750  mParent->removeChildItem(this);
751  }
752  else if (mWidgetStyle == WidgetStyle::Overlapped)
753  {
754  mParent->removeChildNode(this);
755  }
756 
757  mWidgetStyle = WidgetStyle::Overlapped;
758 
759  mCroppedParent = nullptr;
760 
761  // обновляем координаты
763 
764  for (VectorWidgetPtr::iterator widget = mWidgetChild.begin(); widget != mWidgetChild.end(); ++widget)
765  (*widget)->_updateAbsolutePoint();
766  for (VectorWidgetPtr::iterator widget = mWidgetChildSkin.begin(); widget != mWidgetChildSkin.end(); ++widget)
767  (*widget)->_updateAbsolutePoint();
768 
769  // сбрасываем обрезку
770  mMargin.clear();
771 
772  _updateView();
773  }
774 
775  // нам нужен самый рутовый парент
776  while (parent->getParent())
777  parent = parent->getParent();
778 
779  //mIWidgetCreator = parent->mIWidgetCreator;
780  //mIWidgetCreator->_linkChildWidget(this);
782  mParent->_unlinkChildWidget(this);
783  mParent = nullptr;
784  }
785 
786  if (!_layer.empty())
787  {
789  }
790  else if (!oldlayer.empty())
791  {
793  }
794 
795  _updateAlpha();
796  }
797 
798  void Widget::attachToWidget(Widget* _parent, WidgetStyle _style, const std::string& _layer)
799  {
800  MYGUI_ASSERT(_parent, "parent must be valid");
801  MYGUI_ASSERT(_parent != this, "cyclic attach (attaching to self)");
802 
803  // attach to client if widget have it
804  if (_parent->getClientWidget())
805  _parent = _parent->getClientWidget();
806 
807  // проверяем на цикличность атача
808  Widget* parent = _parent;
809  while (parent->getParent())
810  {
811  MYGUI_ASSERT(parent != this, "cyclic attach");
812  parent = parent->getParent();
813  }
814 
815  // отдетачиваемся от всего
817 
818  mWidgetStyle = _style;
819 
820  if (_style == WidgetStyle::Popup)
821  {
822  //mIWidgetCreator->_unlinkChildWidget(this);
823  //mIWidgetCreator = _parent;
824  if (mParent == nullptr)
826  else
827  mParent->_unlinkChildWidget(this);
828 
829  mParent = _parent;
830  mParent->_linkChildWidget(this);
831 
832  mCroppedParent = nullptr;
833 
834  if (!_layer.empty())
835  {
837  }
838  }
839  else if (_style == WidgetStyle::Child)
840  {
842 
843  //mIWidgetCreator->_unlinkChildWidget(this);
844  //mIWidgetCreator = _parent;
845  if (mParent == nullptr)
847  else
848  mParent->_unlinkChildWidget(this);
849 
850  mParent = _parent;
851  mParent->_linkChildWidget(this);
852 
853  mCroppedParent = _parent;
855 
856  for (VectorWidgetPtr::iterator widget = mWidgetChild.begin(); widget != mWidgetChild.end(); ++widget)
857  (*widget)->_updateAbsolutePoint();
858  for (VectorWidgetPtr::iterator widget = mWidgetChildSkin.begin(); widget != mWidgetChildSkin.end(); ++widget)
859  (*widget)->_updateAbsolutePoint();
860 
861  mParent->addChildItem(this);
862 
863  _updateView();
864  }
865  else if (_style == WidgetStyle::Overlapped)
866  {
868 
869  //mIWidgetCreator->_unlinkChildWidget(this);
870  //mIWidgetCreator = _parent;
871  if (mParent == nullptr)
873  else
874  mParent->_unlinkChildWidget(this);
875 
876  mParent = _parent;
877  mParent->_linkChildWidget(this);
878 
879  mCroppedParent = _parent;
881 
882  for (VectorWidgetPtr::iterator widget = mWidgetChild.begin(); widget != mWidgetChild.end(); ++widget)
883  (*widget)->_updateAbsolutePoint();
884  for (VectorWidgetPtr::iterator widget = mWidgetChildSkin.begin(); widget != mWidgetChildSkin.end(); ++widget)
885  (*widget)->_updateAbsolutePoint();
886 
887  mParent->addChildNode(this);
888 
889  _updateView();
890  }
891 
892  _updateAlpha();
893  }
894 
895  void Widget::setWidgetStyle(WidgetStyle _style, const std::string& _layer)
896  {
897  if (_style == mWidgetStyle)
898  return;
899  if (nullptr == getParent())
900  return;
901 
902  Widget* parent = mParent;
903 
905  attachToWidget(parent, _style, _layer);
906  // ищем леер к которому мы присоедененны
907  }
908 
909  Widget* Widget::createWidgetT(const std::string& _type, const std::string& _skin, const IntCoord& _coord, Align _align, const std::string& _name)
910  {
911  return baseCreateWidget(WidgetStyle::Child, _type, _skin, _coord, _align, "", _name, false);
912  }
913 
914  Widget* Widget::createWidgetT(const std::string& _type, const std::string& _skin, int _left, int _top, int _width, int _height, Align _align, const std::string& _name)
915  {
916  return createWidgetT(_type, _skin, IntCoord(_left, _top, _width, _height), _align, _name);
917  }
918 
919  Widget* Widget::createWidgetRealT(const std::string& _type, const std::string& _skin, float _left, float _top, float _width, float _height, Align _align, const std::string& _name)
920  {
921  return createWidgetRealT(_type, _skin, FloatCoord(_left, _top, _width, _height), _align, _name);
922  }
923 
924  Widget* Widget::createWidgetT(WidgetStyle _style, const std::string& _type, const std::string& _skin, const IntCoord& _coord, Align _align, const std::string& _layer, const std::string& _name)
925  {
926  return baseCreateWidget(_style, _type, _skin, _coord, _align, _layer, _name, false);
927  }
928 
930  {
931  if (mWidgetClient != nullptr)
932  return mWidgetClient->getEnumerator();
933  return Enumerator<VectorWidgetPtr>(mWidgetChild.begin(), mWidgetChild.end());
934  }
935 
936  size_t Widget::getChildCount() const
937  {
938  if (mWidgetClient != nullptr)
939  return mWidgetClient->getChildCount();
940  return mWidgetChild.size();
941  }
942 
943  Widget* Widget::getChildAt(size_t _index) const
944  {
945  if (mWidgetClient != nullptr)
946  return mWidgetClient->getChildAt(_index);
947  MYGUI_ASSERT_RANGE(_index, mWidgetChild.size(), "Widget::getChildAt");
948  return mWidgetChild[_index];
949  }
950 
952  {
953  if (getInheritedEnabled())
954  _setWidgetState("normal");
955  else
956  _setWidgetState("disabled");
957  }
958 
959  void Widget::setVisible(bool _value)
960  {
961  if (mVisible == _value)
962  return;
963  mVisible = _value;
964 
965  _updateVisible();
966  }
967 
968  void Widget::_updateVisible()
969  {
970  mInheritedVisible = mParent == nullptr || mParent->getInheritedVisible();
971  mInheritedVisible = mVisible && mInheritedVisible;
972 
973  _setSkinItemVisible(mInheritedVisible);
974 
975  for (VectorWidgetPtr::iterator widget = mWidgetChild.begin(); widget != mWidgetChild.end(); ++widget)
976  (*widget)->_updateVisible();
977  for (VectorWidgetPtr::iterator widget = mWidgetChildSkin.begin(); widget != mWidgetChildSkin.end(); ++widget)
978  (*widget)->_updateVisible();
979 
980  if (!mInheritedVisible && InputManager::getInstance().getMouseFocusWidget() == this)
982  if (!mInheritedVisible && InputManager::getInstance().getKeyFocusWidget() == this)
984  }
985 
986  void Widget::setEnabled(bool _value)
987  {
988  if (mEnabled == _value)
989  return;
990  mEnabled = _value;
991 
992  _updateEnabled();
993  }
994 
995  void Widget::_updateEnabled()
996  {
997  mInheritedEnabled = mParent == nullptr || (mParent->getInheritedEnabled());
998  mInheritedEnabled = mInheritedEnabled && mEnabled;
999 
1000  for (VectorWidgetPtr::iterator iter = mWidgetChild.begin(); iter != mWidgetChild.end(); ++iter)
1001  (*iter)->_updateEnabled();
1002  for (VectorWidgetPtr::iterator iter = mWidgetChildSkin.begin(); iter != mWidgetChildSkin.end(); ++iter)
1003  (*iter)->_updateEnabled();
1004 
1005  baseUpdateEnable();
1006 
1007  if (!mInheritedEnabled)
1009  }
1010 
1011  void Widget::setColour(const Colour& _value)
1012  {
1013  _setSkinItemColour(_value);
1014 
1015  for (VectorWidgetPtr::iterator widget = mWidgetChildSkin.begin(); widget != mWidgetChildSkin.end(); ++widget)
1016  (*widget)->setColour(_value);
1017  }
1018 
1020  {
1021  if (mCroppedParent)
1022  return static_cast<Widget*>(mCroppedParent)->getSize();
1023  if (getLayer())
1024  return getLayer()->getSize();
1025 
1027  }
1028 
1029  void Widget::_resetContainer(bool _updateOnly)
1030  {
1031  if (getNeedToolTip())
1033  }
1034 
1035  bool Widget::_checkPoint(int _left, int _top) const
1036  {
1037  return ! ((_getViewLeft() > _left) || (_getViewTop() > _top) || (_getViewRight() < _left) || (_getViewBottom() < _top));
1038  }
1039 
1040  void Widget::_linkChildWidget(Widget* _widget)
1041  {
1042  VectorWidgetPtr::iterator iter = std::find(mWidgetChild.begin(), mWidgetChild.end(), _widget);
1043  MYGUI_ASSERT(iter == mWidgetChild.end(), "widget already exist");
1044  addWidget(_widget);
1045  }
1046 
1047  void Widget::_unlinkChildWidget(Widget* _widget)
1048  {
1049  VectorWidgetPtr::iterator iter = std::remove(mWidgetChild.begin(), mWidgetChild.end(), _widget);
1050  MYGUI_ASSERT(iter != mWidgetChild.end(), "widget not found");
1051  mWidgetChild.erase(iter);
1052  }
1053 
1055  {
1056  }
1057 
1059  {
1061  assignWidget(mWidgetClient, "Client");
1062  }
1063 
1064  void Widget::setSkinProperty(ResourceSkin* _info)
1065  {
1066  const MapString& properties = _info->getProperties();
1067  for (MapString::const_iterator item = properties.begin(); item != properties.end(); ++item)
1068  setProperty((*item).first, (*item).second);
1069  }
1070 
1071  void Widget::setProperty(const std::string& _key, const std::string& _value)
1072  {
1073  std::string key = _key;
1074  std::string value = _value;
1075 
1076  if (BackwardCompatibility::checkProperty(this, key, value))
1077  {
1078  size_t index = key.find("_");
1079  if (index != std::string::npos)
1080  {
1081  MYGUI_LOG(Warning, "Widget property '" << key << "' have type prefix - use '" << key.substr(index + 1) << "' instead [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1082  key = key.substr(index + 1);
1083  }
1084 
1085  setPropertyOverride(key, value);
1086  }
1087  }
1088 
1089  VectorWidgetPtr Widget::getSkinWidgetsByName(const std::string& _name) const
1090  {
1091  VectorWidgetPtr result;
1092 
1093  for (const auto& childSkin : mWidgetChildSkin)
1094  childSkin->findWidgets(_name, result);
1095 
1096  return result;
1097  }
1098 
1099  void Widget::findWidgets(const std::string& _name, VectorWidgetPtr& _result)
1100  {
1101  if (_name == mName)
1102  _result.push_back(this);
1103 
1104  if (mWidgetClient != nullptr)
1105  {
1106  mWidgetClient->findWidgets(_name, _result);
1107  }
1108  else
1109  {
1110  for (VectorWidgetPtr::iterator widget = mWidgetChild.begin(); widget != mWidgetChild.end(); ++widget)
1111  (*widget)->findWidgets(_name, _result);
1112  }
1113  }
1114 
1116  {
1117  }
1118 
1120  {
1121  }
1122 
1124  {
1125  MYGUI_ASSERT(mWidgetClient != this, "mWidgetClient can not be this widget");
1126  mWidgetClient = _widget;
1127  }
1128 
1130  {
1131  return getClientWidget() == nullptr ? this : getClientWidget();
1132  }
1133 
1135  {
1136  return getClientWidget() == nullptr ? this : getClientWidget();
1137  }
1138 
1139  Widget* Widget::_createSkinWidget(WidgetStyle _style, const std::string& _type, const std::string& _skin, const IntCoord& _coord, Align _align, const std::string& _layer, const std::string& _name)
1140  {
1141  return baseCreateWidget(_style, _type, _skin, _coord, _align, _layer, _name, true);
1142  }
1143 
1144  void Widget::setPropertyOverride(const std::string& _key, const std::string& _value)
1145  {
1147  if (_key == "Position")
1148  setPosition(utility::parseValue<IntPoint>(_value));
1149 
1151  else if (_key == "Size")
1152  setSize(utility::parseValue<IntSize>(_value));
1153 
1155  else if (_key == "Coord")
1156  setCoord(utility::parseValue<IntCoord>(_value));
1157 
1159  else if (_key == "Visible")
1160  setVisible(utility::parseValue<bool>(_value));
1161 
1163  else if (_key == "Depth")
1164  setDepth(utility::parseValue<int>(_value));
1165 
1167  else if (_key == "Alpha")
1168  setAlpha(utility::parseValue<float>(_value));
1169 
1171  else if (_key == "Colour")
1172  setColour(utility::parseValue<Colour>(_value));
1173 
1175  else if (_key == "InheritsAlpha")
1176  setInheritsAlpha(utility::parseValue<bool>(_value));
1177 
1179  else if (_key == "InheritsPick")
1180  setInheritsPick(utility::parseValue<bool>(_value));
1181 
1183  else if (_key == "MaskPick")
1184  setMaskPick(_value);
1185 
1187  else if (_key == "NeedKey")
1188  setNeedKeyFocus(utility::parseValue<bool>(_value));
1189 
1191  else if (_key == "NeedMouse")
1192  setNeedMouseFocus(utility::parseValue<bool>(_value));
1193 
1195  else if (_key == "Enabled")
1196  setEnabled(utility::parseValue<bool>(_value));
1197 
1199  else if (_key == "NeedToolTip")
1200  setNeedToolTip(utility::parseValue<bool>(_value));
1201 
1203  else if (_key == "Pointer")
1204  setPointer(_value);
1205 
1206  else
1207  {
1208  MYGUI_LOG(Warning, "Widget '" << getName() << "|" << getTypeName() << "' have unknown property '" << _key << "' " << " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
1209  return;
1210  }
1211 
1212  eventChangeProperty(this, _key, _value);
1213  }
1214 
1215  void Widget::setPosition(int _left, int _top)
1216  {
1217  setPosition(IntPoint(_left, _top));
1218  }
1219 
1220  void Widget::setSize(int _width, int _height)
1221  {
1222  setSize(IntSize(_width, _height));
1223  }
1224 
1225  void Widget::setCoord(int _left, int _top, int _width, int _height)
1226  {
1227  setCoord(IntCoord(_left, _top, _width, _height));
1228  }
1229 
1230  void Widget::setRealPosition(float _left, float _top)
1231  {
1232  setRealPosition(FloatPoint(_left, _top));
1233  }
1234 
1235  void Widget::setRealSize(float _width, float _height)
1236  {
1237  setRealSize(FloatSize(_width, _height));
1238  }
1239 
1240  void Widget::setRealCoord(float _left, float _top, float _width, float _height)
1241  {
1242  setRealCoord(FloatCoord(_left, _top, _width, _height));
1243  }
1244 
1245  const std::string& Widget::getName() const
1246  {
1247  return mName;
1248  }
1249 
1250  bool Widget::getVisible() const
1251  {
1252  return mVisible;
1253  }
1254 
1256  {
1257  return mAlign;
1258  }
1259 
1260  float Widget::getAlpha() const
1261  {
1262  return mAlpha;
1263  }
1264 
1266  {
1267  return mInheritsAlpha;
1268  }
1269 
1271  {
1272  return nullptr == mCroppedParent;
1273  }
1274 
1276  {
1277  return mParent;
1278  }
1279 
1280  void Widget::setEnabledSilent(bool _value)
1281  {
1282  mEnabled = _value;
1283  }
1284 
1285  bool Widget::getEnabled() const
1286  {
1287  return mEnabled;
1288  }
1289 
1291  {
1292  return mWidgetClient;
1293  }
1294 
1296  {
1297  return mWidgetClient;
1298  }
1299 
1301  {
1302  return mWidgetStyle;
1303  }
1304 
1305  size_t Widget::_getItemIndex(Widget* _item) const
1306  {
1307  return ITEM_NONE;
1308  }
1309 
1311  {
1312  mContainer = _value;
1313  }
1314 
1316  {
1317  return mContainer;
1318  }
1319 
1320  size_t Widget::_getContainerIndex(const IntPoint& _point) const
1321  {
1322  return ITEM_NONE;
1323  }
1324 
1326  {
1327  return mCoord;
1328  }
1329 
1330  float Widget::_getRealAlpha() const
1331  {
1332  return mRealAlpha;
1333  }
1334 
1336  {
1337  return mInheritedEnabled;
1338  }
1339 
1341  {
1342  return mInheritedVisible;
1343  }
1344 
1345  void Widget::resizeLayerItemView(const IntSize& _oldView, const IntSize& _newView)
1346  {
1347  _setAlign(_oldView, _newView);
1348  }
1349 
1350  void Widget::setDepth(int _value)
1351  {
1352  if (mDepth == _value)
1353  return;
1354 
1355  mDepth = _value;
1356 
1357  if (mParent != nullptr)
1358  {
1359  mParent->_unlinkChildWidget(this);
1360  mParent->_linkChildWidget(this);
1361  mParent->_updateChilds();
1362  }
1363  }
1364 
1365  int Widget::getDepth() const
1366  {
1367  return mDepth;
1368  }
1369 
1370  void Widget::addWidget(Widget* _widget)
1371  {
1372  // сортировка глубины от большого к меньшему
1373 
1374  int depth = _widget->getDepth();
1375 
1376  for (size_t index = 0; index < mWidgetChild.size(); ++index)
1377  {
1378  Widget* widget = mWidgetChild[index];
1379  if (widget->getDepth() < depth)
1380  {
1381  mWidgetChild.insert(mWidgetChild.begin() + index, _widget);
1382  _updateChilds();
1383  return;
1384  }
1385  }
1386 
1387  mWidgetChild.push_back(_widget);
1388  }
1389 
1391  {
1392  for (VectorWidgetPtr::iterator widget = mWidgetChild.begin(); widget != mWidgetChild.end(); ++widget)
1393  {
1394  if ((*widget)->getWidgetStyle() == WidgetStyle::Child)
1395  {
1396  (*widget)->detachFromLayerItemNode(false);
1397  removeChildItem((*widget));
1398  }
1399  }
1400 
1401  for (VectorWidgetPtr::iterator widget = mWidgetChild.begin(); widget != mWidgetChild.end(); ++widget)
1402  {
1403  if ((*widget)->getWidgetStyle() == WidgetStyle::Child)
1404  {
1405  addChildItem((*widget));
1406  (*widget)->_updateView();
1407  }
1408  }
1409  }
1410 
1411 } // namespace MyGUI
#define MYGUI_ASSERT(exp, dest)
#define MYGUI_EXCEPT(dest)
#define MYGUI_ASSERT_RANGE(index, size, owner)
#define MYGUI_LOG(level, text)
static AnyEmpty Null
Definition: MyGUI_Any.h:59
static bool isIgnoreProperty(const std::string &_key)
static bool checkProperty(Widget *_owner, std::string &_key, std::string &_value)
static IntCoord convertFromRelative(const FloatCoord &_coord, const IntSize &_view)
void _unlinkChildWidget(Widget *_widget)
Definition: MyGUI_Gui.cpp:277
void _linkChildWidget(Widget *_widget)
Definition: MyGUI_Gui.cpp:270
static Gui & getInstance()
const IntCoord & getCoord() const
ICroppedRectangle * mCroppedParent
const IntPoint & getAbsolutePosition() const
const std::string & getName() const
Definition: MyGUI_ILayer.h:29
virtual const IntSize & getSize() const =0
virtual ILayerItem * getLayerItemByPoint(int _left, int _top) const =0
void unlinkWidget(Widget *_widget)
void resetKeyFocusWidget(Widget *_widget)
static InputManager & getInstance()
void removeChildNode(LayerItem *_item)
void detachFromLayerItemNode(bool _deep)
void addChildItem(LayerItem *_item)
void addChildNode(LayerItem *_item)
void removeChildItem(LayerItem *_item)
ILayer * getLayer() const
void detachFromLayer(Widget *_item)
static LayerManager & getInstance()
void attachToLayerNode(const std::string &_name, Widget *_item)
const std::string & getCurrentLayout() const
ResourceLayout * getByName(const std::string &_name, bool _throw=true) const
static LayoutManager & getInstance()
virtual const IntSize & getViewSize() const =0
static RenderManager & getInstance()
const VectorWidgetInfo & getLayoutData() const
Widget * createWidget(const WidgetInfo &_widgetInfo, const std::string &_prefix="", Widget *_parent=nullptr, bool _template=false)
const IntSize & getSize() const
const MapString & getProperties() const
const VectorChildSkinInfo & getChild() const
void _correctSkinItemView()
void _setSkinItemAlpha(float _value)
void _createSkinItem(ResourceSkin *_info)
void _setSkinItemColour(const Colour &_value)
bool _setSkinItemState(const std::string &_state)
void _updateSkinItemView()
void _setSubSkinVisible(bool _visible)
void _setSkinItemAlign(const IntSize &_size)
void _setSkinItemVisible(bool _value)
ResourceSkin * getByName(const std::string &_name) const
static SkinManager & getInstance()
static ToolTipManager & getInstance()
void _unlinkWidget(Widget *_widget) override
void setUserData(Any _data)
void setUserString(const std::string &_key, const std::string &_value)
widget description should be here.
Definition: MyGUI_Widget.h:37
Widget * getParent() const
void attachToWidget(Widget *_parent, WidgetStyle _style=WidgetStyle::Child, const std::string &_layer="")
void detachFromWidget(const std::string &_layer="")
bool getInheritedEnabled() const
void _destroyAllChildWidget()
void setCoord(const IntCoord &_value) override
VectorWidgetPtr getSkinWidgetsByName(const std::string &_name) const
void setAlpha(float _value)
Widget * createWidgetT(const std::string &_type, const std::string &_skin, const IntCoord &_coord, Align _align, const std::string &_name="")
ILayerItem * getLayerItemByPoint(int _left, int _top) const override
void setProperty(const std::string &_key, const std::string &_value)
bool _checkPoint(int _left, int _top) const
void _destroyChildWidget(Widget *_widget)
virtual void onWidgetDestroy(Widget *_widget)
EventHandle_WidgetStringString eventChangeProperty
Definition: MyGUI_Widget.h:267
bool _setWidgetState(const std::string &_value)
void setWidgetStyle(WidgetStyle _style, const std::string &_layer="")
void assignWidget(T *&_widget, const std::string &_name)
Definition: MyGUI_Widget.h:335
virtual void initialiseOverride()
Widget * findWidget(const std::string &_name)
size_t getChildCount() const
const std::string & getName() const
Get name of widget.
Widget * getChildAt(size_t _index) const
virtual void setVisible(bool _value)
bool getEnabled() const
void setRealPosition(const FloatPoint &_value)
void _setAlign(const IntSize &_oldsize, const IntSize &_newSize)
virtual void baseUpdateEnable()
virtual void setEnabled(bool _value)
void setPosition(const IntPoint &_value) override
Widget * _createSkinWidget(WidgetStyle _style, const std::string &_type, const std::string &_skin, const IntCoord &_coord, Align _align, const std::string &_layer="", const std::string &_name="")
const IntCoord & getLayerItemCoord() const override
IntSize getParentSize() const
void setRealCoord(const FloatCoord &_value)
bool getVisible() const
void setInheritsAlpha(bool _value)
void setSize(const IntSize &_value) override
void setDepth(int _value)
virtual const std::string & getTypeName() const override
Definition: MyGUI_Widget.h:41
Widget * getClientWidget()
IntCoord getClientCoord() const
bool isRootWidget() const
Align getAlign() const
EventHandle_WidgetVoid eventChangeCoord
Definition: MyGUI_Widget.h:273
virtual void onWidgetCreated(Widget *_widget)
virtual void setAlign(Align _value)
void _initialise(WidgetStyle _style, const IntCoord &_coord, const std::string &_skinName, Widget *_parent, ICroppedRectangle *_croppedParent, const std::string &_name)
int getDepth() const
void changeWidgetSkin(const std::string &_skinName)
virtual void _resetContainer(bool _update)
WidgetStyle getWidgetStyle() const
bool getInheritsAlpha() const
void setWidgetClient(Widget *_widget)
float getAlpha() const
void setColour(const Colour &_value)
Widget * _getContainer() const
virtual void setPropertyOverride(const std::string &_key, const std::string &_value)
void _setContainer(Widget *_value)
virtual size_t _getContainerIndex(const IntPoint &_point) const
void setRealSize(const FloatSize &_value)
void _forcePick(Widget *_widget)
Widget * createWidgetRealT(const std::string &_type, const std::string &_skin, const FloatCoord &_coord, Align _align, const std::string &_name="")
EventHandle_WidgetVoid eventWidgetDestroyed
Definition: MyGUI_Widget.h:279
void findWidgets(const std::string &_name, VectorWidgetPtr &_result)
virtual size_t _getItemIndex(Widget *_item) const
virtual void shutdownOverride()
void setEnabledSilent(bool _value)
EnumeratorWidgetPtr getEnumerator() const
Widget * _getClientWidget()
If there is client widget return it, otherwise return this.
Widget * baseCreateWidget(WidgetStyle _style, const std::string &_type, const std::string &_skin, const IntCoord &_coord, Align _align, const std::string &_layer, const std::string &_name, bool _template)
bool getInheritedVisible() const
void setPointer(const std::string &_value)
bool getInheritsPick() const
void setNeedMouseFocus(bool _value)
void setMaskPick(const std::string &_filename)
void setNeedKeyFocus(bool _value)
bool getNeedMouseFocus() const
bool isMaskPickInside(const IntPoint &_point, const IntCoord &_coord) const
void setInheritsPick(bool _value)
void setNeedToolTip(bool _value)
static WidgetManager & getInstance()
Widget * createWidget(WidgetStyle _style, const std::string &_type, const std::string &_skin, const IntCoord &_coord, Widget *_parent, ICroppedRectangle *_cropeedParent, const std::string &_name)
void _deleteWidget(Widget *_widget)
void unlinkFromUnlinkers(Widget *_widget)
types::TSize< float > FloatSize
Definition: MyGUI_Types.h:30
std::map< std::string, std::string > MapString
Definition: MyGUI_Types.h:39
types::TCoord< float > FloatCoord
Definition: MyGUI_Types.h:36
std::vector< WidgetInfo > VectorWidgetInfo
types::TCoord< int > IntCoord
Definition: MyGUI_Types.h:35
std::vector< ChildSkinInfo > VectorChildSkinInfo
std::vector< Widget * > VectorWidgetPtr
types::TPoint< float > FloatPoint
Definition: MyGUI_Types.h:27
const float ALPHA_MAX
Definition: MyGUI_Macros.h:19
types::TSize< int > IntSize
Definition: MyGUI_Types.h:29
const size_t ITEM_NONE
Definition: MyGUI_Macros.h:17
types::TPoint< int > IntPoint
Definition: MyGUI_Types.h:26
bool isHStretch() const
Definition: MyGUI_Align.h:69
bool isVCenter() const
Definition: MyGUI_Align.h:49
bool isVStretch() const
Definition: MyGUI_Align.h:84
bool isRight() const
Definition: MyGUI_Align.h:64
bool isHCenter() const
Definition: MyGUI_Align.h:44
bool isBottom() const
Definition: MyGUI_Align.h:79
VectorStringPairs properties
std::vector< WidgetInfo > childWidgetsInfo
TSize< T > size() const
Definition: MyGUI_TCoord.h:190
TPoint< T > point() const
Definition: MyGUI_TCoord.h:185