quakeforge/ruamoko/gui/Text.r
Bill Currie e472364f51 call [self init] rather than [super init] (and variants where possible) to
ease derived class initialization (all allocation can be done in -init).
Objective-C rocks :)
2004-02-13 02:51:38 +00:00

40 lines
548 B
R

#include "gui/Text.h"
#include "string.h"
#include "draw.h"
@implementation Text
- (id) init
{
text = str_new ();
return self;
}
- (void) dealloc
{
str_free (text);
}
- (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
{
local integer maxlen = xlen / 8;
Draw_nString (xabs, yabs, text, maxlen);
}
@end