2021-09-24 16:42:36 +00:00
|
|
|
#include <string.h>
|
2021-09-25 05:22:19 +00:00
|
|
|
#include "ruamoko/qwaq/device/nameview.h"
|
2021-09-24 16:42:36 +00:00
|
|
|
|
|
|
|
@implementation NameView
|
|
|
|
|
|
|
|
-initWithName:(string)name
|
|
|
|
{
|
2021-09-25 05:22:19 +00:00
|
|
|
if (!(self = [super init])) {
|
2021-09-24 16:42:36 +00:00
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
self.name = name;
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void)dealloc
|
|
|
|
{
|
|
|
|
str_free (name);
|
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
|
|
|
+(NameView *)withName:(string)name
|
|
|
|
{
|
|
|
|
return [[[self alloc] initWithName:name] autorelease];
|
|
|
|
}
|
|
|
|
|
|
|
|
-draw
|
|
|
|
{
|
|
|
|
[super draw];
|
|
|
|
[self mvaddstr:{0, 0}, str_mid (name, 0, xlen)];
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|