mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 16:10:55 +00:00
Rewritten much
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@6306 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
457c3527f4
commit
4b2cb3d369
1 changed files with 37 additions and 26 deletions
|
@ -74,6 +74,7 @@
|
||||||
// We do not RETAIN aTableView but aTableView is supposed
|
// We do not RETAIN aTableView but aTableView is supposed
|
||||||
// to RETAIN us.
|
// to RETAIN us.
|
||||||
_tableView = aTableView;
|
_tableView = aTableView;
|
||||||
|
|
||||||
}
|
}
|
||||||
- (NSTableView*)tableView
|
- (NSTableView*)tableView
|
||||||
{
|
{
|
||||||
|
@ -102,33 +103,28 @@
|
||||||
*/
|
*/
|
||||||
- (int)columnAtPoint: (NSPoint)aPoint
|
- (int)columnAtPoint: (NSPoint)aPoint
|
||||||
{
|
{
|
||||||
// TODO
|
if (_tableView == nil)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
/* Ask to the tableview, which is caching geometry info */
|
||||||
|
aPoint = [self convertPoint: aPoint toView: _tableView];
|
||||||
|
aPoint.y = [_tableView bounds].origin.y;
|
||||||
|
return [_tableView columnAtPoint: aPoint];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSRect)headerRectOfColumn: (int)columnIndex
|
- (NSRect)headerRectOfColumn: (int)columnIndex
|
||||||
{
|
{
|
||||||
NSArray* columns;
|
|
||||||
NSRect rect;
|
NSRect rect;
|
||||||
int i;
|
|
||||||
|
|
||||||
if (_tableView == nil)
|
if (_tableView == nil)
|
||||||
return NSZeroRect;
|
return NSZeroRect;
|
||||||
|
|
||||||
columns = [_tableView tableColumns];
|
/* Ask to the tableview, which is caching geometry info */
|
||||||
|
rect = [_tableView rectOfColumn: columnIndex];
|
||||||
NSAssert(columnIndex > 0, NSInternalInconsistencyException);
|
rect = [self convertRect: rect fromView: _tableView];
|
||||||
NSAssert(columnIndex < [columns count], NSInternalInconsistencyException);
|
|
||||||
|
|
||||||
rect.origin.x = _bounds.origin.x;
|
|
||||||
rect.origin.y = _bounds.origin.y;
|
rect.origin.y = _bounds.origin.y;
|
||||||
rect.size.height = _bounds.size.height;
|
rect.size.height = _bounds.size.height;
|
||||||
|
|
||||||
for (i = 0; i < columnIndex; i++)
|
|
||||||
{
|
|
||||||
rect.origin.x += [[columns objectAtIndex: i] width];
|
|
||||||
}
|
|
||||||
rect.size.width = [[columns objectAtIndex: columnIndex] width];
|
|
||||||
|
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,24 +133,39 @@
|
||||||
*/
|
*/
|
||||||
- (void)drawRect: (NSRect)aRect
|
- (void)drawRect: (NSRect)aRect
|
||||||
{
|
{
|
||||||
NSArray* columns;
|
NSArray *columns;
|
||||||
NSRange columnsToDraw;
|
int firstColumnToDraw;
|
||||||
|
int lastColumnToDraw;
|
||||||
|
NSRect drawingRect;
|
||||||
|
NSTableColumn *column;
|
||||||
|
float width;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (_tableView == nil)
|
if (_tableView == nil)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
columnsToDraw = [_tableView columnsInRect: aRect];
|
firstColumnToDraw = [self columnAtPoint: NSMakePoint (aRect.origin.x,
|
||||||
if (columnsToDraw.length == 0)
|
aRect.origin.y)];
|
||||||
return;
|
if (firstColumnToDraw == -1)
|
||||||
|
firstColumnToDraw = 0;
|
||||||
|
|
||||||
|
lastColumnToDraw = [self columnAtPoint: NSMakePoint (NSMaxX (aRect),
|
||||||
|
aRect.origin.y)];
|
||||||
|
if (lastColumnToDraw == -1)
|
||||||
|
lastColumnToDraw = [_tableView numberOfColumns] - 1;
|
||||||
|
|
||||||
|
drawingRect = [self headerRectOfColumn: firstColumnToDraw];
|
||||||
|
|
||||||
columns = [_tableView tableColumns];
|
columns = [_tableView tableColumns];
|
||||||
|
|
||||||
for (i = columnsToDraw.location; i < columnsToDraw.length + 1; i++)
|
for (i = firstColumnToDraw; i <= lastColumnToDraw; i++)
|
||||||
{
|
{
|
||||||
[[[columns objectAtIndex: i] headerCell]
|
column = [columns objectAtIndex: i];
|
||||||
drawWithFrame: [self headerRectOfColumn: i]
|
width = [column width];
|
||||||
|
drawingRect.size.width = width;
|
||||||
|
[[column headerCell] drawWithFrame: drawingRect
|
||||||
inView: self];
|
inView: self];
|
||||||
|
drawingRect.origin.x += width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
-(void)mouseDown: (NSEvent*)event
|
-(void)mouseDown: (NSEvent*)event
|
||||||
|
|
Loading…
Reference in a new issue