CWindowObject.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * CWindowObject.h, 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. #pragma once
  11. #include "../gui/CIntObject.h"
  12. class CGStatusBar;
  13. class CWindowObject : public WindowBase
  14. {
  15. std::shared_ptr<CPicture> createBg(std::string imageName, bool playerColored);
  16. int getUsedEvents(int options);
  17. std::vector<std::shared_ptr<CPicture>> shadowParts;
  18. void setShadow(bool on);
  19. int options;
  20. protected:
  21. std::shared_ptr<CPicture> background;
  22. //Used only if RCLICK_POPUP was set
  23. bool isPopupWindow() const override;
  24. //To display border
  25. void updateShadow();
  26. void setBackground(std::string filename);
  27. public:
  28. enum EOptions
  29. {
  30. PLAYER_COLORED=1, //background will be player-colored
  31. RCLICK_POPUP=2, // window will behave as right-click popup
  32. BORDERED=4, // window will have border if current resolution is bigger than size of window
  33. SHADOW_DISABLED=8 //this window won't display any shadow
  34. };
  35. /*
  36. * options - EOpions enum
  37. * imageName - name for background image, can be empty
  38. * centerAt - position of window center. Default - center of the screen
  39. */
  40. CWindowObject(int options, std::string imageName, Point centerAt);
  41. CWindowObject(int options, std::string imageName = "");
  42. ~CWindowObject();
  43. void showAll(Canvas & to) override;
  44. };
  45. class CStatusbarWindow : public CWindowObject
  46. {
  47. public:
  48. CStatusbarWindow(int options, std::string imageName, Point centerAt);
  49. CStatusbarWindow(int options, std::string imageName = "");
  50. protected:
  51. std::shared_ptr<CGStatusBar> statusbar;
  52. };