PolyLabel.h 992 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * PolyLabel.h
  3. * TAU
  4. *
  5. * Created by Ivan Safrin on 3/16/08.
  6. * Copyright 2008 __MyCompanyName__. All rights reserved.
  7. *
  8. */
  9. // @package BasicTypes
  10. #pragma once
  11. #include "PolyGlobals.h"
  12. #include "PolyFont.h"
  13. #include "PolyImage.h"
  14. #include "PolyUtil.h"
  15. #include <string>
  16. using namespace std;
  17. using std::wstring;
  18. #define TAB_REPLACE " "
  19. namespace Polycode {
  20. class _PolyExport Label : public Image {
  21. public:
  22. Label(Font *font, wstring text, int size, int antiAliasMode);
  23. ~Label();
  24. void setText(wstring text);
  25. wstring getText();
  26. int getTextWidth(Font *font, wstring text, int size);
  27. int getTextHeight(Font *font, wstring text, int size);
  28. float getTextWidth();
  29. float getTextHeight();
  30. Font *getFont();
  31. static const int ANTIALIAS_FULL = 0;
  32. static const int ANTIALIAS_NONE = 1;
  33. private:
  34. float currentTextWidth;
  35. float currentTextHeight;
  36. int antiAliasMode;
  37. int size;
  38. wstring text;
  39. Font *font;
  40. };
  41. }