1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Moved window stack management from GuiHandler to new class

This commit is contained in:
Ivan Savenko
2023-05-16 15:10:26 +03:00
parent ddf22a757d
commit 7838190ef4
40 changed files with 411 additions and 298 deletions

View File

@@ -14,6 +14,7 @@
#include "TextControls.h"
#include "../gui/CGuiHandler.h"
#include "../gui/WindowHandler.h"
#include "../renderSDL/SDL_Extensions.h"
#include "../windows/CCreatureWindow.h"
#include "../windows/GUIClasses.h"
@@ -174,7 +175,7 @@ bool CGarrisonSlot::viewInfo()
elem->block(true);
redraw();
GH.pushIntT<CStackWindow>(myStack, dism, pom, upgr);
GH.windows().pushIntT<CStackWindow>(myStack, dism, pom, upgr);
return true;
}
@@ -183,7 +184,7 @@ bool CGarrisonSlot::viewInfo()
bool CGarrisonSlot::highlightOrDropArtifact()
{
bool artSelected = false;
if (CWindowWithArtifacts* chw = dynamic_cast<CWindowWithArtifacts*>(GH.topInt().get())) //dirty solution
if (CWindowWithArtifacts* chw = dynamic_cast<CWindowWithArtifacts*>(GH.windows().topInt().get())) //dirty solution
{
const auto pickedArtInst = chw->getPickedArtifact();
@@ -252,7 +253,7 @@ bool CGarrisonSlot::split()
int countLeft = selection->myStack ? selection->myStack->count : 0;
int countRight = myStack ? myStack->count : 0;
GH.pushIntT<CSplitWindow>(selection->creature, std::bind(&CGarrisonInt::splitStacks, owner, _1, _2),
GH.windows().pushIntT<CSplitWindow>(selection->creature, std::bind(&CGarrisonInt::splitStacks, owner, _1, _2),
minLeft, minRight, countLeft, countRight);
return true;
}
@@ -289,7 +290,7 @@ void CGarrisonSlot::clickRight(tribool down, bool previousState)
{
if(creature && down)
{
GH.pushIntT<CStackWindow>(myStack, true);
GH.windows().pushIntT<CStackWindow>(myStack, true);
}
}