Small clean up of toolbar code.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27443 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2008-12-28 15:16:05 +00:00
parent 0aec53d988
commit 6c0a0ef0cb
7 changed files with 296 additions and 305 deletions

View file

@ -1,3 +1,13 @@
2008-12-28 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSWindow.m: Remove left over traces of toolbar handling.
* Headers/AppKit/NSWindow+Toolbar.h: Move some private methods
from here ...
* Source/NSWindow+Toolbar.m: ... to here.
* Source/NSToolbarItem.m,
* Source/GSToolbar.m,
* Source/NSToolbar.m: White space clean up.
2008-12-28 Riccardo Mottola <rmottola@users.sf.net>
* Source/NSClipView.m: removed C99-ism

View file

@ -37,9 +37,7 @@
@interface NSWindow (Toolbar)
- (void) runToolbarCustomizationPalette: (id)sender;
- (void) toggleToolbarShown: (id)sender;
- (NSView *) contentViewWithoutToolbar;
- (NSToolbar *) toolbar;
- (void) setContentViewWithoutToolbar: (NSView *)contentViewWithoutToolbar;
- (void) setToolbar: (NSToolbar*)toolbar;
@end

View file

@ -56,12 +56,12 @@
static NSNotificationCenter *nc = nil;
static const int current_version = 1;
static NSMutableArray *toolbars;
static NSMutableArray *toolbars = nil;
// Validation stuff
static const unsigned int ValidationInterval = 4;
@class GSValidationCenter; // Mandatory because the interface is declared later
static GSValidationCenter *vc;
static GSValidationCenter *vc = nil;
// Extensions
@implementation NSArray (ObjectsWithValueForKey)

View file

@ -1546,4 +1546,3 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
}
@end

View file

@ -51,6 +51,8 @@
@interface NSWindow (ToolbarPrivate)
- (void) _adjustToolbarView;
- (void) _toggleToolbarViewWithDisplay: (BOOL)flag;
- (NSView *) contentViewWithoutToolbar;
- (void) setContentViewWithoutToolbar: (NSView *)contentViewWithoutToolbar;
@end
@implementation NSWindow (Toolbar)
@ -66,9 +68,9 @@
BOOL isVisible = [toolbar isVisible];
GSToolbarView *toolbarView = [toolbar _toolbarView];
if ([sender isEqual: toolbar])
// We can enter this branch when the toolbar class has called
// toggleToolbarShown:
if ([sender isEqual: toolbar])
{
if (!isVisible) // In the case : not visible when the method has been called
{
@ -87,7 +89,6 @@
// We call the toolbar class letting it call back on toggleToolbarShown:
[toolbar setVisible: !isVisible];
}
}
// Accessors
@ -107,7 +108,8 @@
int i, n = [subviews count];
GSToolbarView *toolbarView = [toolbar _toolbarView];
if (n > 2 || ![[toolbarView superview] isEqual: _contentView]) {
if (n > 2 || ![[toolbarView superview] isEqual: _contentView])
{
[NSException raise: @"_contentView error"
format: @"_contenView is not valid. _contentView needs a \
toolbar view and a contentViewWithoutToolbar, with \
@ -160,7 +162,6 @@
}
}
- (void) setToolbar: (NSToolbar*)toolbar
{
NSToolbar *lastToolbar = [self toolbar];
@ -200,7 +201,8 @@
if (toolbarView == nil)
{
toolbarView = [[GSToolbarView alloc] initWithFrame: NSMakeRect(0, 0,
toolbarView = [[GSToolbarView alloc] initWithFrame:
NSMakeRect(0, 0,
[NSWindow contentRectForFrameRect: [self frame]
styleMask: [self styleMask]].size.width, 100)];
// _toggleToolbarView:display: method will set the toolbar view to the right

View file

@ -72,21 +72,17 @@
#include "AppKit/NSScreen.h"
#include "AppKit/NSTextField.h"
#include "AppKit/NSTextFieldCell.h"
#include "AppKit/NSToolbar.h"
#include "AppKit/NSView.h"
#include "AppKit/NSWindow.h"
#include "AppKit/NSWindowController.h"
#include "AppKit/PSOperators.h"
#include "GNUstepGUI/GSTrackingRect.h"
#include "GNUstepGUI/GSDisplayServer.h"
#include "GNUstepGUI/GSToolbarView.h"
#include "GSToolTips.h"
static GSToolTips *toolTipVisible = nil;
#include "GSWindowDecorationView.h"
static id<GSWindowDecorator> windowDecorator;
static GSToolTips *toolTipVisible = nil;
static id<GSWindowDecorator> windowDecorator = nil;
BOOL GSViewAcceptsDrag(NSView *v, id<NSDraggingInfo> dragInfo);
@ -111,19 +107,6 @@ BOOL GSViewAcceptsDrag(NSView *v, id<NSDraggingInfo> dragInfo);
- (id) _initWithScreenNumber: (int)screen;
@end
/*
* FIXME: Not sure if I should be exposing this here, but it seems to be the only way
* to fix the window frame save issue when a toolbar is present.
*/
@interface NSWindow (ToolbarPrivate)
- (id) toolbar;
- (NSView *)contentViewWithoutToolbar;
@end
@interface NSToolbar (GNUstepPrivate)
- (GSToolbarView *) _toolbarView;
@end
// FIXME: END (GJC)
/*
* Category for internal methods (for use only within the NSWindow class itself
@ -138,7 +121,6 @@ BOOL GSViewAcceptsDrag(NSView *v, id<NSDraggingInfo> dragInfo);
- (void) _lossOfKeyOrMainWindow;
- (NSView *) _windowView;
// Method used to support validation in the toolbar implementation
@end
@implementation NSWindow (GNUstepPrivate)