mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 16:10:48 +00:00
Merge pull request #64 from gnustep/NSLayoutConstraint_branch
NSLayoutConstraint branch
This commit is contained in:
commit
27f43a6cda
11 changed files with 1562 additions and 17 deletions
48
ChangeLog
48
ChangeLog
|
@ -1,9 +1,27 @@
|
|||
2020-07-30 Gregory John Casamento <greg.casamento@gmail.com>
|
||||
|
||||
* Headers/AppKit/AppKit.h
|
||||
* Headers/AppKit/NSLayoutAnchor.h
|
||||
* Headers/AppKit/NSLayoutConstraint.h
|
||||
* Headers/AppKit/NSLayoutGuide.h
|
||||
* MISSING: Remove classes from list.
|
||||
* Source/GNUmakefile
|
||||
* Source/GSXib5KeyedUnarchiver.m: Add code to decode constraints.
|
||||
* Source/NSLayoutAnchor.m
|
||||
* Source/NSLayoutConstraint.m
|
||||
* Source/NSLayoutGuide.m: Add infrastructure for layouts.
|
||||
This needs additional work and study. Comitting now so others
|
||||
can more easily help.
|
||||
|
||||
2020-07-28 Gregory John Casamento <greg.casamento@gmail.com>
|
||||
|
||||
* Headers/AppKit/AppKit.h: Add includes for splitviewcontroller, pagecontroller and tabviewcontroller.
|
||||
* Headers/AppKit/AppKit.h: Add includes for splitviewcontroller,
|
||||
pagecontroller and tabviewcontroller.
|
||||
* Headers/AppKit/NSPageController.h: Interface for page view controller
|
||||
* Headers/AppKit/NSSplitViewController.h: Interface for splitview controller
|
||||
* Headers/AppKit/NSSplitViewItem.h: Enhancements to splitview item to add logic for controller
|
||||
* Headers/AppKit/NSSplitViewController.h: Interface for splitview
|
||||
controller
|
||||
* Headers/AppKit/NSSplitViewItem.h: Enhancements to splitview item to
|
||||
add logic for controller
|
||||
* Headers/AppKit/NSStoryboardSegue.h: Add methods to handle popovers
|
||||
* Headers/AppKit/NSTabViewController.h: Interface for tabViewController
|
||||
* Headers/AppKit/NSTabViewItem.h: methods to support NSViewController
|
||||
|
@ -14,7 +32,8 @@
|
|||
* Source/GSStoryboardTransform.h: Additional methods on proxy
|
||||
* Source/GSStoryboardTransform.m: Additional methods on proxy
|
||||
* Source/GSThemeDrawing.m: minor changes
|
||||
* Source/GSXib5KeyedUnarchiver.m: Handle pagecontroller element, set certain things to true if abesnt
|
||||
* Source/GSXib5KeyedUnarchiver.m: Handle pagecontroller element,
|
||||
set certain things to true if abesnt
|
||||
* Source/NSPageController.m: Implementation of NSPageController
|
||||
* Source/NSSplitViewController.m: Implementation of NSSplitViewController
|
||||
* Source/NSSplitViewItem.m: Implementation
|
||||
|
@ -45,16 +64,21 @@
|
|||
* MISSING: Remove the classes implemented here from the missing list.
|
||||
* Source/Functions.m: Enhance NSApplicationMain() function to handle the
|
||||
loading of a storyboard.
|
||||
* Source/GNUmakefile: Add the new classes to the build and copy the headers.
|
||||
* Source/GSStoryboardTransform.[hm]: Class to handle the transformation of
|
||||
the storyboard file into "XIB" files for loading. Also handles the intermediate
|
||||
* Source/GNUmakefile: Add the new classes to the build and copy the
|
||||
headers.
|
||||
* Source/GSStoryboardTransform.[hm]: Class to handle the transformation
|
||||
of the storyboard file into "XIB" files for loading. Also handles the
|
||||
intermediate
|
||||
processes of instantiation of the destination controller.
|
||||
* Source/NSStoryboard.m: Implementation of the above described class.
|
||||
* Source/NSStoryboardSegue.m: Implementation of the above described class.
|
||||
* Source/NSViewController.m: Implementation of private methods to handle transitions.
|
||||
* Source/NSWindowController.m: Implementation of private methods to handle transitions.
|
||||
* Source/NSWindow.m: Implementation of method to create window controller for
|
||||
view controllers.
|
||||
* Source/NSStoryboardSegue.m: Implementation of the above described
|
||||
class.
|
||||
* Source/NSViewController.m: Implementation of private methods to
|
||||
handle transitions.
|
||||
* Source/NSWindowController.m: Implementation of private methods to
|
||||
handle transitions.
|
||||
* Source/NSWindow.m: Implementation of method to create window
|
||||
controller for view controllers.
|
||||
|
||||
2020-07-10 Gregory John Casamento <greg.casamento@gmail.com>
|
||||
|
||||
|
|
|
@ -178,6 +178,9 @@
|
|||
#import <AppKit/NSInputServer.h>
|
||||
#import <AppKit/NSInterfaceStyle.h>
|
||||
#import <AppKit/NSKeyValueBinding.h>
|
||||
#import <AppKit/NSLayoutAnchor.h>
|
||||
#import <AppKit/NSLayoutConstraint.h>
|
||||
#import <AppKit/NSLayoutGuide.h>
|
||||
#import <AppKit/NSLayoutManager.h>
|
||||
#import <AppKit/NSLevelIndicator.h>
|
||||
#import <AppKit/NSLevelIndicatorCell.h>
|
||||
|
|
101
Headers/AppKit/NSLayoutAnchor.h
Normal file
101
Headers/AppKit/NSLayoutAnchor.h
Normal file
|
@ -0,0 +1,101 @@
|
|||
/* Interface of class NSLayoutAnchor
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory Casamento <greg.casamento@gmail.com>
|
||||
Date: Sat May 9 16:30:52 EDT 2020
|
||||
|
||||
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 _NSLayoutAnchor_h_GNUSTEP_GUI_INCLUDE
|
||||
#define _NSLayoutAnchor_h_GNUSTEP_GUI_INCLUDE
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@class NSLayoutConstraint, NSString, NSArray;
|
||||
|
||||
@interface NSLayoutAnchor : NSObject <NSCoding, NSCopying>
|
||||
{
|
||||
NSString *_name;
|
||||
id _item;
|
||||
BOOL _hasAmbiguousLayout;
|
||||
NSArray *_constraintsAffectingLayout;
|
||||
}
|
||||
|
||||
- (NSLayoutConstraint *) constraintEqualToAnchor: (NSLayoutAnchor *)anchor;
|
||||
- (NSLayoutConstraint *) constraintGreaterThanOrEqualToAnchor: (NSLayoutAnchor *)anchor;
|
||||
- (NSLayoutConstraint *) constraintLessThanOrEqualToAnchor: (NSLayoutAnchor *)anchor;
|
||||
|
||||
- (NSLayoutConstraint *) constraintEqualToAnchor: (NSLayoutAnchor *)anchor constant: (CGFloat)c;
|
||||
- (NSLayoutConstraint *) constraintGreaterThanOrEqualToAnchor: (NSLayoutAnchor *)anchor constant: (CGFloat)c;
|
||||
- (NSLayoutConstraint *) constraintLessThanOrEqualToAnchor: (NSLayoutAnchor *)anchor constant: (CGFloat)c;
|
||||
|
||||
- (NSString *) name;
|
||||
|
||||
- (id) item;
|
||||
|
||||
- (BOOL) hasAmbiguousLayout;
|
||||
|
||||
- (NSArray *) constraintsAffectingLayout;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSLayoutDimension : NSLayoutAnchor
|
||||
{
|
||||
}
|
||||
|
||||
- (NSLayoutConstraint *) constraintEqualToConstant: (CGFloat)c;
|
||||
- (NSLayoutConstraint *) constraintGreaterThanOrEqualToConstant: (CGFloat)c;
|
||||
- (NSLayoutConstraint *) constraintLessThanOrEqualToConstant: (CGFloat)c;
|
||||
|
||||
- (NSLayoutConstraint *) constraintEqualToAnchor: (NSLayoutDimension *)anchor multiplier: (CGFloat)m;
|
||||
- (NSLayoutConstraint *) constraintGreaterThanOrEqualToAnchor: (NSLayoutDimension *)anchor multiplier: (CGFloat)m;
|
||||
- (NSLayoutConstraint *) constraintLessThanOrEqualToAnchor: (NSLayoutDimension *)anchor multiplier: (CGFloat)m;
|
||||
|
||||
- (NSLayoutConstraint *) constraintEqualToAnchor: (NSLayoutDimension *)anchor multiplier: (CGFloat)m constant: (CGFloat)c;
|
||||
- (NSLayoutConstraint *) constraintGreaterThanOrEqualToAnchor: (NSLayoutDimension *)anchor multiplier: (CGFloat)m constant: (CGFloat)c;
|
||||
- (NSLayoutConstraint *) constraintLessThanOrEqualToAnchor: (NSLayoutDimension *)anchor multiplier: (CGFloat)m constant: (CGFloat)c;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSLayoutXAxisAnchor : NSLayoutAnchor
|
||||
|
||||
- (NSLayoutDimension *) anchorWithOffsetToAnchor: (NSLayoutXAxisAnchor *)anchor;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSLayoutYAxisAnchor : NSLayoutAnchor
|
||||
|
||||
- (NSLayoutDimension *) anchorWithOffsetToAnchor: (NSLayoutYAxisAnchor *)anchor;
|
||||
|
||||
@end
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GS_API_MACOSX */
|
||||
|
||||
#endif /* _NSLayoutAnchor_h_GNUSTEP_GUI_INCLUDE */
|
||||
|
170
Headers/AppKit/NSLayoutConstraint.h
Normal file
170
Headers/AppKit/NSLayoutConstraint.h
Normal file
|
@ -0,0 +1,170 @@
|
|||
/* Interface of class NSLayoutConstraint
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory Casamento <greg.casamento@gmail.com>
|
||||
Date: Sat May 9 16:30:22 EDT 2020
|
||||
|
||||
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 _NSLayoutConstraint_h_GNUSTEP_GUI_INCLUDE
|
||||
#define _NSLayoutConstraint_h_GNUSTEP_GUI_INCLUDE
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <Foundation/NSGeometry.h>
|
||||
#import <Foundation/NSKeyedArchiver.h>
|
||||
#import <AppKit/NSLayoutAnchor.h>
|
||||
|
||||
@class NSControl, NSView, NSAnimation, NSArray, NSMutableArray, NSDictionary;
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Priority
|
||||
typedef float NSLayoutPriority;
|
||||
static const NSLayoutPriority NSLayoutPriorityRequired = 1000.0;
|
||||
static const NSLayoutPriority NSLayoutPriorityDefaultHigh = 750.0;
|
||||
static const NSLayoutPriority NSLayoutPriorityDragThatCanResizeWindow = 510.0;
|
||||
static const NSLayoutPriority NSLayoutPriorityWindowSizeStayPut = 500.0;
|
||||
static const NSLayoutPriority NSLayoutPriorityDragThatCannotResizeWindow = 490.0;
|
||||
static const NSLayoutPriority NSLayoutPriorityDefaultLow = 250.0;
|
||||
static const NSLayoutPriority NSLayoutPriorityFittingSizeCompression = 50.0;
|
||||
|
||||
// Orientation
|
||||
enum {
|
||||
NSLayoutConstraintOrientationHorizontal = 0,
|
||||
NSLayoutConstraintOrientationVertical = 1
|
||||
};
|
||||
typedef NSInteger NSLayoutConstraintOrientation;
|
||||
|
||||
// Attributes
|
||||
enum {
|
||||
NSLayoutAttributeLeft = 1,
|
||||
NSLayoutAttributeRight,
|
||||
NSLayoutAttributeTop,
|
||||
NSLayoutAttributeBottom,
|
||||
NSLayoutAttributeLeading,
|
||||
NSLayoutAttributeTrailing,
|
||||
NSLayoutAttributeWidth,
|
||||
NSLayoutAttributeHeight,
|
||||
NSLayoutAttributeCenterX,
|
||||
NSLayoutAttributeCenterY,
|
||||
NSLayoutAttributeLastBaseline,
|
||||
NSLayoutAttributeBaseline = NSLayoutAttributeLastBaseline,
|
||||
NSLayoutAttributeFirstBaseline,
|
||||
NSLayoutAttributeNotAnAttribute = 0
|
||||
};
|
||||
typedef NSInteger NSLayoutAttribute;
|
||||
|
||||
// Relation
|
||||
enum {
|
||||
NSLayoutRelationLessThanOrEqual = -1,
|
||||
NSLayoutRelationEqual = 0,
|
||||
NSLayoutRelationGreaterThanOrEqual = 1,
|
||||
};
|
||||
typedef NSInteger NSLayoutRelation;
|
||||
|
||||
// Options
|
||||
enum {
|
||||
NSLayoutFormatAlignAllLeft = (1 << NSLayoutAttributeLeft),
|
||||
NSLayoutFormatAlignAllRight = (1 << NSLayoutAttributeRight),
|
||||
NSLayoutFormatAlignAllTop = (1 << NSLayoutAttributeTop),
|
||||
NSLayoutFormatAlignAllBottom = (1 << NSLayoutAttributeBottom),
|
||||
NSLayoutFormatAlignAllLeading = (1 << NSLayoutAttributeLeading),
|
||||
NSLayoutFormatAlignAllTrailing = (1 << NSLayoutAttributeTrailing),
|
||||
NSLayoutFormatAlignAllCenterX = (1 << NSLayoutAttributeCenterX),
|
||||
NSLayoutFormatAlignAllCenterY = (1 << NSLayoutAttributeCenterY),
|
||||
NSLayoutFormatAlignAllLastBaseline = (1 << NSLayoutAttributeLastBaseline),
|
||||
NSLayoutFormatAlignAllFirstBaseline = (1 << NSLayoutAttributeFirstBaseline),
|
||||
NSLayoutFormatAlignAllBaseline = NSLayoutFormatAlignAllLastBaseline,
|
||||
NSLayoutFormatAlignmentMask = 0xFFFF,
|
||||
NSLayoutFormatDirectionLeadingToTrailing = 0 << 16,
|
||||
NSLayoutFormatDirectionLeftToRight = 1 << 16,
|
||||
NSLayoutFormatDirectionRightToLeft = 2 << 16,
|
||||
NSLayoutFormatDirectionMask = 0x3 << 16,
|
||||
};
|
||||
typedef NSUInteger NSLayoutFormatOptions;
|
||||
|
||||
@interface NSLayoutConstraint : NSObject <NSCoding, NSCopying>
|
||||
{
|
||||
NSLayoutAnchor *_firstAnchor;
|
||||
NSLayoutAnchor *_secondAnchor;
|
||||
id _firstItem;
|
||||
id _secondItem;
|
||||
NSLayoutAttribute _firstAttribute;
|
||||
NSLayoutAttribute _secondAttribute;
|
||||
NSLayoutRelation _relation;
|
||||
CGFloat _multiplier;
|
||||
CGFloat _constant;
|
||||
NSLayoutPriority _priority;
|
||||
}
|
||||
|
||||
+ (NSArray *)constraintsWithVisualFormat: (NSString *)fmt
|
||||
options: (NSLayoutFormatOptions)opt
|
||||
metrics: (NSDictionary *)metrics
|
||||
views: (NSDictionary *)views;
|
||||
|
||||
+ (instancetype) constraintWithItem: (id)view1
|
||||
attribute: (NSLayoutAttribute)attr1
|
||||
relatedBy: (NSLayoutRelation)relation
|
||||
toItem: (id)view2
|
||||
attribute: (NSLayoutAttribute)attr2
|
||||
multiplier: (CGFloat)mult
|
||||
constant: (CGFloat)c;
|
||||
|
||||
// Active
|
||||
- (BOOL) isActive;
|
||||
- (void) setActive: (BOOL)flag;
|
||||
|
||||
+ (void) activateConstraints: (NSArray *)constraints;
|
||||
+ (void) deactivateConstraints: (NSArray *)constraints;
|
||||
|
||||
// Items
|
||||
- (id) firstItem;
|
||||
|
||||
- (NSLayoutAttribute) firstAttribute;
|
||||
|
||||
- (NSLayoutRelation) relation;
|
||||
|
||||
- (id) secondItem;
|
||||
|
||||
- (NSLayoutAttribute) secondAttribute;
|
||||
|
||||
- (CGFloat) multiplier;
|
||||
|
||||
- (CGFloat) constant;
|
||||
|
||||
- (NSLayoutAnchor *) firstAnchor;
|
||||
|
||||
- (NSLayoutAnchor *) secondAnchor;
|
||||
|
||||
- (NSLayoutPriority) priority;
|
||||
|
||||
@end
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GS_API_MACOSX */
|
||||
|
||||
#endif /* _NSLayoutConstraint_h_GNUSTEP_GUI_INCLUDE */
|
||||
|
101
Headers/AppKit/NSLayoutGuide.h
Normal file
101
Headers/AppKit/NSLayoutGuide.h
Normal file
|
@ -0,0 +1,101 @@
|
|||
/* Interface of class NSLayoutGuide
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory Casamento <greg.casamento@gmail.com>
|
||||
Date: Sat May 9 16:30:36 EDT 2020
|
||||
|
||||
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 _NSLayoutGuide_h_GNUSTEP_GUI_INCLUDE
|
||||
#define _NSLayoutGuide_h_GNUSTEP_GUI_INCLUDE
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <AppKit/NSUserInterfaceItemIdentification.h>
|
||||
#import <AppKit/NSLayoutConstraint.h>
|
||||
#import <AppKit/NSView.h>
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@class NSView, NSLayoutXAxisAnchor, NSLayoutYAxisAnchor, NSLayoutDimension;
|
||||
|
||||
@interface NSLayoutGuide : NSObject <NSCoding, NSUserInterfaceItemIdentification>
|
||||
{
|
||||
NSRect _frame;
|
||||
NSView *_owningView;
|
||||
NSUserInterfaceItemIdentifier _identifier;
|
||||
NSLayoutXAxisAnchor *_leadingAnchor;
|
||||
NSLayoutXAxisAnchor *_trailingAnchor;
|
||||
NSLayoutXAxisAnchor *_leftAnchor;
|
||||
NSLayoutXAxisAnchor *_rightAnchor;
|
||||
NSLayoutYAxisAnchor *_topAnchor;
|
||||
NSLayoutYAxisAnchor *_bottomAnchor;
|
||||
NSLayoutDimension *_widthAnchor;
|
||||
NSLayoutDimension *_heightAnchor;
|
||||
NSLayoutXAxisAnchor *_centerXAnchor;
|
||||
NSLayoutYAxisAnchor *_centerYAnchor;
|
||||
|
||||
BOOL _hasAmbiguousLayout;
|
||||
}
|
||||
|
||||
- (NSRect) frame;
|
||||
|
||||
- (NSView *) owningView;
|
||||
- (void) setOwningView: (NSView *)owningView;
|
||||
|
||||
- (NSUserInterfaceItemIdentifier) identifier;
|
||||
- (void) setIdentifier: (NSUserInterfaceItemIdentifier)identifier;
|
||||
|
||||
- (NSLayoutXAxisAnchor *) leadingAnchor;
|
||||
- (NSLayoutXAxisAnchor *) trailingAnchor;
|
||||
- (NSLayoutXAxisAnchor *) leftAnchor;
|
||||
- (NSLayoutXAxisAnchor *) rightAnchor;
|
||||
- (NSLayoutYAxisAnchor *) topAnchor;
|
||||
- (NSLayoutYAxisAnchor *) bottomAnchor;
|
||||
- (NSLayoutDimension *) widthAnchor;
|
||||
- (NSLayoutDimension *) heightAnchor;
|
||||
- (NSLayoutXAxisAnchor *) centerXAnchor;
|
||||
- (NSLayoutYAxisAnchor *) centerYAnchor;
|
||||
|
||||
- (BOOL) hasAmbiguousLayout;
|
||||
|
||||
- (NSArray *) constraintsAffectingLayoutForOrientation: (NSLayoutConstraintOrientation)orientation;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSView (NSLayoutGuideSupport)
|
||||
|
||||
- (void) addLayoutGuide: (NSLayoutGuide *)guide;
|
||||
- (void) removeLayoutGuide: (NSLayoutGuide *)guide;
|
||||
|
||||
- (NSArray *) layoutGuides;
|
||||
|
||||
@end
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GS_API_MACOSX */
|
||||
|
||||
#endif /* _NSLayoutGuide_h_GNUSTEP_GUI_INCLUDE */
|
||||
|
3
MISSING
3
MISSING
|
@ -15,9 +15,6 @@ MISSING HEADERS
|
|||
> NSGlyphInfo.h
|
||||
> NSGridView.h
|
||||
> NSItemProvider.h
|
||||
> NSLayoutAnchor.h
|
||||
> NSLayoutConstraint.h
|
||||
> NSLayoutGuide.h
|
||||
> NSMenuToolbarItem.h
|
||||
> NSOpenGLLayer.h
|
||||
> NSRuleEditor.h
|
||||
|
|
|
@ -148,6 +148,9 @@ NSInputManager.m \
|
|||
NSInputServer.m \
|
||||
NSInterfaceStyle.m \
|
||||
NSKeyValueBinding.m \
|
||||
NSLayoutAnchor.m \
|
||||
NSLayoutConstraint.m \
|
||||
NSLayoutGuide.m \
|
||||
NSLayoutManager.m \
|
||||
NSLevelIndicator.m \
|
||||
NSLevelIndicatorCell.m \
|
||||
|
@ -448,6 +451,9 @@ NSInputManager.h \
|
|||
NSInputServer.h \
|
||||
NSInterfaceStyle.h \
|
||||
NSKeyValueBinding.h \
|
||||
NSLayoutAnchor.h \
|
||||
NSLayoutConstraint.h \
|
||||
NSLayoutGuide.h \
|
||||
NSLayoutManager.h \
|
||||
NSLevelIndicator.h \
|
||||
NSLevelIndicatorCell.h \
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
#import "AppKit/NSTabView.h"
|
||||
#import "AppKit/NSToolbarItem.h"
|
||||
#import "AppKit/NSView.h"
|
||||
#import "AppKit/NSLayoutConstraint.h"
|
||||
#import "AppKit/NSPageController.h"
|
||||
#import "GSCodingFlags.h"
|
||||
|
||||
|
@ -169,6 +170,7 @@ static NSDictionary *XmlKeyToDecoderSelectorMap = nil;
|
|||
static NSArray *XmlKeysDefined = nil;
|
||||
static NSArray *XmlReferenceAttributes = nil;
|
||||
static NSArray *XmlConnectionRecordTags = nil;
|
||||
static NSArray *XmlConstraintRecordTags = nil;
|
||||
static NSArray *XmlBoolDefaultYes = nil;
|
||||
|
||||
+ (void) initialize
|
||||
|
@ -199,6 +201,7 @@ static NSArray *XmlBoolDefaultYes = nil;
|
|||
@"NSMutableArray", @"allowedToolbarItems",
|
||||
@"NSMutableArray", @"defaultToolbarItems",
|
||||
@"NSMutableArray", @"rowTemplates",
|
||||
@"NSMutableArray", @"constraints",
|
||||
@"NSSegmentItem", @"segment",
|
||||
@"NSCell", @"customCell",
|
||||
@"NSCustomObject5", @"customObject",
|
||||
|
@ -209,6 +212,7 @@ static NSArray *XmlBoolDefaultYes = nil;
|
|||
@"NSView", @"tableCellView",
|
||||
@"IBUserDefinedRuntimeAttribute5", @"userDefinedRuntimeAttribute",
|
||||
@"NSURL", @"url",
|
||||
@"NSLayoutConstraint", @"constraint",
|
||||
@"NSPageController", @"pagecontroller", // why is pagecontroller capitalized this way?
|
||||
nil];
|
||||
RETAIN(XmlTagToObjectClassMap);
|
||||
|
@ -223,12 +227,15 @@ static NSArray *XmlBoolDefaultYes = nil;
|
|||
RETAIN(ClassNamePrefixes);
|
||||
|
||||
XmlReferenceAttributes = [NSArray arrayWithObjects: @"headerView", @"initialItem",
|
||||
@"selectedItem", nil];
|
||||
@"selectedItem", @"firstItem", @"secondItem", nil];
|
||||
RETAIN(XmlReferenceAttributes);
|
||||
|
||||
XmlConnectionRecordTags = [NSArray arrayWithObjects: @"action", @"outlet", @"binding", nil];
|
||||
RETAIN(XmlConnectionRecordTags);
|
||||
|
||||
XmlConstraintRecordTags = [NSArray arrayWithObject: @"constraint"];
|
||||
RETAIN(XmlConstraintRecordTags);
|
||||
|
||||
// These cross-reference from the OLD key to the NEW key that can be referenced and its value
|
||||
// or object returned verbatim. If an OLD XIB key does not exist and contains the 'NS' prefix
|
||||
// the key processing will strip the 'NS' prefix, make the first letter lowercase then check
|
||||
|
@ -389,6 +396,9 @@ static NSArray *XmlBoolDefaultYes = nil;
|
|||
@"decodeToolbarImageForElement:", @"NSToolbarItemImage",
|
||||
@"decodeControlContentsForElement:", @"NSControlContents",
|
||||
@"decodePathStyle:", @"NSPathStyle",
|
||||
@"decodeFirstAttribute:", @"NSFirstAttribute",
|
||||
@"decodeSecondAttribute:", @"NSSecondAttribute",
|
||||
@"decodeRelation:", @"NSRelation",
|
||||
@"decodeTransitionStyle:", @"NSTransitionStyle",
|
||||
nil];
|
||||
RETAIN(XmlKeyToDecoderSelectorMap);
|
||||
|
@ -513,7 +523,7 @@ static NSArray *XmlBoolDefaultYes = nil;
|
|||
forKey: @"destination"];
|
||||
}
|
||||
|
||||
// Build a connection recort
|
||||
// Build a connection record
|
||||
connectionRecord = [[GSXibElement alloc] initWithType: @"object"
|
||||
andAttributes:
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
|
@ -795,6 +805,10 @@ 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
|
||||
{
|
||||
|
@ -2781,6 +2795,103 @@ didStartElement: (NSString*)elementName
|
|||
return num;
|
||||
}
|
||||
|
||||
- (id) decodeConstraintAttribute: (id)obj
|
||||
{
|
||||
NSNumber *num = [NSNumber numberWithInteger: 0];
|
||||
|
||||
if ([obj isEqualToString: @"left"])
|
||||
{
|
||||
num = [NSNumber numberWithInteger: NSLayoutAttributeLeft];
|
||||
}
|
||||
else if ([obj isEqualToString: @"right"])
|
||||
{
|
||||
num = [NSNumber numberWithInteger: NSLayoutAttributeRight];
|
||||
}
|
||||
else if ([obj isEqualToString: @"top"])
|
||||
{
|
||||
num = [NSNumber numberWithInteger: NSLayoutAttributeTop];
|
||||
}
|
||||
else if ([obj isEqualToString: @"bottom"])
|
||||
{
|
||||
num = [NSNumber numberWithInteger: NSLayoutAttributeBottom];
|
||||
}
|
||||
else if ([obj isEqualToString: @"leading"])
|
||||
{
|
||||
num = [NSNumber numberWithInteger: NSLayoutAttributeLeading];
|
||||
}
|
||||
else if ([obj isEqualToString: @"trailing"])
|
||||
{
|
||||
num = [NSNumber numberWithInteger: NSLayoutAttributeTrailing];
|
||||
}
|
||||
else if ([obj isEqualToString: @"width"])
|
||||
{
|
||||
num = [NSNumber numberWithInteger: NSLayoutAttributeWidth];
|
||||
}
|
||||
else if ([obj isEqualToString: @"height"])
|
||||
{
|
||||
num = [NSNumber numberWithInteger: NSLayoutAttributeHeight];
|
||||
}
|
||||
else if ([obj isEqualToString: @"centerX"])
|
||||
{
|
||||
num = [NSNumber numberWithInteger: NSLayoutAttributeCenterX];
|
||||
}
|
||||
else if ([obj isEqualToString: @"centerY"])
|
||||
{
|
||||
num = [NSNumber numberWithInteger: NSLayoutAttributeCenterY];
|
||||
}
|
||||
else if ([obj isEqualToString: @"lastBaseline"])
|
||||
{
|
||||
num = [NSNumber numberWithInteger: NSLayoutAttributeLastBaseline];
|
||||
}
|
||||
else if ([obj isEqualToString: @"baseline"])
|
||||
{
|
||||
num = [NSNumber numberWithInteger: NSLayoutAttributeBaseline];
|
||||
}
|
||||
else if ([obj isEqualToString: @"firstBaseline"])
|
||||
{
|
||||
num = [NSNumber numberWithInteger: NSLayoutAttributeFirstBaseline];
|
||||
}
|
||||
else if ([obj isEqualToString: @"notAnAttribute"])
|
||||
{
|
||||
num = [NSNumber numberWithInteger: NSLayoutAttributeNotAnAttribute];
|
||||
}
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
- (id) decodeFirstAttribute: (GSXibElement *)element
|
||||
{
|
||||
id obj = [element attributeForKey: @"firstAttribute"];
|
||||
return [self decodeConstraintAttribute: obj];
|
||||
}
|
||||
|
||||
- (id) decodeSecondAttribute: (GSXibElement *)element
|
||||
{
|
||||
id obj = [element attributeForKey: @"secondAttribute"];
|
||||
return [self decodeConstraintAttribute: obj];
|
||||
}
|
||||
|
||||
- (id) decodeRelation: (GSXibElement *)element
|
||||
{
|
||||
NSNumber *num = [NSNumber numberWithInteger: 0];
|
||||
id obj = [element attributeForKey: @"relation"];
|
||||
|
||||
if ([obj isEqualToString: @"lessThanOrEqual"])
|
||||
{
|
||||
num = [NSNumber numberWithInteger: NSLayoutRelationLessThanOrEqual];
|
||||
}
|
||||
else if ([obj isEqualToString: @"equal"])
|
||||
{
|
||||
num = [NSNumber numberWithInteger: NSLayoutRelationEqual];
|
||||
}
|
||||
else if ([obj isEqualToString: @"greaterThanOrEqual"])
|
||||
{
|
||||
num = [NSNumber numberWithInteger: NSLayoutRelationGreaterThanOrEqual];
|
||||
}
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
- (id) decodeTransitionStyle: (GSXibElement *)element
|
||||
{
|
||||
NSNumber *num = [NSNumber numberWithInteger: 0];
|
||||
|
|
292
Source/NSLayoutAnchor.m
Normal file
292
Source/NSLayoutAnchor.m
Normal file
|
@ -0,0 +1,292 @@
|
|||
/* Implementation of class NSLayoutAnchor
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory Casamento <greg.casamento@gmail.com>
|
||||
Date: Sat May 9 16:30:52 EDT 2020
|
||||
|
||||
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 <Foundation/NSString.h>
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
|
||||
#import "AppKit/NSLayoutAnchor.h"
|
||||
#import "AppKit/NSLayoutConstraint.h"
|
||||
|
||||
@implementation NSLayoutAnchor
|
||||
|
||||
- (NSLayoutConstraint *) constraintEqualToAnchor: (NSLayoutAnchor *)anchor
|
||||
{
|
||||
return [NSLayoutConstraint constraintWithItem: _item
|
||||
attribute: NSLayoutAttributeLeft
|
||||
relatedBy: NSLayoutRelationEqual
|
||||
toItem: [anchor item]
|
||||
attribute: NSLayoutAttributeLeft
|
||||
multiplier: 1.0
|
||||
constant: 0.0];
|
||||
}
|
||||
|
||||
- (NSLayoutConstraint *) constraintGreaterThanOrEqualToAnchor: (NSLayoutAnchor *)anchor
|
||||
{
|
||||
return [NSLayoutConstraint constraintWithItem: _item
|
||||
attribute: NSLayoutAttributeLeft
|
||||
relatedBy: NSLayoutRelationGreaterThanOrEqual
|
||||
toItem: [anchor item]
|
||||
attribute: NSLayoutAttributeLeft
|
||||
multiplier: 1.0
|
||||
constant: 0.0];
|
||||
}
|
||||
|
||||
- (NSLayoutConstraint *) constraintLessThanOrEqualToAnchor: (NSLayoutAnchor *)anchor
|
||||
{
|
||||
return [NSLayoutConstraint constraintWithItem: _item
|
||||
attribute: NSLayoutAttributeLeft
|
||||
relatedBy: NSLayoutRelationLessThanOrEqual
|
||||
toItem: [anchor item]
|
||||
attribute: NSLayoutAttributeLeft
|
||||
multiplier: 1.0
|
||||
constant: 0.0];
|
||||
}
|
||||
|
||||
- (NSLayoutConstraint *) constraintEqualToAnchor: (NSLayoutAnchor *)anchor constant: (CGFloat)c
|
||||
{
|
||||
return [NSLayoutConstraint constraintWithItem: _item
|
||||
attribute: NSLayoutAttributeLeft
|
||||
relatedBy: NSLayoutRelationEqual
|
||||
toItem: [anchor item]
|
||||
attribute: NSLayoutAttributeLeft
|
||||
multiplier: 1.0
|
||||
constant: 0.0];
|
||||
}
|
||||
|
||||
- (NSLayoutConstraint *) constraintGreaterThanOrEqualToAnchor: (NSLayoutAnchor *)anchor constant: (CGFloat)c
|
||||
{
|
||||
return [NSLayoutConstraint constraintWithItem: _item
|
||||
attribute: NSLayoutAttributeLeft
|
||||
relatedBy: NSLayoutRelationGreaterThanOrEqual
|
||||
toItem: [anchor item]
|
||||
attribute: NSLayoutAttributeLeft
|
||||
multiplier: 1.0
|
||||
constant: c];
|
||||
}
|
||||
|
||||
- (NSLayoutConstraint *) constraintLessThanOrEqualToAnchor: (NSLayoutAnchor *)anchor constant: (CGFloat)c;
|
||||
{
|
||||
return [NSLayoutConstraint constraintWithItem: _item
|
||||
attribute: NSLayoutAttributeLeft
|
||||
relatedBy: NSLayoutRelationLessThanOrEqual
|
||||
toItem: [anchor item]
|
||||
attribute: NSLayoutAttributeLeft
|
||||
multiplier: 1.0
|
||||
constant: c];
|
||||
}
|
||||
|
||||
- (instancetype) init
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_name = nil;
|
||||
_item = nil;
|
||||
_hasAmbiguousLayout = NO;
|
||||
_constraintsAffectingLayout = [[NSMutableArray alloc] init];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(_name);
|
||||
RELEASE(_item);
|
||||
RELEASE(_constraintsAffectingLayout);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString *) name
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
- (id) item
|
||||
{
|
||||
return _item;
|
||||
}
|
||||
|
||||
- (BOOL) hasAmbiguousLayout
|
||||
{
|
||||
return _hasAmbiguousLayout;
|
||||
}
|
||||
|
||||
- (NSArray *) constraintsAffectingLayout
|
||||
{
|
||||
return _constraintsAffectingLayout;
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder *)c
|
||||
{
|
||||
self = [super init];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder *)c
|
||||
{
|
||||
}
|
||||
|
||||
- (id) copyWithZone: (NSZone *)z
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSLayoutDimension
|
||||
|
||||
- (NSLayoutConstraint *) constraintEqualToConstant: (CGFloat)c
|
||||
{
|
||||
return [NSLayoutConstraint constraintWithItem: _item
|
||||
attribute: NSLayoutAttributeLeft
|
||||
relatedBy: NSLayoutRelationEqual
|
||||
toItem: _item
|
||||
attribute: NSLayoutAttributeLeft
|
||||
multiplier: 1.0
|
||||
constant: c];
|
||||
}
|
||||
|
||||
- (NSLayoutConstraint *) constraintGreaterThanOrEqualToConstant: (CGFloat)c
|
||||
{
|
||||
return [NSLayoutConstraint constraintWithItem: _item
|
||||
attribute: NSLayoutAttributeLeft
|
||||
relatedBy: NSLayoutRelationGreaterThanOrEqual
|
||||
toItem: _item
|
||||
attribute: NSLayoutAttributeLeft
|
||||
multiplier: 1.0
|
||||
constant: c];
|
||||
}
|
||||
|
||||
- (NSLayoutConstraint *) constraintLessThanOrEqualToConstant: (CGFloat)c
|
||||
{
|
||||
return [NSLayoutConstraint constraintWithItem: _item
|
||||
attribute: NSLayoutAttributeLeft
|
||||
relatedBy: NSLayoutRelationLessThanOrEqual
|
||||
toItem: _item
|
||||
attribute: NSLayoutAttributeLeft
|
||||
multiplier: 1.0
|
||||
constant: c];
|
||||
}
|
||||
|
||||
- (NSLayoutConstraint *) constraintEqualToAnchor: (NSLayoutDimension *)anchor multiplier: (CGFloat)m
|
||||
{
|
||||
return [NSLayoutConstraint constraintWithItem: _item
|
||||
attribute: NSLayoutAttributeLeft
|
||||
relatedBy: NSLayoutRelationEqual
|
||||
toItem: [anchor item]
|
||||
attribute: NSLayoutAttributeLeft
|
||||
multiplier: m
|
||||
constant: 0.0];
|
||||
}
|
||||
|
||||
- (NSLayoutConstraint *) constraintGreaterThanOrEqualToAnchor: (NSLayoutDimension *)anchor multiplier: (CGFloat)m
|
||||
{
|
||||
return [NSLayoutConstraint constraintWithItem: _item
|
||||
attribute: NSLayoutAttributeLeft
|
||||
relatedBy: NSLayoutRelationGreaterThanOrEqual
|
||||
toItem: [anchor item]
|
||||
attribute: NSLayoutAttributeLeft
|
||||
multiplier: m
|
||||
constant: 0.0];
|
||||
}
|
||||
|
||||
- (NSLayoutConstraint *) constraintLessThanOrEqualToAnchor: (NSLayoutDimension *)anchor multiplier: (CGFloat)m
|
||||
{
|
||||
return [NSLayoutConstraint constraintWithItem: _item
|
||||
attribute: NSLayoutAttributeLeft
|
||||
relatedBy: NSLayoutRelationLessThanOrEqual
|
||||
toItem: [anchor item]
|
||||
attribute: NSLayoutAttributeLeft
|
||||
multiplier: m
|
||||
constant: 0.0];
|
||||
}
|
||||
|
||||
- (NSLayoutConstraint *) constraintEqualToAnchor: (NSLayoutDimension *)anchor multiplier: (CGFloat)m constant: (CGFloat)c
|
||||
{
|
||||
return [NSLayoutConstraint constraintWithItem: _item
|
||||
attribute: NSLayoutAttributeLeft
|
||||
relatedBy: NSLayoutRelationEqual
|
||||
toItem: [anchor item]
|
||||
attribute: NSLayoutAttributeLeft
|
||||
multiplier: m
|
||||
constant: c];
|
||||
}
|
||||
|
||||
- (NSLayoutConstraint *) constraintGreaterThanOrEqualToAnchor: (NSLayoutDimension *)anchor multiplier: (CGFloat)m constant: (CGFloat)c
|
||||
{
|
||||
return [NSLayoutConstraint constraintWithItem: _item
|
||||
attribute: NSLayoutAttributeLeft
|
||||
relatedBy: NSLayoutRelationGreaterThanOrEqual
|
||||
toItem: [anchor item]
|
||||
attribute: NSLayoutAttributeLeft
|
||||
multiplier: m
|
||||
constant: c];
|
||||
}
|
||||
|
||||
- (NSLayoutConstraint *) constraintLessThanOrEqualToAnchor: (NSLayoutDimension *)anchor multiplier: (CGFloat)m constant: (CGFloat)c
|
||||
{
|
||||
return [NSLayoutConstraint constraintWithItem: _item
|
||||
attribute: NSLayoutAttributeLeft
|
||||
relatedBy: NSLayoutRelationLessThanOrEqual
|
||||
toItem: [anchor item]
|
||||
attribute: NSLayoutAttributeLeft
|
||||
multiplier: m
|
||||
constant: c];
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder *)coder
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
NSLog(@"Decoding");
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder *)coder
|
||||
{
|
||||
[super encodeWithCoder: coder];
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation NSLayoutXAxisAnchor
|
||||
|
||||
- (NSLayoutDimension *) anchorWithOffsetToAnchor: (NSLayoutXAxisAnchor *)anchor
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSLayoutYAxisAnchor
|
||||
|
||||
- (NSLayoutDimension *) anchorWithOffsetToAnchor: (NSLayoutYAxisAnchor *)anchor
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
605
Source/NSLayoutConstraint.m
Normal file
605
Source/NSLayoutConstraint.m
Normal file
|
@ -0,0 +1,605 @@
|
|||
/* Implementation of class NSLayoutConstraint
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory Casamento <greg.casamento@gmail.com>
|
||||
Date: Sat May 9 16:30:22 EDT 2020
|
||||
|
||||
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 <Foundation/NSArray.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSKeyedArchiver.h>
|
||||
|
||||
#import "AppKit/NSControl.h"
|
||||
#import "AppKit/NSView.h"
|
||||
#import "AppKit/NSAnimation.h"
|
||||
#import "AppKit/NSLayoutConstraint.h"
|
||||
#import "AppKit/NSWindow.h"
|
||||
#import "AppKit/NSApplication.h"
|
||||
|
||||
static NSMutableArray *activeConstraints = nil;
|
||||
// static NSNotificationCenter *nc = nil;
|
||||
|
||||
@implementation NSLayoutConstraint
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
if (self == [NSLayoutConstraint class])
|
||||
{
|
||||
[self setVersion: 1];
|
||||
activeConstraints = [[NSMutableArray alloc] initWithCapacity: 10];
|
||||
// nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
// [nc addObserver: self
|
||||
// selector: @selector(_setupNotifications:)
|
||||
// name: NSApplicationDidFinishLaunchingNotification
|
||||
// object: nil];
|
||||
}
|
||||
}
|
||||
|
||||
+ (void) _setupNotifications: (NSNotification *)n
|
||||
{
|
||||
/*
|
||||
[nc addObserver: self
|
||||
selector: @selector(_handleWindowResize:)
|
||||
name: NSWindowDidResizeNotification
|
||||
object: nil];
|
||||
*/
|
||||
}
|
||||
|
||||
+ (NSString *) _attributeToString: (NSLayoutAttribute)attr
|
||||
{
|
||||
NSString *name = nil;
|
||||
|
||||
switch (attr)
|
||||
{
|
||||
case NSLayoutAttributeLeft:
|
||||
name = @"Left";
|
||||
break;
|
||||
case NSLayoutAttributeRight:
|
||||
name = @"Right";
|
||||
break;
|
||||
case NSLayoutAttributeTop:
|
||||
name = @"Top";
|
||||
break;
|
||||
case NSLayoutAttributeBottom:
|
||||
name = @"Bottom";
|
||||
break;
|
||||
case NSLayoutAttributeLeading:
|
||||
name = @"Leading";
|
||||
break;
|
||||
case NSLayoutAttributeTrailing:
|
||||
name = @"Trailing";
|
||||
break;
|
||||
case NSLayoutAttributeWidth:
|
||||
name = @"Width";
|
||||
break;
|
||||
case NSLayoutAttributeHeight:
|
||||
name = @"Height";
|
||||
break;
|
||||
case NSLayoutAttributeCenterX:
|
||||
name = @"CenterX";
|
||||
break;
|
||||
case NSLayoutAttributeCenterY:
|
||||
name = @"CenterY";
|
||||
break;
|
||||
//case NSLayoutAttributeLastBaseline:
|
||||
//name = @"LastBaseline";
|
||||
//break;
|
||||
case NSLayoutAttributeBaseline:
|
||||
name = @"Baseline";
|
||||
break;
|
||||
case NSLayoutAttributeFirstBaseline:
|
||||
name = @"FirstBaseline";
|
||||
break;
|
||||
case NSLayoutAttributeNotAnAttribute:
|
||||
name = @"NotAnAttribute";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
+ (NSLayoutAttribute) _stringToAttribute: (NSString *)str
|
||||
{
|
||||
NSLayoutAttribute a = 0;
|
||||
|
||||
if ([@"Left" isEqualToString: str])
|
||||
{
|
||||
a = NSLayoutAttributeLeft;
|
||||
}
|
||||
else if ([@"Right" isEqualToString: str])
|
||||
{
|
||||
a = NSLayoutAttributeRight;
|
||||
}
|
||||
else if ([@"Top" isEqualToString: str])
|
||||
{
|
||||
a = NSLayoutAttributeTop;
|
||||
}
|
||||
else if ([@"Bottom" isEqualToString: str])
|
||||
{
|
||||
a = NSLayoutAttributeBottom;
|
||||
}
|
||||
else if ([@"Leading" isEqualToString: str])
|
||||
{
|
||||
a = NSLayoutAttributeLeading;
|
||||
}
|
||||
else if ([@"Trailing" isEqualToString: str])
|
||||
{
|
||||
a = NSLayoutAttributeTrailing;
|
||||
}
|
||||
else if ([@"Width" isEqualToString: str])
|
||||
{
|
||||
a = NSLayoutAttributeWidth;
|
||||
}
|
||||
else if ([@"Height" isEqualToString: str])
|
||||
{
|
||||
a = NSLayoutAttributeHeight;
|
||||
}
|
||||
else if ([@"CenterX" isEqualToString: str])
|
||||
{
|
||||
a = NSLayoutAttributeCenterX;
|
||||
}
|
||||
else if ([@"CenterY" isEqualToString: str])
|
||||
{
|
||||
a = NSLayoutAttributeCenterY;
|
||||
}
|
||||
else if ([@"Baseline" isEqualToString: str])
|
||||
{
|
||||
a = NSLayoutAttributeBaseline;
|
||||
}
|
||||
else if ([@"FirstBaseline" isEqualToString: str])
|
||||
{
|
||||
a = NSLayoutAttributeFirstBaseline;
|
||||
}
|
||||
else if ([@"NotAnAttribute" isEqualToString: str])
|
||||
{
|
||||
a = NSLayoutAttributeNotAnAttribute;
|
||||
}
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
+ (NSString *) _relationToString: (NSLayoutRelation)rel
|
||||
{
|
||||
NSString *relation = nil;
|
||||
|
||||
switch (rel)
|
||||
{
|
||||
case NSLayoutRelationLessThanOrEqual:
|
||||
relation = @"<=";
|
||||
break;
|
||||
case NSLayoutRelationEqual:
|
||||
relation = @"=";
|
||||
break;
|
||||
case NSLayoutRelationGreaterThanOrEqual:
|
||||
relation = @">=";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return relation;
|
||||
}
|
||||
|
||||
+ (NSLayoutRelation) _stringToRelation: (NSString *)str
|
||||
{
|
||||
NSLayoutRelation r = 0;
|
||||
|
||||
if ([@"<=" isEqualToString: str])
|
||||
{
|
||||
r = NSLayoutRelationLessThanOrEqual;
|
||||
}
|
||||
else if ([@"=" isEqualToString: str])
|
||||
{
|
||||
r = NSLayoutRelationEqual;
|
||||
}
|
||||
else if ([@">=" isEqualToString: str])
|
||||
{
|
||||
r = NSLayoutRelationGreaterThanOrEqual;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
+ (void) _activateConstraint: (NSLayoutConstraint *)constraint
|
||||
{
|
||||
// [activeConstraints addObject: constraint];
|
||||
// activeConstraints = [[activeConstraints sortedArrayUsingSelector: @selector(compare:)] mutableCopy];
|
||||
}
|
||||
|
||||
+ (void) _removeConstraint: (NSLayoutConstraint *)constraint
|
||||
{
|
||||
[activeConstraints removeObject: constraint];
|
||||
}
|
||||
|
||||
+ (NSArray *) constraintsWithVisualFormat: (NSString *)fmt
|
||||
options: (NSLayoutFormatOptions)opt
|
||||
metrics: (NSDictionary *)metrics
|
||||
views: (NSDictionary *)views
|
||||
{
|
||||
NSMutableArray *array = [NSMutableArray arrayWithCapacity: 10];
|
||||
return array;
|
||||
}
|
||||
|
||||
- (instancetype) initWithItem: (id)firstItem
|
||||
attribute: (NSLayoutAttribute)firstAttribute
|
||||
relatedBy: (NSLayoutRelation)relation
|
||||
toItem: (id)secondItem
|
||||
attribute: (NSLayoutAttribute)secondAttribute
|
||||
multiplier: (CGFloat)multiplier
|
||||
constant: (CGFloat)constant
|
||||
priority: (CGFloat)priority;
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_firstItem = firstItem;
|
||||
_secondItem = secondItem;
|
||||
_firstAttribute = firstAttribute;
|
||||
_secondAttribute = secondAttribute;
|
||||
_relation = relation;
|
||||
_multiplier = multiplier;
|
||||
_constant = constant;
|
||||
_priority = priority;
|
||||
|
||||
[NSLayoutConstraint _activateConstraint: self];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (instancetype) constraintWithItem: (id)view1
|
||||
attribute: (NSLayoutAttribute)attr1
|
||||
relatedBy: (NSLayoutRelation)relation
|
||||
toItem: (id)view2
|
||||
attribute: (NSLayoutAttribute)attr2
|
||||
multiplier: (CGFloat)mult
|
||||
constant: (CGFloat)c
|
||||
{
|
||||
NSLayoutConstraint *constraint =
|
||||
[[NSLayoutConstraint alloc] initWithItem: view1
|
||||
attribute: attr1
|
||||
relatedBy: relation
|
||||
toItem: view2
|
||||
attribute: attr2
|
||||
multiplier: mult
|
||||
constant: c
|
||||
priority: NSLayoutPriorityRequired];
|
||||
|
||||
AUTORELEASE(constraint);
|
||||
return constraint;
|
||||
}
|
||||
|
||||
+ (void) activateConstraints: (NSArray *)constraints
|
||||
{
|
||||
NSEnumerator *en = [constraints objectEnumerator];
|
||||
NSLayoutConstraint *c = nil;
|
||||
|
||||
while ((c = [en nextObject]) != nil)
|
||||
{
|
||||
[NSLayoutConstraint _activateConstraint: c];
|
||||
}
|
||||
}
|
||||
|
||||
+ (void) deactivateConstraints: (NSArray *)constraints
|
||||
{
|
||||
NSEnumerator *en = [constraints objectEnumerator];
|
||||
NSLayoutConstraint *c = nil;
|
||||
|
||||
while ((c = [en nextObject]) != nil)
|
||||
{
|
||||
[NSLayoutConstraint _removeConstraint: c];
|
||||
}
|
||||
}
|
||||
|
||||
// Active
|
||||
- (BOOL) isActive
|
||||
{
|
||||
return [activeConstraints containsObject: self];
|
||||
}
|
||||
|
||||
- (void) setActive: (BOOL)flag
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
[NSLayoutConstraint _activateConstraint: self];
|
||||
}
|
||||
else
|
||||
{
|
||||
[NSLayoutConstraint _removeConstraint: self];
|
||||
}
|
||||
}
|
||||
|
||||
// compare and isEqual...
|
||||
- (NSComparisonResult) compare: (NSLayoutConstraint *)constraint
|
||||
{
|
||||
if ([self priority] < [constraint priority])
|
||||
{
|
||||
return NSOrderedAscending;
|
||||
}
|
||||
else if ([self priority] > [constraint priority])
|
||||
{
|
||||
return NSOrderedDescending;
|
||||
}
|
||||
|
||||
return NSOrderedSame;
|
||||
}
|
||||
|
||||
- (BOOL) isEqual: (NSLayoutConstraint *)constraint
|
||||
{
|
||||
BOOL result = [super isEqual: constraint];
|
||||
|
||||
if (result == NO)
|
||||
{
|
||||
result = (_firstItem == [constraint firstItem] &&
|
||||
_secondItem == [constraint secondItem] &&
|
||||
_firstAttribute == [constraint firstAttribute] &&
|
||||
_secondAttribute == [constraint secondAttribute] &&
|
||||
_relation == [constraint relation] &&
|
||||
_multiplier == [constraint multiplier] &&
|
||||
_constant == [constraint constant] &&
|
||||
_priority == [constraint priority]);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Items
|
||||
- (id) firstItem
|
||||
{
|
||||
return _firstItem;
|
||||
}
|
||||
|
||||
- (NSLayoutAttribute) firstAttribute
|
||||
{
|
||||
return _firstAttribute;
|
||||
}
|
||||
|
||||
- (NSLayoutRelation) relation
|
||||
{
|
||||
return _relation;
|
||||
}
|
||||
|
||||
- (id) secondItem
|
||||
{
|
||||
return _secondItem;
|
||||
}
|
||||
|
||||
- (NSLayoutAttribute) secondAttribute
|
||||
{
|
||||
return _secondAttribute;
|
||||
}
|
||||
|
||||
- (CGFloat) multiplier
|
||||
{
|
||||
return _multiplier;
|
||||
}
|
||||
|
||||
- (CGFloat) constant
|
||||
{
|
||||
return _constant;
|
||||
}
|
||||
|
||||
- (NSLayoutAnchor *) firstAnchor
|
||||
{
|
||||
return _firstAnchor;
|
||||
}
|
||||
|
||||
- (NSLayoutAnchor *) secondAnchor
|
||||
{
|
||||
return _secondAnchor;
|
||||
}
|
||||
|
||||
- (NSLayoutPriority) priority
|
||||
{
|
||||
return _priority;
|
||||
}
|
||||
|
||||
- (void) setPriority: (NSLayoutPriority)priority
|
||||
{
|
||||
_priority = priority;
|
||||
}
|
||||
|
||||
// Coding...
|
||||
- (instancetype) initWithCoder: (NSCoder *)coder
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
if ([coder containsValueForKey: @"NSConstant"])
|
||||
{
|
||||
_constant = [coder decodeFloatForKey: @"NSConstant"];
|
||||
}
|
||||
|
||||
if ([coder containsValueForKey: @"NSFirstAttribute"])
|
||||
{
|
||||
_firstAttribute = [coder decodeIntegerForKey: @"NSFirstAttribute"];
|
||||
}
|
||||
|
||||
if ([coder containsValueForKey: @"NSFirstItem"])
|
||||
{
|
||||
_firstItem = [coder decodeObjectForKey: @"NSFirstItem"];
|
||||
}
|
||||
|
||||
if ([coder containsValueForKey: @"NSSecondAttribute"])
|
||||
{
|
||||
_secondAttribute = [coder decodeIntegerForKey: @"NSSecondAttribute"];
|
||||
}
|
||||
|
||||
if ([coder containsValueForKey: @"NSSecondItem"])
|
||||
{
|
||||
_secondItem = [coder decodeObjectForKey: @"NSSecondItem"];
|
||||
}
|
||||
|
||||
if ([coder containsValueForKey: @"NSMultiplier"])
|
||||
{
|
||||
_multiplier = [coder decodeFloatForKey: @"NSMultiplier"];
|
||||
}
|
||||
else
|
||||
{
|
||||
_multiplier = 1.0; // identity multiplier if not present
|
||||
}
|
||||
|
||||
if ([coder containsValueForKey: @"NSRelation"])
|
||||
{
|
||||
_relation = [coder decodeIntegerForKey: @"NSRelation"];
|
||||
}
|
||||
else
|
||||
{
|
||||
_relation = NSLayoutRelationEqual;
|
||||
}
|
||||
|
||||
if ([coder containsValueForKey: @"NSPriority"])
|
||||
{
|
||||
_priority = [coder decodeFloatForKey: @"NSPriority"];
|
||||
}
|
||||
else
|
||||
{
|
||||
_priority = NSLayoutPriorityRequired; // if it is not present, this defaults to 1000... per testing with Cocoa.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[coder decodeValueOfObjCType: @encode(float)
|
||||
at: &_constant];
|
||||
[coder decodeValueOfObjCType: @encode(NSUInteger)
|
||||
at: &_firstAttribute];
|
||||
_firstItem = RETAIN([coder decodeObject]);
|
||||
[coder decodeValueOfObjCType: @encode(NSUInteger)
|
||||
at: &_secondAttribute];
|
||||
_secondItem = RETAIN([coder decodeObject]);
|
||||
[coder decodeValueOfObjCType: @encode(float)
|
||||
at: &_multiplier];
|
||||
[coder decodeValueOfObjCType: @encode(NSUInteger)
|
||||
at: &_relation];
|
||||
[coder decodeValueOfObjCType: @encode(float)
|
||||
at: &_priority];
|
||||
}
|
||||
}
|
||||
|
||||
[NSLayoutConstraint _activateConstraint: self];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder *)coder
|
||||
{
|
||||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
[coder encodeFloat: _constant
|
||||
forKey: @"NSConstant"];
|
||||
[coder encodeInteger: _firstAttribute
|
||||
forKey: @"NSFirstAttribute"];
|
||||
[coder encodeObject: _firstItem
|
||||
forKey: @"NSFirstItem"];
|
||||
[coder encodeInteger: _secondAttribute
|
||||
forKey: @"NSSecondAttribute"];
|
||||
[coder encodeObject: _secondItem
|
||||
forKey: @"NSSecondItem"];
|
||||
[coder encodeFloat: _multiplier
|
||||
forKey: @"NSMultiplier"];
|
||||
[coder encodeInteger: _relation
|
||||
forKey: @"NSRelation"];
|
||||
[coder encodeFloat: _priority
|
||||
forKey: @"NSPriority"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[coder encodeValueOfObjCType: @encode(float)
|
||||
at: &_constant];
|
||||
[coder encodeValueOfObjCType: @encode(NSUInteger)
|
||||
at: &_firstAttribute];
|
||||
[coder encodeObject: _firstItem];
|
||||
[coder encodeValueOfObjCType: @encode(NSUInteger)
|
||||
at: &_secondAttribute];
|
||||
[coder encodeObject: _secondItem];
|
||||
[coder encodeValueOfObjCType: @encode(float)
|
||||
at: &_multiplier];
|
||||
[coder encodeValueOfObjCType: @encode(NSUInteger)
|
||||
at: &_relation];
|
||||
[coder encodeValueOfObjCType: @encode(float)
|
||||
at: &_priority];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) copyWithZone: (NSZone *)z
|
||||
{
|
||||
NSLayoutConstraint *constraint = [[NSLayoutConstraint allocWithZone: z]
|
||||
initWithItem: _firstItem
|
||||
attribute: _firstAttribute
|
||||
relatedBy: _relation
|
||||
toItem: _secondItem
|
||||
attribute: _secondAttribute
|
||||
multiplier: _multiplier
|
||||
constant: _constant
|
||||
priority: _priority];
|
||||
return constraint;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[NSLayoutConstraint _removeConstraint: self];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString *) description
|
||||
{
|
||||
return [NSString stringWithFormat: @"%@ <firstItem = %@, firstAttribute = %ld, relation = %ld, secondItem = %@, "
|
||||
"secondAttribute = %ld, multiplier = %f, constant = %f, priority = %f>",
|
||||
[super description],
|
||||
_firstItem,
|
||||
_firstAttribute,
|
||||
_relation,
|
||||
_secondItem,
|
||||
_secondAttribute,
|
||||
_multiplier,
|
||||
_constant,
|
||||
_priority];
|
||||
}
|
||||
|
||||
// item1.attribute1 = multiplier × item2.attribute2 + constant
|
||||
- (void) _applyConstraint
|
||||
{
|
||||
// Currently not implemented.
|
||||
}
|
||||
|
||||
+ (void) _handleWindowResize: (NSNotification *)notification
|
||||
{
|
||||
/*
|
||||
NSLayoutConstraint *c = nil;
|
||||
NSEnumerator *en = [activeConstraints objectEnumerator];
|
||||
|
||||
// Only apply to the window in the notification...
|
||||
while ((c = [en nextObject]) != nil)
|
||||
{
|
||||
NSWindow *w = [[c firstItem] window];
|
||||
if (w == [notification object])
|
||||
{
|
||||
[c _applyConstraint];
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@end
|
135
Source/NSLayoutGuide.m
Normal file
135
Source/NSLayoutGuide.m
Normal file
|
@ -0,0 +1,135 @@
|
|||
/* Implementation of class NSLayoutGuide
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory Casamento <greg.casamento@gmail.com>
|
||||
Date: Sat May 9 16:30:36 EDT 2020
|
||||
|
||||
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/NSLayoutGuide.h"
|
||||
|
||||
@implementation NSLayoutGuide
|
||||
|
||||
- (NSRect) frame
|
||||
{
|
||||
return _frame;
|
||||
}
|
||||
|
||||
- (NSView *) owningView
|
||||
{
|
||||
return _owningView;
|
||||
}
|
||||
|
||||
- (void) setOwningView: (NSView *)owningView
|
||||
{
|
||||
_owningView = owningView; // weak
|
||||
}
|
||||
|
||||
- (NSUserInterfaceItemIdentifier) identifier
|
||||
{
|
||||
return _identifier;
|
||||
}
|
||||
|
||||
- (void) setIdentifier: (NSUserInterfaceItemIdentifier)identifier
|
||||
{
|
||||
_identifier = identifier;
|
||||
}
|
||||
|
||||
- (NSLayoutXAxisAnchor *) leadingAnchor
|
||||
{
|
||||
return _leadingAnchor;
|
||||
}
|
||||
|
||||
- (NSLayoutXAxisAnchor *) trailingAnchor
|
||||
{
|
||||
return _trailingAnchor;
|
||||
}
|
||||
|
||||
- (NSLayoutXAxisAnchor *) leftAnchor
|
||||
{
|
||||
return _leftAnchor;
|
||||
}
|
||||
|
||||
- (NSLayoutXAxisAnchor *) rightAnchor
|
||||
{
|
||||
return _rightAnchor;
|
||||
}
|
||||
|
||||
- (NSLayoutYAxisAnchor *) topAnchor
|
||||
{
|
||||
return _topAnchor;
|
||||
}
|
||||
|
||||
- (NSLayoutYAxisAnchor *) bottomAnchor
|
||||
{
|
||||
return _bottomAnchor;
|
||||
}
|
||||
|
||||
- (NSLayoutDimension *) widthAnchor
|
||||
{
|
||||
return _widthAnchor;
|
||||
}
|
||||
|
||||
- (NSLayoutDimension *) heightAnchor
|
||||
{
|
||||
return _heightAnchor;
|
||||
}
|
||||
|
||||
- (NSLayoutXAxisAnchor *) centerXAnchor
|
||||
{
|
||||
return _centerXAnchor;
|
||||
}
|
||||
|
||||
- (NSLayoutYAxisAnchor *) centerYAnchor
|
||||
{
|
||||
return _centerYAnchor;
|
||||
}
|
||||
|
||||
- (BOOL) hasAmbiguousLayout
|
||||
{
|
||||
return _hasAmbiguousLayout;
|
||||
}
|
||||
|
||||
- (NSArray *) constraintsAffectingLayoutForOrientation: (NSLayoutConstraintOrientation)orientation
|
||||
{
|
||||
return [NSArray array];
|
||||
}
|
||||
|
||||
- (instancetype) init
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_frame = NSZeroRect;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype) initWithCoder: (NSCoder *)coder
|
||||
{
|
||||
self = [super init];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder *)coder
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
|
Loading…
Reference in a new issue