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. 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, //background will be player-colored
  35. RCLICK_POPUP=2, // window will behave as right-click popup
  36. BORDERED=4, // window will have border if current resolution is bigger than size of window
  37. SHADOW_DISABLED=8 //this window won't display any shadow
  38. };
  39. /*
  40. * options - EOpions enum
  41. * imageName - name for background image, can be empty
  42. * centerAt - position of window center. Default - center of the screen
  43. */
  44. CWindowObject(int options, std::string imageName, Point centerAt);
  45. CWindowObject(int options, std::string imageName = "");
  46. ~CWindowObject();
  47. };