Added Toolbar customization palette, not yet functional though. Modified NSToolbarItem and GSToolbar to display it

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/Toolbar@24315 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Quentin Mathe 2007-01-05 13:58:17 +00:00
parent 5025bb332c
commit 7d2b80c52d
10 changed files with 176 additions and 6 deletions

View file

@ -1,3 +1,19 @@
2007-01-05 Quentin Mathe <qmathe@club-internet.fr>
* Headers/Additions/GNUstepGUI/GSToolbarCustomizationPalette.h:
* Source/GSToolbarCustomizationPalette.m:
* Panels/English.lproj/GSToolbarCustomizationPalette.gorm:
Added.
* Source/GNUmakefile:
* Panels/GNUmakefile:
Updated to include the new files.
* Source/GSToolbar.m (-runCustomizationPalette:): Modified to use
GSToolbarCustomizationPalette and show the palette.
* Source/NSToolbarItem.m
(-[GSToolbarCustomizeToolbarItem initWithItemIdentifier:]): Temporary hack
to let NSWindow pass the customization request to the toolbar.
[Toolbar]
2007-01-04 Quentin Mathe <qmathe@club-internet.fr>
* Headers/Additions/GNUstepGUI/GSToolbar.h:

View file

@ -0,0 +1,54 @@
/*
GSToolbarCustomizationPalette.h
The palette which allows to customize toolbar
Copyright (C) 2007 Free Software Foundation, Inc.
Author: Quentin Mathe <qmathe@club-internet.fr>
Date: January 2007
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,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _GNUstep_H_GSToolbarCustomizationPalette
#define _GNUstep_H_GSToolbarCustomizationPalette
#include <Foundation/NSObject.h>
@class GSToolbar;
@interface GSToolbarCustomizationPalette : NSObject
{
id _customizationWindow;
id _customizationView;
id _defaultTemplateView;
id _sizeCheckBox;
id _displayPopup;
id _doneButton;
}
+ (GSToolbarCustomizationPalette *) paletteWithToolbar: (GSToolbar *)toolbar;
- (GSToolbarCustomizationPalette *) initWithToolbar: (GSToolbar *)toolbar;
- (void) show: (id)sender;
@end
#endif /* _GNUstep_H_GSToolbarCustomizationPalette */

View file

@ -0,0 +1,23 @@
{
"## Comment" = "Do NOT change this file, Gorm maintains it";
FirstResponder = {
Actions = (
"show:"
);
Super = NSObject;
};
GSToolbarCustomizationPalette = {
Actions = (
"show:"
);
Outlets = (
_customizationWindow,
_customizationView,
_defaultTemplateView,
_sizeCheckBox,
_displayPopup,
_doneButton
);
Super = NSObject;
};
}

View file

@ -38,7 +38,7 @@ LANGUAGES = English
# LOCALIZED_RESOURCE_FILES = SpellPanel.gmodel
LOCALIZED_RESOURCE_COMPONENTS = GSPrintPanel.gorm GSPageLayout.gorm \
GSDataLinkPanel.gorm GSSpellPanel.gorm
GSDataLinkPanel.gorm GSSpellPanel.gorm GSToolbarCustomizationPalette.gorm
-include GNUmakefile.preamble
-include GNUmakefile.local

View file

@ -201,6 +201,7 @@ GSToolTips.m \
NSArray_filtering.m \
GSToolbar_validation.m \
GSToolbar.m \
GSToolbarCustomizationPalette.m \
GSToolbarView.m \
GSStandardWindowDecorationView.m \
GSWindowDecorationView.m \

View file

@ -47,6 +47,7 @@
#include "AppKit/NSView.h"
#include "AppKit/NSWindow.h"
#include "AppKit/NSWindow+Toolbar.h"
#include "GNUstepGUI/GSToolbarCustomizationPalette.h"
#include "GNUstepGUI/GSToolbarView.h"
#include "GNUstepGUI/GSToolbar.h"
#include "GSToolbar_validation.h"
@ -275,13 +276,19 @@ static NSMutableArray *toolbars;
- (void) runCustomizationPalette: (id)sender
{
_customizationPaletteIsRunning =
[NSBundle loadNibNamed: @"GSToolbarCustomizationPalette" owner: self];
GSToolbarCustomizationPalette *palette = [GSToolbarCustomizationPalette
paletteWithToolbar: self];
if (!_customizationPaletteIsRunning)
if (_customizationPaletteIsRunning)
{
NSLog(@"Failed to load gorm for GSToolbarCustomizationPalette");
NSLog("Customization palette is already running for toolbar: %@", self);
return;
}
if (palette != nil)
_customizationPaletteIsRunning = YES;
[palette show: self];
}
- (void) validateVisibleItems

View file

@ -0,0 +1,67 @@
/*
GSToolbarCustomizationPalette.m
The palette which allows to customize toolbar
Copyright (C) 2007 Free Software Foundation, Inc.
Author: Quentin Mathe <qmathe@club-internet.fr>
Date: January 2007
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,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "AppKit/NSNibLoading.h"
#include "AppKit/NSWindow.h"
#include "GNUstepGUI/GSToolbar.h"
#include "GNUstepGUI/GSToolbarCustomizationPalette.h"
@implementation GSToolbarCustomizationPalette
+ (GSToolbarCustomizationPalette *) paletteWithToolbar: (GSToolbar *)toolbar
{
return AUTORELEASE([[GSToolbarCustomizationPalette alloc]
initWithToolbar: toolbar]);
}
- (GSToolbarCustomizationPalette *) initWithToolbar: (GSToolbar *)toolbar
{
self = [super init];
if (self != nil)
{
BOOL nibLoaded = [NSBundle loadNibNamed: @"GSToolbarCustomizationPalette"
owner: self];
if (nibLoaded == NO)
{
NSLog(@"Failed to load gorm for GSToolbarCustomizationPalette");
return nil;
}
}
return self;
}
- (void) show: (id)sender
{
[_customizationWindow makeKeyAndOrderFront: self];
}
@end

View file

@ -991,7 +991,9 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
// Set action...
[self setTarget: nil]; // Goes to first responder..
[self setAction: @selector(runCustomizationPalette:)];
// FIXME: -runCustomizationPalette: would be lost since the toolbar is not
// part of the responder chain.
[self setAction: @selector(runToolbarCustomizationPalette:)];
return self;
}