mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-03 19:00:42 +00:00
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:
parent
a2db2de101
commit
7345965f7b
5 changed files with 117 additions and 42 deletions
|
@ -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>
|
2015-06-25 14:17-EDT Gregory John Casamento <greg.casamento@gmail.com>
|
||||||
|
|
||||||
* Headers/Additions/GNUstepGUI/GSTheme.h: Declarations for new theme
|
* Headers/Additions/GNUstepGUI/GSTheme.h: Declarations for new theme
|
||||||
|
|
|
@ -1465,5 +1465,20 @@ withRepeatedImage: (NSImage*)image
|
||||||
- (Class) pageLayoutClass;
|
- (Class) pageLayoutClass;
|
||||||
@end
|
@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 /* OS_API_VERSION */
|
||||||
#endif /* _GNUstep_H_GSTheme */
|
#endif /* _GNUstep_H_GSTheme */
|
||||||
|
|
|
@ -235,6 +235,7 @@ GSThemeOpenSavePanels.m \
|
||||||
GSThemePanel.m \
|
GSThemePanel.m \
|
||||||
GSThemePrintPanels.m \
|
GSThemePrintPanels.m \
|
||||||
GSThemeTools.m \
|
GSThemeTools.m \
|
||||||
|
GSThemeWindow.m \
|
||||||
GSTitleView.m \
|
GSTitleView.m \
|
||||||
GSToolTips.m \
|
GSToolTips.m \
|
||||||
GSToolbarView.m \
|
GSToolbarView.m \
|
||||||
|
|
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
|
|
@ -3234,48 +3234,8 @@ checkCursorRectanglesExited(NSView *theView, NSEvent *theEvent, NSPoint lastPoi
|
||||||
+ (NSButton *) standardWindowButton: (NSWindowButton)button
|
+ (NSButton *) standardWindowButton: (NSWindowButton)button
|
||||||
forStyleMask: (NSUInteger) mask
|
forStyleMask: (NSUInteger) mask
|
||||||
{
|
{
|
||||||
NSButton *newButton;
|
return [[GSTheme theme] standardWindowButton: button
|
||||||
|
forStyleMask: mask];
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSButton *) standardWindowButton: (NSWindowButton)button
|
- (NSButton *) standardWindowButton: (NSWindowButton)button
|
||||||
|
@ -5164,6 +5124,7 @@ current key view.<br />
|
||||||
|
|
||||||
[aCell setKeyEquivalent: @"\r"];
|
[aCell setKeyEquivalent: @"\r"];
|
||||||
[aCell setKeyEquivalentModifierMask: 0];
|
[aCell setKeyEquivalentModifierMask: 0];
|
||||||
|
[[GSTheme theme] didSetDefaultButtonCell: aCell];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) disableKeyEquivalentForDefaultButtonCell
|
- (void) disableKeyEquivalentForDefaultButtonCell
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue