CWindowObject.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. CPicture * createBg(std::string imageName, bool playerColored);
  16. int getUsedEvents(int options);
  17. CIntObject * shadow;
  18. void setShadow(bool on);
  19. int options;
  20. protected:
  21. 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 showAll(SDL_Surface * to) override;
  28. //change or set background image
  29. void setBackground(std::string filename);
  30. void updateShadow();
  31. public:
  32. enum EOptions
  33. {
  34. PLAYER_COLORED=1,
  35. //background will be player-colored
  36. RCLICK_POPUP=2,
  37. // window will behave as right-click popup
  38. BORDERED=4,
  39. // window will have border if current resolution is bigger than size of window
  40. SHADOW_DISABLED=8 //this window won't display any shadow
  41. };
  42. /*
  43. * options - EOpions enum
  44. * imageName - name for background image, can be empty
  45. * centerAt - position of window center. Default - center of the screen
  46. */
  47. CWindowObject(int options, std::string imageName, Point centerAt);
  48. CWindowObject(int options, std::string imageName = "");
  49. ~CWindowObject();
  50. };