Add more theme methods for theming windows.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@38687 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2015-06-26 00:13:05 +00:00
parent 0ff0a07742
commit 4213323979
5 changed files with 117 additions and 42 deletions

View file

@ -1,3 +1,12 @@
2015-06-25 20:11-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Headers/Additions/GNUstepGUI/GSTheme.h: Add declarations for method
* Source/GNUmakefile: Add new file GSThemeWindow.m
* Source/GSThemeWindow.m: Add method standardWindowButton:
forStyleMask:.
* Source/NSWindow.m: Call theme methods to return standardWindowButton:
forStyleMask:.
2015-06-25 14:17-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Headers/Additions/GNUstepGUI/GSTheme.h: Declarations for new theme

View file

@ -1465,5 +1465,20 @@ 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
#endif /* OS_API_VERSION */
#endif /* _GNUstep_H_GSTheme */

View file

@ -235,6 +235,7 @@ GSThemeOpenSavePanels.m \
GSThemePanel.m \
GSThemePrintPanels.m \
GSThemeTools.m \
GSThemeWindow.m \
GSTitleView.m \
GSToolTips.m \
GSToolbarView.m \

89
Source/GSThemeWindow.m Normal file
View 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

View file

@ -3234,48 +3234,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
@ -5164,6 +5124,7 @@ current key view.<br />
[aCell setKeyEquivalent: @"\r"];
[aCell setKeyEquivalentModifierMask: 0];
[[GSTheme theme] didSetDefaultButtonCell: aCell];
}
- (void) disableKeyEquivalentForDefaultButtonCell