CHeroBackpackWindow.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * CHeroBackpackWindow.cpp, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #include "StdInc.h"
  11. #include "CHeroBackpackWindow.h"
  12. #include "../gui/CGuiHandler.h"
  13. #include "../gui/Shortcut.h"
  14. #include "../widgets/Buttons.h"
  15. #include "../widgets/Images.h"
  16. #include "CMessage.h"
  17. #include "render/Canvas.h"
  18. CHeroBackpackWindow::CHeroBackpackWindow(const CGHeroInstance * hero)
  19. : CWindowObject((EOptions)0)
  20. {
  21. OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
  22. stretchedBackground = std::make_shared<CFilledTexture>("DIBOXBCK", Rect(0, 0, 410, 425));
  23. pos.w = stretchedBackground->pos.w;
  24. pos.h = stretchedBackground->pos.h;
  25. center();
  26. arts = std::make_shared<CArtifactsOfHeroBackpack>(/*Point(-100, -170)*/Point(10, 10));
  27. arts->setHero(hero);
  28. addSet(arts);
  29. addCloseCallback(std::bind(&CHeroBackpackWindow::close, this));
  30. quitButton = std::make_shared<CButton>(Point(173, 385), "IOKAY32.def", CButton::tooltip(""), [this]() { close(); }, EShortcut::GLOBAL_RETURN);
  31. }
  32. void CHeroBackpackWindow::showAll(Canvas &to)
  33. {
  34. CIntObject::showAll(to);
  35. CMessage::drawBorder(PlayerColor(1), to.getInternalSurface(), pos.w+28, pos.h+29, pos.x-14, pos.y-15);
  36. }