2004-03-12 22:55:02 +00:00
|
|
|
/*
|
|
|
|
GSToolbar.h
|
|
|
|
|
|
|
|
The basic toolbar class.
|
|
|
|
|
|
|
|
Copyright (C) 2004 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
Author: Gregory John Casamento <greg_casamento@yahoo.com>,
|
|
|
|
Fabien Vallon <fabien.vallon@fr.alcove.com>,
|
|
|
|
Quentin Mathe <qmathe@club-internet.fr>
|
|
|
|
Date: February 2004
|
|
|
|
|
|
|
|
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,
|
|
|
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _GNUstep_H_GSToolbar
|
|
|
|
#define _GNUstep_H_GSToolbar
|
|
|
|
|
|
|
|
#include <Foundation/NSObject.h>
|
2004-03-12 23:15:16 +00:00
|
|
|
#include <Foundation/NSArray.h>
|
2004-03-23 22:57:03 +00:00
|
|
|
#include <AppKit/AppKitDefines.h>
|
2004-03-12 22:55:02 +00:00
|
|
|
|
|
|
|
@class NSString;
|
|
|
|
@class NSMutableArray;
|
|
|
|
@class NSDictionary;
|
|
|
|
@class NSMutableDictionary;
|
|
|
|
@class NSNotification;
|
|
|
|
@class NSToolbarItem;
|
|
|
|
@class GSToolbarView;
|
|
|
|
@class NSWindow;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Constants
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
NSToolbarDisplayModeDefault,
|
|
|
|
NSToolbarDisplayModeIconAndLabel,
|
|
|
|
NSToolbarDisplayModeIconOnly,
|
|
|
|
NSToolbarDisplayModeLabelOnly
|
|
|
|
} NSToolbarDisplayMode;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
NSToolbarSizeModeDefault,
|
|
|
|
NSToolbarSizeModeRegular,
|
|
|
|
NSToolbarSizeModeSmall,
|
|
|
|
} NSToolbarSizeMode;
|
|
|
|
|
|
|
|
APPKIT_EXPORT NSString *NSToolbarDidRemoveItemNotification;
|
|
|
|
APPKIT_EXPORT NSString *NSToolbarWillAddItemNotification;
|
|
|
|
|
|
|
|
@interface GSToolbar : NSObject
|
|
|
|
{
|
|
|
|
BOOL _allowsUserCustomization;
|
|
|
|
BOOL _autosavesConfiguration;
|
|
|
|
NSMutableDictionary *_configurationDictionary;
|
|
|
|
BOOL _customizationPaletteIsRunning;
|
|
|
|
id _delegate;
|
|
|
|
NSToolbarDisplayMode _displayMode;
|
|
|
|
NSToolbarSizeMode _sizeMode;
|
|
|
|
NSString *_identifier;
|
2004-05-23 18:22:45 +00:00
|
|
|
NSString *_selectedItemIdentifier;
|
2004-03-12 22:55:02 +00:00
|
|
|
NSMutableArray *_items;
|
|
|
|
GSToolbarView *_toolbarView;
|
|
|
|
BOOL _build;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Instance methods
|
|
|
|
- (id) initWithIdentifier: (NSString*)identifier;
|
|
|
|
- (id) initWithIdentifier: (NSString *)identifier
|
|
|
|
displayMode: (NSToolbarDisplayMode)displayMode
|
|
|
|
sizeMode: (NSToolbarSizeMode)sizeMode;
|
|
|
|
|
|
|
|
- (void) insertItemWithItemIdentifier: (NSString*)itemIdentifier atIndex: (int)index;
|
|
|
|
- (void) removeItemAtIndex: (int)index;
|
|
|
|
- (void) runCustomizationPalette: (id)sender;
|
2004-04-13 13:12:53 +00:00
|
|
|
- (void) validateVisibleItems;
|
2004-03-12 22:55:02 +00:00
|
|
|
|
|
|
|
// Accessors
|
|
|
|
- (BOOL) allowsUserCustomization;
|
|
|
|
- (BOOL) autosavesConfiguration;
|
|
|
|
- (NSDictionary*) configurationDictionary;
|
|
|
|
- (BOOL) customizationPaletteIsRunning;
|
|
|
|
- (id) delegate;
|
2004-04-13 13:12:53 +00:00
|
|
|
- (NSToolbarDisplayMode) displayMode;
|
2004-03-12 22:55:02 +00:00
|
|
|
- (NSString*) identifier;
|
|
|
|
- (NSArray*) items;
|
|
|
|
- (NSString *) selectedItemIdentifier;
|
|
|
|
- (NSArray*) visibleItems;
|
|
|
|
- (void) setAllowsUserCustomization: (BOOL)flag;
|
|
|
|
- (void) setAutosavesConfiguration: (BOOL)flag;
|
|
|
|
- (void) setConfigurationFromDictionary: (NSDictionary*)configDict;
|
|
|
|
- (void) setDelegate: (id)delegate;
|
|
|
|
- (void) setSelectedItemIdentifier: (NSString *) identifier;
|
2004-05-23 18:22:45 +00:00
|
|
|
- (void) setUsesStandardBackgroundColor: (BOOL)standard;
|
2004-04-13 13:12:53 +00:00
|
|
|
- (NSToolbarSizeMode) sizeMode;
|
2004-03-12 22:55:02 +00:00
|
|
|
|
2005-01-21 21:43 Alexander Malmberg <alexander@malmberg.org>
Various whitespace cleanups, comment type fixes, and changes
to avoid warnings from recent versions of gcc.
* Headers/Additions/GNUstepGUI/GSToolbar.h (-_toolbars): Declare.
* Source/NSWindow+Toolbar.m: Remove conflicting declaration of
[NSToolbar -_toolbars].
* Headers/Additions/GNUstepGUI/GSServicesManager.h,
Source/GSServicesMananger.m (-item2title:, -validateMenuItem:):
Adjust argument types.
* Headers/AppKit/NSMenu.h (-validateMenuItem:): Adjust argument
type.
* Source/NSTextView.m (-sizeToFit): Don't use size uninitialized
if neither resizable flags is set.
(-insertText:): Adjust argument type.
* Headers/AppKit/NSResponder.h, Source/NSResponder.m (-insertText:):
Adjust argument type. Document.
* Headers/AppKit/NSView.h: Change type of ivar _window to NSWindow *.
* Source/GSTitleView.m (-mouseDown:): Always initialize
startWindowOrigin.
* Source/NSApplication.m (-setApplicationIconImage:): Add casts
to avoid warnings.
* Source/NSCell.m (-cellSize): Add default: case.
* Source/NSPasteboard.m
([GSFiltered -pasteboard:provideDataForType:]): Detect and warn if we
can't find a filter that will get us the desired type.
* Source/NSProgressIndicator.m: Comment out unused variable 'images'.
* Source/NSBezierPath.m: Declare GSBezierPath fully before using it.
(-bezierPathByFlatteningPath, -bezierPathByReversingPath): Make sure
variables are always initialized.
* Source/NSMenuView.m,
* Source/NSPrintOperation.m,
* Source/NSSplitView.m,
* Source/NSTableHeaderView.m: Make sure variables are always
initialized.
* Source/NSBox.m,
* Source/NSImageview.m,
* Source/NSText.m,
* Source/NSTextStorage.m: Add missing includes.
* Source/GSKeyBindingTable.m,
* Source/GSLayoutManager.m,
* Source/NSBitmapImageRep+PNM.m,
* Source/NSBundleAdditions.m,
* Source/NSLayoutManager.m,
* Source/nsimage-tiff.h,
* Source/tiff.m,
* Headers/Additions/GNUstepGUI/GSDisplayServer.h,
* Source/GSDisplayServer.m: Change signedness of various variables.
* Source/NSPanel.m (-sendEvent:): Remove.
* Source/NSWindow.m (-becomesKeyOnlyIfNeeded): New method.
(-_sendEvent:becomesKeyOnlyIfNeeded:): Remove. Move code ...
(-sendEvent:): ... here. Use -becomesKeyOnlyIfNeeded instead
of the argument.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@20590 72102866-910b-0410-8b05-ffd578937521
2005-01-21 20:39:18 +00:00
|
|
|
|
|
|
|
// Private class method
|
|
|
|
|
|
|
|
+ (NSMutableArray *) _toolbars;
|
|
|
|
|
2004-03-12 22:55:02 +00:00
|
|
|
@end /* interface of NSToolbar */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Methods Implemented by the Delegate
|
|
|
|
*/
|
|
|
|
@interface NSObject (GSToolbarDelegate)
|
|
|
|
// notification methods
|
|
|
|
- (void) toolbarDidRemoveItem: (NSNotification*)aNotification;
|
|
|
|
- (void) toolbarWillAddItem: (NSNotification*)aNotification;
|
|
|
|
|
|
|
|
// delegate methods
|
|
|
|
// required method
|
|
|
|
- (NSToolbarItem*)toolbar: (GSToolbar*)toolbar
|
|
|
|
itemForItemIdentifier: (NSString*)itemIdentifier
|
|
|
|
willBeInsertedIntoToolbar: (BOOL)flag;
|
|
|
|
// required method
|
|
|
|
- (NSArray*) toolbarAllowedItemIdentifiers: (GSToolbar*)toolbar;
|
|
|
|
// required method
|
|
|
|
- (NSArray*) toolbarDefaultItemIdentifiers: (GSToolbar*)toolbar;
|
|
|
|
// optional method
|
|
|
|
- (NSArray *) toolbarSelectableItemIdentifiers: (GSToolbar *)toolbar;
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
// Extensions
|
|
|
|
|
|
|
|
@interface NSArray (ObjectsWithValueForKey)
|
2004-05-23 18:22:45 +00:00
|
|
|
- (NSArray *) objectsWithValue: (id)value forKey: (NSString *)key;
|
2004-03-12 22:55:02 +00:00
|
|
|
@end
|
|
|
|
|
|
|
|
#endif /* _GNUstep_H_NSToolbar */
|