mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 17:22:10 +00:00
Merge some code with main brnch revision 39289
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@39326 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3e5185efa1
commit
ffb26b5d34
14 changed files with 738 additions and 231 deletions
|
@ -204,7 +204,11 @@
|
|||
A theme subclass may override the -imageClass method to change the
|
||||
class used to load each image from the bundle ... thus allowing
|
||||
customisation of not just the images but also of the image
|
||||
behavior in the (very rare) cases where this is desirable.
|
||||
behavior in the (very rare) cases where this is desirable.<br />
|
||||
Finally, a theme may provide application specific images which are
|
||||
loaded <em>in preference to</em> named images from the application's
|
||||
own bundle. These images are simply stored in a subdirectory whose
|
||||
name is the same as the application's bundleIdentifier.
|
||||
</desc>
|
||||
</deflist>
|
||||
</section>
|
||||
|
@ -235,8 +239,8 @@
|
|||
#if OS_API_VERSION(GS_API_NONE,GS_API_NONE)
|
||||
@class NSArray;
|
||||
@class NSBundle;
|
||||
@class NSBrowserCell;
|
||||
@class NSDictionary;
|
||||
|
||||
@class NSButton;
|
||||
@class NSColor;
|
||||
@class NSColorList;
|
||||
|
@ -1163,6 +1167,14 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
|
|||
|
||||
- (float) resizebarHeight;
|
||||
|
||||
- (float) titlebarButtonSize;
|
||||
|
||||
- (float) titlebarPaddingRight;
|
||||
|
||||
- (float) titlebarPaddingTop;
|
||||
|
||||
- (float) titlebarPaddingLeft;
|
||||
|
||||
- (void) drawWindowBorder: (NSRect)rect
|
||||
withFrame: (NSRect)frame
|
||||
forStyleMask: (unsigned int)styleMask
|
||||
|
@ -1457,5 +1469,60 @@ withRepeatedImage: (NSImage*)image
|
|||
- (Class) pageLayoutClass;
|
||||
@end
|
||||
|
||||
@interface GSTheme (NSWindow)
|
||||
/**
|
||||
* This method returns the standard window button for the
|
||||
* given mask for the current theme.
|
||||
*/
|
||||
- (NSButton *) standardWindowButton: (NSWindowButton)button
|
||||
forStyleMask: (NSUInteger) mask;
|
||||
|
||||
/**
|
||||
* This method does any additional setup after the default
|
||||
* cell is set.
|
||||
*/
|
||||
- (void) didSetDefaultButtonCell: (NSButtonCell *)aCell;
|
||||
@end
|
||||
|
||||
@interface GSTheme (NSBrowserCell)
|
||||
/**
|
||||
* Draw editor in cell
|
||||
*/
|
||||
- (void) drawEditorForCell: (NSCell *)cell
|
||||
withFrame: (NSRect)cellFrame
|
||||
inView: (NSView *)view;
|
||||
|
||||
/**
|
||||
* Draw attributed text in cell
|
||||
*/
|
||||
- (void) drawInCell: (NSCell *)cell
|
||||
attributedText: (NSAttributedString *)stringValue
|
||||
inFrame: (NSRect)cellFrame;
|
||||
|
||||
/**
|
||||
* Draw the interior of the browser cell
|
||||
*/
|
||||
- (void) drawBrowserInteriorWithFrame: (NSRect)cellFrame
|
||||
withCell: (NSBrowserCell *)cell
|
||||
inView: (NSView *)controlView
|
||||
withImage: (NSImage *)theImage
|
||||
alternateImage: (NSImage *)alternateImage
|
||||
isHighlighted: (BOOL)isHighlighted
|
||||
state: (int)state
|
||||
isLeaf: (BOOL)isLeaf;
|
||||
|
||||
/**
|
||||
* This method returns the branch image
|
||||
*/
|
||||
- (NSImage *) branchImage;
|
||||
|
||||
/**
|
||||
* This method returns the highlighted version of
|
||||
* the branch image
|
||||
*/
|
||||
- (NSImage *) highlightedBranchImage;
|
||||
@end
|
||||
|
||||
|
||||
#endif /* OS_API_VERSION */
|
||||
#endif /* _GNUstep_H_GSTheme */
|
||||
|
|
|
@ -168,8 +168,8 @@
|
|||
- (void) setName: (NSString *)name;
|
||||
- (NSString *) name;
|
||||
|
||||
- (void) setRuntimeAttributes: (NSString *)attributes;
|
||||
- (NSString *) runtimeAttributes;
|
||||
- (void) setRuntimeAttributes: (NSArray *)attributes;
|
||||
- (NSArray *) runtimeAttributes;
|
||||
|
||||
@end
|
||||
|
||||
|
|
66
Headers/AppKit/NSAnimationContext.h
Normal file
66
Headers/AppKit/NSAnimationContext.h
Normal file
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
NSAnimationContext.h
|
||||
|
||||
Created by Gregory John Casamento on Wed Jun 10 2015.
|
||||
Copyright (c) 2015 Free Software Foundation, Inc.
|
||||
|
||||
Author: Gregory Casamento <greg.casamento@gmail.com>
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _GNUstep_H_NSAnimationContext_
|
||||
#define _GNUstep_H_NSAnimationContext_
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <Foundation/NSDate.h>
|
||||
|
||||
@class NSAnimationContext;
|
||||
|
||||
DEFINE_BLOCK_TYPE_NO_ARGS(GSAnimationContextCompletionHandler, void);
|
||||
DEFINE_BLOCK_TYPE(GSAnimationContextChanges, void, NSAnimationContext*);
|
||||
|
||||
@interface NSAnimationContext : NSObject
|
||||
{
|
||||
NSTimeInterval _duration;
|
||||
GSAnimationContextCompletionHandler _completionHandler;
|
||||
}
|
||||
|
||||
// Begin and end grouping
|
||||
+ (void) beginGrouping;
|
||||
+ (void) endGrouping;
|
||||
|
||||
// Retrieve current context
|
||||
+ (NSAnimationContext *)currentContext;
|
||||
|
||||
// run
|
||||
+ (void)runAnimationGroup: (GSAnimationContextChanges)changes
|
||||
completionHandler: (GSAnimationContextCompletionHandler)completionHandler;
|
||||
|
||||
// Properties...
|
||||
- (void) setDuration: (NSTimeInterval)duration;
|
||||
- (NSTimeInterval) duration;
|
||||
|
||||
- (GSAnimationContextCompletionHandler) completionHandler;
|
||||
- (void) setCompletionHandler: (GSAnimationContextCompletionHandler) completionHandler;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<abstract>Encapsulates all drawing functionality</abstract>
|
||||
|
||||
Copyright <copy>(C) 1996 Free Software Foundation, Inc.</copy>
|
||||
Copyright <copy>(C) 1996-2015 Free Software Foundation, Inc.</copy>
|
||||
|
||||
Author: Scott Christley <scottc@net-community.com>
|
||||
Date: 1996
|
||||
|
@ -119,6 +119,7 @@ PACKAGE_SCOPE
|
|||
NSInteger _gstate;
|
||||
void *_nextKeyView;
|
||||
void *_previousKeyView;
|
||||
CGFloat _alphaValue;
|
||||
|
||||
@public
|
||||
/*
|
||||
|
@ -228,6 +229,17 @@ PACKAGE_SCOPE
|
|||
- (BOOL) isRotatedFromBase;
|
||||
- (BOOL) isRotatedOrScaledFromBase;
|
||||
|
||||
/*
|
||||
* View Layers
|
||||
*/
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
|
||||
- (CGFloat) alphaValue;
|
||||
- (void) setAlphaValue: (CGFloat)alpha;
|
||||
- (CGFloat) frameCenterRotation;
|
||||
- (void) setFrameCenterRotation:(CGFloat)rot;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Converting Coordinates
|
||||
*/
|
||||
|
|
|
@ -48,6 +48,7 @@ NSActionCell.m \
|
|||
NSAffineTransform.m \
|
||||
NSAlert.m \
|
||||
NSAnimation.m \
|
||||
NSAnimationContext.m \
|
||||
NSApplication.m \
|
||||
NSArrayController.m \
|
||||
NSAttributedString.m \
|
||||
|
@ -120,6 +121,7 @@ NSMenuItemCell.m \
|
|||
NSMovie.m \
|
||||
NSMovieView.m \
|
||||
NSNib.m \
|
||||
NSNibConnector.m \
|
||||
NSNibBindingConnector.m \
|
||||
NSNibAXAttributeConnector.m \
|
||||
NSNibAXRelationshipConnector.m \
|
||||
|
@ -234,6 +236,7 @@ GSThemeOpenSavePanels.m \
|
|||
GSThemePanel.m \
|
||||
GSThemePrintPanels.m \
|
||||
GSThemeTools.m \
|
||||
GSThemeWindow.m \
|
||||
GSTitleView.m \
|
||||
GSToolTips.m \
|
||||
GSToolbarView.m \
|
||||
|
@ -278,6 +281,7 @@ NSActionCell.h \
|
|||
NSAffineTransform.h \
|
||||
NSAlert.h \
|
||||
NSAnimation.h \
|
||||
NSAnimationContext.h \
|
||||
NSApplication.h \
|
||||
NSArrayController.h \
|
||||
NSBezierPath.h \
|
||||
|
|
|
@ -229,6 +229,14 @@ static GSFontEnumerator *sharedEnumerator = nil;
|
|||
break;
|
||||
}
|
||||
}
|
||||
else if ([key isEqual: NSFontCharacterSetAttribute])
|
||||
{
|
||||
if (![valueB isSupersetOfSet: valueA])
|
||||
{
|
||||
match = NO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (![valueA isEqual: valueB])
|
||||
|
|
|
@ -108,15 +108,18 @@
|
|||
}
|
||||
if (hasCloseButton)
|
||||
{
|
||||
closeButtonRect = NSMakeRect(
|
||||
[self bounds].size.width - 15 - 4, [self bounds].size.height - 15 - 4, 15, 15);
|
||||
closeButtonRect = NSMakeRect([self bounds].size.width - [theme titlebarButtonSize] -
|
||||
[theme titlebarPaddingRight], [self bounds].size.height -
|
||||
[theme titlebarButtonSize] - [theme titlebarPaddingTop],
|
||||
[theme titlebarButtonSize], [theme titlebarButtonSize]);
|
||||
[closeButton setFrame: closeButtonRect];
|
||||
}
|
||||
|
||||
if (hasMiniaturizeButton)
|
||||
{
|
||||
miniaturizeButtonRect = NSMakeRect(
|
||||
4, [self bounds].size.height - 15 - 4, 15, 15);
|
||||
miniaturizeButtonRect = NSMakeRect([theme titlebarPaddingLeft], [self bounds].size.height -
|
||||
[theme titlebarButtonSize] - [theme titlebarPaddingTop],
|
||||
[theme titlebarButtonSize], [theme titlebarButtonSize]);
|
||||
[miniaturizeButton setFrame: miniaturizeButtonRect];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#import "AppKit/NSBezierPath.h"
|
||||
#import "AppKit/NSButtonCell.h"
|
||||
#import "AppKit/NSBrowser.h"
|
||||
#import "AppKit/NSBrowserCell.h"
|
||||
#import "AppKit/NSCell.h"
|
||||
#import "AppKit/NSColor.h"
|
||||
#import "AppKit/NSColorList.h"
|
||||
|
@ -3514,4 +3515,131 @@ typedef enum {
|
|||
}
|
||||
}
|
||||
|
||||
- (void) drawEditorForCell: (NSCell *)cell
|
||||
withFrame: (NSRect)cellFrame
|
||||
inView: (NSView *)view
|
||||
{
|
||||
[cell _drawEditorWithFrame: cellFrame
|
||||
inView: view];
|
||||
}
|
||||
|
||||
|
||||
- (void) drawInCell: (NSCell *)cell
|
||||
attributedText: (NSAttributedString *)stringValue
|
||||
inFrame: (NSRect)cellFrame
|
||||
{
|
||||
[cell _drawAttributedText: stringValue
|
||||
inFrame: cellFrame];
|
||||
}
|
||||
|
||||
// NSBrowserCell
|
||||
- (void) drawBrowserInteriorWithFrame: (NSRect)cellFrame
|
||||
withCell: (NSBrowserCell *)cell
|
||||
inView: (NSView *)controlView
|
||||
withImage: (NSImage *)theImage
|
||||
alternateImage: (NSImage *)alternateImage
|
||||
isHighlighted: (BOOL)isHighlighted
|
||||
state: (int)state
|
||||
isLeaf: (BOOL)isLeaf
|
||||
{
|
||||
NSRect title_rect = cellFrame;
|
||||
NSImage *branch_image = nil;
|
||||
NSImage *cell_image = theImage;
|
||||
|
||||
if (isHighlighted || state)
|
||||
{
|
||||
if (!isLeaf)
|
||||
branch_image = [self highlightedBranchImage];
|
||||
if (nil != alternateImage)
|
||||
[cell setImage: alternateImage];
|
||||
|
||||
// If we are highlighted, fill the background
|
||||
[[cell highlightColorInView: controlView] setFill];
|
||||
NSRectFill(cellFrame);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!isLeaf)
|
||||
branch_image = [self branchImage];
|
||||
|
||||
// (Don't fill the background)
|
||||
}
|
||||
|
||||
// Draw the branch image if there is one
|
||||
if (branch_image)
|
||||
{
|
||||
NSRect imgRect;
|
||||
|
||||
imgRect.size = [branch_image size];
|
||||
imgRect.origin.x = MAX(NSMaxX(title_rect) - imgRect.size.width - 4.0, 0.);
|
||||
imgRect.origin.y = MAX(NSMidY(title_rect) - (imgRect.size.height/2.), 0.);
|
||||
|
||||
if (controlView != nil)
|
||||
{
|
||||
imgRect = [controlView centerScanRect: imgRect];
|
||||
}
|
||||
|
||||
[branch_image drawInRect: imgRect
|
||||
fromRect: NSZeroRect
|
||||
operation: NSCompositeSourceOver
|
||||
fraction: 1.0
|
||||
respectFlipped: YES
|
||||
hints: nil];
|
||||
|
||||
title_rect.size.width -= imgRect.size.width + 8;
|
||||
}
|
||||
|
||||
// Skip 2 points from the left border
|
||||
title_rect.origin.x += 2;
|
||||
title_rect.size.width -= 2;
|
||||
|
||||
// Draw the cell image if there is one
|
||||
if (cell_image)
|
||||
{
|
||||
NSRect imgRect;
|
||||
|
||||
imgRect.size = [cell_image size];
|
||||
imgRect.origin.x = NSMinX(title_rect);
|
||||
imgRect.origin.y = MAX(NSMidY(title_rect) - (imgRect.size.height/2.),0.);
|
||||
|
||||
if (controlView != nil)
|
||||
{
|
||||
imgRect = [controlView centerScanRect: imgRect];
|
||||
}
|
||||
|
||||
[cell_image drawInRect: imgRect
|
||||
fromRect: NSZeroRect
|
||||
operation: NSCompositeSourceOver
|
||||
fraction: 1.0
|
||||
respectFlipped: YES
|
||||
hints: nil];
|
||||
|
||||
title_rect.origin.x += imgRect.size.width + 4;
|
||||
title_rect.size.width -= imgRect.size.width + 4;
|
||||
}
|
||||
|
||||
// Draw the body of the cell
|
||||
if ([cell _inEditing])
|
||||
{
|
||||
[self drawEditorForCell: cell
|
||||
withFrame: cellFrame
|
||||
inView: controlView];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self drawInCell: cell
|
||||
attributedText: [cell attributedStringValue]
|
||||
inFrame: title_rect];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSImage *) branchImage
|
||||
{
|
||||
return [NSImage imageNamed: @"common_3DArrowRight"];
|
||||
}
|
||||
|
||||
- (NSImage *) highlightedBranchImage
|
||||
{
|
||||
return [NSImage imageNamed: @"common_3DArrowRightH"];
|
||||
}
|
||||
@end
|
||||
|
|
89
Source/GSThemeWindow.m
Normal file
89
Source/GSThemeWindow.m
Normal file
|
@ -0,0 +1,89 @@
|
|||
/** <title>GSThemeWindow</title>
|
||||
|
||||
<abstract>The theme methods for window specific functions</abstract>
|
||||
|
||||
Copyright (C) 2015 Free Software Foundation, Inc.
|
||||
|
||||
Author: Gregory Casamento <greg.casamento@gmail.com>
|
||||
Date: Jun 2015
|
||||
|
||||
This file is part of the GNU Objective C User interface library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#import "AppKit/NSWindow.h"
|
||||
#import "AppKit/NSImage.h"
|
||||
#import "AppKit/NSButton.h"
|
||||
|
||||
#import "GNUstepGUI/GSTheme.h"
|
||||
#import "GNUstepGUI/GSWindowDecorationView.h"
|
||||
#import "GSThemePrivate.h"
|
||||
|
||||
@implementation GSTheme (NSWindow)
|
||||
- (NSButton *) standardWindowButton: (NSWindowButton)button
|
||||
forStyleMask: (NSUInteger) mask
|
||||
{
|
||||
NSButton *newButton;
|
||||
|
||||
newButton = [[NSButton alloc] init];
|
||||
[newButton setRefusesFirstResponder: YES];
|
||||
[newButton setButtonType: NSMomentaryChangeButton];
|
||||
[newButton setImagePosition: NSImageOnly];
|
||||
[newButton setBordered: YES];
|
||||
[newButton setTag: button];
|
||||
|
||||
switch (button)
|
||||
{
|
||||
case NSWindowCloseButton:
|
||||
[newButton setImage: [NSImage imageNamed: @"common_Close"]];
|
||||
[newButton setAlternateImage: [NSImage imageNamed: @"common_CloseH"]];
|
||||
/* TODO: -performClose: should (but doesn't currently) highlight the
|
||||
button, which is wrong here. When -performClose: is fixed, we'll need a
|
||||
different method here. */
|
||||
[newButton setAction: @selector(performClose:)];
|
||||
break;
|
||||
|
||||
case NSWindowMiniaturizeButton:
|
||||
[newButton setImage: [NSImage imageNamed: @"common_Miniaturize"]];
|
||||
[newButton setAlternateImage: [NSImage imageNamed: @"common_MiniaturizeH"]];
|
||||
[newButton setAction: @selector(miniaturize:)];
|
||||
break;
|
||||
|
||||
case NSWindowZoomButton:
|
||||
// FIXME
|
||||
[newButton setAction: @selector(zoom:)];
|
||||
break;
|
||||
|
||||
case NSWindowToolbarButton:
|
||||
// FIXME
|
||||
[newButton setAction: @selector(toggleToolbarShown:)];
|
||||
break;
|
||||
case NSWindowDocumentIconButton:
|
||||
default:
|
||||
// FIXME
|
||||
break;
|
||||
}
|
||||
|
||||
return AUTORELEASE(newButton);
|
||||
}
|
||||
|
||||
- (void) didSetDefaultButtonCell: (NSButtonCell *)aCell
|
||||
{
|
||||
// default implementation does nothing...
|
||||
}
|
||||
@end
|
86
Source/NSAnimationContext.m
Normal file
86
Source/NSAnimationContext.m
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
NSAnimationContext.h
|
||||
|
||||
Created by Gregory John Casamento on Wed Jun 10 2015.
|
||||
Copyright (c) 2015 Free Software Foundation, Inc.
|
||||
|
||||
Author: Gregory Casamento <greg.casamento@gmail.com>
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#import <AppKit/NSAnimationContext.h>
|
||||
|
||||
static NSAnimationContext *_currentContext = nil;
|
||||
|
||||
@implementation NSAnimationContext : NSObject
|
||||
|
||||
// Begin and end grouping
|
||||
+ (void) beginGrouping
|
||||
{
|
||||
}
|
||||
|
||||
+ (void) endGrouping
|
||||
{
|
||||
}
|
||||
|
||||
// Retrieve current context
|
||||
+ (NSAnimationContext *)currentContext
|
||||
{
|
||||
return _currentContext;
|
||||
}
|
||||
|
||||
// run
|
||||
+ (void)runAnimationGroup: (GSAnimationContextChanges)changes
|
||||
completionHandler: (GSAnimationContextCompletionHandler)completionHandler
|
||||
{
|
||||
}
|
||||
|
||||
// Properties...
|
||||
- (void) setDuration: (NSTimeInterval)duration
|
||||
{
|
||||
_duration = duration;
|
||||
}
|
||||
|
||||
- (NSTimeInterval) duration
|
||||
{
|
||||
return _duration;
|
||||
}
|
||||
|
||||
- (GSAnimationContextCompletionHandler) completionHandler
|
||||
{
|
||||
return _completionHandler;
|
||||
}
|
||||
|
||||
- (void) setCompletionHandler: (GSAnimationContextCompletionHandler) completionHandler
|
||||
{
|
||||
_completionHandler = completionHandler;
|
||||
}
|
||||
|
||||
- (void *) timingFunction
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- (void) setTimingFunction: (void *)timingFunction
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -48,185 +48,6 @@
|
|||
#import "AppKit/NSNibLoading.h"
|
||||
#import "GNUstepGUI/GSModelLoaderFactory.h"
|
||||
|
||||
@implementation NSNibConnector
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(_src);
|
||||
RELEASE(_dst);
|
||||
RELEASE(_tag);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id) destination
|
||||
{
|
||||
return _dst;
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
if ([aCoder allowsKeyedCoding])
|
||||
{
|
||||
if (_src != nil)
|
||||
{
|
||||
[aCoder encodeObject: _src forKey: @"NSSource"];
|
||||
}
|
||||
if (_dst != nil)
|
||||
{
|
||||
[aCoder encodeObject: _dst forKey: @"NSDestination"];
|
||||
}
|
||||
if (_tag != nil)
|
||||
{
|
||||
[aCoder encodeObject: _tag forKey: @"NSLabel"];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[aCoder encodeObject: _src];
|
||||
[aCoder encodeObject: _dst];
|
||||
[aCoder encodeObject: _tag];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) establishConnection
|
||||
{
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
if ([aDecoder containsValueForKey: @"NSDestination"])
|
||||
{
|
||||
ASSIGN(_dst, [aDecoder decodeObjectForKey: @"NSDestination"]);
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSSource"])
|
||||
{
|
||||
ASSIGN(_src, [aDecoder decodeObjectForKey: @"NSSource"]);
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSLabel"])
|
||||
{
|
||||
ASSIGN(_tag, [aDecoder decodeObjectForKey: @"NSLabel"]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_src];
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_dst];
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_tag];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString*) label
|
||||
{
|
||||
return _tag;
|
||||
}
|
||||
|
||||
- (void) replaceObject: (id)anObject withObject: (id)anotherObject
|
||||
{
|
||||
if (_src == anObject)
|
||||
{
|
||||
ASSIGN(_src, anotherObject);
|
||||
}
|
||||
if (_dst == anObject)
|
||||
{
|
||||
ASSIGN(_dst, anotherObject);
|
||||
}
|
||||
if (_tag == anObject)
|
||||
{
|
||||
ASSIGN(_tag, anotherObject);
|
||||
}
|
||||
}
|
||||
|
||||
- (id) source
|
||||
{
|
||||
return _src;
|
||||
}
|
||||
|
||||
- (void) setDestination: (id)anObject
|
||||
{
|
||||
ASSIGN(_dst, anObject);
|
||||
}
|
||||
|
||||
- (void) setLabel: (NSString*)label
|
||||
{
|
||||
ASSIGN(_tag, label);
|
||||
}
|
||||
|
||||
- (void) setSource: (id)anObject
|
||||
{
|
||||
ASSIGN(_src, anObject);
|
||||
}
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
NSString *desc = [NSString stringWithFormat: @"<%@ src=%@ dst=%@ label=%@>",
|
||||
[super description],
|
||||
[self source],
|
||||
[self destination],
|
||||
[self label]];
|
||||
return desc;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation NSNibControlConnector
|
||||
- (void) establishConnection
|
||||
{
|
||||
SEL sel = NSSelectorFromString(_tag);
|
||||
|
||||
[_src setTarget: _dst];
|
||||
[_src setAction: sel];
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation NSNibOutletConnector
|
||||
- (void) establishConnection
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
if (_src != nil)
|
||||
{
|
||||
NSString *selName;
|
||||
SEL sel;
|
||||
|
||||
selName = [NSString stringWithFormat: @"set%@%@:",
|
||||
[[_tag substringToIndex: 1] uppercaseString],
|
||||
[_tag substringFromIndex: 1]];
|
||||
sel = NSSelectorFromString(selName);
|
||||
|
||||
if (sel && [_src respondsToSelector: sel])
|
||||
{
|
||||
[_src performSelector: sel withObject: _dst];
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *nam = [_tag cString];
|
||||
const char *type;
|
||||
unsigned int size;
|
||||
int offset;
|
||||
|
||||
/*
|
||||
* Use the GNUstep additional function to set the instance
|
||||
* variable directly.
|
||||
* FIXME - need some way to do this for libFoundation and
|
||||
* Foundation based systems.
|
||||
*/
|
||||
if (GSObjCFindVariable(_src, nam, &type, &size, &offset))
|
||||
{
|
||||
GSObjCSetVariable(_src, offset, size, (void*)&_dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
NSLog(@"Error while establishing connection %@: %@",self,[localException reason]);
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation NSBundle (NSBundleAdditions)
|
||||
+ (BOOL) loadNibFile: (NSString*)fileName
|
||||
externalNameTable: (NSDictionary*)context
|
||||
|
|
237
Source/NSNibConnector.m
Normal file
237
Source/NSNibConnector.m
Normal file
|
@ -0,0 +1,237 @@
|
|||
/*
|
||||
<title>NSNibConnector</title>
|
||||
|
||||
<abstract>Implementation of NSNibConnector and subclasses</abstract>
|
||||
|
||||
Copyright (C) 1999, 2015 Free Software Foundation, Inc.
|
||||
|
||||
Author: Richard Frith-Macdonald <richard@branstorm.co.uk>
|
||||
Date: 1999
|
||||
Author: Fred Kiefer <fredkiefer@gmx.de>
|
||||
Date: August 2015
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#import "config.h"
|
||||
#import <Foundation/NSCoder.h>
|
||||
#import <Foundation/NSException.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import "AppKit/NSControl.h"
|
||||
#import "AppKit/NSNibConnector.h"
|
||||
|
||||
@implementation NSNibConnector
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(_src);
|
||||
RELEASE(_dst);
|
||||
RELEASE(_tag);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id) destination
|
||||
{
|
||||
return _dst;
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
if ([aCoder allowsKeyedCoding])
|
||||
{
|
||||
if (_src != nil)
|
||||
{
|
||||
[aCoder encodeObject: _src forKey: @"NSSource"];
|
||||
}
|
||||
if (_dst != nil)
|
||||
{
|
||||
[aCoder encodeObject: _dst forKey: @"NSDestination"];
|
||||
}
|
||||
if (_tag != nil)
|
||||
{
|
||||
[aCoder encodeObject: _tag forKey: @"NSLabel"];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[aCoder encodeObject: _src];
|
||||
[aCoder encodeObject: _dst];
|
||||
[aCoder encodeObject: _tag];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) establishConnection
|
||||
{
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
if ([aDecoder containsValueForKey: @"NSDestination"])
|
||||
{
|
||||
ASSIGN(_dst, [aDecoder decodeObjectForKey: @"NSDestination"]);
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSSource"])
|
||||
{
|
||||
ASSIGN(_src, [aDecoder decodeObjectForKey: @"NSSource"]);
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSLabel"])
|
||||
{
|
||||
ASSIGN(_tag, [aDecoder decodeObjectForKey: @"NSLabel"]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_src];
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_dst];
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_tag];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL) isEqual: (id)object
|
||||
{
|
||||
BOOL result = NO;
|
||||
|
||||
if([object isKindOfClass: [NSNibConnector class]] == NO)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
if(self == object)
|
||||
{
|
||||
result = YES;
|
||||
}
|
||||
else if([[self source] isEqual: [object source]] &&
|
||||
[[self destination] isEqual: [object destination]] &&
|
||||
[[self label] isEqual: [object label]] &&
|
||||
([self class] == [object class]))
|
||||
{
|
||||
result = YES;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
- (NSString*) label
|
||||
{
|
||||
return _tag;
|
||||
}
|
||||
|
||||
- (void) replaceObject: (id)anObject withObject: (id)anotherObject
|
||||
{
|
||||
if (_src == anObject)
|
||||
{
|
||||
ASSIGN(_src, anotherObject);
|
||||
}
|
||||
if (_dst == anObject)
|
||||
{
|
||||
ASSIGN(_dst, anotherObject);
|
||||
}
|
||||
if (_tag == anObject)
|
||||
{
|
||||
ASSIGN(_tag, anotherObject);
|
||||
}
|
||||
}
|
||||
|
||||
- (id) source
|
||||
{
|
||||
return _src;
|
||||
}
|
||||
|
||||
- (void) setDestination: (id)anObject
|
||||
{
|
||||
ASSIGN(_dst, anObject);
|
||||
}
|
||||
|
||||
- (void) setLabel: (NSString*)label
|
||||
{
|
||||
ASSIGN(_tag, label);
|
||||
}
|
||||
|
||||
- (void) setSource: (id)anObject
|
||||
{
|
||||
ASSIGN(_src, anObject);
|
||||
}
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
NSString *desc = [NSString stringWithFormat: @"<%@ src=%@ dst=%@ label=%@>",
|
||||
[super description],
|
||||
[self source],
|
||||
[self destination],
|
||||
[self label]];
|
||||
return desc;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation NSNibControlConnector
|
||||
- (void) establishConnection
|
||||
{
|
||||
SEL sel = NSSelectorFromString(_tag);
|
||||
|
||||
[_src setTarget: _dst];
|
||||
[_src setAction: sel];
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation NSNibOutletConnector
|
||||
- (void) establishConnection
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
if (_src != nil)
|
||||
{
|
||||
NSString *selName;
|
||||
SEL sel;
|
||||
|
||||
selName = [NSString stringWithFormat: @"set%@%@:",
|
||||
[[_tag substringToIndex: 1] uppercaseString],
|
||||
[_tag substringFromIndex: 1]];
|
||||
sel = NSSelectorFromString(selName);
|
||||
|
||||
if (sel && [_src respondsToSelector: sel])
|
||||
{
|
||||
[_src performSelector: sel withObject: _dst];
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* We cannot use the KVC mechanism here, as this would always retain _dst
|
||||
* and it could also affect _setXXX methods and _XXX ivars that aren't
|
||||
* affected by the Cocoa code.
|
||||
*/
|
||||
const char *name = [_tag cString];
|
||||
Class class = object_getClass(_src);
|
||||
Ivar ivar = class_getInstanceVariable(class, name);
|
||||
|
||||
if (ivar != 0)
|
||||
{
|
||||
object_setIvar(_src, ivar, _dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
NSLog(@"Error while establishing connection %@: %@", self, [localException reason]);
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
@end
|
|
@ -630,6 +630,8 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
|||
//_nextKeyView = 0;
|
||||
//_previousKeyView = 0;
|
||||
|
||||
_alphaValue = 1.0;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -1639,6 +1641,30 @@ static NSSize _computeScale(NSSize fs, NSSize bs)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
- (CGFloat) alphaValue
|
||||
{
|
||||
return _alphaValue;
|
||||
}
|
||||
|
||||
- (void)setAlphaValue: (CGFloat)alpha
|
||||
{
|
||||
_alphaValue = alpha;
|
||||
}
|
||||
|
||||
- (CGFloat) frameCenterRotation
|
||||
{
|
||||
// FIXME this is dummy, we don't have layers yet
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
- (void) setFrameCenterRotation:(CGFloat)rot;
|
||||
{
|
||||
// FIXME this is dummy, we don't have layers yet
|
||||
// we probably need a Matrix akin frame rotation.
|
||||
}
|
||||
|
||||
|
||||
- (NSRect) centerScanRect: (NSRect)aRect
|
||||
{
|
||||
NSAffineTransform *matrix;
|
||||
|
@ -2810,7 +2836,6 @@ in the main thread.
|
|||
const NSRect inBase = [self convertRectToBase: _invalidRect];
|
||||
const NSRect inBaseRounded = NSIntegralRect(inBase);
|
||||
_invalidRect = [self convertRectFromBase: inBaseRounded];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -3284,48 +3284,8 @@ checkCursorRectanglesExited(NSView *theView, NSEvent *theEvent, NSPoint lastPoi
|
|||
+ (NSButton *) standardWindowButton: (NSWindowButton)button
|
||||
forStyleMask: (NSUInteger) mask
|
||||
{
|
||||
NSButton *newButton;
|
||||
|
||||
newButton = [[NSButton alloc] init];
|
||||
[newButton setRefusesFirstResponder: YES];
|
||||
[newButton setButtonType: NSMomentaryChangeButton];
|
||||
[newButton setImagePosition: NSImageOnly];
|
||||
[newButton setBordered: YES];
|
||||
[newButton setTag: button];
|
||||
|
||||
switch (button)
|
||||
{
|
||||
case NSWindowCloseButton:
|
||||
[newButton setImage: [NSImage imageNamed: @"common_Close"]];
|
||||
[newButton setAlternateImage: [NSImage imageNamed: @"common_CloseH"]];
|
||||
/* TODO: -performClose: should (but doesn't currently) highlight the
|
||||
button, which is wrong here. When -performClose: is fixed, we'll need a
|
||||
different method here. */
|
||||
[newButton setAction: @selector(performClose:)];
|
||||
break;
|
||||
|
||||
case NSWindowMiniaturizeButton:
|
||||
[newButton setImage: [NSImage imageNamed: @"common_Miniaturize"]];
|
||||
[newButton setAlternateImage: [NSImage imageNamed: @"common_MiniaturizeH"]];
|
||||
[newButton setAction: @selector(miniaturize:)];
|
||||
break;
|
||||
|
||||
case NSWindowZoomButton:
|
||||
// FIXME
|
||||
[newButton setAction: @selector(zoom:)];
|
||||
break;
|
||||
|
||||
case NSWindowToolbarButton:
|
||||
// FIXME
|
||||
[newButton setAction: @selector(toggleToolbarShown:)];
|
||||
break;
|
||||
case NSWindowDocumentIconButton:
|
||||
default:
|
||||
// FIXME
|
||||
break;
|
||||
}
|
||||
|
||||
return AUTORELEASE(newButton);
|
||||
return [[GSTheme theme] standardWindowButton: button
|
||||
forStyleMask: mask];
|
||||
}
|
||||
|
||||
- (NSButton *) standardWindowButton: (NSWindowButton)button
|
||||
|
@ -5285,6 +5245,7 @@ current key view.<br />
|
|||
|
||||
[aCell setKeyEquivalent: @"\r"];
|
||||
[aCell setKeyEquivalentModifierMask: 0];
|
||||
[[GSTheme theme] didSetDefaultButtonCell: aCell];
|
||||
}
|
||||
|
||||
- (void) disableKeyEquivalentForDefaultButtonCell
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue