mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
[qwaq] Support resizing the table view
This commit is contained in:
parent
0da92e33f6
commit
beecdcadbf
3 changed files with 30 additions and 1 deletions
|
@ -87,7 +87,8 @@
|
|||
locals_data = [[LocalsData withTarget:target] retain];
|
||||
locals_view = [TableView withRect:{{1, 1}, {38, 8}}];
|
||||
[locals_view addColumn:[TableViewColumn named:"name" width:12]];
|
||||
[locals_view addColumn:[TableViewColumn named:"value" width:26]];
|
||||
[locals_view addColumn:[[TableViewColumn named:"value" width:26]
|
||||
setGrowMode:gfGrowHiX]];
|
||||
ScrollBar *sb = [ScrollBar vertical:8 at:{39, 1}];
|
||||
[locals_view setVerticalScrollBar:sb];
|
||||
[locals_view setDataSource:locals_data];
|
||||
|
|
|
@ -21,9 +21,14 @@
|
|||
{
|
||||
string name;
|
||||
int width;
|
||||
int growMode; // Y flags ignored
|
||||
}
|
||||
+(TableViewColumn *)named:(string)name;
|
||||
+(TableViewColumn *)named:(string)name width:(int)width;
|
||||
|
||||
-setGrowMode: (int) mode;
|
||||
-(int)growMode;
|
||||
|
||||
-(string)name;
|
||||
-(int)width;
|
||||
@end
|
||||
|
|
|
@ -23,6 +23,17 @@
|
|||
return [[[self alloc] initWithName:name width:width] autorelease];
|
||||
}
|
||||
|
||||
-setGrowMode: (int) mode
|
||||
{
|
||||
growMode = mode;
|
||||
return self;
|
||||
}
|
||||
|
||||
-(int)growMode
|
||||
{
|
||||
return growMode;
|
||||
}
|
||||
|
||||
-(string)name
|
||||
{
|
||||
return name;
|
||||
|
@ -38,6 +49,14 @@
|
|||
self.width = width;
|
||||
return self;
|
||||
}
|
||||
|
||||
-grow:(Extent)delta
|
||||
{
|
||||
if (growMode & gfGrowHiX) {
|
||||
width += delta.width;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation TableView
|
||||
|
@ -51,6 +70,7 @@
|
|||
buffer = [[DrawBuffer buffer:size] retain];
|
||||
[buffer bkgd:' '];
|
||||
[onViewScrolled addListener:self :@selector(onScroll:)];
|
||||
growMode = gfGrowHi;
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -85,6 +105,9 @@
|
|||
Extent size = self.size;
|
||||
[super resize:delta];
|
||||
[buffer resizeTo:self.size];
|
||||
for (int i = [columns count]; i-- > 0; ) {
|
||||
[[columns objectAtIndex: i] grow: delta];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue