CWindowObject.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #pragma once
  2. #include "../gui/CIntObject.h"
  3. //#include "../gui/SDL_Extensions.h"
  4. //#include "../../lib/FunctionList.h"
  5. struct SDL_Surface;
  6. struct Rect;
  7. class CAnimImage;
  8. class CLabel;
  9. class CAnimation;
  10. class CDefHandler;
  11. /*
  12. * CWindowObject.h, part of VCMI engine
  13. *
  14. * Authors: listed in file AUTHORS in main folder
  15. *
  16. * License: GNU General Public License v2.0 or later
  17. * Full text of license available in license.txt file, in main folder
  18. *
  19. */
  20. /// Basic class for windows
  21. class CWindowObject : public CIntObject
  22. {
  23. CPicture * createBg(std::string imageName, bool playerColored);
  24. int getUsedEvents(int options);
  25. CIntObject *shadow;
  26. void setShadow(bool on);
  27. int options;
  28. protected:
  29. CPicture * background;
  30. //Simple function with call to GH.popInt
  31. void close();
  32. //Used only if RCLICK_POPUP was set
  33. void clickRight(tribool down, bool previousState);
  34. //To display border
  35. void showAll(SDL_Surface *to);
  36. //change or set background image
  37. void setBackground(std::string filename);
  38. void updateShadow();
  39. public:
  40. enum EOptions
  41. {
  42. PLAYER_COLORED=1, //background will be player-colored
  43. RCLICK_POPUP=2, // window will behave as right-click popup
  44. BORDERED=4, // window will have border if current resolution is bigger than size of window
  45. SHADOW_DISABLED=8 //this window won't display any shadow
  46. };
  47. /*
  48. * options - EOpions enum
  49. * imageName - name for background image, can be empty
  50. * centerAt - position of window center. Default - center of the screen
  51. */
  52. CWindowObject(int options, std::string imageName, Point centerAt);
  53. CWindowObject(int options, std::string imageName = "");
  54. ~CWindowObject();
  55. };