MyGUI_Widget.cpp
Go to the documentation of this file.
/*
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
* Distributed under the MIT License
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
*/
#include "MyGUI_Precompiled.h"
#include "MyGUI_Widget.h"
#include "MyGUI_Gui.h"
#include "MyGUI_InputManager.h"
#include "MyGUI_SkinManager.h"
#include "MyGUI_SubWidgetManager.h"
#include "MyGUI_WidgetManager.h"
#include "MyGUI_ResourceSkin.h"
#include "MyGUI_WidgetDefines.h"
#include "MyGUI_LayerItem.h"
#include "MyGUI_LayerManager.h"
#include "MyGUI_RenderItem.h"
#include "MyGUI_ISubWidget.h"
#include "MyGUI_ISubWidgetText.h"
#include "MyGUI_TextBox.h"
#include "MyGUI_FactoryManager.h"
#include "MyGUI_CoordConverter.h"
#include "MyGUI_RenderManager.h"
#include "MyGUI_ToolTipManager.h"
#include "MyGUI_LayoutManager.h"
namespace MyGUI
{
void Widget::_initialise(
WidgetStyle _style,
const IntCoord& _coord,
std::string_view _skinName,
Widget* _parent,
ICroppedRectangle* _croppedParent,
std::string_view _name)
{
ResourceSkin* skinInfo = nullptr;
ResourceLayout* templateInfo = nullptr;
if (LayoutManager::getInstance().isExist(_skinName))
templateInfo = LayoutManager::getInstance().getByName(_skinName);
else
skinInfo = SkinManager::getInstance().getByName(_skinName);
mCoord = _coord;
mAlign = Align::Default;
mWidgetStyle = _style;
mName = _name;
mCroppedParent = _croppedParent;
mParent = _parent;
#if MYGUI_DEBUG_MODE == 1
// проверяем соответсвие входных данных
if (mWidgetStyle == WidgetStyle::Child)
{
MYGUI_ASSERT(mCroppedParent, "must be cropped");
MYGUI_ASSERT(mParent, "must be parent");
}
else if (mWidgetStyle == WidgetStyle::Overlapped)
{
MYGUI_ASSERT((mParent == nullptr) == (mCroppedParent == nullptr), "error cropped");
}
else if (mWidgetStyle == WidgetStyle::Popup)
{
MYGUI_ASSERT(!mCroppedParent, "cropped must be nullptr");
MYGUI_ASSERT(mParent, "must be parent");
}
#endif
// корректируем абсолютные координаты
mAbsolutePosition = _coord.point();
if (nullptr != mCroppedParent)
mAbsolutePosition += mCroppedParent->getAbsolutePosition();
const WidgetInfo* root = initialiseWidgetSkinBase(skinInfo, templateInfo);
// дочернее окно обыкновенное
if (mWidgetStyle == WidgetStyle::Child)
{
if (mParent)
mParent->addChildItem(this);
}
// дочернее нуно перекрывающееся
else if (mWidgetStyle == WidgetStyle::Overlapped)
{
// дочернее перекрывающееся
if (mParent)
mParent->addChildNode(this);
}
// витр метод для наследников
initialiseOverride();
if (skinInfo != nullptr)
setSkinProperty(skinInfo);
if (root != nullptr)
{
for (const auto& property : root->properties)
{
setProperty(property.first, property.second);
}
}
}
void Widget::_shutdown()
{
eventWidgetDestroyed(this);
setUserData(Any::Null);
// витр метод для наследников
shutdownOverride();
shutdownWidgetSkinBase();
_destroyAllChildWidget();
// дочернее окно обыкновенное
if (mWidgetStyle == WidgetStyle::Child)
{
if (mParent)
mParent->removeChildItem(this);
}
// дочернее нуно перекрывающееся
else if (mWidgetStyle == WidgetStyle::Overlapped)
{
// дочернее перекрывающееся
if (mParent)
mParent->removeChildNode(this);
}
mParent = nullptr;
mCroppedParent = nullptr;
}
void Widget::changeWidgetSkin(std::string_view _skinName)
{
ResourceSkin* skinInfo = nullptr;
ResourceLayout* templateInfo = nullptr;
if (LayoutManager::getInstance().isExist(_skinName))
templateInfo = LayoutManager::getInstance().getByName(_skinName);
else
skinInfo = SkinManager::getInstance().getByName(_skinName);
shutdownOverride();
saveLayerItem();
shutdownWidgetSkinBase();
const WidgetInfo* root = initialiseWidgetSkinBase(skinInfo, templateInfo);
restoreLayerItem();
initialiseOverride();
if (skinInfo != nullptr)
setSkinProperty(skinInfo);
if (root != nullptr)
{
for (const auto& property : root->properties)
{
setProperty(property.first, property.second);
}
}
}
const WidgetInfo* Widget::initialiseWidgetSkinBase(ResourceSkin* _skinInfo, ResourceLayout* _templateInfo)
{
const WidgetInfo* root = nullptr;
bool skinOnly = false;
if (_skinInfo == nullptr)
{
skinOnly = true;
std::string_view skinName;
const VectorWidgetInfo& data = _templateInfo->getLayoutData();
for (const auto& item : data)
{
if (item.name == "Root")
{
skinName = item.skin;
root = &item;
break;
}
}
_skinInfo = SkinManager::getInstance().getByName(skinName);
}
//SAVE
const IntSize& _size = mCoord.size();
if (_skinInfo != nullptr)
{
//FIXME - явный вызов
Widget::setSize(_skinInfo->getSize());
_createSkinItem(_skinInfo);
}
// выставляем альфу, корректировка по отцу автоматически
_updateAlpha();
_updateEnabled();
_updateVisible();
if (!skinOnly)
{
#ifndef MYGUI_DONT_USE_OBSOLETE
const MapString& properties = _skinInfo->getProperties();
for (const auto& property : properties)
{
if (BackwardCompatibility::isIgnoreProperty(property.first))
{
MYGUI_LOG(
Warning,
property.first
<< " skin property is deprecated, move it to UserString in a widget in ResourceLayout"
<< LayoutManager::getInstance().getCurrentLayout() << "]");
setUserString(property.first, property.second);
}
}
#endif
// create skin childs
const VectorChildSkinInfo& child = _skinInfo->getChild();
for (const auto& iter : child)
{
Widget* widget = baseCreateWidget(
iter.style,
iter.type,
iter.skin,
iter.coord,
iter.align,
iter.layer,
iter.name,
true);
// fill UserString with skin properties
for (const auto& prop : iter.params)
widget->setUserString(prop.first, prop.second);
}
}
if (root != nullptr)
{
//FIXME - явный вызов
Widget::setSize(root->intCoord.size());
for (const auto& userString : root->userStrings)
{
setUserString(userString.first, userString.second);
}
for (const auto& iter : root->childWidgetsInfo)
{
_templateInfo->createWidget(iter, {}, this, true);
}
}
//FIXME - явный вызов
Widget::setSize(_size);
return root;
}
void Widget::shutdownWidgetSkinBase()
{
setMaskPick(MaskPickInfo{});
_deleteSkinItem();
// удаляем виджеты чтобы ли в скине
for (auto& iter : mWidgetChildSkin)
{
// Добавляем себя чтобы удалилось
mWidgetChild.push_back(iter);
_destroyChildWidget(iter);
}
mWidgetChildSkin.clear();
mWidgetClient = nullptr;
}
Widget* Widget::baseCreateWidget(
WidgetStyle _style,
std::string_view _type,
std::string_view _skin,
const IntCoord& _coord,
Align _align,
std::string_view _layer,
std::string_view _name,
bool _template)
{
Widget* widget = nullptr;
if (_template)
{
widget = WidgetManager::getInstance().createWidget(
_style,
_type,
_skin,
_coord,
this,
_style == WidgetStyle::Popup ? nullptr : this,
_name);
mWidgetChildSkin.push_back(widget);
}
else
{
if (mWidgetClient != nullptr)
{
widget =
mWidgetClient->baseCreateWidget(_style, _type, _skin, _coord, _align, _layer, _name, _template);
onWidgetCreated(widget);
return widget;
}
widget = WidgetManager::getInstance().createWidget(
_style,
_type,
_skin,
_coord,
this,
_style == WidgetStyle::Popup ? nullptr : this,
_name);
addWidget(widget);
}
widget->setAlign(_align);
// присоединяем виджет с уровню
if (!_layer.empty() && widget->isRootWidget())
LayerManager::getInstance().attachToLayerNode(_layer, widget);
onWidgetCreated(widget);
return widget;
}
Widget* Widget::createWidgetRealT(
std::string_view _type,
std::string_view _skin,
const FloatCoord& _coord,
Align _align,
std::string_view _name)
{
return createWidgetT(_type, _skin, CoordConverter::convertFromRelative(_coord, getSize()), _align, _name);
}
void Widget::_updateView()
{
bool margin = mCroppedParent ? _checkMargin() : false;
// вьюпорт стал битым
if (margin)
{
// проверка на полный выход за границу
if (_checkOutside())
{
// запоминаем текущее состояние
mIsMargin = margin;
// скрываем
_setSubSkinVisible(false);
// вся иерархия должна быть проверенна
for (auto& widget : mWidgetChild)
widget->_updateView();
for (auto& widget : mWidgetChildSkin)
widget->_updateView();
return;
}
}
// мы не обрезаны и были нормальные
else if (!mIsMargin)
{
_updateSkinItemView();
return;
}
// запоминаем текущее состояние
mIsMargin = margin;
// если скин был скрыт, то покажем
_setSubSkinVisible(true);
// обновляем наших детей, а они уже решат обновлять ли своих детей
for (auto& widget : mWidgetChild)
widget->_updateView();
for (auto& widget : mWidgetChildSkin)
widget->_updateView();
_updateSkinItemView();
}
bool Widget::_setWidgetState(std::string_view _state)
{
return _setSkinItemState(_state);
}
void Widget::_destroyChildWidget(Widget* _widget)
{
MYGUI_ASSERT(nullptr != _widget, "invalid widget pointer");
if (mParent != nullptr && mParent->getClientWidget() == this)
mParent->onWidgetDestroy(_widget);
onWidgetDestroy(_widget);
VectorWidgetPtr::iterator iter = std::find(mWidgetChild.begin(), mWidgetChild.end(), _widget);
if (iter != mWidgetChild.end())
{
// сохраняем указатель
MyGUI::Widget* widget = *iter;
// удаляем из списка
mWidgetChild.erase(iter);
// отписываем от всех
WidgetManager::getInstance().unlinkFromUnlinkers(_widget);
// непосредственное удаление
WidgetManager::getInstance()._deleteWidget(widget);
}
else
{
MYGUI_EXCEPT("Widget '" << _widget->getName() << "' not found");
}
}
// удаляет всех детей
void Widget::_destroyAllChildWidget()
{
WidgetManager& manager = WidgetManager::getInstance();
while (!mWidgetChild.empty())
{
// сразу себя отписывем, иначе вложенной удаление убивает все
Widget* widget = mWidgetChild.back();
mWidgetChild.pop_back();
// отписываем от всех
manager.unlinkFromUnlinkers(widget);
// и сами удалим, так как его больше в списке нет
WidgetManager::getInstance()._deleteWidget(widget);
}
}
IntCoord Widget::getClientCoord() const
{
if (mWidgetClient != nullptr)
return mWidgetClient->getCoord();
return {0, 0, mCoord.width, mCoord.height};
}
void Widget::setAlpha(float _alpha)
{
if (mAlpha == _alpha)
return;
mAlpha = _alpha;
_updateAlpha();
}
void Widget::_updateAlpha()
{
if (nullptr != mParent)
mRealAlpha = mAlpha * (mInheritsAlpha ? mParent->_getRealAlpha() : ALPHA_MAX);
else
mRealAlpha = mAlpha;
for (auto& widget : mWidgetChild)
widget->_updateAlpha();
for (auto& widget : mWidgetChildSkin)
widget->_updateAlpha();
_setSkinItemAlpha(mRealAlpha);
}
void Widget::setInheritsAlpha(bool _inherits)
{
mInheritsAlpha = _inherits;
_updateAlpha();
}
ILayerItem* Widget::getLayerItemByPoint(int _left, int _top) const
{
// проверяем попадание
if (!mEnabled || !mInheritedVisible || (!getNeedMouseFocus() && !getInheritsPick()) ||
!_checkPoint(_left, _top)
// если есть маска, проверяем еще и по маске
|| !isMaskPickInside(IntPoint(_left - mCoord.left, _top - mCoord.top), mCoord))
return nullptr;
// спрашиваем у детишек
for (VectorWidgetPtr::const_reverse_iterator widget = mWidgetChild.rbegin(); widget != mWidgetChild.rend();
++widget)
{
// общаемся только с послушными детьми
if ((*widget)->mWidgetStyle == WidgetStyle::Popup)
continue;
ILayerItem* item = (*widget)->getLayerItemByPoint(_left - mCoord.left, _top - mCoord.top);
if (item != nullptr)
return item;
}
// спрашиваем у детишек скина
for (VectorWidgetPtr::const_reverse_iterator widget = mWidgetChildSkin.rbegin();
widget != mWidgetChildSkin.rend();
++widget)
{
ILayerItem* item = (*widget)->getLayerItemByPoint(_left - mCoord.left, _top - mCoord.top);
if (item != nullptr)
return item;
}
// непослушные дети
return getInheritsPick() ? nullptr : const_cast<Widget*>(this);
}
void Widget::_updateAbsolutePoint()
{
// мы рут, нам не надо
if (!mCroppedParent)
return;
mAbsolutePosition = mCroppedParent->getAbsolutePosition() + mCoord.point();
for (auto& widget : mWidgetChild)
widget->_updateAbsolutePoint();
for (auto& widget : mWidgetChildSkin)
widget->_updateAbsolutePoint();
_correctSkinItemView();
}
void Widget::_forcePick(Widget* _widget)
{
if (mWidgetClient != nullptr)
{
mWidgetClient->_forcePick(_widget);
return;
}
auto iter = std::find(mWidgetChild.begin(), mWidgetChild.end(), _widget);
if (iter == mWidgetChild.end())
return;
for (auto& widget : mWidgetChild)
{
if (widget == _widget)
widget->mDepth = -1;
else if (widget->getDepth() == -1)
widget->mDepth = 0;
}
// code below is an optimized way to setDepth for multiple widgets
// without calling slow Windget::_updateChilds multiple times
std::stable_sort(
mWidgetChild.begin(),
mWidgetChild.end(),
[](Widget* lhs, Widget* rhs) { return lhs->getDepth() > rhs->getDepth(); });
_updateChilds();
}
Widget* Widget::findWidget(std::string_view _name)
{
if (_name == mName)
return this;
if (mWidgetClient != nullptr)
return mWidgetClient->findWidget(_name);
for (const auto& widget : mWidgetChild)
{
Widget* find = widget->findWidget(_name);
if (nullptr != find)
return find;
}
return nullptr;
}
void Widget::setRealPosition(const FloatPoint& _point)
{
setPosition(CoordConverter::convertFromRelative(
_point,
mCroppedParent == nullptr ? RenderManager::getInstance().getViewSize() : mCroppedParent->getSize()));
}
void Widget::setRealSize(const FloatSize& _size)
{
setSize(CoordConverter::convertFromRelative(
_size,
mCroppedParent == nullptr ? RenderManager::getInstance().getViewSize() : mCroppedParent->getSize()));
}
void Widget::setRealCoord(const FloatCoord& _coord)
{
setCoord(CoordConverter::convertFromRelative(
_coord,
mCroppedParent == nullptr ? RenderManager::getInstance().getViewSize() : mCroppedParent->getSize()));
}
void Widget::_setAlign(const IntSize& _oldsize, const IntSize& _newSize)
{
const IntSize& size = _newSize; //getParentSize();
bool need_move = false;
bool need_size = false;
IntCoord coord = mCoord;
// первоначальное выравнивание
if (mAlign.isHStretch())
{
// растягиваем
coord.width = mCoord.width + (size.width - _oldsize.width);
need_size = true;
}
else if (mAlign.isRight())
{
// двигаем по правому краю
coord.left = mCoord.left + (size.width - _oldsize.width);
need_move = true;
}
else if (mAlign.isHCenter())
{
// выравнивание по горизонтали без растяжения
coord.left = (size.width - mCoord.width) / 2;
need_move = true;
}
if (mAlign.isVStretch())
{
// растягиваем
coord.height = mCoord.height + (size.height - _oldsize.height);
need_size = true;
}
else if (mAlign.isBottom())
{
// двигаем по нижнему краю
coord.top = mCoord.top + (size.height - _oldsize.height);
need_move = true;
}
else if (mAlign.isVCenter())
{
// выравнивание по вертикали без растяжения
coord.top = (size.height - mCoord.height) / 2;
need_move = true;
}
if (need_move)
{
if (need_size)
setCoord(coord);
else
setPosition(coord.point());
}
else if (need_size)
{
setSize(coord.size());
}
else
{
_updateView(); // только если не вызвано передвижение и сайз
}
}
void Widget::setPosition(const IntPoint& _point)
{
// обновляем абсолютные координаты
mAbsolutePosition += _point - mCoord.point();
for (auto& widget : mWidgetChild)
widget->_updateAbsolutePoint();
for (auto& widget : mWidgetChildSkin)
widget->_updateAbsolutePoint();
mCoord = _point;
_updateView();
eventChangeCoord(this);
}
void Widget::setSize(const IntSize& _size)
{
// устанавливаем новую координату а старую пускаем в расчеты
IntSize old = mCoord.size();
mCoord = _size;
bool visible = true;
// обновляем выравнивание
bool margin = mCroppedParent ? _checkMargin() : false;
if (margin)
{
// проверка на полный выход за границу
if (_checkOutside())
{
// скрываем
visible = false;
}
}
_setSubSkinVisible(visible);
// передаем старую координату , до вызова, текущая координата отца должна быть новой
for (auto& widget : mWidgetChild)
widget->_setAlign(old, getSize());
for (auto& widget : mWidgetChildSkin)
widget->_setAlign(old, getSize());
_setSkinItemAlign(old);
// запоминаем текущее состояние
mIsMargin = margin;
eventChangeCoord(this);
}
void Widget::setCoord(const IntCoord& _coord)
{
// обновляем абсолютные координаты
mAbsolutePosition += _coord.point() - mCoord.point();
for (auto& widget : mWidgetChild)
widget->_updateAbsolutePoint();
for (auto& widget : mWidgetChildSkin)
widget->_updateAbsolutePoint();
// устанавливаем новую координату а старую пускаем в расчеты
IntCoord old = mCoord;
mCoord = _coord;
bool visible = true;
// обновляем выравнивание
bool margin = mCroppedParent ? _checkMargin() : false;
if (margin)
{
// проверка на полный выход за границу
if (_checkOutside())
{
// скрываем
visible = false;
}
}
_setSubSkinVisible(visible);
// передаем старую координату , до вызова, текущая координата отца должна быть новой
for (auto& widget : mWidgetChild)
widget->_setAlign(old.size(), getSize());
for (auto& widget : mWidgetChildSkin)
widget->_setAlign(old.size(), getSize());
_setSkinItemAlign(old.size());
// запоминаем текущее состояние
mIsMargin = margin;
eventChangeCoord(this);
}
void Widget::setAlign(Align _value)
{
mAlign = _value;
}
void Widget::detachFromWidget(std::string_view _layer)
{
std::string_view oldlayer;
if (getLayer())
oldlayer = getLayer()->getName();
Widget* parent = getParent();
if (parent)
{
// отдетачиваемся от лееров
if (!isRootWidget())
{
detachFromLayerItemNode(true);
if (mWidgetStyle == WidgetStyle::Child)
{
mParent->removeChildItem(this);
}
else if (mWidgetStyle == WidgetStyle::Overlapped)
{
mParent->removeChildNode(this);
}
mWidgetStyle = WidgetStyle::Overlapped;
mCroppedParent = nullptr;
// обновляем координаты
mAbsolutePosition = mCoord.point();
for (auto& widget : mWidgetChild)
widget->_updateAbsolutePoint();
for (auto& widget : mWidgetChildSkin)
widget->_updateAbsolutePoint();
// сбрасываем обрезку
mMargin.clear();
_updateView();
}
// нам нужен самый рутовый парент
while (parent->getParent())
parent = parent->getParent();
Gui::getInstance()._linkChildWidget(this);
mParent->_unlinkChildWidget(this);
mParent = nullptr;
}
if (!_layer.empty())
{
LayerManager::getInstance().attachToLayerNode(_layer, this);
}
else if (!oldlayer.empty())
{
LayerManager::getInstance().attachToLayerNode(oldlayer, this);
}
_updateAlpha();
}
void Widget::attachToWidget(Widget* _parent, WidgetStyle _style, std::string_view _layer)
{
MYGUI_ASSERT(_parent, "parent must be valid");
MYGUI_ASSERT(_parent != this, "cyclic attach (attaching to self)");
// attach to client if widget have it
if (_parent->getClientWidget())
_parent = _parent->getClientWidget();
Widget* parent = _parent;
while (parent->getParent())
{
MYGUI_ASSERT(parent != this, "cyclic attach");
parent = parent->getParent();
}
detachFromWidget();
mWidgetStyle = _style;
if (_style == WidgetStyle::Popup)
{
if (mParent == nullptr)
Gui::getInstance()._unlinkChildWidget(this);
else
mParent->_unlinkChildWidget(this);
mParent = _parent;
mParent->_linkChildWidget(this);
mCroppedParent = nullptr;
if (!_layer.empty())
{
LayerManager::getInstance().attachToLayerNode(_layer, this);
}
}
else if (_style == WidgetStyle::Child)
{
LayerManager::getInstance().detachFromLayer(this);
if (mParent == nullptr)
Gui::getInstance()._unlinkChildWidget(this);
else
mParent->_unlinkChildWidget(this);
mParent = _parent;
mParent->addChildItem(this);
mParent->_linkChildWidget(this);
mCroppedParent = _parent;
mAbsolutePosition = _parent->getAbsolutePosition() + mCoord.point();
for (auto& widget : mWidgetChild)
widget->_updateAbsolutePoint();
for (auto& widget : mWidgetChildSkin)
widget->_updateAbsolutePoint();
_updateView();
}
else if (_style == WidgetStyle::Overlapped)
{
LayerManager::getInstance().detachFromLayer(this);
if (mParent == nullptr)
Gui::getInstance()._unlinkChildWidget(this);
else
mParent->_unlinkChildWidget(this);
mParent = _parent;
mParent->_linkChildWidget(this);
mCroppedParent = _parent;
mAbsolutePosition = _parent->getAbsolutePosition() + mCoord.point();
for (auto& widget : mWidgetChild)
widget->_updateAbsolutePoint();
for (auto& widget : mWidgetChildSkin)
widget->_updateAbsolutePoint();
mParent->addChildNode(this);
_updateView();
}
_updateAlpha();
}
void Widget::setWidgetStyle(WidgetStyle _style, std::string_view _layer)
{
if (_style == mWidgetStyle)
return;
if (nullptr == getParent())
return;
Widget* parent = mParent;
detachFromWidget();
attachToWidget(parent, _style, _layer);
// ищем леер к которому мы присоедененны
}
Widget* Widget::createWidgetT(
std::string_view _type,
std::string_view _skin,
const IntCoord& _coord,
Align _align,
std::string_view _name)
{
return baseCreateWidget(WidgetStyle::Child, _type, _skin, _coord, _align, {}, _name, false);
}
Widget* Widget::createWidgetT(
std::string_view _type,
std::string_view _skin,
int _left,
int _top,
int _width,
int _height,
Align _align,
std::string_view _name)
{
return createWidgetT(_type, _skin, IntCoord(_left, _top, _width, _height), _align, _name);
}
Widget* Widget::createWidgetRealT(
std::string_view _type,
std::string_view _skin,
float _left,
float _top,
float _width,
float _height,
Align _align,
std::string_view _name)
{
return createWidgetRealT(_type, _skin, FloatCoord(_left, _top, _width, _height), _align, _name);
}
Widget* Widget::createWidgetT(
WidgetStyle _style,
std::string_view _type,
std::string_view _skin,
const IntCoord& _coord,
Align _align,
std::string_view _layer,
std::string_view _name)
{
return baseCreateWidget(_style, _type, _skin, _coord, _align, _layer, _name, false);
}
EnumeratorWidgetPtr Widget::getEnumerator() const
{
if (mWidgetClient != nullptr)
return mWidgetClient->getEnumerator();
return {mWidgetChild.begin(), mWidgetChild.end()};
}
size_t Widget::getChildCount() const
{
if (mWidgetClient != nullptr)
return mWidgetClient->getChildCount();
return mWidgetChild.size();
}
Widget* Widget::getChildAt(size_t _index) const
{
if (mWidgetClient != nullptr)
return mWidgetClient->getChildAt(_index);
MYGUI_ASSERT_RANGE(_index, mWidgetChild.size(), "Widget::getChildAt");
return mWidgetChild[_index];
}
void Widget::baseUpdateEnable()
{
if (getInheritedEnabled())
_setWidgetState("normal");
else
_setWidgetState("disabled");
}
void Widget::setVisible(bool _value)
{
if (mVisible == _value)
return;
mVisible = _value;
_updateVisible();
}
void Widget::_updateVisible()
{
mInheritedVisible = mParent == nullptr || mParent->getInheritedVisible();
mInheritedVisible = mVisible && mInheritedVisible;
_setSkinItemVisible(mInheritedVisible);
for (auto& widget : mWidgetChild)
widget->_updateVisible();
for (auto& widget : mWidgetChildSkin)
widget->_updateVisible();
if (!mInheritedVisible && InputManager::getInstance().getMouseFocusWidget() == this)
InputManager::getInstance()._resetMouseFocusWidget();
if (!mInheritedVisible && InputManager::getInstance().getKeyFocusWidget() == this)
InputManager::getInstance().resetKeyFocusWidget();
}
void Widget::setEnabled(bool _value)
{
if (mEnabled == _value)
return;
mEnabled = _value;
_updateEnabled();
}
void Widget::_updateEnabled()
{
mInheritedEnabled = mParent == nullptr || (mParent->getInheritedEnabled());
mInheritedEnabled = mInheritedEnabled && mEnabled;
for (auto& iter : mWidgetChild)
iter->_updateEnabled();
for (auto& iter : mWidgetChildSkin)
iter->_updateEnabled();
baseUpdateEnable();
if (!mInheritedEnabled)
InputManager::getInstance().unlinkWidget(this);
}
void Widget::setColour(const Colour& _value)
{
_setSkinItemColour(_value);
for (auto& widget : mWidgetChildSkin)
widget->setColour(_value);
}
IntSize Widget::getParentSize() const
{
if (mCroppedParent)
return static_cast<Widget*>(mCroppedParent)->getSize();
if (getLayer())
return getLayer()->getSize();
return RenderManager::getInstance().getViewSize();
}
void Widget::_resetContainer(bool _updateOnly)
{
if (getNeedToolTip())
ToolTipManager::getInstance()._unlinkWidget(this);
}
bool Widget::_checkPoint(int _left, int _top) const
{
return (_getViewLeft() <= _left) && (_getViewTop() <= _top) && (_getViewRight() >= _left) &&
(_getViewBottom() >= _top);
}
void Widget::_linkChildWidget(Widget* _widget)
{
VectorWidgetPtr::iterator iter = std::find(mWidgetChild.begin(), mWidgetChild.end(), _widget);
MYGUI_ASSERT(iter == mWidgetChild.end(), "widget already exist");
addWidget(_widget);
}
void Widget::_unlinkChildWidget(Widget* _widget)
{
VectorWidgetPtr::iterator iter = std::remove(mWidgetChild.begin(), mWidgetChild.end(), _widget);
MYGUI_ASSERT(iter != mWidgetChild.end(), "widget not found");
mWidgetChild.erase(iter);
}
void Widget::shutdownOverride()
{
}
void Widget::initialiseOverride()
{
assignWidget(mWidgetClient, "Client");
}
void Widget::setSkinProperty(ResourceSkin* _info)
{
const MapString& properties = _info->getProperties();
for (const auto& property : properties)
setProperty(property.first, property.second);
}
void Widget::setProperty(std::string_view _key, std::string_view _value)
{
std::string key{_key};
std::string value{_value};
if (BackwardCompatibility::checkProperty(this, key, value))
{
size_t index = key.find('_');
if (index != std::string::npos)
{
MYGUI_LOG(
Warning,
"Widget property '" << key << "' have type prefix - use '" << key.substr(index + 1) << "' instead ["
<< LayoutManager::getInstance().getCurrentLayout() << "]");
key = key.substr(index + 1);
}
setPropertyOverride(key, value);
}
}
VectorWidgetPtr Widget::getSkinWidgetsByName(std::string_view _name) const
{
VectorWidgetPtr result;
for (const auto& childSkin : mWidgetChildSkin)
childSkin->findWidgets(_name, result);
return result;
}
void Widget::findWidgets(std::string_view _name, VectorWidgetPtr& _result)
{
if (_name == mName)
_result.push_back(this);
if (mWidgetClient != nullptr)
{
mWidgetClient->findWidgets(_name, _result);
}
else
{
for (const auto& widget : mWidgetChild)
widget->findWidgets(_name, _result);
}
}
void Widget::onWidgetCreated(Widget* _widget)
{
}
void Widget::onWidgetDestroy(Widget* _widget)
{
}
void Widget::setWidgetClient(Widget* _widget)
{
MYGUI_ASSERT(mWidgetClient != this, "mWidgetClient can not be this widget");
mWidgetClient = _widget;
}
Widget* Widget::_getClientWidget()
{
return getClientWidget() == nullptr ? this : getClientWidget();
}
const Widget* Widget::_getClientWidget() const
{
return getClientWidget() == nullptr ? this : getClientWidget();
}
Widget* Widget::_createSkinWidget(
WidgetStyle _style,
std::string_view _type,
std::string_view _skin,
const IntCoord& _coord,
Align _align,
std::string_view _layer,
std::string_view _name)
{
return baseCreateWidget(_style, _type, _skin, _coord, _align, _layer, _name, true);
}
void Widget::setPropertyOverride(std::string_view _key, std::string_view _value)
{
if (_key == "Position")
setPosition(utility::parseValue<IntPoint>(_value));
else if (_key == "Size")
setSize(utility::parseValue<IntSize>(_value));
else if (_key == "Coord")
setCoord(utility::parseValue<IntCoord>(_value));
else if (_key == "Visible")
setVisible(utility::parseValue<bool>(_value));
else if (_key == "Depth")
setDepth(utility::parseValue<int>(_value));
else if (_key == "Alpha")
setAlpha(utility::parseValue<float>(_value));
else if (_key == "Colour")
setColour(utility::parseValue<Colour>(_value));
else if (_key == "InheritsAlpha")
setInheritsAlpha(utility::parseValue<bool>(_value));
else if (_key == "InheritsPick")
setInheritsPick(utility::parseValue<bool>(_value));
else if (_key == "MaskPick")
setMaskPick(std::string{_value});
else if (_key == "NeedKey")
setNeedKeyFocus(utility::parseValue<bool>(_value));
else if (_key == "NeedMouse")
setNeedMouseFocus(utility::parseValue<bool>(_value));
else if (_key == "Enabled")
setEnabled(utility::parseValue<bool>(_value));
else if (_key == "NeedToolTip")
setNeedToolTip(utility::parseValue<bool>(_value));
else if (_key == "Pointer")
setPointer(_value);
else
{
MYGUI_LOG(
Warning,
"Widget '" << getName() << "|" << getTypeName() << "' have unknown property '" << _key << "' "
<< " [" << LayoutManager::getInstance().getCurrentLayout() << "]");
return;
}
eventChangeProperty(this, _key, _value);
}
void Widget::setPosition(int _left, int _top)
{
setPosition(IntPoint(_left, _top));
}
void Widget::setSize(int _width, int _height)
{
setSize(IntSize(_width, _height));
}
void Widget::setCoord(int _left, int _top, int _width, int _height)
{
setCoord(IntCoord(_left, _top, _width, _height));
}
void Widget::setRealPosition(float _left, float _top)
{
setRealPosition(FloatPoint(_left, _top));
}
void Widget::setRealSize(float _width, float _height)
{
setRealSize(FloatSize(_width, _height));
}
void Widget::setRealCoord(float _left, float _top, float _width, float _height)
{
setRealCoord(FloatCoord(_left, _top, _width, _height));
}
const std::string& Widget::getName() const
{
return mName;
}
bool Widget::getVisible() const
{
return mVisible;
}
Align Widget::getAlign() const
{
return mAlign;
}
float Widget::getAlpha() const
{
return mAlpha;
}
bool Widget::getInheritsAlpha() const
{
return mInheritsAlpha;
}
bool Widget::isRootWidget() const
{
return nullptr == mCroppedParent;
}
Widget* Widget::getParent() const
{
return mParent;
}
void Widget::setEnabledSilent(bool _value)
{
mEnabled = _value;
}
bool Widget::getEnabled() const
{
return mEnabled;
}
Widget* Widget::getClientWidget()
{
return mWidgetClient;
}
const Widget* Widget::getClientWidget() const
{
return mWidgetClient;
}
WidgetStyle Widget::getWidgetStyle() const
{
return mWidgetStyle;
}
size_t Widget::_getItemIndex(Widget* _item) const
{
return ITEM_NONE;
}
void Widget::_setContainer(Widget* _value)
{
mContainer = _value;
}
Widget* Widget::_getContainer() const
{
return mContainer;
}
size_t Widget::_getContainerIndex(const IntPoint& _point) const
{
return ITEM_NONE;
}
const IntCoord& Widget::getLayerItemCoord() const
{
return mCoord;
}
float Widget::_getRealAlpha() const
{
return mRealAlpha;
}
bool Widget::getInheritedEnabled() const
{
return mInheritedEnabled;
}
bool Widget::getInheritedVisible() const
{
return mInheritedVisible;
}
void Widget::resizeLayerItemView(const IntSize& _oldView, const IntSize& _newView)
{
_setAlign(_oldView, _newView);
}
void Widget::setDepth(int _value)
{
if (mDepth == _value)
return;
mDepth = _value;
if (mParent != nullptr)
{
mParent->_unlinkChildWidget(this);
mParent->_linkChildWidget(this);
mParent->_updateChilds();
}
}
int Widget::getDepth() const
{
return mDepth;
}
void Widget::addWidget(Widget* _widget)
{
// сортировка глубины от большого к меньшему
int depth = _widget->getDepth();
for (size_t index = 0; index < mWidgetChild.size(); ++index)
{
Widget* widget = mWidgetChild[index];
if (widget->getDepth() < depth)
{
mWidgetChild.insert(mWidgetChild.begin() + index, _widget);
_updateChilds();
return;
}
}
mWidgetChild.push_back(_widget);
}
void Widget::_updateChilds()
{
for (auto& widget : mWidgetChild)
{
if (widget->getWidgetStyle() == WidgetStyle::Child)
{
widget->detachFromLayerItemNode(false);
removeChildItem(widget);
}
}
for (auto& widget : mWidgetChild)
{
if (widget->getWidgetStyle() == WidgetStyle::Child)
{
addChildItem(widget);
widget->_updateView();
}
}
}
} // namespace MyGUI
MyGUI_CoordConverter.h
MYGUI_ASSERT
#define MYGUI_ASSERT(exp, dest)
Definition MyGUI_Diagnostic.h:31
MYGUI_EXCEPT
#define MYGUI_EXCEPT(dest)
Definition MyGUI_Diagnostic.h:21
MYGUI_ASSERT_RANGE
#define MYGUI_ASSERT_RANGE(index, size, owner)
Definition MyGUI_Diagnostic.h:44
MYGUI_LOG
#define MYGUI_LOG(level, text)
Definition MyGUI_Diagnostic.h:17
MyGUI_FactoryManager.h
MyGUI_Gui.h
MyGUI_ISubWidget.h
MyGUI_ISubWidgetText.h
MyGUI_InputManager.h
MyGUI_LayerItem.h
MyGUI_LayerManager.h
MyGUI_LayoutManager.h
MyGUI_Precompiled.h
MyGUI_RenderItem.h
MyGUI_RenderManager.h
MyGUI_ResourceSkin.h
MyGUI_SkinManager.h
MyGUI_SubWidgetManager.h
MyGUI_TextBox.h
MyGUI_ToolTipManager.h
MyGUI_Widget.h
MyGUI_WidgetDefines.h
MyGUI_WidgetManager.h
MyGUI::Any::Null
static const Any Null
Definition MyGUI_Any.h:58
MyGUI::BackwardCompatibility::isIgnoreProperty
static bool isIgnoreProperty(std::string_view _key)
Definition MyGUI_BackwardCompatibility.cpp:1086
MyGUI::BackwardCompatibility::checkProperty
static bool checkProperty(Widget *_owner, std::string &_key, std::string &_value)
Definition MyGUI_BackwardCompatibility.cpp:1095
MyGUI::CoordConverter::convertFromRelative
static IntCoord convertFromRelative(const FloatCoord &_coord, const IntSize &_view)
Definition MyGUI_CoordConverter.h:34
MyGUI::Gui::_unlinkChildWidget
void _unlinkChildWidget(Widget *_widget)
Definition MyGUI_Gui.cpp:268
MyGUI::Gui::_linkChildWidget
void _linkChildWidget(Widget *_widget)
Definition MyGUI_Gui.cpp:261
MyGUI::Gui::getInstance
static Gui & getInstance()
Definition MyGUI_Gui.cpp:34
MyGUI::ICroppedRectangle
Definition MyGUI_ICroppedRectangle.h:17
MyGUI::ICroppedRectangle::mIsMargin
bool mIsMargin
Definition MyGUI_ICroppedRectangle.h:248
MyGUI::ICroppedRectangle::mCoord
IntCoord mCoord
Definition MyGUI_ICroppedRectangle.h:245
MyGUI::ICroppedRectangle::mMargin
IntRect mMargin
Definition MyGUI_ICroppedRectangle.h:244
MyGUI::ICroppedRectangle::getAbsolutePosition
const IntPoint & getAbsolutePosition() const
Definition MyGUI_ICroppedRectangle.h:62
MyGUI::ICroppedRectangle::_checkMargin
bool _checkMargin()
Definition MyGUI_ICroppedRectangle.h:184
MyGUI::ICroppedRectangle::_checkOutside
bool _checkOutside() const
Definition MyGUI_ICroppedRectangle.h:234
MyGUI::ICroppedRectangle::mCroppedParent
ICroppedRectangle * mCroppedParent
Definition MyGUI_ICroppedRectangle.h:249
MyGUI::ICroppedRectangle::mAbsolutePosition
IntPoint mAbsolutePosition
Definition MyGUI_ICroppedRectangle.h:246
MyGUI::ICroppedRectangle::getSize
IntSize getSize() const
Definition MyGUI_ICroppedRectangle.h:51
MyGUI::ICroppedRectangle::_getViewRight
int _getViewRight() const
Definition MyGUI_ICroppedRectangle.h:136
MyGUI::ICroppedRectangle::_getViewLeft
int _getViewLeft() const
Definition MyGUI_ICroppedRectangle.h:132
MyGUI::ICroppedRectangle::_getViewTop
int _getViewTop() const
Definition MyGUI_ICroppedRectangle.h:140
MyGUI::ICroppedRectangle::_getViewBottom
int _getViewBottom() const
Definition MyGUI_ICroppedRectangle.h:144
MyGUI::ILayer::getName
const std::string & getName() const
Definition MyGUI_ILayer.h:28
MyGUI::ILayer::getSize
virtual const IntSize & getSize() const =0
MyGUI::ILayerItem
Definition MyGUI_ILayerItem.h:20
MyGUI::ILayerItem::getLayerItemByPoint
virtual ILayerItem * getLayerItemByPoint(int _left, int _top) const =0
MyGUI::InputManager::unlinkWidget
void unlinkWidget(Widget *_widget)
Definition MyGUI_InputManager.cpp:695
MyGUI::InputManager::resetKeyFocusWidget
void resetKeyFocusWidget(Widget *_widget)
Definition MyGUI_InputManager.cpp:600
MyGUI::InputManager::_resetMouseFocusWidget
void _resetMouseFocusWidget()
Definition MyGUI_InputManager.cpp:441
MyGUI::InputManager::getInstance
static InputManager & getInstance()
MyGUI::LayerItem::detachFromLayerItemNode
void detachFromLayerItemNode(bool _deep)
Definition MyGUI_LayerItem.cpp:158
MyGUI::LayerItem::addChildItem
void addChildItem(LayerItem *_item)
Definition MyGUI_LayerItem.cpp:14
MyGUI::LayerItem::removeChildItem
void removeChildItem(LayerItem *_item)
Definition MyGUI_LayerItem.cpp:23
MyGUI::LayerItem::getLayer
ILayer * getLayer() const
Definition MyGUI_LayerItem.cpp:191
MyGUI::LayerItem::restoreLayerItem
void restoreLayerItem()
Definition MyGUI_LayerItem.cpp:79
MyGUI::LayerItem::saveLayerItem
void saveLayerItem()
Definition MyGUI_LayerItem.cpp:74
MyGUI::LayerManager::detachFromLayer
void detachFromLayer(Widget *_item)
Definition MyGUI_LayerManager.cpp:145
MyGUI::LayerManager::getInstance
static LayerManager & getInstance()
MyGUI::LayerManager::attachToLayerNode
void attachToLayerNode(std::string_view _name, Widget *_item)
Definition MyGUI_LayerManager.cpp:122
MyGUI::LayoutManager::getCurrentLayout
const std::string & getCurrentLayout() const
Definition MyGUI_LayoutManager.cpp:105
MyGUI::LayoutManager::getInstance
static LayoutManager & getInstance()
MyGUI::LayoutManager::getByName
ResourceLayout * getByName(std::string_view _name, bool _throw=true) const
Definition MyGUI_LayoutManager.cpp:86
MyGUI::RenderManager::getViewSize
virtual const IntSize & getViewSize() const =0
MyGUI::RenderManager::getInstance
static RenderManager & getInstance()
MyGUI::ResourceLayout
Definition MyGUI_ResourceLayout.h:19
MyGUI::ResourceLayout::createWidget
Widget * createWidget(const WidgetInfo &_widgetInfo, std::string_view _prefix={}, Widget *_parent=nullptr, bool _template=false)
Definition MyGUI_ResourceLayout.cpp:117
MyGUI::ResourceLayout::getLayoutData
const VectorWidgetInfo & getLayoutData() const
Definition MyGUI_ResourceLayout.cpp:224
MyGUI::ResourceSkin
Definition MyGUI_ResourceSkin.h:22
MyGUI::ResourceSkin::getSize
const IntSize & getSize() const
Definition MyGUI_ResourceSkin.cpp:259
MyGUI::ResourceSkin::getProperties
const MapString & getProperties() const
Definition MyGUI_ResourceSkin.cpp:279
MyGUI::ResourceSkin::getChild
const VectorChildSkinInfo & getChild() const
Definition MyGUI_ResourceSkin.cpp:284
MyGUI::SkinItem::_correctSkinItemView
void _correctSkinItemView()
Definition MyGUI_SkinItem.cpp:45
MyGUI::SkinItem::_setSkinItemAlpha
void _setSkinItemAlpha(float _value)
Definition MyGUI_SkinItem.cpp:39
MyGUI::SkinItem::_createSkinItem
void _createSkinItem(ResourceSkin *_info)
Definition MyGUI_SkinItem.cpp:73
MyGUI::SkinItem::_setSkinItemColour
void _setSkinItemColour(const Colour &_value)
Definition MyGUI_SkinItem.cpp:29
MyGUI::SkinItem::_setSkinItemState
bool _setSkinItemState(std::string_view _state)
Definition MyGUI_SkinItem.cpp:57
MyGUI::SkinItem::_deleteSkinItem
void _deleteSkinItem()
Definition MyGUI_SkinItem.cpp:110
MyGUI::SkinItem::_updateSkinItemView
void _updateSkinItemView()
Definition MyGUI_SkinItem.cpp:51
MyGUI::SkinItem::_setSubSkinVisible
void _setSubSkinVisible(bool _visible)
Definition MyGUI_SkinItem.cpp:139
MyGUI::SkinItem::_setSkinItemAlign
void _setSkinItemAlign(const IntSize &_size)
Definition MyGUI_SkinItem.cpp:17
MyGUI::SkinItem::_setSkinItemVisible
void _setSkinItemVisible(bool _value)
Definition MyGUI_SkinItem.cpp:23
MyGUI::SkinManager::getInstance
static SkinManager & getInstance()
MyGUI::SkinManager::getByName
ResourceSkin * getByName(std::string_view _name) const
Definition MyGUI_SkinManager.cpp:80
MyGUI::ToolTipManager::getInstance
static ToolTipManager & getInstance()
MyGUI::ToolTipManager::_unlinkWidget
void _unlinkWidget(Widget *_widget) override
Definition MyGUI_ToolTipManager.cpp:129
MyGUI::UserData::setUserString
void setUserString(std::string_view _key, std::string_view _value)
Definition MyGUI_WidgetUserData.cpp:14
MyGUI::UserData::setUserData
void setUserData(Any _data)
Definition MyGUI_WidgetUserData.cpp:54
MyGUI::Widget
widget description should be here.
Definition MyGUI_Widget.h:40
MyGUI::Widget::getParent
Widget * getParent() const
Definition MyGUI_Widget.cpp:1352
MyGUI::Widget::setAlpha
void setAlpha(float _alpha)
Definition MyGUI_Widget.cpp:466
MyGUI::Widget::getInheritedEnabled
bool getInheritedEnabled() const
Definition MyGUI_Widget.cpp:1412
MyGUI::Widget::_destroyAllChildWidget
void _destroyAllChildWidget()
Definition MyGUI_Widget.cpp:442
MyGUI::Widget::getLayerItemByPoint
ILayerItem * getLayerItemByPoint(int _left, int _top) const override
Definition MyGUI_Widget.cpp:496
MyGUI::Widget::setSize
void setSize(const IntSize &_size) override
Definition MyGUI_Widget.cpp:693
MyGUI::Widget::_checkPoint
bool _checkPoint(int _left, int _top) const
Definition MyGUI_Widget.cpp:1098
MyGUI::Widget::_destroyChildWidget
void _destroyChildWidget(Widget *_widget)
Definition MyGUI_Widget.cpp:411
MyGUI::Widget::setProperty
void setProperty(std::string_view _key, std::string_view _value)
Definition MyGUI_Widget.cpp:1135
MyGUI::Widget::onWidgetDestroy
virtual void onWidgetDestroy(Widget *_widget)
Definition MyGUI_Widget.cpp:1186
MyGUI::Widget::getSkinWidgetsByName
VectorWidgetPtr getSkinWidgetsByName(std::string_view _name) const
Definition MyGUI_Widget.cpp:1156
MyGUI::Widget::eventChangeProperty
EventHandle_WidgetStringString eventChangeProperty
Definition MyGUI_Widget.h:324
MyGUI::Widget::_setWidgetState
bool _setWidgetState(std::string_view _state)
Definition MyGUI_Widget.cpp:406
MyGUI::Widget::initialiseOverride
virtual void initialiseOverride()
Definition MyGUI_Widget.cpp:1122
MyGUI::Widget::getChildCount
size_t getChildCount() const
Definition MyGUI_Widget.cpp:999
MyGUI::Widget::getName
const std::string & getName() const
Get name of widget.
Definition MyGUI_Widget.cpp:1322
MyGUI::Widget::getChildAt
Widget * getChildAt(size_t _index) const
Definition MyGUI_Widget.cpp:1006
MyGUI::Widget::setPropertyOverride
virtual void setPropertyOverride(std::string_view _key, std::string_view _value)
Definition MyGUI_Widget.cpp:1218
MyGUI::Widget::_shutdown
void _shutdown()
Definition MyGUI_Widget.cpp:112
MyGUI::Widget::createWidgetRealT
Widget * createWidgetRealT(std::string_view _type, std::string_view _skin, const FloatCoord &_coord, Align _align, std::string_view _name={})
Definition MyGUI_Widget.cpp:349
MyGUI::Widget::setVisible
virtual void setVisible(bool _value)
Definition MyGUI_Widget.cpp:1022
MyGUI::Widget::getEnabled
bool getEnabled() const
Definition MyGUI_Widget.cpp:1362
MyGUI::Widget::_setAlign
void _setAlign(const IntSize &_oldsize, const IntSize &_newSize)
Definition MyGUI_Widget.cpp:612
MyGUI::Widget::baseUpdateEnable
virtual void baseUpdateEnable()
Definition MyGUI_Widget.cpp:1014
MyGUI::Widget::setPosition
void setPosition(const IntPoint &_point) override
Definition MyGUI_Widget.cpp:676
MyGUI::Widget::_initialise
void _initialise(WidgetStyle _style, const IntCoord &_coord, std::string_view _skinName, Widget *_parent, ICroppedRectangle *_croppedParent, std::string_view _name)
Definition MyGUI_Widget.cpp:31
MyGUI::Widget::setEnabled
virtual void setEnabled(bool _value)
Definition MyGUI_Widget.cpp:1049
MyGUI::Widget::attachToWidget
void attachToWidget(Widget *_parent, WidgetStyle _style=WidgetStyle::Child, std::string_view _layer={})
Definition MyGUI_Widget.cpp:842
MyGUI::Widget::WidgetManager
friend class WidgetManager
Definition MyGUI_Widget.h:42
MyGUI::Widget::getLayerItemCoord
const IntCoord & getLayerItemCoord() const override
Definition MyGUI_Widget.cpp:1402
MyGUI::Widget::getParentSize
IntSize getParentSize() const
Definition MyGUI_Widget.cpp:1082
MyGUI::Widget::changeWidgetSkin
void changeWidgetSkin(std::string_view _skinName)
Definition MyGUI_Widget.cpp:143
MyGUI::Widget::setInheritsAlpha
void setInheritsAlpha(bool _inherits)
Definition MyGUI_Widget.cpp:490
MyGUI::Widget::getVisible
bool getVisible() const
Definition MyGUI_Widget.cpp:1327
MyGUI::Widget::setDepth
void setDepth(int _value)
Definition MyGUI_Widget.cpp:1427
MyGUI::Widget::createWidgetT
Widget * createWidgetT(std::string_view _type, std::string_view _skin, const IntCoord &_coord, Align _align, std::string_view _name={})
Definition MyGUI_Widget.cpp:944
MyGUI::Widget::getClientWidget
Widget * getClientWidget()
Definition MyGUI_Widget.cpp:1367
MyGUI::Widget::detachFromWidget
void detachFromWidget(std::string_view _layer={})
Definition MyGUI_Widget.cpp:780
MyGUI::Widget::getClientCoord
IntCoord getClientCoord() const
Definition MyGUI_Widget.cpp:459
MyGUI::Widget::isRootWidget
bool isRootWidget() const
Definition MyGUI_Widget.cpp:1347
MyGUI::Widget::findWidget
Widget * findWidget(std::string_view _name)
Definition MyGUI_Widget.cpp:575
MyGUI::Widget::setWidgetStyle
void setWidgetStyle(WidgetStyle _style, std::string_view _layer={})
Definition MyGUI_Widget.cpp:930
MyGUI::Widget::getAlign
Align getAlign() const
Definition MyGUI_Widget.cpp:1332
MyGUI::Widget::setRealPosition
void setRealPosition(const FloatPoint &_point)
Definition MyGUI_Widget.cpp:591
MyGUI::Widget::eventChangeCoord
EventHandle_WidgetVoid eventChangeCoord
Definition MyGUI_Widget.h:330
MyGUI::Widget::onWidgetCreated
virtual void onWidgetCreated(Widget *_widget)
Definition MyGUI_Widget.cpp:1182
MyGUI::Widget::setAlign
virtual void setAlign(Align _value)
Definition MyGUI_Widget.cpp:775
MyGUI::Widget::getDepth
int getDepth() const
Definition MyGUI_Widget.cpp:1442
MyGUI::Widget::_resetContainer
virtual void _resetContainer(bool _update)
Definition MyGUI_Widget.cpp:1092
MyGUI::Widget::getWidgetStyle
WidgetStyle getWidgetStyle() const
Definition MyGUI_Widget.cpp:1377
MyGUI::Widget::setRealCoord
void setRealCoord(const FloatCoord &_coord)
Definition MyGUI_Widget.cpp:605
MyGUI::Widget::getInheritsAlpha
bool getInheritsAlpha() const
Definition MyGUI_Widget.cpp:1342
MyGUI::Widget::assignWidget
void assignWidget(T *&_widget, std::string_view _name)
Definition MyGUI_Widget.h:413
MyGUI::Widget::setWidgetClient
void setWidgetClient(Widget *_widget)
Definition MyGUI_Widget.cpp:1190
MyGUI::Widget::getAlpha
float getAlpha() const
Definition MyGUI_Widget.cpp:1337
MyGUI::Widget::setColour
void setColour(const Colour &_value)
Definition MyGUI_Widget.cpp:1074
MyGUI::Widget::_getContainer
Widget * _getContainer() const
Definition MyGUI_Widget.cpp:1392
MyGUI::Widget::_createSkinWidget
Widget * _createSkinWidget(WidgetStyle _style, std::string_view _type, std::string_view _skin, const IntCoord &_coord, Align _align, std::string_view _layer={}, std::string_view _name={})
Definition MyGUI_Widget.cpp:1206
MyGUI::Widget::_setContainer
void _setContainer(Widget *_value)
Definition MyGUI_Widget.cpp:1387
MyGUI::Widget::_getContainerIndex
virtual size_t _getContainerIndex(const IntPoint &_point) const
Definition MyGUI_Widget.cpp:1397
MyGUI::Widget::getTypeName
virtual std::string_view getTypeName() const override
Definition MyGUI_Widget.h:44
MyGUI::Widget::_updateView
void _updateView()
Definition MyGUI_Widget.cpp:359
MyGUI::Widget::_forcePick
void _forcePick(Widget *_widget)
Definition MyGUI_Widget.cpp:547
MyGUI::Widget::findWidgets
void findWidgets(std::string_view _name, VectorWidgetPtr &_result)
Definition MyGUI_Widget.cpp:1166
MyGUI::Widget::eventWidgetDestroyed
EventHandle_WidgetVoid eventWidgetDestroyed
Definition MyGUI_Widget.h:336
MyGUI::Widget::_getItemIndex
virtual size_t _getItemIndex(Widget *_item) const
Definition MyGUI_Widget.cpp:1382
MyGUI::Widget::shutdownOverride
virtual void shutdownOverride()
Definition MyGUI_Widget.cpp:1118
MyGUI::Widget::baseCreateWidget
Widget * baseCreateWidget(WidgetStyle _style, std::string_view _type, std::string_view _skin, const IntCoord &_coord, Align _align, std::string_view _layer, std::string_view _name, bool _template)
Definition MyGUI_Widget.cpp:293
MyGUI::Widget::_updateChilds
void _updateChilds()
Definition MyGUI_Widget.cpp:1467
MyGUI::Widget::setCoord
void setCoord(const IntCoord &_coord) override
Definition MyGUI_Widget.cpp:730
MyGUI::Widget::setRealSize
void setRealSize(const FloatSize &_size)
Definition MyGUI_Widget.cpp:598
MyGUI::Widget::setEnabledSilent
void setEnabledSilent(bool _value)
Definition MyGUI_Widget.cpp:1357
MyGUI::Widget::getEnumerator
EnumeratorWidgetPtr getEnumerator() const
Definition MyGUI_Widget.cpp:992
MyGUI::Widget::_getClientWidget
Widget * _getClientWidget()
If there is client widget return it, otherwise return this.
Definition MyGUI_Widget.cpp:1196
MyGUI::Widget::getInheritedVisible
bool getInheritedVisible() const
Definition MyGUI_Widget.cpp:1417
MyGUI::WidgetInput::getInheritsPick
bool getInheritsPick() const
Definition MyGUI_WidgetInput.cpp:167
MyGUI::WidgetInput::setNeedMouseFocus
void setNeedMouseFocus(bool _value)
Definition MyGUI_WidgetInput.cpp:152
MyGUI::WidgetInput::setMaskPick
void setMaskPick(const std::string &_filename)
Definition MyGUI_WidgetInput.cpp:14
MyGUI::WidgetInput::setNeedKeyFocus
void setNeedKeyFocus(bool _value)
Definition MyGUI_WidgetInput.cpp:142
MyGUI::WidgetInput::getNeedToolTip
bool getNeedToolTip() const
Definition MyGUI_WidgetInput.cpp:127
MyGUI::WidgetInput::getNeedMouseFocus
bool getNeedMouseFocus() const
Definition MyGUI_WidgetInput.cpp:157
MyGUI::WidgetInput::isMaskPickInside
bool isMaskPickInside(const IntPoint &_point, const IntCoord &_coord) const
Definition MyGUI_WidgetInput.cpp:27
MyGUI::WidgetInput::setInheritsPick
void setInheritsPick(bool _value)
Definition MyGUI_WidgetInput.cpp:162
MyGUI::WidgetInput::setPointer
void setPointer(std::string_view _value)
Definition MyGUI_WidgetInput.cpp:132
MyGUI::WidgetInput::setNeedToolTip
void setNeedToolTip(bool _value)
Definition MyGUI_WidgetInput.cpp:122
MyGUI::WidgetManager::createWidget
Widget * createWidget(WidgetStyle _style, std::string_view _type, std::string_view _skin, const IntCoord &_coord, Widget *_parent, ICroppedRectangle *_cropeedParent, std::string_view _name)
Definition MyGUI_WidgetManager.cpp:102
MyGUI::WidgetManager::getInstance
static WidgetManager & getInstance()
MyGUI::WidgetManager::_deleteWidget
void _deleteWidget(Widget *_widget)
Definition MyGUI_WidgetManager.cpp:170
MyGUI::WidgetManager::unlinkFromUnlinkers
void unlinkFromUnlinkers(Widget *_widget)
Definition MyGUI_WidgetManager.cpp:152
MyGUI::utility::parseValue
T parseValue(std::string_view _value)
Definition MyGUI_StringUtility.h:60
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::ALPHA_MAX
constexpr float ALPHA_MAX
Definition MyGUI_Macros.h:20
MyGUI::IntPoint
types::TPoint< int > IntPoint
Definition MyGUI_Types.h:27
MyGUI::FloatCoord
types::TCoord< float > FloatCoord
Definition MyGUI_Types.h:37
MyGUI::MapString
std::map< std::string, std::string, std::less<> > MapString
Definition MyGUI_Types.h:40
MyGUI::VectorWidgetInfo
std::vector< WidgetInfo > VectorWidgetInfo
Definition MyGUI_LayoutData.h:55
MyGUI::EnumeratorWidgetPtr
Enumerator< VectorWidgetPtr > EnumeratorWidgetPtr
Definition MyGUI_WidgetDefines.h:22
MyGUI::FloatPoint
types::TPoint< float > FloatPoint
Definition MyGUI_Types.h:28
MyGUI::ITEM_NONE
constexpr size_t ITEM_NONE
Definition MyGUI_Macros.h:19
MyGUI::FloatSize
types::TSize< float > FloatSize
Definition MyGUI_Types.h:31
MyGUI::IntCoord
types::TCoord< int > IntCoord
Definition MyGUI_Types.h:36
MyGUI::IntSize
types::TSize< int > IntSize
Definition MyGUI_Types.h:30
MyGUI::VectorWidgetPtr
std::vector< Widget * > VectorWidgetPtr
Definition MyGUI_WidgetDefines.h:20
MyGUI::VectorChildSkinInfo
std::vector< ChildSkinInfo > VectorChildSkinInfo
Definition MyGUI_ChildSkinInfo.h:40
MyGUI::Align
Definition MyGUI_Align.h:20
MyGUI::Align::Default
@ Default
Definition MyGUI_Align.h:36
MyGUI::Colour
Definition MyGUI_Colour.h:17
MyGUI::WidgetInfo
Definition MyGUI_LayoutData.h:23
MyGUI::WidgetInfo::userStrings
MapString userStrings
Definition MyGUI_LayoutData.h:35
MyGUI::WidgetInfo::properties
VectorStringPairs properties
Definition MyGUI_LayoutData.h:34
MyGUI::WidgetInfo::intCoord
IntCoord intCoord
Definition MyGUI_LayoutData.h:51
MyGUI::WidgetInfo::childWidgetsInfo
std::vector< WidgetInfo > childWidgetsInfo
Definition MyGUI_LayoutData.h:32
MyGUI::WidgetStyle
Definition MyGUI_WidgetStyle.h:19
MyGUI::WidgetStyle::Popup
@ Popup
Definition MyGUI_WidgetStyle.h:23
MyGUI::WidgetStyle::Child
@ Child
Definition MyGUI_WidgetStyle.h:22
MyGUI::WidgetStyle::Overlapped
@ Overlapped
Definition MyGUI_WidgetStyle.h:24
MyGUI::types::TCoord::height
T height
Definition MyGUI_TCoord.h:23
MyGUI::types::TCoord::width
T width
Definition MyGUI_TCoord.h:22
MyGUI::types::TCoord::top
T top
Definition MyGUI_TCoord.h:21
MyGUI::types::TCoord::point
TPoint< T > point() const
Definition MyGUI_TCoord.h:160
MyGUI::types::TCoord::size
TSize< T > size() const
Definition MyGUI_TCoord.h:165
MyGUI::types::TCoord::left
T left
Definition MyGUI_TCoord.h:20
MyGUI::types::TSize::width
T width
Definition MyGUI_TSize.h:19
MyGUI::types::TSize::height
T height
Definition MyGUI_TSize.h:20