diff options
Diffstat (limited to 'setedit/settvuti/nostatex.cc')
-rw-r--r-- | setedit/settvuti/nostatex.cc | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/setedit/settvuti/nostatex.cc b/setedit/settvuti/nostatex.cc new file mode 100644 index 0000000..9c8b2eb --- /dev/null +++ b/setedit/settvuti/nostatex.cc @@ -0,0 +1,42 @@ +/* Copyright (C) 1996-2005 by Salvador E. Tropea (SET), + see copyrigh file for details */ +#define Uses_string + +#define Uses_TNoStaticText +#include <settvuti.h> + +TNoStaticText::TNoStaticText(const TRect& bounds, const char *aText) : + TStaticText(bounds,aText) +{ + startLen=strlen(getText()); +} + +TNoStaticText::TNoStaticText(const TRect& bounds, const char *aText, + stTVIntl *cache) : + TStaticText(bounds,aText,cache) +{ + startLen=strlen(getText()); +} + +void TNoStaticText::setText(const char *s) +{ + if (0) + {// Old behavior, I don't think it really helps + int l=strlen(s); + int copy=min(startLen,l); + memcpy((char *)text,s,copy); + int rest=startLen-copy; + if (rest) + memset((char *)text+copy,' ',rest); + } + else + {// New behavior, the draw() member will limit the size and also pad with + // spaces. + delete[] text; + text=newStr(s); + startLen=strlen(getText()); + } + + TVIntl::freeSt(intlText); // Invalidate i18n cache + draw(); +} |