mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 03:40:59 +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>>
|
2008-10-19 Riccardo Mottola <rmottola@users.sf.net>>
|
||||||
|
|
||||||
* Source/GSServicesManager.m: dont unreigster non existent named port
|
* Source/GSServicesManager.m: dont unreigster non existent named port
|
||||||
|
|
|
@ -32,16 +32,16 @@
|
||||||
|
|
||||||
@class NSWindow;
|
@class NSWindow;
|
||||||
|
|
||||||
|
// These are implemented as class methods on GSWindowDecorationView
|
||||||
@protocol GSWindowDecorator
|
@protocol GSWindowDecorator
|
||||||
- (id) newWindowDecorationViewWithFrame: (NSRect)frame
|
- (id) newWindowDecorationViewWithFrame: (NSRect)frame
|
||||||
window: (NSWindow *)window;
|
window: (NSWindow *)window;
|
||||||
|
|
||||||
- (NSRect) contentRectForFrameRect: (NSRect)aRect
|
- (NSRect) contentRectForFrameRect: (NSRect)aRect
|
||||||
styleMask: (unsigned int)aStyle;
|
styleMask: (unsigned int)aStyle;
|
||||||
- (NSRect) frameRectForContentRect: (NSRect)aRect
|
- (NSRect) frameRectForContentRect: (NSRect)aRect
|
||||||
styleMask: (unsigned int)aStyle;
|
styleMask: (unsigned int)aStyle;
|
||||||
- (float) minFrameWidthWithTitle: (NSString *)aTitle
|
- (float) minFrameWidthWithTitle: (NSString *)aTitle
|
||||||
styleMask: (unsigned int)aStyle;
|
styleMask: (unsigned int)aStyle;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,6 +64,11 @@ this, either directly, or indirectly (by using the backend).
|
||||||
|
|
||||||
- (id) initWithFrame: (NSRect)frame window: (NSWindow *)w;
|
- (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) setBackgroundColor: (NSColor *)color;
|
||||||
- (void) setContentView: (NSView *)contentView;
|
- (void) setContentView: (NSView *)contentView;
|
||||||
- (void) setDocumentEdited: (BOOL)flag;
|
- (void) setDocumentEdited: (BOOL)flag;
|
||||||
|
@ -79,6 +84,13 @@ windowNumber will be 0.
|
||||||
@end
|
@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.
|
Standard OPENSTEP-ish window decorations.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -33,20 +33,6 @@
|
||||||
#include "GNUstepGUI/GSDisplayServer.h"
|
#include "GNUstepGUI/GSDisplayServer.h"
|
||||||
#include "GNUstepGUI/GSTheme.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
|
@implementation GSWindowDecorationView
|
||||||
|
|
||||||
+ (id<GSWindowDecorator>) windowDecorator
|
+ (id<GSWindowDecorator>) windowDecorator
|
||||||
|
@ -118,13 +104,29 @@ struct NSWindow_struct
|
||||||
self = [super initWithFrame: frame];
|
self = [super initWithFrame: frame];
|
||||||
if (self != nil)
|
if (self != nil)
|
||||||
{
|
{
|
||||||
contentRect = [isa contentRectForFrameRect: frame
|
|
||||||
styleMask: [w styleMask]];
|
|
||||||
window = w;
|
window = w;
|
||||||
|
contentRect = [self contentRectForFrameRect: frame
|
||||||
|
styleMask: [w styleMask]];
|
||||||
}
|
}
|
||||||
return self;
|
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
|
#if 0
|
||||||
- (void) removeSubview: (NSView*)aView
|
- (void) removeSubview: (NSView*)aView
|
||||||
{
|
{
|
||||||
|
@ -179,8 +181,8 @@ struct NSWindow_struct
|
||||||
_autoresizes_subviews = NO;
|
_autoresizes_subviews = NO;
|
||||||
[super setFrame: frameRect];
|
[super setFrame: frameRect];
|
||||||
|
|
||||||
contentRect = [isa contentRectForFrameRect: frameRect
|
contentRect = [self contentRectForFrameRect: frameRect
|
||||||
styleMask: [window styleMask]];
|
styleMask: [window styleMask]];
|
||||||
|
|
||||||
// Safety Check.
|
// Safety Check.
|
||||||
[cv setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
|
[cv setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
|
||||||
|
|
|
@ -980,8 +980,6 @@ many times.
|
||||||
@"can be created.");
|
@"can be created.");
|
||||||
|
|
||||||
NSDebugLLog(@"NSWindow", @"NSWindow start of init\n");
|
NSDebugLLog(@"NSWindow", @"NSWindow start of init\n");
|
||||||
if (!windowDecorator)
|
|
||||||
windowDecorator = [GSWindowDecorationView windowDecorator];
|
|
||||||
|
|
||||||
// FIXME: This hack is here to work around a gorm decoding problem.
|
// FIXME: This hack is here to work around a gorm decoding problem.
|
||||||
if (_windowNum)
|
if (_windowNum)
|
||||||
|
@ -1014,6 +1012,9 @@ many times.
|
||||||
/* Create the window view */
|
/* Create the window view */
|
||||||
cframe.origin = NSZeroPoint;
|
cframe.origin = NSZeroPoint;
|
||||||
cframe.size = _frame.size;
|
cframe.size = _frame.size;
|
||||||
|
if (!windowDecorator)
|
||||||
|
windowDecorator = [GSWindowDecorationView windowDecorator];
|
||||||
|
|
||||||
_wv = [windowDecorator newWindowDecorationViewWithFrame: cframe
|
_wv = [windowDecorator newWindowDecorationViewWithFrame: cframe
|
||||||
window: self];
|
window: self];
|
||||||
[_wv _viewWillMoveToWindow: self];
|
[_wv _viewWillMoveToWindow: self];
|
||||||
|
@ -1091,12 +1092,12 @@ many times.
|
||||||
|
|
||||||
- (NSRect) contentRectForFrameRect: (NSRect)frameRect
|
- (NSRect) contentRectForFrameRect: (NSRect)frameRect
|
||||||
{
|
{
|
||||||
return [isa contentRectForFrameRect: frameRect styleMask: _styleMask];
|
return [_wv contentRectForFrameRect: frameRect styleMask: _styleMask];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSRect) frameRectForContentRect: (NSRect)contentRect
|
- (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]
|
aView = AUTORELEASE([[NSView alloc]
|
||||||
initWithFrame:
|
initWithFrame:
|
||||||
[NSWindow contentRectForFrameRect: _frame
|
[self contentRectForFrameRect: _frame]]);
|
||||||
styleMask: _styleMask]]);
|
|
||||||
}
|
}
|
||||||
if (_contentView != nil)
|
if (_contentView != nil)
|
||||||
{
|
{
|
||||||
|
@ -1819,7 +1819,7 @@ many times.
|
||||||
}
|
}
|
||||||
|
|
||||||
[self setFrameTopLeftPoint: topLeftPoint];
|
[self setFrameTopLeftPoint: topLeftPoint];
|
||||||
cRect = [isa contentRectForFrameRect: _frame styleMask: _styleMask];
|
cRect = [self contentRectForFrameRect: _frame];
|
||||||
topLeftPoint.x = NSMinX(cRect);
|
topLeftPoint.x = NSMinX(cRect);
|
||||||
topLeftPoint.y = NSMaxY(cRect);
|
topLeftPoint.y = NSMaxY(cRect);
|
||||||
|
|
||||||
|
@ -2030,7 +2030,7 @@ many times.
|
||||||
NSRect r = _frame;
|
NSRect r = _frame;
|
||||||
|
|
||||||
r.size = aSize;
|
r.size = aSize;
|
||||||
r = [NSWindow frameRectForContentRect: r styleMask: _styleMask];
|
r = [self frameRectForContentRect: r];
|
||||||
r.origin = _frame.origin;
|
r.origin = _frame.origin;
|
||||||
[self setFrame: r display: YES];
|
[self setFrame: r display: YES];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue