PolyLabel.h 1014 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * PolyLabel.h
  3. * Poly
  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 "PolyString.h"
  12. #include "PolyGlobals.h"
  13. #include "PolyFont.h"
  14. #include "PolyImage.h"
  15. #include "PolyUtil.h"
  16. #include <string>
  17. using namespace std;
  18. using std::wstring;
  19. #define TAB_REPLACE " "
  20. namespace Polycode {
  21. class _PolyExport Label : public Image {
  22. public:
  23. Label(Font *font, String text, int size, int antiAliasMode);
  24. ~Label();
  25. void setText(String text);
  26. String getText();
  27. int getTextWidth(Font *font, String text, int size);
  28. int getTextHeight(Font *font, String text, int size);
  29. Number getTextWidth();
  30. Number getTextHeight();
  31. Font *getFont();
  32. static const int ANTIALIAS_FULL = 0;
  33. static const int ANTIALIAS_NONE = 1;
  34. private:
  35. Number currentTextWidth;
  36. Number currentTextHeight;
  37. int antiAliasMode;
  38. int size;
  39. String text;
  40. Font *font;
  41. };
  42. }