2003-07-31 23:52:10 +00:00
|
|
|
/*
|
|
|
|
NSToolbarItem.h
|
|
|
|
|
|
|
|
The toolbar item class.
|
|
|
|
|
|
|
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
Author: Gregory John Casamento <greg_casamento@yahoo.com>,
|
2004-04-13 14:10:22 +00:00
|
|
|
Fabien Vallon <fabien.vallon@fr.alcove.com>,
|
|
|
|
Quentin Mathe <qmathe@club-internet.fr>
|
2003-07-31 23:52:10 +00:00
|
|
|
Date: May 2002
|
|
|
|
|
|
|
|
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 Library 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
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public
|
|
|
|
License along with this library; see the file COPYING.LIB.
|
|
|
|
If not, write to the Free Software Foundation,
|
2005-05-26 02:52:46 +00:00
|
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2003-07-31 23:52:10 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _GNUstep_H_NSToolbarItem
|
|
|
|
#define _GNUstep_H_NSToolbarItem
|
|
|
|
|
|
|
|
#include <Foundation/NSObject.h>
|
|
|
|
#include <Foundation/NSGeometry.h>
|
2004-02-25 03:27:23 +00:00
|
|
|
#include <AppKit/AppKitDefines.h>
|
|
|
|
#include <AppKit/NSUserInterfaceValidation.h>
|
2003-07-31 23:52:10 +00:00
|
|
|
|
|
|
|
@class NSArray;
|
|
|
|
@class NSString;
|
|
|
|
@class NSDictionary;
|
|
|
|
@class NSMutableDictionary;
|
|
|
|
@class NSImage;
|
|
|
|
@class NSMenuItem;
|
|
|
|
@class NSView;
|
2004-04-13 14:10:22 +00:00
|
|
|
@class GSToolbar;
|
2003-07-31 23:52:10 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Constants
|
|
|
|
*/
|
2004-02-29 04:39:48 +00:00
|
|
|
APPKIT_EXPORT NSString *NSToolbarSeparatorItemIdentifier;
|
2003-07-31 23:52:10 +00:00
|
|
|
APPKIT_EXPORT NSString *NSToolbarSpaceItemIdentifier;
|
|
|
|
APPKIT_EXPORT NSString *NSToolbarFlexibleSpaceItemIdentifier;
|
|
|
|
APPKIT_EXPORT NSString *NSToolbarShowColorsItemIdentifier;
|
|
|
|
APPKIT_EXPORT NSString *NSToolbarShowFontsItemIdentifier;
|
|
|
|
APPKIT_EXPORT NSString *NSToolbarCustomizeToolbarItemIdentifier;
|
|
|
|
APPKIT_EXPORT NSString *NSToolbarPrintItemIdentifier;
|
|
|
|
|
|
|
|
@interface NSToolbarItem : NSObject <NSCopying, NSValidatedUserInterfaceItem>
|
|
|
|
{
|
|
|
|
// externally visible variables
|
|
|
|
BOOL _allowsDuplicatesInToolbar;
|
|
|
|
NSString *_itemIdentifier;
|
|
|
|
NSString *_label;
|
|
|
|
NSString *_paletteLabel;
|
2004-02-25 03:27:23 +00:00
|
|
|
NSImage *_image;
|
2004-07-07 23:21:10 +00:00
|
|
|
id _view;
|
|
|
|
NSMenuItem *_menuFormRepresentation;
|
|
|
|
NSString *_toolTip;
|
|
|
|
int _tag;
|
2003-08-24 17:22:11 +00:00
|
|
|
|
|
|
|
// toolbar
|
2004-04-13 14:10:22 +00:00
|
|
|
GSToolbar *_toolbar;
|
2004-02-25 03:27:23 +00:00
|
|
|
NSView *_backView;
|
2004-04-13 14:10:22 +00:00
|
|
|
BOOL _modified;
|
2004-05-23 18:22:45 +00:00
|
|
|
BOOL _selectable;
|
2003-08-24 17:22:11 +00:00
|
|
|
|
|
|
|
// size
|
|
|
|
NSSize _maxSize;
|
|
|
|
NSSize _minSize;
|
|
|
|
|
|
|
|
// record the fact that the view responds to these
|
|
|
|
// to save time.
|
2003-08-29 04:13:48 +00:00
|
|
|
struct __flags
|
2003-08-24 17:22:11 +00:00
|
|
|
{
|
|
|
|
// gets
|
2003-08-29 04:13:48 +00:00
|
|
|
unsigned int _isEnabled:1;
|
|
|
|
unsigned int _tag:1;
|
|
|
|
unsigned int _action:1;
|
|
|
|
unsigned int _target:1;
|
|
|
|
unsigned int _image:1;
|
2003-08-24 17:22:11 +00:00
|
|
|
// sets
|
2003-08-29 04:13:48 +00:00
|
|
|
unsigned int _setEnabled:1;
|
|
|
|
unsigned int _setTag:1;
|
|
|
|
unsigned int _setAction:1;
|
|
|
|
unsigned int _setTarget:1;
|
|
|
|
unsigned int _setImage:1;
|
|
|
|
// to even out the long.
|
|
|
|
unsigned int RESERVED:22;
|
2003-08-24 17:22:11 +00:00
|
|
|
} _flags;
|
2003-07-31 23:52:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Instance methods
|
|
|
|
- (id)initWithItemIdentifier: (NSString *)itemIdentifier;
|
2004-02-25 03:27:23 +00:00
|
|
|
|
2003-07-31 23:52:10 +00:00
|
|
|
- (void)validate;
|
2004-02-25 03:27:23 +00:00
|
|
|
|
|
|
|
// Accessors
|
|
|
|
- (SEL) action;
|
|
|
|
- (BOOL) allowsDuplicatesInToolbar;
|
|
|
|
- (NSImage *) image;
|
|
|
|
- (BOOL) isEnabled;
|
|
|
|
- (NSString *) itemIdentifier;
|
|
|
|
- (NSString *) label;
|
|
|
|
- (NSSize) maxSize;
|
|
|
|
- (NSMenuItem *) menuFormRepresentation;
|
|
|
|
- (NSSize) minSize;
|
|
|
|
- (NSString *) paletteLabel;
|
|
|
|
- (int) tag;
|
|
|
|
- (id) target;
|
|
|
|
- (NSString *) toolTip;
|
2004-04-13 14:10:22 +00:00
|
|
|
- (GSToolbar *) toolbar;
|
2004-02-25 03:27:23 +00:00
|
|
|
- (NSView *) view;
|
|
|
|
- (void) setAction: (SEL)action;
|
|
|
|
- (void) setEnabled: (BOOL)enabled;
|
|
|
|
- (void) setImage: (NSImage *)image;
|
|
|
|
- (void) setLabel: (NSString *)label;
|
|
|
|
- (void) setMaxSize: (NSSize)maxSize;
|
|
|
|
- (void) setMenuFormRepresentation: (NSMenuItem *)menuItem;
|
|
|
|
- (void) setMinSize: (NSSize)minSize;
|
|
|
|
- (void) setPaletteLabel: (NSString *)paletteLabel;
|
|
|
|
- (void) setTag: (int)tag;
|
|
|
|
- (void) setTarget: (id)target;
|
|
|
|
- (void) setToolTip: (NSString *)toolTip;
|
|
|
|
- (void) setView: (NSView *)view;
|
|
|
|
|
2003-07-31 23:52:10 +00:00
|
|
|
@end /* interface of NSToolbarItem */
|
|
|
|
|
2004-05-23 18:22:45 +00:00
|
|
|
// Informal protocol for the toolbar validation
|
|
|
|
@interface NSObject (NSToolbarItemValidation)
|
|
|
|
- (BOOL) validateToolbarItem: (NSToolbarItem *)toolbarItem;
|
2003-07-31 23:52:10 +00:00
|
|
|
@end
|
|
|
|
|
2004-09-02 17:40:00 +00:00
|
|
|
// Extra private stuff
|
|
|
|
extern NSString *GSMovableToolbarItemPboardType;
|
|
|
|
|
2003-07-31 23:52:10 +00:00
|
|
|
#endif /* _GNUstep_H_NSToolbarItem */
|