CWindowObject.h 1.4 KB

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