2020-03-23 13:01:13 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
2020-06-21 14:15:17 +00:00
|
|
|
#include "ruamoko/qwaq/ui/group.h"
|
|
|
|
#include "ruamoko/qwaq/ui/titlebar.h"
|
2020-03-23 13:01:13 +00:00
|
|
|
|
|
|
|
@implementation TitleBar
|
|
|
|
|
2020-03-30 07:30:58 +00:00
|
|
|
+(TitleBar *)withTitle:(string)title
|
|
|
|
{
|
|
|
|
return [[[self alloc] initWithTitle:title] autorelease];
|
|
|
|
}
|
|
|
|
|
2020-03-23 13:01:13 +00:00
|
|
|
-initWithTitle:(string) title
|
|
|
|
{
|
|
|
|
if (!(self = [super init])) {
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
self.title = title;
|
|
|
|
length = strlen (title);
|
|
|
|
growMode = gfGrowHiX;
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
-setTitle:(string) newTitle
|
|
|
|
{
|
|
|
|
title = newTitle;
|
|
|
|
length = strlen (title);
|
|
|
|
[self redraw];
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2021-09-26 01:07:34 +00:00
|
|
|
-(string)title
|
|
|
|
{
|
|
|
|
return title;
|
|
|
|
}
|
|
|
|
|
2020-03-23 13:01:13 +00:00
|
|
|
-setOwner: (Group *) owner
|
|
|
|
{
|
|
|
|
[super setOwner: owner];
|
|
|
|
size = [owner size];
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
-draw
|
|
|
|
{
|
|
|
|
[super draw];
|
|
|
|
[self mvaddstr: { (xlen - length) / 2, 0}, title];
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|