* Headers/Additions/GNUstepGUI/GSTheme.h: Add category to allow

overriding of classes used for save/open panels.
	* Source/GNUmakefile: Build new category.
	* Source/GSThemeOpenSavePanels.m: Implementation of methods
	-savePanelClass and -openPanelClass.
	* Source/NSOpenPanel.m: Modifications to use class from current 
	theme.
	* Source/NSSavePanel.m: Modifications to use class from current 
	theme.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29791 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2010-02-28 04:31:54 +00:00
parent 694c273aee
commit cc37831c44
6 changed files with 80 additions and 4 deletions

View file

@ -1,3 +1,15 @@
2010-02-27 23:32-EST Gregory John Casamento <greg.casamento@gmail.com>
* Headers/Additions/GNUstepGUI/GSTheme.h: Add category to allow
overriding of classes used for save/open panels.
* Source/GNUmakefile: Build new category.
* Source/GSThemeOpenSavePanels.m: Implementation of methods
-savePanelClass and -openPanelClass.
* Source/NSOpenPanel.m: Modifications to use class from current
theme.
* Source/NSSavePanel.m: Modifications to use class from current
theme.
2010-02-26 Wolfgang Lux <wolfgang.lux@gmail.com>
* Tools/GSspell.m (-createBundleAtPath:languages:,

View file

@ -1064,9 +1064,16 @@ withRepeatedImage: (NSImage*)image
@interface GSTheme (OpenSavePanels)
/**
* This method displays and returns the open panel needed by the
* This method returns the open panel class needed by the
* native environment.
*/
- (Class) openPanelClass;
/**
* This method returns the open panel class needed by the
* native environment.
*/
- (Class) savePanelClass;
@end
#endif /* OS_API_VERSION */

View file

@ -204,6 +204,7 @@ GSTheme.m \
GSThemeDrawing.m \
GSThemeInspector.m \
GSThemeMenu.m \
GSThemeOpenSavePanels.m \
GSThemePanel.m \
GSThemeTools.m \
GSDragView.m \

View file

@ -0,0 +1,51 @@
/** <title>GSThemeOpenSavePanels</title>
<abstract>Methods for themes using open and save panels.</abstract>
Copyright (C) 2008 Free Software Foundation, Inc.
Author: Gregory Casamento <greg.casamento@gmail.com>
Date: 2010
This file is part of the GNU Objective C User interface 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.
*/
#include "AppKit/NSOpenPanel.h"
#include "AppKit/NSSavePanel.h"
#include "GNUstepGUI/GSTheme.h"
@implementation GSTheme (OpenSavePanels)
/**
* This method returns the open panel class needed by the
* native environment.
*/
- (Class) openPanelClass
{
return [NSOpenPanel class];
}
/**
* This method returns the open panel class needed by the
* native environment.
*/
- (Class) savePanelClass
{
return [NSSavePanel class];
}
@end

View file

@ -53,6 +53,7 @@
#import "AppKit/NSOpenPanel.h"
#include "GSGuiPrivate.h"
#include "GNUstepGUI/GSTheme.h"
static NSString *
pathToColumn(NSBrowser *browser, int column)
@ -262,8 +263,10 @@ static NSOpenPanel *_gs_gui_open_panel = nil;
+ (NSOpenPanel *) openPanel
{
if (!_gs_gui_open_panel)
_gs_gui_open_panel = [[NSOpenPanel alloc] init];
{
Class openPanelClass = [[GSTheme theme] openPanelClass];
_gs_gui_open_panel = [[openPanelClass alloc] init];
}
[_gs_gui_open_panel _resetDefaults];
return _gs_gui_open_panel;

View file

@ -57,6 +57,7 @@
#import "AppKit/NSWorkspace.h"
#include "GSGuiPrivate.h"
#include "GNUstepGUI/GSTheme.h"
#define _SAVE_PANEL_X_PAD 5
#define _SAVE_PANEL_Y_PAD 4
@ -671,7 +672,8 @@ selectCellWithString: (NSString*)title
{
if (_gs_gui_save_panel == nil)
{
_gs_gui_save_panel = [[NSSavePanel alloc] init];
Class savePanelClass = [[GSTheme theme] savePanelClass];
_gs_gui_save_panel = [[savePanelClass alloc] init];
}
[_gs_gui_save_panel _resetDefaults];