Merge GSToolbar with NSToolbar and remove all traces of the old class.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27491 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2009-01-01 22:04:38 +00:00
parent 46af2db2df
commit f66a0decc7
11 changed files with 1242 additions and 1405 deletions

View file

@ -1,3 +1,16 @@
2009-01-01 Fred Kiefer <FredKiefer@gmx.de>
* Headers/Additions/GNUstepGUI/GSToolbar.h,
* Source/GSToolbar.m: Remove.
* Source/GNUmakefile: Remove these files.
* Headers/AppKit/NSToolbar.h,
* Source/NSToolbar.m: Add code from GSToolbar plus some 10.4 methods.
* Headers/Additions/GNUstepGUI/GSToolbarView.h,
* Headers/AppKit/NSToolbarItem.h,
* Source/GSToolbarView.m,
* Source/NSWindow+Toolbar.m,
* Source/NSToolbarItem.m: Change GSToolbar into NSToolbar.
2009-01-01 Fred Kiefer <FredKiefer@gmx.de>
* Headers/Additions/GNUstepGUI/GSToolbar.h,

View file

@ -1,135 +0,0 @@
/*
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 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.
*/
#ifndef _GNUstep_H_GSToolbar
#define _GNUstep_H_GSToolbar
#include <Foundation/NSObject.h>
#include <Foundation/NSArray.h>
#include <AppKit/AppKitDefines.h>
@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;
NSString *_selectedItemIdentifier;
NSMutableArray *_items;
GSToolbarView *_toolbarView;
BOOL _build;
}
// Instance methods
- (id) initWithIdentifier: (NSString*)identifier;
- (void) insertItemWithItemIdentifier: (NSString*)itemIdentifier atIndex: (int)index;
- (void) removeItemAtIndex: (int)index;
- (void) runCustomizationPalette: (id)sender;
- (void) validateVisibleItems;
// Accessors
- (BOOL) allowsUserCustomization;
- (BOOL) autosavesConfiguration;
- (NSDictionary*) configurationDictionary;
- (BOOL) customizationPaletteIsRunning;
- (id) delegate;
- (NSToolbarDisplayMode) displayMode;
- (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;
- (void) setUsesStandardBackgroundColor: (BOOL)standard;
- (NSToolbarSizeMode) sizeMode;
@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
#endif /* _GNUstep_H_NSToolbar */

View file

@ -33,11 +33,11 @@
#define _GSToolbarView_h_INCLUDE
#include <Foundation/NSGeometry.h>
// Necessary for NSToolbarDisplayMode and NSToolbarSizeMode
#include <AppKit/NSToolbar.h>
#include <AppKit/NSView.h>
#include <AppKit/NSColor.h>
#include "GNUstepGUI/GSToolbar.h"
// Necessary for NSToolbarDisplayMode and NSToolbarSizeMode
@class NSMutableArray;
@class NSClipView;
@ -54,7 +54,7 @@ typedef enum {
@interface GSToolbarView : NSView
{
GSToolbar *_toolbar;
NSToolbar *_toolbar;
NSClipView *_clipView, *_clipViewForEditMode;
GSToolbarClippedItemsButton *_clippedItemsMark;
NSMutableArray *_visibleBackViews;
@ -72,8 +72,8 @@ typedef enum {
sizeMode: (NSToolbarSizeMode)sizeMode;
// Accessors
- (GSToolbar *) toolbar;
- (void) setToolbar: (GSToolbar *)toolbar;
- (NSToolbar *) toolbar;
- (void) setToolbar: (NSToolbar *)toolbar;
- (unsigned int) borderMask;
- (void) setBorderMask: (unsigned int)borderMask;

View file

@ -3,12 +3,14 @@
The toolbar class.
Copyright (C) 2002 Free Software Foundation, Inc.
Copyright (C) 2002, 2004, 2009 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: May 2002
Date: May 2002, February 2004
Author: Fred Kiefer <fredkiefer@gmx.de>
Date: January 2009
This file is part of the GNUstep GUI Library.
@ -32,19 +34,103 @@
#ifndef _GNUstep_H_NSToolbar
#define _GNUstep_H_NSToolbar
#include "GNUstepGUI/GSToolbar.h"
#include <Foundation/NSObject.h>
#include <Foundation/NSArray.h>
#include <AppKit/AppKitDefines.h>
@interface NSToolbar : GSToolbar
@class NSString;
@class NSMutableArray;
@class NSDictionary;
@class NSMutableDictionary;
@class NSNotification;
@class NSToolbarItem;
@class GSToolbarView;
@class NSWindow;
/*
* Constants
*/
typedef enum
{
NSToolbarDisplayModeDefault,
NSToolbarDisplayModeIconAndLabel,
NSToolbarDisplayModeIconOnly,
NSToolbarDisplayModeLabelOnly
} NSToolbarDisplayMode;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_2, GS_API_LATEST)
typedef enum
{
NSToolbarSizeModeDefault,
NSToolbarSizeModeRegular,
NSToolbarSizeModeSmall,
} NSToolbarSizeMode;
#endif
APPKIT_EXPORT NSString *NSToolbarDidRemoveItemNotification;
APPKIT_EXPORT NSString *NSToolbarWillAddItemNotification;
@interface NSToolbar : NSObject
{
NSMutableDictionary *_configurationDictionary;
id _delegate;
NSString *_identifier;
NSString *_selectedItemIdentifier;
NSMutableArray *_items;
GSToolbarView *_toolbarView;
NSToolbarDisplayMode _displayMode;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_2, GS_API_LATEST)
NSToolbarSizeMode _sizeMode;
#else
int _sizeMode;
#endif
BOOL _allowsUserCustomization;
BOOL _autosavesConfiguration;
BOOL _visible;
BOOL _customizationPaletteIsRunning;
BOOL _showsBaselineSeparator;
BOOL _build;
}
// Accessors
// Instance methods
- (id) initWithIdentifier: (NSString*)identifier;
- (void) insertItemWithItemIdentifier: (NSString*)itemIdentifier
atIndex: (NSInteger)index;
- (void) removeItemAtIndex: (NSInteger)index;
- (void) runCustomizationPalette: (id)sender;
- (void) validateVisibleItems;
// Accessors
- (BOOL) allowsUserCustomization;
- (BOOL) autosavesConfiguration;
- (NSDictionary*) configurationDictionary;
- (BOOL) customizationPaletteIsRunning;
- (id) delegate;
- (NSToolbarDisplayMode) displayMode;
- (NSString*) identifier;
- (NSArray*) items;
- (NSArray*) visibleItems;
- (BOOL) isVisible;
- (void) setAllowsUserCustomization: (BOOL)flag;
- (void) setAutosavesConfiguration: (BOOL)flag;
- (void) setConfigurationFromDictionary: (NSDictionary*)configDict;
- (void) setDelegate: (id)delegate;
- (void) setDisplayMode: (NSToolbarDisplayMode)displayMode;
- (void) setSizeMode: (NSToolbarSizeMode)sizeMode;
- (void) setVisible: (BOOL)shown;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_2, GS_API_LATEST)
- (NSToolbarSizeMode) sizeMode;
- (void) setSizeMode: (NSToolbarSizeMode)sizeMode;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
- (NSString *) selectedItemIdentifier;
- (void) setSelectedItemIdentifier: (NSString *) identifier;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
- (BOOL) showsBaselineSeparator;
- (void) setShowsBaselineSeparator: (BOOL)flag;
#endif
@end /* interface of NSToolbar */
@ -52,6 +138,9 @@
* Methods Implemented by the Delegate
*/
@interface NSObject (NSToolbarDelegate)
// notification methods
- (void) toolbarDidRemoveItem: (NSNotification*)aNotification;
- (void) toolbarWillAddItem: (NSNotification*)aNotification;
// delegate methods
// required method

View file

@ -44,7 +44,7 @@
@class NSImage;
@class NSMenuItem;
@class NSView;
@class GSToolbar;
@class NSToolbar;
/*
* Constants
@ -81,7 +81,7 @@ enum _NSToolbarItemVisibilityPriority {
NSInteger _visibilityPriority;
// toolbar
GSToolbar *_toolbar;
NSToolbar *_toolbar;
NSView *_backView;
BOOL _modified;
BOOL _selectable;
@ -129,7 +129,7 @@ enum _NSToolbarItemVisibilityPriority {
- (NSInteger) tag;
- (id) target;
- (NSString *) toolTip;
- (GSToolbar *) toolbar;
- (NSToolbar *) toolbar;
- (NSView *) view;
- (void) setAction: (SEL)action;
- (void) setEnabled: (BOOL)enabled;

View file

@ -219,7 +219,6 @@ GSGormLoading.m \
GSNibLoading.m \
GSTitleView.m \
GSToolTips.m \
GSToolbar.m \
GSToolbarView.m \
GSStandardWindowDecorationView.m \
GSWindowDecorationView.m \
@ -423,7 +422,6 @@ GSLayoutManager.h \
GSLayoutManager_internal.h \
GSTypesetter.h \
GSHorizontalTypesetter.h \
GSToolbar.h \
GSToolbarView.h \
GSNibLoading.h \
GSDragView.h \

File diff suppressed because it is too large Load diff

View file

@ -44,10 +44,10 @@
#include "AppKit/NSImage.h"
#include "AppKit/NSMenu.h"
#include "AppKit/NSPasteboard.h"
#include "AppKit/NSToolbarItem.h" // It contains GSMovableToolbarItemPboardType declaration
// It contains GSMovableToolbarItemPboardType declaration
#include "AppKit/NSToolbarItem.h"
#include "AppKit/NSView.h"
#include "AppKit/NSWindow.h"
#include "GNUstepGUI/GSToolbar.h"
#include "GNUstepGUI/GSToolbarView.h"
typedef enum {
@ -141,7 +141,7 @@ static void initSystemExtensionsColors(void)
/*
* Toolbar related code
*/
@interface GSToolbar (GNUstepPrivate)
@interface NSToolbar (GNUstepPrivate)
- (void) _build;
- (void) _concludeRemoveItem: (NSToolbarItem *)item atIndex: (int)index broadcast: (BOOL)broadcast;
@ -192,7 +192,7 @@ static void initSystemExtensionsColors(void)
@interface GSToolbarClippedItemsButton : NSButton
{
GSToolbar *_toolbar;
NSToolbar *_toolbar;
}
- (id) init;
@ -203,7 +203,7 @@ static void initSystemExtensionsColors(void)
method with the same name. */
- (void) layout;
- (void) setToolbar: (GSToolbar *)toolbar;
- (void) setToolbar: (NSToolbar *)toolbar;
@end
@interface GSToolbarClipView : NSClipView
@ -306,7 +306,7 @@ static void initSystemExtensionsColors(void)
// Accessors
- (void) setToolbar: (GSToolbar *)toolbar
- (void) setToolbar: (NSToolbar *)toolbar
{
// Don't do an ASSIGN here, the toolbar view retains us.
_toolbar = toolbar;
@ -431,7 +431,7 @@ static void initSystemExtensionsColors(void)
- (NSDragOperation) draggingEntered: (id <NSDraggingInfo>)info
{
GSToolbar *toolbar = [self toolbar];
NSToolbar *toolbar = [self toolbar];
NSArray *allowedItemIdentifiers =
[[toolbar delegate] toolbarAllowedItemIdentifiers: toolbar];
NSString *itemIdentifier =
@ -448,7 +448,7 @@ static void initSystemExtensionsColors(void)
- (NSDragOperation) draggingUpdated: (id <NSDraggingInfo>)info
{
GSToolbar *toolbar = [self toolbar];
NSToolbar *toolbar = [self toolbar];
NSArray *allowedItemIdentifiers =
[[toolbar delegate] toolbarAllowedItemIdentifiers: toolbar];
NSString *itemIdentifier =
@ -468,7 +468,7 @@ static void initSystemExtensionsColors(void)
NSPasteboard *pboard = [info draggingPasteboard];
NSString *str = [pboard stringForType: [[pboard types] objectAtIndex: 0]];
int index = [str intValue];
GSToolbar *toolbar = [self toolbar];
NSToolbar *toolbar = [self toolbar];
[toolbar _concludeRemoveItem:
[[info draggingSource] toolbarItem] atIndex: index broadcast: YES];
@ -489,7 +489,7 @@ static void initSystemExtensionsColors(void)
NSPasteboard *pboard = [info draggingPasteboard];
NSString *str = [pboard stringForType: [[pboard types] objectAtIndex: 0]];
int index = [str intValue];
GSToolbar *toolbar = [self toolbar];
NSToolbar *toolbar = [self toolbar];
NSToolbarItem *item = [[info draggingSource] toolbarItem];
int newIndex = [self _insertionIndexAtPoint: [info draggingLocation]];
// Calculate the index
@ -598,7 +598,7 @@ static void initSystemExtensionsColors(void)
return _borderMask;
}
- (GSToolbar *) toolbar
- (NSToolbar *) toolbar
{
return _toolbar;
}
@ -656,7 +656,7 @@ static void initSystemExtensionsColors(void)
[_clipView setFrame: rect];
}
- (void) setToolbar: (GSToolbar *)toolbar
- (void) setToolbar: (NSToolbar *)toolbar
{
if ([toolbar sizeMode] != _sizeMode)
; // FIXME: Raise exception here

File diff suppressed because it is too large Load diff

View file

@ -45,8 +45,8 @@
#include "AppKit/NSMenuItem.h"
#include "AppKit/NSParagraphStyle.h"
#include "AppKit/NSPasteboard.h"
#include "AppKit/NSToolbar.h"
#include "AppKit/NSView.h"
#include "GNUstepGUI/GSToolbar.h"
#include "GNUstepGUI/GSToolbarView.h"
#include "AppKit/NSToolbarItem.h"
@ -89,7 +89,7 @@ static NSFont *SmallFont = nil;
NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
@interface GSToolbar (GNUstepPrivate)
@interface NSToolbar (GNUstepPrivate)
- (GSToolbarView *) _toolbarView;
- (int) _indexOfItem: (NSToolbarItem *)item; // Used by drag setup
@ -105,11 +105,10 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
- (BOOL) _isFlexibleSpace;
- (BOOL) _isModified;
- (BOOL) _selectable;
- (GSToolbar *) _toolbar;
- (void) _setSelectable: (BOOL)selectable;
- (BOOL) _selected;
- (void) _setSelected: (BOOL)selected;
- (void) _setToolbar: (GSToolbar *)toolbar;
- (void) _setToolbar: (NSToolbar *)toolbar;
@end
@interface GSToolbarView (GNUstepPrivate)
@ -278,7 +277,7 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
- (void) mouseDown: (NSEvent *)event
{
GSToolbar *toolbar = [_toolbarItem toolbar];
NSToolbar *toolbar = [_toolbarItem toolbar];
if ([event modifierFlags] == NSCommandKeyMask
&& [toolbar allowsUserCustomization])
@ -331,7 +330,7 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
- (void) draggedImage: (NSImage *)dragImage beganAt: (NSPoint)location
{
GSToolbar *toolbar = [_toolbarItem toolbar];
NSToolbar *toolbar = [_toolbarItem toolbar];
// FIXME: Where is this released?
RETAIN(_toolbarItem);
@ -733,7 +732,7 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
- (void) mouseDown: (NSEvent *)event
{
GSToolbar *toolbar = [_toolbarItem toolbar];
NSToolbar *toolbar = [_toolbarItem toolbar];
if ([event modifierFlags] == NSCommandKeyMask
&& [toolbar allowsUserCustomization])
@ -783,7 +782,7 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
- (void) draggedImage: (NSImage *)dragImage beganAt: (NSPoint)location
{
GSToolbar *toolbar = [_toolbarItem toolbar];
NSToolbar *toolbar = [_toolbarItem toolbar];
RETAIN(_toolbarItem);
/* We retain the toolbar item to be able to have have it reinsered later by
@ -1366,7 +1365,7 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
return _toolTip;
}
- (GSToolbar *) toolbar
- (NSToolbar *) toolbar
{
return _toolbar;
}
@ -1447,11 +1446,6 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
return [(GSToolbarButton *)_backView state];
}
- (GSToolbar *) _toolbar
{
return _toolbar;
}
- (void) _setSelected: (BOOL)selected
{
if (_selectable)
@ -1478,7 +1472,7 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
}
}
- (void) _setToolbar: (GSToolbar *)toolbar
- (void) _setToolbar: (NSToolbar *)toolbar
{
// Don't do an ASSIGN here, the toolbar itself retains us.
_toolbar = toolbar;

View file

@ -34,7 +34,7 @@
#include "AppKit/NSToolbar.h"
#include "GNUstepGUI/GSToolbarView.h"
@interface GSToolbar (GNUstepPrivate)
@interface NSToolbar (GNUstepPrivate)
- (GSToolbarView *) _toolbarView;
@end