Skip to content

Commit

Permalink
Merge pull request indragiek#56 from cHoco/master
Browse files Browse the repository at this point in the history
We need to override setContentView
  • Loading branch information
kgn committed Aug 7, 2012
2 parents 63dc2dc + 1cc6c6f commit 2659d45
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions INAppStoreWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ - (void)_doInitialWindowSetup;
- (void)_createTitlebarView;
- (void)_setupTrafficLightsTrackingArea;
- (void)_recalculateFrameForTitleBarView;
- (void)_repositionContentView;
- (void)_layoutTrafficLightsAndContent;
- (CGFloat)_minimumTitlebarHeight;
- (void)_displayWindowAndTitlebar;
Expand Down Expand Up @@ -336,6 +337,12 @@ - (void)resignMainWindow
[_titleBarView setNeedsDisplay:YES];
}

- (void)setContentView:(NSView *)aView
{
[super setContentView:aView];
[self _repositionContentView];
}

#pragma mark -
#pragma mark Accessors

Expand Down Expand Up @@ -536,15 +543,7 @@ - (void)_layoutTrafficLightsAndContent
}
#endif

// Reposition the content view
NSView *contentView = [self contentView];
NSRect windowFrame = [self frame];
NSRect newFrame = [contentView frame];
CGFloat titleHeight = NSHeight(windowFrame) - NSHeight(newFrame);
CGFloat extraHeight = _titleBarHeight - titleHeight;
newFrame.size.height -= extraHeight;
[contentView setFrame:newFrame];
[contentView setNeedsDisplay:YES];
[self _repositionContentView];
}

- (void)windowWillEnterFullScreen:(NSNotification *)notification
Expand Down Expand Up @@ -600,6 +599,18 @@ - (void)_recalculateFrameForTitleBarView
[_titleBarView setFrame:titleFrame];
}

- (void)_repositionContentView
{
NSView *contentView = [self contentView];
NSRect windowFrame = [self frame];
NSRect newFrame = [contentView frame];
CGFloat titleHeight = NSHeight(windowFrame) - NSHeight(newFrame);
CGFloat extraHeight = _titleBarHeight - titleHeight;
newFrame.size.height -= extraHeight;
[contentView setFrame:newFrame];
[contentView setNeedsDisplay:YES];
}

- (CGFloat)_minimumTitlebarHeight
{
static CGFloat minTitleHeight = 0.0;
Expand Down

0 comments on commit 2659d45

Please sign in to comment.