mirror of
https://github.com/edubart/otclient.git
synced 2025-10-20 06:23:26 +02:00
Refactor for documentation
This commit is contained in:
@@ -119,7 +119,7 @@ bool UIGridLayout::internalUpdate()
|
||||
|
||||
if(m_fitChildren && preferredHeight != parentWidget->getHeight()) {
|
||||
// must set the preferred height later
|
||||
g_eventDispatcher.addEvent([=] {
|
||||
g_dispatcher.addEvent([=] {
|
||||
parentWidget->setHeight(preferredHeight);
|
||||
});
|
||||
}
|
||||
|
@@ -85,7 +85,7 @@ bool UIHorizontalLayout::internalUpdate()
|
||||
|
||||
if(m_fitChildren && preferredWidth != parentWidget->getWidth()) {
|
||||
// must set the preferred width later
|
||||
g_eventDispatcher.addEvent([=] {
|
||||
g_dispatcher.addEvent([=] {
|
||||
parentWidget->setWidth(preferredWidth);
|
||||
});
|
||||
}
|
||||
|
@@ -65,7 +65,7 @@ void UILayout::updateLater()
|
||||
return;
|
||||
|
||||
auto self = asUILayout();
|
||||
g_eventDispatcher.addEvent([self] {
|
||||
g_dispatcher.addEvent([self] {
|
||||
self->m_updateScheduled = false;
|
||||
self->update();
|
||||
});
|
||||
|
@@ -214,7 +214,7 @@ void UIManager::updateHoveredWidget()
|
||||
if(m_hoverUpdateScheduled)
|
||||
return;
|
||||
|
||||
g_eventDispatcher.addEvent([this] {
|
||||
g_dispatcher.addEvent([this] {
|
||||
if(!m_rootWidget)
|
||||
return;
|
||||
|
||||
@@ -278,11 +278,11 @@ void UIManager::onWidgetDestroy(const UIWidgetPtr& widget)
|
||||
if(m_checkEvent && !m_checkEvent->isExecuted())
|
||||
return;
|
||||
|
||||
m_checkEvent = g_eventDispatcher.scheduleEvent([this] {
|
||||
m_checkEvent = g_dispatcher.scheduleEvent([this] {
|
||||
g_lua.collectGarbage();
|
||||
UIWidgetList backupList = m_destroyedWidgets;
|
||||
m_destroyedWidgets.clear();
|
||||
g_eventDispatcher.scheduleEvent([backupList] {
|
||||
g_dispatcher.scheduleEvent([backupList] {
|
||||
g_lua.collectGarbage();
|
||||
for(const UIWidgetPtr& widget : backupList) {
|
||||
if(widget->getUseCount() != 1)
|
||||
@@ -404,7 +404,7 @@ UIWidgetPtr UIManager::loadUI(const std::string& file, const UIWidgetPtr& parent
|
||||
}
|
||||
}
|
||||
|
||||
UIWidgetPtr UIManager::createWidgetFromStyle(const std::string& styleName, const UIWidgetPtr& parent)
|
||||
UIWidgetPtr UIManager::createWidget(const std::string& styleName, const UIWidgetPtr& parent)
|
||||
{
|
||||
OTMLNodePtr node = OTMLNode::create(styleName);
|
||||
try {
|
||||
|
@@ -49,7 +49,8 @@ public:
|
||||
std::string getStyleClass(const std::string& styleName);
|
||||
|
||||
UIWidgetPtr loadUI(const std::string& file, const UIWidgetPtr& parent);
|
||||
UIWidgetPtr createWidgetFromStyle(const std::string& styleName, const UIWidgetPtr& parent);
|
||||
UIWidgetPtr displayUI(const std::string& file) { return loadUI(file, m_rootWidget); }
|
||||
UIWidgetPtr createWidget(const std::string& styleName, const UIWidgetPtr& parent);
|
||||
UIWidgetPtr createWidgetFromOTML(const OTMLNodePtr& widgetNode, const UIWidgetPtr& parent);
|
||||
|
||||
void setMouseReceiver(const UIWidgetPtr& widget) { m_mouseReceiver = widget; }
|
||||
|
@@ -86,7 +86,7 @@ bool UIVerticalLayout::internalUpdate()
|
||||
|
||||
if(m_fitChildren && preferredHeight != parentWidget->getHeight()) {
|
||||
// must set the preferred width later
|
||||
g_eventDispatcher.addEvent([=] {
|
||||
g_dispatcher.addEvent([=] {
|
||||
parentWidget->setHeight(preferredHeight);
|
||||
});
|
||||
}
|
||||
|
@@ -505,7 +505,7 @@ void UIWidget::applyStyle(const OTMLNodePtr& styleNode)
|
||||
|
||||
if(m_firstOnStyle) {
|
||||
auto self = asUIWidget();
|
||||
g_eventDispatcher.addEvent([self] {
|
||||
g_dispatcher.addEvent([self] {
|
||||
self->callLuaField("onSetup");
|
||||
});
|
||||
// always focus new child
|
||||
@@ -832,7 +832,7 @@ bool UIWidget::setRect(const Rect& rect)
|
||||
// avoid massive update events
|
||||
if(!m_updateEventScheduled) {
|
||||
UIWidgetPtr self = asUIWidget();
|
||||
g_eventDispatcher.addEvent([self, oldRect]() {
|
||||
g_dispatcher.addEvent([self, oldRect]() {
|
||||
self->m_updateEventScheduled = false;
|
||||
if(oldRect != self->getRect())
|
||||
self->onGeometryChange(oldRect, self->getRect());
|
||||
@@ -1318,7 +1318,7 @@ void UIWidget::updateStyle()
|
||||
|
||||
if(m_loadingStyle && !m_updateStyleScheduled) {
|
||||
UIWidgetPtr self = asUIWidget();
|
||||
g_eventDispatcher.addEvent([self] {
|
||||
g_dispatcher.addEvent([self] {
|
||||
self->m_updateStyleScheduled = false;
|
||||
self->updateStyle();
|
||||
});
|
||||
|
Reference in New Issue
Block a user