mirror of
https://github.com/gnustep/libs-steptalk.git
synced 2025-02-14 23:51:14 +00:00
New methods to construct rectangles from points and sizes.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/steptalk/trunk@34544 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
64fad794f3
commit
ceaed8ae36
4 changed files with 53 additions and 1 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2012-01-15 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||||
|
|
||||||
|
* Frameworks/StepTalk/STStructure.h:
|
||||||
|
* Frameworks/StepTalk/STStructure.m (+structureWithOrigin:size:,
|
||||||
|
extent:, corner:): New methods to construct rectangles from points
|
||||||
|
and sizes.
|
||||||
|
|
||||||
|
* TODO: Update.
|
||||||
|
|
||||||
2012-01-15 Wolfgang Lux <wolfgang.lux@gmail.com>
|
2012-01-15 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||||
|
|
||||||
* Modules/AppKit/AppKitConstants.list: Remove obsolete NSDataLink
|
* Modules/AppKit/AppKitConstants.list: Remove obsolete NSDataLink
|
||||||
|
|
|
@ -62,6 +62,9 @@
|
||||||
|
|
||||||
- (int)intValueAtIndex:(unsigned)index;
|
- (int)intValueAtIndex:(unsigned)index;
|
||||||
- (float)floatValueAtIndex:(unsigned)index;
|
- (float)floatValueAtIndex:(unsigned)index;
|
||||||
|
|
||||||
|
- extent:(NSSize)size;
|
||||||
|
- corner:(NSPoint)corner;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -69,6 +69,15 @@
|
||||||
return AUTORELEASE(str);
|
return AUTORELEASE(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ structureWithOrigin:(NSPoint)point size:(NSSize)size
|
||||||
|
{
|
||||||
|
NSRect rect;
|
||||||
|
STStructure *str;
|
||||||
|
rect = NSMakeRect(point.x, point.y, size.width, size.height);
|
||||||
|
str = [[self alloc] initWithValue:&rect type:@encode(NSRect)];
|
||||||
|
return AUTORELEASE(str);
|
||||||
|
}
|
||||||
|
|
||||||
- initWithValue:(void *)value type:(const char*)type
|
- initWithValue:(void *)value type:(const char*)type
|
||||||
{
|
{
|
||||||
const char *nameBeg, *nextType;
|
const char *nameBeg, *nextType;
|
||||||
|
@ -266,6 +275,38 @@
|
||||||
[fields replaceObjectAtIndex:1 withObject: [NSNumber numberWithFloat:y]];
|
[fields replaceObjectAtIndex:1 withObject: [NSNumber numberWithFloat:y]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- extent:(NSSize)size
|
||||||
|
{
|
||||||
|
NSRect rect;
|
||||||
|
rect = NSMakeRect([self x], [self y], size.width, size.height);
|
||||||
|
return [[self class] structureWithRect:rect];
|
||||||
|
}
|
||||||
|
|
||||||
|
- corner:(NSPoint)corner
|
||||||
|
{
|
||||||
|
NSRect rect;
|
||||||
|
rect = NSMakeRect([self x], [self y], 0, 0);
|
||||||
|
if (corner.x >= rect.origin.x)
|
||||||
|
{
|
||||||
|
rect.size.width = corner.x - rect.origin.x;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rect.size.width = rect.origin.x - corner.x;
|
||||||
|
rect.origin.x = corner.x;
|
||||||
|
}
|
||||||
|
if (corner.y >= rect.origin.y)
|
||||||
|
{
|
||||||
|
rect.size.height = corner.y - rect.origin.y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rect.size.height = rect.origin.y - corner.y;
|
||||||
|
rect.origin.y = corner.y;
|
||||||
|
}
|
||||||
|
return [[self class] structureWithRect:rect];
|
||||||
|
}
|
||||||
|
|
||||||
/* NSSize */
|
/* NSSize */
|
||||||
|
|
||||||
- (float)width
|
- (float)width
|
||||||
|
|
1
TODO
1
TODO
|
@ -7,7 +7,6 @@ TODO list
|
||||||
|
|
||||||
HIGH PRIORITY
|
HIGH PRIORITY
|
||||||
|
|
||||||
- implement NSRect object
|
|
||||||
- Rewrite Smalltalk compiler (grammar)
|
- Rewrite Smalltalk compiler (grammar)
|
||||||
|
|
||||||
Remove STBytecodeInterpreter and use only STCompiler. How?
|
Remove STBytecodeInterpreter and use only STCompiler. How?
|
||||||
|
|
Loading…
Reference in a new issue