You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
2.6 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. * Turbo Vision - Version 2.0
  3. *
  4. * Copyright (c) 1994 by Borland International
  5. * All Rights Reserved.
  6. *
  7. Modified by Robert H�hne to be used for RHIDE.
  8. Modified by Salvador E. Tropea: added i18n support, added T1StaticText.
  9. *
  10. *
  11. */
  12. /* ---------------------------------------------------------------------- */
  13. /* class TStaticText */
  14. /* */
  15. /* Palette layout */
  16. /* 1 = Text */
  17. /* ---------------------------------------------------------------------- */
  18. #if defined( Uses_TStaticText ) && !defined( TStaticText_defined )
  19. #define TStaticText_defined
  20. class TRect;
  21. class TStaticText : public TView
  22. {
  23. public:
  24. TStaticText( const TRect& bounds, const char *aText );
  25. TStaticText( const TRect& bounds, const char *aText, stTVIntl *aIntlText );
  26. ~TStaticText();
  27. virtual void draw();
  28. virtual TPalette& getPalette() const;
  29. virtual void getText( char *buf, int maxLen );
  30. const char *getText();
  31. protected:
  32. const char *text;
  33. stTVIntl *intlText;
  34. char noIntl;
  35. #if !defined( NO_STREAM )
  36. private:
  37. virtual const char *streamableName() const
  38. { return name; }
  39. protected:
  40. TStaticText( StreamableInit );
  41. virtual void write( opstream& );
  42. virtual void *read( ipstream& );
  43. public:
  44. static const char * const name;
  45. static TStreamable *build();
  46. #endif // NO_STREAM
  47. };
  48. #if !defined( NO_STREAM )
  49. inline ipstream& operator >> ( ipstream& is, TStaticText& cl )
  50. { return is >> (TStreamable&)cl; }
  51. inline ipstream& operator >> ( ipstream& is, TStaticText*& cl )
  52. { return is >> (void *&)cl; }
  53. inline opstream& operator << ( opstream& os, TStaticText& cl )
  54. { return os << (TStreamable&)cl; }
  55. inline opstream& operator << ( opstream& os, TStaticText* cl )
  56. { return os << (TStreamable *)cl; }
  57. #endif // NO_STREAM
  58. #endif // Uses_TStaticText
  59. #if defined( Uses_T1StaticText ) && !defined( T1StaticText_defined )
  60. #define T1StaticText_defined
  61. // This is based on TVTools idea, but I think is better to implement it
  62. // in this way and not like a macro.
  63. // I was forced to use growTo for the i18n stuff and the fact that
  64. // base constructors must be called first and that the order in which
  65. // gcc evaluated the arguments is random when optimizing.
  66. class T1StaticText : public TStaticText
  67. {
  68. public:
  69. T1StaticText(int x, int y, const char *aText) :
  70. TStaticText(TRect(x,y,x,y),aText)
  71. { growTo(cstrlen(TVIntl::getText(aText,intlText))+1,1); };
  72. }
  73. #endif // Uses_T1StaticText