1/** <title>GSThemeWindow</title> 2 3 <abstract>The theme methods for window specific functions</abstract> 4 5 Copyright (C) 2015 Free Software Foundation, Inc. 6 7 Author: Gregory Casamento <greg.casamento@gmail.com> 8 Date: Jun 2015 9 10 This file is part of the GNU Objective C User interface library. 11 12 This library is free software; you can redistribute it and/or 13 modify it under the terms of the GNU Lesser General Public 14 License as published by the Free Software Foundation; either 15 version 2 of the License, or (at your option) any later version. 16 17 This library is distributed in the hope that it will be useful, 18 but WITHOUT ANY WARRANTY; without even the implied warranty of 19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 Lesser General Public License for more details. 21 22 You should have received a copy of the GNU Lesser General Public 23 License along with this library; see the file COPYING.LIB. 24 If not, see <http://www.gnu.org/licenses/> or write to the 25 Free Software Foundation, 51 Franklin Street, Fifth Floor, 26 Boston, MA 02110-1301, USA. 27*/ 28 29#import "AppKit/NSWindow.h" 30#import "AppKit/NSImage.h" 31#import "AppKit/NSButton.h" 32 33#import "GNUstepGUI/GSTheme.h" 34#import "GNUstepGUI/GSWindowDecorationView.h" 35#import "GSThemePrivate.h" 36 37@implementation GSTheme (NSWindow) 38- (NSButton *) standardWindowButton: (NSWindowButton)button 39 forStyleMask: (NSUInteger) mask 40{ 41 NSButton *newButton; 42 43 newButton = [[NSButton alloc] init]; 44 [newButton setRefusesFirstResponder: YES]; 45 [newButton setButtonType: NSMomentaryChangeButton]; 46 [newButton setImagePosition: NSImageOnly]; 47 [newButton setBordered: YES]; 48 [newButton setTag: button]; 49 50 switch (button) 51 { 52 case NSWindowCloseButton: 53 [newButton setImage: [NSImage imageNamed: @"common_Close"]]; 54 [newButton setAlternateImage: [NSImage imageNamed: @"common_CloseH"]]; 55 /* TODO: -performClose: should (but doesn't currently) highlight the 56 button, which is wrong here. When -performClose: is fixed, we'll need a 57 different method here. */ 58 [newButton setAction: @selector(performClose:)]; 59 break; 60 61 case NSWindowMiniaturizeButton: 62 [newButton setImage: [NSImage imageNamed: @"common_Miniaturize"]]; 63 [newButton setAlternateImage: [NSImage imageNamed: @"common_MiniaturizeH"]]; 64 [newButton setAction: @selector(miniaturize:)]; 65 break; 66 67 case NSWindowZoomButton: 68 // FIXME 69 [newButton setAction: @selector(zoom:)]; 70 break; 71 72 case NSWindowToolbarButton: 73 // FIXME 74 [newButton setAction: @selector(toggleToolbarShown:)]; 75 break; 76 case NSWindowDocumentIconButton: 77 default: 78 // FIXME 79 break; 80 } 81 82 return AUTORELEASE(newButton); 83} 84 85- (void) didSetDefaultButtonCell: (NSButtonCell *)aCell 86{ 87 // default implementation does nothing... 88} 89@end 90