mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 20:40:47 +00:00
Adopt the window size when adding or removing a toolbar,
not the size of the content view. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27506 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0ab9d38e59
commit
18f9a40038
2 changed files with 70 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2009-01-03 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Source/GSWindowDecorationView.m: Adopt the window size when
|
||||||
|
adding or removing a toolbar, not the size of the content view.
|
||||||
|
|
||||||
2009-01-02 Fred Kiefer <FredKiefer@gmx.de>
|
2009-01-02 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSWindow+Toolbar.m: Move window toolbar code from here ...
|
* Source/NSWindow+Toolbar.m: Move window toolbar code from here ...
|
||||||
|
|
|
@ -219,13 +219,17 @@
|
||||||
NSRect contentViewFrame = [cv frame];
|
NSRect contentViewFrame = [cv frame];
|
||||||
float newToolbarViewHeight;
|
float newToolbarViewHeight;
|
||||||
|
|
||||||
[tv setFrameSize: NSMakeSize(contentViewFrame.size.width, 100)];
|
// If the width changed we may need to recalculate the height
|
||||||
// Will recalculate the layout
|
if (contentViewFrame.size.width != [tv frame].size.width)
|
||||||
[tv _reload];
|
{
|
||||||
|
[tv setFrameSize: NSMakeSize(contentViewFrame.size.width, 100)];
|
||||||
|
// Will recalculate the layout
|
||||||
|
[tv _reload];
|
||||||
|
}
|
||||||
newToolbarViewHeight = [tv _heightFromLayout];
|
newToolbarViewHeight = [tv _heightFromLayout];
|
||||||
[tv setFrame: NSMakeRect(
|
[tv setFrame: NSMakeRect(
|
||||||
contentViewFrame.origin.x,
|
contentViewFrame.origin.x,
|
||||||
contentViewFrame.size.height,
|
NSMaxY(contentViewFrame),
|
||||||
contentViewFrame.size.width,
|
contentViewFrame.size.width,
|
||||||
newToolbarViewHeight)];
|
newToolbarViewHeight)];
|
||||||
}
|
}
|
||||||
|
@ -298,7 +302,11 @@
|
||||||
// Plug the toolbar view
|
// Plug the toolbar view
|
||||||
[toolbarView setFrame: NSMakeRect(
|
[toolbarView setFrame: NSMakeRect(
|
||||||
contentViewFrame.origin.x,
|
contentViewFrame.origin.x,
|
||||||
contentViewFrame.size.height - newToolbarViewHeight,
|
#if 1
|
||||||
|
NSMaxY(contentViewFrame),
|
||||||
|
#else
|
||||||
|
NSMaxY(contentViewFrame) - newToolbarViewHeight,
|
||||||
|
#endif
|
||||||
contentViewFrame.size.width,
|
contentViewFrame.size.width,
|
||||||
newToolbarViewHeight)];
|
newToolbarViewHeight)];
|
||||||
[self addSubview: toolbarView];
|
[self addSubview: toolbarView];
|
||||||
|
@ -306,6 +314,23 @@
|
||||||
// Resize the content view
|
// Resize the content view
|
||||||
contentViewFrame.size.height -= newToolbarViewHeight;
|
contentViewFrame.size.height -= newToolbarViewHeight;
|
||||||
[contentView setFrame: contentViewFrame];
|
[contentView setFrame: contentViewFrame];
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
{
|
||||||
|
NSRect orgWindowFrame;
|
||||||
|
NSRect windowFrame;
|
||||||
|
NSRect windowContentFrame;
|
||||||
|
|
||||||
|
orgWindowFrame = [window frame];
|
||||||
|
windowContentFrame = [isa contentRectForFrameRect: orgWindowFrame
|
||||||
|
styleMask: [window styleMask]];
|
||||||
|
windowContentFrame.size.height += newToolbarViewHeight;
|
||||||
|
windowFrame = [isa frameRectForContentRect: windowContentFrame
|
||||||
|
styleMask: [window styleMask]];
|
||||||
|
windowFrame.origin.y += orgWindowFrame.size.height - windowFrame.size.height;
|
||||||
|
[window setFrame: windowFrame display: YES];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) removeToolbarView: (GSToolbarView *)toolbarView
|
- (void) removeToolbarView: (GSToolbarView *)toolbarView
|
||||||
|
@ -313,13 +338,30 @@
|
||||||
NSView *contentView = [window contentView];
|
NSView *contentView = [window contentView];
|
||||||
NSRect contentViewFrame = [contentView frame];
|
NSRect contentViewFrame = [contentView frame];
|
||||||
float toolbarViewHeight = [toolbarView frame].size.height;
|
float toolbarViewHeight = [toolbarView frame].size.height;
|
||||||
|
|
||||||
// Unplug the toolbar view
|
// Unplug the toolbar view
|
||||||
[toolbarView removeFromSuperviewWithoutNeedingDisplay];
|
[toolbarView removeFromSuperviewWithoutNeedingDisplay];
|
||||||
|
|
||||||
// Resize the content view
|
// Resize the content view
|
||||||
contentViewFrame.size.height += toolbarViewHeight;
|
contentViewFrame.size.height += toolbarViewHeight;
|
||||||
[contentView setFrame: contentViewFrame];
|
[contentView setFrame: contentViewFrame];
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
{
|
||||||
|
NSRect orgWindowFrame;
|
||||||
|
NSRect windowFrame;
|
||||||
|
NSRect windowContentFrame;
|
||||||
|
|
||||||
|
orgWindowFrame = [window frame];
|
||||||
|
windowContentFrame = [isa contentRectForFrameRect: orgWindowFrame
|
||||||
|
styleMask: [window styleMask]];
|
||||||
|
windowContentFrame.size.height -= toolbarViewHeight;
|
||||||
|
windowFrame = [isa frameRectForContentRect: windowContentFrame
|
||||||
|
styleMask: [window styleMask]];
|
||||||
|
windowFrame.origin.y += orgWindowFrame.size.height - windowFrame.size.height;
|
||||||
|
[window setFrame: windowFrame display: YES];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) adjustToolbarView: (GSToolbarView *)toolbarView
|
- (void) adjustToolbarView: (GSToolbarView *)toolbarView
|
||||||
|
@ -344,8 +386,25 @@
|
||||||
contentViewFrame.size.height += toolbarViewHeight - newToolbarViewHeight;
|
contentViewFrame.size.height += toolbarViewHeight - newToolbarViewHeight;
|
||||||
[contentView setFrame: contentViewFrame];
|
[contentView setFrame: contentViewFrame];
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
{
|
||||||
|
NSRect orgWindowFrame;
|
||||||
|
NSRect windowFrame;
|
||||||
|
NSRect windowContentFrame;
|
||||||
|
|
||||||
|
orgWindowFrame = [window frame];
|
||||||
|
windowContentFrame = [isa contentRectForFrameRect: orgWindowFrame
|
||||||
|
styleMask: [window styleMask]];
|
||||||
|
windowContentFrame.size.height -= toolbarViewHeight - newToolbarViewHeight;
|
||||||
|
windowFrame = [isa frameRectForContentRect: windowContentFrame
|
||||||
|
styleMask: [window styleMask]];
|
||||||
|
windowFrame.origin.y += orgWindowFrame.size.height - windowFrame.size.height;
|
||||||
|
[window setFrame: windowFrame display: YES];
|
||||||
|
}
|
||||||
|
#else
|
||||||
// Redisplay the window
|
// Redisplay the window
|
||||||
[window display];
|
[window display];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue