mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 03:51:00 +00:00
Delegate the content rect computation to the actual window decoration
view. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@26942 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b078bfc7c9
commit
1b11784194
4 changed files with 51 additions and 29 deletions
|
@ -1,3 +1,11 @@
|
|||
2008-10-20 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/GSWindowDecorationView.h,
|
||||
* Source/GSWindowDecorationView.m
|
||||
(-contentRectForFrameRect:styleMask:,
|
||||
-frameRectForContentRect:styleMask): New instance methods.
|
||||
* Source/NSWindow.m: Use these new methods.
|
||||
|
||||
2008-10-19 Riccardo Mottola <rmottola@users.sf.net>>
|
||||
|
||||
* Source/GSServicesManager.m: dont unreigster non existent named port
|
||||
|
|
|
@ -32,16 +32,16 @@
|
|||
|
||||
@class NSWindow;
|
||||
|
||||
// These are implemented as class methods on GSWindowDecorationView
|
||||
@protocol GSWindowDecorator
|
||||
- (id) newWindowDecorationViewWithFrame: (NSRect)frame
|
||||
window: (NSWindow *)window;
|
||||
|
||||
- (NSRect) contentRectForFrameRect: (NSRect)aRect
|
||||
styleMask: (unsigned int)aStyle;
|
||||
styleMask: (unsigned int)aStyle;
|
||||
- (NSRect) frameRectForContentRect: (NSRect)aRect
|
||||
styleMask: (unsigned int)aStyle;
|
||||
- (float) minFrameWidthWithTitle: (NSString *)aTitle
|
||||
styleMask: (unsigned int)aStyle;
|
||||
styleMask: (unsigned int)aStyle;
|
||||
@end
|
||||
|
||||
|
||||
|
@ -64,6 +64,11 @@ this, either directly, or indirectly (by using the backend).
|
|||
|
||||
- (id) initWithFrame: (NSRect)frame window: (NSWindow *)w;
|
||||
|
||||
- (NSRect) contentRectForFrameRect: (NSRect)aRect
|
||||
styleMask: (unsigned int)aStyle;
|
||||
- (NSRect) frameRectForContentRect: (NSRect)aRect
|
||||
styleMask: (unsigned int)aStyle;
|
||||
|
||||
- (void) setBackgroundColor: (NSColor *)color;
|
||||
- (void) setContentView: (NSView *)contentView;
|
||||
- (void) setDocumentEdited: (BOOL)flag;
|
||||
|
@ -79,6 +84,13 @@ windowNumber will be 0.
|
|||
@end
|
||||
|
||||
|
||||
/* Manage window decorations by using the backend functions. This only works
|
||||
* on backends that can handle window decorations.
|
||||
*/
|
||||
@interface GSBackendWindowDecorationView : GSWindowDecorationView
|
||||
@end
|
||||
|
||||
|
||||
/*
|
||||
Standard OPENSTEP-ish window decorations.
|
||||
*/
|
||||
|
|
|
@ -33,20 +33,6 @@
|
|||
#include "GNUstepGUI/GSDisplayServer.h"
|
||||
#include "GNUstepGUI/GSTheme.h"
|
||||
|
||||
|
||||
struct NSWindow_struct
|
||||
{
|
||||
@defs(NSWindow)
|
||||
};
|
||||
|
||||
|
||||
/* Manage window decorations by using the backend functions. This only works
|
||||
* on backends that can handle window decorations.
|
||||
*/
|
||||
@interface GSBackendWindowDecorationView : GSWindowDecorationView
|
||||
@end
|
||||
|
||||
|
||||
@implementation GSWindowDecorationView
|
||||
|
||||
+ (id<GSWindowDecorator>) windowDecorator
|
||||
|
@ -118,13 +104,29 @@ struct NSWindow_struct
|
|||
self = [super initWithFrame: frame];
|
||||
if (self != nil)
|
||||
{
|
||||
contentRect = [isa contentRectForFrameRect: frame
|
||||
styleMask: [w styleMask]];
|
||||
window = w;
|
||||
contentRect = [self contentRectForFrameRect: frame
|
||||
styleMask: [w styleMask]];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSRect) contentRectForFrameRect: (NSRect)aRect
|
||||
styleMask: (unsigned int)aStyle
|
||||
{
|
||||
// TODO: Handle toolbar and others
|
||||
return [isa contentRectForFrameRect: aRect
|
||||
styleMask: aStyle];
|
||||
}
|
||||
|
||||
- (NSRect) frameRectForContentRect: (NSRect)aRect
|
||||
styleMask: (unsigned int)aStyle
|
||||
{
|
||||
// TODO: Handle toolbar and others
|
||||
return [isa frameRectForContentRect: aRect
|
||||
styleMask: aStyle];
|
||||
}
|
||||
|
||||
#if 0
|
||||
- (void) removeSubview: (NSView*)aView
|
||||
{
|
||||
|
@ -179,8 +181,8 @@ struct NSWindow_struct
|
|||
_autoresizes_subviews = NO;
|
||||
[super setFrame: frameRect];
|
||||
|
||||
contentRect = [isa contentRectForFrameRect: frameRect
|
||||
styleMask: [window styleMask]];
|
||||
contentRect = [self contentRectForFrameRect: frameRect
|
||||
styleMask: [window styleMask]];
|
||||
|
||||
// Safety Check.
|
||||
[cv setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
|
||||
|
|
|
@ -980,8 +980,6 @@ many times.
|
|||
@"can be created.");
|
||||
|
||||
NSDebugLLog(@"NSWindow", @"NSWindow start of init\n");
|
||||
if (!windowDecorator)
|
||||
windowDecorator = [GSWindowDecorationView windowDecorator];
|
||||
|
||||
// FIXME: This hack is here to work around a gorm decoding problem.
|
||||
if (_windowNum)
|
||||
|
@ -1014,6 +1012,9 @@ many times.
|
|||
/* Create the window view */
|
||||
cframe.origin = NSZeroPoint;
|
||||
cframe.size = _frame.size;
|
||||
if (!windowDecorator)
|
||||
windowDecorator = [GSWindowDecorationView windowDecorator];
|
||||
|
||||
_wv = [windowDecorator newWindowDecorationViewWithFrame: cframe
|
||||
window: self];
|
||||
[_wv _viewWillMoveToWindow: self];
|
||||
|
@ -1091,12 +1092,12 @@ many times.
|
|||
|
||||
- (NSRect) contentRectForFrameRect: (NSRect)frameRect
|
||||
{
|
||||
return [isa contentRectForFrameRect: frameRect styleMask: _styleMask];
|
||||
return [_wv contentRectForFrameRect: frameRect styleMask: _styleMask];
|
||||
}
|
||||
|
||||
- (NSRect) frameRectForContentRect: (NSRect)contentRect
|
||||
{
|
||||
return [isa frameRectForContentRect: contentRect styleMask: _styleMask];
|
||||
return [_wv frameRectForContentRect: contentRect styleMask: _styleMask];
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1116,8 +1117,7 @@ many times.
|
|||
{
|
||||
aView = AUTORELEASE([[NSView alloc]
|
||||
initWithFrame:
|
||||
[NSWindow contentRectForFrameRect: _frame
|
||||
styleMask: _styleMask]]);
|
||||
[self contentRectForFrameRect: _frame]]);
|
||||
}
|
||||
if (_contentView != nil)
|
||||
{
|
||||
|
@ -1819,7 +1819,7 @@ many times.
|
|||
}
|
||||
|
||||
[self setFrameTopLeftPoint: topLeftPoint];
|
||||
cRect = [isa contentRectForFrameRect: _frame styleMask: _styleMask];
|
||||
cRect = [self contentRectForFrameRect: _frame];
|
||||
topLeftPoint.x = NSMinX(cRect);
|
||||
topLeftPoint.y = NSMaxY(cRect);
|
||||
|
||||
|
@ -2030,7 +2030,7 @@ many times.
|
|||
NSRect r = _frame;
|
||||
|
||||
r.size = aSize;
|
||||
r = [NSWindow frameRectForContentRect: r styleMask: _styleMask];
|
||||
r = [self frameRectForContentRect: r];
|
||||
r.origin = _frame.origin;
|
||||
[self setFrame: r display: YES];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue