mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 20:01:11 +00:00
* Source/NSOutlineView.m (-editColumn:...select:): Bring closer
to the new code in [-drawRow:clipRect:]. * Source/GSInfoPanel.m (-initWithDictionary:): Protect against icon being nil. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@32161 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f58e9c1d39
commit
89d6cc016c
3 changed files with 47 additions and 27 deletions
|
@ -1,3 +1,10 @@
|
|||
2011-02-14 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSOutlineView.m (-editColumn:...select:): Bring closer to
|
||||
the new code in [-drawRow:clipRect:].
|
||||
* Source/GSInfoPanel.m (-initWithDictionary:): Protect against
|
||||
icon being nil.
|
||||
|
||||
2011-02-14 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSCursor.m,
|
||||
|
|
|
@ -398,7 +398,11 @@ new_label (NSString *value)
|
|||
* Create GUI Objects
|
||||
*/
|
||||
f = NSZeroRect;
|
||||
f.size = [icon size];
|
||||
if (icon != nil)
|
||||
{
|
||||
f.size = [icon size];
|
||||
}
|
||||
|
||||
iconButton = AUTORELEASE([[NSButton alloc] initWithFrame: f]);
|
||||
[iconButton setImage: icon];
|
||||
[iconButton setBordered: NO];
|
||||
|
@ -477,7 +481,7 @@ new_label (NSString *value)
|
|||
*/
|
||||
|
||||
/** width **/
|
||||
tmp_A = [icon size].width;
|
||||
tmp_A = f.size.width;
|
||||
/* distance between icon and title */
|
||||
tmp_A += 10;
|
||||
/* compute the maximum of the following three sizes */
|
||||
|
@ -533,7 +537,7 @@ new_label (NSString *value)
|
|||
standard height of 48. The code tries to be nice so that 50 or
|
||||
47 should more or less work -- but beware that 200 or 20 will
|
||||
*not* work. */
|
||||
tmp_A = [icon size].height;
|
||||
tmp_A = f.size.height;
|
||||
|
||||
if (description)
|
||||
tmp_A += 10;
|
||||
|
|
|
@ -970,9 +970,9 @@ static NSImage *unexpandable = nil;
|
|||
imageRect.size.height = [image size].height;
|
||||
[imageCell drawWithFrame: imageRect inView: self];
|
||||
drawingRect.origin.x
|
||||
+= indentationFactor + [image size].width + 5;
|
||||
+= indentationFactor + imageRect.size.width + 5;
|
||||
drawingRect.size.width
|
||||
-= indentationFactor + [image size].width + 5;
|
||||
-= indentationFactor + imageRect.size.width + 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1459,7 +1459,7 @@ Also returns the child index relative to this parent. */
|
|||
{
|
||||
NSText *t;
|
||||
NSTableColumn *tb;
|
||||
NSRect drawingRect, imageRect;
|
||||
NSRect drawingRect;
|
||||
unsigned length = 0;
|
||||
int level = 0;
|
||||
float indentationFactor = 0.0;
|
||||
|
@ -1543,8 +1543,9 @@ Also returns the child index relative to this parent. */
|
|||
id item = nil;
|
||||
NSImage *image = nil;
|
||||
NSCell *imageCell = nil;
|
||||
NSRect imageRect;
|
||||
|
||||
item = [self itemAtRow: _editedRow];
|
||||
item = [self itemAtRow: rowIndex];
|
||||
// determine which image to use...
|
||||
if ([self isItemExpanded: item])
|
||||
{
|
||||
|
@ -1557,38 +1558,46 @@ Also returns the child index relative to this parent. */
|
|||
|
||||
if (![self isExpandable: item])
|
||||
{
|
||||
// image = unexpandable;
|
||||
image = nil;
|
||||
image = unexpandable;
|
||||
}
|
||||
|
||||
level = [self levelForItem: item];
|
||||
indentationFactor = _indentationPerLevel * level;
|
||||
|
||||
// create the image cell..
|
||||
imageCell = [[NSCell alloc] initImageCell: image];
|
||||
if (_indentationMarkerFollowsCell)
|
||||
imageRect = [self frameOfOutlineCellAtRow: rowIndex];
|
||||
|
||||
if ([_delegate respondsToSelector: @selector(outlineView:willDisplayOutlineCell:forTableColumn:item:)])
|
||||
{
|
||||
imageRect.origin.x = drawingRect.origin.x + indentationFactor;
|
||||
imageRect.origin.y = drawingRect.origin.y;
|
||||
[_delegate outlineView: self
|
||||
willDisplayOutlineCell: imageCell
|
||||
forTableColumn: tb
|
||||
item: item];
|
||||
}
|
||||
|
||||
|
||||
if ([imageCell image])
|
||||
{
|
||||
|
||||
imageRect.size.width = [image size].width;
|
||||
imageRect.size.height = [image size].height;
|
||||
|
||||
// draw...
|
||||
[self lockFocus];
|
||||
[imageCell drawWithFrame: imageRect inView: self];
|
||||
[self unlockFocus];
|
||||
|
||||
// move the drawing rect over like in the drawRow routine...
|
||||
drawingRect.origin.x += indentationFactor + 5 + imageRect.size.width;
|
||||
drawingRect.size.width -= indentationFactor + 5 + imageRect.size.width;
|
||||
}
|
||||
else
|
||||
{
|
||||
imageRect.origin.x = drawingRect.origin.x;
|
||||
imageRect.origin.y = drawingRect.origin.y;
|
||||
// move the drawing rect over like in the drawRow routine...
|
||||
drawingRect.origin.x += indentationFactor;
|
||||
drawingRect.size.width -= indentationFactor;
|
||||
}
|
||||
|
||||
imageRect.size.width = [image size].width;
|
||||
imageRect.size.height = [image size].height;
|
||||
|
||||
// draw...
|
||||
[self lockFocus];
|
||||
[imageCell drawWithFrame: imageRect inView: self];
|
||||
[self unlockFocus];
|
||||
|
||||
// move the drawing rect over like in the drawRow routine...
|
||||
drawingRect.origin.x += indentationFactor + 5 + [image size].width;
|
||||
drawingRect.size.width -= indentationFactor + 5 + [image size].width;
|
||||
|
||||
RELEASE(imageCell);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue