CWindowObject.h 1.4 KB

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