Initial merge with r38582 of gui main trunk

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@38614 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Marcian Lytwyn 2015-06-11 17:48:41 +00:00
parent 510212e29f
commit c6a5c9a81e
51 changed files with 3313 additions and 785 deletions

View file

@ -200,6 +200,7 @@ APPKIT_EXPORT NSString *GSScreenNumber;
- (void) discardEventsMatchingMask: (unsigned)mask
beforeEvent: (NSEvent*)limit;
- (void) postEvent: (NSEvent*)anEvent atStart: (BOOL)flag;
- (void) _printEventQueue;
@end

View file

@ -32,6 +32,7 @@
#import <Foundation/NSObject.h>
#import <Foundation/NSZone.h>
@class NSArray;
@class NSData;
@class NSDictionary;
@class NSString;
@ -52,6 +53,7 @@
@interface GSModelLoaderFactory : NSObject
+ (void) registerModelLoaderClass: (Class)aClass;
+ (Class)classForType: (NSString *)type;
+ (NSArray *) supportedTypes;
+ (NSString *) supportedModelFileAtPath: (NSString *)modelPath;
+ (GSModelLoader *)modelLoaderForFileType: (NSString *)type;
+ (GSModelLoader *)modelLoaderForFileName: (NSString *)modelPath;

View file

@ -217,6 +217,7 @@
#import <Foundation/NSObject.h>
#import <Foundation/NSGeometry.h>
#import <AppKit/NSBox.h>
#import <AppKit/NSCell.h>
// For gradient types
#import <AppKit/NSButtonCell.h>
@ -226,6 +227,10 @@
#import <AppKit/NSScroller.h>
// For segmented control style constants
#import <AppKit/NSSegmentedControl.h>
// For tab view type
#import <AppKit/NSTabView.h>
#import <AppKit/NSPrintPanel.h>
#import <AppKit/NSPageLayout.h>
#if OS_API_VERSION(GS_API_NONE,GS_API_NONE)
@class NSArray;
@ -238,11 +243,13 @@
@class NSColorWell;
@class NSImage;
@class NSMenuItemCell;
@class NSPopUpButtonCell;
@class NSMenuView;
@class NSProgressIndicator;
@class NSTableHeaderCell;
@class NSTabViewItem;
@class GSDrawTiles;
@class GSTitleView;
APPKIT_EXPORT NSString *GSSwitch;
APPKIT_EXPORT NSString *GSRadio;
@ -277,19 +284,47 @@ APPKIT_EXPORT NSString *GSBrowserHeader;
*/
APPKIT_EXPORT NSString *GSMenuHorizontalBackground;
APPKIT_EXPORT NSString *GSMenuVerticalBackground;
APPKIT_EXPORT NSString *GSMenuTitleBackground;
APPKIT_EXPORT NSString *GSMenuHorizontalItem;
APPKIT_EXPORT NSString *GSMenuVerticalItem;
APPKIT_EXPORT NSString *GSMenuSeparatorItem;
/* NSPopUpButton parts */
APPKIT_EXPORT NSString *GSPopUpButton;
/*
* Progress Indicator part names.
*/
APPKIT_EXPORT NSString *GSProgressIndicatorBezel;
APPKIT_EXPORT NSString *GSProgressIndicatorBarDeterminate;
/*
* Color well part names.
*/
APPKIT_EXPORT NSString *GSColorWell;
APPKIT_EXPORT NSString *GSColorWellInnerBorder;
/* NSSliderCell parts */
APPKIT_EXPORT NSString *GSSliderHorizontalTrack;
APPKIT_EXPORT NSString *GSSliderVerticalTrack;
/* NSBox parts */
APPKIT_EXPORT NSString *GSBoxBorder;
/* NSTabView parts */
APPKIT_EXPORT NSString *GSTabViewSelectedTabFill;
APPKIT_EXPORT NSString *GSTabViewUnSelectedTabFill;
APPKIT_EXPORT NSString *GSTabViewBackgroundTabFill;
APPKIT_EXPORT NSString *GSTabViewBottomSelectedTabFill;
APPKIT_EXPORT NSString *GSTabViewBottomUnSelectedTabFill;
APPKIT_EXPORT NSString *GSTabViewBottomBackgroundTabFill;
APPKIT_EXPORT NSString *GSTabViewLeftSelectedTabFill;
APPKIT_EXPORT NSString *GSTabViewLeftUnSelectedTabFill;
APPKIT_EXPORT NSString *GSTabViewLeftBackgroundTabFill;
APPKIT_EXPORT NSString *GSTabViewRightSelectedTabFill;
APPKIT_EXPORT NSString *GSTabViewRightUnSelectedTabFill;
APPKIT_EXPORT NSString *GSTabViewRightBackgroundTabFill;
/**
* Structure to describe the size of top/bottom/left/right margins inside
@ -342,8 +377,11 @@ GSThemeFillStyleFromString(NSString *s);
*/
typedef enum {
GSThemeNormalState = 0, /** A control in its normal state */
GSThemeFirstResponderState,
GSThemeDisabledState, /** A control which is disabled */
GSThemeHighlightedFirstResponderState,
GSThemeHighlightedState, /** A control which is highlighted */
GSThemeSelectedFirstResponderState,
GSThemeSelectedState /** A control which is selected */
} GSThemeControlState;
@ -798,6 +836,23 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
*/
- (NSSize) sizeForImageFrameStyle: (NSImageFrameStyle)frameStyle;
/**
* Return YES if the scroller arrows are at the same end.
* Return NO to get one scroller arrow at each end of the scroller.
*
* The default implementation first checks the default GSScrollerArrowsSameEnd
* and if that is not set, delegates to the NSInterfaceStyle.
*/
- (BOOL) scrollerArrowsSameEndForScroller: (NSScroller *)aScroller;
/**
* Returns YES if clicking in the scroller slot should scroll by one page,
* NO if the scroller should jump to the location clicked.
*
* The default implementation first checks the default GSScrollerScrollsByPage
* and if that is not set, delegates to the NSInterfaceStyle.
*/
- (BOOL) scrollerScrollsByPageForScroller: (NSScroller *)aScroller;
/**
* Creates and returns the cell to be used to draw a scroller arrow of the
@ -836,6 +891,23 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
*/
- (float) defaultScrollerWidth;
/**
* If YES, instructs NSScrollView to leave an empty square space where
* the horizontal and vertical scrollers meet.
*
* Controlled by user default GSScrollViewUseBottomCorner; default YES.
*/
- (BOOL) scrollViewUseBottomCorner;
/**
* If YES, instructs NSScrollView to make the scrollers overlap the border.
* The scroll view border is drawn using the NSScrollView part, which
* must be provided by the theme if this method returns YES.
*
* Controlled by user default GSScrollViewScrollersOverlapBorders; default NO;
*/
- (BOOL) scrollViewScrollersOverlapBorders;
/**
* Method for toolbar theming.
*/
@ -972,6 +1044,7 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
inView: (NSView *)controlView
state: (GSThemeControlState)state
isHorizontal: (BOOL)isHorizontal;
/**
* <p>Draws the menu item title.</p>
*
@ -1013,6 +1086,22 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
* <p>Can be overridden in subclasses to return a custom value.</p>
*/
- (CGFloat) menuSeparatorInset;
/**
* Amount that submenus overlap their parent menu by, horizontally.
* (i.e. applies to vertical menus)
*
* Controlled by GSMenuSubmenuHorizontalOverlap default
*/
- (CGFloat) menuSubmenuHorizontalOverlap;
/**
* Amount that submenus overlap the horizontal menu bar by, vertically.
*
* Controlled by GSMenuSubmenuVerticalOverlap default
*/
- (CGFloat) menuSubmenuVerticalOverlap;
/**
* <p>Draws a separator between normal menu items in a menu.</p>
*
@ -1037,6 +1126,14 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
*/
- (Class) titleViewClassForMenuView: (NSMenuView *)aMenuView;
- (NSRect) drawMenuTitleBackground: (GSTitleView *)aTitleView
withBounds: (NSRect)bounds
withClip: (NSRect)clipRect;
- (CGFloat) menuBarHeight;
- (CGFloat) menuItemHeight;
- (CGFloat) menuSeparatorHeight;
// NSColorWell drawing method
- (NSRect) drawColorWellBorder: (NSColorWell*)well
withBounds: (NSRect)bounds
@ -1053,6 +1150,8 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
- (void) drawProgressIndicatorBarDeterminate: (NSRect)bounds;
// Table drawing methods
- (NSColor *) tableHeaderTextColorForState: (GSThemeControlState)state;
- (void) drawTableCornerView: (NSView*)cornerView
withClip: (NSRect)aRect;
- (void) drawTableHeaderCell: (NSTableHeaderCell *)cell
@ -1070,6 +1169,8 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
state: (int)inputState
andTitle: (NSString*)title;
- (NSColor *) browserHeaderTextColor;
- (void) drawBrowserHeaderCell: (NSTableHeaderCell*)cell
withFrame: (NSRect)rect
inView: (NSView*)view;
@ -1077,6 +1178,10 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
- (NSRect) browserHeaderDrawingRectForCell: (NSTableHeaderCell*)cell
withFrame: (NSRect)rect;
- (NSRect) tabViewContentRectForBounds: (NSRect)aRect
tabViewType: (NSTabViewType)type
tabView: (NSTabView *)view;
- (void) drawTabViewRect: (NSRect)rect
inView: (NSView *)view
withItems: (NSArray *)items
@ -1092,6 +1197,12 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
withScrollerRect: (NSRect)scrollerRect
columnSize: (NSSize)columnSize;
- (CGFloat) browserColumnSeparation;
- (CGFloat) browserVerticalPadding;
- (BOOL) browserUseBezels;
- (void) drawMenuRect: (NSRect)rect
inView: (NSView *)view
isHorizontal: (BOOL)horizontal
@ -1100,6 +1211,11 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
- (void) drawScrollViewRect: (NSRect)rect
inView: (NSView *)view;
- (void) drawSliderBorderAndBackground: (NSBorderType)aType
frame: (NSRect)cellFrame
inCell: (NSCell *)cell
isHorizontal: (BOOL)horizontal;
- (void) drawBarInside: (NSRect)rect
inCell: (NSCell *)cell
flipped: (BOOL)flipped;
@ -1132,6 +1248,11 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
- (void) drawTableViewRow: (int)rowIndex
clipRect: (NSRect)clipRect
inView: (NSView *)view;
- (void) drawBoxInClipRect: (NSRect)clipRect
boxType: (NSBoxType)boxType
borderType: (NSBorderType)borderType
inView: (NSBox *)box;
@end
/**
@ -1231,6 +1352,9 @@ withRepeatedImage: (NSImage*)image
withTiles: (GSDrawTiles*)tiles
background: (NSColor*)color;
- (NSRect) fillRect: (NSRect)rect
withTiles: (GSDrawTiles*)tiles;
/**
* Method to tile the supplied image to fill the vertical rectangle.<br />
* The rect argument is the rectangle to be filled.<br />
@ -1312,5 +1436,26 @@ withRepeatedImage: (NSImage*)image
- (Class) savePanelClass;
@end
// Panels which can be overridden by the theme...
@interface GSPrintPanel : NSPrintPanel
@end
@interface GSPageLayout : NSPageLayout
@end
@interface GSTheme (PrintPanels)
/**
* This method returns the print panel class needed by the
* native environment.
*/
- (Class) printPanelClass;
/**
* This method returns the page layout class needed by the
* native environment.
*/
- (Class) pageLayoutClass;
@end
#endif /* OS_API_VERSION */
#endif /* _GNUstep_H_GSTheme */

View file

@ -0,0 +1,62 @@
/* <title>GSXibLoading</title>
<abstract>Xib (Cocoa XML) model loader</abstract>
Copyright (C) 2010 Free Software Foundation, Inc.
Written by: Fred Kiefer <FredKiefer@gmx.de>
Created: March 2010
Refactored slightly by: Gregory Casamento <greg.casamento@gmail.com>
Created: May 2010
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _GNUstep_H_GSXibElement
#define _GNUstep_H_GSXibElement
#import <Foundation/NSObject.h>
@class NSString, NSDictionary, NSMutableDictionary, NSMutableArray;
@interface GSXibElement: NSObject
{
NSString *type;
NSDictionary *attributes;
NSString *value;
NSMutableDictionary *elements;
NSMutableArray *values;
}
- (GSXibElement*) initWithType: (NSString*)typeName
andAttributes: (NSDictionary*)attribs;
- (NSString*) type;
- (NSString*) value;
- (NSDictionary*) elements;
- (NSArray*) values;
- (void) addElement: (GSXibElement*)element;
- (void) setElement: (GSXibElement*)element forKey: (NSString*)key;
- (void) setValue: (NSString*)text;
- (NSString*) attributeForKey: (NSString*)key;
- (GSXibElement*) elementForKey: (NSString*)key;
- (NSDictionary *) attributes;
@end
#endif

View file

@ -9,21 +9,23 @@
Refactored slightly by: Gregory Casamento <greg.casamento@gmail.com>
Created: May 2010
This file is part of the GNUstep Base Library.
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
Lesser General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _GNUstep_H_GSXibLoading
@ -34,6 +36,7 @@
@class NSString, NSDictionary, NSArray, NSMutableDictionary, NSMutableArray;
@class NSNibBindingConnector;
@class GSXibElement;
// Hack: This allows the class name FirstResponder in NSCustomObject and
// correctly returns nil as the corresponding object.
@ -155,25 +158,6 @@
- (NSEnumerator *) objectRecordEnumerator;
@end
@interface GSXibElement: NSObject
{
NSString *type;
NSDictionary *attributes;
NSString *value;
NSMutableDictionary *elements;
NSMutableArray *values;
}
- (NSString*) type;
- (NSString*) value;
- (NSDictionary*) elements;
- (NSArray*) values;
- (void) addElement: (GSXibElement*)element;
- (void) setElement: (GSXibElement*)element forKey: (NSString*)key;
- (void) setValue: (NSString*)text;
- (NSString*) attributeForKey: (NSString*)key;
- (GSXibElement*) elementForKey: (NSString*)key;
@end
@interface GSXibKeyedUnarchiver: NSKeyedUnarchiver
{
NSMutableDictionary *objects;

View file

@ -0,0 +1,43 @@
/* <title>GSXibObjectContainer</title>
<abstract>Xib v5 (Cocoa XML) container</abstract>
Copyright (C) 2014 Free Software Foundation, Inc.
Written by: Gregory Casamento <greg.casamento@gmail.com>
Created: March 2014
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _GNUstep_H_GSXibObjectContainer
#define _GNUstep_H_GSXibObjectContainer
#import <Foundation/NSObject.h>
@class NSMutableArray;
@interface GSXibObjectContainer : NSObject
{
NSMutableArray *objects;
NSMutableArray *connections;
}
@end
#endif

View file

@ -0,0 +1,53 @@
/* <title>GSXibParser</title>
<abstract>Xib v5 (Cocoa XML) parser</abstract>
Copyright (C) 2014 Free Software Foundation, Inc.
Written by: Gregory Casamento <greg.casamento@gmail.com>
Created: March 2014
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _GNUstep_H_GSXibParser
#define _GNUstep_H_GSXibParser
#import <Foundation/NSObject.h>
@class NSData;
@class NSXMLParser;
@class NSMutableDictionary;
@class GSXibElement;
@class NSMutableArray;
@interface GSXibParser : NSObject
{
NSMutableDictionary *objects;
GSXibElement *currentElement;
NSMutableArray *stack;
NSXMLParser *theParser;
}
- (id) initWithData: (NSData *)data;
- (NSDictionary *) parse;
@end
#endif

View file

@ -65,6 +65,45 @@ typedef enum {
NSImageCacheNever
} NSImageCacheMode;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
APPKIT_EXTERN NSString *const NSImageNameQuickLookTemplate;
APPKIT_EXTERN NSString *const NSImageNameBluetoothTemplate;
APPKIT_EXTERN NSString *const NSImageNameIChatTheaterTemplate;
APPKIT_EXTERN NSString *const NSImageNameSlideshowTemplate;
APPKIT_EXTERN NSString *const NSImageNameActionTemplate;
APPKIT_EXTERN NSString *const NSImageNameSmartBadgeTemplate;
APPKIT_EXTERN NSString *const NSImageNameIconViewTemplate;
APPKIT_EXTERN NSString *const NSImageNameListViewTemplate;
APPKIT_EXTERN NSString *const NSImageNameColumnViewTemplate;
APPKIT_EXTERN NSString *const NSImageNameFlowViewTemplate;
APPKIT_EXTERN NSString *const NSImageNamePathTemplate;
APPKIT_EXTERN NSString *const NSImageNameInvalidDataFreestandingTemplate;
APPKIT_EXTERN NSString *const NSImageNameLockLockedTemplate;
APPKIT_EXTERN NSString *const NSImageNameLockUnlockedTemplate;
APPKIT_EXTERN NSString *const NSImageNameGoRightTemplate;
APPKIT_EXTERN NSString *const NSImageNameGoLeftTemplate;
APPKIT_EXTERN NSString *const NSImageNameRightFacingTriangleTemplate;
APPKIT_EXTERN NSString *const NSImageNameLeftFacingTriangleTemplate;
APPKIT_EXTERN NSString *const NSImageNameAddTemplate;
APPKIT_EXTERN NSString *const NSImageNameRemoveTemplate;
APPKIT_EXTERN NSString *const NSImageNameRevealFreestandingTemplate;
APPKIT_EXTERN NSString *const NSImageNameFollowLinkFreestandingTemplate;
APPKIT_EXTERN NSString *const NSImageNameEnterFullScreenTemplate;
APPKIT_EXTERN NSString *const NSImageNameExitFullScreenTemplate;
APPKIT_EXTERN NSString *const NSImageNameStopProgressTemplate;
APPKIT_EXTERN NSString *const NSImageNameStopProgressFreestandingTemplate;
APPKIT_EXTERN NSString *const NSImageNameRefreshTemplate;
APPKIT_EXTERN NSString *const NSImageNameRefreshFreestandingTemplate;
APPKIT_EXTERN NSString *const NSImageNameBonjour;
APPKIT_EXTERN NSString *const NSImageNameComputer;
APPKIT_EXTERN NSString *const NSImageNameFolderBurnable;
APPKIT_EXTERN NSString *const NSImageNameFolderSmart;
APPKIT_EXTERN NSString *const NSImageNameNetwork;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
APPKIT_EXTERN NSString *const NSImageNameFolder;
#endif
@interface NSImage : NSObject <NSCoding, NSCopying>
{

View file

@ -0,0 +1,94 @@
/*
NSStatusItem.h
The status item class
Copyright (C) 2013 Free Software Foundation, Inc.
Author: Gregory Casamento <greg.casamento@gmail.com>
Date: 2013
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
// FIXME: This class is currently a placeholder to allow compilation of
// apps which require NSStatusItem. Currently there is not a clean,
// cross-platform way to implement this functionality.
#ifndef _GNUstep_H_NSStatusItem
#define _GNUstep_H_NSStatusItem
#import <GNUstepBase/GSVersionMacros.h>
#import <Foundation/NSObject.h>
#import <Foundation/NSGeometry.h>
@class NSAttributedString;
@class NSString;
@class NSStatusBar;
@class NSView;
@class NSImage;
@class NSMenu;
@class NSMenuItem;
@interface NSStatusItem : NSObject
{
@private
NSMenuItem *_menuItem;
NSStatusBar *_statusBar;
NSView *_view;
CGFloat _length;
BOOL _highlightMode;
}
- (SEL) action;
- (NSAttributedString*) attributedTitle;
- (SEL) doubleAction;
- (void) drawStatusBarBackgroundInRect: (NSRect)rect withHighlight: (BOOL)flag;
- (BOOL) highlightMode;
- (NSImage*) image;
- (BOOL) isEnabled;
- (CGFloat) length;
- (NSMenu*) menu;
- (void) popUpStatusItemMenu: (NSMenu*)menu;
- (NSInteger) sendActionOn: (NSInteger)mask;
- (void) setAction: (SEL)action;
- (void) setAttributedTitle: (NSAttributedString*)title;
- (void) setDoubleAction: (SEL)sel;
- (void) setEnabled: (BOOL)flag;
- (void) setHighlightMode: (BOOL)highlightMode;
- (void) setImage: (NSImage*)image;
- (void) setLength: (CGFloat)length;
- (void) setMenu: (NSMenu*)menu;
- (void) setTarget: (id)target;
- (void) setTitle: (NSString*)title;
- (void) setToolTip: (NSString*)toolTip;
- (void) setView: (NSView*)view;
- (NSStatusBar*) statusBar;
- (id) target;
- (NSString*) title;
- (NSString*) toolTip;
- (NSView*) view;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
- (NSImage*) alternateImage;
- (void) setAlternateImage: (NSImage*)img;
#endif
@end
#endif // _GNUstep_H_NSStatusItem

View file

@ -127,7 +127,6 @@ typedef enum _NSTableViewAnimationOptions
* Ivars Acting as Control...
*/
BOOL _isValidating;
NSInteger _beginEndUpdates;
/*
* Ivars Acting as Cache
@ -163,6 +162,8 @@ typedef enum _NSTableViewAnimationOptions
NSDragOperation _draggingSourceOperationMaskForLocal;
NSDragOperation _draggingSourceOperationMaskForRemote;
NSInteger _beginEndUpdates;
}
/* Data Source */
@ -379,9 +380,11 @@ typedef enum _NSTableViewAnimationOptions
* Informal protocol NSTableDataSource
*/
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
@protocol NSTableViewDataSource <NSObject>
@protocol NSTableViewDataSource
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST) && GS_PROTOCOLS_HAVE_OPTIONAL
@optional
#else
@end
@interface NSObject (NSTableDataSource)
#endif
@ -434,12 +437,13 @@ APPKIT_EXPORT NSString *NSTableViewSelectionIsChangingNotification;
* Methods Implemented by the Delegate
*/
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
@protocol NSTableViewDelegate <NSObject>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST) && GS_PROTOCOLS_HAVE_OPTIONAL
@optional
#else
@end
@interface NSObject (NSTableViewDelegate)
#endif
- (BOOL) selectionShouldChangeInTableView: (NSTableView *)aTableView;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
- (void) tableView: (NSTableView*)tableView

View file

@ -0,0 +1,76 @@
/*
NSTrackingArea.h
Create a rectangle to track mouse movements.
Copyright (C) 2013 Free Software Foundation, Inc.
Written by: Gregory Casamento <greg.casamento@gmail.com>
Date: September 2013
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _GNUstep_H_NSTrackingArea
#define _GNUstep_H_NSTrackingArea
#import <Foundation/NSObject.h>
#import <Foundation/NSCoder.h>
/*
* Options pulled from Cocoa documentation.
*/
enum {
NSTrackingMouseEnteredAndExited = 1,
NSTrackingMouseMoved = 2,
NSTrackingCursorUpdate = 4,
NSTrackingActiveWhenFirstResponder = 8,
NSTrackingActiveInKeyWindow = 16,
NSTrackingActiveInActiveApp = 32,
NSTrackingActiveAlways = 64,
NSTrackingAssumeInside = 128,
NSTrackingInVisibleRect = 256,
NSTrackingEnabledDuringMouseDrag = 512
};
typedef NSUInteger NSTrackingAreaOptions;
@class NSDictionary;
@class GSTrackingRect;
@interface NSTrackingArea : NSObject <NSCoding, NSCopying>
{
NSDictionary *_userInfo;
GSTrackingRect *_trackingRect;
NSTrackingAreaOptions _options;
}
- (id)initWithRect: (NSRect)rect
options: (NSTrackingAreaOptions)options
owner: (id)owner
userInfo: (NSDictionary *)userInfo;
- (NSTrackingAreaOptions) options;
- (id) owner;
- (NSRect) rect;
- (NSDictionary *) userInfo;
@end
#endif // _GNUstep_H_NSTrackingArea

View file

@ -0,0 +1,61 @@
/*
NSTreeNode.h
The tree node class
Copyright (C) 2013 Free Software Foundation, Inc.
Author: Dr. H. Nikolaus Schaller
Date: 2013
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _GNUstep_H_NSTreeNode
#define _GNUstep_H_NSTreeNode
#import <GNUstepBase/GSVersionMacros.h>
#import <Foundation/NSObject.h>
@class NSArray;
@class NSIndexPath;
@class NSMutableArray;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
@interface NSTreeNode : NSObject
{
id _representedObject;
NSMutableArray *_childNodes;
NSTreeNode *_parentNode;
}
+ (id) treeNodeWithRepresentedObject: (id)modelObject;
- (NSArray*) childNodes;
- (NSTreeNode*) descendantNodeAtIndexPath: (NSIndexPath*)path;
- (NSIndexPath*) indexPath;
- (id) initWithRepresentedObject: (id)repObj;
- (BOOL) isLeaf;
- (NSMutableArray*) mutableChildNodes;
- (NSTreeNode*) parentNode;
- (id) representedObject;
- (void) sortWithSortDescriptors: (NSArray*)sortDescs recursively: (BOOL)flag;
@end
#endif
#endif // _GNUstep_H_NSTreeNode

View file

@ -42,6 +42,7 @@ Images_RESOURCE_FILES = \
NSPathTemplate.tiff\
NSComboArrow.tiff \
NSRatingLevelIndicator.tiff \
NSRemoveTemplate.tiff\
common_2DCheckMark.tiff \
common_2DDash.tiff \
common_3DArrowDown.tiff \
@ -103,6 +104,10 @@ Images_RESOURCE_FILES = \
common_Root_Sparc2.tiff \
common_SliderHoriz.tiff \
common_SliderVert.tiff \
common_StepperDown.tiff \
common_StepperDownHighlighted.tiff \
common_StepperUp.tiff \
common_StepperUpHighlighted.tiff \
common_SwitchOff.tiff \
common_SwitchOn.tiff \
common_TabDownSelectedLeft.tiff \

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -163,6 +163,8 @@ NSSplitView.m \
NSStepper.m \
NSStepperCell.m \
NSStringDrawing.m \
NSStatusBar.m \
NSStatusItem.m \
NSTabView.m \
NSTabViewItem.m \
NSTableColumn.m \
@ -186,7 +188,9 @@ NSToolbarItem.m \
NSToolbarItemGroup.m \
NSTokenField.m \
NSTokenFieldCell.m \
NSTrackingArea.m \
NSTreeController.m \
NSTreeNode.m \
NSUserDefaultsController.m \
NSView.m \
NSViewController.m \
@ -228,6 +232,7 @@ GSThemeInspector.m \
GSThemeMenu.m \
GSThemeOpenSavePanels.m \
GSThemePanel.m \
GSThemePrintPanels.m \
GSThemeTools.m \
GSTitleView.m \
GSToolTips.m \
@ -243,8 +248,11 @@ GSModelLoaderFactory.m \
GSGormLoader.m \
GSGModelLoader.m \
GSNibLoader.m \
GSXibElement.m \
GSXibLoader.m \
GSXibLoading.m \
GSXibObjectContainer.m \
GSXibParser.m \
GSHelpAttachment.m
# Turn off NSMenuItem warning that NSMenuItem conforms to <NSObject>,
@ -375,6 +383,8 @@ NSSplitView.h \
NSStepper.h \
NSStepperCell.h \
NSStringDrawing.h \
NSStatusBar.h \
NSStatusItem.h \
NSTabView.h \
NSTabViewItem.h \
NSTableColumn.h \
@ -395,7 +405,9 @@ NSToolbarItem.h \
NSToolbarItemGroup.h \
NSTokenField.h \
NSTokenFieldCell.h \
NSTrackingArea.h \
NSTreeController.h \
NSTreeNode.h \
NSUserDefaultsController.h \
NSView.h \
NSViewController.h \
@ -456,7 +468,10 @@ GSInstantiator.h \
GSSoundSink.h \
GSSoundSource.h \
GSWindowDecorationView.h \
GSXibElement.h \
GSXibLoading.h \
GSXibObjectContainer.h \
GSXibParser.h \
GSHelpAttachment.h
libgnustep-gui_HEADER_FILES = ${GUI_HEADERS}

View file

@ -36,12 +36,12 @@
# Things to do before compiling
ifeq ($(doc),yes)
before-all:: $(GNUSTEP_TARGET_DIR)/config.h
cp ../Documentation/Gui/Gui.gsdoc .
cp ../Documentation/Gui.gsdoc .
# Things to do after compiling
after-all::
$(RM) Gui.gsdoc
if test -d Gui; then rmdir Gui; fi;
if test -d Gui; then rm -rf Gui; fi;
else
before-all:: $(GNUSTEP_TARGET_DIR)/config.h
endif

View file

@ -331,7 +331,7 @@ GSCurrentServer(void)
NSCountedSet *old = (NSCountedSet*)NSMapGet(drag_types, (void*)win);
NSEnumerator *drag_enum = [types objectEnumerator];
id type;
unsigned originalCount;
NSUInteger originalCount;
/*
* Make sure the set exists.
@ -999,14 +999,14 @@ GSCurrentServer(void)
inMode: (NSString*)mode
dequeue: (BOOL)flag
{
unsigned pos = 0; /* Position in queue scanned so far */
NSUInteger pos = 0; /* Position in queue scanned so far */
NSRunLoop *loop = nil;
do
{
unsigned count = [event_queue count];
NSUInteger count = [event_queue count];
NSEvent *event;
unsigned i = 0;
NSUInteger i = 0;
if (count == 0)
{
@ -1028,7 +1028,7 @@ GSCurrentServer(void)
*/
if (count > pos)
{
unsigned end = count - pos;
NSUInteger end = count - pos;
NSRange r = NSMakeRange(pos, end);
NSEvent *events[end];
@ -1084,7 +1084,7 @@ GSCurrentServer(void)
- (void) discardEventsMatchingMask: (unsigned)mask
beforeEvent: (NSEvent*)limit
{
unsigned index = [event_queue count];
NSUInteger index = [event_queue count];
/*
* If there is a range to use - remove all the matching events in it
@ -1125,4 +1125,29 @@ GSCurrentServer(void)
[event_queue addObject: anEvent];
}
- (void) _printEventQueue
{
NSUInteger index = [event_queue count];
if (index > 0)
{
NSEvent *events[index];
NSUInteger i;
NSLog(@"Dumping events from queue");
[event_queue getObjects: events];
for (i = 0; i < index; i++)
{
NSEvent *event = events[i];
NSLog(@"index %lu %@", (unsigned long) i, event);
}
}
else
{
NSLog(@"Event queue is empty");
}
}
@end

View file

@ -95,6 +95,7 @@ static BOOL _isInInterfaceBuilder = NO;
@end
@interface NSMenu (GNUstepPrivate)
- (void) _setGeometry;
- (BOOL) _isMainMenu;
@end
@implementation NSMenu (NibCompatibility)
@ -311,8 +312,10 @@ static BOOL _isInInterfaceBuilder = NO;
// style & size
_windowStyle = [window styleMask];
_backingStoreType = [window backingType];
_maxSize = [window maxSize];
_minSize = [window minSize];
//_maxSize = [window maxSize];
//_minSize = [window minSize];
_maxSize = [window contentMaxSize];
_minSize = [window contentMinSize];
_windowRect = [window frame];
_screenRect = [[NSScreen mainScreen] frame];
@ -360,18 +363,37 @@ static BOOL _isInInterfaceBuilder = NO;
unsigned long flags = [coder decodeIntForKey: @"NSWTFlags"];
memcpy((void *)&_flags,(void *)&flags,sizeof(struct _GSWindowTemplateFlags));
}
if ([coder containsValueForKey: @"NSMinSize"])
if ([coder containsValueForKey: @"NSWindowContentMinSize"])
{
_minSize = [coder decodeSizeForKey: @"NSMinSize"];
_minSize = [coder decodeSizeForKey: @"NSWindowContentMinSize"];
}
if ([coder containsValueForKey: @"NSMaxSize"])
else if ([coder containsValueForKey: @"NSMinSize"])
{
_maxSize = [coder decodeSizeForKey: @"NSMaxSize"];
NSRect rect = NSZeroRect;
rect.size = [coder decodeSizeForKey: @"NSMinSize"];
rect = [NSWindow contentRectForFrameRect: rect
styleMask: _windowStyle];
_minSize = rect.size;
}
if ([coder containsValueForKey: @"NSWindowContentMaxSize"])
{
_maxSize = [coder decodeSizeForKey: @"NSWindowContentMaxSize"];
}
else if ([coder containsValueForKey: @"NSMaxSize"])
{
NSRect rect = NSZeroRect;
rect.size = [coder decodeSizeForKey: @"NSMaxSize"];
rect = [NSWindow contentRectForFrameRect: rect
styleMask: _windowStyle];
_maxSize = rect.size;
}
else
{
_maxSize = NSMakeSize (10e4, 10e4);
}
if ([coder containsValueForKey: @"NSWindowRect"])
{
_windowRect = [coder decodeRectForKey: @"NSWindowRect"];
@ -412,8 +434,8 @@ static BOOL _isInInterfaceBuilder = NO;
[aCoder encodeInt: _backingStoreType forKey: @"NSWindowBacking"];
[aCoder encodeObject: _view forKey: @"NSWindowView"];
[aCoder encodeInt: flags forKey: @"NSWTFlags"];
[aCoder encodeSize: _minSize forKey: @"NSMinSize"];
[aCoder encodeSize: _maxSize forKey: @"NSMaxSize"];
[aCoder encodeSize: _minSize forKey: @"NSWindowContentMinSize"];
[aCoder encodeSize: _maxSize forKey: @"NSWindowContentMaxSize"];
[aCoder encodeRect: rect forKey: @"NSWindowRect"];
[aCoder encodeObject: _title forKey: @"NSWindowTitle"];
[aCoder encodeObject: _autosaveName forKey: @"NSFrameAutosaveName"];
@ -465,8 +487,8 @@ static BOOL _isInInterfaceBuilder = NO;
// reset attributes...
[_realObject setContentView: _view];
[_realObject setMinSize: _minSize];
[_realObject setMaxSize: _maxSize];
//[_realObject setMinSize: _minSize];
//[_realObject setMaxSize: _maxSize];
[_realObject setTitle: _title];
if ([_viewClass isKindOfClass: [NSToolbar class]])
@ -475,6 +497,9 @@ static BOOL _isInInterfaceBuilder = NO;
[_realObject setToolbar: (NSToolbar*)_viewClass];
}
[_realObject setContentMinSize: _minSize];
[_realObject setContentMaxSize: _maxSize];
[_view _fixSubviews];
// FIXME What is the point of calling -setFrame:display: here? It looks
@ -1913,8 +1938,13 @@ static BOOL _isInInterfaceBuilder = NO;
// objects on behalf of the owner.
RETAIN(obj);
}
if ([obj isKindOfClass: [NSMenu class]] &&
[obj _isMainMenu])
{
[NSApp _setMainMenu: obj];
}
}
}
// iterate over connections, instantiate and then establish them.
en = [_connections objectEnumerator];

View file

@ -87,16 +87,44 @@ NSString *GSBrowserHeader = @"GSBrowserHeader";
// Menu part names
NSString *GSMenuHorizontalBackground = @"GSMenuHorizontalBackground";
NSString *GSMenuVerticalBackground = @"GSMenuVerticalBackground";
NSString *GSMenuTitleBackground = @"GSMenuTitleBackground";
NSString *GSMenuHorizontalItem = @"GSMenuHorizontalItem";
NSString *GSMenuVerticalItem = @"GSMenuVerticalItem";
NSString *GSMenuSeparatorItem = @"GSMenuSeparatorItem";
// NSPopUpButton part names
NSString *GSPopUpButton = @"GSPopUpButton";
// Progress indicator part names
NSString *GSProgressIndicatorBezel = @"GSProgressIndicatorBezel";
NSString *GSProgressIndicatorBarDeterminate
= @"GSProgressIndicatorBarDeterminate";
// Color well part names
NSString *GSColorWell = @"GSColorWell";
NSString *GSColorWellInnerBorder = @"GSColorWellInnerBorder";
// Slider part names
NSString *GSSliderHorizontalTrack = @"GSSliderHorizontalTrack";
NSString *GSSliderVerticalTrack = @"GSSliderVerticalTrack";
// NSBox parts
NSString *GSBoxBorder = @"GSBoxBorder";
/* NSTabView parts */
NSString *GSTabViewSelectedTabFill = @"GSTabViewSelectedTabFill";
NSString *GSTabViewUnSelectedTabFill = @"GSTabViewUnSelectedTabFill";
NSString *GSTabViewBackgroundTabFill = @"GSTabViewBackgroundTabFill";
NSString *GSTabViewBottomSelectedTabFill = @"GSTabViewBottomSelectedTabFill";
NSString *GSTabViewBottomUnSelectedTabFill = @"GSTabViewBottomUnSelectedTabFill";
NSString *GSTabViewBottomBackgroundTabFill = @"GSTabViewBottomBackgroundTabFill";
NSString *GSTabViewLeftSelectedTabFill = @"GSTabViewLeftSelectedTabFill";
NSString *GSTabViewLeftUnSelectedTabFill = @"GSTabViewLeftUnSelectedTabFill";
NSString *GSTabViewLeftBackgroundTabFill = @"GSTabViewLeftBackgroundTabFill";
NSString *GSTabViewRightSelectedTabFill = @"GSTabViewRightSelectedTabFill";
NSString *GSTabViewRightUnSelectedTabFill = @"GSTabViewRightUnSelectedTabFill";
NSString *GSTabViewRightBackgroundTabFill = @"GSTabViewRightBackgroundTabFill";
NSString *GSThemeDidActivateNotification
= @"GSThemeDidActivateNotification";
@ -209,6 +237,36 @@ GSStringFromBorderType(NSBorderType borderType)
}
}
NSString *
GSStringFromTabViewType(NSTabViewType type)
{
switch (type)
{
case NSTopTabsBezelBorder: return @"NSTopTabsBezelBorder";
case NSBottomTabsBezelBorder: return @"NSBottomTabsBezelBorder";
case NSLeftTabsBezelBorder: return @"NSLeftTabsBezelBorder";
case NSRightTabsBezelBorder: return @"NSRightTabsBezelBorder";
case NSNoTabsBezelBorder: return @"NSNoTabsBezelBorder";
case NSNoTabsLineBorder: return @"NSNoTabsLineBorder";
case NSNoTabsNoBorder: return @"NSNoTabsNoBorder";
default: return nil;
}
}
NSString *
GSStringFromImageFrameStyle(NSImageFrameStyle type)
{
switch (type)
{
case NSImageFrameNone: return @"NSImageFrameNone";
case NSImageFramePhoto: return @"NSImageFramePhoto";
case NSImageFrameGrayBezel: return @"NSImageFrameGrayBezel";
case NSImageFrameGroove: return @"NSImageFrameGroove";
case NSImageFrameButton: return @"NSImageFrameButton";
default: return nil;
}
}
@interface NSImage (Private)
+ (void) _setImagePath: (NSString*)path name: (NSString*)name;
+ (void) _reloadCachedImages;
@ -1085,12 +1143,21 @@ typedef struct {
case GSThemeNormalState:
fullName = aName;
break;
case GSThemeFirstResponderState:
fullName = [aName stringByAppendingString: @"FirstResponder"];
break;
case GSThemeDisabledState:
fullName = [aName stringByAppendingString: @"Disabled"];
break;
case GSThemeHighlightedFirstResponderState:
fullName = [aName stringByAppendingString: @"HighlightedFirstResponder"];
break;
case GSThemeHighlightedState:
fullName = [aName stringByAppendingString: @"Highlighted"];
break;
case GSThemeSelectedFirstResponderState:
fullName = [aName stringByAppendingString: @"SelectedFirstResponder"];
break;
case GSThemeSelectedState:
fullName = [aName stringByAppendingString: @"Selected"];
break;
@ -1107,88 +1174,109 @@ typedef struct {
info = [[info objectForKey: @"GSThemeTiles"] objectForKey: fullName];
if ([info isKindOfClass: [NSDictionary class]] == YES)
{
float x;
float y;
NSString *name;
NSString *path;
NSString *file;
NSString *ext;
GSThemeFillStyle style;
float x;
float y;
NSString *name;
NSString *path;
NSString *file;
NSString *ext;
GSThemeFillStyle style;
name = [info objectForKey: @"FillStyle"];
style = GSThemeFillStyleFromString(name);
if (style < GSThemeFillStyleNone) style = GSThemeFillStyleNone;
x = [[info objectForKey: @"HorizontalDivision"] floatValue];
y = [[info objectForKey: @"VerticalDivision"] floatValue];
file = [info objectForKey: @"FileName"];
ext = [file pathExtension];
file = [file stringByDeletingPathExtension];
path = [_bundle pathForResource: file
ofType: ext
inDirectory: @"ThemeTiles"];
if (path == nil)
{
NSLog(@"File %@.%@ not found in ThemeTiles", file, ext);
}
else
{
image = [[_imageClass alloc] initWithContentsOfFile: path];
if (image != nil)
{
if ([[info objectForKey: @"NinePatch"] boolValue])
name = [info objectForKey: @"FillStyle"];
style = GSThemeFillStyleFromString(name);
if (style < GSThemeFillStyleNone)
style = GSThemeFillStyleNone;
x = [[info objectForKey: @"HorizontalDivision"] floatValue];
y = [[info objectForKey: @"VerticalDivision"] floatValue];
file = [info objectForKey: @"FileName"];
ext = [file pathExtension];
file = [file stringByDeletingPathExtension];
path = [_bundle pathForResource: file
ofType: ext
inDirectory: @"ThemeTiles"];
if (path == nil)
{
NSLog(@"File %@.%@ not found in ThemeTiles", file, ext);
}
else
{
image = [[_imageClass alloc] initWithContentsOfFile: path];
if (image != nil)
{
if ([[info objectForKey: @"NinePatch"] boolValue]
|| [file hasSuffix: @".9"])
{
tiles = [[GSDrawTiles alloc]
initWithNinePatchImage: image];
[tiles setFillStyle: GSThemeFillStyleScaleAll];
tiles = [[GSDrawTiles alloc] initWithNinePatchImage: image];
[tiles setFillStyle: GSThemeFillStyleScaleAll];
}
else
{
tiles = [[GSDrawTiles alloc] initWithImage: image
tiles = [[GSDrawTiles alloc] initWithImage: image
horizontal: x
vertical: y];
[tiles setFillStyle: style];
[tiles setFillStyle: style];
}
RELEASE(image);
RELEASE(image);
}
}
}
}
}
else
if (tiles == nil)
{
NSArray *imageTypes;
NSString *imagePath;
unsigned count;
NSString *imagePath;
imageTypes = [_imageClass imageFileTypes];
for (count = 0; count < [imageTypes count]; count++)
{
NSString *ext = [imageTypes objectAtIndex: count];
imagePath = [_bundle pathForResource: fullName
ofType: ext
inDirectory: @"ThemeTiles"];
if (imagePath != nil)
{
image
= [[_imageClass alloc] initWithContentsOfFile: imagePath];
if (image != nil)
{
tiles = [[GSDrawTiles alloc] initWithImage: image];
RELEASE(image);
break;
}
}
// Try 9-patch first
imagePath = [_bundle pathForResource: fullName
ofType: @"9.png"
inDirectory: @"ThemeTiles"];
if (imagePath != nil)
{
image = [[_imageClass alloc] initWithContentsOfFile: imagePath];
if (image != nil)
{
tiles = [[GSDrawTiles alloc] initWithNinePatchImage: image];
[tiles setFillStyle: GSThemeFillStyleScaleAll];
RELEASE(image);
}
}
}
}
if (tiles == nil)
{
NSArray *imageTypes;
NSString *imagePath;
unsigned count;
imageTypes = [_imageClass imageFileTypes];
for (count = 0; count < [imageTypes count]; count++)
{
NSString *ext = [imageTypes objectAtIndex: count];
imagePath = [_bundle pathForResource: fullName
ofType: ext
inDirectory: @"ThemeTiles"];
if (imagePath != nil)
{
image = [[_imageClass alloc] initWithContentsOfFile: imagePath];
if (image != nil)
{
tiles = [[GSDrawTiles alloc] initWithImage: image];
RELEASE(image);
break;
}
}
}
}
if (tiles == nil)
{
[cache setObject: null forKey: aName];
}
[cache setObject: null forKey: aName];
}
else
{
[cache setObject: tiles forKey: aName];
RELEASE(tiles);
}
[cache setObject: tiles forKey: aName];
RELEASE(tiles);
}
}
if (tiles == (id)null)
{

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,71 @@
/** <title>GSThemeOpenSavePanels</title>
<abstract>Methods for themes using open and save panels.</abstract>
Copyright (C) 2015 Free Software Foundation, Inc.
Author: Gregory Casamento <greg.casamento@gmail.com>
Date: 2015
This file is part of the GNU Objective C User interface library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#import "AppKit/NSPrintPanel.h"
#import "AppKit/NSPageLayout.h"
#import "GNUstepGUI/GSTheme.h"
@implementation GSPrintPanel
+ (id) allocWithZone: (NSZone*)zone
{
return NSAllocateObject(self, 0, zone);
}
@end
@implementation GSPageLayout
+ (id) allocWithZone: (NSZone*)zone
{
return NSAllocateObject(self, 0, zone);
}
@end
@implementation GSTheme (PrintPanels)
/**
* This method returns the print panel class needed by the
* native environment.
*/
- (Class) printPanelClass
{
return [GSPrintPanel class];
}
/**
* This method returns the page layout class needed by the
* native environment.
*/
- (Class) pageLayoutClass
{
return [GSPageLayout class];
}
@end

View file

@ -39,6 +39,8 @@
NSString *GSStringFromSegmentStyle(NSSegmentStyle segmentStyle);
NSString *GSStringFromBezelStyle(NSBezelStyle bezelStyle);
NSString *GSStringFromBorderType(NSBorderType borderType);
NSString *GSStringFromTabViewType(NSTabViewType type);
NSString *GSStringFromImageFrameStyle(NSImageFrameStyle type);
/** These are the nine types of tile used to draw a rectangular object.
*/
@ -64,6 +66,10 @@ typedef enum {
NSRect contentRect; /** Rectangle in which content should be
* drawn, normally rects[TileCM], but can
* be customized in the nine-patch format */
NSRect layoutRect;
NSRect originalRectCM; /** Caches rects[TileCM] as it was before
* -validateTilesSizeWithImage clears the
* origin. Used by -themeMargins */
float scaleFactor;
GSThemeFillStyle style; /** The default style for filling a rect */
}
@ -108,8 +114,8 @@ typedef enum {
* drawn in the given rect, or NSZeroRect if the given rect is too small
* to draw the tiles in.
*/
- (NSRect) contentRectForRect: (NSRect)rect;
- (NSRect) contentRectForRect: (NSRect)rect
isFlipped: (BOOL)flipped;
/* Style drawing methods
*/
- (NSRect) noneStyleFillRect: (NSRect)rect;
@ -130,6 +136,17 @@ typedef enum {
- (GSThemeFillStyle) fillStyle;
- (void) setFillStyle: (GSThemeFillStyle)aStyle;
/**
* Returns the sum of the widths of the left, middle, and right tiles,
* and the sum of the heights of the top, center, and bottom tiles, before scaling.
*
* Can be used to calculate a rect to draw the tiles in such that they are only
* filled in one direction.
*/
- (NSSize) size;
- (GSThemeMargins) themeMargins;
@end
/** This is the panel used to select and inspect themes.

116
Source/GSXibElement.m Normal file
View file

@ -0,0 +1,116 @@
/* <title>GSXibElement</title>
<abstract>Xib element</abstract>
Copyright (C) 2010, 2011 Free Software Foundation, Inc.
Written by: Fred Kiefer <FredKiefer@gmx.de>
Created: March 2010
Written by: Gregory Casamento <greg.casamento@gmail.com>
Created: March 2014
This file is part of the GNUstep Base Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
*/
#import <Foundation/NSArray.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSString.h>
#import "GNUstepGUI/GSXibElement.h"
@implementation GSXibElement
- (GSXibElement*) initWithType: (NSString*)typeName
andAttributes: (NSDictionary*)attribs
{
ASSIGN(type, typeName);
ASSIGN(attributes, attribs);
elements = [[NSMutableDictionary alloc] init];
values = [[NSMutableArray alloc] init];
return self;
}
- (void) dealloc
{
DESTROY(type);
DESTROY(attributes);
DESTROY(elements);
DESTROY(values);
DESTROY(value);
[super dealloc];
}
- (NSString*) type
{
return type;
}
- (NSString*) value
{
return value;
}
- (NSDictionary*) elements
{
return elements;
}
- (NSArray*) values
{
return values;
}
- (void) addElement: (GSXibElement*)element
{
[values addObject: element];
}
- (void) setElement: (GSXibElement*)element forKey: (NSString*)key
{
[elements setObject: element forKey: key];
}
- (void) setValue: (NSString*)text
{
ASSIGN(value, text);
}
- (NSString*) attributeForKey: (NSString*)key
{
return [attributes objectForKey: key];
}
- (GSXibElement*) elementForKey: (NSString*)key
{
return [elements objectForKey: key];
}
- (NSDictionary *)attributes
{
return attributes;
}
- (NSString*) description
{
return [NSString stringWithFormat:
@"GSXibElement <%@> attrs (%@) elements [%@] values [%@] %@",
type, attributes, elements, values, value, nil];
}
@end

View file

@ -45,6 +45,9 @@
#import "GNUstepGUI/GSModelLoaderFactory.h"
#import "GNUstepGUI/GSNibLoading.h"
#import "GNUstepGUI/GSXibLoading.h"
#import "GNUstepGUI/GSXibParser.h"
#import "GNUstepGUI/GSXibObjectContainer.h"
#import "GNUstepGUI/GSXibElement.h"
@interface NSApplication (NibCompatibility)
- (void) _setMainMenu: (NSMenu*)aMenu;
@ -628,7 +631,7 @@
- (NSString *) description
{
return [NSString stringWithFormat: @"<%@, %@, %@, %d>",
return [NSString stringWithFormat: @"<%@, %@, %@, %p>",
[self className],
object,
parent,
@ -944,7 +947,10 @@
}
// Load connections and awaken objects
[objects nibInstantiate];
if ([objects respondsToSelector:@selector(nibInstantiate)])
{
[objects nibInstantiate];
}
}
- (BOOL) loadModelData: (NSData *)data
@ -975,7 +981,20 @@
}
else
{
NSLog(@"Could not instantiate Xib unarchiver.");
GSXibParser *parser = [[GSXibParser alloc] initWithData: data];
NSDictionary *result = [parser parse];
if (result != nil)
{
NSArray *rootObjects = [result objectForKey: @"IBDocument.RootObjects"];
GSXibObjectContainer *objects = [result objectForKey: @"IBDocument.Objects"];
[self awake: rootObjects
inContainer: objects
withContext: context];
}
else
{
NSLog(@"Could not instantiate Xib unarchiver/Unable to parse Xib.");
}
}
}
else
@ -1024,83 +1043,6 @@
@end
@implementation GSXibElement
- (GSXibElement*) initWithType: (NSString*)typeName
andAttributes: (NSDictionary*)attribs
{
ASSIGN(type, typeName);
ASSIGN(attributes, attribs);
elements = [[NSMutableDictionary alloc] init];
values = [[NSMutableArray alloc] init];
return self;
}
- (void) dealloc
{
DESTROY(type);
DESTROY(attributes);
DESTROY(elements);
DESTROY(values);
DESTROY(value);
[super dealloc];
}
- (NSString*) type
{
return type;
}
- (NSString*) value
{
return value;
}
- (NSDictionary*) elements
{
return elements;
}
- (NSArray*) values
{
return values;
}
- (void) addElement: (GSXibElement*)element
{
[values addObject: element];
}
- (void) setElement: (GSXibElement*)element forKey: (NSString*)key
{
[elements setObject: element forKey: key];
}
- (void) setValue: (NSString*)text
{
ASSIGN(value, text);
}
- (NSString*) attributeForKey: (NSString*)key
{
return [attributes objectForKey: key];
}
- (GSXibElement*) elementForKey: (NSString*)key
{
return [elements objectForKey: key];
}
- (NSString*) description
{
return [NSString stringWithFormat:
@"GSXibElement <%@> attrs (%@) elements [%@] values [%@] %@",
type, attributes, elements, values, value, nil];
}
@end
@implementation GSXibKeyedUnarchiver
- (NSData *) _preProcessXib: (NSData *)data
@ -1115,6 +1057,16 @@
}
else
{
// Test to see if this is an Xcode 5 XIB...
NSArray *documentNodes = [document nodesForXPath:@"/document"
error:NULL];
if ([documentNodes count] > 0)
{
NSLog(@"Unsupported... This is an XCode 5 XIB file.");
return nil;
}
else
{
NSArray *customClassNodes = [document nodesForXPath:@"//dictionary[@key=\"flattenedProperties\"]/"
@"string[contains(@key,\"CustomClassName\")]"
error:NULL];
@ -1252,6 +1204,7 @@
result = [document XMLData];
RELEASE(document);
}
}
return result;
}
@ -1268,6 +1221,11 @@
theData = [self _preProcessXib: data];
}
if (theData == nil)
{
return nil;
}
objects = [[NSMutableDictionary alloc] init];
stack = [[NSMutableArray alloc] init];
decoded = [[NSMutableDictionary alloc] init];

View file

@ -1,5 +1,6 @@
#import <Foundation/NSObject.h>
#import <Foundation/NSKeyedArchiver.h>
#import "GNUstepGUI/GSXibElement.h"
@interface IBUserDefinedRuntimeAttributesPlaceholder : NSObject <NSCoding>
{
@ -22,6 +23,12 @@
@interface IBAccessibilityAttribute : NSObject <NSCoding>
@end
@interface IBNSLayoutConstraint : NSObject <NSCoding>
@end
@interface IBLayoutConstant : NSObject <NSCoding>
@end
@implementation IBUserDefinedRuntimeAttributesPlaceholder
- (void) encodeWithCoder: (NSCoder *)coder
@ -92,3 +99,27 @@
}
@end
@implementation IBNSLayoutConstraint
- (void) encodeWithCoder: (NSCoder *)coder
{
// Do nothing...
}
- (id) initWithCoder: (NSCoder *)coder
{
return self;
}
@end
@implementation IBLayoutConstant
- (void) encodeWithCoder: (NSCoder *)coder
{
// Do nothing...
}
- (id) initWithCoder: (NSCoder *)coder
{
return self;
}
@end

View file

@ -0,0 +1,31 @@
/* <title>GSXibObjectContainer</title>
<abstract>Xib v5 (Cocoa XML) container</abstract>
Copyright (C) 2014 Free Software Foundation, Inc.
Written by: Gregory Casamento <greg.casamento@gmail.com>
Created: March 2014
This file is part of the GNUstep Base Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
*/
#import "GNUstepGUI/GSXibObjectContainer.h"
@implementation GSXibObjectContainer
@end

211
Source/GSXibParser.m Normal file
View file

@ -0,0 +1,211 @@
/* <title>GSXibParser</title>
<abstract>Xib v5 (Cocoa XML) parser</abstract>
Copyright (C) 2014 Free Software Foundation, Inc.
Written by: Gregory Casamento <greg.casamento@gmail.com>
Created: March 2014
This file is part of the GNUstep Base Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
*/
#import <Foundation/NSData.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSXMLParser.h>
#import <Foundation/NSString.h>
#import <Foundation/NSArray.h>
#import <Foundation/NSException.h>
#import "GNUstepGUI/GSXibParser.h"
#import "GNUstepGUI/GSXibElement.h"
// XIB Object...
@interface XIBObject : NSObject
{
NSMutableArray *connections;
}
- (id) initWithXibElement: (GSXibElement *)element;
- (id) instantiateObject;
@end
@implementation XIBObject
- (id) initWithXibElement: (GSXibElement *)element
{
if ((self = [super init]) != nil)
{
connections = [[NSMutableArray alloc] initWithCapacity: 10];
}
return self;
}
- (void) dealloc
{
[connections release];
[super dealloc];
}
- (id) instantiateObject
{
return nil;
}
- (NSArray *) connections
{
return connections;
}
@end
@interface XIBAction : XIBObject
- (void) setSelector: (NSString *)selectorName;
- (NSString *) selector;
- (void) setTarget: (NSString *)targetId;
- (NSString *) target;
@end
@interface XIBOutlet : XIBObject
- (void) setProperty: (NSString *)propertyName;
- (NSString *) property;
- (void) setDestination: (NSString *)destinationId;
- (NSString *) destination;
@end
@interface XIBCustomObject
- (void) setUserLabel: (NSString *)label;
- (NSString *) userLabel;
- (void) setCustomClass: (NSString *)className;
- (NSString *) customClass;
@end
@implementation GSXibParser
- (id) initWithData: (NSData *)data
{
if ((self = [super init]) != nil)
{
theParser = [[NSXMLParser alloc] initWithData: data];
[theParser setDelegate: self];
objects = [[NSMutableDictionary alloc] initWithCapacity: 100];
stack = [[NSMutableArray alloc] initWithCapacity: 100];
currentElement = nil;
}
return self;
}
- (NSDictionary *) parse
{
NS_DURING
{
[theParser parse];
}
NS_HANDLER
{
NSLog(@"%@",[localException reason]);
}
NS_ENDHANDLER;
return objects;
}
- (NSMutableDictionary *) instantiateObjects
{
return nil;
}
- (NSString *)classNameFromType: (NSString *)typeName
{
NSString *className = [@"XIB" stringByAppendingString: [typeName capitalizedString]];
return className;
}
- (id) instantiateObjectForElement: (GSXibElement *)element
{
NSString *className = [self classNameFromType: [element type]];
id obj = nil;
if (className != nil)
{
Class cls = NSClassFromString(className);
if (cls != nil)
{
obj = [[cls alloc] initWithXibElement:element];
}
}
return obj;
}
- (void) parser: (NSXMLParser*)parser
foundCharacters: (NSString*)string
{
[currentElement setValue: string];
}
- (void) parser: (NSXMLParser*)parser
didStartElement: (NSString*)elementName
namespaceURI: (NSString*)namespaceURI
qualifiedName: (NSString*)qualifiedName
attributes: (NSDictionary*)attributeDict
{
GSXibElement *element = [[GSXibElement alloc] initWithType: elementName
andAttributes: attributeDict];
NSString *key = [attributeDict objectForKey: @"id"];
// FIXME: We should use proper memory management here
AUTORELEASE(element);
if ([@"document" isEqualToString: elementName])
{
currentElement = element;
}
else
{
if (key != nil)
{
// id obj = [self instantiateObjectForElement: element];
[currentElement setElement: element forKey: key];
}
else
{
// For Arrays
[currentElement addElement: element];
}
currentElement = element;
}
[stack addObject: currentElement];
}
- (void) parser: (NSXMLParser*)parser
didEndElement: (NSString*)elementName
namespaceURI: (NSString*)namespaceURI
qualifiedName: (NSString*)qName
{
if (![@"document" isEqualToString: elementName])
{
currentElement = [stack lastObject];
[stack removeLastObject];
}
else
{
objects = [self instantiateObjects];
}
}
@end

87
Source/NSStatusBar.m Normal file
View file

@ -0,0 +1,87 @@
/*
NSStatusBar.m
The status bar class
Copyright (C) 2013 Free Software Foundation, Inc.
Author: Dr. H. Nikolaus Schaller
Date: 2013
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#import <Foundation/NSArray.h>
#import <AppKit/NSStatusBar.h>
#import <AppKit/NSStatusItem.h>
@interface NSStatusItem (Private)
- (id) _initForStatusBar: (NSStatusBar*)bar
withLength: (CGFloat)len;
@end
@implementation NSStatusBar
- (id) init
{
self = [super init];
if (self)
{
_items = [[NSMutableArray alloc] init];
}
return self;
}
- (void) dealloc
{
RELEASE(_items);
[super dealloc];
}
+ (NSStatusBar*) systemStatusBar
{
return nil;
}
- (BOOL) isVertical
{
return NO;
}
- (void) removeStatusItem: (NSStatusItem*)item
{
[_items removeObjectIdenticalTo: item];
}
- (NSStatusItem*) statusItemWithLength: (CGFloat)length
{
NSStatusItem *item = [[NSStatusItem alloc] _initForStatusBar: self
withLength: length];
[_items addObject: item];
return AUTORELEASE(item);
}
- (CGFloat) thickness
{
return 22;
}
@end

220
Source/NSStatusItem.m Normal file
View file

@ -0,0 +1,220 @@
/*
NSStatusItem.h
The status item class
Copyright (C) 2013 Free Software Foundation, Inc.
Author: Gregory Casamento <greg.casamento@gmail.com>
Date: 2013
Author: Dr. H. Nikolaus Schaller
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
// FIXME: This class is currently a placeholder to allow compilation of
// apps which require NSStatusItem. Currently there is not a clean,
// cross-platform way to implement this functionality.
#import <Foundation/NSAttributedString.h>
#import <Foundation/NSString.h>
#import <AppKit/NSStatusItem.h>
#import <AppKit/NSMenuItem.h>
#import <AppKit/NSView.h>
@implementation NSStatusItem
- (id) _initForStatusBar: (NSStatusBar*)bar
withLength: (CGFloat)len
{
if ((self = [super init]))
{
_statusBar = bar;
_menuItem = [[NSMenuItem alloc] initWithTitle: @"?"
action: NULL
keyEquivalent: @""];
[_menuItem setRepresentedObject: self];
[self setLength: len];
}
return self;
}
- (void) dealloc
{
RELEASE(_menuItem);
[super dealloc];
}
- (SEL) action
{
return [_menuItem action];
}
- (NSAttributedString*) attributedTitle
{
return [_menuItem attributedTitle];
}
- (SEL) doubleAction
{
// NIMP
return NULL;
}
- (void) drawStatusBarBackgroundInRect: (NSRect)rect withHighlight: (BOOL)flag
{
// NIMP
}
- (BOOL) highlightMode
{
return _highlightMode;
}
- (NSImage*) image
{
return [_menuItem image];
}
- (BOOL) isEnabled
{
return [_menuItem isEnabled];
}
- (CGFloat) length
{
return _length;
}
- (NSMenu *) menu
{
return [_menuItem submenu];
}
- (void) popUpStatusItemMenu: (NSMenu*)menu
{
// NIMP
}
- (NSInteger) sendActionOn: (NSInteger)mask
{
//NIMP
return 0;
}
- (void) setAction: (SEL)action
{
[_menuItem setAction: action];
}
- (void) setAttributedTitle: (NSAttributedString*) title
{
[_menuItem setAttributedTitle: title];
}
- (void) setDoubleAction: (SEL)sel
{
// NIMP
}
- (void) setEnabled: (BOOL)flag
{
[_menuItem setEnabled: flag];
}
- (void) setHighlightMode: (BOOL)highlightMode
{
_highlightMode = highlightMode;
}
- (void) setImage: (NSImage*)image
{
[_menuItem setImage: image];
}
- (void) setLength: (CGFloat)len
{
_length = len;
//[_menuItem _changed];
}
- (void) setMenu: (NSMenu*)menu
{
[_menuItem setSubmenu: menu];
}
- (void) setTarget: (id)target
{
[_menuItem setTarget: target];
}
- (void) setTitle: (NSString*)title
{
[_menuItem setTitle: title];
}
- (void) setToolTip: (NSString*)toolTip
{
[_menuItem setToolTip: toolTip];
}
- (void) setView: (NSView*)view
{
ASSIGN(_view, view);
}
- (NSStatusBar*) statusBar
{
return _statusBar;
}
- (id) target
{
return [_menuItem target];
}
- (NSString*) title
{
return [_menuItem title];
}
- (NSString*) toolTip
{
return [_menuItem toolTip];
}
- (NSView*) view
{
return _view;
}
- (NSImage*) alternateImage
{
//NIMP
return nil;
}
- (void) setAlternateImage: (NSImage*)img
{
//NIMP
}
@end

109
Source/NSTrackingArea.m Normal file
View file

@ -0,0 +1,109 @@
/*
NSTrackingArea.h
Track mouse movements in and out of a rectangle on screen.
Copyright (C) 2013 Free Software Foundation, Inc.
Written by: Gregory Casamento <greg.casamento@gmail.com>
Date: September 2013
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#import <Foundation/NSDictionary.h>
#import "AppKit/NSTrackingArea.h"
#import "GNUstepGUI/GSTrackingRect.h"
@implementation NSTrackingArea
- (id)initWithRect: (NSRect)rect
options: (NSTrackingAreaOptions)options
owner: (id)owner
userInfo: (NSDictionary *)userInfo
{
if ((self = [super init]) != nil)
{
BOOL flag = (BOOL)(options & NSTrackingAssumeInside);
_userInfo = RETAIN(_userInfo);
_options = options;
_trackingRect = [[GSTrackingRect alloc] initWithRect:rect
tag:0
owner:owner
userData:(void *)userInfo
inside:flag];
}
return self;
}
- (void) dealloc
{
[_userInfo release];
[_trackingRect release];
[super dealloc];
}
- (NSTrackingAreaOptions) options
{
return _options;
}
- (id) owner
{
return [_trackingRect owner];
}
- (NSRect) rect
{
return [_trackingRect rectangle];
}
- (NSDictionary *) userInfo
{
return _userInfo;
}
- (void) encodeWithCoder: (NSCoder *)coder
{
// [super encodeWithCoder:coder];
}
- (id) initWithCoder: (NSCoder *)coder
{
//[super initWithCoder:coder];
return self;
}
- (id) copyWithZone: (NSZone *)zone
{
NSRect rect = [self rect];
NSTrackingAreaOptions options = [self options];
id owner = [self owner];
id info = [self userInfo];
NSTrackingArea *newArea = [[NSTrackingArea allocWithZone:zone]
initWithRect: rect
options: options
owner: owner
userInfo: info];
return newArea;
}
@end

251
Source/NSTreeNode.m Normal file
View file

@ -0,0 +1,251 @@
/*
NSTreeNode.m
The tree node class
Copyright (C) 2013 Free Software Foundation, Inc.
Author: Fred Kiefer <fredkiefer@gmx.de>
Date: 2013
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#import <Foundation/NSArray.h>
#import <Foundation/NSIndexPath.h>
#import <Foundation/NSString.h>
#import <Foundation/NSSortDescriptor.h>
#import <AppKit/NSTreeNode.h>
@interface NSTreeNode (Private)
- (NSMutableArray*) _childNodes;
- (void) _setParentNode: (NSTreeNode*)parentNode;
@end
@implementation NSTreeNode (Private)
- (NSMutableArray*) _childNodes
{
return _childNodes;
}
- (void) _setParentNode: (NSTreeNode*)parentNode
{
_parentNode = parentNode;
}
@end
@interface GSTreeNodeArray : NSMutableArray
{
NSMutableArray *array;
NSTreeNode *parent;
}
@end
@implementation GSTreeNodeArray
- (id) initForTreeNode: (NSTreeNode*)node
{
ASSIGN(parent, node);
array = [parent _childNodes];
return self;
}
- (void) dealloc
{
RELEASE(parent);
[super dealloc];
}
- (NSUInteger) count
{
return [array count];
}
- (id) objectAtIndex: (NSUInteger)index
{
return [array objectAtIndex: index];
}
- (void) addObject: (id)anObject
{
[array addObject: anObject];
[(NSTreeNode*)anObject _setParentNode: parent];
}
- (void) replaceObjectAtIndex: (NSUInteger)index withObject: (id)anObject
{
id old = [array objectAtIndex: index];
[(NSTreeNode*)old _setParentNode: nil];
[array replaceObjectAtIndex: index withObject: anObject];
[(NSTreeNode*)anObject _setParentNode: parent];
}
- (void) insertObject: anObject atIndex: (NSUInteger)index
{
[array insertObject: anObject atIndex: index];
[(NSTreeNode*)anObject _setParentNode: parent];
}
- (void) removeObjectAtIndex: (NSUInteger)index
{
id old = [array objectAtIndex: index];
[(NSTreeNode*)old _setParentNode: nil];
[array removeObjectAtIndex: index];
}
@end
@implementation NSTreeNode
+ (id) treeNodeWithRepresentedObject: (id)modelObject
{
NSTreeNode *node = [[NSTreeNode alloc] initWithRepresentedObject: modelObject];
return AUTORELEASE(node);
}
- (NSArray*) childNodes
{
return [NSArray arrayWithArray: _childNodes];
}
- (NSTreeNode*) descendantNodeAtIndexPath: (NSIndexPath*)path
{
NSUInteger len = [path length];
NSUInteger i;
NSTreeNode *node = self;
for (i = 0; i < len; i++)
{
NSUInteger index = [path indexAtPosition: i];
node = [node->_childNodes objectAtIndex: index];
if (node == nil)
{
return nil;
}
}
return node;
}
- (NSIndexPath*) indexPath
{
if (_parentNode != nil)
{
NSIndexPath *path;
NSUInteger index;
index = [_parentNode->_childNodes indexOfObject: self];
path = [_parentNode indexPath];
if (path != nil)
{
return [path indexPathByAddingIndex: index];
}
else
{
return [NSIndexPath indexPathWithIndex: index];
}
}
else
{
return nil;
}
}
- (id) initWithRepresentedObject: (id)repObj
{
ASSIGN(_representedObject, repObj);
_childNodes = [[NSMutableArray alloc] init];
return self;
}
- (void) dealloc
{
RELEASE(_representedObject);
RELEASE(_childNodes);
[super dealloc];
}
- (BOOL) isLeaf
{
return [_childNodes count] == 0;
}
- (NSMutableArray*) mutableChildNodes
{
GSTreeNodeArray *nodeArray = [[GSTreeNodeArray alloc] initForTreeNode: self];
return AUTORELEASE(nodeArray);
}
- (NSTreeNode*) parentNode
{
return _parentNode;
}
- (id) representedObject
{
return _representedObject;
}
- (void) sortWithSortDescriptors: (NSArray*)sortDescs recursively: (BOOL)flag
{
// Sort children nodes
NSUInteger i;
NSUInteger len = [sortDescs count];
NSMutableArray *newSortDescs = [[NSMutableArray alloc] init];
for (i = 0; i < len; i++)
{
NSSortDescriptor *oldDesc = [sortDescs objectAtIndex: i];
NSString * newKey = [@"representedObject." stringByAppendingString: [oldDesc key]];
NSSortDescriptor *newDesc = [[NSSortDescriptor alloc]
initWithKey: newKey
ascending: [oldDesc ascending]
selector: [oldDesc selector]];
[newSortDescs addObject: newDesc];
RELEASE(newDesc);
}
[_childNodes sortUsingDescriptors: newSortDescs];
RELEASE(newSortDescs);
if (flag)
{
// sort recursive
NSUInteger count = [_childNodes count];
for (i = 0; i < count; i++)
{
[[_childNodes objectAtIndex: i] sortWithSortDescriptors: sortDescs
recursively: YES];
}
}
}
@end