Author: mlytwyn
Date: Wed Apr 6 22:58:26 2016
New Revision: 39637
URL: http://svn.gna.org/viewcvs/gnustep?rev=39637&view=rev
Log:
Fix NSCollectionView within a NSScrollView/NSClipView
Modified:
libs/gui/branches/gnustep_testplant_branch/Source/NSCollectionView.m
Modified: libs/gui/branches/gnustep_testplant_branch/Source/NSCollectionView.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Source/NSCollectionView.m?rev=39637&r1=39636&r2=39637&view=diff
==============================================================================
--- libs/gui/branches/gnustep_testplant_branch/Source/NSCollectionView.m
(original)
+++ libs/gui/branches/gnustep_testplant_branch/Source/NSCollectionView.m
Wed Apr 6 22:58:26 2016
@@ -597,6 +597,48 @@
_tileWidth = width;
[self setFrameSize: NSMakeSize(width, proposedHeight)];
[self setNeedsDisplay: YES];
+}
+
+- (NSSize)_minVisibleSize
+{
+ NSSize minSize = NSMakeSize(_itemSize.width * _numberOfColumns, 1e20);
+
+ if (_numberOfColumns != 0 )
+ {
+ NSInteger rows = ceil((CGFloat)[_content count] /
(CGFloat)_numberOfColumns);
+ minSize.height = _itemSize.height * rows;
+ }
+ return minSize;
+}
+
+- (void)setFrame:(NSRect)newFrame
+{
+ // FIXME: This SHOULD be moved to a central location for
NSSCrollView/NSClipView processing
+ // Are we under a clip view...
+ if ([[self superview] respondsToSelector: @selector(documentVisibleRect)])
+ {
+ NSSize clipSize = [(NSClipView *)_super_view documentVisibleRect].size;
+ NSSize minSize = [self _minVisibleSize];
+
+ // FIXME: Process width...
+ newFrame.size.height = MAX(minSize.height, clipSize.height);
+ }
+ [super setFrame: newFrame];
+}
+
+- (void)setFrameSize:(NSSize)newSize
+{
+ // FIXME: This SHOULD be moved to a central location for
NSSCrollView/NSClipView processing
+ // Are we under a clip view...implementation similar to NSTableView...
+ if ([[self superview] respondsToSelector: @selector(documentVisibleRect)])
+ {
+ NSSize clipSize = [(NSClipView *)_super_view documentVisibleRect].size;
+ NSSize minSize = [self _minVisibleSize];
+
+ // FIXME: Process width...
+ newSize.height = MAX(minSize.height, clipSize.height);
+ }
+ [super setFrameSize: newSize];
}
- (void) resizeSubviewsWithOldSize: (NSSize)aSize
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs