2003-07-31 23:52:10 +00:00
|
|
|
/*
|
|
|
|
NSButtonCell.h
|
|
|
|
|
|
|
|
The cell class for NSButton
|
|
|
|
|
|
|
|
Copyright (C) 1996 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
Author: Scott Christley <scottc@net-community.com>
|
|
|
|
Ovidiu Predescu <ovidiu@net-community.com>
|
|
|
|
Date: 1996
|
|
|
|
|
|
|
|
This file is part of the GNUstep GUI Library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
2007-10-29 21:16:17 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
2003-07-31 23:52:10 +00:00
|
|
|
License as published by the Free Software Foundation; either
|
2008-06-10 04:01:49 +00:00
|
|
|
version 2 of the License, or (at your option) any later version.
|
2007-10-29 21:16:17 +00:00
|
|
|
|
2003-07-31 23:52:10 +00:00
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2007-10-29 21:16:17 +00:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
2003-07-31 23:52:10 +00:00
|
|
|
|
2007-10-29 21:16:17 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2003-07-31 23:52:10 +00:00
|
|
|
License along with this library; see the file COPYING.LIB.
|
2007-10-29 21:16:17 +00:00
|
|
|
If not, see <http://www.gnu.org/licenses/> or write to the
|
|
|
|
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
2006-11-06 13:58:37 +00:00
|
|
|
Boston, MA 02110-1301, USA.
|
2003-07-31 23:52:10 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _GNUstep_H_NSButtonCell
|
|
|
|
#define _GNUstep_H_NSButtonCell
|
2006-11-06 13:58:37 +00:00
|
|
|
#import <GNUstepBase/GSVersionMacros.h>
|
2003-07-31 23:52:10 +00:00
|
|
|
|
2010-03-24 22:41:21 +00:00
|
|
|
#import <AppKit/NSActionCell.h>
|
2003-07-31 23:52:10 +00:00
|
|
|
|
|
|
|
@class NSFont;
|
|
|
|
@class NSSound;
|
|
|
|
|
2007-01-23 14:44:35 +00:00
|
|
|
/** Type of button in an NSButton or NSButtonCell.
|
|
|
|
* <deflist>
|
|
|
|
* <term>NSMomentaryPushInButton</term>
|
|
|
|
* <desc><em>Default button type!</em> Pushed in and lit when mouse is
|
|
|
|
* down, pushed out and unlit when mouse is release.</desc>
|
|
|
|
* <term>NSPushOnPushOffButton</term>
|
|
|
|
* <desc>Used to show/store ON / OFF states. In when ON, out when OFF.</desc>
|
|
|
|
* <term>NSToggleButton</term>
|
|
|
|
* <desc>Like NSPushOnPushOffButton but images is changed for ON and
|
|
|
|
* OFF state.</desc>
|
|
|
|
* <term>NSSwitchButton</term>
|
|
|
|
* <desc>A borderless NSToggleButton</desc>
|
|
|
|
* <term>NSRadioButton</term>
|
|
|
|
* <desc>A type of NSSwitchButton similar to a Microsoft Windows radio
|
|
|
|
* button.</desc>
|
|
|
|
* <term>NSMomentaryChangeButton</term>
|
|
|
|
* <desc>Image of button changes on mouse down and then changes back
|
|
|
|
* once released.</desc>
|
|
|
|
* <term>NSOnOffButton</term>
|
|
|
|
* <desc>Simple ON / OFF button. First click lights the button,
|
|
|
|
* seconds click unlights it.</desc>
|
|
|
|
* <term>NSMomentaryLightButton</term>
|
|
|
|
* <desc>Like NSMomentaryPushInButton but button is not pushed
|
|
|
|
* in on mouse down</desc>
|
|
|
|
*
|
|
|
|
* <term>NSMomentaryLight</term>
|
|
|
|
* <desc>Same as NSMomentaryPushInButton. Has been depricated in Cocoa.</desc>
|
|
|
|
* <term>NSMomentaryPushButton</term>
|
|
|
|
* <desc>Same as NSMomentaryLightButton. Has been depricated in
|
|
|
|
* Cocoa.</desc>
|
2007-01-24 09:46:07 +00:00
|
|
|
* </deflist>
|
2007-01-23 14:44:35 +00:00
|
|
|
*/
|
2003-07-31 23:52:10 +00:00
|
|
|
typedef enum _NSButtonType {
|
2007-01-23 14:17:02 +00:00
|
|
|
NSMomentaryLightButton,
|
2003-07-31 23:52:10 +00:00
|
|
|
NSPushOnPushOffButton,
|
|
|
|
NSToggleButton,
|
|
|
|
NSSwitchButton,
|
|
|
|
NSRadioButton,
|
|
|
|
NSMomentaryChangeButton,
|
|
|
|
NSOnOffButton,
|
2007-01-23 14:17:02 +00:00
|
|
|
NSMomentaryPushInButton,
|
|
|
|
// These are old names
|
|
|
|
NSMomentaryLight = NSMomentaryPushInButton,
|
|
|
|
NSMomentaryPushButton = NSMomentaryLightButton
|
2003-07-31 23:52:10 +00:00
|
|
|
} NSButtonType;
|
|
|
|
|
|
|
|
typedef enum _NSBezelStyle {
|
2007-01-23 14:17:02 +00:00
|
|
|
NSRoundedBezelStyle = 1,
|
2003-07-31 23:52:10 +00:00
|
|
|
NSRegularSquareBezelStyle,
|
|
|
|
NSThickSquareBezelStyle,
|
|
|
|
NSThickerSquareBezelStyle,
|
2007-01-23 14:17:02 +00:00
|
|
|
NSDisclosureBezelStyle,
|
|
|
|
NSShadowlessSquareBezelStyle,
|
|
|
|
NSCircularBezelStyle,
|
|
|
|
NSTexturedSquareBezelStyle,
|
|
|
|
NSHelpButtonBezelStyle,
|
|
|
|
NSSmallSquareBezelStyle,
|
2010-01-28 23:33:08 +00:00
|
|
|
NSTexturedRoundedBezelStyle,
|
2007-01-23 14:17:02 +00:00
|
|
|
NSRoundRectBezelStyle,
|
|
|
|
NSRecessedBezelStyle,
|
|
|
|
NSRoundedDisclosureBezelStyle,
|
2003-07-31 23:52:10 +00:00
|
|
|
// The next five no longer show up in the MacOSX documentation
|
|
|
|
NSNeXTBezelStyle,
|
|
|
|
NSPushButtonBezelStyle,
|
|
|
|
NSSmallIconButtonBezelStyle,
|
|
|
|
NSMediumIconButtonBezelStyle,
|
2007-01-23 14:17:02 +00:00
|
|
|
NSLargeIconButtonBezelStyle
|
2003-07-31 23:52:10 +00:00
|
|
|
} NSBezelStyle;
|
|
|
|
|
|
|
|
typedef enum _NSGradientType {
|
|
|
|
NSGradientNone,
|
|
|
|
NSGradientConcaveWeak,
|
|
|
|
NSGradientConcaveStrong,
|
|
|
|
NSGradientConvexWeak,
|
|
|
|
NSGradientConvexStrong
|
|
|
|
} NSGradientType;
|
|
|
|
|
|
|
|
|
|
|
|
@interface NSButtonCell : NSActionCell
|
|
|
|
{
|
|
|
|
// Attributes
|
|
|
|
NSString *_altContents;
|
|
|
|
NSImage *_altImage;
|
|
|
|
NSString *_keyEquivalent;
|
|
|
|
NSFont *_keyEquivalentFont;
|
|
|
|
NSSound *_sound;
|
|
|
|
unsigned int _keyEquivalentModifierMask;
|
|
|
|
unsigned int _highlightsByMask;
|
|
|
|
unsigned int _showAltStateMask;
|
|
|
|
float _delayInterval;
|
|
|
|
float _repeatInterval;
|
|
|
|
NSBezelStyle _bezel_style;
|
|
|
|
NSGradientType _gradient_type;
|
2007-01-23 14:17:02 +00:00
|
|
|
NSColor *_backgroundColor;
|
2003-07-31 23:52:10 +00:00
|
|
|
// Think of the following as a BOOL ivars
|
|
|
|
#define _buttoncell_is_transparent _cell.subclass_bool_one
|
|
|
|
#define _image_dims_when_disabled _cell.subclass_bool_two
|
2007-01-23 14:17:02 +00:00
|
|
|
#define _shows_border_only_while_mouse_inside _cell.subclass_bool_three
|
|
|
|
#define _mouse_inside _cell.subclass_bool_four
|
2003-07-31 23:52:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Setting the Titles
|
|
|
|
//
|
|
|
|
- (NSString *)alternateTitle;
|
2009-08-25 07:46:37 +00:00
|
|
|
- (void)setAlternateTitle: (NSString *)aString;
|
|
|
|
- (void)setFont: (NSFont *)fontObject;
|
|
|
|
- (void)setTitle: (NSString *)aString;
|
2003-07-31 23:52:10 +00:00
|
|
|
- (NSString *)title;
|
2006-11-06 13:58:37 +00:00
|
|
|
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
2003-07-31 23:52:10 +00:00
|
|
|
- (NSAttributedString *)attributedAlternateTitle;
|
|
|
|
- (NSAttributedString *)attributedTitle;
|
2009-08-25 07:46:37 +00:00
|
|
|
- (void)setAttributedAlternateTitle: (NSAttributedString *)aString;
|
|
|
|
- (void)setAttributedTitle: (NSAttributedString *)aString;
|
|
|
|
- (void)setTitleWithMnemonic: (NSString *)aString;
|
2003-07-31 23:52:10 +00:00
|
|
|
- (NSString *)alternateMnemonic;
|
|
|
|
- (unsigned)alternateMnemonicLocation;
|
2009-08-25 07:46:37 +00:00
|
|
|
- (void)setAlternateMnemonicLocation: (unsigned)location;
|
|
|
|
- (void)setAlternateTitleWithMnemonic: (NSString *)aString;
|
2003-07-31 23:52:10 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
//
|
|
|
|
// Setting the Images
|
|
|
|
//
|
|
|
|
- (NSImage *)alternateImage;
|
|
|
|
- (NSCellImagePosition)imagePosition;
|
2009-08-25 07:46:37 +00:00
|
|
|
- (void)setAlternateImage: (NSImage *)anImage;
|
|
|
|
- (void)setImagePosition: (NSCellImagePosition)aPosition;
|
2003-07-31 23:52:10 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Setting the Repeat Interval
|
|
|
|
//
|
2009-08-25 07:46:37 +00:00
|
|
|
- (void)getPeriodicDelay: (float *)delay
|
|
|
|
interval: (float *)interval;
|
|
|
|
- (void)setPeriodicDelay: (float)delay
|
|
|
|
interval: (float)interval;
|
2003-07-31 23:52:10 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Setting the Key Equivalent
|
|
|
|
//
|
|
|
|
- (NSString *)keyEquivalent;
|
|
|
|
- (NSFont *)keyEquivalentFont;
|
|
|
|
- (unsigned int)keyEquivalentModifierMask;
|
2009-08-25 07:46:37 +00:00
|
|
|
- (void)setKeyEquivalent: (NSString *)key;
|
|
|
|
- (void)setKeyEquivalentModifierMask: (unsigned int)mask;
|
|
|
|
- (void)setKeyEquivalentFont: (NSFont *)fontObj;
|
|
|
|
- (void)setKeyEquivalentFont: (NSString *)fontName
|
|
|
|
size: (float)fontSize;
|
2003-07-31 23:52:10 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Modifying Graphic Attributes
|
|
|
|
//
|
|
|
|
- (BOOL)isTransparent;
|
2009-08-25 07:46:37 +00:00
|
|
|
- (void)setTransparent: (BOOL)flag;
|
2006-11-06 13:58:37 +00:00
|
|
|
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
2003-07-31 23:52:10 +00:00
|
|
|
- (NSBezelStyle)bezelStyle;
|
2009-08-25 07:46:37 +00:00
|
|
|
- (void)setBezelStyle: (NSBezelStyle)bezelStyle;
|
2003-07-31 23:52:10 +00:00
|
|
|
- (BOOL)showsBorderOnlyWhileMouseInside;
|
2009-08-25 07:46:37 +00:00
|
|
|
- (void)setShowsBorderOnlyWhileMouseInside: (BOOL)show;
|
2003-07-31 23:52:10 +00:00
|
|
|
- (NSGradientType)gradientType;
|
2009-08-25 07:46:37 +00:00
|
|
|
- (void)setGradientType: (NSGradientType)gradientType;
|
2003-07-31 23:52:10 +00:00
|
|
|
- (BOOL)imageDimsWhenDisabled;
|
2009-08-25 07:46:37 +00:00
|
|
|
- (void)setImageDimsWhenDisabled: (BOOL)flag;
|
2003-07-31 23:52:10 +00:00
|
|
|
#endif
|
2007-01-23 14:17:02 +00:00
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
|
2009-08-25 07:46:37 +00:00
|
|
|
- (NSColor *) backgroundColor;
|
|
|
|
- (void) setBackgroundColor: (NSColor *)color;
|
|
|
|
- (void) drawBezelWithFrame: (NSRect)cellFrame inView: (NSView*)controlView;
|
|
|
|
- (void) drawImage: (NSImage*)imageToDisplay
|
|
|
|
withFrame: (NSRect)cellFrame
|
|
|
|
inView: (NSView *)controlView;
|
|
|
|
- (void) drawTitle: (NSAttributedString*)titleToDisplay
|
|
|
|
withFrame: (NSRect)cellFrame
|
|
|
|
inView: (NSView *)controlView;
|
2007-01-23 14:17:02 +00:00
|
|
|
#endif
|
2003-07-31 23:52:10 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Modifying Graphic Attributes
|
|
|
|
//
|
|
|
|
- (int)highlightsBy;
|
2009-08-25 07:46:37 +00:00
|
|
|
- (void)setHighlightsBy: (int)mask;
|
|
|
|
- (void)setShowsStateBy: (int)mask;
|
|
|
|
- (void)setButtonType: (NSButtonType)buttonType;
|
2003-07-31 23:52:10 +00:00
|
|
|
- (int)showsStateBy;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Sound
|
|
|
|
//
|
2006-11-06 13:58:37 +00:00
|
|
|
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
2009-08-25 07:46:37 +00:00
|
|
|
- (void)setSound: (NSSound *)aSound;
|
2003-07-31 23:52:10 +00:00
|
|
|
- (NSSound *)sound;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//
|
|
|
|
// Mouse
|
|
|
|
//
|
2006-11-06 13:58:37 +00:00
|
|
|
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
2009-08-25 07:46:37 +00:00
|
|
|
- (void)mouseEntered: (NSEvent *)event;
|
|
|
|
- (void)mouseExited: (NSEvent *)event;
|
2003-07-31 23:52:10 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
#endif // _GNUstep_H_NSButtonCell
|