mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 19:01:15 +00:00
synchronise with trunk
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/themes@24269 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3b84c6bed7
commit
63244128c1
36 changed files with 1408 additions and 273 deletions
65
ChangeLog
65
ChangeLog
|
@ -1,15 +1,66 @@
|
|||
2006-12-27 Richard Frith-Macdoanld <rfm@gnu.org>
|
||||
|
||||
Synchronize with trunk at revision 24268
|
||||
|
||||
2006-12-27 Richard Frith-Macdoanld <rfm@gnu.org>
|
||||
|
||||
* Headers/Additions/GNUstepGUI/GSTheme.h: Store images in dictionary.
|
||||
* Source/GSTheme.m: Improve handling of named images.
|
||||
* Source/NSButtonImageSource.[hm]: Partial implementation of classes
|
||||
to handle standard images in buttons (support theming etc).
|
||||
|
||||
2006-12-21 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Headers/AppKit/NSWindow.h
|
||||
Added missing delegate methods.
|
||||
* Source/NSResponder.m (-undoManager):
|
||||
Forward method to next responder.
|
||||
* Source/NSWindow.m (-undoManager):
|
||||
Try to get an undo manager from delegate or document.
|
||||
* Source/NSTextView.m
|
||||
(-shouldChangeTextInRange:replacementString:): Added basic support
|
||||
for undo.
|
||||
|
||||
2006-12-19 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Headers/AppKit/NSObjectController.h
|
||||
* Headers/AppKit/NSUserDefaultsController.h
|
||||
* Headers/AppKit/NSKeyValueBinding.h
|
||||
* Headers/AppKit/NSArrayController.h
|
||||
* Headers/AppKit/NSController.h
|
||||
* Source/NSObjectController.m
|
||||
* Source/NSUserDefaultsController.m
|
||||
* Source/NSArrayController.m
|
||||
* Source/NSController.m:
|
||||
New files added as basic support for controllers.
|
||||
Mostly not implemented.
|
||||
* Source/GNUmakefile
|
||||
* Source/externs.m:
|
||||
Add these new classes and helper variables.
|
||||
|
||||
2006-12-18 Saso Kiselkov
|
||||
|
||||
* Source/NSAlert.m: Left align long alert messages.
|
||||
|
||||
2006-12-11 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Documentation/manual/: File and node name fixes.
|
||||
|
||||
2006-12-09 Mark Tracy <tracy454@concentric.net>
|
||||
|
||||
* Source/NSBitmapImageRep.m: Autogsdoc comments
|
||||
|
||||
2006-12-08 Richard Frith-Macdoanld <rfm@gnu.org>
|
||||
|
||||
* Merge changes from gui up to revision 24192
|
||||
* Source/GSTheme.m: improve system image overriding
|
||||
* Source/NSButtonImageSource.h:
|
||||
* Source/NSButtonImageSource.m:
|
||||
|
||||
* Source/NSInputManager.m:
|
||||
Use help function key to enter context help mode rather than
|
||||
inserting it into the text.
|
||||
|
||||
2006-12-06 Matt Rice <ratmice@gmail.com>
|
||||
|
||||
* Source/NSTextView.m: Don't update the selection when dragging a
|
||||
* Source/NSTextView.m: Don't update the selection when dragging a
|
||||
NSColorPboardType.
|
||||
|
||||
|
||||
2006-12-03 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Documentation/manual/: New AppKit manual.
|
||||
|
|
|
@ -46,7 +46,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
@end copying
|
||||
|
||||
@ifnottex
|
||||
@node Top
|
||||
@node Top, Introduction, (dir), (dir)
|
||||
@top Using the GNUstep AppKit
|
||||
|
||||
@ifnothtml
|
||||
|
@ -72,31 +72,25 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
@end ifhtml
|
||||
|
||||
@menu
|
||||
@b{Contents}
|
||||
|
||||
* Introduction: introduction.
|
||||
* Basic Concepts: basicconcepts.
|
||||
* GNUstep Applications: gnustepapplications.
|
||||
* Application Makefiles: applicationmakefiles.
|
||||
* Interface Files: interfacefiles
|
||||
* Basic Controls: controls.
|
||||
* The View Concept: theviewconcept
|
||||
* Event Handling: eventhandling
|
||||
* Tableviews: tableview
|
||||
* Outline Views: outlineviews
|
||||
* Matrix Controls: matrix
|
||||
* Browser Controls: browsercontrols
|
||||
* Data Exchange: dataexchange
|
||||
* Images and ImageViews: images
|
||||
|
||||
@b{Appendices}
|
||||
* License: fdl
|
||||
|
||||
@b{Concept Index}
|
||||
* Concept Index: conceptindex.
|
||||
* Introduction::
|
||||
* basicconcepts::
|
||||
* gnustepapplications::
|
||||
* applicationmakefiles::
|
||||
* interfacefiles::
|
||||
* controls::
|
||||
* theviewconcept::
|
||||
* eventhandling::
|
||||
* tableview::
|
||||
* outlineviews::
|
||||
* matrix::
|
||||
* browsercontrols::
|
||||
* dataexchange::
|
||||
* images::
|
||||
* fdl::
|
||||
* conceptindex::
|
||||
@end menu
|
||||
@end ifnottex
|
||||
|
||||
@end ifnottex
|
||||
@iftex
|
||||
@titlepage
|
||||
@title Using the GNUstep AppKit
|
||||
|
@ -112,7 +106,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
@c %** @include helloworld.texi
|
||||
|
||||
@c // Chapters
|
||||
@include introduction.texi
|
||||
@include intro.texi
|
||||
@include basicconcepts.texi
|
||||
@include gnustepapplication.texi
|
||||
@c //@include afirstapplication.texi
|
||||
|
@ -135,7 +129,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
@include fdl.texi
|
||||
|
||||
@c Indexes
|
||||
@node conceptindex
|
||||
@node conceptindex, , Top, Top
|
||||
@unnumbered Concept Index
|
||||
@printindex cp
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ eventhandling.texi \
|
|||
fdl.texi \
|
||||
gnustepapplication.texi \
|
||||
interfacefiles.texi \
|
||||
introduction.texi \
|
||||
intro.texi \
|
||||
matrix.texi \
|
||||
quickreference.texi \
|
||||
tableviews.texi \
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
@c GOODS AND SERVICES; OR BUSINESS INTERUPTION) HOWEVER CAUSED, EVEN
|
||||
@c IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
@node applicationmakefiles
|
||||
@node applicationmakefiles, interfacefiles, gnustepapplications, Top
|
||||
@chapter Application Makefiles
|
||||
@anchor{Application Makefiles}
|
||||
@cindex makefiles
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
@c
|
||||
@c * Thanks to Damien Pollet for some minor spelling and grammatical fixups.
|
||||
|
||||
@node basicconcepts
|
||||
@node basicconcepts, gnustepapplications, Introduction, Top
|
||||
@chapter Basic Concepts
|
||||
|
||||
Throughout this manual, we refer to a number of concepts that you will need to be familiar with. It may be useful to at least glance over this section and make sure you are familiar with the concepts presented.
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
@c GOODS AND SERVICES; OR BUSINESS INTERUPTION) HOWEVER CAUSED, EVEN
|
||||
@c IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
@node browsercontrols
|
||||
@node browsercontrols, dataexchange, matrix, Top
|
||||
@chapter Browsers
|
||||
@anchor{Browsers}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
@c GOODS AND SERVICES; OR BUSINESS INTERUPTION) HOWEVER CAUSED, EVEN
|
||||
@c IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
@node controls
|
||||
@node controls, theviewconcept, interfacefiles, Top
|
||||
@chapter Basic Controls
|
||||
@anchor{Basic Controls}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
@c GOODS AND SERVICES; OR BUSINESS INTERUPTION) HOWEVER CAUSED, EVEN
|
||||
@c IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
@node dataexchange
|
||||
@node dataexchange, images, browsercontrols, Top
|
||||
@chapter Data Exchange
|
||||
|
||||
@dfn{Data Exchange} refers to the many high-level options GNUstep provides for allowing different applications to exchange common types of data. The sorts of services include "cut and paste", "drag and drop", service applications, filter services and distributed objects.
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
@c GOODS AND SERVICES; OR BUSINESS INTERUPTION) HOWEVER CAUSED, EVEN
|
||||
@c IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
@node eventhandling
|
||||
@node eventhandling, tableview, theviewconcept, Top
|
||||
@chapter Event handling
|
||||
|
||||
The way events are handled and passed between objects in GNUstep requires special treatment. It is relatively simple, but generally not well documented as to how it works, and how it is used by default in GNUstep. Before reading this chapter, you may wish to reaquaint yourself with views (@pxref{The view concept}).
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
@c GOODS AND SERVICES; OR BUSINESS INTERUPTION) HOWEVER CAUSED, EVEN
|
||||
@c IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
@node fdl
|
||||
@node fdl, , images, Top
|
||||
@appendix GNU Free Documentation License
|
||||
|
||||
@center Version 1.2, November 2002
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
@c
|
||||
@c * Thanks to Damien Pollet for some minor spelling and grammatical fixups.
|
||||
|
||||
@node gnustepapplications
|
||||
@node gnustepapplications, applicationmakefiles, basicconcepts, Top
|
||||
@chapter GNUstep Applications
|
||||
|
||||
@cindex AppKit
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
@c GOODS AND SERVICES; OR BUSINESS INTERUPTION) HOWEVER CAUSED, EVEN
|
||||
@c IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
@node images
|
||||
@node images, fdl, dataexchange, Top
|
||||
@chapter Images and Imageviews
|
||||
|
||||
@anchor{Images and Imageviews}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
@c IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
@anchor{Interface Files}
|
||||
@node interfacefiles
|
||||
@node interfacefiles, controls, applicationmakefiles, Top
|
||||
@chapter Interface Files
|
||||
|
||||
@cindex interface files, definition
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@paragraphindent 0
|
||||
|
||||
@node Introduction
|
||||
@node Introduction, basicconcepts, Top, Top
|
||||
@chapter Introduction
|
||||
|
||||
This manual documents some configuration and installation issues
|
|
@ -1,217 +0,0 @@
|
|||
@paragraphindent 0
|
||||
|
||||
@node Introduction
|
||||
@chapter Introduction
|
||||
|
||||
This manual documents some configuration and installation issues
|
||||
with the GNUstep GUI Library and also differences between the GUI
|
||||
Library and libraries that implement the OpenStep AppKit specification
|
||||
and the MacOS-X AppKit implementation.
|
||||
|
||||
@section Overview
|
||||
|
||||
The GNUstep GUI Library is a library of objects useful for writing
|
||||
graphical applications. For example, it includes classes for drawing
|
||||
and manipulating graphics objects on the screen: windows, menus,
|
||||
buttons, sliders, text fields, and events. There are also many
|
||||
peripheral classes that offer operating-system-independent interfaces to
|
||||
images, cursors, colors, fonts, pasteboards, printing. There are also
|
||||
workspace support classes such as data links, open/save panels,
|
||||
context-dependent help, spell checking.
|
||||
|
||||
It provides functionality that aims to implement the @samp{AppKit}
|
||||
portion of the OpenStep standard. However the implementation has
|
||||
been written to take advantage of GNUstep enhancements wherever possible.
|
||||
|
||||
The GNUstep GUI Library is divided into a front and back-end. The
|
||||
front-end contains the majority of implementation, but leaves out the
|
||||
low-level drawing and event code. Different back-ends will make GNUstep
|
||||
available on various platforms. The default GNU back-end currently runs
|
||||
on top of the X Window System and uses only Xlib calls for
|
||||
graphics. Another backend uses a Display Postscript Server for graphics.
|
||||
Much work will be saved by this clean separation between front and
|
||||
back-end, because it allows different platforms to share the large
|
||||
amount of front-end code. Documentation for how the individual backends
|
||||
work is coverered in a separate document.
|
||||
|
||||
@section Implementation Details
|
||||
|
||||
Following are some implementation details of the GUI library. These will
|
||||
mostly be of interest to developers of the GUI library itself.
|
||||
|
||||
@subsection Drag and Drop
|
||||
|
||||
The drag types info for each view is kept in a global map table (protected by
|
||||
locks) and can be accessed by the backend library using the function -
|
||||
|
||||
@smallexample
|
||||
NSArray *GSGetDragTypes(Nsview *aView);
|
||||
@end smallexample
|
||||
|
||||
Drag type information for each window (a union of the drag type info for all
|
||||
the views in the window) is maintained in the graphics context.
|
||||
The backend can get this information (as a counted set) using -
|
||||
|
||||
@smallexample
|
||||
- (NSCountedSet*) _dragTypesForWindow: (int)winNum;
|
||||
@end smallexample
|
||||
|
||||
Whenever a DnD aware view is added to, or removed from a window, the type
|
||||
information for that view is added to/removed from the type information
|
||||
for the window, altering the counted set. If the alteration results in a
|
||||
change in the types for the window, the method making the change returns YES.
|
||||
|
||||
@smallexample
|
||||
- (BOOL) _addDragTypes: (NSArray*)types toWindow: (int)winNum;
|
||||
- (BOOL) _removeDragTypes: (NSArray*)types fromWindow: (int)winNum;
|
||||
@end smallexample
|
||||
|
||||
The backend library should therefore override these methods and call 'super'
|
||||
to handle the update. If the call to the super method returns YES, the
|
||||
backend should make any changes as appropriate (in the case of the xdnd
|
||||
protocol this means altering the XdndAware property of the X window).
|
||||
|
||||
You will notice that these methods use the integer window number rather
|
||||
than the NSWindow object - this is for the convenience of the backend
|
||||
library which should (eventually) use window numbers for everything
|
||||
|
||||
@subsection NSWorkspace
|
||||
|
||||
Here is (I think) the current state of the code (largely untested) -
|
||||
|
||||
The make_services tool examines all applications (anything with a .app,
|
||||
.debug, or .profile suffix) in the system, local, and user Apps Directories.
|
||||
|
||||
In addition to the cache of services information, it builds a cache of
|
||||
information about known applications (including information about file types
|
||||
they handle).
|
||||
|
||||
NSWorkspace reads the cache and uses it to determine which application to use
|
||||
to open a document and which icon to use to represent that document.
|
||||
|
||||
The NSWorkspace API has been extended to provide methods for finding/setting
|
||||
the preferred icon/application for a particular file type. NSWorkspace will
|
||||
use the 'best' icon/application available.
|
||||
|
||||
To determine the executable to launch, if there was an
|
||||
Info-gnustep.plist/Info.plist in the app wrapper and it had an
|
||||
NSExecutable field - use that name. Otherwise, try to use the name of
|
||||
the app - eg. foo.app/foo The executable is launched by NSTask, which
|
||||
handles the addition of machine/os/library path components as necessary.
|
||||
|
||||
To determine the icon for a file, use the value from the cache of icons
|
||||
for the file extension, or use an 'unknown' icon.
|
||||
|
||||
To determine the icon for a folder, if the folder has a '.app', '.debug'
|
||||
or '.profile' extension - examine the Info.plist file for an 'NSIcon'
|
||||
value and try to use that. If there is no value specified - try
|
||||
foo.app/foo.tiff' or 'foo.app/.dir.tiff'
|
||||
|
||||
If the folder was not an application wrapper, just try the .dir.tiff file.
|
||||
|
||||
If no icon was available, use a default folder icon or a special icon for the
|
||||
root directory.
|
||||
|
||||
The information about what file types an app can handle needs to be in
|
||||
the MacOS-X format in the Info-gnustep.plist/Info.plist for the app -
|
||||
see
|
||||
@url{http://developer.apple.com/techpubs/macosxserver/System/Documentation/Developer/YellowBox/ReleaseNotes/InfoPlist.html}.
|
||||
|
||||
In the NSTypes fields, I used NSIcon (the icon to use for the type)
|
||||
NSUnixExtensions (a list of file extensions corresponding to the type)
|
||||
and NSRole (what the app can do with documents of this type). In the
|
||||
AppList cache, I generate a dictionary, keyed by file extension, whose
|
||||
values are the dictionaries containing the NSTypes dictionaries of each
|
||||
of the apps that handle the extension.
|
||||
|
||||
I tested the code briefly with the FileViewer app, and it seemed to
|
||||
provide the icons as expected.
|
||||
|
||||
With this model the software doesn't need to monitor loads of
|
||||
different files, just register to recieve notifications when the
|
||||
defaults database changes, and check an appropriate default value. At
|
||||
present, there are four hidden files used by the software:
|
||||
|
||||
@table @samp
|
||||
@item ~/GNUstep/Services/.GNUstepAppList
|
||||
Cached information about applications and file extensions.
|
||||
@item ~/GNUstep/Services/.GNUstepExtPrefs
|
||||
User preferences for which apps/icons should be used for each file
|
||||
extension.
|
||||
@item ~/GNUstep/Services/.GNUstepServices
|
||||
Cache of services provides by apps and services daemons
|
||||
@item ~/GNUstep/Services/.GNUstepDisabled
|
||||
User settings to determine which services should not appear in the
|
||||
services menu.
|
||||
@end table
|
||||
|
||||
Each of these is a serialized property list.
|
||||
|
||||
Almost forgot - Need to modify NSApplication to understand '-GSOpenFile ...'
|
||||
as an instruction to open the specified file on launching. Need to modify
|
||||
NSWorkspace to supply the appropriate arguments when launching a task rather
|
||||
than using the existing mechanism of using DO to request that the app opens
|
||||
the file. When these changes are made, we can turn any program into a
|
||||
pseudo-GNUstep app by creating the appropriate app wrapper.
|
||||
An app wrapper then need only contain a shell-script that understands the
|
||||
-GSOpenFile argument and uses it to start the program - though provision of
|
||||
a GNUstep-info.plist and various icons would obviously make things prettier.
|
||||
|
||||
For instance - you could set up xv.app to contain a shellscript 'xv' that
|
||||
would start the real xv binary passing it a file to open if the -GSOpenFile
|
||||
argument was given. The Info-gnustep.plist file could look like this:
|
||||
|
||||
@example
|
||||
@{
|
||||
NSExecutable = "xv";
|
||||
NSIcon = "xv.tiff";
|
||||
NSTypes = (
|
||||
@{
|
||||
NSIcon = "tiff.tiff";
|
||||
NSUnixExtensions = ( tiff, tif );
|
||||
@},
|
||||
@{
|
||||
NSIcon = "xbm.tiff";
|
||||
NSUnixExtensions = ( xbm );
|
||||
@}
|
||||
);
|
||||
@}
|
||||
@end example
|
||||
|
||||
@section Contributing
|
||||
|
||||
Contributing code is not difficult. Here are
|
||||
some general guidelines:
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
FSF must maintain the right to accept or reject potential contributions.
|
||||
Generally, the only reasons for rejecting contributions are cases where
|
||||
they duplicate existing or nearly-released code, contain unremovable
|
||||
specific machine dependencies, or are somehow incompatible with the
|
||||
rest of the library.
|
||||
|
||||
@item
|
||||
Acceptance of contributions means that the code is accepted for adaptation
|
||||
into libgnustep-gui. FSF must reserve the right to make various editorial
|
||||
changes in code. Very often, this merely entails formatting, maintenance of
|
||||
various conventions, etc. Contributors are always given authorship credit and
|
||||
shown the final version for approval.
|
||||
|
||||
@item
|
||||
Contributors must assign their copyright to FSF via a form sent out
|
||||
upon acceptance. Assigning copyright to FSF ensures that the code
|
||||
may be freely distributed.
|
||||
|
||||
@item
|
||||
Assistance in providing documentation, test files, and debugging
|
||||
support is strongly encouraged.
|
||||
|
||||
@end itemize
|
||||
|
||||
Extensions, comments, and suggested modifications of existing libgnustep-gui
|
||||
features are also very welcome.
|
||||
|
||||
@page
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
@c GOODS AND SERVICES; OR BUSINESS INTERUPTION) HOWEVER CAUSED, EVEN
|
||||
@c IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
@node matrix
|
||||
@node matrix, browsercontrols, outlineviews, Top
|
||||
@chapter Matrix Controls
|
||||
@anchor{Matrix Controls}
|
||||
@cindex matrices, matrix control
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
@c GOODS AND SERVICES; OR BUSINESS INTERUPTION) HOWEVER CAUSED, EVEN
|
||||
@c IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
@node outlineviews
|
||||
@node outlineviews, matrix, tableview, Top
|
||||
@chapter Outline Views
|
||||
|
||||
An @dfn{outline view} is a specialised form of table view designed for displaying hierachical data in a tree like format. It looks alot like a Windows' TreeView Control, but operates differently, provides much more powerful functionality and it is less tedious to programme.
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
@c GOODS AND SERVICES; OR BUSINESS INTERUPTION) HOWEVER CAUSED, EVEN
|
||||
@c IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
@node tableview
|
||||
@node tableview, outlineviews, eventhandling, Top
|
||||
@chapter Tableviews
|
||||
@anchor{Tableviews}
|
||||
@cindex tableview, definition
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
@c IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
@anchor{The view concept}
|
||||
@node theviewconcept
|
||||
@node theviewconcept, eventhandling, controls, Top
|
||||
@chapter The view concept
|
||||
|
||||
This chapter discusses the concepts surrounding @dfn{views} and goes into some detail what can be done with them. As a result, most of this chapter is concerned with the creation of custom views, which is not necessary for general application development. If you want to create your own view classes or are interested in how GNUstep manages views, then this chapter should be useful.
|
||||
|
|
91
Headers/AppKit/NSArrayController.h
Normal file
91
Headers/AppKit/NSArrayController.h
Normal file
|
@ -0,0 +1,91 @@
|
|||
/** <title>NSArrayController</title>
|
||||
|
||||
<abstract>Controller class for arrays</abstract>
|
||||
|
||||
Copyright <copy>(C) 2006 Free Software Foundation, Inc.</copy>
|
||||
|
||||
Author: Fred Kiefer <fredkiefer@gmx.de>
|
||||
Date: June 2006
|
||||
|
||||
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_NSArrayController
|
||||
#define _GNUstep_H_NSArrayController
|
||||
|
||||
#include <AppKit/NSObjectController.h>
|
||||
|
||||
#if OS_API_VERSION(100300,GS_API_LATEST)
|
||||
|
||||
@class NSArray;
|
||||
@class NSIndexSet;
|
||||
|
||||
@interface NSArrayController : NSObjectController
|
||||
{
|
||||
NSMutableArray *_arrange_objects;
|
||||
NSArray *_sort_descriptors;
|
||||
NSIndexSet *_selection_indexes;
|
||||
BOOL _avoids_empty_Selection;
|
||||
BOOL _preserves_selection;
|
||||
}
|
||||
|
||||
- (void) addObjects: (NSArray*)obj;
|
||||
- (void) removeObjects: (NSArray*)obj;
|
||||
- (BOOL) canInsert;
|
||||
- (void) insert: (id)sender;
|
||||
|
||||
- (BOOL) addSelectedObjects: (NSArray*)obj;
|
||||
- (BOOL) addSelectionIndexes: (NSIndexSet*)idx;
|
||||
- (BOOL) setSelectedObjects: (NSArray*)obj;
|
||||
- (BOOL) setSelectionIndex: (unsigned int)idx;
|
||||
- (BOOL) setSelectionIndexes: (NSIndexSet*)idx;
|
||||
- (BOOL) removeSelectedObjects: (NSArray*)obj;
|
||||
- (BOOL) removeSelectionIndexes: (NSIndexSet*)idx;
|
||||
- (void) selectNext: (id)sender;
|
||||
- (void) selectPrevious: (id)sender;
|
||||
- (NSArray*) selectedObjects;
|
||||
- (unsigned int) selectionIndex;
|
||||
- (NSIndexSet*) selectionIndexes;
|
||||
|
||||
- (BOOL) canSelectNext;
|
||||
- (BOOL) canSelectPrevious;
|
||||
- (BOOL) avoidsEmptySelection;
|
||||
- (void) setAvoidsEmptySelection: (BOOL)flag;
|
||||
- (BOOL) preservesSelection;
|
||||
- (void) setPreservesSelection: (BOOL)flag;
|
||||
- (BOOL) selectsInsertedObjects;
|
||||
- (void) setSelectsInsertedObjects: (BOOL)flag;
|
||||
|
||||
- (NSArray*) arrangeObjects: (NSArray*)obj;
|
||||
- (id) arrangedObjects;
|
||||
- (void) rearrangeObjects;
|
||||
- (void) setSortDescriptors: (NSArray*)desc;
|
||||
- (NSArray*) sortDescriptors;
|
||||
|
||||
- (void) insertObject: (id)obj
|
||||
atArrangedObjectIndex: (unsigned int)idx;
|
||||
- (void) insertObjects: (NSArray*)obj
|
||||
atArrangedObjectIndexes: (NSIndexSet*)idx;
|
||||
- (void) removeObjectAtArrangedObjectIndex: (unsigned int)idx;
|
||||
- (void) removeObjectsAtArrangedObjectIndexes: (NSIndexSet*)idx;
|
||||
|
||||
@end
|
||||
|
||||
#endif // OS_API_VERSION
|
||||
|
||||
#endif // _GNUstep_H_NSArrayController
|
56
Headers/AppKit/NSController.h
Normal file
56
Headers/AppKit/NSController.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/** <title>NSController</title>
|
||||
|
||||
<abstract>abstract base class for controllers</abstract>
|
||||
|
||||
Copyright <copy>(C) 2006 Free Software Foundation, Inc.</copy>
|
||||
|
||||
Author: Fred Kiefer <fredkiefer@gmx.de>
|
||||
Date: June 2006
|
||||
|
||||
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_NSController
|
||||
#define _GNUstep_H_NSController
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
|
||||
#if OS_API_VERSION(100300,GS_API_LATEST)
|
||||
|
||||
@class NSMutableArray;
|
||||
|
||||
@interface NSController : NSObject <NSCoding>
|
||||
{
|
||||
NSMutableArray *_editors;
|
||||
}
|
||||
|
||||
// NSEditor protocol
|
||||
- (BOOL) commitEditing;
|
||||
- (void) discardEditing;
|
||||
|
||||
- (BOOL) isEditing;
|
||||
|
||||
// NSEditorRegistration protocol
|
||||
- (void) objectDidBeginEditing: (id)editor;
|
||||
- (void) objectDidEndEditing: (id)editor;
|
||||
|
||||
@end
|
||||
|
||||
#endif // OS_API_VERSION
|
||||
|
||||
#endif // _GNUstep_H_NSController
|
99
Headers/AppKit/NSKeyValueBinding.h
Normal file
99
Headers/AppKit/NSKeyValueBinding.h
Normal file
|
@ -0,0 +1,99 @@
|
|||
/** <title>NSKeyValueBinding</title>
|
||||
|
||||
<abstract>Interfae declaration for key value binding</abstract>
|
||||
|
||||
Copyright <copy>(C) 2006 Free Software Foundation, Inc.</copy>
|
||||
|
||||
Author: Fred Kiefer <fredkiefer@gmx.de>
|
||||
Date: June 2006
|
||||
|
||||
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_NSKeyValueBinding
|
||||
#define _GNUstep_H_NSKeyValueBinding
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
|
||||
#if OS_API_VERSION(100300,GS_API_LATEST)
|
||||
|
||||
@class NSString;
|
||||
@class NSArray;
|
||||
@class NSDictionary;
|
||||
|
||||
|
||||
@interface NSObject (NSKeyValueBindingCreation)
|
||||
|
||||
+ (void) exposeBinding: (NSString *)key;
|
||||
|
||||
- (NSArray *) exposedBindings;
|
||||
- (Class) valueClassForBinding: (NSString *)binding;
|
||||
- (void) bind: (NSString *)binding
|
||||
toObject: (id)controller
|
||||
withKeyPath: (NSString *)keyPath
|
||||
options: (NSDictionary *)options;
|
||||
- (void) unbind: (NSString *)binding;
|
||||
- (void) commitEditingWithDelegate: (id)delegate
|
||||
didCommitSelector: (SEL)didCommitSelector
|
||||
contextInfo: (void *)contextInfo;
|
||||
- (NSDictionary *) infoForBinding: (NSString *)binding;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSObject (NSPlaceholder)
|
||||
|
||||
+ (id) defaultPlaceholderForMarker: (id)marker
|
||||
withBinding: (NSString *)binding;
|
||||
+ (void) setDefaultPlaceholder: (id)placeholder
|
||||
forMarker: (id)marker
|
||||
withBinding: (NSString *)binding;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface NSObject (NSEditor)
|
||||
|
||||
- (BOOL) commitEditing;
|
||||
- (void) discardEditing;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSObject (NSEditorRegistration)
|
||||
|
||||
- (void) objectDidBeginEditing: (id)editor;
|
||||
- (void) objectDidEndEditing: (id)editor;
|
||||
|
||||
@end
|
||||
|
||||
// Keys in options dictionary
|
||||
|
||||
// binding values
|
||||
|
||||
// Keys in dictionary returned by infoForBinding
|
||||
APPKIT_EXPORT NSString *NSObservedObjectKey;
|
||||
APPKIT_EXPORT NSString *NSObservedKeyPath;
|
||||
APPKIT_EXPORT NSString *NSOptionsKey;
|
||||
|
||||
// special markers
|
||||
APPKIT_EXPORT id NSMultipleValuesMarker;
|
||||
APPKIT_EXPORT id NSNoSelectionMarker;
|
||||
APPKIT_EXPORT id NSNotApplicableMarker;
|
||||
|
||||
#endif // OS_API_VERSION
|
||||
|
||||
#endif // _GNUstep_H_NSKeyValueBinding
|
99
Headers/AppKit/NSObjectController.h
Normal file
99
Headers/AppKit/NSObjectController.h
Normal file
|
@ -0,0 +1,99 @@
|
|||
/** <title>NSObjectController</title>
|
||||
|
||||
<abstract>Controller class</abstract>
|
||||
|
||||
Copyright <copy>(C) 2006 Free Software Foundation, Inc.</copy>
|
||||
|
||||
Author: Fred Kiefer <fredkiefer@gmx.de>
|
||||
Date: June 2006
|
||||
|
||||
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_NSObjectController
|
||||
#define _GNUstep_H_NSObjectController
|
||||
|
||||
#include <AppKit/NSController.h>
|
||||
#include <AppKit/NSMenuItem.h>
|
||||
|
||||
#if OS_API_VERSION(100300,GS_API_LATEST)
|
||||
|
||||
@class NSArray;
|
||||
@class NSMutableArray;
|
||||
@class NSString;
|
||||
@class NSPredicate;
|
||||
@class NSError;
|
||||
@class NSFetchRequest;
|
||||
@class NSManagedObjectContext;
|
||||
|
||||
@interface NSObjectController : NSController
|
||||
{
|
||||
Class _object_class;
|
||||
id _content;
|
||||
NSMutableArray *_selection;
|
||||
NSString *_entity_name_key;
|
||||
NSPredicate *_fetch_predicate;
|
||||
NSManagedObjectContext *_managed_object_context;
|
||||
BOOL _is_editable;
|
||||
BOOL _automatically_prepares_content;
|
||||
}
|
||||
|
||||
- (id) initWithContent: (id)content;
|
||||
- (id) content;
|
||||
- (void) setContent: (id)content;
|
||||
- (Class) objectClass;
|
||||
- (void) setObjectClass: (Class)class;
|
||||
|
||||
- (id) newObject;
|
||||
- (void) prepareContent;
|
||||
- (BOOL) automaticallyPreparesContent;
|
||||
- (void) setAutomaticallyPreparesContent: (BOOL)flag;
|
||||
|
||||
- (void) add: (id)sender;
|
||||
- (void) addObject: (id)obj;
|
||||
- (void) remove: (id)sender;
|
||||
- (void) removeObject: (id)obj;
|
||||
- (BOOL) canAdd;
|
||||
- (BOOL) canRemove;
|
||||
|
||||
- (BOOL) isEditable;
|
||||
- (void) setEditable: (BOOL)flag;
|
||||
|
||||
- (NSArray*) selectedObjects;
|
||||
- (id) selection;
|
||||
|
||||
- (BOOL) validateMenuItem: (id <NSMenuItem>)item;
|
||||
|
||||
#if OS_API_VERSION(100400,GS_API_LATEST)
|
||||
- (NSString*) entityNameKey;
|
||||
- (void) setEntityName: (NSString*)entityName;
|
||||
- (NSPredicate*) fetchPredicate;
|
||||
- (void) setFetchPredicate: (NSPredicate*)predicate;
|
||||
- (void) fetch: (id)sender;
|
||||
- (BOOL) fetchWithRequest: (NSFetchRequest*)fetchRequest
|
||||
merge: (BOOL)merge
|
||||
error: (NSError**)error;
|
||||
- (NSManagedObjectContext*) managedObjectContext;
|
||||
- (void) setManagedObjectContext: (NSManagedObjectContext*)managedObjectContext;
|
||||
#endif //OS_API_VERSION
|
||||
|
||||
@end
|
||||
|
||||
#endif // OS_API_VERSION
|
||||
|
||||
#endif // _GNUstep_H_NSObjectController
|
65
Headers/AppKit/NSUserDefaultsController.h
Normal file
65
Headers/AppKit/NSUserDefaultsController.h
Normal file
|
@ -0,0 +1,65 @@
|
|||
/** <title>NSUserDefaultsController</title>
|
||||
|
||||
<abstract>Controller class for user defaults</abstract>
|
||||
|
||||
Copyright <copy>(C) 2006 Free Software Foundation, Inc.</copy>
|
||||
|
||||
Author: Fred Kiefer <fredkiefer@gmx.de>
|
||||
Date: September 2006
|
||||
|
||||
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_NSUserDefaultsController
|
||||
#define _GNUstep_H_NSUserDefaultsController
|
||||
|
||||
#include <AppKit/NSController.h>
|
||||
|
||||
#if OS_API_VERSION(100300,GS_API_LATEST)
|
||||
|
||||
@class NSUserDefaults;
|
||||
@class NSDictionary;
|
||||
@class NSMutableDictionary;
|
||||
|
||||
@interface NSUserDefaultsController : NSController
|
||||
{
|
||||
NSUserDefaults* _defaults;
|
||||
NSDictionary* _initial_values;
|
||||
BOOL _applies_immediately;
|
||||
}
|
||||
|
||||
+ (id) sharedUserDefaultsController;
|
||||
|
||||
- (id) initWithDefaults: (NSUserDefaults*)defaults
|
||||
initialValues: (NSDictionary*)initialValues;
|
||||
|
||||
- (NSUserDefaults*) defaults;
|
||||
- (id) values;
|
||||
- (NSDictionary*) initialValues;
|
||||
- (void) setInitialValues: (NSDictionary*)values;
|
||||
- (BOOL) appliesImmediately;
|
||||
- (void) setAppliesImmediately: (BOOL)flag;
|
||||
- (void) revert: (id)sender;
|
||||
- (void) revertToInitialValues: (id)sender;
|
||||
- (void) save: (id)sender;
|
||||
|
||||
@end
|
||||
|
||||
#endif // OS_API_VERSION
|
||||
|
||||
#endif // _GNUstep_H_NSUserDefaultsController
|
|
@ -47,6 +47,7 @@
|
|||
@class NSMutableArray;
|
||||
@class NSNotification;
|
||||
@class NSString;
|
||||
@class NSUndoManager;
|
||||
|
||||
@class NSButtonCell;
|
||||
@class NSColor;
|
||||
|
@ -688,8 +689,15 @@ APPKIT_EXPORT NSSize NSTokenSize;
|
|||
@interface NSObject (NSWindowDelegate)
|
||||
- (BOOL) windowShouldClose: (id)sender;
|
||||
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
||||
- (NSRect) window: (NSWindow*)window
|
||||
willPositionSheet: (NSWindow*)sheet
|
||||
usingRect: (NSRect)rect;
|
||||
- (void) windowDidChangeScreenProfile: (NSNotification*)aNotification;
|
||||
- (void) windowDidEndSheet: (NSNotification*)aNotification;
|
||||
- (BOOL) windowShouldZoom: (NSWindow*)sender
|
||||
toFrame: (NSRect)aFrame;
|
||||
- (void) windowWillBeginSheet: (NSNotification*)aNotification;
|
||||
- (NSUndoManager*) windowWillReturnUndoManager: (NSWindow*)sender;
|
||||
- (NSRect) windowWillUseStandardFrame: (NSWindow*)sender
|
||||
defaultFrame: (NSRect)aFrame;
|
||||
#endif
|
||||
|
|
|
@ -51,6 +51,7 @@ NSActionCell.m \
|
|||
NSAffineTransform.m \
|
||||
NSAlert.m \
|
||||
NSApplication.m \
|
||||
NSArrayController.m \
|
||||
NSAttributedString.m \
|
||||
NSBezierPath.m \
|
||||
NSBitmapImageRep.m \
|
||||
|
@ -75,6 +76,7 @@ NSColorWell.m \
|
|||
NSComboBox.m \
|
||||
NSComboBoxCell.m \
|
||||
NSControl.m \
|
||||
NSController.m \
|
||||
NSCursor.m \
|
||||
NSCustomImageRep.m \
|
||||
NSDataLink.m \
|
||||
|
@ -110,6 +112,7 @@ NSMenuItemCell.m \
|
|||
NSMovie.m \
|
||||
NSMovieView.m \
|
||||
NSNib.m \
|
||||
NSObjectController.m \
|
||||
NSOpenGLContext.m \
|
||||
NSOpenGLPixelFormat.m \
|
||||
NSOpenGLView.m \
|
||||
|
@ -159,6 +162,7 @@ NSTextFieldCell.m \
|
|||
NSTextStorage.m \
|
||||
NSToolbar.m \
|
||||
NSToolbarItem.m \
|
||||
NSUserDefaultsController.m \
|
||||
NSView.m \
|
||||
NSWindow+Toolbar.m \
|
||||
NSWindow.m \
|
||||
|
@ -230,6 +234,7 @@ NSActionCell.h \
|
|||
NSAffineTransform.h \
|
||||
NSAlert.h \
|
||||
NSApplication.h \
|
||||
NSArrayController.h \
|
||||
NSBezierPath.h \
|
||||
NSBox.h \
|
||||
NSBitmapImageRep.h \
|
||||
|
@ -248,6 +253,7 @@ NSColorWell.h \
|
|||
NSComboBox.h \
|
||||
NSComboBoxCell.h \
|
||||
NSControl.h \
|
||||
NSController.h \
|
||||
NSCursor.h \
|
||||
NSCustomImageRep.h \
|
||||
NSDataLink.h \
|
||||
|
@ -282,6 +288,7 @@ NSMenuItemCell.h \
|
|||
NSMenuView.h \
|
||||
NSMovie.h \
|
||||
NSMovieView.h \
|
||||
NSObjectController.h \
|
||||
NSOpenPanel.h \
|
||||
NSOpenGL.h \
|
||||
NSOpenGLView.h \
|
||||
|
@ -332,6 +339,7 @@ NSTextStorage.h \
|
|||
NSTextView.h \
|
||||
NSToolbar.h \
|
||||
NSToolbarItem.h \
|
||||
NSUserDefaultsController.h \
|
||||
NSView.h \
|
||||
NSWindow.h \
|
||||
NSWindowController.h \
|
||||
|
|
|
@ -734,6 +734,20 @@ setControl(NSView* content, id control, NSString *title)
|
|||
[messageField removeFromSuperview];
|
||||
}
|
||||
setControl(content, messageField, message);
|
||||
|
||||
/* If the message contains a newline character then align the
|
||||
* message to the left side, as it is quite undesirable for a long
|
||||
* message to appear aligned in the center
|
||||
*/
|
||||
if ([message rangeOfString: @"\n"].location != NSNotFound)
|
||||
{
|
||||
[messageField setAlignment: NSLeftTextAlignment];
|
||||
}
|
||||
else
|
||||
{
|
||||
[messageField setAlignment: NSCenterTextAlignment];
|
||||
}
|
||||
|
||||
setControl(content, defButton, defaultButton);
|
||||
setControl(content, altButton, alternateButton);
|
||||
setControl(content, othButton, otherButton);
|
||||
|
|
274
Source/NSArrayController.m
Normal file
274
Source/NSArrayController.m
Normal file
|
@ -0,0 +1,274 @@
|
|||
/** <title>NSArrayController</title>
|
||||
|
||||
<abstract>Controller class for arrays</abstract>
|
||||
|
||||
Copyright <copy>(C) 2006 Free Software Foundation, Inc.</copy>
|
||||
|
||||
Author: Fred Kiefer <fredkiefer@gmx.de>
|
||||
Date: June 2006
|
||||
|
||||
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 <Foundation/NSArray.h>
|
||||
#include <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <AppKit/NSArrayController.h>
|
||||
|
||||
@implementation NSArrayController
|
||||
|
||||
- (id) initWithContent: (id)content
|
||||
{
|
||||
if ((self = [super initWithContent: content]) != nil)
|
||||
{
|
||||
_arrange_objects = [[NSMutableArray alloc] init];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
NSMutableArray *new = [[NSMutableArray alloc] init];
|
||||
|
||||
self = [self initWithContent: new];
|
||||
RELEASE(new);
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) addObject: (id)obj
|
||||
{
|
||||
[_content addObject: obj];
|
||||
[_arrange_objects addObject: obj];
|
||||
}
|
||||
|
||||
- (void) addObjects: (NSArray*)obj
|
||||
{
|
||||
[_content addObjectsFromArray: obj];
|
||||
if ([self selectsInsertedObjects])
|
||||
{
|
||||
[_arrange_objects addObjectsFromArray: obj];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) removeObject: (id)obj
|
||||
{
|
||||
[_content removeObject: obj];
|
||||
[_arrange_objects removeObject: obj];
|
||||
}
|
||||
|
||||
- (void) removeObjects: (NSArray*)obj
|
||||
{
|
||||
[_content removeObjectsInArray: obj];
|
||||
[_arrange_objects removeObjectsInArray: obj];
|
||||
}
|
||||
|
||||
- (BOOL) canInsert
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void) insert: (id)sender
|
||||
{
|
||||
id new = [self newObject];
|
||||
|
||||
[_content addObject: new];
|
||||
RELEASE(new);
|
||||
}
|
||||
|
||||
- (BOOL) addSelectedObjects: (NSArray*)obj
|
||||
{
|
||||
// TODO
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) addSelectionIndexes: (NSIndexSet*)idx
|
||||
{
|
||||
// TODO
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) setSelectedObjects: (NSArray*)obj
|
||||
{
|
||||
// TODO
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) setSelectionIndex: (unsigned int)idx
|
||||
{
|
||||
// TODO
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) setSelectionIndexes: (NSIndexSet*)idx
|
||||
{
|
||||
// TODO
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) removeSelectedObjects: (NSArray*)obj
|
||||
{
|
||||
// TODO
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) removeSelectionIndexes: (NSIndexSet*)idx
|
||||
{
|
||||
// TODO
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void) selectNext: (id)sender
|
||||
{
|
||||
// TODO
|
||||
return;
|
||||
}
|
||||
|
||||
- (void) selectPrevious: (id)sender
|
||||
{
|
||||
// TODO
|
||||
return;
|
||||
}
|
||||
|
||||
- (NSArray*) selectedObjects
|
||||
{
|
||||
// TODO
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (unsigned int) selectionIndex
|
||||
{
|
||||
// TODO
|
||||
return -1;
|
||||
}
|
||||
|
||||
- (NSIndexSet*) selectionIndexes
|
||||
{
|
||||
// TODO
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) canSelectNext
|
||||
{
|
||||
// TODO
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) canSelectPrevious
|
||||
{
|
||||
// TODO
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) avoidsEmptySelection
|
||||
{
|
||||
// TODO
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void) setAvoidsEmptySelection: (BOOL)flag
|
||||
{
|
||||
// TODO
|
||||
return;
|
||||
}
|
||||
|
||||
- (BOOL) preservesSelection
|
||||
{
|
||||
// TODO
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void) setPreservesSelection: (BOOL)flag
|
||||
{
|
||||
// TODO
|
||||
return;
|
||||
}
|
||||
|
||||
- (BOOL) selectsInsertedObjects
|
||||
{
|
||||
// TODO
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void) setSelectsInsertedObjects: (BOOL)flag
|
||||
{
|
||||
// TODO
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
- (NSArray*) arrangeObjects: (NSArray*)obj
|
||||
{
|
||||
// TODO
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id) arrangedObjects
|
||||
{
|
||||
// TODO
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void) rearrangeObjects
|
||||
{
|
||||
// TODO
|
||||
return;
|
||||
}
|
||||
|
||||
- (void) setSortDescriptors: (NSArray*)desc
|
||||
{
|
||||
// TODO
|
||||
return;
|
||||
}
|
||||
|
||||
- (NSArray*) sortDescriptors
|
||||
{
|
||||
// TODO
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
- (void) insertObject: (id)obj
|
||||
atArrangedObjectIndex: (unsigned int)idx
|
||||
{
|
||||
// TODO
|
||||
return;
|
||||
}
|
||||
|
||||
- (void) insertObjects: (NSArray*)obj
|
||||
atArrangedObjectIndexes: (NSIndexSet*)idx
|
||||
{
|
||||
// TODO
|
||||
return;
|
||||
}
|
||||
|
||||
- (void) removeObjectAtArrangedObjectIndex: (unsigned int)idx
|
||||
{
|
||||
// TODO
|
||||
return;
|
||||
}
|
||||
|
||||
- (void) removeObjectsAtArrangedObjectIndexes: (NSIndexSet*)idx
|
||||
{
|
||||
// TODO
|
||||
return;
|
||||
}
|
||||
|
||||
@end
|
|
@ -159,7 +159,7 @@
|
|||
|
||||
/** <p>Returns a newly allocated NSBitmapImageRep object representing the
|
||||
image stored in imageData. If the image data contains more than one
|
||||
image, the first one is choosen.</p><p>See Also: +imageRepWithData:</p>
|
||||
image, the first one is choosen.</p><p>See Also: +imageRepsWithData:</p>
|
||||
*/
|
||||
+ (id) imageRepWithData: (NSData *)imageData
|
||||
{
|
||||
|
@ -309,6 +309,7 @@
|
|||
return self;
|
||||
}
|
||||
|
||||
/** Initialize with bitmap data from a rect within the focused view */
|
||||
- (id) initWithFocusedViewRect: (NSRect)rect
|
||||
{
|
||||
int bps, spp, alpha;
|
||||
|
@ -783,6 +784,12 @@
|
|||
return [NSData dataWithBytesNoCopy: bytes length: length];
|
||||
}
|
||||
|
||||
/** <p> Returns a data object in the selected format with multiple images. See Also:
|
||||
-representationUsingType:properties: for a list of supported file types. See Also:
|
||||
-setProperty:withValue: for the options supported in the properties.</p>
|
||||
<p> FIXME: returns only the first image in the array, and only works for
|
||||
NSBitmapImageRep or subclasses thereof. </p>
|
||||
*/
|
||||
+ (NSData *)representationOfImageRepsInArray:(NSArray *)imageReps
|
||||
usingType:(NSBitmapImageFileType)storageType
|
||||
properties:(NSDictionary *)properties
|
||||
|
@ -805,6 +812,21 @@
|
|||
return nil;
|
||||
}
|
||||
|
||||
/** <p> Returns a data object in one of the supported bitmap graphics file types.
|
||||
A limited set of options may be passed via the properties. If the passed in properties is nil,
|
||||
it falls back to the options set with -setProperty:withValue:. Some file types are not
|
||||
implemented yet; they return nil and log an error message.</p>
|
||||
<p> NSBitmapImageFileType </p>
|
||||
<list>
|
||||
<item> NSTIFFFileType = 0; TIFF is supported </item>
|
||||
<item> NSBMPFileType = 1; BMP is not implemented </item>
|
||||
<item> NSGIFFileType = 2; GIF is supported </item>
|
||||
<item> NSJPEGFileType = 3; JPEG is supported </item>
|
||||
<item> NSPNGFileType = 4; PNG is supported </item>
|
||||
<item> NSJPEG2000FileType = 5; JPEG-2000 is not implemented </item>
|
||||
</list>
|
||||
<p> See Also: -setProperty:withValue: for supported options in the properties. </p>
|
||||
*/
|
||||
- (NSData *)representationUsingType:(NSBitmapImageFileType)storageType
|
||||
properties:(NSDictionary *)properties
|
||||
{
|
||||
|
@ -890,6 +912,7 @@
|
|||
*numTypes = j;
|
||||
}
|
||||
|
||||
/** Returns a localized string describing a TIFF compression type. */
|
||||
+ (NSString*) localizedNameForTIFFCompressionType: (NSTIFFCompression)type
|
||||
{
|
||||
switch (type)
|
||||
|
@ -954,6 +977,41 @@
|
|||
_comp_factor = factor;
|
||||
}
|
||||
|
||||
/** <p> Properties are key-value pairs associated with the representation. Arbitrary
|
||||
key-value pairs may be set. If the value is nil, the key is erased from properties.
|
||||
There are standard keys that are used to pass information
|
||||
and options related to the standard file types that may be read from or written to.
|
||||
Certain properties are automatically set when reading in image data.
|
||||
Certain properties may be set by the user prior to writing image data in order to set options
|
||||
for the data format. </p>
|
||||
<deflist>
|
||||
<term> NSImageCompressionMethod </term>
|
||||
<desc> NSNumber; automatically set when reading TIFF data; writing TIFF data </desc>
|
||||
<term> NSImageCompressionFactor </term>
|
||||
<desc> NSNumber 0.0 to 255.0; writing JPEG data
|
||||
(GNUstep extension: JPEG-compressed TIFFs too) </desc>
|
||||
<term> NSImageProgressive </term>
|
||||
<desc> NSNumber boolean; automatically set when reading JPEG data; writing JPEG data.
|
||||
Note: progressive display is not supported in GNUstep at this time. </desc>
|
||||
<term> NSImageInterlaced </term>
|
||||
<desc> NSNumber boolean; only for writing PNG data </desc>
|
||||
<term> NSImageGamma </term>
|
||||
<desc> NSNumber 0.0 to 1.0; only for reading or writing PNG data </desc>
|
||||
<term> NSImageRGBColorTable </term>
|
||||
<desc> NSData; automatically set when reading GIF data; writing GIF data </desc>
|
||||
<term> NSImageFrameCount </term>
|
||||
<desc> NSNumber integer; automatically set when reading animated GIF data.
|
||||
Not currently implemented. </desc>
|
||||
<term> NSImageCurrentFrame </term>
|
||||
<desc> NSNumber integer; only for animated GIF files. Not currently implemented. </desc>
|
||||
<term> NSImageCurrentFrameDuration </term>
|
||||
<desc> NSNumber float; automatically set when reading animated GIF data </desc>
|
||||
<term> NSImageLoopCount </term>
|
||||
<desc> NSNumber integer; automatically set when reading animated GIF data </desc>
|
||||
<term> NSImageDitherTranparency </term>
|
||||
<desc> NSNumber boolean; only for writing GIF data. Not currently supported. </desc>
|
||||
</deflist>
|
||||
*/
|
||||
- (void)setProperty:(NSString *)property withValue:(id)value
|
||||
{
|
||||
if (value)
|
||||
|
@ -966,6 +1024,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
/** Returns the value of a property */
|
||||
- (id)valueForProperty:(NSString *)property
|
||||
{
|
||||
return [_properties objectForKey: property];
|
||||
|
|
93
Source/NSController.m
Normal file
93
Source/NSController.m
Normal file
|
@ -0,0 +1,93 @@
|
|||
/** <title>NSController</title>
|
||||
|
||||
<abstract>abstract base class for controllers</abstract>
|
||||
|
||||
Copyright <copy>(C) 2006 Free Software Foundation, Inc.</copy>
|
||||
|
||||
Author: Fred Kiefer <fredkiefer@gmx.de>
|
||||
Date: June 2006
|
||||
|
||||
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 <Foundation/NSArray.h>
|
||||
#include <AppKit/NSController.h>
|
||||
|
||||
@implementation NSController
|
||||
|
||||
- (id) init
|
||||
{
|
||||
_editors = [[NSMutableArray alloc] init];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(_editors);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder *)aCoder
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder *)aDecoder
|
||||
{
|
||||
// TODO
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL) isEditing
|
||||
{
|
||||
return [_editors count] > 0;
|
||||
}
|
||||
|
||||
- (BOOL) commitEditing
|
||||
{
|
||||
unsigned c = [_editors count];
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < c; i++)
|
||||
{
|
||||
if (![[_editors objectAtIndex: i] commitEditing])
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void) discardEditing
|
||||
{
|
||||
[_editors makeObjectsPerformSelector: @selector(discardEditing)];
|
||||
}
|
||||
|
||||
- (void) objectDidBeginEditing: (id)editor
|
||||
{
|
||||
[_editors addObject: editor];
|
||||
}
|
||||
|
||||
- (void) objectDidEndEditing: (id)editor
|
||||
{
|
||||
[_editors removeObject: editor];
|
||||
}
|
||||
|
||||
@end
|
253
Source/NSObjectController.m
Normal file
253
Source/NSObjectController.m
Normal file
|
@ -0,0 +1,253 @@
|
|||
/** <title>NSObjectController</title>
|
||||
|
||||
<abstract>Controller class</abstract>
|
||||
|
||||
Copyright <copy>(C) 2006 Free Software Foundation, Inc.</copy>
|
||||
|
||||
Author: Fred Kiefer <fredkiefer@gmx.de>
|
||||
Date: June 2006
|
||||
|
||||
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 <Foundation/NSArray.h>
|
||||
#include <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSPredicate.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <AppKit/NSObjectController.h>
|
||||
|
||||
@implementation NSObjectController
|
||||
|
||||
- (id) initWithContent: (id)content
|
||||
{
|
||||
if ((self = [super init]) != nil)
|
||||
{
|
||||
[self setContent: content];
|
||||
[self setObjectClass: [NSMutableDictionary class]];
|
||||
[self setEditable: YES];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
return [self initWithContent: nil];
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(_content);
|
||||
RELEASE(_entity_name_key);
|
||||
RELEASE(_fetch_predicate);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder *)aCoder
|
||||
{
|
||||
[super encodeWithCoder: aCoder];
|
||||
// TODO
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder *)aDecoder
|
||||
{
|
||||
self = [super initWithCoder: aDecoder];
|
||||
// TODO
|
||||
|
||||
if ([self automaticallyPreparesContent])
|
||||
{
|
||||
if ([self managedObjectContext] != nil)
|
||||
{
|
||||
[self fetch: aDecoder];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self prepareContent];
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) content
|
||||
{
|
||||
return _content;
|
||||
}
|
||||
|
||||
- (void) setContent: (id)content
|
||||
{
|
||||
ASSIGN(_content, content);
|
||||
}
|
||||
|
||||
- (Class) objectClass
|
||||
{
|
||||
return _object_class;
|
||||
}
|
||||
|
||||
- (void) setObjectClass: (Class)class
|
||||
{
|
||||
_object_class = class;
|
||||
}
|
||||
|
||||
- (id) newObject
|
||||
{
|
||||
return [[[self objectClass] alloc] init];
|
||||
}
|
||||
|
||||
- (void) prepareContent
|
||||
{
|
||||
id new = [self newObject];
|
||||
|
||||
[self setContent: new];
|
||||
RELEASE(new);
|
||||
}
|
||||
|
||||
- (BOOL) automaticallyPreparesContent
|
||||
{
|
||||
return _automatically_prepares_content;
|
||||
}
|
||||
|
||||
- (void) setAutomaticallyPreparesContent: (BOOL)flag
|
||||
{
|
||||
_automatically_prepares_content = flag;
|
||||
}
|
||||
|
||||
- (void) add: (id)sender
|
||||
{
|
||||
id new = [self newObject];
|
||||
|
||||
[self addObject: new];
|
||||
RELEASE(new);
|
||||
}
|
||||
|
||||
- (void) addObject: (id)obj
|
||||
{
|
||||
[self setContent: obj];
|
||||
// TODO
|
||||
}
|
||||
|
||||
- (void) remove: (id)sender
|
||||
{
|
||||
[self removeObject: [self content]];
|
||||
}
|
||||
|
||||
- (void) removeObject: (id)obj
|
||||
{
|
||||
if (obj == [self content])
|
||||
{
|
||||
[self setContent: nil];
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL) canAdd
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL) canRemove
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL) isEditable
|
||||
{
|
||||
return _is_editable;
|
||||
}
|
||||
|
||||
- (void) setEditable: (BOOL)flag
|
||||
{
|
||||
_is_editable = flag;
|
||||
}
|
||||
|
||||
- (NSArray*) selectedObjects
|
||||
{
|
||||
// TODO
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id) selection
|
||||
{
|
||||
// TODO
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) validateMenuItem: (id <NSMenuItem>)item
|
||||
{
|
||||
SEL action = [item action];
|
||||
|
||||
if (sel_eq(action, @selector(add:)))
|
||||
{
|
||||
return [self canAdd];
|
||||
}
|
||||
else if (sel_eq(action, @selector(remove:)))
|
||||
{
|
||||
return [self canRemove];
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSString*) entityNameKey
|
||||
{
|
||||
return _entity_name_key;
|
||||
}
|
||||
|
||||
- (void) setEntityName: (NSString*)entityName
|
||||
{
|
||||
ASSIGN(_entity_name_key, entityName);
|
||||
}
|
||||
|
||||
- (NSPredicate*) fetchPredicate
|
||||
{
|
||||
return _fetch_predicate;
|
||||
}
|
||||
|
||||
- (void) setFetchPredicate: (NSPredicate*)predicate
|
||||
{
|
||||
ASSIGN(_fetch_predicate, predicate);
|
||||
}
|
||||
|
||||
- (void) fetch: (id)sender
|
||||
{
|
||||
NSError *error;
|
||||
|
||||
[self fetchWithRequest: nil merge: NO error: &error];
|
||||
}
|
||||
|
||||
- (BOOL) fetchWithRequest: (NSFetchRequest*)fetchRequest
|
||||
merge: (BOOL)merge
|
||||
error: (NSError**)error
|
||||
{
|
||||
// TODO
|
||||
//[_managed_object_context executeFetchRequest: fetchRequest error: error];
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (NSManagedObjectContext*) managedObjectContext
|
||||
{
|
||||
return _managed_object_context;
|
||||
}
|
||||
|
||||
- (void) setManagedObjectContext: (NSManagedObjectContext*)managedObjectContext
|
||||
{
|
||||
_managed_object_context = managedObjectContext;
|
||||
}
|
||||
|
||||
@end
|
|
@ -426,7 +426,10 @@
|
|||
|
||||
- (NSUndoManager*) undoManager
|
||||
{
|
||||
return nil;
|
||||
if (_next_responder)
|
||||
return [_next_responder undoManager];
|
||||
else
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (BOOL) shouldBeTreatedAsInkEvent: (NSEvent *)theEvent
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#include <Foundation/NSRunLoop.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSTimer.h>
|
||||
#include <Foundation/NSUndoManager.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
#include "AppKit/NSApplication.h"
|
||||
#include "AppKit/NSClipView.h"
|
||||
|
@ -2336,10 +2337,11 @@ TextDidEndEditing notification _without_ asking the delegate
|
|||
- (BOOL) shouldChangeTextInRange: (NSRange)affectedCharRange
|
||||
replacementString: (NSString *)replacementString
|
||||
{
|
||||
BOOL result = YES;
|
||||
|
||||
if (_tf.is_editable == NO)
|
||||
return NO;
|
||||
|
||||
|
||||
/*
|
||||
We need to send the textShouldBeginEditing: /
|
||||
textDidBeginEditingNotification only once.
|
||||
|
@ -2359,12 +2361,41 @@ TextDidEndEditing notification _without_ asking the delegate
|
|||
|
||||
if (_tf.delegate_responds_to_should_change)
|
||||
{
|
||||
return [_delegate textView: self
|
||||
shouldChangeTextInRange: affectedCharRange
|
||||
replacementString: replacementString];
|
||||
result = [_delegate textView: self
|
||||
shouldChangeTextInRange: affectedCharRange
|
||||
replacementString: replacementString];
|
||||
}
|
||||
|
||||
return YES;
|
||||
if (result && [self allowsUndo])
|
||||
{
|
||||
NSUndoManager *undo;
|
||||
NSRange undoRange;
|
||||
NSAttributedString *undoString;
|
||||
|
||||
// FIXME: Not sure, if this rather belongs into a local implementation of
|
||||
// the method undoManager.
|
||||
if (![_delegate respondsToSelector: @selector(undoManagerForTextView:)]
|
||||
|| ((undo = [_delegate undoManagerForTextView: self]) == nil))
|
||||
{
|
||||
undo = [self undoManager];
|
||||
}
|
||||
|
||||
// The length of the undoRange is the length of the replacement, if any.
|
||||
if (replacementString != nil)
|
||||
{
|
||||
undoRange = NSMakeRange(affectedCharRange.location,
|
||||
[replacementString length]);
|
||||
}
|
||||
else
|
||||
{
|
||||
undoRange = affectedCharRange;
|
||||
}
|
||||
undoString = [self attributedSubstringFromRange: affectedCharRange];
|
||||
[[undo prepareWithInvocationTarget: self] replaceCharactersInRange: undoRange
|
||||
withAttributedString: undoString];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
114
Source/NSUserDefaultsController.m
Normal file
114
Source/NSUserDefaultsController.m
Normal file
|
@ -0,0 +1,114 @@
|
|||
/** <title>NSUserDefaultsController</title>
|
||||
|
||||
<abstract>Controller class for user defaults</abstract>
|
||||
|
||||
Copyright <copy>(C) 2006 Free Software Foundation, Inc.</copy>
|
||||
|
||||
Author: Fred Kiefer <fredkiefer@gmx.de>
|
||||
Date: September 2006
|
||||
|
||||
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 <Foundation/NSDictionary.h>
|
||||
#include <Foundation/NSUserDefaults.h>
|
||||
#include <AppKit/NSUserDefaultsController.h>
|
||||
|
||||
static id shared = nil;
|
||||
|
||||
@implementation NSUserDefaultsController
|
||||
|
||||
+ (id) sharedUserDefaultsController
|
||||
{
|
||||
if (shared == nil)
|
||||
{
|
||||
shared = [[NSUserDefaultsController alloc]
|
||||
initWithDefaults: nil
|
||||
initialValues: nil];
|
||||
}
|
||||
return shared;
|
||||
}
|
||||
|
||||
- (id) initWithDefaults: (NSUserDefaults*)defaults
|
||||
initialValues: (NSDictionary*)initialValues
|
||||
{
|
||||
if ((self = [super init]) != nil)
|
||||
{
|
||||
if (defaults == nil)
|
||||
{
|
||||
defaults = [NSUserDefaults standardUserDefaults];
|
||||
}
|
||||
|
||||
ASSIGN(_defaults, defaults);
|
||||
[self setInitialValues: initialValues];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSUserDefaults*) defaults
|
||||
{
|
||||
return _defaults;
|
||||
}
|
||||
|
||||
- (id) values
|
||||
{
|
||||
// TODO
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSDictionary*) initialValues
|
||||
{
|
||||
return _initial_values;
|
||||
}
|
||||
|
||||
- (void) setInitialValues: (NSDictionary*)values
|
||||
{
|
||||
ASSIGN(_initial_values, values);
|
||||
}
|
||||
|
||||
- (BOOL) appliesImmediately
|
||||
{
|
||||
return _applies_immediately;
|
||||
}
|
||||
|
||||
- (void) setAppliesImmediately: (BOOL)flag
|
||||
{
|
||||
_applies_immediately = flag;
|
||||
}
|
||||
|
||||
- (void) revert: (id)sender
|
||||
{
|
||||
[self discardEditing];
|
||||
if (![self appliesImmediately])
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
- (void) revertToInitialValues: (id)sender
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
- (void) save: (id)sender
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
@end
|
|
@ -2693,6 +2693,36 @@ resetCursorRectsForView(NSView *theView)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Get a undo manager from the delegate or create one.
|
||||
*/
|
||||
- (NSUndoManager*) undoManager
|
||||
{
|
||||
NSUndoManager *undo;
|
||||
|
||||
if ([_delegate respondsToSelector: @selector(windowWillReturnUndoManager:)])
|
||||
{
|
||||
return [_delegate windowWillReturnUndoManager: self];
|
||||
}
|
||||
else
|
||||
{
|
||||
// FIXME: This is more a hack to get an undo manager.
|
||||
if (_windowController)
|
||||
{
|
||||
NSDocument *document = [_windowController document];
|
||||
|
||||
if (document && (undo = [document undoManager]) != nil)
|
||||
{
|
||||
return undo;
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: We should reuse the same undo manager all the time!!!
|
||||
//return AUTORELEASE([[NSUndoManager alloc] init]);
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
If YES, then the window is released when the close method is called.
|
||||
*/
|
||||
|
|
|
@ -490,6 +490,16 @@ const NSWindowDepth _GSWindowDepths[7] = { 258, 264, 514, 516, 517, 520, 0 };
|
|||
|
||||
/* End of color functions externs */
|
||||
|
||||
// NSKeyValueBinding
|
||||
NSString *NSObservedObjectKey = @"NSObservedObjectKey";
|
||||
NSString *NSObservedKeyPath = @"NSObservedKeyPath";
|
||||
NSString *NSOptionsKey = @"NSOptionsKey";
|
||||
// FIXME: Need to defined!
|
||||
id NSMultipleValuesMarker = nil;
|
||||
id NSNoSelectionMarker = nil;
|
||||
id NSNotApplicableMarker = nil;
|
||||
|
||||
|
||||
extern void __objc_gui_force_linking (void);
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue