mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 13:10:59 +00:00
Added the ability for GSTheme subclasses to provide custom implementations of GSWindowDecorator.
This commit is contained in:
parent
225eea02d5
commit
7f70818be2
5 changed files with 21 additions and 5 deletions
|
@ -235,6 +235,8 @@
|
|||
#import <AppKit/NSTabView.h>
|
||||
#import <AppKit/NSPrintPanel.h>
|
||||
#import <AppKit/NSPageLayout.h>
|
||||
// For window decorator protocol
|
||||
#import <GNUstepGUI/GSWindowDecorationView.h>
|
||||
|
||||
#if OS_API_VERSION(GS_API_NONE,GS_API_NONE)
|
||||
@class NSArray;
|
||||
|
@ -1586,6 +1588,13 @@ APPKIT_EXPORT_CLASS
|
|||
@end
|
||||
|
||||
@interface GSTheme (NSWindow)
|
||||
|
||||
/**
|
||||
* This method returns the window decorator provided by
|
||||
* the current theme.
|
||||
*/
|
||||
- (id<GSWindowDecorator>) windowDecorator;
|
||||
|
||||
/**
|
||||
* This method returns the standard window button for the
|
||||
* given mask for the current theme.
|
||||
|
|
|
@ -67,6 +67,7 @@ APPKIT_EXPORT_CLASS
|
|||
BOOL hasMenu;
|
||||
BOOL hasToolbar;
|
||||
}
|
||||
|
||||
+ (id<GSWindowDecorator>) windowDecorator;
|
||||
|
||||
- (id) initWithFrame: (NSRect)frame window: (NSWindow *)w;
|
||||
|
|
|
@ -109,7 +109,6 @@
|
|||
if (hasCloseButton)
|
||||
{
|
||||
NSRect closeButtonFrame = [[GSTheme theme] closeButtonFrameForBounds: [self bounds]];
|
||||
|
||||
[closeButton setFrame: closeButtonFrame];
|
||||
}
|
||||
else
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#import "GNUstepGUI/GSTheme.h"
|
||||
#import "GNUstepGUI/GSWindowDecorationView.h"
|
||||
#import "GSThemePrivate.h"
|
||||
#import "GNUstepGUI/GSDisplayServer.h"
|
||||
|
||||
@implementation GSTheme (NSWindow)
|
||||
- (NSButton *) standardWindowButton: (NSWindowButton)button
|
||||
|
@ -86,4 +87,13 @@
|
|||
{
|
||||
// default implementation does nothing...
|
||||
}
|
||||
|
||||
- (id<GSWindowDecorator>) windowDecorator
|
||||
{
|
||||
if ([GSCurrentServer() handlesWindowDecorations])
|
||||
return [GSBackendWindowDecorationView self];
|
||||
else
|
||||
return [GSStandardWindowDecorationView self];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -64,10 +64,7 @@ static inline NSRect RectWithSizeScaledByFactor(NSRect aRect, CGFloat factor)
|
|||
|
||||
+ (id<GSWindowDecorator>) windowDecorator
|
||||
{
|
||||
if ([GSCurrentServer() handlesWindowDecorations])
|
||||
return [GSBackendWindowDecorationView self];
|
||||
else
|
||||
return [GSStandardWindowDecorationView self];
|
||||
return [[GSTheme theme] windowDecorator];
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue