mirror of
https://github.com/gnustep/libs-steptalk.git
synced 2025-02-14 15:40:56 +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>
|
||||
|
||||
* Modules/AppKit/AppKitConstants.list: Remove obsolete NSDataLink
|
||||
|
|
|
@ -62,6 +62,9 @@
|
|||
|
||||
- (int)intValueAtIndex:(unsigned)index;
|
||||
- (float)floatValueAtIndex:(unsigned)index;
|
||||
|
||||
- extent:(NSSize)size;
|
||||
- corner:(NSPoint)corner;
|
||||
@end
|
||||
|
||||
/*
|
||||
|
|
|
@ -69,6 +69,15 @@
|
|||
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
|
||||
{
|
||||
const char *nameBeg, *nextType;
|
||||
|
@ -266,6 +275,38 @@
|
|||
[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 */
|
||||
|
||||
- (float)width
|
||||
|
|
1
TODO
1
TODO
|
@ -7,7 +7,6 @@ TODO list
|
|||
|
||||
HIGH PRIORITY
|
||||
|
||||
- implement NSRect object
|
||||
- Rewrite Smalltalk compiler (grammar)
|
||||
|
||||
Remove STBytecodeInterpreter and use only STCompiler. How?
|
||||
|
|
Loading…
Reference in a new issue