Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

UKViewListView can now also resize the containing window to fit the v…

…isible views it has lined up, if desired.
  • Loading branch information...
commit 85eaed784118876b39a1ef2ead75b404bf33c562 1 parent 75aa3d2
@uliwitness authored
Showing with 15 additions and 2 deletions.
  1. +2 −0  UKViewListView.h
  2. +13 −2 UKViewListView.m
View
2  UKViewListView.h
@@ -56,6 +56,7 @@
BOOL isInReLayout; // To avoid recursion when layouting views.
BOOL doAnimateResizing; // To have an animation when resizing the window.
BOOL isFlipped; // Use flipped-Y-axis coordinates to avoid problems with NSAnimation during combined fading and resizing.
+ BOOL resizeWindowAndView; // Goes with forceToContentHeight if your view is not the content view of a window.
}
-(void) setForceToContentHeight: (BOOL)doForce;
@@ -77,6 +78,7 @@
- (void)setInterViewSpacing:(float)value;
-(void) setAnimateResizing: (BOOL)animateResizing;
+-(void) setResizeWindowAndView: (BOOL)resizeBoth;
-(NSSize) bestSize;
View
15 UKViewListView.m
@@ -88,14 +88,23 @@ -(void) viewDidMoveToWindow
}
+-(void) setResizeWindowAndView: (BOOL)resizeBoth
+{
+ resizeWindowAndView = resizeBoth;
+}
+
+
-(void) reLayoutViewListViewsAndAdjustFrame: (BOOL)adjustFrame
{
if( !isInReLayout )
{
isInReLayout = YES;
+ [self setHidden: YES];
+
if( forceToContentHeight && adjustFrame )
{
- if( [[self window] contentView] == self )
+ BOOL isContentView = [[self window] contentView] == self;
+ if( isContentView || resizeWindowAndView )
{
NSWindow* wd = [self window];
NSRect newBox = [wd contentRectForFrameRect: [wd frame]];
@@ -106,7 +115,8 @@ -(void) reLayoutViewListViewsAndAdjustFrame: (BOOL)adjustFrame
newBox = [wd frameRectForContentRect: newBox];
[wd setFrame: newBox display: YES animate: doAnimateResizing];
}
- else
+
+ if( !isContentView || resizeWindowAndView )
[self setFrameSizePinnedToTopLeft: [self bestSize]];
}
@@ -134,6 +144,7 @@ -(void) reLayoutViewListViewsAndAdjustFrame: (BOOL)adjustFrame
}
[self setNeedsDisplay: YES];
+ [self setHidden: NO];
isInReLayout = NO;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.