2004-02-04 02:35:57 +00:00
|
|
|
#include "gui/Text.h"
|
|
|
|
#include "string.h"
|
|
|
|
#include "draw.h"
|
|
|
|
|
|
|
|
@implementation Text
|
2004-02-13 02:51:38 +00:00
|
|
|
- (id) init
|
|
|
|
{
|
|
|
|
text = str_new ();
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) dealloc
|
|
|
|
{
|
|
|
|
str_free (text);
|
2004-02-13 05:36:35 +00:00
|
|
|
[super dealloc];
|
2004-02-13 02:51:38 +00:00
|
|
|
}
|
|
|
|
|
2004-02-04 02:35:57 +00:00
|
|
|
- (id) initWithBounds: (Rect)aRect
|
|
|
|
{
|
|
|
|
return [self initWithBounds:aRect text:""];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) initWithBounds: (Rect)aRect text:(string)str
|
|
|
|
{
|
|
|
|
self = [super initWithBounds:aRect];
|
|
|
|
str_copy (text, str);
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setText: (string)str
|
|
|
|
{
|
|
|
|
str_copy (text, str);
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) draw
|
|
|
|
{
|
2011-03-25 07:46:32 +00:00
|
|
|
local int maxlen = xlen / 8;
|
2004-02-04 02:35:57 +00:00
|
|
|
Draw_nString (xabs, yabs, text, maxlen);
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|