mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 13:10:59 +00:00
Fix xib encoding for stack view, update MISSING file, add decoding for distribution, update NSStackView _refreshView method, update methods for adding views to stackview.
This commit is contained in:
parent
47d48a1659
commit
d9ed92cdec
3 changed files with 132 additions and 57 deletions
2
MISSING
2
MISSING
|
@ -15,7 +15,7 @@ MISSING HEADERS ( * = difficult, - = quick, + = placeholder, x = won't do )
|
|||
> NSGlyphInfo.h -
|
||||
> NSItemProvider.h +
|
||||
> NSMenuToolbarItem.h -
|
||||
> NSOpenGLLayer.h x - header only
|
||||
> NSOpenGLLayer.h +
|
||||
> NSTableCellView.h *
|
||||
> NSTableRowView.h *
|
||||
> NSTableViewRowAction.h *
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#import "AppKit/NSScrollView.h"
|
||||
#import "AppKit/NSSliderCell.h"
|
||||
#import "AppKit/NSSplitView.h"
|
||||
#import "AppKit/NSStackView.h"
|
||||
#import "AppKit/NSTableColumn.h"
|
||||
#import "AppKit/NSTableHeaderView.h"
|
||||
#import "AppKit/NSTableView.h"
|
||||
|
@ -224,7 +225,10 @@ static NSArray *XmlBoolDefaultYes = nil;
|
|||
@"IBUserDefinedRuntimeAttribute5", @"userDefinedRuntimeAttribute",
|
||||
@"NSURL", @"url",
|
||||
@"NSLayoutConstraint", @"constraint",
|
||||
@"NSPageController", @"pagecontroller", // why is pagecontroller capitalized this way?
|
||||
@"NSPageController", @"pagecontroller", // inconsistent capitalization
|
||||
@"NSStackViewContainer", @"beginningViews",
|
||||
@"NSStackViewContainer", @"middleViews",
|
||||
@"NSStackViewContainer", @"endViews",
|
||||
nil];
|
||||
RETAIN(XmlTagToObjectClassMap);
|
||||
|
||||
|
@ -320,7 +324,6 @@ static NSArray *XmlBoolDefaultYes = nil;
|
|||
@"beginningViews", @"NSStackViewBeginningContainer", // NSStackView
|
||||
@"middleViews", @"NSStackViewMiddleContainer",
|
||||
@"endViews", @"NSStackViewEndContainer",
|
||||
@"orientation", @"NSStackViewOrientation",
|
||||
nil];
|
||||
RETAIN(XmlKeyMapTable);
|
||||
|
||||
|
@ -369,6 +372,7 @@ static NSArray *XmlBoolDefaultYes = nil;
|
|||
// decoding the integer flag masks...
|
||||
XmlKeyToDecoderSelectorMap =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"decodeDistributionForElement:", @"NSStackViewdistribution",
|
||||
@"decodeOrientationForElement:", @"NSStackViewOrientation",
|
||||
@"decodeXPlacementForElement:", @"NSGrid_xPlacement",
|
||||
@"decodeYPlacementForElement:", @"NSGrid_yPlacement",
|
||||
|
@ -3069,6 +3073,42 @@ didStartElement: (NSString*)elementName
|
|||
return [self _decodeOrientationForObject: obj];
|
||||
}
|
||||
|
||||
- (id) _decodeDistributionForObject: (id)obj
|
||||
{
|
||||
NSStackViewDistribution d = 0L;
|
||||
if ([obj isEqualToString: @"equalCentering"])
|
||||
{
|
||||
d = NSStackViewDistributionEqualCentering;
|
||||
}
|
||||
else if ([obj isEqualToString: @"equalSpacing"])
|
||||
{
|
||||
d = NSStackViewDistributionEqualCentering;
|
||||
}
|
||||
else if ([obj isEqualToString: @"fill"])
|
||||
{
|
||||
d = NSStackViewDistributionFill;
|
||||
}
|
||||
else if ([obj isEqualToString: @"fillEqually"])
|
||||
{
|
||||
d = NSStackViewDistributionFillEqually;
|
||||
}
|
||||
else if ([obj isEqualToString: @"fillProportionally"])
|
||||
{
|
||||
d = NSStackViewDistributionFillProportionally;
|
||||
}
|
||||
else if ([obj isEqualToString: @"gravityAreas"])
|
||||
{
|
||||
d = NSStackViewDistributionEqualCentering;
|
||||
}
|
||||
return [NSNumber numberWithInteger: d];
|
||||
}
|
||||
|
||||
- (id) decodeDistributionForElement: (GSXibElement *)element
|
||||
{
|
||||
id obj = [element attributeForKey: @"distribution"];
|
||||
return [self _decodeDistributionForObject: obj];
|
||||
}
|
||||
|
||||
- (id) decodeRowAlignmentForElement: (GSXibElement *)element
|
||||
{
|
||||
id obj = [element attributeForKey: @"rowAlignment"];
|
||||
|
|
|
@ -71,9 +71,11 @@
|
|||
|
||||
- (void) _refreshView
|
||||
{
|
||||
NSLog(@"orientation = %ld", _orientation);
|
||||
NSLog(@"distribution = %ld, _beginningContainer = %@", _distribution, _beginningContainer);
|
||||
if (_orientation == NSUserInterfaceLayoutOrientationHorizontal)
|
||||
{
|
||||
if (_beginningContainer != nil) // if one exists, they all do...
|
||||
if (_beginningContainer != nil)
|
||||
{
|
||||
NSSize s = [self frame].size;
|
||||
CGFloat w = s.width / 3.0; // three sections, always.
|
||||
|
@ -81,6 +83,8 @@
|
|||
NSUInteger i = 0;
|
||||
CGFloat y = 0.0;
|
||||
CGFloat x = 0.0;
|
||||
|
||||
NSLog(@"Size = %@", NSStringFromSize(s));
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
|
@ -117,27 +121,32 @@
|
|||
NSUInteger i = 0;
|
||||
CGFloat y = 0.0;
|
||||
CGFloat x = 0.0;
|
||||
|
||||
NSLog(@"V. Size = %@", NSStringFromSize(s));
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
NSRect f;
|
||||
|
||||
x = h * (CGFloat)i;
|
||||
y = h * (CGFloat)i;
|
||||
f = NSMakeRect(x,y,w,h);
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
[_beginningContainer setFrame: f];
|
||||
NSLog(@"Adding beginning container with frame %@", NSStringFromRect(f));
|
||||
[self addSubview: _beginningContainer];
|
||||
}
|
||||
if (i == 1)
|
||||
{
|
||||
[_middleContainer setFrame: f];
|
||||
NSLog(@"Adding mid container with frame %@", NSStringFromRect(f));
|
||||
[self addSubview: _middleContainer];
|
||||
}
|
||||
if (i == 2)
|
||||
{
|
||||
[_endContainer setFrame: f];
|
||||
NSLog(@"Adding end container with frame %@", NSStringFromRect(f));
|
||||
[self addSubview: _endContainer];
|
||||
}
|
||||
}
|
||||
|
@ -404,22 +413,30 @@
|
|||
|
||||
- (void)addView: (NSView *)view inGravity: (NSStackViewGravity)gravity
|
||||
{
|
||||
switch (gravity)
|
||||
if (_beginningContainer != nil)
|
||||
{
|
||||
case NSStackViewGravityTop: // or leading...
|
||||
[_beginningContainer addSubview: view];
|
||||
break;
|
||||
case NSStackViewGravityCenter:
|
||||
[_middleContainer addSubview: view];
|
||||
break;
|
||||
case NSStackViewGravityBottom:
|
||||
[_endContainer addSubview: view]; // or trailing...
|
||||
break;
|
||||
default:
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"Attempt to add view %@ to unknown container %ld.", view, gravity];
|
||||
break;
|
||||
switch (gravity)
|
||||
{
|
||||
case NSStackViewGravityTop: // or leading...
|
||||
[_beginningContainer addSubview: view];
|
||||
break;
|
||||
case NSStackViewGravityCenter:
|
||||
[_middleContainer addSubview: view];
|
||||
break;
|
||||
case NSStackViewGravityBottom:
|
||||
[_endContainer addSubview: view]; // or trailing...
|
||||
break;
|
||||
default:
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"Attempt to add view %@ to unknown container %ld.", view, gravity];
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[self addSubview: view];
|
||||
}
|
||||
|
||||
[self _refreshView];
|
||||
}
|
||||
|
||||
|
@ -452,47 +469,64 @@
|
|||
|
||||
- (NSArray *) viewsInGravity: (NSStackViewGravity)gravity
|
||||
{
|
||||
NSArray *result = nil;
|
||||
switch (gravity)
|
||||
NSMutableArray *result = [NSMutableArray array];
|
||||
|
||||
if (_beginningContainer != nil)
|
||||
{
|
||||
case NSStackViewGravityTop: // or leading...
|
||||
result = [_beginningContainer copy];
|
||||
break;
|
||||
case NSStackViewGravityCenter:
|
||||
result = [_middleContainer copy];
|
||||
break;
|
||||
case NSStackViewGravityBottom:
|
||||
result = [_endContainer copy]; // or trailing...
|
||||
break;
|
||||
default:
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"Attempt get array of views from unknown gravity %ld.", gravity];
|
||||
break;
|
||||
switch (gravity)
|
||||
{
|
||||
case NSStackViewGravityTop: // or leading...
|
||||
[result addObjectsFromArray: [_beginningContainer subviews]];
|
||||
break;
|
||||
case NSStackViewGravityCenter:
|
||||
[result addObjectsFromArray: [_middleContainer subviews]];
|
||||
break;
|
||||
case NSStackViewGravityBottom:
|
||||
[result addObjectsFromArray: [_endContainer subviews]];
|
||||
break;
|
||||
default:
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"Attempt get array of views from unknown gravity %ld.", gravity];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (void)setViews: (NSArray *)views inGravity: (NSStackViewGravity)gravity
|
||||
{
|
||||
switch (gravity)
|
||||
if (_beginningContainer != nil)
|
||||
{
|
||||
case NSStackViewGravityTop: // or leading...
|
||||
[_beginningContainer removeAllSubviews];
|
||||
[_beginningContainer addSubviews: views];
|
||||
break;
|
||||
case NSStackViewGravityCenter:
|
||||
[_middleContainer removeAllSubviews];
|
||||
[_middleContainer addSubviews: views];
|
||||
break;
|
||||
case NSStackViewGravityBottom:
|
||||
[_endContainer removeAllSubviews];
|
||||
[_endContainer addSubviews: views];
|
||||
break;
|
||||
default:
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"Attempt set array of views %@ into unknown gravity %ld.", views, gravity];
|
||||
break;
|
||||
switch (gravity)
|
||||
{
|
||||
case NSStackViewGravityTop: // or leading...
|
||||
[_beginningContainer removeAllSubviews];
|
||||
[_beginningContainer addSubviews: views];
|
||||
break;
|
||||
case NSStackViewGravityCenter:
|
||||
[_middleContainer removeAllSubviews];
|
||||
[_middleContainer addSubviews: views];
|
||||
break;
|
||||
case NSStackViewGravityBottom:
|
||||
[_endContainer removeAllSubviews];
|
||||
[_endContainer addSubviews: views];
|
||||
break;
|
||||
default:
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"Attempt set array of views %@ into unknown gravity %ld.", views, gravity];
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FOR_IN(NSView*,v,views)
|
||||
{
|
||||
[self addSubview: v];
|
||||
}
|
||||
END_FOR_IN(views);
|
||||
}
|
||||
|
||||
[self _refreshView];
|
||||
}
|
||||
|
||||
|
@ -579,19 +613,20 @@
|
|||
{
|
||||
if ([coder containsValueForKey: @"NSStackViewAlignment"])
|
||||
{
|
||||
_alignment = [coder decodeIntegerForKey: @"NSStackViewAlignment"];
|
||||
_alignment = [coder decodeIntForKey: @"NSStackViewAlignment"];
|
||||
}
|
||||
if ([coder containsValueForKey: @"NSStackViewBeginningContainer"])
|
||||
{
|
||||
_beginningContainer = [coder decodeObjectForKey: @"NSStackViewBeginningContainer"];
|
||||
ASSIGN(_beginningContainer, [coder decodeObjectForKey: @"NSStackViewBeginningContainer"]);
|
||||
NSLog(@"_beginningContainer = %@", _beginningContainer);
|
||||
}
|
||||
if ([coder containsValueForKey: @"NSStackViewMiddleContainer"])
|
||||
{
|
||||
_middleContainer = [coder decodeObjectForKey: @"NSStackViewMiddleContainer"];
|
||||
ASSIGN(_middleContainer, [coder decodeObjectForKey: @"NSStackViewMiddleContainer"]);
|
||||
}
|
||||
if ([coder containsValueForKey: @"NSStackViewEndContainer"])
|
||||
{
|
||||
_endContainer = [coder decodeObjectForKey: @"NSStackViewEndContainer"];
|
||||
ASSIGN(_endContainer, [coder decodeObjectForKey: @"NSStackViewEndContainer"]);
|
||||
}
|
||||
if ([coder containsValueForKey: @"NSStackViewDetachesHiddenViews"])
|
||||
{
|
||||
|
@ -627,7 +662,7 @@
|
|||
}
|
||||
if ([coder containsValueForKey: @"NSStackViewOrientation"])
|
||||
{
|
||||
_orientation = [coder decodeIntegerForKey: @"NSStackViewOrientation"];
|
||||
_orientation = [coder decodeIntForKey: @"NSStackViewOrientation"];
|
||||
}
|
||||
if ([coder containsValueForKey: @"NSStackViewSecondaryAlignment"])
|
||||
{
|
||||
|
@ -647,7 +682,7 @@
|
|||
}
|
||||
if ([coder containsValueForKey: @"NSStackViewdistribution"])
|
||||
{
|
||||
_distribution = [coder decodeIntegerForKey: @"NSStackViewdistribution"];
|
||||
_distribution = [coder decodeIntForKey: @"NSStackViewdistribution"];
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue