Merge branch 'master' of github.com:gnustep/libs-gui into NSPopover_issue168

This commit is contained in:
Gregory John Casamento 2024-05-10 23:03:14 -04:00
commit 42d6fb9466
111 changed files with 3082 additions and 1055 deletions

6
.gitignore vendored
View file

@ -13,6 +13,7 @@ gnustep-gui-debug.spec
gui.make
Headers/Additions/GNUstepGUI/GSVersion.h
Source/config.h
Source/gnustep-gui.pc
Source/Info-gnustep.plist
Tests/gui/*/GNUmakefile
Tools/speech/GSSpeechServer.app
@ -61,3 +62,8 @@ DerivedData/
**/xcshareddata/WorkspaceSettings.xcsettings
# End of https://www.gitignore.io/api/xcode
compile_commands.json
**/.cache
**/.vscode

View file

@ -2,5 +2,4 @@
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.
* @gcasa
* @fredkeifer
* @fredkiefer

View file

@ -1,3 +1,55 @@
2024-03-18 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTextView.m: Add support for NSFilenamenPboardType.
Change by OnFlApp (https://githup.com/onflapp)
2023-12-28 Fred Kiefer <FredKiefer@gmx.de>
* Documentation/manual/AppKit.texi: Move table of contents outside
of title page. This fixes building the documentation with newer texinfo.
2023-12-27 Gregory John Casamento <greg.casamento@gmail.com>
* Headers/AppKit/NSView.h: Add ivar for NSShadow, update
version of class for NSArchiver so this can be properly
read and saved in .gorm files.
* Source/GSXib5KeyedUnarchiver.m: Add code to handle XIB
keys for NSShadow.
* Source/NSShadow.m: Minor cleanup to use ASSIGN macro
in -initWithCoder:
* Source/NSView.m: Add code to -encodeWithCoder: and
-initWithCoder: to properly handle NSViewShadow.
2023-11-27 Gregory John Casamento <greg.casamento@gmail.com>
* Source/GSGormLoading.m
* Source/GSNibLoading.m
* Source/GSXibLoading.m: Remove calls to respondsToSelector:
for awakeFromNib. This method is now implemented on a
category on NSObject called NSNibAwaking. Also add a
call to prepareForInterfaceBuilder when we are in Gorm/IB.
2023-11-25 Gregory John Casamento <greg.casamento@gmail.com>
* Documentation/manual/applicationmakefiles.texi: Update
documentation.
* Documentation/manual/gnustepapplication.texi: Update
documentation. Update installation path default.
* Documentation/manual/interfacefiles.texi: Update
documentation. Add information about model files (xib,
nib, etc).
* Documentation/manual/intro.texi: Update
documentation. Add information about themes.
2023-11-25 Gregory John Casamento <greg.casamento@gmail.com>
* Headers/AppKit/NSNibLoading.h: Add declaration for
-prepareForInterfaceBuilder to NSNibLoading category.
* Source/NSNib.m: Add new empty method implementation for
-awakeFromNib and -prepareForInterfaceBuilder to NSNibLoading
category on NSObject.
* Source/NSView.m: Remove empty implementation of awakeFromNib.
2023-09-05 Richard Frith-Macdonald <rfm@gnu.org>
* Source/DocMakefile: Fix issue #198 ... headers had added a new

View file

@ -3,13 +3,7 @@
<gsdoc base="Gui">
<head>
<title>Gui</title>
<author name="Richard Frith-Macdonald">
<email address="rfm@gnu.org"/>
<url url="http://www.gnustep.org/developers/whoiswho.html"/>
</author>
<version>$Revision$</version>
<date>$Date$</date>
<copy>2005 Free Software Foundation, Inc.</copy>
<copy>1996-2023 Free Software Foundation, Inc.</copy>
</head>
<body>
<chapter>

View file

@ -98,8 +98,8 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@author Christopher Armstrong
@page
@insertcopying
@contents
@end titlepage
@contents
@end iftex
@c %** Contents of file, one file per chapter

View file

@ -54,7 +54,7 @@ include $(GNUSTEP_MAKEFILES)/application.make
@file{common.make} and @file{application.make} are necessary to build an application, and need to be at the beginning and end respectively to the Makefile to operate properly. The @file{GNUmakefile.preamble} and @file{GNUmakefile.postamble} are optional, and permit you to define extra rules for building your application. You can include those lines without those files containing anything. Templates for those files also exist with the source code for gnustep-gui, which can simply be copied into your project and modified accordingly.
The table below describes the makefile variables that you can set to control the output of the make process. Note that @var{appname} refers to the application name that you set with @code{APP_NAME}. It is case sensistive and so are file names. Also, most of the variables listed below are optional if you wish to get a program to compile, but it is recommend you make use of them where appropriate. Where variables ask for flags and compiler options, they should be in the format that @command{gcc} expects, as it is the only compiler currently used with GNUstep. Many variables also take more than one parameter. They are usually separated by a space, and line breaks with a backslash. Please refer to the @cite{GNUstep Makefile Manual} for more details.
The table below describes the makefile variables that you can set to control the output of the make process. Note that @var{appname} refers to the application name that you set with @code{APP_NAME}. It is case sensistive and so are file names. Also, most of the variables listed below are optional if you wish to get a program to compile, but it is recommend you make use of them where appropriate. Where variables ask for flags and compiler options, they should be in the format that @command{gcc} or @command{clang} expects, these the only compilers currently used with GNUstep. Many variables also take more than one parameter. They are usually separated by a space, and line breaks with a backslash. Please refer to the @cite{GNUstep Makefile Manual} for more details.
@cindex makefiles, components
@table @code
@ -87,7 +87,7 @@ A version number for your application.
[Optional] This is where you list your C++ files (*.cpp, *.cc) to be compiled into your programme. It takes the same form as @code{@var{appname}_OBJC_FILES}.
@item @var{appname}_OBJCC_FILES
[Optional] This is where you list your Objective-C++ files (*.mm) to be compiled into your programme. It takes the same form as the @code{@var{appname}_OBJC_FILES}.@footnote{You will need gcc 4.1 or higher to compile Objective-C++ programmes. This feature of the gcc compiler is quite new and has not been well tested.}
[Optional] This is where you list your Objective-C++ files (*.mm) to be compiled into your programme. It takes the same form as the @code{@var{appname}_OBJC_FILES}.@footnote{You will need either clang or gcc 4.1 or higher to compile Objective-C++ programmes.}
@item @var{appname}_RESOURCE_FILES
[Recommended] Here you list the @dfn{resource files} that are to be included with your application, including your application property list, interface file(s) and other images, data, etc. You can also list directories here, which should be added recursively (e.g. @file{.gorm} files are actually a directory containing three files, used to describe your interface).

View file

@ -120,11 +120,13 @@ Startup your shell and source GNUstep.sh from your GNUstep installation (if it's
> cd ~
> mkdir firstapp
> cd firstapp
> . /usr/lib/GNUstep/System/Library/Makefiles/GNUstep.sh
> . /usr/GNUstep/System/Library/Makefiles/GNUstep.sh
>
@end smallexample
In the above, we simply created a new directory under our home directory called @file{firstapp}, changed into it and sourced our GNUstep installation (which in this case is under @file{/usr/lib}@footnote{Replace @file{/usr/lib} with the path to your GNUstep installation}).
Your prefix could be different than this example.
In the above, we simply created a new directory under our home directory called @file{firstapp}, changed into it and sourced our GNUstep installation (which in this case is under @file{/usr/GNUstep}@footnote{Replace @file{/usr/GNUstep} with the path to your GNUstep installation}).
Next we will create our makefile. Using your favourite editor, create a file called @file{GNUmakefile} (the case is important). In this case we're using @command{vim}:
@smallexample

View file

@ -25,10 +25,26 @@
@chapter Interface Files
@cindex interface files, definition
@dfn{Interface files} are used to store your applications graphical user interface. It's separation means that you can modify it more easily than other interface generation mechanisms, such as code generators, which generate code that makes it hard to modify the interface or requires you to rewrite your own code. The advantage of a separate interface file is that you can change the interface without having to recompile one bit of code (in most instances).
@dfn{Interface files} are used to store your applications graphical user interface. This separation means that you can modify it more easily than other interface generation mechanisms, such as code generators, that make it hard to modify the interface or requires you to rewrite your own code. The advantage of a separate interface file is that you can change the interface without having to recompile one bit of code (in most instances).
@cindex nibs
Interface files are often referred to as "nib" files.@footnote{This is a throwback to the origin's of the GNUstep framework, where it's API specification (OpenStep) was based on NeXTStep, which used "nib" files (NeXT Inteface Builder) to store interfaces.} These are not the same as those appearing on NeXT and MacOS X systems, and are completely incompatible (tagged XML nib's may change this in future). This section is very important to understanding key concepts in the AppKit, especially with regards to manipulation of your user interface. It is strongly recommended you do not skip this section, and refer back to it if you do not understand anything, even if you don't intend to use Gorm (also not recommended).
@cindex nibs (and other models)
Interface files are often referred to as "nib" (or, more generally, model) files.@footnote{This is a throwback to the origin's of the GNUstep framework, when it's API specification (OpenStep) was based on NeXTStep, which used typedstream "nib" files (NeXT Inteface Builder) to store interfaces.} XML nib files after 10.2.x are usable by GNUstep, early nib files are ``typedstream'' style nibs which cannot be read by GNUstep. The framework can read other formats as detailed below. This section is very important to understanding key concepts in the AppKit, especially with regards to manipulation of your user interface. It is strongly recommended you do not skip this section, and refer back to it if you do not understand anything, even if you don't intend to use Gorm (also not recommended).
The different types of models which are usable by GNUstep are:
@table @code
@item .gorm
.gorm files are the native format that is used by GNUstep, these are encoded and decoded in the Foundation / AppKit classes themselves. This is Gorm's native format.
@item .gmodel
.gmodel files are .plist based model files that are usually created using the deprecated nib2gmodel tool. Interestingly, the .gmodel format is structally similar to the .nib XML format even though it predates it by several years. These files can be loaded, but not saved by Gorm.
@item .nib
.nib files that are 10.2.x+ are readable by GNUstep and also in Gorm. XML nib files are referential models as everything is contained in a master array and referred to by other objects. These files can be loaded, but not saved by Gorm. These are different than typedstream .nib files which are entirely binary. The issue with reading typedstream nibs is that the format is not well documented.
@item .xib
.xib files are the XML based model file created by Xcode and InterfaceBuilder 3+. These model files are a ``compositional'' XML model as opposed the XML nib files which ae ``referential'' the difference is that in a xib, for instance, a view XML object contains all of its subviews. In an XML nib, they are referred to in a master array. XIB files can be loaded and (experimentally) saved in the Gorm application.
@end table
@section Using Gorm
@cindex Gorm
@ -58,7 +74,7 @@ Connections has three panes: the outlets, actions and object connections that yo
Lets you modify the size using numbers, and the resizing data for this object (the springs at the bottom). See the Gorm manual for more details on this pane.
@item Help
Help related to this object type. Still being completed.
Help related to this object type. This inspector is used to specify the ToolTip associated with the selected item.
@item Custom class
Let's you set the class for this object manually (NOTE: this only appears for some objects where it is possible to set a custom class).

View file

@ -20,7 +20,7 @@ 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
portion of the OpenStep / Cocoa API. 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
@ -34,6 +34,40 @@ 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.
The backend is divided into two parts: graphical and event handling. The
graphical portion renders the widgets based on code in the AppKit/GUI
framework. The events portion processes the events from mouse and
keyboard input. Both portions are operating system / environment
specific.
The backends supported by GNUstep currently are:
@table @command
@item Cairo
The Cairo backend uses the more postscript like rendering of the cairo
graphics library (available from opendesktop.org) to render.
@item Win32 / GDI
This backend uses GDI to render the widgets.
@item Wayland
This backend uses the Wayland display technology to render. This is
an expermental backend at present.
@item Art
The art backend uses libart (the LGPL version) to render the widgets.
This backend is deprecated.
@item Xlib
The Xlib backend is the bare X11 backend that uses primitive calls to
render the objects. This backend is deprecated.
@end table
In general, GNUstep GUI can theoretically be used on any system on which
you can build a backend. Currently, you can build on most UNIX systems
(not Darwin, currently) as well as Windows under MSYS2 and MSVC.
@section Implementation Details
Following are some implementation details of the GUI library. These will
@ -75,6 +109,53 @@ 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 Theming
GNUstep implements Theming via the GSTheme class. This class can be subclassed
to override the existing drawing being done by the widgets. Each widget has
a category in this class in which the drawing for that widget is done. There are
two types of theme: code and non-code...
@table @command
@item Code
Code themes, for example, the WinUXTheme, use code to override specific things in
the GSTheme class so that the theme can display using the native widgets. These
can be combined with custom widgets as well as color and image settings.
@item Non-code
Non-code themes use .plist files (which can also be used in code based themes) to
override standard images and color settings in GNUstep.
@end table
Theming is extremely flexible. GNUstep can be made to blend into most environments.
The application to modify themes is called Thematic.
You can set the theme using the follow command:
@example
defaults write NSGlobalDomain GSTheme THEMENAME
@end example
Where THEMENAME is the name of the theme installed. The locations for themes are:
@table @samp
@item PREFIX/System/Library/Themes
System themes
@item PREFIX/Local/Library/Themes
Locally installed themes
@item ~/GNUstep/Library/Themes
User installed themes
@end table
Where PREFIX is whatever prefix that was specified when building GNUstep. Usually
this is /usr/GNUstep, /usr/local/GNUstep, or /.
@subsection NSWorkspace
Here is (I think) the current state of the code (largely untested) -

View file

@ -249,10 +249,12 @@
@class NSColorWell;
@class NSImage;
@class NSMenuItemCell;
@class NSOutlineView;
@class NSPopUpButtonCell;
@class NSMenuView;
@class NSProgressIndicator;
@class NSTableHeaderCell;
@class NSTableView;
@class NSTabViewItem;
@class NSPathControl;
@class NSPathComponentCell;
@ -1266,6 +1268,12 @@ APPKIT_EXPORT_CLASS
tabViewType: (NSTabViewType)type
tabView: (NSTabView *)view;
- (NSImage *) imageForTabPart: (GSTabPart)part
type: (NSTabViewType)type;
- (NSRect) tabViewBackgroundRectForBounds: (NSRect)aRect
tabViewType: (NSTabViewType)type;
- (void) drawTabViewRect: (NSRect)rect
inView: (NSView *)view
withItems: (NSArray *)items
@ -1331,7 +1339,17 @@ APPKIT_EXPORT_CLASS
- (void) drawTableViewRow: (NSInteger)rowIndex
clipRect: (NSRect)clipRect
inView: (NSView *)view;
inView: (NSTableView *)view;
- (void) drawCellViewRow: (NSInteger)rowIndex
clipRect: (NSRect)clipRect
inView: (NSTableView *)v;
- (void) drawOutlineViewRow: (NSInteger)rowIndex
clipRect: (NSRect)clipRect
inView: (NSOutlineView *)view;
- (BOOL) isBoxOpaque: (NSBox *)box;
- (void) drawBoxInClipRect: (NSRect)clipRect
boxType: (NSBoxType)boxType

View file

@ -18,9 +18,6 @@
/* Define to 1 if you have the <flite/flite.h> header file. */
#undef HAVE_FLITE_FLITE_H
/* Define to 1 if you have the pocketsphinx.h header file */
#undef HAVE_POCKETSPHINX_POCKETSPHINX_EXPORT_H
/* Define to 1 if you have the `floorf' function. */
#undef HAVE_FLOORF
@ -78,6 +75,10 @@
/* Define to 1 if you have the <png.h> header file. */
#undef HAVE_PNG_H
/* Define to 1 if you have the <pocketsphinx/pocketsphinx_export.h> header
file. */
#undef HAVE_POCKETSPHINX_POCKETSPHINX_EXPORT_H
/* Define to 1 if you have the `QuantizeBuffer' function. */
#undef HAVE_QUANTIZEBUFFER
@ -144,7 +145,10 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* mnt_fsname structure member name */
/* MagickCore >= 7 */
#undef MAGICKCORE_7_OR_NEWER
/* mntent structure member name */
#undef MNT_FSNAME
/* mntent structure member name */

View file

@ -243,10 +243,13 @@
#import <AppKit/NSSwitch.h>
#import <AppKit/NSSplitViewController.h>
#import <AppKit/NSSplitViewItem.h>
#import <AppKit/NSTableCellView.h>
#import <AppKit/NSTableColumn.h>
#import <AppKit/NSTableHeaderCell.h>
#import <AppKit/NSTableHeaderView.h>
#import <AppKit/NSTableRowView.h>
#import <AppKit/NSTableView.h>
#import <AppKit/NSTableViewRowAction.h>
#import <AppKit/NSTabView.h>
#import <AppKit/NSTabViewController.h>
#import <AppKit/NSTabViewItem.h>

View file

@ -36,7 +36,7 @@
#ifdef GNUSTEP_WITH_DLL
#if BUILD_libgnustep_gui_DLL
#
# if defined(__MINGW__)
/* On Mingw, the compiler will export all symbols automatically, so
* __declspec(dllexport) is not needed.
@ -72,7 +72,7 @@
#endif
#ifdef __clang__
#if defined(__clang__) && !defined(__MINGW32__)
# define PACKAGE_SCOPE @package
#else
# define PACKAGE_SCOPE @public

View file

@ -472,6 +472,7 @@ static inline void
DPSWriteData(GSCTXT *ctxt, const char * buf, unsigned int count)
__attribute__((unused));
/** <ignore> These are duplicate definitions for MSVC, let's ignore them for autogsdoc */
#ifdef _MSC_VER
#define DPS_FUNCTION(type, name) static inline type \
name(GSCTXT *ctxt) \
@ -589,7 +590,8 @@ name(GSCTXT *ctxt, type1 var1, type2 var2, type3 var3, type4 var4, type5 var5, t
(ctxt->methods->name ## ________) \
(ctxt, @selector(name: : : : : : : :), var1, var2, var3, var4, var5, var6, var7, var8); \
}
#endif
#endif // _MSVC_VER
/** </ignore> */
/* ----------------------------------------------------------------------- */
/* Color operations */

View file

@ -28,6 +28,7 @@
#ifndef _GNUstep_H_NSAlert
#define _GNUstep_H_NSAlert
#import <AppKit/NSWindow.h>
#import <AppKit/AppKitDefines.h>
#import <Foundation/NSObject.h>
@ -49,12 +50,6 @@ enum _NSAlertStyle {
};
typedef NSUInteger NSAlertStyle;
enum {
NSAlertFirstButtonReturn = 1000,
NSAlertSecondButtonReturn = 1001,
NSAlertThirdButtonReturn = 1002
};
APPKIT_EXPORT_CLASS
@interface NSAlert : NSObject
{
@ -106,6 +101,11 @@ APPKIT_EXPORT_CLASS
- (BOOL) showsHelp;
- (id) window;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_9, GS_API_LATEST)
- (void) beginSheetModalForWindow:(NSWindow *)sheetWindow
completionHandler:(GSNSWindowDidEndSheetCallbackBlock)handler;
#endif
@end

View file

@ -215,7 +215,7 @@ APPKIT_EXPORT_CLASS
- (void) setDelegate: (id)delegate;
/** Sets the duration of the animation to a specified number of seconds.
If the duration is changed while the animation is running the <i>speed</i>
If the duration is changed while the animation is running the <em>speed</em>
of the animation is not changed but the current progress value is
(see [-setCurrentprogress]). The new value takes effect at the next
frame. */

View file

@ -81,5 +81,23 @@ APPKIT_EXPORT NSAppearanceName const NSAppearanceNameLightContent;
#endif /* GS_API_MACOSX */
@protocol NSAppearanceCustomization
#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST)
@required
#if GS_HAS_DECLARED_PROPERTIES
/** Set the appearance of the reciever. Default is nil. */
@property(retain) NSAppearance* appearance;
/** Get the appearance of the reciever. If self.appearance is nil, then go up the
view hierarchy to find an appearance. If still nil, go up to NSApp. If still nil,
go up to [NSAppearance currentAppearance]. */
@property(readonly, retain) NSAppearance* effectiveAppearance;
#else
- (NSAppearance*) appearance;
- (void) setAppearance: (NSAppearance*) appearance;
- (NSAppearance*) effectiveAppearance;
#endif
#endif
@end
#endif /* _NSAppearance_h_GNUSTEP_GUI_INCLUDE */

View file

@ -41,12 +41,14 @@
#import <AppKit/NSResponder.h>
#import <AppKit/NSUserInterfaceValidation.h>
#import <AppKit/NSWindow.h>
#if defined(__cplusplus)
extern "C" {
#endif
@class NSArray;
@class NSAppearance;
@class NSDate;
@class NSError;
@class NSException;
@ -228,6 +230,7 @@ APPKIT_EXPORT_CLASS
NSWindow *_hidden_key;
NSWindow *_hidden_main;
GSInfoPanel *_infoPanel;
NSAppearance *_appearance;
NSApplicationPresentationOptions _presentationOptions;
/* This autorelease pool should only be created and used by -run, with
@ -780,16 +783,6 @@ NSShowSystemInfoPanel(NSDictionary *options);
*/
APPKIT_EXPORT NSApplication *NSApp;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
enum
{
NSModalResponseStop = -1000,
NSModalResponseAbort = -1001,
NSModalResponseContinue = -1002
};
typedef NSInteger NSModalResponse;
#endif
#if defined(__cplusplus)
}
#endif

View file

@ -171,7 +171,9 @@ enum {
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
enum {
NSBackgroundStyleLight = 0,
NSBackgroundStyleNormal = 0,
NSBackgroundStyleDark = 1,
NSBackgroundStyleEmphasized = 1,
NSBackgroundStyleRaised = 2,
NSBackgroundStyleLowered = 3
};

View file

@ -56,7 +56,7 @@ APPKIT_EXPORT_CLASS
- (NSSize) minimumItemSize;
- (void) setMaximumItemSize: (NSSize)maxSize;
- (NSSize) maximumItemSize;;
- (NSSize) maximumItemSize;
- (void) setMargins: (NSEdgeInsets)insets;
- (NSEdgeInsets) margins;

View file

@ -101,7 +101,9 @@ APPKIT_EXPORT_CLASS
@optional
#endif
#else
/** <ignore> */
@interface NSObject (NSComboBoxDataSource)
/** </ignore> */
#endif
- (NSInteger) numberOfItemsInComboBox: (NSComboBox *)aComboBox;
- (id) comboBox: (NSComboBox *)aComboBox objectValueForItemAtIndex:(NSInteger)index;
@ -120,7 +122,9 @@ APPKIT_EXPORT_CLASS
@optional
#endif
#else
/** <ignore> */
@interface NSObject (NSComboBoxNotifications)
/** </ignore> */
#endif
- (void) comboBoxWillPopUp: (NSNotification *)notification;
- (void) comboBoxWillDismiss: (NSNotification *)notification;

View file

@ -91,6 +91,11 @@ enum _NSEventType {
NSApplicationDefined,
NSPeriodic,
NSCursorUpdate,
// NSEventTypeCursorUpdate = 17,
// NSEventTypeRotate = 18,
// NSEventTypeBeginGesture = 19,
// NSEventTypeEndGesture = 20,
// (not defined) = 21,
NSScrollWheel = 22,
#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST)
NSTabletPoint,
@ -98,7 +103,46 @@ enum _NSEventType {
#endif
NSOtherMouseDown = 25,
NSOtherMouseUp,
NSOtherMouseDragged
NSOtherMouseDragged,
#if OS_API_VERSION(MAC_OS_X_VERSION_10_12, GS_API_LATEST)
NSEventTypeLeftMouseDown = 1,
NSEventTypeLeftMouseUp = 2,
NSEventTypeRightMouseDown = 3,
NSEventTypeRightMouseUp = 4,
NSEventTypeMouseMoved = 5,
NSEventTypeLeftMouseDragged = 6,
NSEventTypeRightMouseDragged = 7,
NSEventTypeMouseEntered = 8,
NSEventTypeMouseExited = 9,
NSEventTypeKeyDown = 10,
NSEventTypeKeyUp = 11,
NSEventTypeFlagsChanged = 12,
NSEventTypeAppKitDefined = 13,
NSEventTypeSystemDefined = 14,
NSEventTypeApplicationDefined = 15,
NSEventTypePeriodic = 16,
NSEventTypeCursorUpdate = 17,
NSEventTypeRotate = 18,
NSEventTypeBeginGesture = 19,
NSEventTypeEndGesture = 20,
// (not defined) = 21,
NSEventTypeScrollWheel = 22,
NSEventTypeTabletPoint = 23,
NSEventTypeTabletProximity = 24,
NSEventTypeOtherMouseDown = 25,
NSEventTypeOtherMouseUp = 26,
NSEventTypeOtherMouseDragged = 27,
// (not defined) = 28,
NSEventTypeGesture = 29,
NSEventTypeMagnify = 30,
NSEventTypeSwipe = 31,
NSEventTypeSmartMagnify = 32,
NSEventTypeQuickLook = 33,
NSEventTypePressure = 34,
// (not defined) = 35~37
NSEventTypeDirectTouch = 37,
NSEventTypeChangeMode = 38,
#endif
};
typedef NSUInteger NSEventType;
@ -183,7 +227,17 @@ enum {
NSCommandKeyMask = 16 << 16,
NSNumericPadKeyMask = 32 << 16,
NSHelpKeyMask = 64 << 16,
NSFunctionKeyMask = 128 << 16
NSFunctionKeyMask = 128 << 16,
#if OS_API_VERSION(MAC_OS_X_VERSION_10_12, GS_API_LATEST)
NSEventModifierFlagCapsLock = NSAlphaShiftKeyMask,
NSEventModifierFlagShift = NSShiftKeyMask,
NSEventModifierFlagControl = NSControlKeyMask,
NSEventModifierFlagOption = NSAlternateKeyMask,
NSEventModifierFlagCommand = NSCommandKeyMask,
NSEventModifierFlagNumericPad = NSNumericPadKeyMask,
NSEventModifierFlagFunction = NSFunctionKeyMask,
NSEventModifierFlagDeviceIndependentFlagsMask = NSDeviceIndependentModifierFlagsMask,
#endif
};
typedef NSUInteger NSEventModifierFlags;

View file

@ -49,6 +49,7 @@
@class NSSet;
@class NSBitmapImageRep;
@class NSGradient;
@class NSShadow;
typedef struct CGContext *CGContextRef;
@ -188,6 +189,7 @@ APPKIT_EXPORT_CLASS
void *_graphicsPort;
BOOL _isFlipped;
NSCompositingOperation _compositingOperation;
NSShadow *_shadow;
}
+ (BOOL) currentContextDrawingToScreen;
@ -268,6 +270,11 @@ APPKIT_EXPORT NSGraphicsContext *GSCurrentContext(void);
/* Private backend methods */
+ (void) handleExposeRect: (NSRect)rect forDriver: (void *)driver;
/* Private method for handling shadows */
- (void) setShadow: (NSShadow *)shadow;
- (NSShadow *) shadow;
@end
#endif

View file

@ -64,6 +64,9 @@ APPKIT_EXPORT_CLASS
- (BOOL)allowsCutCopyPaste;
- (void)setAllowsCutCopyPaste:(BOOL)flag;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_12, GS_API_LATEST)
+ (instancetype) imageViewWithImage: (NSImage *)image;
#endif
@end

View file

@ -436,9 +436,14 @@ APPKIT_EXPORT_CLASS
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
// Provided for source compatibility with GNUstep-specific code.
// This method is just an alternate name for popUpMenuPositioningItem:atLocation:inView:
- (void) popUpMenuPositionItem: (NSMenuItem *)item
atLocation: (NSPoint) point
inView: (NSView *) view;
- (void) popUpMenuPositioningItem: (NSMenuItem *)item
atLocation: (NSPoint) point
inView: (NSView *) view;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_2, GS_API_LATEST)

View file

@ -47,6 +47,15 @@
*/
- (void) awakeFromNib;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_8, GS_API_LATEST)
/**
* This method is called on a designable object to notify it that it
* was created at design time. This allows IB/Gorm to set up the
* appearance of the object when loaded into the editor.
*/
- (void) prepareForInterfaceBuilder;
#endif
@end

View file

@ -297,6 +297,23 @@ willDisplayOutlineCell: (id)cell
didClickTableColumn: (NSTableColumn *)aTableColumn;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
- (NSView *) outlineView: (NSOutlineView *)outlineView
viewForTableColumn: (NSTableColumn *)aTableColumn
item: (id)item;
- (NSTableRowView *) outlineView: (NSOutlineView *)outlineView
rowViewForItem: (id)item;
- (void) outlineView: (NSOutlineView *)outlineView
didAddRowView: (NSTableRowView *)rowView
forRow: (NSInteger)rowIndex;
- (void) outlineView: (NSOutlineView *)outlineView
didRemoveRowView: (NSTableRowView *)rowView
forRow: (NSInteger)rowIndex;
#endif
@end
#endif /* _GNUstep_H_NSOutlineView */

View file

@ -33,6 +33,7 @@
#import <AppKit/AppKitDefines.h>
#import <AppKit/NSView.h>
#import <AppKit/NSScroller.h>
enum
{
@ -76,6 +77,8 @@ APPKIT_EXPORT_CLASS
BOOL _autohidesScrollers;
NSScrollElasticity _horizScrollElasticity;
NSScrollElasticity _vertScrollElasticity;
NSScrollerStyle _scrollerStyle;
NSScrollerKnobStyle _scrollerKnobStyle;
}
/* Calculating layout */
@ -188,6 +191,19 @@ APPKIT_EXPORT_CLASS
/* Arranging components */
- (void)tile;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
/** The scroller style. By default, NSScrollerStyleDefault. */
- (NSScrollerStyle)scrollerStyle;
/** Sets the scroller style. In the default theme, this must be NSScrollerStyleDefault. */
- (void)setScrollerStyle:(NSScrollerStyle)style;
/** The scroller knob style. By default, NSScrollerStyleDefault. */
- (NSScrollerKnobStyle)scrollerKnobStyle;
/** Sets the scroller knob style. In the default theme, this must be NSScrollerKnobStyleDefault. */
- (void)setScrollerKnobStyle:(NSScrollerKnobStyle)style;
/** Shows the scrollers if they're overlay scrollers. */
- (void)flashScrollers;
#endif
@end
#endif /* _GNUstep_H_NSScrollView */

View file

@ -104,10 +104,33 @@ APPKIT_EXPORT_CLASS
unsigned control_tint: 3;
unsigned control_size: 2;
} _scFlags;
NSScrollerStyle _scrollerStyle;
NSScrollerKnobStyle _knobStyle;
}
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
+ (NSScrollerStyle)preferredScrollerStyle;
/** The scroller style. By default, NSScrollerStyleDefault.
If your theme implements other scroller styles, you must override this method.
You may use the ivar _scrollerStyle for this. */
- (NSScrollerStyle)scrollerStyle;
/** Sets the scroller style. In the default theme, this must be NSScrollerStyleDefault.
If your theme implements other scroller styles, you must override this method.
You may use the ivar _scrollerStyle for this. */
- (void)setScrollerStyle:(NSScrollerStyle)style;
/** The scroller knob style. By default, NSScrollerStyleDefault.
If your theme implements other scroller styles, you must override this method.
You may use the ivar _knobStyle for this. */
- (NSScrollerKnobStyle)knobStyle;
/** Sets the scroller knob style. In the default theme, this must be NSScrollerKnobStyleDefault.
If your theme implements other scroller knob styles, you must override this method.
You may use the ivar _scrollerKnobStyle for this. */
- (void)setKnobStyle:(NSScrollerKnobStyle)style;
#endif
#if GS_API_VERSION(013000,GS_API_LATEST)
/** Shows the scroller if it's an overlay scroller.
If your theme supports overlay scrollers, you must override this method. */
- (void)flashScroller;
#endif
//

View file

@ -109,7 +109,13 @@ APPKIT_EXPORT_CLASS
@end
#endif
@protocol NSSplitViewDelegate <NSObject>
#if GS_PROTOCOLS_HAVE_OPTIONAL
@optional
#else
@end
@interface NSObject (NSSplitViewDelegate)
#endif
- (void) splitView: (NSSplitView *)sender
resizeSubviewsWithOldSize: (NSSize)oldSize;

View file

@ -114,7 +114,9 @@ APPKIT_EXPORT_CLASS
@optional
#endif
#else
/** <ignore> */
@interface NSObject (NSTabViewDelegate)
/** </ignore> */
#endif
- (BOOL)tabView:(NSTabView *)tabView shouldSelectTabViewItem:(NSTabViewItem *)tabViewItem;
- (void)tabView:(NSTabView *)tabView willSelectTabViewItem:(NSTabViewItem *)tabViewItem;

View file

@ -0,0 +1,83 @@
/* Definition of class NSTableCellView
Copyright (C) 2022 Free Software Foundation, Inc.
By: Gregory John Casamento <greg.casamento@gmail.com>
Date: 03-09-2022
This file is part of the GNUstep 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.1 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; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110 USA.
*/
#ifndef _NSTableCellView_h_GNUSTEP_GUI_INCLUDE
#define _NSTableCellView_h_GNUSTEP_GUI_INCLUDE
#import <AppKit/NSView.h>
#import <AppKit/NSCell.h>
#import <AppKit/NSTableView.h>
#import <AppKit/NSNibDeclarations.h>
#import <AppKit/AppKitDefines.h>
#import <AppKit/NSTableView.h>
#import <AppKit/NSNibDeclarations.h>
#import <AppKit/AppKitDefines.h>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
#if defined(__cplusplus)
extern "C" {
#endif
@class NSImageView, NSTextField, NSArray;
APPKIT_EXPORT_CLASS
@interface NSTableCellView : NSView
{
id _objectValue;
IBOutlet NSImageView *_imageView;
IBOutlet NSTextField *_textField;
NSArray *_draggingImageComponents;
NSBackgroundStyle _backgroundStyle;
NSTableViewRowSizeStyle _rowSizeStyle;
}
- (id) objectValue;
- (void) setObjectValue: (id)objectValue;
- (NSImageView *) imageView;
- (void) setImageView: (NSImageView *)imageView;
- (NSTextField *) textField;
- (void) setTextField: (NSTextField *)textField;
- (NSBackgroundStyle) backgroundStyle;
- (void) setBackgroundStyle: (NSBackgroundStyle)backgroundStyle;
- (NSTableViewRowSizeStyle) rowSizeStyle;
- (void) setRowSizeStyle: (NSTableViewRowSizeStyle) rowSizeStyle;
- (NSArray *) draggingImageComponents;
- (void) setDraggingImageComponents: (NSArray *)draggingImageComponents;
@end
#if defined(__cplusplus)
}
#endif
#endif /* GS_API_MACOSX */
#endif /* _NSTableCellView_h_GNUSTEP_GUI_INCLUDE */

View file

@ -37,6 +37,7 @@
@class NSSortDescriptor;
@class NSCell;
@class NSTableView;
@class NSMutableArray;
// TODO: Finish to implement hidden, header tool tip and resizing mask
// and update the archiving code to support them.
@ -72,6 +73,7 @@ APPKIT_EXPORT_CLASS
NSCell *_dataCell;
NSString *_headerToolTip;
NSSortDescriptor *_sortDescriptorPrototype;
NSMutableArray *_prototypeCellViews;
}
/*
* Initializing an NSTableColumn instance
@ -131,6 +133,13 @@ APPKIT_EXPORT_CLASS
- (void) setSortDescriptorPrototype: (NSSortDescriptor *)aSortDescriptor;
- (NSSortDescriptor *) sortDescriptorPrototype;
#endif
/*
* Title
*/
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
- (void) setTitle: (NSString *)title;
- (NSString *) title;
#endif
@end
/* Notifications */

View file

@ -0,0 +1,46 @@
/* Definition of class NSTableRowView
Copyright (C) 2022 Free Software Foundation, Inc.
By: Gregory John Casamento <greg.casamento@gmail.com>
Date: 03-09-2022
This file is part of the GNUstep 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.1 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; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110 USA.
*/
#ifndef _NSTableRowView_h_GNUSTEP_GUI_INCLUDE
#define _NSTableRowView_h_GNUSTEP_GUI_INCLUDE
#import <AppKit/NSView.h>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
#if defined(__cplusplus)
extern "C" {
#endif
@interface NSTableRowView : NSView
@end
#if defined(__cplusplus)
}
#endif
#endif /* GS_API_MACOSX */
#endif /* _NSTableRowView_h_GNUSTEP_GUI_INCLUDE */

View file

@ -33,15 +33,18 @@
#import <AppKit/NSControl.h>
#import <AppKit/NSDragging.h>
#import <AppKit/NSUserInterfaceValidation.h>
#import <AppKit/NSUserInterfaceItemIdentification.h>
@class NSArray;
@class NSIndexSet;
@class NSMutableIndexSet;
@class NSTableColumn;
@class NSTableHeaderView;
@class NSTableRowView;
@class NSText;
@class NSImage;
@class NSURL;
@class NSNib;
typedef enum _NSTableViewDropOperation {
NSTableViewDropOn,
@ -88,6 +91,15 @@ typedef enum _NSTableViewAnimationOptions
NSTableViewAnimationSlideLeft = 0x30,
NSTableViewAnimationSlideRight = 0x40,
} NSTableViewAnimationOptions;
typedef enum _NSTableViewRowSizeStyle
{
NSTableViewRowSizeStyleDefault = -1,
NSTableViewRowSizeStyleCustom = 0,
NSTableViewRowSizeStyleSmall = 1,
NSTableViewRowSizeStyleMedium = 2,
NSTableViewRowSizeStyleLarge = 3,
} NSTableViewRowSizeStyle;
#endif
@ -125,6 +137,7 @@ APPKIT_EXPORT_CLASS
BOOL _allowsColumnReordering;
BOOL _autoresizesAllColumnsToFit;
BOOL _selectingColumns;
BOOL _usesAlternatingRowBackgroundColors;
NSText *_textObject;
NSInteger _editedRow;
NSInteger _editedColumn;
@ -155,7 +168,8 @@ APPKIT_EXPORT_CLASS
* We cache column origins (precisely, the x coordinate of the left
* origin of each column). When a column width is changed through
* [NSTableColumn setWidth:], then [NSTableView tile] gets called,
* which updates the cache. */
* which updates the cache.
*/
CGFloat *_columnOrigins;
/*
@ -174,6 +188,13 @@ APPKIT_EXPORT_CLASS
NSDragOperation _draggingSourceOperationMaskForRemote;
NSInteger _beginEndUpdates;
/* Supporting ivars for view based tables */
BOOL _viewBased;
NSMapTable *_renderedViewPaths;
NSMapTable *_pathsToViews;
NSMutableDictionary *_registeredNibs;
NSMutableDictionary *_registeredViews;
}
/* Data Source */
@ -380,6 +401,13 @@ APPKIT_EXPORT_CLASS
- (void) insertRowsAtIndexes: (NSIndexSet*)indexes withAnimation: (NSTableViewAnimationOptions)animationOptions;
- (void) removeRowsAtIndexes: (NSIndexSet*)indexes withAnimation: (NSTableViewAnimationOptions)animationOptions;
- (NSInteger) rowForView: (NSView*)view;
- (NSView *) makeViewWithIdentifier: (NSUserInterfaceItemIdentifier)identifier owner: (id)owner;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_8, GS_API_LATEST)
- (void) registerNib: (NSNib *)nib
forIdentifier: (NSUserInterfaceItemIdentifier)identifier;
- (NSDictionary *) registeredNibsByIdentifier;
#endif
@end /* interface of NSTableView */
@ -497,6 +525,24 @@ dataCellForTableColumn: (NSTableColumn *)aTableColumn
row: (NSInteger)row
mouseLocation: (NSPoint)mouse;
#endif
// NSTableCellView based table methods...
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
- (NSView *) tableView: (NSTableView *)tableView
viewForTableColumn: (NSTableColumn *)aTableColumn
row: (NSInteger)rowIndex;
- (NSTableRowView *) tableView: (NSTableView *)tableView
rowViewForRow: (NSInteger)rowIndex;
- (void) tableView: (NSTableView *)tableView
didAddRowView: (NSTableRowView *)rowView
forRow: (NSInteger)rowIndex;
- (void) tableView: (NSTableView *)tableView
didRemoveRowView: (NSTableRowView *)rowView
forRow: (NSInteger)rowIndex;
#endif
@end
#endif /* _GNUstep_H_NSTableView */

View file

@ -0,0 +1,47 @@
/* Interface of class NSTableViewRowAction
Copyright (C) 2022 Free Software Foundation, Inc.
By: Gregory John Casamento
Date: 04-09-2022
This file is part of the GNUstep 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.1 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; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110 USA.
*/
#ifndef _NSTableViewRowAction_h_GNUSTEP_GUI_INCLUDE
#define _NSTableViewRowAction_h_GNUSTEP_GUI_INCLUDE
#import <Foundation/NSObject.h>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST)
#if defined(__cplusplus)
extern "C" {
#endif
@interface NSTableViewRowAction : NSObject
@end
#if defined(__cplusplus)
}
#endif
#endif /* GS_API_MACOSX */
#endif /* _NSTableViewRowAction_h_GNUSTEP_GUI_INCLUDE */

View file

@ -145,10 +145,12 @@ APPKIT_EXPORT_CLASS
* Methods Implemented by the Delegate
*/
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
/** <ignore> */
@protocol NSToolbarDelegate <NSObject>
#if GS_PROTOCOLS_HAVE_OPTIONAL
@optional
#endif
/** </ignore> */
#else
@interface NSObject (NSToolbarDelegate)
#endif

View file

@ -34,8 +34,10 @@
#define _GNUstep_H_NSView
#import <AppKit/AppKitDefines.h>
#import <AppKit/NSAppearance.h>
#import <AppKit/NSGraphicsContext.h>
#import <AppKit/NSResponder.h>
#import <AppKit/NSUserInterfaceItemIdentification.h>
#import <AppKit/NSUserInterfaceLayout.h>
#import <AppKit/NSLayoutConstraint.h>
@ -54,6 +56,7 @@
@class NSScrollView;
@class NSView;
@class NSWindow;
@class NSShadow;
typedef NSInteger NSTrackingRectTag;
typedef NSInteger NSToolTipTag;
@ -128,7 +131,7 @@ extern const CGFloat NSViewNoInstrinsicMetric;
extern const CGFloat NSViewNoIntrinsicMetric;
APPKIT_EXPORT_CLASS
@interface NSView : NSResponder
@interface NSView : NSResponder <NSAppearanceCustomization, NSUserInterfaceItemIdentification>
{
NSRect _frame;
NSRect _bounds;
@ -193,6 +196,9 @@ PACKAGE_SCOPE
NSUInteger _autoresizingMask;
NSFocusRingType _focusRingType;
NSRect _autoresizingFrameError;
NSShadow *_shadow;
NSAppearance* _appearance;
NSUserInterfaceItemIdentifier _identifier;
}
/*
@ -684,7 +690,7 @@ PACKAGE_SCOPE
@property float contentCompressionResistancePriority;
#else
- (BOOL) contentCompressionResistancePriority;
- (void) setContentCompressionResistancePriority: (float)priority;
- (void) setContentCompressionResistancePriority: (NSLayoutPriority)priority;
#endif
#if GS_HAS_DECLARED_PROPERTIES
@ -735,6 +741,20 @@ PACKAGE_SCOPE
@end
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
/*
* Core Animation support methods. More methods will be added here as more are implemented.
*/
@interface NSView (CoreAnimationSupport)
- (NSShadow *) shadow;
- (void) setShadow: (NSShadow *)shadow;
@end
#endif
@class NSAffineTransform;
/*

View file

@ -90,10 +90,18 @@ enum {
};
#if OS_API_VERSION(MAC_OS_X_VERSION_10_9, GS_API_LATEST)
enum {
NSModalResponseOK = 1,
NSModalResponseCancel = 0
};
typedef NSInteger NSModalResponse;
enum {
NSModalResponseOK = 1,
NSModalResponseCancel = 0,
NSModalResponseStop = -1000,
NSModalResponseAbort = -1001,
NSModalResponseContinue = -1002,
NSAlertFirstButtonReturn = 1000,
NSAlertSecondButtonReturn = 1001,
NSAlertThirdButtonReturn = 1002,
};
DEFINE_BLOCK_TYPE(GSNSWindowDidEndSheetCallbackBlock, void, NSModalResponse returnCode);
#endif
enum {
@ -862,6 +870,9 @@ PACKAGE_SCOPE
#else
- (NSWindow *) sheetParent;
#endif
- (void)beginSheet:(NSWindow *)sheet
completionHandler:(GSNSWindowDidEndSheetCallbackBlock)handler;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)

View file

@ -27,6 +27,7 @@ NSHighlightedRadioButton = GSRadioSelected;
GNUstepMenuImage = GSApplicationMenuIcon;
AppleMenuImage = GSApplicationMenuIcon;
common_3DArrowRight = GSMenuArrow;
common_3DArrowRightH = NSHighlightedMenuArrow;
NSMenuArrow = GSMenuArrow;
common_2DCheckMark = GSMenuSelected;
NSMenuCheckmark = GSMenuSelected;

View file

@ -9,9 +9,6 @@ MISSING HEADERS ( * = difficult, - = quick, + = placeholder, x = won't do )
> NSItemProvider.h +
> NSMenuToolbarItem.h -
> NSOpenGLLayer.h +
> NSTableCellView.h *
> NSTableRowView.h *
> NSTableViewRowAction.h *
> NSTypesetter.h +
> NSUserActivity.h -
> NSWindowTab.h +

View file

@ -73,7 +73,7 @@ add comments above this one
/* File: ../Source/NSDocument.m:1694 */
/* File: ../Source/NSDocument.m:1696 */
/* File: ../Source/NSFontPanel.m:696 */
"Revert" = "Ritorna a com'era prima";
"Revert" = "Ripristina";
/* File: ../Source/GSHelpManagerPanel.m:70 */
/* File: ../Source/NSHelpPanel.m:154 */
@ -90,12 +90,9 @@ add comments above this one
"Unknown" = "Sconosciuto";
/* File: ../Source/NSPrintPanel.m:643 */
/* Flag: untranslated */
/* File: ../Source/NSPrintPanel.m:774 */
/* Flag: untranslated */
/* File: ../Source/NSPrintPanel.m:781 */
/* Flag: untranslated */
"Manual" = "Manual";
"Manual" = "Manuale";
/* File: ../Source/NSSavePanel.m:1321 */
/* Flag: untranslated */
@ -122,7 +119,7 @@ add comments above this one
/* File: ../Source/NSDocument.m:646 */
/* Comment: Error description */
"Could not create data for type."
= "Impossibile generare i dati per il tipo dati.";
= "Impossibile generare i dati per il tipo.";
/* File: ../Source/NSDocument.m:925 */
/* Comment: Error description */
@ -140,8 +137,7 @@ add comments above this one
"Code Point" = "Code Point";
/* File: ../Source/GSCharacterPanel.m:203 */
/* Flag: untranslated */
"Unicode Block" = "Unicode Block";
"Unicode Block" = "Blocco Unicode";
/* File: ../Source/GSInfoPanel.m:339 */
/* Flag: untranslated */
@ -155,8 +151,7 @@ add comments above this one
/* File: ../Source/NSAttributedString.m:865 */
/* Comment: Error description */
/* Flag: untranslated */
"Could not load data." = "Could not load data.";
"Could not load data." = "Impossibile caricare i dati.";
/* File: ../Source/NSAttributedString.m:1035 */
/* Comment: Error description */
@ -164,8 +159,7 @@ add comments above this one
"No type specified for data." = "No type specified for data.";
/* File: ../Source/NSColorPanel.m:294 */
/* Flag: untranslated */
"Opacity" = "Opacity";
"Opacity" = "Opacit\U00E0";
/* File: ../Source/NSColorSpace.m:147 */
/* Comment: color space */
@ -190,11 +184,11 @@ add comments above this one
/* File: ../Source/NSDocumentController.m:1852 */
/* Flag: untranslated */
"Clear List" = "Clear List";
"Clear List" = "Pulisci Lista";
/* File: ../Source/NSFontPanel.m:241 */
/* Flag: untranslated */
"Multiple fonts selected" = "Multiple fonts selected";
"Multiple fonts selected" = "Pi\U00F9 caratteri selezionati";
/* File: ../Source/NSFontPanel.m:553 */
/* Flag: untranslated */
@ -256,7 +250,7 @@ add comments above this one
/* File: ../Source/NSSavePanel.m:243 */
/* Flag: untranslated */
"Show Hidden Files" = "Show Hidden Files";
"Show Hidden Files" = "Mostra Archivi nascosti";
/* File: ../Source/NSSavePanel.m:278 */
/* Flag: untranslated */
@ -290,19 +284,19 @@ add comments above this one
/* File: ../Source/NSPathControl.m:389 */
/* Flag: untranslated */
"Choose..." = "Choose...";
"Choose..." = "Scegli...";
/* File: ../Source/NSSearchFieldCell.m:556 */
/* Flag: untranslated */
"Recent searches" = "Recent searches";
"Recent searches" = "Ricerche recenti";
/* File: ../Source/NSSearchFieldCell.m:563 */
/* Flag: untranslated */
"Recent search item" = "Recent search item";
"Recent search item" = "Elemento di ricerca recente";
/* File: ../Source/NSSearchFieldCell.m:570 */
/* Flag: untranslated */
"Clear recent searches" = "Clear recent searches";
"Clear recent searches" = "Pulire ricerche recenti";
/* File: ../Source/NSSearchFieldCell.m:578 */
/* Flag: untranslated */
@ -348,7 +342,7 @@ add comments above this one
/*** Strings from ../Source/Functions.m ***/
/* File: ../Source/Functions.m:94 */
"Cannot load the main model file '%@'"
= "Non \U00E8 possibile caricare il model file principale '%@'";
= "Non \U00E8 possibile caricare il file modello principale '%@'";
/*** Strings from ../Source/GSInfoPanel.m ***/

View file

@ -325,8 +325,13 @@ Gui_AGSDOC_FLAGS = \
-VariablesTemplate TypesAndConstants \
-WordMap '{\
APPKIT_EXPORT_CLASS="";\
APPKIT_EXPORT=extern;APPKIT_DECLARE="";\
DEFINE_RINT_IF_MISSING=""; \
APPKIT_EXPORT=extern;\
APPKIT_DECLARE="";\
APPKIT_EXTERN=extern;\
DEFINE_RINT_IF_MISSING="";\
PACKAGE_SCOPE="";\
IBOutlet="";\
IBAction=void;\
}' -Up Gui
GuiAdditions_AGSDOC_FLAGS = \

View file

@ -261,10 +261,13 @@ NSStatusItem.m \
NSTabView.m \
NSTabViewController.m \
NSTabViewItem.m \
NSTableCellView.m \
NSTableColumn.m \
NSTableHeaderView.m \
NSTableHeaderCell.m \
NSTableView.m \
NSTableViewRowAction.m \
NSTableRowView.m \
NSText.m \
NSTextAlternatives.m \
NSTextAttachment.m \
@ -580,10 +583,13 @@ NSSwitch.h \
NSTabView.h \
NSTabViewController.h \
NSTabViewItem.h \
NSTableCellView.h \
NSTableColumn.h \
NSTableHeaderCell.h \
NSTableHeaderView.h \
NSTableView.h \
NSTableViewRowAction.h \
NSTableRowView.h \
NSText.h \
NSTextAlternatives.h \
NSTextAttachment.h \
@ -701,6 +707,9 @@ libgui-resources_RESOURCE_FILES = Info-gnustep.plist
# Extra DLL exports file
libgnustep-gui_DLL_DEF = libgnustep-gui.def
# pkg-config file
libgnustep-gui_PKGCONFIG_FILES = "gnustep-gui.pc"
include GNUmakefile.preamble
include $(GNUSTEP_MAKEFILES)/library.make

View file

@ -369,6 +369,7 @@ typedef NSInteger GSLayoutViewAttribute;
newConstraint = [GSCSConstraint constraintWithLeftVariable: firstItemConstraintVariable operator: GSCSConstraintOperatorLessThanOrEqual rightConstant: [constraint constant]];
break;
case NSLayoutRelationEqual:
default:
newConstraint = [GSCSConstraint constraintWithLeftVariable: firstItemConstraintVariable operator: GSCSConstraintOperatorEqual rightConstant: [constraint constant]];
break;
case NSLayoutRelationGreaterThanOrEqual:
@ -1290,4 +1291,4 @@ typedef NSInteger GSLayoutViewAttribute;
[super dealloc];
}
@end
@end

View file

@ -6,7 +6,7 @@
Author: Gregory John Casamento
Date: July 2003.
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
@ -21,10 +21,10 @@
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,
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.
*/
*/
#import <Foundation/NSCoder.h>
#import <Foundation/NSDictionary.h>
@ -55,7 +55,7 @@ static const int currentVersion = 1; // GSNibItem version number...
@end
/*
* This private class is used to collect the nib items while the
* This private class is used to collect the nib items while the
* .gorm file is being unarchived. This is done to allow only
* the top level items to be retained in a clean way. The reason it's
* being done this way is because old .gorm files don't have any
@ -65,7 +65,7 @@ static const int currentVersion = 1; // GSNibItem version number...
* of subclasses of NSMenu, NSWindow, or any controller class.
* It's the last one that's hairy. Controller classes are
* represented in .gorm files by the GSNibItem class, but once they transform
* into the actual class instance it's not easy to tell if it should be
* into the actual class instance it's not easy to tell if it should be
* retained or not since there are a lot of other things stored in the nameTable
* as well. GJC
*/
@ -96,7 +96,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
// add myself as an observer and initialize the items array.
[nc addObserver: self
selector: @selector(handleNotification:)
name: GSInternalNibItemAddedNotification
name: GSInternalNibItemAddedNotification
object: nil];
items = [[NSMutableArray alloc] init];
}
@ -137,7 +137,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
NSNibConnector *connection;
NSString *key;
NSMenu *menu;
NSMutableArray *topObjects;
NSMutableArray *topObjects;
id obj;
// Add these objects with there old names as the code expects them
@ -171,7 +171,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
}
/*
* See if there is a main menu to be set. Report #4815, mainMenu
* See if there is a main menu to be set. Report #4815, mainMenu
* should be initialized before awakeFromNib is called.
*/
menu = [nameTable objectForKey: @"NSMenu"];
@ -211,10 +211,10 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
}
/*
/*
* See if the user has passed in the NSNibTopLevelObjects key.
* This is an implementation of a commonly used feature to give access to
* all top level objects of a nib file.
* all top level objects of a gorm file.
*/
obj = [context objectForKey: NSNibTopLevelObjects];
if ([obj isKindOfClass: [NSMutableArray class]])
@ -223,46 +223,55 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
}
else
{
topObjects = nil;
topObjects = nil;
}
/*
* Now tell all the objects that they have been loaded from
* a nib.
* a gorm model.
*/
enumerator = [nameTable keyEnumerator];
while ((key = [enumerator nextObject]) != nil)
{
if ([context objectForKey: key] == nil ||
if ([context objectForKey: key] == nil ||
[key isEqualToString: NSNibOwner]) // we want to send the message to the owner
{
// we don't want to send a message to these menus twice, if they're custom classes.
if ([key isEqualToString: @"NSWindowsMenu"] == NO &&
[key isEqualToString: @"NSServicesMenu"] == NO &&
// we don't want to send a message to these menus twice, if they're custom classes.
if ([key isEqualToString: @"NSWindowsMenu"] == NO &&
[key isEqualToString: @"NSServicesMenu"] == NO &&
[key isEqualToString: NSNibTopLevelObjects] == NO)
{
id o = [nameTable objectForKey: key];
// send the awake message, if it responds...
if ([o respondsToSelector: @selector(awakeFromNib)])
// send the awake message, every object should respond to this message since
// it is defined on NSObject(NSNibAwaking)
[o awakeFromNib];
// Call prepareForInteraceBuilder if we are in IB/Gorm.
if ([self respondsToSelector: @selector(isInInterfaceBuilder)])
{
[o awakeFromNib];
if ([self isInInterfaceBuilder] == YES)
{
// All objects should respond to this as it is defined on
// NSObject(NSNibAwaking)
[o prepareForInterfaceBuilder];
}
}
/*
* Retain all "top level" items so that, when the container
* is released, they will remain. The GSNibItems instantiated in the gorm need
* to be retained, since we are deallocating the container.
* Retain all "top level" items so that, when the container
* is released, they will remain. The GSNibItems instantiated in the gorm need
* to be retained, since we are deallocating the container.
* We don't want to retain the owner.
*
* Please note: It is encumbent upon the developer of an application to
* release these objects. Instantiating a window manually or loading in a .gorm
* file are equivalent processes. These objects need to be released in their
* respective controllers. If the developer has used the NSNibTopLevelObjects feature,
* then she will get the objects back in an array. She will will have to first release
* all the objects in the array and then the array itself in order to release the
* objects held within.
* Please note: It is encumbent upon the developer of an application to
* release these objects. Instantiating a window manually or loading in a .gorm
* file are equivalent processes. These objects need to be released in their
* respective controllers. If the developer has used the NSNibTopLevelObjects feature,
* then she will get the objects back in an array. She will will have to first release
* all the objects in the array and then the array itself in order to release the
* objects held within.
*/
if ([key isEqualToString: NSNibOwner] == NO)
{
@ -271,7 +280,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
[topObjects addObject: o];
// All top level objects must be released by the
// caller to avoid leaking, unless they are going
// to be released by other nib objects on behalf
// to be released by other gorm objects on behalf
// of the owner.
RETAIN(o);
}
@ -279,7 +288,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
}
}
}
/*
* See if there are objects that should be made visible.
* This is the last thing we should do since changes might be made
@ -345,11 +354,11 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
else if (version == 1)
{
NSMutableDictionary *nt = [NSMutableDictionary dictionaryWithDictionary: nameTable];
[nt setObject: [NSMutableArray arrayWithArray: visibleWindows]
[nt setObject: [NSMutableArray arrayWithArray: visibleWindows]
forKey: @"NSVisible"];
[nt setObject: [NSMutableArray arrayWithArray: deferredWindows]
[nt setObject: [NSMutableArray arrayWithArray: deferredWindows]
forKey: @"NSDeferred"];
[nt setObject: [NSMutableDictionary dictionaryWithDictionary: customClasses]
[nt setObject: [NSMutableDictionary dictionaryWithDictionary: customClasses]
forKey: @"GSCustomClassMap"];
[aCoder encodeObject: nt];
[aCoder encodeObject: connections];
@ -358,11 +367,11 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
else if (version == 0)
{
NSMutableDictionary *nt = [NSMutableDictionary dictionaryWithDictionary: nameTable];
[nt setObject: [NSMutableArray arrayWithArray: visibleWindows]
[nt setObject: [NSMutableArray arrayWithArray: visibleWindows]
forKey: @"NSVisible"];
[nt setObject: [NSMutableArray arrayWithArray: deferredWindows]
[nt setObject: [NSMutableArray arrayWithArray: deferredWindows]
forKey: @"NSDeferred"];
[nt setObject: [NSMutableDictionary dictionaryWithDictionary: customClasses]
[nt setObject: [NSMutableDictionary dictionaryWithDictionary: customClasses]
forKey: @"GSCustomClassMap"];
[aCoder encodeObject: nt];
[aCoder encodeObject: connections];
@ -376,7 +385,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
- (id) initWithCoder: (NSCoder*)aCoder
{
int version = [aCoder versionForClassName: @"GSNibContainer"];
int version = [aCoder versionForClassName: @"GSNibContainer"];
// save the version to the ivar, we need it later.
if (version == GNUSTEP_NIB_VERSION)
@ -395,11 +404,11 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
[aCoder decodeValueOfObjCType: @encode(id) at: &topLevelObjects];
// initialize with special entries...
ASSIGN(visibleWindows, [NSMutableArray arrayWithArray:
ASSIGN(visibleWindows, [NSMutableArray arrayWithArray:
[nameTable objectForKey: @"NSVisible"]]);
ASSIGN(deferredWindows, [NSMutableArray arrayWithArray:
ASSIGN(deferredWindows, [NSMutableArray arrayWithArray:
[nameTable objectForKey: @"NSDeferred"]]);
ASSIGN(customClasses, [NSMutableDictionary dictionaryWithDictionary:
ASSIGN(customClasses, [NSMutableDictionary dictionaryWithDictionary:
[nameTable objectForKey: @"GSCustomClassMap"]]);
// then remove them from the name table.
@ -412,7 +421,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
GSNibItemCollector *nibitems = [[GSNibItemCollector alloc] init];
NSEnumerator *en;
NSString *key;
// initialize the set of top level objects...
topLevelObjects = [[NSMutableSet alloc] initWithCapacity: 8];
@ -435,11 +444,11 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
}
// initialize with special entries...
ASSIGN(visibleWindows, [NSMutableArray arrayWithArray:
ASSIGN(visibleWindows, [NSMutableArray arrayWithArray:
[nameTable objectForKey: @"NSVisible"]]);
ASSIGN(deferredWindows, [NSMutableArray arrayWithArray:
ASSIGN(deferredWindows, [NSMutableArray arrayWithArray:
[nameTable objectForKey: @"NSDeferred"]]);
ASSIGN(customClasses, [NSMutableDictionary dictionaryWithDictionary:
ASSIGN(customClasses, [NSMutableDictionary dictionaryWithDictionary:
[nameTable objectForKey: @"GSCustomClassMap"]]);
@ -509,13 +518,13 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
{
[aCoder encodeObject: theClass];
[aCoder encodeRect: theFrame];
[aCoder encodeValueOfObjCType: @encode(unsigned int)
[aCoder encodeValueOfObjCType: @encode(unsigned int)
at: &autoresizingMask];
}
- (id) initWithCoder: (NSCoder*)aCoder
{
int version = [aCoder versionForClassName:
int version = [aCoder versionForClassName:
NSStringFromClass([self class])];
id obj = nil;
@ -523,19 +532,19 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
{
Class cls;
unsigned int mask;
[aCoder decodeValueOfObjCType: @encode(id) at: &theClass];
theFrame = [aCoder decodeRect];
[aCoder decodeValueOfObjCType: @encode(unsigned int)
[aCoder decodeValueOfObjCType: @encode(unsigned int)
at: &mask];
cls = NSClassFromString(theClass);
if (cls == nil)
{
[NSException raise: NSInternalInconsistencyException
format: @"Unable to find class '%@', it is not linked into the application.", theClass];
}
if (theFrame.size.height > 0 && theFrame.size.width > 0)
{
obj = [[cls allocWithZone: [self zone]] initWithFrame: theFrame];
@ -549,7 +558,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
else
{
obj = [[cls allocWithZone: [self zone]] init];
}
}
}
if ([obj respondsToSelector: @selector(setAutoresizingMask:)])
@ -560,17 +569,17 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
else if (version == 0)
{
Class cls;
[aCoder decodeValueOfObjCType: @encode(id) at: &theClass];
theFrame = [aCoder decodeRect];
cls = NSClassFromString(theClass);
if (cls == nil)
{
[NSException raise: NSInternalInconsistencyException
format: @"Unable to find class '%@', it is not linked into the application.", theClass];
}
obj = [cls allocWithZone: [self zone]];
if (theFrame.size.height > 0 && theFrame.size.width > 0)
{
@ -631,14 +640,14 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
/*
These stand-ins are here for use by GUI elements within Gorm. Since each gui element
has it's own "designated initializer" it's important to provide a division between these
so that when they are loaded, the application will call the correct initializer.
so that when they are loaded, the application will call the correct initializer.
Some "tricks" are employed in this code. For instance the use of initWithCoder and
encodeWithCoder directly as opposed to using the encodeObjC.. methods is the obvious
standout. To understand this it's necessary to explain a little about how encoding itself
works.
When the model is saved by the Interface Builder (whether Gorm or another
When the model is saved by the Interface Builder (whether Gorm or another
IB equivalent) these classes should be used to substitute for the actual classes. The actual
classes are encoded as part of it, but since they are being replaced we can't use the normal
encode methods to do it and must encode it directly.
@ -651,8 +660,8 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
@implementation GSClassSwapper
+ (void) initialize
{
if (self == [GSClassSwapper class])
{
if (self == [GSClassSwapper class])
{
[self setVersion: GSSWAPPER_VERSION];
}
}
@ -681,7 +690,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
_className = nil;
_superClass = nil;
_object = nil;
}
}
return self;
}
@ -713,10 +722,10 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
NSUnarchiver *unarchiver = (NSUnarchiver *)coder;
// decode class/superclass...
[coder decodeValueOfObjCType: @encode(id) at: &_className];
[coder decodeValueOfObjCType: @encode(id) at: &_className];
[coder decodeValueOfObjCType: @encode(Class) at: &_superClass];
// if we are living within the interface builder app, then don't try to
// if we are living within the interface builder app, then don't try to
// morph into the subclass.
if ([self shouldSwapClass])
{
@ -726,9 +735,9 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
[NSException raise: NSInternalInconsistencyException
format: @"Unable to find class '%@', it is not linked into the application.", _className];
}
// Initialize the object... dont call decode, since this wont
// allow us to instantiate the class we want.
// Initialize the object... dont call decode, since this wont
// allow us to instantiate the class we want.
obj = [aClass alloc];
}
else
@ -738,7 +747,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
// inform the coder that this object is to replace the template in all cases.
[unarchiver replaceObject: self withObject: obj];
obj = [obj initWithCoder: coder]; // unarchive the object...
obj = [obj initWithCoder: coder]; // unarchive the object...
}
}
@ -748,14 +757,14 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
- (void) encodeWithCoder: (NSCoder *)aCoder
{
[aCoder encodeValueOfObjCType: @encode(id) at: &_className];
[aCoder encodeValueOfObjCType: @encode(id) at: &_className];
[aCoder encodeValueOfObjCType: @encode(Class) at: &_superClass];
if (_object != nil)
{
// Don't call encodeValue, the way templates are used will prevent
// it from being saved correctly. Just call encodeWithCoder directly.
[_object encodeWithCoder: aCoder];
[_object encodeWithCoder: aCoder];
}
}
@ -773,8 +782,8 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
@implementation GSWindowTemplate
+ (void) initialize
{
if (self == [GSWindowTemplate class])
{
if (self == [GSWindowTemplate class])
{
[self setVersion: GSWINDOWT_VERSION];
}
}
@ -854,7 +863,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
{
float change = newSize.height - oldSize.height;
float changePerOption = change / options;
if (_autoPositionMask & (GSWindowMaxYMargin | GSWindowMinYMargin))
{
if (_autoPositionMask & GSWindowMinYMargin)
@ -864,7 +873,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
}
}
}
// change the origin of the window.
if (changedOrigin)
{
@ -883,25 +892,25 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
if (version == GSWINDOWT_VERSION)
{
// decode the defer flag...
[coder decodeValueOfObjCType: @encode(BOOL) at: &_deferFlag];
[coder decodeValueOfObjCType: @encode(BOOL) at: &_deferFlag];
[coder decodeValueOfObjCType: @encode(unsigned int) at: &_autoPositionMask];
_screenRect = [coder decodeRect];
}
else if (version == 0)
{
// decode the defer flag...
[coder decodeValueOfObjCType: @encode(BOOL) at: &_deferFlag];
[coder decodeValueOfObjCType: @encode(BOOL) at: &_deferFlag];
_autoPositionMask = GSWindowAutoPositionNone;
_screenRect = [[obj screen] frame];
}
// FIXME: The designated initializer logic for NSWindow is in the initWithCoder: method of
// NSWindow. Unfortunately, this means that the "defer" flag for NSWindows and NSWindow
// subclasses in gorm files will be ignored. This shouldn't have a great impact,
// but it is not the correct behavior.
// subclasses in gorm files will be ignored. This shouldn't have a great impact,
// but it is not the correct behavior.
//
// Set all of the attributes into the object, if it
// Set all of the attributes into the object, if it
// responds to any of these methods.
//
if ([obj respondsToSelector: @selector(setAutoPositionMask:)])
@ -922,10 +931,10 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
if (version == GSWINDOWT_VERSION)
{
_screenRect = [[_object screen] frame];
_screenRect = [[_object screen] frame];
[coder encodeValueOfObjCType: @encode(BOOL) at: &_deferFlag];
[coder encodeValueOfObjCType: @encode(unsigned int) at: &_autoPositionMask];
[coder encodeRect: _screenRect];
[coder encodeRect: _screenRect];
}
else if (version == 0)
{
@ -937,7 +946,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
@implementation GSViewTemplate
+ (void) initialize
{
if (self == [GSViewTemplate class])
if (self == [GSViewTemplate class])
{
[self setVersion: GSVIEWT_VERSION];
}
@ -958,7 +967,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
@implementation GSTextTemplate
+ (void) initialize
{
if (self == [GSTextTemplate class])
if (self == [GSTextTemplate class])
{
[self setVersion: GSTEXTT_VERSION];
}
@ -979,7 +988,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
@implementation GSTextViewTemplate
+ (void) initialize
{
if (self == [GSTextViewTemplate class])
if (self == [GSTextViewTemplate class])
{
[self setVersion: GSTEXTVIEWT_VERSION];
}
@ -1000,7 +1009,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
@implementation GSMenuTemplate
+ (void) initialize
{
if (self == [GSMenuTemplate class])
if (self == [GSMenuTemplate class])
{
[self setVersion: GSMENUT_VERSION];
}
@ -1022,7 +1031,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
@implementation GSControlTemplate
+ (void) initialize
{
if (self == [GSControlTemplate class])
if (self == [GSControlTemplate class])
{
[self setVersion: GSCONTROLT_VERSION];
}
@ -1042,7 +1051,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
@implementation GSObjectTemplate
+ (void) initialize
{
if (self == [GSObjectTemplate class])
if (self == [GSObjectTemplate class])
{
[self setVersion: GSOBJECTT_VERSION];
}
@ -1059,11 +1068,11 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
}
@end
// Order in this factory method is very important.
// Order in this factory method is very important.
// Which template to create must be determined
// in sequence because of the class hierarchy.
@implementation GSTemplateFactory
+ (id) templateForObject: (id) object
+ (id) templateForObject: (id) object
withClassName: (NSString *)className
withSuperClassName: (NSString *)superClassName
{
@ -1073,44 +1082,44 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
if ([object isKindOfClass: [NSWindow class]])
{
template = [[GSWindowTemplate alloc] initWithObject: object
className: className
className: className
superClassName: superClassName];
}
else if ([object isKindOfClass: [NSTextView class]])
{
template = [[GSTextViewTemplate alloc] initWithObject: object
className: className
className: className
superClassName: superClassName];
}
else if ([object isKindOfClass: [NSText class]])
{
template = [[GSTextTemplate alloc] initWithObject: object
className: className
className: className
superClassName: superClassName];
}
else if ([object isKindOfClass: [NSControl class]])
{
template = [[GSControlTemplate alloc] initWithObject: object
className: className
className: className
superClassName: superClassName];
}
else if ([object isKindOfClass: [NSView class]])
{
template = [[GSViewTemplate alloc] initWithObject: object
className: className
className: className
superClassName: superClassName];
}
else if ([object isKindOfClass: [NSMenu class]])
{
template = [[GSMenuTemplate alloc] initWithObject: object
className: className
className: className
superClassName: superClassName];
}
else if ([object isKindOfClass: [NSObject class]])
else if ([object isKindOfClass: [NSObject class]])
{
// for gui elements derived from NSObject
template = [[GSObjectTemplate alloc] initWithObject: object
className: className
className: className
superClassName: superClassName];
}
}

View file

@ -43,7 +43,11 @@
#if HAVE_IMAGEMAGICK
#if MAGICKCORE_7_OR_NEWER
#include <MagickCore/MagickCore.h>
#else
#include <magick/MagickCore.h>
#endif
@implementation GSImageMagickImageRep

File diff suppressed because it is too large Load diff

View file

@ -345,11 +345,11 @@ static SEL oatSel;
static SEL remSel;
static IMP infImp;
static void (*addImp)();
static unsigned (*cntImp)();
static void (*insImp)();
static void (*addImp)(NSMutableArray*, SEL, NSObject*);
static unsigned (*cntImp)(NSMutableArray*, SEL);
static void (*insImp)(NSMutableArray*, SEL, NSObject*, NSUInteger);
static IMP oatImp;
static void (*remImp)();
static void (*remImp)(NSMutableArray*, SEL, NSUInteger);
#define NEWINFO(Z,O,L) ((*infImp)(infCls, infSel, (Z), (O), (L)))
#define ADDOBJECT(O) ((*addImp)(_infoArray, addSel, (O)))

View file

@ -33,6 +33,7 @@
#import "AppKit/NSAttributedString.h"
#import "AppKit/NSBezierPath.h"
#import "AppKit/NSButton.h"
#import "AppKit/NSButtonCell.h"
#import "AppKit/NSBrowser.h"
#import "AppKit/NSBrowserCell.h"
@ -42,8 +43,10 @@
#import "AppKit/NSColorWell.h"
#import "AppKit/NSGraphics.h"
#import "AppKit/NSImage.h"
#import "AppKit/NSImageView.h"
#import "AppKit/NSMenuView.h"
#import "AppKit/NSMenuItemCell.h"
#import "AppKit/NSOutlineView.h"
#import "AppKit/NSParagraphStyle.h"
#import "AppKit/NSPopUpButtonCell.h"
#import "AppKit/NSProgressIndicator.h"
@ -51,9 +54,11 @@
#import "AppKit/NSScrollView.h"
#import "AppKit/NSStringDrawing.h"
#import "AppKit/NSTableView.h"
#import "AppKit/NSTableCellView.h"
#import "AppKit/NSTableColumn.h"
#import "AppKit/NSTableHeaderCell.h"
#import "AppKit/NSTableHeaderView.h"
#import "AppKit/NSTableView.h"
#import "AppKit/NSView.h"
#import "AppKit/NSTabView.h"
#import "AppKit/NSTabViewItem.h"
@ -62,6 +67,7 @@
#import "AppKit/NSPathCell.h"
#import "AppKit/NSPathControl.h"
#import "AppKit/NSPathComponentCell.h"
#import "GNUstepGUI/GSToolbarView.h"
#import "GNUstepGUI/GSTitleView.h"
@ -76,6 +82,12 @@
row: (NSInteger)index;
- (id)_objectValueForTableColumn: (NSTableColumn *)tb
row: (NSInteger)index;
- (NSView *) _renderedViewForPath: (NSIndexPath *)path;
- (void) _setRenderedView: (NSView *)view forPath: (NSIndexPath *)path;
@end
@interface NSTableColumn (Private)
- (NSArray *) _prototypeCellViews;
@end
@interface NSCell (Private)
@ -3298,7 +3310,6 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
NSInteger numberOfColumns = [tableView numberOfColumns];
NSIndexSet *selectedRows = [tableView selectedRowIndexes];
NSIndexSet *selectedColumns = [tableView selectedColumnIndexes];
NSColor *backgroundColor = [tableView backgroundColor];
// Set the fill color
{
@ -3309,18 +3320,10 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
if (selectionColor == nil)
{
// Switch to the alternate color of the backgroundColor is white.
if([backgroundColor isEqual: [NSColor whiteColor]])
{
selectionColor = [NSColor colorWithCalibratedRed: 0.86
green: 0.92
blue: 0.99
alpha: 1.0];
}
else
{
selectionColor = [NSColor whiteColor];
}
selectionColor = [NSColor colorWithCalibratedRed: 0.86
green: 0.92
blue: 0.99
alpha: 1.0];
}
[selectionColor set];
}
@ -3381,31 +3384,17 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
}
}
- (void) drawTableViewRow: (NSInteger)rowIndex
clipRect: (NSRect)clipRect
inView: (NSView *)view
- (void) _calculatedStartingColumn: (NSInteger *)startingColumn
endingColumn: (NSInteger *)endingColumn
withTableView: (NSTableView *)tableView
inClipRect: (NSRect)clipRect
{
NSTableView *tableView = (NSTableView *)view;
// NSInteger numberOfRows = [tableView numberOfRows];
CGFloat x_pos = 0.0;
NSInteger i = 0;
NSInteger numberOfColumns = [tableView numberOfColumns];
// NSIndexSet *selectedRows = [tableView selectedRowIndexes];
// NSColor *backgroundColor = [tableView backgroundColor];
CGFloat *columnOrigins = [tableView _columnOrigins];
NSInteger editedRow = [tableView editedRow];
NSInteger editedColumn = [tableView editedColumn];
NSArray *tableColumns = [tableView tableColumns];
NSInteger startingColumn;
NSInteger endingColumn;
NSTableColumn *tb;
NSRect drawingRect;
NSCell *cell;
NSInteger i;
CGFloat x_pos;
const BOOL rowSelected = [[tableView selectedRowIndexes] containsIndex: rowIndex];
NSColor *tempColor = nil;
NSColor *selectedTextColor = [self colorNamed: @"highlightedTableRowTextColor"
state: GSThemeNormalState];
/* Using columnAtPoint: here would make it called twice per row per drawn
rect - so we avoid it and do it natively */
@ -3416,10 +3405,10 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
{
i++;
}
startingColumn = (i - 1);
*startingColumn = (i - 1);
if (startingColumn == -1)
startingColumn = 0;
if (*startingColumn == -1)
*startingColumn = 0;
/* Determine ending column as fast as possible */
x_pos = NSMaxX (clipRect);
@ -3428,11 +3417,35 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
{
i++;
}
endingColumn = (i - 1);
*endingColumn = (i - 1);
if (endingColumn == -1)
endingColumn = numberOfColumns - 1;
if (*endingColumn == -1)
*endingColumn = numberOfColumns - 1;
}
- (void) drawTableViewRow: (NSInteger)rowIndex
clipRect: (NSRect)clipRect
inView: (NSTableView *)tableView
{
NSInteger editedRow = [tableView editedRow];
NSInteger editedColumn = [tableView editedColumn];
NSArray *tableColumns = [tableView tableColumns];
NSInteger startingColumn;
NSInteger endingColumn;
NSTableColumn *tb;
NSRect drawingRect;
NSCell *cell;
NSInteger i;
const BOOL rowSelected = [[tableView selectedRowIndexes] containsIndex: rowIndex];
NSColor *tempColor = nil;
NSColor *selectedTextColor = [self colorNamed: @"highlightedTableRowTextColor"
state: GSThemeNormalState];
[self _calculatedStartingColumn: &startingColumn
endingColumn: &endingColumn
withTableView: tableView
inClipRect: clipRect];
/* Draw the row between startingColumn and endingColumn */
for (i = startingColumn; i <= endingColumn; i++)
{
@ -3482,6 +3495,281 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
}
}
- (NSRect) _drawOutlineTableColumn: (NSTableColumn *)tb
outlineView: (NSOutlineView *)outlineView
item: (id)item
drawingRect: (NSRect)inputRect
rowIndex: (NSInteger)rowIndex
{
NSRect drawingRect = inputRect;
NSImage *image = nil;
NSInteger level = 0;
CGFloat indentationFactor = 0.0;
CGFloat indentationPerLevel = [outlineView indentationPerLevel];
NSCell *imageCell = nil;
NSRect imageRect;
id delegate = [outlineView delegate];
// display the correct arrow...
if ([outlineView isItemExpanded: item])
{
image = [NSImage imageNamed: @"common_ArrowDownH"];
}
else
{
image = [NSImage imageNamed: @"common_ArrowRightH"];
}
if (![outlineView isExpandable: item])
{
image = AUTORELEASE([[NSImage alloc] initWithSize: NSMakeSize(14.0,14.0)]);
}
level = [outlineView levelForItem: item];
indentationFactor = indentationPerLevel * level;
imageCell = [[NSCell alloc] initImageCell: image];
imageRect = [outlineView frameOfOutlineCellAtRow: rowIndex];
if ([delegate respondsToSelector: @selector(outlineView:willDisplayOutlineCell:forTableColumn:item:)])
{
[delegate outlineView: outlineView
willDisplayOutlineCell: imageCell
forTableColumn: tb
item: item];
}
/* Do not indent if the delegate set the image to nil. */
if ([imageCell image])
{
imageRect.size.width = [image size].width;
imageRect.size.height = [image size].height + 5;
[imageCell drawWithFrame: imageRect inView: outlineView];
drawingRect.origin.x
+= indentationFactor + imageRect.size.width + 5;
drawingRect.size.width
-= indentationFactor + imageRect.size.width + 5;
}
else
{
drawingRect.origin.x += indentationFactor;
drawingRect.size.width -= indentationFactor;
}
RELEASE(imageCell);
return drawingRect;
}
- (void) drawOutlineViewRow: (NSInteger)rowIndex
clipRect: (NSRect)clipRect
inView: (NSOutlineView *)outlineView
{
NSInteger editedRow = [outlineView editedRow];
NSInteger editedColumn = [outlineView editedColumn];
NSArray *tableColumns = [outlineView tableColumns];
NSInteger numberOfRows = [outlineView numberOfRows];
NSInteger startingColumn;
NSInteger endingColumn;
NSRect drawingRect;
NSInteger i;
id dataSource = [outlineView dataSource];
NSTableColumn *outlineTableColumn = [outlineView outlineTableColumn];
if (dataSource == nil)
{
return;
}
/* Using columnAtPoint: here would make it called twice per row per drawn
rect - so we avoid it and do it natively */
if (rowIndex >= numberOfRows)
{
return;
}
[self _calculatedStartingColumn: &startingColumn
endingColumn: &endingColumn
withTableView: outlineView
inClipRect: clipRect];
/* Draw the row between startingColumn and endingColumn */
for (i = startingColumn; i <= endingColumn; i++)
{
id item = [outlineView itemAtRow: rowIndex];
NSTableColumn *tb = [tableColumns objectAtIndex: i];
NSCell *cell = [outlineView preparedCellAtColumn: i row: rowIndex];
[outlineView _willDisplayCell: cell
forTableColumn: tb
row: rowIndex];
if (i == editedColumn && rowIndex == editedRow)
{
[cell _setInEditing: YES];
[cell setShowsFirstResponder: YES];
}
else
{
[cell setObjectValue: [dataSource outlineView: outlineView
objectValueForTableColumn: tb
byItem: item]];
}
drawingRect = [outlineView frameOfCellAtColumn: i
row: rowIndex];
if (tb == outlineTableColumn)
{
drawingRect = [self _drawOutlineTableColumn: tb
outlineView: outlineView
item: item
drawingRect: drawingRect
rowIndex: rowIndex];
}
[cell drawWithFrame: drawingRect inView: outlineView];
if (i == editedColumn && rowIndex == editedRow)
{
[cell _setInEditing: NO];
[cell setShowsFirstResponder: NO];
}
}
}
- (id) _prototypeCellViewFromTableColumn: (NSTableColumn *)tb
{
NSArray *protoCellViews = [tb _prototypeCellViews];
id view = nil;
// it seems there is always one prototype...
if ([protoCellViews count] > 0)
{
view = [protoCellViews objectAtIndex: 0];
view = [view copy]; // instantiate the prototype...
}
return view;
}
- (void) drawCellViewRow: (NSInteger)rowIndex
clipRect: (NSRect)clipRect
inView: (NSTableView *)v
{
NSArray *tableColumns = [v tableColumns];
NSInteger numberOfRows = [v numberOfRows];
NSInteger startingColumn;
NSInteger endingColumn;
NSInteger i;
id dataSource = [v dataSource];
id delegate = [v delegate];
BOOL hasMethod = NO;
NSTableColumn *outlineTableColumn = nil;
NSOutlineView *ov = nil;
// If we have no data source, there is nothing to do...
if (dataSource == nil)
{
return;
}
// If the rowIndex is greater than the numberOfRows, done...
if (rowIndex >= numberOfRows)
{
return;
}
// Check the delegate method...
hasMethod = [delegate respondsToSelector: @selector(outlineView:viewForTableColumn:item:)];
if (hasMethod)
{
ov = (NSOutlineView *)v;
outlineTableColumn = [ov outlineTableColumn];
}
else
{
hasMethod = [delegate respondsToSelector: @selector(tableView:viewForTableColumn:row:)];
}
[self _calculatedStartingColumn: &startingColumn
endingColumn: &endingColumn
withTableView: v
inClipRect: clipRect];
/* Draw the row between startingColumn and endingColumn */
for (i = startingColumn; i <= endingColumn; i++)
{
NSRect drawingRect = [v frameOfCellAtColumn: i
row: rowIndex];
NSTableColumn *tb = [tableColumns objectAtIndex: i];
NSIndexPath *path = [NSIndexPath indexPathForItem: i
inSection: rowIndex];
NSView *view = [v _renderedViewForPath: path];
if (ov != nil)
{
id item = [ov itemAtRow: rowIndex];
if (tb == outlineTableColumn)
{
drawingRect = [self _drawOutlineTableColumn: tb
outlineView: ov
item: item
drawingRect: drawingRect
rowIndex: rowIndex];
}
if (view == nil)
{
if (hasMethod)
{
view = [delegate outlineView: ov
viewForTableColumn: tb
item: item];
}
else
{
view = [self _prototypeCellViewFromTableColumn: tb];
}
}
}
else
{
// If the view has been stored use it, if not
// then grab it.
if (view == nil)
{
if (hasMethod)
{
view = [delegate tableView: v
viewForTableColumn: tb
row: rowIndex];
}
else
{
view = [self _prototypeCellViewFromTableColumn: tb];
}
}
}
// Store the object...
[v _setRenderedView: view forPath: path];
[v addSubview: view];
// Place the view...
[view setFrame: drawingRect];
}
}
- (BOOL) isBoxOpaque: (NSBox *)box
{
if ([box boxType] == NSBoxCustom)
{
return ![box isTransparent];
}
return YES;
}
- (void) drawBoxInClipRect: (NSRect)clipRect
boxType: (NSBoxType)boxType
borderType: (NSBorderType)borderType

View file

@ -425,9 +425,6 @@
{
if (closeButton == nil)
{
NSSize viewSize;
NSSize buttonSize;
[[GSTheme theme] setName: nil forElement: [closeButton cell] temporary: NO];
ASSIGN(closeButton,
[NSWindow standardWindowButton:

View file

@ -100,7 +100,6 @@
float vAccumulator = 0.0;
NSEnumerator *e = [[self subviews] objectEnumerator];
NSView *layoutedView = nil;
int index = 0;
// Loop over all subviews
while ((layoutedView = [e nextObject]) != nil)
@ -137,7 +136,6 @@
maxHeight - vAccumulator)];
[layoutedView setAutoresizingMask:NSViewMinYMargin];
hAccumulator += width;
index++;
}
maxHeight -= vAccumulator; // adjust for final row
if (maxHeight != 0) // need to grow (or shrink) the window to accommodate more (or fewer) items

View file

@ -26,7 +26,9 @@
Boston, MA 02110-1301, USA.
*/
#import <Foundation/Foundation.h>
#import <Foundation/NSArray.h>
#import <Foundation/NSDictionary.h>
#import "GNUstepGUI/GSXibKeyedUnarchiver.h"
@class GSXibElement;

View file

@ -169,6 +169,7 @@ static NSString *ApplicationClass = nil;
@implementation GSXib5KeyedUnarchiver
// Singleton dictionary that holds any cached XIB data... cells, etc.
static NSDictionary *XmlTagToObjectClassMap = nil;
static NSArray *XmlTagsNotStacked = nil;
static NSArray *XmlTagsToSkip = nil;
@ -206,7 +207,7 @@ static NSArray *XmlBoolDefaultYes = nil;
@"NSMutableArray", @"resources",
@"NSMutableArray", @"segments",
@"NSMutableArray", @"objectValues",
@"NSMutableArray", @"prototypeCellViews",
@"NSMutableArray", @"prototypeCellViews",
@"NSMutableArray", @"allowedToolbarItems",
@"NSMutableArray", @"defaultToolbarItems",
@"NSMutableArray", @"rowTemplates",
@ -221,7 +222,6 @@ static NSArray *XmlBoolDefaultYes = nil;
@"IBActionConnection", @"action",
@"NSNibBindingConnector", @"binding",
@"NSWindowTemplate", @"window",
@"NSView", @"tableCellView",
@"IBUserDefinedRuntimeAttribute5", @"userDefinedRuntimeAttribute",
@"NSURL", @"url",
@"NSLayoutConstraint", @"constraint",
@ -287,6 +287,8 @@ static NSArray *XmlBoolDefaultYes = nil;
@"initialItem", @"NSSelectedTabViewItem",
@"allowsExpansionToolTips", @"NSControlAllowsExpansionToolTips",
@"segments", @"NSSegmentImages",
@"label", @"NSSegmentItemLabel",
@"image", @"NSSegmentItemImage",
@"editable", @"NSIsEditable",
@"objectValues", @"NSPopUpListData",
@"maxNumberOfRows", @"NSMaxNumberOfGridRows",
@ -324,7 +326,10 @@ static NSArray *XmlBoolDefaultYes = nil;
@"beginningViews", @"NSStackViewBeginningContainer", // NSStackView
@"middleViews", @"NSStackViewMiddleContainer",
@"endViews", @"NSStackViewEndContainer",
@"collectionViewLayout", @"NSCollectionViewLayout",
@"collectionViewLayout", @"NSCollectionViewLayout",
@"shadow", @"NSViewShadow",
@"blurRadius", @"NSShadowBlurRadius",
@"color", @"NSShadowColor",
nil];
RETAIN(XmlKeyMapTable);
@ -445,6 +450,8 @@ static NSArray *XmlBoolDefaultYes = nil;
@"decodeSecondAttribute:", @"NSSecondAttribute",
@"decodeRelation:", @"NSRelation",
@"decodeTransitionStyle:", @"NSTransitionStyle",
@"decodeShadowOffsetHoriz:", @"NSShadowHoriz",
@"decodeShadowOffsetVert:", @"NSShadowVert",
nil];
RETAIN(XmlKeyToDecoderSelectorMap);
@ -870,10 +877,12 @@ didStartElement: (NSString*)elementName
// Need to store element for making the connections...
[self addConnection: element];
}
/*
else if ([XmlConstraintRecordTags containsObject: elementName])
{
[self objectForXib: element]; // decode the constraint...
}
*/
}
else
{
@ -1373,21 +1382,9 @@ didStartElement: (NSString*)elementName
id object = nil;
NSDictionary *attributes = [[element elementForKey: @"keyEquivalentModifierMask"] attributes];
// ??? SKIP modifier mask processing if BASE64-UTF8 string being used ???
if (attributes == nil)
{
if (([element elementForKey: @"keyEquivalent"]) &&
([[element elementForKey: @"keyEquivalent"] attributeForKey: @"base64-UTF8"]))
{
object = [NSNumber numberWithUnsignedInt: 0];
}
else
{
// Seems that Apple decided to omit this attribute IF certain default keys alone
// are applied. If this key is present WITH NO setting then the following is
// used for the modifier mask...
object = [NSNumber numberWithUnsignedInt: NSCommandKeyMask];
}
return nil;
}
else
{
@ -2386,8 +2383,7 @@ didStartElement: (NSString*)elementName
mask.flags.highlighted = [[attributes objectForKey: @"highlighted"] boolValue];
mask.flags.disabled = ([attributes objectForKey: @"enabled"] ?
[[attributes objectForKey: @"enabled"] boolValue] == NO : NO);
mask.flags.editable = ([attributes objectForKey: @"editable"] ?
[[attributes objectForKey: @"editable"] boolValue] : YES);
mask.flags.editable = [[attributes objectForKey: @"editable"] boolValue];
mask.flags.vCentered = [[attributes objectForKey: @"alignment"] isEqualToString: @"center"];
mask.flags.hCentered = [[attributes objectForKey: @"alignment"] isEqualToString: @"center"];
mask.flags.bordered = [[borderStyle lowercaseString] containsString: @"border"];
@ -2697,7 +2693,12 @@ didStartElement: (NSString*)elementName
}
// keyEquivalentModifierMask...
mask.value |= [[self decodeModifierMaskForElement: element] unsignedIntValue];
NSNumber* modifierMask = [self decodeModifierMaskForElement: element];
if (modifierMask != nil)
{
mask.value |= [modifierMask unsignedIntValue] << 8;
}
// Return value...
value = [NSNumber numberWithUnsignedInteger: mask.value];
@ -2982,6 +2983,18 @@ didStartElement: (NSString*)elementName
return num;
}
- (id) decodeShadowOffsetHoriz: (GSXibElement *)element
{
NSSize size = [self decodeSizeForKey: @"offset"];
return [NSNumber numberWithFloat: size.width];
}
- (id) decodeShadowOffsetVert: (GSXibElement *)element
{
NSSize size = [self decodeSizeForKey: @"offset"];
return [NSNumber numberWithFloat: size.height];
}
- (id) _decodePlacementForObject: (id)obj
{
NSGridRowAlignment alignment = NSGridCellPlacementNone;
@ -3184,13 +3197,13 @@ didStartElement: (NSString*)elementName
if (toolTipString != nil)
{
if ([object respondsToSelector: @selector(setToolTip:)])
{
[object setToolTip: toolTipString];
}
{
[object setToolTip: toolTipString];
}
else if ([object respondsToSelector: @selector(setHeaderToolTip:)])
{
[object setHeaderToolTip: toolTipString];
}
{
[object setHeaderToolTip: toolTipString];
}
}
}

View file

@ -310,6 +310,7 @@
objects = [[NSMutableDictionary alloc] init];
stack = [[NSMutableArray alloc] init];
decoded = [[NSMutableDictionary alloc] init];
_customClasses= [[NSMutableDictionary alloc] init];
}
- (id) initForReadingWithData: (NSData*)data
@ -318,18 +319,16 @@
NSXMLParser *theParser;
NSData *theData = data;
// Dictionary which contains custom class information for Gorm/IB.
_customClasses = [[NSMutableDictionary alloc] init];
// Initialize...
[self _initCommon];
// Prepare the XIB data for parsing...
theData = [self _preProcessXib: data];
if (theData == nil)
{
return nil;
}
// Initialize...
[self _initCommon];
theParser = [[NSXMLParser alloc] initWithData: theData];
[theParser setDelegate: self];

View file

@ -1049,6 +1049,17 @@
// If we are currently in IB, then don't do anything.
if ([NSClassSwapper isInInterfaceBuilder])
{
// Prepare objects for display in Gorm/IB.
en = [[objectRecords orderedObjects] objectEnumerator];
while ((obj = [en nextObject]) != nil)
{
id realObj = [obj object];
// All objects should respond to this as it is defined on
// NSObject(NSNibAwaking)
[realObj prepareForInterfaceBuilder];
}
return self;
}
@ -1124,10 +1135,7 @@
}
}
if ([realObj respondsToSelector: @selector(awakeFromNib)])
{
[realObj awakeFromNib];
}
[realObj awakeFromNib];
}
return self;

View file

@ -90,7 +90,7 @@
return nil;
}
- (id<NSAccessibilityElement>) targetElement;
- (id<NSAccessibilityElement>) targetElement
{
return nil;
}

View file

@ -2049,6 +2049,15 @@ void NSBeginInformationalAlertSheet(NSString *title,
DESTROY(_window);
}
- (void) beginSheetModalForWindow:(NSWindow *)sheet
completionHandler:(GSNSWindowDidEndSheetCallbackBlock)handler
{
[self _setupPanel];
[sheet beginSheet: _window
completionHandler: handler];
DESTROY(_window);
}
- (void) _alertDidEnd: (NSWindow *)sheet
returnCode: (NSInteger)returnCode
contextInfo: (void *)contextInfo

View file

@ -992,7 +992,7 @@ nsanimation_progressMarkSorter(NSAnimationProgress first, NSAnimationProgress se
_NSANIMATION_UNLOCK;
}
- (void) animatorStep: (NSTimeInterval) elapsedTime;
- (void) animatorStep: (NSTimeInterval) elapsedTime
{
NSAnimationProgress progress;
_NSANIMATION_LOCKING_SETUP;
@ -1200,7 +1200,7 @@ nsanimation_progressMarkSorter(NSAnimationProgress first, NSAnimationProgress se
_NSANIMATION_UNLOCK;
}
- (float) actualFrameRate;
- (float) actualFrameRate
{
float r;
_NSANIMATION_LOCKING_SETUP;

View file

@ -62,6 +62,7 @@
#import "AppKit/AppKitExceptions.h"
#import "AppKit/NSAlert.h"
#import "AppKit/NSAppearance.h"
#import "AppKit/NSApplication.h"
#import "AppKit/NSCell.h"
#import "AppKit/NSCursor.h"
@ -3834,6 +3835,26 @@ struct _DelegateWrapper
return self;
}
- (NSAppearance*) appearance {
return _appearance;
}
- (void) setAppearance: (NSAppearance*) appearance {
ASSIGNCOPY(_appearance, appearance);
}
- (NSAppearance*) effectiveAppearance {
if (_appearance)
{
return _appearance;
}
else
{
return [NSAppearance currentAppearance];
}
}
@end /* NSApplication */

View file

@ -30,74 +30,6 @@ static NSUInteger minYAttribute = 33;
static NSUInteger maxXAttribute = 36;
static NSUInteger maxYAttribute = 37;
+ (NSArray *)constraintsWithAutoresizingMask:
(NSAutoresizingMaskOptions) autoresizingMask
subitem: (NSView *) subItem
frame: (NSRect) frame
superitem: (NSView *) superItem
bounds: (NSRect) bounds
{
if (autoresizingMask == NSViewNotSizable)
{
return [NSArray array];
}
NSAutoresizingMaskLayoutConstraint *xConstraint =
[self _xConstraintForAutoresizingMask: autoresizingMask
subitem: subItem
frame: frame
superitem: superItem
bounds: bounds];
NSAutoresizingMaskLayoutConstraint *yConstraint =
[self _yConstraintForAutoresizingMask: autoresizingMask
subitem: subItem
frame: frame
superitem: superItem
bounds: bounds];
NSAutoresizingMaskLayoutConstraint *widthConstraint =
[self _widthConstraintForAutoresizingMask: autoresizingMask
subitem: subItem
frame: frame
superitem: superItem
bounds: bounds];
NSAutoresizingMaskLayoutConstraint *heightConstraint =
[self _heightConstraintForAutoresizingMask: autoresizingMask
subitem: subItem
frame: frame
superitem: superItem
bounds: bounds];
NSMutableArray *constraints = [NSMutableArray arrayWithCapacity:4];
// The order of constraints was determined from MacOS behaviour.
// For the majority of users it will not matter, but we should assume that users have coupled to the ordering.
if ((autoresizingMask & NSViewMinXMargin)
&& (autoresizingMask & NSViewMaxXMargin))
{
[constraints addObject: widthConstraint];
[constraints addObject: xConstraint];
}
else
{
[constraints addObject: xConstraint];
[constraints addObject: widthConstraint];
}
if ((autoresizingMask & NSViewMinYMargin)
&& (autoresizingMask & NSViewMaxYMargin))
{
[constraints addObject: heightConstraint];
[constraints addObject: yConstraint];
}
else
{
[constraints addObject: yConstraint];
[constraints addObject: heightConstraint];
}
return constraints;
}
+ (NSAutoresizingMaskLayoutConstraint *)
_xConstraintForAutoresizingMask: (NSAutoresizingMaskOptions)autoresizingMask
subitem: (NSView *)subItem
@ -292,4 +224,72 @@ static NSUInteger maxYAttribute = 37;
}
}
+ (NSArray *)constraintsWithAutoresizingMask:
(NSAutoresizingMaskOptions) autoresizingMask
subitem: (NSView *) subItem
frame: (NSRect) frame
superitem: (NSView *) superItem
bounds: (NSRect) bounds
{
if (autoresizingMask == NSViewNotSizable)
{
return [NSArray array];
}
NSAutoresizingMaskLayoutConstraint *xConstraint =
[self _xConstraintForAutoresizingMask: autoresizingMask
subitem: subItem
frame: frame
superitem: superItem
bounds: bounds];
NSAutoresizingMaskLayoutConstraint *yConstraint =
[self _yConstraintForAutoresizingMask: autoresizingMask
subitem: subItem
frame: frame
superitem: superItem
bounds: bounds];
NSAutoresizingMaskLayoutConstraint *widthConstraint =
[self _widthConstraintForAutoresizingMask: autoresizingMask
subitem: subItem
frame: frame
superitem: superItem
bounds: bounds];
NSAutoresizingMaskLayoutConstraint *heightConstraint =
[self _heightConstraintForAutoresizingMask: autoresizingMask
subitem: subItem
frame: frame
superitem: superItem
bounds: bounds];
NSMutableArray *constraints = [NSMutableArray arrayWithCapacity:4];
// The order of constraints was determined from MacOS behaviour.
// For the majority of users it will not matter, but we should assume that users have coupled to the ordering.
if ((autoresizingMask & NSViewMinXMargin)
&& (autoresizingMask & NSViewMaxXMargin))
{
[constraints addObject: widthConstraint];
[constraints addObject: xConstraint];
}
else
{
[constraints addObject: xConstraint];
[constraints addObject: widthConstraint];
}
if ((autoresizingMask & NSViewMinYMargin)
&& (autoresizingMask & NSViewMaxYMargin))
{
[constraints addObject: heightConstraint];
[constraints addObject: yConstraint];
}
else
{
[constraints addObject: yConstraint];
[constraints addObject: heightConstraint];
}
return constraints;
}
@end

View file

@ -147,7 +147,12 @@
if (types == nil)
{
types = [[NSArray alloc] initWithObjects: NSTIFFPboardType, nil];
types = [[NSArray alloc] initWithObjects:
NSTIFFPboardType,
#if HAVE_LIBPNG
NSPasteboardTypePNG,
#endif
nil];
}
return types;

View file

@ -464,18 +464,7 @@
- (BOOL) isOpaque
{
// FIXME: Depends on theme; if always returning NO is a performance hit
// we can check if GSTheme is going to draw an old-style opaque box
// or not.
return NO;
// if (_box_type == NSBoxCustom)
// {
// return !_transparent;
// }
// else
// {
// return YES;
// }
return [[GSTheme theme] isBoxOpaque: self];
}
- (NSColor*) fillColor
@ -629,6 +618,22 @@
[self setContentView: cv];
RELEASE(cv);
}
[self setBorderColor: [NSColor clearColor]];
if ([aDecoder containsValueForKey: @"NSBorderColor2"])
{
NSColor *color = [aDecoder decodeObjectForKey: @"NSBorderColor2"];
if (color != nil)
[self setBorderColor:color];
}
[self setFillColor:[NSColor clearColor]];
if ([aDecoder containsValueForKey: @"NSFillColor2"])
{
NSColor *color = [aDecoder decodeObjectForKey:@"NSFillColor2"];
if (color != nil)
[self setFillColor:color];
}
}
else
{

View file

@ -458,7 +458,7 @@ static BOOL browserUseBezels;
}
}
/** <p>Returns the index path of the selected item, or nil if there is
/** Returns the index path of the selected item, or nil if there is
no selection.
*/
- (NSIndexPath *) selectionIndexPath
@ -1131,8 +1131,9 @@ static BOOL browserUseBezels;
return _firstVisibleColumn;
}
/** <p>Returns the number of columns visible.</p>
<p>See Also: -firstVisibleColumn -lastVisibleColumn</p>*/
/** Returns the number of columns visible.
<p>See Also: -firstVisibleColumn -lastVisibleColumn</p> */
- (NSInteger) numberOfVisibleColumns
{
NSInteger num;

View file

@ -1605,6 +1605,15 @@ static NSString *_placeholderItem = nil;
/* Creating Collection view Items */
- (NSNib *) _nibForClass: (Class)cls
{
NSString *clsName = NSStringFromClass(cls);
NSNib *nib = [[NSNib alloc] initWithNibNamed: clsName
bundle: [NSBundle bundleForClass: cls]];
AUTORELEASE(nib);
return nib;
}
- (NSCollectionViewItem *) makeItemWithIdentifier: (NSUserInterfaceItemIdentifier)identifier
forIndexPath: (NSIndexPath *)indexPath
{
@ -1703,15 +1712,6 @@ static NSString *_placeholderItem = nil;
/* Configuring the Collection view */
- (NSNib *) _nibForClass: (Class)cls
{
NSString *clsName = NSStringFromClass(cls);
NSNib *nib = [[NSNib alloc] initWithNibNamed: clsName
bundle: [NSBundle bundleForClass: cls]];
AUTORELEASE(nib);
return nib;
}
- (NSView *) backgroundView
{
return _backgroundView;
@ -1987,7 +1987,7 @@ static NSString *_placeholderItem = nil;
return _allowsEmptySelection;
}
- (void) setAllowsEmptySelection: (BOOL)flag;
- (void) setAllowsEmptySelection: (BOOL)flag
{
_allowsEmptySelection = flag;
}

View file

@ -146,7 +146,7 @@
_maximumNumberOfRows = maxRows;
}
- (NSUInteger) maximumNumberOfRows;
- (NSUInteger) maximumNumberOfRows
{
return _maximumNumberOfRows;
}

View file

@ -176,7 +176,7 @@
return self;
}
- (void) dealloc;
- (void) dealloc
{
RELEASE(_attributes);
[super dealloc];

View file

@ -50,7 +50,7 @@ relativeCenterPosition: (NSPoint)relativeCenterPoint;
@implementation NSGradient
- (NSColorSpace *) colorSpace;
- (NSColorSpace *) colorSpace
{
return _colorSpace;
}
@ -133,7 +133,7 @@ relativeCenterPosition: (NSPoint)relativeCenterPoint
*location = _locations[index];
}
- (id) initWithColors: (NSArray *)colorArray;
- (id) initWithColors: (NSArray *)colorArray
{
return [self initWithColors: colorArray
atLocations: NULL
@ -142,7 +142,7 @@ relativeCenterPosition: (NSPoint)relativeCenterPoint
- (id) initWithColors: (NSArray *)colorArray
atLocations: (const CGFloat *)locations
colorSpace: (NSColorSpace *)colorSpace;
colorSpace: (NSColorSpace *)colorSpace
{
if ((self = [super init]))
{

View file

@ -320,6 +320,7 @@ NSGraphicsContext *GSCurrentContext(void)
DESTROY(focus_stack);
DESTROY(context_data);
DESTROY(context_info);
DESTROY(_shadow);
[super dealloc];
}
@ -345,12 +346,12 @@ NSGraphicsContext *GSCurrentContext(void)
* be protected from other threads.
*/
[contextLock lock];
methods = [[classMethodTable objectForKey: [self class]] pointerValue];
methods = [[classMethodTable objectForKey: (id<NSCopying>)[self class]] pointerValue];
if (methods == 0)
{
methods = [[self class] _initializeMethodTable];
[classMethodTable setObject: [NSValue valueWithPointer: methods]
forKey: [self class]];
forKey: (id<NSCopying>)[self class]];
}
[contextLock unlock];
}
@ -359,7 +360,7 @@ NSGraphicsContext *GSCurrentContext(void)
- (id) initWithGraphicsPort: (void *)port
flipped: (BOOL)flag;
flipped: (BOOL)flag
{
self = [self init];
if (self != nil)
@ -515,6 +516,17 @@ NSGraphicsContext *GSCurrentContext(void)
{
}
/* Private method for handling shadows */
- (void) setShadow: (NSShadow *)shadow
{
ASSIGN(_shadow, shadow);
}
- (NSShadow *) shadow
{
return _shadow;
}
@end
@implementation NSGraphicsContext (Private)

View file

@ -541,27 +541,27 @@
return _xPlacement;
}
- (void) setXPlacement: (NSGridCellPlacement)x;
- (void) setXPlacement: (NSGridCellPlacement)x
{
_xPlacement = x;
}
- (NSGridCellPlacement) yPlacement;
- (NSGridCellPlacement) yPlacement
{
return _yPlacement;
}
- (void) setYPlacement: (NSGridCellPlacement)y;
- (void) setYPlacement: (NSGridCellPlacement)y
{
_yPlacement = y;
}
- (NSGridRowAlignment) rowAlignment;
- (NSGridRowAlignment) rowAlignment
{
return _rowAlignment;
}
- (void) setRowAlignment: (NSGridRowAlignment)a;
- (void) setRowAlignment: (NSGridRowAlignment)a
{
_rowAlignment = a;
}

View file

@ -69,6 +69,18 @@ static Class imageCellClass;
usedCellClass = factoryId ? factoryId : imageCellClass;
}
+ (instancetype) imageViewWithImage: (NSImage *)image
{
NSImageView *imageView = AUTORELEASE([[NSImageView alloc] init]);
[imageView setImage: image];
return imageView;
}
//
// Instance methods
//
- (id) initWithFrame: (NSRect)aFrame
{
@ -340,7 +352,15 @@ static Class imageCellClass;
}
}
}
[super mouseDown: theEvent];
if (![self isEditable] && [self nextResponder] != nil)
{
[[self nextResponder] mouseDown:theEvent];
}
else
{
[super mouseDown: theEvent];
}
}
- (NSDragOperation) draggingSourceOperationMaskForLocal: (BOOL)isLocal

View file

@ -131,7 +131,7 @@ NSInterfaceStyleForKey(NSString *key, NSResponder *responder)
* First try the cache - then, if no style is found, use the
* defaults system and add the results into the cache.
*/
style = (NSInterfaceStyle)NSMapGet(styleMap, key);
style = (NSInterfaceStyle)(uintptr_t)NSMapGet(styleMap, key);
if (style == NSNoInterfaceStyle)
{
NSUserDefaults *defs;
@ -231,7 +231,7 @@ NSInterfaceStyleForKey(NSString *key, NSResponder *responder)
}
}
if (newStyle != ((NSInterfaceStyle)val))
if (newStyle != ((NSInterfaceStyle)(uintptr_t)val))
{
NSMapInsert(styleMap, (void*)key, (void*)newStyle);
}

View file

@ -86,7 +86,7 @@
constant: c];
}
- (NSLayoutConstraint *) constraintLessThanOrEqualToAnchor: (NSLayoutAnchor *)anchor constant: (CGFloat)c;
- (NSLayoutConstraint *) constraintLessThanOrEqualToAnchor: (NSLayoutAnchor *)anchor constant: (CGFloat)c
{
return [NSLayoutConstraint constraintWithItem: _item
attribute: NSLayoutAttributeLeft

View file

@ -261,7 +261,7 @@ static NSMutableArray *activeConstraints = nil;
attribute: (NSLayoutAttribute)secondAttribute
multiplier: (CGFloat)multiplier
constant: (CGFloat)constant
priority: (CGFloat)priority;
priority: (CGFloat)priority
{
self = [super init];
if (self != nil)
@ -620,17 +620,17 @@ static NSMutableArray *activeConstraints = nil;
@implementation NSWindow (NSConstraintBasedLayoutCoreMethods)
- (void) updateConstraintsIfNeeded
{
[[self contentView] updateConstraintsForSubtreeIfNeeded];
}
- (void) layoutIfNeeded
{
[self updateConstraintsIfNeeded];
[[self contentView] _layoutViewAndSubViews];
}
- (void) updateConstraintsIfNeeded
{
[[self contentView] updateConstraintsForSubtreeIfNeeded];
}
- (void) _bootstrapAutoLayout
{
GSAutoLayoutEngine *layoutEngine = [[GSAutoLayoutEngine alloc] init];

View file

@ -1337,11 +1337,11 @@ has the same y origin and height as the line frag rect it is in.
return NO;
}
- (void) setAllowsNonContiguousLayout: (BOOL)flag;
- (void) setAllowsNonContiguousLayout: (BOOL)flag
{
}
- (BOOL) hasNonContiguousLayout;
- (BOOL) hasNonContiguousLayout
{
return NO;
}

View file

@ -1445,9 +1445,9 @@ static BOOL menuBarVisible = YES;
[menu _rightMouseDisplay: event];
}
- (void) popUpMenuPositionItem: (NSMenuItem *)item
atLocation: (NSPoint) point
inView: (NSView *) view
- (void) popUpMenuPositioningItem: (NSMenuItem *)item
atLocation: (NSPoint) point
inView: (NSView *) view
{
NSRect cellFrame = [view convertRect: [view bounds] toView: nil];
NSWindow *w = [view window];
@ -1465,6 +1465,15 @@ static BOOL menuBarVisible = YES;
selectedItem: selectedItem];
}
- (void) popUpMenuPositionItem: (NSMenuItem *)item
atLocation: (NSPoint) point
inView: (NSView *) view
{
[self popUpMenuPositioningItem: item
atLocation: point
inView: view];
}
/*
* NSObject Protocol
*/

View file

@ -650,7 +650,7 @@ static Class imageClass;
NSString *action;
NSString *key;
BOOL isSeparator = NO;
int keyMask;
NSNumber *keyMask;
if ([aDecoder containsValueForKey: @"NSIsSeparator"])
{
@ -703,10 +703,18 @@ static Class imageClass;
[self setSubmenu: submenu];
}
// Set the key mask regardless of whether it is present;
// i.e. set it to 0 if it is not present in the nib.
keyMask = [aDecoder decodeIntForKey: @"NSKeyEquivModMask"];
[self setKeyEquivalentModifierMask: keyMask];
// Set the key mask when it is present; or default to NSCommandKeyMask
// when not specified
keyMask = (NSNumber*)[aDecoder decodeObjectForKey: @"NSKeyEquivModMask"];
if (keyMask != nil)
{
[self setKeyEquivalentModifierMask: [keyMask intValue]];
}
else
{
[self setKeyEquivalentModifierMask: NSCommandKeyMask];
}
if ([aDecoder containsValueForKey: @"NSMnemonicLoc"])
{

View file

@ -61,32 +61,32 @@
return NO;
}
- (void) gotoPosterFrame: (id)sender;
- (void) gotoPosterFrame: (id)sender
{
//FIXME
}
- (void) gotoBeginning: (id)sender;
- (void) gotoBeginning: (id)sender
{
//FIXME
}
- (void) gotoEnd: (id)sender;
- (void) gotoEnd: (id)sender
{
//FIXME
}
- (void) stepForward: (id)sender;
- (void) stepForward: (id)sender
{
//FIXME
}
- (void) stepBack: (id)sender;
- (void) stepBack: (id)sender
{
//FIXME
}
- (void) setRate: (float)rate;
- (void) setRate: (float)rate
{
_rate = rate;
}
@ -168,17 +168,17 @@
return [self bounds];
}
- (void) resizeWithMagnification: (float)magnification;
- (void) resizeWithMagnification: (float)magnification
{
//FIXME
}
- (NSSize) sizeForMagnification: (float)magnification;
- (NSSize) sizeForMagnification: (float)magnification
{
//FIXME
return NSMakeSize(0, 0);
}
- (void) setEditable: (BOOL)editable;
- (void) setEditable: (BOOL)editable
{
_flags.editable = editable;
}

View file

@ -39,8 +39,8 @@
*/
#import "config.h"
#import <Foundation/NSArray.h>
#import <Foundation/NSArchiver.h>
#import <Foundation/NSArray.h>
#import <Foundation/NSBundle.h>
#import <Foundation/NSData.h>
#import <Foundation/NSDebug.h>
@ -53,6 +53,21 @@
#import "AppKit/NSNibLoading.h"
#import "GNUstepGUI/GSModelLoaderFactory.h"
@implementation NSObject (NSNibLoading)
- (void) awakeFromNib
{
// empty implementation, so that all objects respond...
}
- (void) prepareForInterfaceBuilder
{
// empty implementation, so that all objects respond...
}
@end
@implementation NSNib
// private method to read in the data...

View file

@ -62,6 +62,7 @@
#import "AppKit/NSTextFieldCell.h"
#import "AppKit/NSWindow.h"
#import "GNUstepGUI/GSTheme.h"
#import "GSGuiPrivate.h"
#include <math.h>
@ -297,6 +298,12 @@ static NSImage *unexpandable = nil;
// Should only mark the rect below the closed item for redraw
[self setNeedsDisplay: YES];
// If it is view based, then refresh the outline view...
if (_viewBased)
{
[self reloadData];
}
}
}
@ -374,6 +381,12 @@ static NSImage *unexpandable = nil;
// Should only mark the rect below the expanded item for redraw
[self setNeedsDisplay: YES];
// If it is view based, then refresh the outline view...
if (_viewBased)
{
[self reloadData];
}
}
}
@ -688,7 +701,9 @@ static NSImage *unexpandable = nil;
CHECK_REQUIRED_METHOD(outlineView:child:ofItem:);
CHECK_REQUIRED_METHOD(outlineView:isItemExpandable:);
CHECK_REQUIRED_METHOD(outlineView:numberOfChildrenOfItem:);
CHECK_REQUIRED_METHOD(outlineView:objectValueForTableColumn:byItem:);
// This method is @optional in NSOutlineViewDataSource as of macOS10.0
// CHECK_REQUIRED_METHOD(outlineView:objectValueForTableColumn:byItem:);
// Is the data source editable?
_dataSource_editable = [anObject respondsToSelector:
@ -705,6 +720,18 @@ static NSImage *unexpandable = nil;
*/
- (void) reloadData
{
// Refresh the views if it is view based...
if (_viewBased)
{
NSEnumerator *en = [[self subviews] objectEnumerator];
NSView *v = nil;
while ((v = [en nextObject]) != nil)
{
[v removeFromSuperview];
}
}
// release the old array
if (_items != nil)
{
@ -830,7 +857,7 @@ static NSImage *unexpandable = nil;
{
NSImage *image;
id item = [self itemAtRow:_clickedRow];
id item = [self itemAtRow: _clickedRow];
NSInteger level = [self levelForRow: _clickedRow];
NSInteger position = 0;
@ -851,8 +878,8 @@ static NSImage *unexpandable = nil;
position += _columnOrigins[_clickedColumn];
if ([self isExpandable:item]
&& location.x >= position
&& location.x <= position + [image size].width)
&& location.x >= position - 5
&& location.x <= position + [image size].width + 10)
{
BOOL withChildren =
([theEvent modifierFlags] & NSAlternateKeyMask) ? YES : NO;
@ -922,136 +949,17 @@ static NSImage *unexpandable = nil;
*/
- (void) drawRow: (NSInteger)rowIndex clipRect: (NSRect)aRect
{
NSInteger startingColumn;
NSInteger endingColumn;
NSRect drawingRect;
NSCell *imageCell = nil;
NSRect imageRect;
NSInteger i;
CGFloat x_pos;
if (_dataSource == nil)
if (_viewBased)
{
return;
[[GSTheme theme] drawCellViewRow: rowIndex
clipRect: aRect
inView: self];
}
/* Using columnAtPoint: here would make it called twice per row per drawn
rect - so we avoid it and do it natively */
if (rowIndex >= _numberOfRows)
else
{
return;
}
/* Determine starting column as fast as possible */
x_pos = NSMinX (aRect);
i = 0;
while ((i < _numberOfColumns) && (x_pos > _columnOrigins[i]))
{
i++;
}
startingColumn = (i - 1);
if (startingColumn == -1)
startingColumn = 0;
/* Determine ending column as fast as possible */
x_pos = NSMaxX (aRect);
// Nota Bene: we do *not* reset i
while ((i < _numberOfColumns) && (x_pos > _columnOrigins[i]))
{
i++;
}
endingColumn = (i - 1);
if (endingColumn == -1)
endingColumn = _numberOfColumns - 1;
/* Draw the row between startingColumn and endingColumn */
for (i = startingColumn; i <= endingColumn; i++)
{
id item = [self itemAtRow: rowIndex];
NSTableColumn *tb = [_tableColumns objectAtIndex: i];
NSCell *cell = [self preparedCellAtColumn: i row: rowIndex];
[self _willDisplayCell: cell
forTableColumn: tb
row: rowIndex];
if (i == _editedColumn && rowIndex == _editedRow)
{
[cell _setInEditing: YES];
[cell setShowsFirstResponder: YES];
}
else
{
[cell setObjectValue: [_dataSource outlineView: self
objectValueForTableColumn: tb
byItem: item]];
}
drawingRect = [self frameOfCellAtColumn: i
row: rowIndex];
if (tb == _outlineTableColumn)
{
NSImage *image = nil;
NSInteger level = 0;
CGFloat indentationFactor = 0.0;
// float originalWidth = drawingRect.size.width;
// display the correct arrow...
if ([self isItemExpanded: item])
{
image = expanded;
}
else
{
image = collapsed;
}
if (![self isExpandable: item])
{
image = unexpandable;
}
level = [self levelForItem: item];
indentationFactor = _indentationPerLevel * level;
imageCell = [[NSCell alloc] initImageCell: image];
imageRect = [self frameOfOutlineCellAtRow: rowIndex];
if ([_delegate respondsToSelector: @selector(outlineView:willDisplayOutlineCell:forTableColumn:item:)])
{
[_delegate outlineView: self
willDisplayOutlineCell: imageCell
forTableColumn: tb
item: item];
}
/* Do not indent if the delegate set the image to nil. */
if ([imageCell image])
{
imageRect.size.width = [image size].width;
imageRect.size.height = [image size].height;
[imageCell drawWithFrame: imageRect inView: self];
drawingRect.origin.x
+= indentationFactor + imageRect.size.width + 5;
drawingRect.size.width
-= indentationFactor + imageRect.size.width + 5;
}
else
{
drawingRect.origin.x += indentationFactor;
drawingRect.size.width -= indentationFactor;
}
RELEASE(imageCell);
}
[cell drawWithFrame: drawingRect inView: self];
if (i == _editedColumn && rowIndex == _editedRow)
{
[cell _setInEditing: NO];
[cell setShowsFirstResponder: NO];
}
[[GSTheme theme] drawOutlineViewRow: rowIndex
clipRect: aRect
inView: self];
}
}
@ -1804,9 +1712,9 @@ Also returns the child index relative to this parent. */
- (BOOL) _shouldSelectionChange
{
if ([_delegate respondsToSelector:
@selector (selectionShouldChangeInTableView:)] == YES)
@selector (selectionShouldChangeInOutlineView:)] == YES)
{
if ([_delegate selectionShouldChangeInTableView: self] == NO)
if ([_delegate selectionShouldChangeInOutlineView: self] == NO)
{
return NO;
}
@ -2273,19 +2181,24 @@ Also returns the child index relative to this parent. */
- (NSCell *) preparedCellAtColumn: (NSInteger)columnIndex row: (NSInteger)rowIndex
{
NSCell *cell = nil;
NSTableColumn *tb = [_tableColumns objectAtIndex: columnIndex];
if ([_delegate respondsToSelector:
@selector(outlineView:dataCellForTableColumn:item:)])
if (_viewBased == NO)
{
id item = [self itemAtRow: rowIndex];
cell = [_delegate outlineView: self dataCellForTableColumn: tb
item: item];
}
if (cell == nil)
{
cell = [tb dataCellForRow: rowIndex];
NSTableColumn *tb = [_tableColumns objectAtIndex: columnIndex];
if ([_delegate respondsToSelector:
@selector(outlineView:dataCellForTableColumn:item:)])
{
id item = [self itemAtRow: rowIndex];
cell = [_delegate outlineView: self dataCellForTableColumn: tb
item: item];
}
if (cell == nil)
{
cell = [tb dataCellForRow: rowIndex];
}
}
return cell;
}

View file

@ -81,7 +81,7 @@
_orientation = orientation;
}
- (NSSize) paperSize;
- (NSSize) paperSize
{
return _paperSize;
}

View file

@ -1999,7 +1999,7 @@ static NSMapTable *mimeMap = NULL;
Protocol *p = @protocol(GSPasteboardSvr);
[conn enableMultipleThreads];
[conn setReplyTimeout:2.0];
[conn setReplyTimeout: 30.0];
[(id)the_server setProtocolForProxy: p];
[[NSNotificationCenter defaultCenter]
addObserver: self

View file

@ -139,7 +139,7 @@ static Class pathCellClass;
[self setNeedsDisplay];
}
- (SEL) doubleAction;
- (SEL) doubleAction
{
return [_cell doubleAction];
}
@ -210,7 +210,7 @@ static Class pathCellClass;
}
}
- (NSArray *) allowedTypes;
- (NSArray *) allowedTypes
{
return [_cell allowedTypes];
}

View file

@ -55,7 +55,7 @@
rightExpressionAttributeType: (NSAttributeType)attrType
modifier: (NSComparisonPredicateModifier)modif
operators: (NSArray *)ops
options: (NSUInteger)opts;
options: (NSUInteger)opts
{
return self;
}
@ -64,7 +64,7 @@
rightExpressions: (NSArray *)rightExprs
modifier: (NSComparisonPredicateModifier)modif
operators: (NSArray *)ops
options: (NSUInteger)opts;
options: (NSUInteger)opts
{
return self;
}

View file

@ -1831,6 +1831,28 @@ GSOppositeEdge(NSRectEdge edge)
}
}
- (NSScrollerStyle)scrollerStyle {
return _scrollerStyle;
}
- (void)setScrollerStyle:(NSScrollerStyle)style {
[[self horizontalScroller] setScrollerStyle:style];
[[self verticalScroller] setScrollerStyle:style];
_scrollerStyle = style;
}
- (NSScrollerKnobStyle)scrollerKnobStyle {
return _scrollerKnobStyle;
}
- (void)setScrollerKnobStyle:(NSScrollerKnobStyle)style {
[[self horizontalScroller] setKnobStyle:style];
[[self verticalScroller] setKnobStyle:style];
_scrollerKnobStyle = style;
}
- (void)flashScrollers {
[[self horizontalScroller] flashScroller];
[[self verticalScroller] flashScroller];
}
@end
@implementation NSScrollView (GSPrivate)

View file

@ -139,6 +139,24 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
return NSScrollerStyleLegacy;
}
- (NSScrollerStyle)scrollerStyle {
// FIXME: we should support other scroller styles.
return NSScrollerStyleLegacy;
}
- (void)setScrollerStyle:(NSScrollerStyle)style {
if(style == NSScrollerStyleOverlay) NSWarnLog(@"GNUstep does not support overlay scrollbars.");
}
- (NSScrollerKnobStyle)knobStyle {
// FIXME: We should set this as an ivar so themes can use this.
return NSScrollerKnobStyleDefault;
}
- (void)setKnobStyle:(NSScrollerKnobStyle)style {
NSWarnLog(@"GNUstep does not support custom scroller knob styles.");
}
- (void)flashScroller {
}
- (BOOL) isFlipped
{
return YES;

View file

@ -109,7 +109,7 @@
[super dealloc];
}
- (id) copyWithZone: (NSZone*)zone;
- (id) copyWithZone: (NSZone*)zone
{
NSSearchFieldCell *c = [super copyWithZone: zone];
@ -345,7 +345,7 @@
return text;
}
- (NSRect) searchButtonRectForBounds: (NSRect)rect;
- (NSRect) searchButtonRectForBounds: (NSRect)rect
{
NSRect search, part;

View file

@ -298,7 +298,7 @@
return self;
}
- (id) copyWithZone: (NSZone *)zone;
- (id) copyWithZone: (NSZone *)zone
{
NSSegmentedCell *c = (NSSegmentedCell *)[super copyWithZone: zone];

View file

@ -30,6 +30,7 @@
#import <Foundation/NSString.h>
#import "AppKit/NSShadow.h"
#import "AppKit/NSColor.h"
#import "AppKit/NSGraphicsContext.h"
@implementation NSShadow
@ -96,7 +97,8 @@
- (void) set
{
// FIXME: Implement
NSGraphicsContext *ctxt = GSCurrentContext();
[ctxt setShadow: self];
}
- (void) encodeWithCoder: (NSCoder*)aCoder
@ -128,7 +130,7 @@
_radius = [aDecoder decodeFloatForKey: @"NSShadowBlurRadius"];
_offset = NSMakeSize([aDecoder decodeFloatForKey: @"NSShadowHoriz"],
[aDecoder decodeFloatForKey: @"NSShadowVert"]);
_color = [[aDecoder decodeObjectForKey: @"NSShadowColor"] retain];
_color = RETAIN([aDecoder decodeObjectForKey: @"NSShadowColor"]);
}
else
{
@ -136,7 +138,7 @@
[aDecoder decodeValueOfObjCType: @encode(float) at: &radius];
_radius = radius;
_offset = [aDecoder decodeSize];
_color = [[aDecoder decodeObject] retain];
_color = RETAIN([aDecoder decodeObject]);
}
return self;
}

216
Source/NSTableCellView.m Normal file
View file

@ -0,0 +1,216 @@
/* Implementation of class NSTableCellView
Copyright (C) 2022 Free Software Foundation, Inc.
By: Gregory John Casamento <greg.casamento@gmail.com>
Date: 12-12-2022
This file is part of the GNUstep 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.1 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; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110 USA.
*/
#import "AppKit/NSTableCellView.h"
#import "AppKit/NSImageView.h"
#import "AppKit/NSTextField.h"
@implementation NSTableCellView
- (instancetype) initWithFrame: (NSRect)frame
{
self = [super initWithFrame: frame];
if (self != nil)
{
_rowSizeStyle = NSTableViewRowSizeStyleDefault;
_backgroundStyle = NSBackgroundStyleLight;
}
return self;
}
- (instancetype) init
{
return [self initWithFrame: NSZeroRect];
}
- (void) dealloc
{
RELEASE(_objectValue);
RELEASE(_imageView);
RELEASE(_textField);
RELEASE(_draggingImageComponents);
[super dealloc];
}
- (id) objectValue
{
return _objectValue;
}
- (void) setObjectValue: (id)objectValue
{
ASSIGN(_objectValue, objectValue);
}
- (NSImageView *) imageView
{
return _imageView;
}
- (void) setImageView: (NSImageView *)imageView
{
ASSIGN(_imageView, imageView);
}
- (NSTextField *) textField
{
return _textField;
}
- (void) setTextField: (NSTextField *)textField
{
ASSIGN(_textField, textField);
}
- (NSBackgroundStyle) backgroundStyle
{
return _backgroundStyle;
}
- (void) setBackgroundStyle: (NSBackgroundStyle)backgroundStyle
{
_backgroundStyle = backgroundStyle;
}
- (NSTableViewRowSizeStyle) rowSizeStyle
{
return _rowSizeStyle;
}
- (void) setRowSizeStyle: (NSTableViewRowSizeStyle)rowSizeStyle
{
_rowSizeStyle = rowSizeStyle;
}
- (NSArray *) draggingImageComponents
{
return _draggingImageComponents;
}
- (void) setDraggingImageComponents: (NSArray *)draggingImageComponents
{
ASSIGNCOPY(_draggingImageComponents, draggingImageComponents);
}
- (void) encodeWithCoder: (NSCoder *)coder
{
[super encodeWithCoder: coder];
if ([coder allowsKeyedCoding])
{
[coder encodeObject: [self objectValue]
forKey: @"NSObjectValue"];
[coder encodeObject: [self imageView]
forKey: @"NSImageView"];
[coder encodeObject: [self textField]
forKey: @"NSTextField"];
[coder encodeInt: [self backgroundStyle]
forKey: @"NSBackgroundStyle"];
[coder encodeInt: [self rowSizeStyle]
forKey: @"NSTableViewRowSizeStyle"];
[coder encodeObject: [self draggingImageComponents]
forKey: @"NSDraggingImageComponents"];
}
else
{
[coder encodeObject: _objectValue];
[coder encodeObject: _imageView];
[coder encodeObject: _textField];
[coder encodeObject: _draggingImageComponents];
[coder encodeValueOfObjCType: @encode(NSBackgroundStyle)
at: &_backgroundStyle];
[coder encodeValueOfObjCType: @encode(NSTableViewRowSizeStyle)
at: &_rowSizeStyle];
}
}
- (id) initWithCoder: (NSCoder *)coder
{
self = [super initWithCoder: coder];
if (self != nil)
{
if ([coder allowsKeyedCoding])
{
if ([coder containsValueForKey: @"NSObjectValue"])
{
[self setObjectValue: [coder decodeObjectForKey: @"NSObjectValue"]];
}
if ([coder containsValueForKey: @"NSImageView"])
{
[self setImageView: [coder decodeObjectForKey: @"NSImageView"]];
}
if ([coder containsValueForKey: @"NSTextField"])
{
[self setTextField: [coder decodeObjectForKey: @"NSTextField"]];
}
if ([coder containsValueForKey: @"NSBackgroundStyle"])
{
[self setBackgroundStyle: [coder decodeIntForKey: @"NSBackgroundStyle"]];
}
if ([coder containsValueForKey: @"NSTableViewRowSizeStyle"])
{
[self setRowSizeStyle: [coder decodeIntForKey: @"NSTableViewRowSizeStyle"]];
}
if ([coder containsValueForKey: @"NSDraggingImageComponents"])
{
[self setDraggingImageComponents: [coder decodeObjectForKey: @"NSDraggingImageComponents"]];
}
}
else
{
[self setObjectValue: [coder decodeObject]];
[self setImageView: [coder decodeObject]];
[self setTextField: [coder decodeObject]];
[self setDraggingImageComponents: [coder decodeObject]];
[coder decodeValueOfObjCType: @encode(NSBackgroundStyle)
at: &_backgroundStyle];
[coder decodeValueOfObjCType: @encode(NSTableViewRowSizeStyle)
at: &_rowSizeStyle];
}
}
return self;
}
- (id) copyWithZone: (NSZone *)zone
{
NSTableCellView *copy = [[NSTableCellView allocWithZone: zone] init];
[copy setObjectValue: [self objectValue]];
[copy setImageView: [self imageView]];
[copy setTextField: [self textField]];
[copy setDraggingImageComponents: [self draggingImageComponents]];
[copy setBackgroundStyle: [self backgroundStyle]];
[copy setRowSizeStyle: [self rowSizeStyle]];
return copy;
}
@end

View file

@ -73,6 +73,11 @@
#import "AppKit/NSTableView.h"
#import "GSBindingHelpers.h"
@interface NSTableView (__NSTableColumnPrivate__)
- (void) _registerPrototypeViews: (NSArray *)prototypeViews;
@end
/**
<p>
NSTableColumn objects represent columns in NSTableViews.
@ -89,7 +94,7 @@
{
if (self == [NSTableColumn class])
{
[self setVersion: 3];
[self setVersion: 4];
[self exposeBinding: NSValueBinding];
[self exposeBinding: NSEnabledBinding];
}
@ -127,8 +132,9 @@
_headerToolTip = nil;
_sortDescriptorPrototype = nil;
ASSIGN (_identifier, anObject);
_prototypeCellViews = nil;
ASSIGN (_identifier, anObject);
return self;
}
@ -141,6 +147,7 @@
RELEASE(_headerToolTip);
RELEASE(_dataCell);
RELEASE(_sortDescriptorPrototype);
RELEASE(_prototypeCellViews);
TEST_RELEASE(_identifier);
[super dealloc];
}
@ -491,6 +498,7 @@ to YES. */
[aCoder encodeObject: _headerToolTip forKey: @"NSHeaderToolTip"];
[aCoder encodeBool: _is_hidden forKey: @"NSHidden"];
[aCoder encodeObject: _tableView forKey: @"NSTableView"];
[aCoder encodeObject: _prototypeCellViews forKey: @"NSPrototypeCellViews"];
}
else
{
@ -506,6 +514,8 @@ to YES. */
[aCoder encodeObject: _dataCell];
[aCoder encodeObject: _sortDescriptorPrototype];
[aCoder encodeObject: _tableView];
[aCoder encodeObject: _prototypeCellViews];
}
}
@ -572,6 +582,11 @@ to YES. */
{
[self setTableView: [aDecoder decodeObjectForKey: @"NSTableView"]];
}
if ([aDecoder containsValueForKey: @"NSPrototypeCellViews"])
{
ASSIGN(_prototypeCellViews, [aDecoder decodeObjectForKey: @"NSPrototypeCellViews"]);
[_tableView _registerPrototypeViews: _prototypeCellViews];
}
}
else
{
@ -597,6 +612,13 @@ to YES. */
{
_sortDescriptorPrototype = RETAIN([aDecoder decodeObject]);
}
if (version >= 4)
{
_tableView = [aDecoder decodeObject]; // not retained, tableView retains us...
_prototypeCellViews = RETAIN([aDecoder decodeObject]);
[_tableView _registerPrototypeViews: _prototypeCellViews];
}
}
else
{
@ -613,6 +635,21 @@ to YES. */
return self;
}
- (NSArray *) _prototypeCellViews
{
return _prototypeCellViews;
}
- (void) setTitle: (NSString *)title
{
[_headerCell setStringValue: title];
}
- (NSString *) title
{
return [_headerCell stringValue];
}
- (void) setValue: (id)anObject forKey: (NSString*)aKey
{
if ([aKey isEqual: NSValueBinding])

30
Source/NSTableRowView.m Normal file
View file

@ -0,0 +1,30 @@
/* Implementation of class NSTableRowView
Copyright (C) 2022 Free Software Foundation, Inc.
By: Gregory John Casamento
Date: 03-09-2022
This file is part of the GNUstep 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.1 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; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110 USA.
*/
#import "AppKit/NSTableRowView.h"
@implementation NSTableRowView
@end

View file

@ -54,6 +54,8 @@
#import "AppKit/NSImage.h"
#import "AppKit/NSGraphics.h"
#import "AppKit/NSKeyValueBinding.h"
#import "AppKit/NSNib.h"
#import "AppKit/NSNibLoading.h"
#import "AppKit/NSScroller.h"
#import "AppKit/NSScrollView.h"
#import "AppKit/NSTableColumn.h"
@ -66,13 +68,15 @@
#import "AppKit/NSPasteboard.h"
#import "AppKit/NSDragging.h"
#import "AppKit/NSCustomImageRep.h"
#import "GNUstepGUI/GSTheme.h"
#import "GSBindingHelpers.h"
#include <math.h>
static NSNotificationCenter *nc = nil;
static const int currentVersion = 5;
static const int currentVersion = 6;
static NSRect oldDraggingRect;
static NSInteger oldDropRow;
@ -96,9 +100,17 @@ typedef struct _tableViewFlags
unsigned int emptySelection:1;
unsigned int multipleSelection:1;
unsigned int columnSelection:1;
unsigned int _unused:26;
unsigned int unknown1:1;
unsigned int columnAutosave:1;
unsigned int alternatingRowBackgroundColors:1;
unsigned int unknown2:3;
unsigned int _unused:20;
#else
unsigned int _unused:26;
unsigned int _unused:20;
unsigned int unknown2:3;
unsigned int alternatingRowBackgroundColors:1;
unsigned int columnAutosave:1;
unsigned int unknown1:1;
unsigned int columnSelection:1;
unsigned int multipleSelection:1;
unsigned int emptySelection:1;
@ -2035,6 +2047,11 @@ static void computeNewSelection
| NSDragOperationLink | NSDragOperationGeneric | NSDragOperationPrivate;
_draggingSourceOperationMaskForRemote = NSDragOperationNone;
ASSIGN(_sortDescriptors, [NSArray array]);
_viewBased = NO;
_renderedViewPaths = RETAIN([NSMapTable strongToWeakObjectsMapTable]);
_pathsToViews = RETAIN([NSMapTable weakToStrongObjectsMapTable]);
_registeredNibs = [[NSMutableDictionary alloc] init];
_registeredViews = [[NSMutableDictionary alloc] init];
}
- (id) initWithFrame: (NSRect)frameRect
@ -2066,6 +2083,10 @@ static void computeNewSelection
RELEASE (_selectedColumns);
RELEASE (_selectedRows);
RELEASE (_sortDescriptors);
RELEASE (_renderedViewPaths);
RELEASE (_pathsToViews);
RELEASE (_registeredNibs);
RELEASE (_registeredViews);
TEST_RELEASE (_headerView);
TEST_RELEASE (_cornerView);
if (_autosaveTableColumns == YES)
@ -2346,6 +2367,12 @@ static void computeNewSelection
- (void) reloadData
{
if (_viewBased)
{
[_renderedViewPaths removeAllObjects];
[_pathsToViews removeAllObjects];
}
[self noteNumberOfRowsChanged];
[self setNeedsDisplay: YES];
}
@ -2560,13 +2587,16 @@ static void computeNewSelection
- (void) setUsesAlternatingRowBackgroundColors: (BOOL)useAlternatingRowColors
{
// FIXME
if (_usesAlternatingRowBackgroundColors != useAlternatingRowColors)
{
_usesAlternatingRowBackgroundColors = useAlternatingRowColors;
[self reloadData];
}
}
- (BOOL) usesAlternatingRowBackgroundColors
{
// FIXME
return NO;
return _usesAlternatingRowBackgroundColors;
}
- (void)setSelectionHighlightStyle: (NSTableViewSelectionHighlightStyle)s
@ -3205,18 +3235,23 @@ byExtendingSelection: (BOOL)flag
- (NSCell *) preparedCellAtColumn: (NSInteger)columnIndex row: (NSInteger)rowIndex
{
NSCell *cell = nil;
NSTableColumn *tb = [_tableColumns objectAtIndex: columnIndex];
if ([_delegate respondsToSelector:
@selector(tableView:dataCellForTableColumn:row:)])
{
cell = [_delegate tableView: self dataCellForTableColumn: tb
row: rowIndex];
}
if (cell == nil)
{
cell = [tb dataCellForRow: rowIndex];
if (_viewBased == NO)
{
NSTableColumn *tb = [_tableColumns objectAtIndex: columnIndex];
if ([_delegate respondsToSelector:
@selector(tableView:dataCellForTableColumn:row:)])
{
cell = [_delegate tableView: self dataCellForTableColumn: tb
row: rowIndex];
}
if (cell == nil)
{
cell = [tb dataCellForRow: rowIndex];
}
}
return cell;
}
@ -3840,26 +3875,27 @@ if (currentRow >= 0 && currentRow < _numberOfRows) \
* so they need to track in mouse up.
*/
NSCell *cell = [self preparedCellAtColumn: _clickedColumn
row: _clickedRow];
row: _clickedRow];
[self _trackCellAtColumn: _clickedColumn
row: _clickedRow
withEvent: theEvent];
row: _clickedRow
withEvent: theEvent];
didTrackCell = YES;
if ([[cell class] prefersTrackingUntilMouseUp])
{
/* the mouse could have gone up outside of the cell
* avoid selecting the row under mouse cursor */
{
/* the mouse could have gone up outside of the cell
* avoid selecting the row under mouse cursor */
sendAction = YES;
done = YES;
}
}
/*
* Since we may have tracked a cell which may have caused
* a change to the currentEvent we may need to loop over
* the current event
*/
*/
getNextEvent = (lastEvent == [NSApp currentEvent]);
}
else
@ -5019,9 +5055,18 @@ This method is deprecated, use -columnIndexesInRect:. */
- (void) drawRow: (NSInteger)rowIndex clipRect: (NSRect)clipRect
{
[[GSTheme theme] drawTableViewRow: rowIndex
clipRect: clipRect
inView: self];
if (_viewBased)
{
[[GSTheme theme] drawCellViewRow: rowIndex
clipRect: clipRect
inView: self];
}
else
{
[[GSTheme theme] drawTableViewRow: rowIndex
clipRect: clipRect
inView: self];
}
}
- (void) noteHeightOfRowsWithIndexesChanged: (NSIndexSet*)indexes
@ -5295,7 +5340,8 @@ This method is deprecated, use -columnIndexesInRect:. */
- (void) setDelegate: (id)anObject
{
const SEL sel = @selector(tableView:willDisplayCell:forTableColumn:row:);
const SEL vbsel = @selector(tableView:viewForTableColumn:row:);
if (_delegate)
[nc removeObserver: _delegate name: nil object: self];
_delegate = anObject;
@ -5313,6 +5359,9 @@ This method is deprecated, use -columnIndexesInRect:. */
/* Cache */
_del_responds = [_delegate respondsToSelector: sel];
/* Test to see if it is view based */
_viewBased = [_delegate respondsToSelector: vbsel];
}
- (id) delegate
@ -5494,11 +5543,16 @@ This method is deprecated, use -columnIndexesInRect:. */
tableViewFlags.drawsGrid = [self drawsGrid];
tableViewFlags.columnResizing = [self allowsColumnResizing];
tableViewFlags.columnOrdering = [self allowsColumnReordering];
tableViewFlags.columnAutosave = [self autosaveTableColumns];
tableViewFlags.alternatingRowBackgroundColors = [self usesAlternatingRowBackgroundColors];
memcpy((void *)&vFlags,(void *)&tableViewFlags,sizeof(unsigned int));
// encode..
[aCoder encodeInt: vFlags forKey: @"NSTvFlags"];
// Encode that the table is view based...
[aCoder encodeBool: _viewBased forKey: @"NSViewBased"];
}
else
{
@ -5534,6 +5588,7 @@ This method is deprecated, use -columnIndexesInRect:. */
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_autoresizesAllColumnsToFit];
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_verticalMotionDrag];
[aCoder encodeObject: _sortDescriptors];
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_viewBased];
}
}
@ -5678,8 +5733,15 @@ This method is deprecated, use -columnIndexesInRect:. */
[self setDrawsGrid: tableViewFlags.drawsGrid];
[self setAllowsColumnResizing: tableViewFlags.columnResizing];
[self setAllowsColumnReordering: tableViewFlags.columnOrdering];
[self setAutosaveTableColumns: tableViewFlags.columnAutosave];
[self setUsesAlternatingRowBackgroundColors: tableViewFlags.alternatingRowBackgroundColors];
}
if ([aDecoder containsValueForKey: @"NSViewBased"])
{
_viewBased = [aDecoder decodeBoolForKey: @"NSViewBased"];
}
// get the table columns...
columns = [aDecoder decodeObjectForKey: @"NSTableColumns"];
e = [columns objectEnumerator];
@ -5729,10 +5791,12 @@ This method is deprecated, use -columnIndexesInRect:. */
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_allowsEmptySelection];
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_allowsColumnSelection];
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_allowsColumnResizing];
if (version >= 3)
{
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_allowsColumnReordering];
}
if (version >= 2)
{
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_autoresizesAllColumnsToFit];
@ -5742,10 +5806,16 @@ This method is deprecated, use -columnIndexesInRect:. */
{
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_verticalMotionDrag];
}
if (version >= 5)
{
ASSIGN(_sortDescriptors, [aDecoder decodeObject]);
}
if (version >= 6)
{
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_viewBased];
}
if (_numberOfColumns > 0)
{
@ -6677,20 +6747,20 @@ For a more detailed explanation, -setSortDescriptors:. */
GSKeyValueBinding *theBinding;
theBinding = [GSKeyValueBinding getBinding: NSValueBinding
forObject: tb];
forObject: tb];
if (theBinding != nil)
{
return [(NSArray *)[theBinding destinationValue]
objectAtIndex: index];
objectAtIndex: index];
}
else if ([_dataSource respondsToSelector:
@selector(tableView:objectValueForTableColumn:row:)])
@selector(tableView:objectValueForTableColumn:row:)])
{
result = [_dataSource tableView: self
objectValueForTableColumn: tb
row: index];
row: index];
}
return result;
}
@ -6699,12 +6769,12 @@ For a more detailed explanation, -setSortDescriptors:. */
row: (NSInteger) index
{
if ([_dataSource respondsToSelector:
@selector(tableView:setObjectValue:forTableColumn:row:)])
@selector(tableView:setObjectValue:forTableColumn:row:)])
{
[_dataSource tableView: self
setObjectValue: value
forTableColumn: tb
row: index];
setObjectValue: value
forTableColumn: tb
row: index];
}
}
@ -6729,7 +6799,7 @@ For a more detailed explanation, -setSortDescriptors:. */
{
return [_dataSource numberOfRowsInTableView:self];
}
else
else if([_tableColumns count] > 0)
{
NSTableColumn *tb = [_tableColumns objectAtIndex: 0];
GSKeyValueBinding *theBinding;
@ -6744,6 +6814,10 @@ For a more detailed explanation, -setSortDescriptors:. */
// FIXME
return 0;
}
else
{
return 0;
}
}
- (BOOL) _isDraggingSource
@ -6803,7 +6877,8 @@ For a more detailed explanation, -setSortDescriptors:. */
- (NSInteger) columnForView: (NSView*)view
{
return NSNotFound;
NSIndexPath *path = [_pathsToViews objectForKey: view];
return [path item];
}
- (void) insertRowsAtIndexes: (NSIndexSet*)indexes
@ -6818,7 +6893,89 @@ For a more detailed explanation, -setSortDescriptors:. */
- (NSInteger) rowForView: (NSView*)view
{
return NSNotFound;
NSIndexPath *path = [_pathsToViews objectForKey: view];
return [path section];
}
- (NSView *) makeViewWithIdentifier: (NSUserInterfaceItemIdentifier)identifier owner: (id)owner
{
NSView *view = [_registeredViews objectForKey: identifier];
if (view != nil)
{
view = [view copy];
[view awakeFromNib];
[owner awakeFromNib];
}
else
{
NSNib *nib = [_registeredNibs objectForKey: identifier];
if (nib != nil)
{
NSArray *tlo = nil;
BOOL loaded = [nib instantiateWithOwner: owner
topLevelObjects: &tlo];
if (loaded)
{
NSEnumerator *en = [tlo objectEnumerator];
id o = nil;
while ((o = [en nextObject]) != nil)
{
if ([o isKindOfClass: [NSView class]])
{
view = o;
break;
}
}
}
else
{
NSLog(@"Failed to load model for identifier %@, in %@", identifier, self);
}
}
}
return view;
}
- (void) registerNib: (NSNib *)nib
forIdentifier: (NSUserInterfaceItemIdentifier)identifier
{
[_registeredNibs setObject: nib
forKey: identifier];
}
- (NSDictionary *) registeredNibsByIdentifier
{
return [_registeredNibs copy];
}
// Private helper methods...
- (void) _registerPrototypeViews: (NSArray *)prototypeViews
{
NSEnumerator *en = [prototypeViews objectEnumerator];
NSView *view = nil;
while ((view = [en nextObject]) != nil)
{
NSUserInterfaceItemIdentifier identifier = [view identifier];
[_registeredViews setObject: view
forKey: identifier];
}
}
- (NSView *) _renderedViewForPath: (NSIndexPath *)path
{
return [_renderedViewPaths objectForKey: path];
}
- (void) _setRenderedView: (NSView *)view forPath: (NSIndexPath *)path
{
[_renderedViewPaths setObject: view forKey: path];
[_pathsToViews setObject: path forKey: view];
}
@end /* implementation of NSTableView */

View file

@ -0,0 +1,30 @@
/* Implementation of class NSTableViewRowAction
Copyright (C) 2022 Free Software Foundation, Inc.
By: Gregory John Casamento
Date: 04-09-2022
This file is part of the GNUstep 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.1 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; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110 USA.
*/
#import "AppKit/NSTableViewRowAction.h"
@implementation NSTableViewRowAction
@end

View file

@ -134,7 +134,7 @@
withTextView: nil];
}
- (void)cancelFindIndicator;
- (void)cancelFindIndicator
{
}

View file

@ -45,7 +45,7 @@
return self;
}
- (void) dealloc;
- (void) dealloc
{
RELEASE(_markerFormat);
[super dealloc];

View file

@ -1142,6 +1142,7 @@ that makes decoding and encoding compatible with the old code.
[notificationCenter removeObserver: _delegate
name: nil
object: _notifObject];
_delegate = nil;
}
DESTROY(_selectedTextAttributes);
@ -4982,6 +4983,44 @@ right.)
RELEASE(attachment);
return YES;
}
if ([type isEqualToString: NSFilenamesPboardType])
{
NSArray *list = [pboard propertyListForType: NSFilenamesPboardType];
NSMutableAttributedString *as = [[NSMutableAttributedString alloc] init];
id<NSFastEnumeration> enumerator = list;
FOR_IN (NSString*, filename, enumerator)
{
NSFileWrapper *fw = [[NSFileWrapper alloc] initWithPath: filename];
if (fw)
{
NSTextAttachment *attachment = [[NSTextAttachment alloc]
initWithFileWrapper: fw];
NSAttributedString *asat =
[NSAttributedString attributedStringWithAttachment: attachment];
RELEASE(fw);
RELEASE(attachment);
[as appendAttributedString: asat];
}
}
END_FOR_IN(enumerator)
if ([as length] != 0 && changeRange.location != NSNotFound &&
[self shouldChangeTextInRange: changeRange
replacementString: [as string]])
{
[self replaceCharactersInRange: changeRange
withAttributedString: as];
[self didChangeText];
changeRange.length = [as length];
[self setSelectedRange: NSMakeRange(NSMaxRange(changeRange),0)];
}
RELEASE(as);
return YES;
}
}
// color accepting
@ -5078,6 +5117,7 @@ right.)
[ret addObject: NSRTFDPboardType];
[ret addObject: NSTIFFPboardType];
[ret addObject: NSFileContentsPboardType];
[ret addObject: NSFilenamesPboardType];
}
if (_tf.is_rich_text)
{

View file

@ -68,9 +68,11 @@
#import "AppKit/NSPrintInfo.h"
#import "AppKit/NSPrintOperation.h"
#import "AppKit/NSScrollView.h"
#import "AppKit/NSShadow.h"
#import "AppKit/NSView.h"
#import "AppKit/NSWindow.h"
#import "AppKit/NSWorkspace.h"
#import "AppKit/NSAppearance.h"
#import "AppKit/PSOperators.h"
#import "GNUstepGUI/GSDisplayServer.h"
#import "GNUstepGUI/GSTrackingRect.h"
@ -569,7 +571,7 @@ GSSetDragTypes(NSView* obj, NSArray *types)
viewClass = [NSView class];
rectClass = [GSTrackingRect class];
NSDebugLLog(@"NSView", @"Initialize NSView class\n");
[self setVersion: 1];
[self setVersion: 2];
// expose bindings
[self exposeBinding: NSToolTipBinding];
@ -771,6 +773,8 @@ GSSetDragTypes(NSView* obj, NSArray *types)
}
TEST_RELEASE(_cursor_rects);
TEST_RELEASE(_tracking_rects);
TEST_RELEASE(_shadow);
[self unregisterDraggedTypes];
[self releaseGState];
@ -1668,7 +1672,7 @@ static NSSize _computeScale(NSSize fs, NSSize bs)
return 0.0;
}
- (void) setFrameCenterRotation:(CGFloat)rot;
- (void) setFrameCenterRotation:(CGFloat)rot
{
// FIXME this is dummy, we don't have layers yet
// we probably need a Matrix akin frame rotation.
@ -4608,6 +4612,12 @@ static NSView* findByTag(NSView *view, NSInteger aTag, NSUInteger *level)
{
[aCoder encodeConditionalObject: _super_view forKey: @"NSSuperview"];
}
// Encode the shadow...
if (_shadow != nil)
{
[aCoder encodeConditionalObject: _shadow forKey: @"NSViewShadow"];
}
}
else
{
@ -4625,6 +4635,9 @@ static NSView* findByTag(NSView *view, NSInteger aTag, NSUInteger *level)
[aCoder encodeConditionalObject: [self nextKeyView]];
[aCoder encodeConditionalObject: [self previousKeyView]];
[aCoder encodeObject: _sub_views];
// Encode view effects attributes...
[aCoder encodeConditionalObject: [self shadow]];
NSDebugLLog(@"NSView", @"NSView: finish encoding\n");
}
}
@ -4737,12 +4750,19 @@ static NSView* findByTag(NSView *view, NSInteger aTag, NSUInteger *level)
[self didAddSubview: sub];
}
// Decode the shadow...
if ([aDecoder containsValueForKey: @"NSViewShadow"])
{
[self setShadow: [aDecoder decodeObjectForKey: @"NSViewShadow"]];
}
// the superview...
//[aDecoder decodeObjectForKey: @"NSSuperview"];
}
else
{
NSRect rect;
int version = [aDecoder versionForClassName: @"NSView"];
NSDebugLLog(@"NSView", @"NSView: start decoding\n");
@ -4798,6 +4818,12 @@ static NSView* findByTag(NSView *view, NSInteger aTag, NSUInteger *level)
[self didAddSubview: sub];
}
RELEASE(subs);
// Decode the shadow if this is version 2 or greater...
if (version >= 2)
{
[self setShadow: [aDecoder decodeObject]];
}
}
return self;
@ -5211,14 +5237,14 @@ static NSView* findByTag(NSView *view, NSInteger aTag, NSUInteger *level)
return _contentCompressionResistancePriority;
}
- (void) setContentCompressionResistancePriority: (NSLayoutPriority)priority;
- (void) setContentCompressionResistancePriority: (NSLayoutPriority)priority
{
_contentCompressionResistancePriority = priority;
}
- (NSSize) intrinsicContentSize
{
return NSMakeSize(NSViewNoIntrinsicMetric, NSViewNoIntrinsicMetric);
return NSMakeSize(NSViewNoIntrinsicMetric, NSViewNoIntrinsicMetric);
}
- (CGFloat) baselineOffsetFromBottom
@ -5231,8 +5257,38 @@ static NSView* findByTag(NSView *view, NSInteger aTag, NSUInteger *level)
return 0;
}
- (void) awakeFromNib
/* Implement NSAppearanceCustomization */
- (NSAppearance*) appearance {
return _appearance;
}
- (void) setAppearance: (NSAppearance*) appearance {
ASSIGNCOPY(_appearance, appearance);
}
- (NSAppearance*) effectiveAppearance {
if (_appearance)
{
return _appearance;
}
else if ([self superview])
{
return [[self superview] effectiveAppearance];
}
else
{
return [NSAppearance currentAppearance];
}
}
- (void) setIdentifier: (NSUserInterfaceItemIdentifier) identifier
{
ASSIGN(_identifier, identifier);
}
- (NSUserInterfaceItemIdentifier) identifier
{
return _identifier;
}
@end
@ -5488,3 +5544,17 @@ cmpFrame(id view1, id view2, void *context)
}
@end
@implementation NSView (CoreAnimationSupport)
- (NSShadow *) shadow
{
return _shadow;
}
- (void) setShadow: (NSShadow *)shadow
{
ASSIGN(_shadow, shadow);
}
@end

View file

@ -5952,6 +5952,30 @@ current key view.<br />
return nil;
}
- (void)beginSheet:(NSWindow *)sheet
completionHandler:(GSNSWindowDidEndSheetCallbackBlock)handler {
// FIXME
NSInteger ret;
[sheet setParentWindow: self];
self->_attachedSheet = sheet;
[[NSNotificationCenter defaultCenter]
postNotificationName: NSWindowWillBeginSheetNotification
object: self];
ret = [NSApp runModalForWindow: sheet
relativeToWindow: self];
CALL_BLOCK(handler, ret);
[sheet close];
self->_attachedSheet = nil;
[sheet setParentWindow: nil];
[[NSNotificationCenter defaultCenter]
postNotificationName: NSWindowDidEndSheetNotification
object: self];
}
- (CGFloat) backingScaleFactor
{
return 1.0;

6
Source/gnustep-gui.pc.in Normal file
View file

@ -0,0 +1,6 @@
Name: gnustep-gui
Description: The GNUstep gui library is a library of graphical user interface classes written completely in the Objective-C language; the classes are based upon Apple's Cocoa framework (which came from the OpenStep specification).
Version: @GNUSTEP_GUI_VERSION@
URL: https://github.com/gnustep/libs-gui/
Libs: @GUILIBS@
Cflags: @GUIFLAGS@

Some files were not shown because too many files have changed in this diff Show more