mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
@@ -600,6 +600,9 @@ void Application::registerLuaFunctions()
|
||||
g_lua.bindClassMemberFunction<UIGridLayout>("setFlow", &UIGridLayout::setFlow);
|
||||
g_lua.bindClassMemberFunction<UIGridLayout>("setNumColumns", &UIGridLayout::setNumColumns);
|
||||
g_lua.bindClassMemberFunction<UIGridLayout>("setNumLines", &UIGridLayout::setNumLines);
|
||||
g_lua.bindClassMemberFunction<UIGridLayout>("getNumColumns", &UIGridLayout::getNumColumns);
|
||||
g_lua.bindClassMemberFunction<UIGridLayout>("getNumLines", &UIGridLayout::getNumLines);
|
||||
g_lua.bindClassMemberFunction<UIGridLayout>("getCellSize", &UIGridLayout::getCellSize);
|
||||
g_lua.bindClassMemberFunction<UIGridLayout>("isUIGridLayout", &UIGridLayout::isUIGridLayout);
|
||||
|
||||
// UIAnchorLayout
|
||||
|
@@ -37,7 +37,6 @@ void UIGridLayout::applyStyle(const OTMLNodePtr& styleNode)
|
||||
{
|
||||
UILayout::applyStyle(styleNode);
|
||||
|
||||
|
||||
for(const OTMLNodePtr& node : styleNode->children()) {
|
||||
if(node->tag() == "cell-size")
|
||||
setCellSize(node->value<Size>());
|
||||
@@ -83,8 +82,13 @@ bool UIGridLayout::internalUpdate()
|
||||
Point topLeft = clippingRect.topLeft();
|
||||
|
||||
int numColumns = m_numColumns;
|
||||
if(m_flow && m_cellSize.width() > 0)
|
||||
if(m_flow && m_cellSize.width() > 0) {
|
||||
numColumns = clippingRect.width() / (m_cellSize.width() + m_cellSpacing);
|
||||
if(numColumns > 0) {
|
||||
m_numColumns = numColumns;
|
||||
m_numLines = std::ceil(widgets.size() / (float)numColumns);
|
||||
}
|
||||
}
|
||||
|
||||
if(numColumns <= 0)
|
||||
numColumns = 1;
|
||||
|
@@ -45,6 +45,10 @@ public:
|
||||
void setFitChildren(bool enable) { m_fitChildren = enable; update(); }
|
||||
void setFlow(bool enable) { m_flow = enable; update(); }
|
||||
|
||||
Size getCellSize() { return m_cellSize; }
|
||||
int getNumColumns() { return m_numColumns; }
|
||||
int getNumLines() { return m_numLines; }
|
||||
|
||||
virtual bool isUIGridLayout() { return true; }
|
||||
|
||||
protected:
|
||||
@@ -61,4 +65,3 @@ private:
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -180,7 +180,11 @@ void Game::processOpenContainer(int containerId, const ItemPtr& containerItem, c
|
||||
m_containers[containerId] = container;
|
||||
container->onAddItems(items);
|
||||
|
||||
// we might want to close a container here
|
||||
enableBotCall();
|
||||
container->onOpen(previousContainer);
|
||||
disableBotCall();
|
||||
|
||||
if(previousContainer)
|
||||
previousContainer->onClose();
|
||||
}
|
||||
|
Reference in New Issue
Block a user